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
sorted(Vegetation.input_var_names)

# The vegetation dynamics model has a running average of 30-day PET used to detect the beginning and end of the growing season. For example when the 30-day average PET is lower than a threshold growth stops.
# Here we will use the 30-day avarege PET the same as the calculated PET earlier for simplicity.

watershed['cell'][
    'surface__potential_evapotranspiration_30day_mean'] = watershed['cell'][
        'surface__potential_evapotranspiration_rate']

# Construction of the Vegetation class includes the default varaibles for central New Mexico conditions which can be found in the link below:
# http://landlab.readthedocs.io/en/latest/landlab.components.single_vegetation.html
#
# Default parameter values can be changed by including them in the instantiation of the component below. Here you can set the initial live and dead vegetaiton biomass and simulate change (growth or decay) during Tb. Unit of biomass is gr Dry Matter per m2

Veg = Vegetation(watershed,
                 Blive_init=initial_live_biomass,
                 Bdead_init=initial_dead_biomass)
Veg.update(Tb=Tb * 24.)
sorted(Vegetation.output_var_names)

# Now let's map (and print as needed) outputs from the soil moisture and vegetation models: live biomass, LAI of live plants, total loss of ET and leakage from the bottom of the root-zone for the entire duration (Tb) of the model run.

imshow_grid(watershed, 'vegetation__live_biomass', values_at='cell')
plt.show()
watershed['cell']['vegetation__live_biomass']

imshow_grid(watershed, 'vegetation__live_leaf_area_index', values_at='cell')
plt.show()

imshow_grid(watershed, 'surface__evapotranspiration', values_at='cell')
plt.show()
Beispiel #4
0
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
VegType = np.empty([n/50, grid1.number_of_cells],dtype = int)
Beispiel #5
0
                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
pet_thresh_n = np.zeros(days_n)  # record PET_threshold - growing season trigger
LAI_live_mod_NFS = np.zeros([days_n, grid.number_of_cells], dtype=float)
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)