for key in initial_conditions.keys(): initial_condition = initial_conditions[key] q = initial_condition['q'] s_p = initial_condition['s_p'] s_t = initial_condition['s_t'] s_s = initial_condition['s_s'] fill_percent = np.repeat( [.99], n_dams4) #np.random.uniform(0,0.8,n_dams4).round(2)# S = (S_max * fill_percent).tolist() SSN5.set_dam_state(states=[1 for _ in range(n_dams4)]) SSN5.initialize(q=q, S=S, s_t=s_t, s_p=s_p, s_s=s_s) dc_passive_S4, st_passive_S4 = SSN5.Run_256([0, te], forcing, dam_params256) out_passive_S4 = SSN5.CalculateOutflow(dam_params256, st_passive_S4) temp1 = dc_passive_S4.max( ) #dc_passive_S4[dc_passive_S4.index>120].max() temp2 = out_passive_S4.max( ) #out_passive_S4[out_passive_S4.index>120].max() dc_passive_Peak_S4 = dc_passive_Peak_S4.append(temp1, ignore_index=True) out_passive_Peak_S4 = out_passive_Peak_S4.append(temp2, ignore_index=True) print( f'(Scenario-4)Storm:{dstorm} is simulated with given initial conditions!' )
SSN5.dam_ids = dams5 H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest = PrepareDamParams( dams5) dam_params256 = SSN5.init_dam_params256(H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest) q = initial_condition['q'] s_p = initial_condition['s_p'] s_t = initial_condition['s_t'] s_s = initial_condition['s_s'] fill_percent = np.repeat([0.0001], n_dams5) S = (S_max * fill_percent).tolist() SSN5.set_dam_state(states=[1 for _ in range(n_dams5)]) SSN5.initialize(q=q, S=S, s_t=s_t, s_p=s_p, s_s=s_s) dc_passive_S5, st_passive_S5 = SSN5.Run_256([0, te], forcing, dam_params256) out_passive_S5 = SSN5.CalculateOutflow(dam_params256, st_passive_S5) dc_passive_S5.to_csv( f'/Users/gurbuz/Supp_DamStudy/final_ActiveControl/dc_passive_{save_ext}.csv' ) st_passive_S5.to_csv( f'/Users/gurbuz/Supp_DamStudy/final_ActiveControl/st_passive_{save_ext}.csv' ) out_passive_S5.to_csv( f'/Users/gurbuz/Supp_DamStudy/final_ActiveControl/out_passive_{save_ext}.csv' ) print(f'Done passive in {time.time()-start}') ############################################################ start = time.time() print('Running Random..') SSN5_r = Watershed(Model=256)
te = len(forcing) - 1 for key in initial_conditions.keys(): initial_condition = initial_conditions[key] q = initial_condition['q'] s_p = initial_condition['s_p'] s_t = initial_condition['s_t'] s_s = initial_condition['s_s'] fill_percent = np.repeat( [.99], n_dams1) #()np.random.uniform(0,0.8,n_dams1).round(2) S = (S_max * fill_percent).tolist() SSN2.set_dam_state(states=[1 for _ in range(n_dams1)]) SSN2.initialize(q=q, S=S, s_t=s_t, s_p=s_p, s_s=s_s) dc_passive_S1, st_passive_S1 = SSN2.Run_256([0, te], forcing, dam_params256) out_passive_S1 = SSN2.CalculateOutflow(dam_params256, st_passive_S1) temp1 = dc_passive_S1.max( ) #dc_passive_S1[dc_passive_S1.index>120].max() temp2 = out_passive_S1.max( ) #out_passive_S1[out_passive_S1.index>120].max() dc_passive_Peak_S1 = dc_passive_Peak_S1.append(temp1, ignore_index=True) out_passive_Peak_S1 = out_passive_Peak_S1.append(temp2, ignore_index=True) print( f'(Scenario-1)Storm:{dstorm} is simulated with given initial conditions!' )