Skip to content

Commit ae26e11

Browse files
committed
Touch up Wetlands
1 parent 229db3a commit ae26e11

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

utils/Wetlands.py

+11-12
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,15 @@ def overlay_sim_true(self, dtw_thresh=0.08, hrs_thresh=5185):
233233
df_subs['dry'] = df_subs.index.map(lambda x: df_dtw.loc[x, 'dry']
234234
if x in df_dtw.index.values else 1)
235235
n_wets = df_subs[df_subs['dry']<0].shape[0] + df_subs[df_subs['dry']==0].shape[0]
236+
236237
## converts dfs to matrix of wetland types
237238
## -2: inactive | -1: wetland (ccap) | 0: wetland(nonccap) | 1: upland
238-
mat_lows = res_base.fill_grid(df_subs.dry, fill_value=-2)
239-
mask_in_ccap = ~self.mask_wet & self.mask_z
240-
df_lows = pd.DataFrame(mat_lows.reshape(-1), columns=['type'])
239+
mat_lows = res_base.fill_grid(df_subs.dry, fill_value=-2)
240+
mask_in_ccap = ~self.mask_wet & self.mask_z
241+
df_lows = pd.DataFrame(mat_lows.reshape(-1), columns=['type'])
241242
df_lows['true'] = mask_in_ccap
242-
# return
243-
df_lows['sim'] = df_lows['type'].apply(lambda x: True if x == -1 or x == 0 else False)
243+
df_lows['sim'] = df_lows['type'].apply(lambda x: True if x == -1 or x == 0 else False)
244+
244245
## get rid of inactive cells
245246
df_lows = df_lows[df_lows['type']>-2]
246247

@@ -399,16 +400,14 @@ def dtw_wet_avg_ann(self):
399400
PATH_res = op.join(op.expanduser('~'), 'Google_Drive',
400401
'WNC', 'Wetlands_Paper', 'Results_Default')
401402
res = Wetlands(PATH_res, z_thresh=3.75)
402-
# res.optimize(increment=10)
403+
404+
### steps
403405
# res.make_indicator(dtw_inc=0.01, hrs_per=50, masked=True, seasonal=False)
404406
# res.apply_indicator(0.08, hrs_thresh=5182)
405-
res.check_performance()
406-
res.overlay_sim_true()
407+
# res.find_cells(0.08, hrs_thresh=5182)
408+
# res.plot_wets_drys()
409+
# res.overlay_sim_true()
407410

408411
## wetland masked, nonseasonal: dtw <= 0.08; hrs_thesh >=5182 ------- best
409412
## nonseasonal indicators: dtw < 0.05; hrs_thresh>4443
410413
## seasonal indicators : dtw < 0.17; hrs_thresh > 1211
411-
412-
# res.find_cells(0.08, hrs_thresh=5182)
413-
# res.plot_wets_drys()
414-
# print len(res.ts_day)

0 commit comments

Comments
 (0)