Example #1
0
 def __init__(
     self
 ):  #elong_ratio increases with tectonic activity (To explore with SergioRest?).
     X = np.loadtxt(
         'doct_topol/Topol_X.txt'
     )  #, dtype = {'formats': } !!deprec:fmt= ' '.join(['%1.1f']*2 + ['%i']*3 + ['%1.3f'] + ['%i']*2))
     ampl_X = 3
     X[:, 0:1 +
       1] = ampl_X * X[:, 0:1 +
                       1]  #as Topol_X.txt saved initial reach points (1st 2 cols of X matrix) with precision: float with 1 decimal.
     #also bresenham algorithm demands integer inputs (extreme points of straight line).
     #        print('X= ', X)
     self.X = X
     param_dict = rpfd.readParam('param_dict.txt')
     A_hs = float(param_dict['A_hs'])
     L_reach = X[:, 6]
     self.L_hs = np.round(A_hs / (2 * L_reach))
     self.lhlr = self.L_hs / L_reach
     #        print('L_reach= ', L_reach)
     #        print('L_hs= ', self.L_hs)
     #        print('lhlr= ', self.lhlr)
     self.t_ev = np.loadtxt('doct_rain/t_ev.txt')
     self.Px0 = np.loadtxt('doct_rain/Px_day' + str(int(self.t_ev[0])) +
                           '.txt')
     self.Px0_sh = self.Px0.shape  #1st and 2nd components say rows/y/northing and columns/x/easting lenght respectively.
Example #2
0
    def __init__(self, realBasin_else_fict, flume_else_basin, which_flume):
        pd = rpfd.readParam('param_dict.txt')
        #call spatial topology
        if flume_else_basin == 1:
            Sof = .02  #maria: .022
            L_flume = 1 * 9.  #maria: 12
            Sof = float(pd['Sof'])
            L_flume = float(pd['L_flume'])
            self.Wflume = float(pd['Wflume'])
            self.dx_flume = float(pd['dx_flume'])

            self.amplif_D = 1  #for sensitivity analysis in 3rd paper with Marwan, comparing flume and numeric model of lateral input channel.

            repos_angle_ini = 30.
            base_level = .2
            triangl_base = self.Wflume / 2.
            rectang_store = base_level * self.Wflume * L_flume
            triang_store = .5 * triangl_base**2 * np.tan(
                3.14 / 180 * repos_angle_ini) * L_flume
            self.ini_store_m3 = 2 * triang_store + rectang_store
            self.ini_store = 2650 * (1 - .3) * self.ini_store_m3
            #            print('rectang_store[m3]', rectang_store, 'triang_store', triang_store, 'ini_store[kg_sed]', self.ini_store)

            n_nodes = int(L_flume / self.dx_flume)  #L must be multiple of dx
            self.serial_topol(which_flume, n_nodes, self.dx_flume,
                              Sof)  #5mar20: self.X=
            print('5mar20, guardó?')
        elif realBasin_else_fict == 1:
            yyy = 1
        else:  #toy basin
            #
            #            stoch_rain=1
            #            rain_fileName='P36500steps.txt'
            #            wash_flag=1
            #            print('param_dict= ', pd)

            self.A_hs = float(pd['A_hs'])  #4e6    #'hillslope' (subbasin) area
            print('27jul20; A_hs: ', self.A_hs)
            self.elong_ratio = float(pd['elong_ratio'])
            #            print('from dict, elong_ratio= ', self.elong_ratio)
            self.Omega = int(pd['Omega'])
            #            self.Omega=3    #order of drainage network at outlet
            offset_angle_degrees = 0

            self.pars_wv_A = lsf.f(pd['fluv_wv_A'])
            self.pars_wc_A = lsf.f(pd['fluv_wc_A'])
            self.Sor_A = lsf.f(pd['fluv_rock_S_A'])  #25may20

            self.X = self.fictNetwork(
                1., 2., offset_angle_degrees
            )  #15jun20; a,c values  below eq 5 in mesaGupta14.

            nR = len(self.X[:, 0])  #number of reaches
            print('X= ', self.X)
Example #3
0
    def __init__(self):
        pd = rpfd.readParam('param_dict.txt')
        flags = lsf.f(pd['flags'])
        prt_wdw = lsf.f(pd['print_range'])
        prt_ddt = lsf.f(pd['prt_rg_ddt'])
        self.fl_fw = lsf.f(pd['fluv_wlogist'])
        self.fl_fwqsy = lsf.f(pd['fluv_wqsy'])
        self.HGelseFract = flags[6]
        self.flume_else_basin = flags[0]

        if self.flume_else_basin == 0:
            tr = lsf.f(pd['temp_resol'])
            self.dt_dQ_coarse = int(tr[0])
        else:
            self.dt_dQ_coarse = pd['dt_dQ_coarse_flume']
        ti = time.time()
        self.runFluvialModel(prt_wdw, prt_ddt, flags, pd)
        tf = time.time()
        t = self.sci([tf - ti], 1)[0]
        print('----------------------------')
        print(f'in supply2Fluvial.py, method runFluvialModel lasts {t}s')
Example #4
0
import numpy as np

import readParamFromDict as rpfd
import Ptx2supply as s
import FolderCleaner as fc
import list_str2float as lsf

fc.cleanFolder(
    'doct_supply/supply_wat_sed'
)  #dedeprec by 27jun20, to clean old Qh figs as they are titled with Qm so no updated.

Ptx = np.loadtxt(
    'doct_supply/PperSubb/P_tx.txt')  #produced by topolPlusRain_PperSubb.py
pd = rpfd.readParam('param_dict.txt')
n = [
    'dT_days', 'A_hs', 'elong_ratio', 'hgy', 'geotech', 'geotech2',
    'weath_coefPerD', 'weath_xrefPerD', 'print_range', 'flags'
]
s.lumped(Ptx, int(pd[n[0]]), float(pd[n[1]]), float(pd[n[2]]), lsf.f(pd[n[3]]), lsf.f(pd[n[4]]), \
    lsf.f(pd[n[5]]), lsf.f(pd[n[6]]), lsf.f(pd[n[7]]), lsf.f(pd[n[8]]), lsf.f(pd[n[9]]))