-
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.
Renamed class property in compliance with stac standard. Implemented …
…test_layer_parameters in a manner intended to improve ease of code maintenance.
- Loading branch information
1 parent
6c66430
commit 1648974
Showing
14 changed files
with
197 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +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, scale_meters=10, **kwargs): | ||
def __init__(self, year=None, spatial_resolution=10, **kwargs): | ||
super().__init__(**kwargs) | ||
self.year = year | ||
self.scale_meters = scale_meters | ||
self.spatial_resolution = spatial_resolution | ||
|
||
def get_data(self, bbox): | ||
if self.year is None: | ||
|
@@ -40,7 +42,7 @@ def calculate_ndvi(image): | |
ndvi_mosaic = ndvi.qualityMosaic('NDVI') | ||
|
||
ic = ee.ImageCollection(ndvi_mosaic) | ||
ndvi_data = get_image_collection(ic, bbox, self.scale_meters, "NDVI") | ||
ndvi_data = get_image_collection(ic, bbox, self.spatial_resolution, "NDVI") | ||
|
||
xdata = ndvi_data.to_dataarray() | ||
|
||
|
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
Oops, something went wrong.