Ejemplo n.º 1
0
    def FW1(Model,ll_temp=None, q_0=None):
        """
        ====================================================
            FW1(Model,ll_temp=None, q_0=None)
        ====================================================
        FW1 connects two module :
            1- The distributed rainfall-runoff module
            2- Triangular function-1 routing method
        Parameters
        ----------
        Model : TYPE
            DESCRIPTION.
        ll_temp : TYPE, optional
            DESCRIPTION. The default is None.
        q_0 : TYPE, optional
            DESCRIPTION. The default is None.

        Returns
        -------
        None.

        """

        # subcatchment
        distrrm.RunLumpedRRM(Model)

        distrrm.DistMaxbas1(Model)

        qlz1 = np.array([np.nansum(Model.qlz[:,:,i]) for i in range(Model.TS)]) # average of all cells (not routed mm/timestep)
        quz1 = np.array([np.nansum(Model.quz[:,:,i]) for i in range(Model.TS)]) # average of all cells (routed mm/timestep)

        Model.qout = qlz1 + quz1

        Model.qout = Model.qout[:-1]
Ejemplo n.º 2
0
    def FW1Withlake(Model, Lake,ll_temp=None, q_0=None):
        """
        ==============================================================
               FW1Withlake(Model, Lake,ll_temp=None, q_0=None)
        ==============================================================

        FW1 connects two module :
            1- The distributed rainfall-runoff module
            2- Triangular function-1 routing method
            3- Lake module

        Parameters
        ----------
        Model : TYPE
            DESCRIPTION.
        Lake : TYPE
            DESCRIPTION.
        ll_temp : TYPE, optional
            DESCRIPTION. The default is None.
        q_0 : TYPE, optional
            DESCRIPTION. The default is None.

        Returns
        -------
        None.

        """

        plake = Lake.MeteoData[:,0]
        et = Lake.MeteoData[:,1]
        t = Lake.MeteoData[:,2]
        tm = Lake.MeteoData[:,3]

        # lake simulation
        Lake.Qlake, _ = hbv_lake.simulate(plake, t, et, Lake.Parameters,
                                      [Model.Timef, Lake.CatArea, Lake.LakeArea],
                                      Lake.StageDischargeCurve, 0,
                                      init_st=Lake.InitialCond,
                                      ll_temp=tm, lake_sim=True)

        # qlake is in m3/sec
        # lake routing
        Lake.QlakeR = routing.muskingum(Lake.Qlake, Lake.Qlake[0], Lake.Parameters[11],
                                  Lake.Parameters[12], Model.Timef)

        # subcatchment
        distrrm.RunLumpedRRM(Model)

        distrrm.DistMAXBAS(Model)

        qlz1 = np.array([np.nansum(Model.qlz[:,:,i]) for i in range(Model.Parameters.shape[2]+1)]) # average of all cells (not routed mm/timestep)
        quz1 = np.array([np.nansum(Model.quz[:,:,i]) for i in range(Model.Parameters.shape[2]+1)]) # average of all cells (routed mm/timestep)

        qout = qlz1 + quz1

        # qout = (qlz1 + quz1) * Model.CatArea / (Model.Timef* 3.6)

        Model.qout = qout[:-1] + Lake.QlakeR
Ejemplo n.º 3
0
    def RRMWithlake(Model, Lake,ll_temp=None, q_0=None):
        """
        ============================================================
            RRMWithlake(Model, Lake,ll_temp=None, q_0=None)
        ============================================================
        RRMWithlake connects three modules the lake, the distributed
        ranfall-runoff module and spatial routing module

        Parameters
        ----------
        Model : [Catchment object]
            DESCRIPTION.
        Lake : TYPE
            DESCRIPTION.
        ll_temp : TYPE, optional
            DESCRIPTION. The default is None.
        q_0 : TYPE, optional
            DESCRIPTION. The default is None.

        Returns
        -------
        None.

        """

        plake = Lake.MeteoData[:,0]
        et = Lake.MeteoData[:,1]
        t = Lake.MeteoData[:,2]
        tm = Lake.MeteoData[:,3]

        # lake simulation
        Lake.Qlake, _ = hbv_lake.simulate(plake, t, et, Lake.Parameters,
                                      [Model.Timef, Lake.CatArea, Lake.LakeArea],
                                      Lake.StageDischargeCurve, 0,
                                      init_st=Lake.InitialCond,
                                      ll_temp=tm, lake_sim=True)
        # qlake is in m3/sec
        # lake routing
        Lake.QlakeR = routing.Muskingum_V(Lake.Qlake, Lake.Qlake[0], Lake.Parameters[11],
                                  Lake.Parameters[12], Model.Timef)

        # subcatchment
        distrrm.RunLumpedRRM(Model)

        # routing lake discharge with DS cell k & x and adding to cell Q
        qlake = routing.Muskingum_V(Lake.QlakeR,Lake.QlakeR[0],
                                   Model.Parameters[Lake.OutflowCell[0],Lake.OutflowCell[1],10],
                                   Model.Parameters[Lake.OutflowCell[0],Lake.OutflowCell[1],11],
                                   Model.Timef)

        qlake = np.append(qlake,qlake[-1])
        # both lake & Quz are in m3/s
        Model.quz[Lake.OutflowCell[0],Lake.OutflowCell[1],:] = Model.quz[Lake.OutflowCell[0],Lake.OutflowCell[1],:] + qlake

        # run the GIS part to rout from cell to another
        distrrm.SpatialRouting(Model)
Ejemplo n.º 4
0
    def RRMModel(Model, ll_temp=None, q_0=None):
        """
        =======================================================================
          Dist_model(DEM,flow_acc,flow_direct,sp_prec,sp_et,sp_temp,sp_par,p2,kub,klb,init_st,ll_temp,q_0)
        =======================================================================
            HapiModel connect two modules :
            1- The distributed rainfall runoff: model runs separately for each cell
            2- The Spatial routing scheme (routing is following river network)

        Inputs:
        ----------
            1-DEM:
                [gdal.dataset] DEM raster file of the catchment (clipped to the catchment only)
            2-flow_acc:
                [gdal.dataset] flow accumulation raster file of the catchment (clipped to the catchment only)
            3-flow_direct:
                [gdal.dataset] flow Direction raster file of the catchment (clipped to the catchment only)
            4-sp_prec:
                [numpy array] 3d array of the precipitation data, sp_prec should
                have the same 2d dimension of raster input
            5-sp_et:
                [numpy array] 3d array of the evapotranspiration data, sp_et should
                have the same 2d dimension of raster input
            6-sp_temp:
                [numpy array] 3d array of the temperature data, sp_temp should
                have the same 2d dimension of raster input
            7-sp_par:
                [numpy array] number of 2d arrays of the catchment properties spatially
                distributed in 2d and the third dimension is the number of parameters,
                sp_pars should have the same 2d dimension of raster input
            8-p2:
                [List] list of unoptimized parameters
                p2[0] = tfac, 1 for hourly, 0.25 for 15 min time step and 24 for daily time step
                p2[1] = catchment area in km2
            9-kub:
                [float] upper bound of K value (traveling time in muskingum routing method)
            10-klb:
                [float] Lower bound of K value (traveling time in muskingum routing method)
            11-init_st:
                [list] initial state variables values [sp, sm, uz, lz, wc]. default=None
            12-ll_temp:
                [numpy array] 3d array of the long term average temperature data
            13-q_0:
                [float] initial discharge m3/s

        Outputs:
        ----------
            1-statevariables:
                [numpy ndarray] 4D array (rows,cols,time,states) states are [sp,wc,sm,uz,lv]
            2-qlz:
                [numpy ndarray] 3D array of the lower zone discharge
            3-quz:
                [numpy ndarray] 3D array of the upper zone discharge
            4-qout:
                [numpy array] 1D timeseries of discharge at the outlet of the catchment
                of unit m3/sec
            5-quz_routed:
                [numpy ndarray] 3D array of the upper zone discharge  accumulated and
                routed at each time step
            6-qlz_translated:
                [numpy ndarray] 3D array of the lower zone discharge translated at each time step
        """
        # run the rainfall runoff model separately
        distrrm.RunLumpedRRM(Model)

        # run the GIS part to rout from cell to another
        distrrm.SpatialRouting(Model)