-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from wri/CIF-197-CORE-Resolution-option-for-la…
…yer-downloads Cif 197 core resolution option for layer downloads
- Loading branch information
Showing
28 changed files
with
540 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,18 @@ | |
class NdviSentinel2(Layer): | ||
"""" | ||
NDVI = Sentinel-2 Normalized Difference Vegetation Index | ||
param: year: The satellite imaging year. | ||
Attributes: | ||
year: The satellite imaging year. | ||
spatial_resolution: raster resolution in meters (see https://github.com/stac-extensions/raster) | ||
return: a rioxarray-format DataArray | ||
Author of associated Jupyter notebook: [email protected] | ||
Notebook: https://github.com/wri/cities-cities4forests-indicators/blob/dev-eric/scripts/extract-VegetationCover.ipynb | ||
Reference: https://en.wikipedia.org/wiki/Normalized_difference_vegetation_index | ||
""" | ||
def __init__(self, year=None, **kwargs): | ||
def __init__(self, year=None, spatial_resolution=10, **kwargs): | ||
super().__init__(**kwargs) | ||
self.year = year | ||
self.spatial_resolution = spatial_resolution | ||
|
||
def get_data(self, bbox): | ||
if self.year is None: | ||
|
@@ -39,8 +42,7 @@ def calculate_ndvi(image): | |
ndvi_mosaic = ndvi.qualityMosaic('NDVI') | ||
|
||
ic = ee.ImageCollection(ndvi_mosaic) | ||
ndvi_data = get_image_collection(ic, bbox, 10, "NDVI") | ||
ndvi_data = (get_image_collection(ic, bbox, self.spatial_resolution, "NDVI") | ||
.NDVI) | ||
|
||
xdata = ndvi_data.to_dataarray() | ||
|
||
return xdata | ||
return ndvi_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.