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

CIF-260 layer riparian areas #112

Merged
merged 15 commits into from
Feb 25, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add numpy
weiqi-tori committed Jan 17, 2025
commit 11b40cba8cb2a6af30c3e38a3ad943f9e7c06200
5 changes: 2 additions & 3 deletions city_metrix/layers/riparian_areas.py
Original file line number Diff line number Diff line change
@@ -25,8 +25,7 @@ def __init__(self, spatial_resolution=30, river_head=1000, thresh=0, **kwargs):

def get_data(self, bbox):
# read HAND data to generate drainage paths
hand = HeightAboveNearestDrainage(
spatial_resolution=self.spatial_resolution, river_head=self.river_head, thresh=self.thresh).get_data(bbox)
hand = HeightAboveNearestDrainage(spatial_resolution=self.spatial_resolution, river_head=self.river_head, thresh=self.thresh).get_data(bbox)

# Read surface water occurance
water = ee.Image('JRC/GSW1_3/GlobalSurfaceWater').select(['occurrence']).gte(50)
@@ -37,7 +36,7 @@ def get_data(self, bbox):
"water"
).occurrence

combWater = xr.ufuncs.maximum(hand.fillna(0), water_da.fillna(0)) > 0
combWater = np.maximum(hand.fillna(0), water_da.fillna(0)) > 0
combWater = combWater.fillna(False)

# Buffer waterways by riparian zone definitions
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -29,5 +29,6 @@ dependencies:
- exactextract=0.2.0
- cfgrib=0.9.15.0
- scipy=1.13.1
- numpy=1.23.0
- pip:
- overturemaps==0.6.0
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
"scikit-image>=0.24.0",
"exactextract>=0.2.0",
"cfgrib",
"scipy"
"scipy",
"numpy"
],
)