Skip to content

Commit

Permalink
add numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqi-tori committed Jan 17, 2025
1 parent 4573de1 commit 11b40cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions city_metrix/layers/riparian_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -29,6 +29,7 @@
"scikit-image>=0.24.0",
"exactextract>=0.2.0",
"cfgrib",
"scipy"
"scipy",
"numpy"
],
)

0 comments on commit 11b40cb

Please sign in to comment.