Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modis data clarification and CI fixes #497

Merged
merged 17 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/earthpy-data-subsets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ natural earth, including global roads, political boundaries, and populated
places. Finally, there are NEON Lidar data and insitu measurements for
SOAP and SJER sites.

cold-springs-modis-h5
cold-springs-modis-h4
---------------------

This dataset contains imagery from the Moderate Resolution Imaging Spectrometer
`(MODIS) <https://www.earthdatascience.org/courses/earth-analytics-python/multispectral-remote-sensing-modis/modis-remote-sensing-data-in-python/>`_
maintained by NASA. `The satellite data <https://figshare.com/articles/Earth_Analytics_Cold_Springs_Fire_Remote_Sensing_Data/6083210>`_
are for the 2016 Cold Springs fire near Nederland, CO. and are in h5 format.
are for the 2016 Cold Springs fire near Nederland, CO. and are in h4 format.

cold-springs-fire
-----------------

This dataset contains satellite and vector data for the
`2016 Cold Springs fire near Nederland, CO <https://figshare.com/articles/Earth_Analytics_Cold_Springs_Fire_Remote_Sensing_Data/6083210>`_.
The imagery used for this dataset comes from MODIS, National Agriculture
Imagery Program `(NAIP) <https://www.earthdatascience.org/courses/earth-analytics-python/multispectral-remote-sensing-in-python/naip-imagery-raster-stacks-in-python/#work-with-naip-data-in-python>`_
Imagery Program `(NAIP) <https://www.earthdatascience.org/courses/use-data-open-source-python/multispectral-remote-sensing/intro-naip/>`_
(provided by the US Department of Agriculture), and
Land-Use Satellite `(Landsat) <https://www.earthdatascience.org/courses/earth-analytics-python/multispectral-remote-sensing-in-python/landsat-bands-geotif-in-Python/>`_
(provided by the USGS).
Expand Down
2 changes: 1 addition & 1 deletion docs/get-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ You can access these data subsets by using:
>>> import earthpy as et
>>> # View all available data keys
>>> et.data.get_data()
Available Datasets: ['california-rim-fire', 'co-flood-extras', 'cold-springs-fire', 'cold-springs-modis-h5', 'colorado-flood', 'cs-test-landsat', 'cs-test-naip', 'ndvi-automation', 'spatial-vector-lidar', 'twitter-flood', 'vignette-elevation', 'vignette-landsat']
Available Datasets: ['california-rim-fire', 'co-flood-extras', 'cold-springs-fire', 'cold-springs-modis-h4', 'colorado-flood', 'cs-test-landsat', 'cs-test-naip', 'ndvi-automation', 'spatial-vector-lidar', 'twitter-flood', 'vignette-elevation', 'vignette-landsat']
>>> # Download data subset to your `$HOME/earth-analytics/data` directory
>>> data = et.data.get_data('cold-springs-fire', verbose=False)
2 changes: 1 addition & 1 deletion earthpy/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
".",
"zip",
),
"cold-springs-modis-h5": (
"cold-springs-modis-h4": (
"https://ndownloader.figshare.com/files/10960112",
".",
"zip",
Expand Down
4 changes: 1 addition & 3 deletions earthpy/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ def basic_geometry_gdf(basic_geometry):
-------
GeoDataFrame containing the basic_geometry polygon
"""
gdf = gpd.GeoDataFrame(
geometry=[basic_geometry], crs={"init": "epsg:4326"}
)
gdf = gpd.GeoDataFrame(geometry=[basic_geometry], crs="epsg:4326")
return gdf


Expand Down
27 changes: 8 additions & 19 deletions earthpy/tests/test_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ def point_gdf():
""" Create a point GeoDataFrame. """
pts = np.array([[2, 2], [3, 4], [9, 8], [-12, -15]])
gdf = gpd.GeoDataFrame(
[Point(xy) for xy in pts],
columns=["geometry"],
crs={"init": "epsg:4326"},
[Point(xy) for xy in pts], columns=["geometry"], crs="epsg:4326",
)
return gdf

Expand All @@ -24,9 +22,7 @@ def point_gdf():
def single_rectangle_gdf():
"""Create a single rectangle for clipping. """
poly_inters = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])
gdf = gpd.GeoDataFrame(
[1], geometry=[poly_inters], crs={"init": "epsg:4326"}
)
gdf = gpd.GeoDataFrame([1], geometry=[poly_inters], crs="epsg:4326")
gdf["attr2"] = "site-boundary"
return gdf

Expand All @@ -39,9 +35,7 @@ def larger_single_rectangle_gdf():
are returned when you clip polygons. This fixture is larger which
eliminates the slivers in the clip return."""
poly_inters = Polygon([(-5, -5), (-5, 15), (15, 15), (15, -5), (-5, -5)])
gdf = gpd.GeoDataFrame(
[1], geometry=[poly_inters], crs={"init": "epsg:4326"}
)
gdf = gpd.GeoDataFrame([1], geometry=[poly_inters], crs="epsg:4326")
gdf["attr2"] = ["study area"]
return gdf

Expand Down Expand Up @@ -69,9 +63,7 @@ def two_line_gdf():
""" Create Line Objects For Testing """
linea = LineString([(1, 1), (2, 2), (3, 2), (5, 3)])
lineb = LineString([(3, 4), (5, 7), (12, 2), (10, 5), (9, 7.5)])
gdf = gpd.GeoDataFrame(
[1, 2], geometry=[linea, lineb], crs={"init": "epsg:4326"}
)
gdf = gpd.GeoDataFrame([1, 2], geometry=[linea, lineb], crs="epsg:4326")
return gdf


Expand All @@ -80,7 +72,7 @@ def multi_poly_gdf(donut_geometry):
""" Create a multi-polygon GeoDataFrame. """
multi_poly = donut_geometry.unary_union
out_df = gpd.GeoDataFrame(
geometry=gpd.GeoSeries(multi_poly), crs={"init": "epsg:4326"}
geometry=gpd.GeoSeries(multi_poly), crs="epsg:4326"
)
out_df = out_df.rename(columns={0: "geometry"}).set_geometry("geometry")
out_df["attr"] = ["pool"]
Expand All @@ -97,8 +89,7 @@ def multi_line(two_line_gdf):
multiline_feat = two_line_gdf.unary_union
linec = LineString([(2, 1), (3, 1), (4, 1), (5, 2)])
out_df = gpd.GeoDataFrame(
geometry=gpd.GeoSeries([multiline_feat, linec]),
crs={"init": "epsg:4326"},
geometry=gpd.GeoSeries([multiline_feat, linec]), crs="epsg:4326",
)
out_df = out_df.rename(columns={0: "geometry"}).set_geometry("geometry")
out_df["attr"] = ["road", "stream"]
Expand All @@ -113,7 +104,7 @@ def multi_point(point_gdf):
gpd.GeoSeries(
[multi_point, Point(2, 5), Point(-11, -14), Point(-10, -12)]
),
crs={"init": "epsg:4326"},
crs="epsg:4326",
)
out_df = out_df.rename(columns={0: "geometry"}).set_geometry("geometry")
out_df["attr"] = ["tree", "another tree", "shrub", "berries"]
Expand All @@ -137,9 +128,7 @@ def test_returns_gdf(point_gdf, single_rectangle_gdf):
def test_non_overlapping_geoms():
"""Test that a bounding box returns error if the extents don't overlap"""
unit_box = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)])
unit_gdf = gpd.GeoDataFrame(
[1], geometry=[unit_box], crs={"init": "epsg:4326"}
)
unit_gdf = gpd.GeoDataFrame([1], geometry=[unit_box], crs="epsg:4326")
non_overlapping_gdf = unit_gdf.copy()
non_overlapping_gdf = non_overlapping_gdf.geometry.apply(
lambda x: shapely.affinity.translate(x, xoff=20)
Expand Down
6 changes: 3 additions & 3 deletions earthpy/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ def test_colorado_counties():
""" Check assumptions about county polygons. """
counties = gpd.read_file(eio.path_to_example("colorado-counties.geojson"))
assert counties.shape == (64, 13)
assert counties.crs == {"init": "epsg:4326"}
assert counties.crs == "epsg:4326"


def test_colorado_glaciers():
""" Check assumptions about glacier point locations. """
glaciers = gpd.read_file(eio.path_to_example("colorado-glaciers.geojson"))
assert glaciers.shape == (134, 2)
assert glaciers.crs == {"init": "epsg:4326"}
assert glaciers.crs == "epsg:4326"


def test_continental_divide_trail():
""" Check assumptions about Continental Divide Trail path. """
cdt = gpd.read_file(eio.path_to_example("continental-div-trail.geojson"))
assert cdt.shape == (1, 2)
assert cdt.crs == {"init": "epsg:4326"}
assert cdt.crs == "epsg:4326"


""" Tests for the EarthlabData class. """
Expand Down