示例#1
0
 SSN = Watershed(Model=256)
 SSN.init_custom(links=l_id,
                 connectivity=connectivity,
                 A_i=A_i,
                 L_i=L_i,
                 A_h=A_h)
 H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest = PrepareDamParams(
     dams5
 )  #!! TODO: make the code run without this parameters when no dam introduced
 dam_params256 = SSN.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']
 SSN.initialize(q=q, s_p=s_p, s_t=s_t, s_s=s_s)
 SSN.set_dam_state()
 dc_nodam, _ = SSN.Run_256(
     [0, te],
     forcing,
     dam_params256,
     rtol=1e-6,
 )
 dc_nodam.to_csv(
     f'/Users/gurbuz/Supp_DamStudy/final_ActiveControl/dc_nodam_{save_ext}.csv'
 )
 print(f'Done nodam in {time.time()-start}')
 ###################################################################################################
 start = time.time()
 print('Running Passive..')
 SSN5 = Watershed(Model=256)
示例#2
0
            H_max.append(5.0)
            diam.append(1.0)
            S_max.append(300000)
            L_spill.append(4.0)
            L_crest.append(10.0)

    # No dam scenario
    print('Running nodam case..')
    SSN1 = Watershed(Model=254)
    SSN1.init_custom(links=l_id,
                     connectivity=connectivity,
                     A_i=A_i,
                     L_i=L_i,
                     A_h=A_h)
    q, s_p, s_t, s_s = Set_InitialConditions(0.5, A_i[0], A_i)
    SSN1.initialize(q=q, s_p=s_p, s_t=s_t, s_s=s_s)
    dc_nodam = SSN1.Run_254(
        [0, te],
        forcing,
        rtol=1e-6,
    )

    #Passive Scenario
    print('Running passive case..')
    SSN2 = Watershed(Model=256)
    SSN2.init_custom(links=l_id,
                     connectivity=connectivity,
                     A_i=A_i,
                     L_i=L_i,
                     A_h=A_h)
    SSN2.dam_ids = dams
示例#3
0
            dstorm,
            24,
            rate=(0.01 * np.diff(rate10, prepend=0)).tolist(),
            timescale=30)
        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)