def initialize(data, grid, grid1):
    """Initialize random plant type field.

    Plant types are defined as the following:

    *  GRASS = 0
    *  SHRUB = 1
    *  TREE = 2
    *  BARE = 3
    *  SHRUBSEEDLING = 4
    *  TREESEEDLING = 5
    """
    grid1.at_cell['vegetation__plant_functional_type'] = compose_veg_grid(
        grid1,
        percent_bare=data['percent_bare_initial'],
        percent_grass=data['percent_grass_initial'],
        percent_shrub=data['percent_shrub_initial'],
        percent_tree=data['percent_tree_initial'])

    # Assign plant type for representative ecohydrologic simulations
    grid.at_cell['vegetation__plant_functional_type'] = np.arange(6)
    grid1.at_node['topographic__elevation'] = np.full(grid1.number_of_nodes,
                                                      1700.)
    grid.at_node['topographic__elevation'] = np.full(grid.number_of_nodes,
                                                     1700.)
    precip_dry = PrecipitationDistribution(
        mean_storm_duration=data['mean_storm_dry'],
        mean_interstorm_duration=data['mean_interstorm_dry'],
        mean_storm_depth=data['mean_storm_depth_dry'])
    precip_wet = PrecipitationDistribution(
        mean_storm_duration=data['mean_storm_wet'],
        mean_interstorm_duration=data['mean_interstorm_wet'],
        mean_storm_depth=data['mean_storm_depth_wet'])

    radiation = Radiation(grid)
    pet_tree = PotentialEvapotranspiration(grid,
                                           method=data['PET_method'],
                                           MeanTmaxF=data['MeanTmaxF_tree'],
                                           delta_d=data['DeltaD'])
    pet_shrub = PotentialEvapotranspiration(grid,
                                            method=data['PET_method'],
                                            MeanTmaxF=data['MeanTmaxF_shrub'],
                                            delta_d=data['DeltaD'])
    pet_grass = PotentialEvapotranspiration(grid,
                                            method=data['PET_method'],
                                            MeanTmaxF=data['MeanTmaxF_grass'],
                                            delta_d=data['DeltaD'])
    soil_moisture = SoilMoisture(grid, **data)  # Soil Moisture object
    vegetation = Vegetation(grid, **data)  # Vegetation object
    vegca = VegCA(grid1, **data)  # Cellular automaton object

    # Initializing inputs for Soil Moisture object
    grid.at_cell['vegetation__live_leaf_area_index'] = (
        1.6 * np.ones(grid.number_of_cells))
    grid.at_cell['soil_moisture__initial_saturation_fraction'] = (
        0.59 * np.ones(grid.number_of_cells))

    return (precip_dry, precip_wet, radiation, pet_tree, pet_shrub, pet_grass,
            soil_moisture, vegetation, vegca)
Beispiel #2
0
def Initialize_(data, grid, grid1):
    # Plant types are defined as following:
    # GRASS = 0; SHRUB = 1; TREE = 2; BARE = 3;
    # SHRUBSEEDLING = 4; TREESEEDLING = 5
    # Initialize random plant type field
    grid1['cell']['vegetation__plant_functional_type'] = compose_veg_grid(
        grid1,
        percent_bare=data['percent_bare_initial'],
        percent_grass=data['percent_grass_initial'],
        percent_shrub=data['percent_shrub_initial'],
        percent_tree=data['percent_tree_initial'])
    # Assign plant type for representative ecohydrologic simulations
    grid['cell']['vegetation__plant_functional_type'] = np.arange(0, 6)
    grid1['node']['topographic__elevation'] = (1700. *
                                               np.ones(grid1.number_of_nodes))
    grid['node']['topographic__elevation'] = (1700. *
                                              np.ones(grid.number_of_nodes))
    PD_D = PrecipitationDistribution(
        mean_storm_duration=data['mean_storm_dry'],
        mean_interstorm_duration=data['mean_interstorm_dry'],
        mean_storm_depth=data['mean_storm_depth_dry'])
    PD_W = PrecipitationDistribution(
        mean_storm_duration=data['mean_storm_wet'],
        mean_interstorm_duration=data['mean_interstorm_wet'],
        mean_storm_depth=data['mean_storm_depth_wet'])
    Rad = Radiation(grid)
    PET_Tree = PotentialEvapotranspiration(grid,
                                           method=data['PET_method'],
                                           MeanTmaxF=data['MeanTmaxF_tree'],
                                           delta_d=data['DeltaD'])
    PET_Shrub = PotentialEvapotranspiration(grid,
                                            method=data['PET_method'],
                                            MeanTmaxF=data['MeanTmaxF_shrub'],
                                            delta_d=data['DeltaD'])
    PET_Grass = PotentialEvapotranspiration(grid,
                                            method=data['PET_method'],
                                            MeanTmaxF=data['MeanTmaxF_grass'],
                                            delta_d=data['DeltaD'])
    SM = SoilMoisture(grid, **data)  # Soil Moisture object
    VEG = Vegetation(grid, **data)  # Vegetation object
    vegca = VegCA(grid1, **data)  # Cellular automaton object

    # # Initializing inputs for Soil Moisture object
    grid['cell']['vegetation__live_leaf_area_index'] = (
        1.6 * np.ones(grid.number_of_cells))
    grid['cell']['soil_moisture__initial_saturation_fraction'] = (
        0.59 * np.ones(grid.number_of_cells))
    # Initializing Soil Moisture
    return PD_D, PD_W, Rad, PET_Tree, PET_Shrub, PET_Grass, SM, \
        VEG, vegca
Beispiel #3
0
pet_shrub = PotentialEvapotranspiration(grid, method='PenmanMonteith',
                albedo=data['albedo_shrub'], rl=data['rl_shrub'],
                zveg=data['zveg_shrub'], LAI=data['LAI_shrub'],
                zm=data['zm_shrub'], zh=data['zh_shrub'])
pet_tree = PotentialEvapotranspiration(grid, method='PenmanMonteith',
                albedo=data['albedo_tree'], rl=data['rl_tree'],
                zveg=data['zveg_tree'], LAI=data['LAI_tree'],
                zm=data['zm_tree'], zh=data['zh_tree'])

if runon_switch:
    (ordered_cells, grid2) = get_ordered_cells_for_soil_moisture(
            grid2, outlet_id=1449-(2*58)-2)
    grid.at_node['flow__receiver_node'] = (
            grid2.at_node['flow__receiver_node'])

SM = SoilMoisture(grid, ordered_cells=ordered_cells, **data)

VEG = Vegetation(grid, **data)    # Vegetation object

# Create arrays to store modeled data
## For modeled Radiation model
Rad_mod_NFS = np.zeros([days_n, grid.number_of_cells], dtype=float) # Total Short Wave Radiation
PET_mod_NFS = np.zeros([days_n, grid.number_of_cells], dtype=float) # Potential Evapotranspiration
AET_mod_NFS = np.zeros([days_n, grid.number_of_cells], dtype=float) # Actual Evapotranspiration
SM_mod_NFS = np.zeros([days_n, grid.number_of_cells], dtype=float)  # Soil Moisture Saturation Fraction
Rad_Factor = np.zeros([days_n, grid.number_of_cells], dtype=float)
AET_annual = np.zeros([4, grid.number_of_cells], dtype=float)  # mm - For annual AET ((actual)evapotranspiration)
P_annual = np.zeros([4, grid.number_of_cells], dtype=float)  # mm - For annual P (precipitation)
drainage_annual = np.zeros([4, grid.number_of_cells], dtype=float)
AET_over_P = np.zeros([4, grid.number_of_cells], dtype=float)  # AET/P ratio - annual
EP30 = np.zeros([days_n, grid.number_of_cells], dtype=float)  # 30 day moving average of PET - only for target cell
Beispiel #4
0
TrClim = mat_data['Tr']
PET_grass = mat_data['Ep']   # Penman Monteith data from file

# Create radiation, soil moisture and Vegetation objects
Rad = Radiation(grid)
PET_Tree = PotentialEvapotranspiration(grid1, method=data['PET_method'],
                                       MeanTmaxF=data['MeanTmaxF_tree'],
                                       DeltaD=data['DeltaD'])
PET_Shrub = PotentialEvapotranspiration(grid1, method=data['PET_method'],
                                        MeanTmaxF=data['MeanTmaxF_shrub'],
                                        DeltaD=data['DeltaD'])
PET_Grass = PotentialEvapotranspiration(grid1, method = data['PET_method'],
                                        MeanTmaxF=data['MeanTmaxF_grass'],
                                        DeltaD=data['DeltaD'])

SM = SoilMoisture(grid, runon_switch=0, **data)   # Soil Moisture object
VEG = Vegetation(grid, **data)    # Vegetation object
vegca = VegCA(grid1, **data)      # Cellular automaton object

##########
n = 3275 #data['n_short']   # Defining number of storms the model will be run
##########

## Create arrays to store modeled data
P = np.empty(n)    # Record precipitation
Tb = np.empty(n)    # Record inter storm duration
Tr = np.empty(n)    # Record storm duration
Time = np.empty(n) # To record time elapsed from the start of simulation

CumWaterStress = np.empty([n/50, grid1.number_of_cells]) # Cum Water Stress
CumWS = np.empty([n/50, grid.number_of_cells]) # Cum Water Stress of different plant types
def initialize(data, grid, grid1, grid2, elevation):
    """Initialize random plant type field.

    Plant types are defined as the following:

    *  GRASS = 0
    *  SHRUB = 1
    *  TREE = 2
    *  BARE = 3
    *  SHRUBSEEDLING = 4
    *  TREESEEDLING = 5
    """
    grid['cell']['vegetation__plant_functional_type'] = compose_veg_grid(
        grid,
        percent_bare=data['percent_bare_initial'],
        percent_grass=data['percent_grass_initial'],
        percent_shrub=data['percent_shrub_initial'],
        percent_tree=data['percent_tree_initial'])
    # Assign plant type for representative ecohydrologic simulations
    grid1.at_cell['vegetation__plant_functional_type'] = np.arange(6)
    grid1.at_node['topographic__elevation'] = np.full(grid1.number_of_nodes,
                                                      1700.)
    grid.at_node['topographic__elevation'] = elevation
    grid2.at_node['topographic__elevation'] = elevation
    if data['runon_switch']:
        (ordered_cells, grid2) = get_ordered_cells_for_soil_moisture(
            grid2, outlet_id=4877)  # hugo10mws: 1331 # 36704
        grid.at_node['flow__receiver_node'] = (
            grid2.at_node['flow__receiver_node'])
    else:
        ordered_cells = None
    precip_dry = PrecipitationDistribution(
        mean_storm_duration=data['mean_storm_dry'],
        mean_interstorm_duration=data['mean_interstorm_dry'],
        mean_storm_depth=data['mean_storm_depth_dry'],
        random_seed=None)
    precip_wet = PrecipitationDistribution(
        mean_storm_duration=data['mean_storm_wet'],
        mean_interstorm_duration=data['mean_interstorm_wet'],
        mean_storm_depth=data['mean_storm_depth_wet'],
        random_seed=None)
    radiation = Radiation(grid)
    rad_pet = Radiation(grid1)
    pet_tree = PotentialEvapotranspiration(grid1,
                                           method=data['PET_method'],
                                           MeanTmaxF=data['MeanTmaxF_tree'],
                                           delta_d=data['DeltaD'])
    pet_shrub = PotentialEvapotranspiration(grid1,
                                            method=data['PET_method'],
                                            MeanTmaxF=data['MeanTmaxF_shrub'],
                                            delta_d=data['DeltaD'])
    pet_grass = PotentialEvapotranspiration(grid1,
                                            method=data['PET_method'],
                                            MeanTmaxF=data['MeanTmaxF_grass'],
                                            delta_d=data['DeltaD'])
    soil_moisture = SoilMoisture(grid, ordered_cells=ordered_cells,
                                 **data)  # Soil Moisture object
    vegetation = Vegetation(grid, **data)  # Vegetation object
    vegca = VegCA(grid, **data)  # Cellular automaton object

    # # Initializing inputs for Soil Moisture object
    grid['cell']['vegetation__live_leaf_area_index'] = (
        1.6 * np.ones(grid.number_of_cells))
    grid['cell']['soil_moisture__initial_saturation_fraction'] = (
        0.59 * np.ones(grid.number_of_cells))
    # Initializing Soil Moisture
    return (precip_dry, precip_wet, radiation, rad_pet, pet_tree, pet_shrub,
            pet_grass, soil_moisture, vegetation, vegca, ordered_cells)