Skip to content

Commit 0c4a9d3

Browse files
committed
Test indicator on nonwetlands
1 parent 272b018 commit 0c4a9d3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

utils/Wetlands.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,20 @@ def indicator_wets_only(self):
9797

9898
return
9999

100+
def apply_indicator(self):
101+
""" Test the indicator developed using indicator_wets_only on drys """
102+
### eventually return these from other func
103+
dtw_thresh = 0.301
104+
hrs_thresh = 7000
100105

106+
## get only dryland cells
107+
mask_wet = np.isnan(self.mat_wetlands.reshape(-1))
108+
mat_nonwet_dtw = self.mat_dtw[mask_wet]
109+
mat_dry_dtw = mat_nonwet_dtw[~np.isnan(mat_nonwet_dtw)].reshape(-1, mat_nonwet_dtw.shape[1])
101110

111+
# apply conditions
112+
result = ((mat_dry_dtw <= dtw_thresh).sum(axis=1) > hrs_thresh).sum()
113+
print (result)
102114

103115

104116
def optimize(self, increment=1):
@@ -216,4 +228,5 @@ def dtw_wet_avg_ann(self):
216228
'WNC', 'Wetlands_Paper', 'Results_Default')
217229
res = Wetlands(PATH_res)
218230
# res.optimize(increment=10)
219-
res.indicator_wets_only()
231+
# res.indicator_wets_only()
232+
res.apply_indicator()

0 commit comments

Comments
 (0)