コード例 #1
0
# Sai Nudurupati and Erkan Istanbulluoglu- 16May2014 :
# Example to use potential_evapotranspiration_field.py

import landlab
from landlab import RasterModelGrid
from landlab.components.radiation.radiation_field import Radiation
from landlab.components.PET.potential_evapotranspiration_field import PotentialEvapotranspiration
import numpy as np
import matplotlib.pyplot as plt
from landlab.plot.imshow import imshow_field

grid = RasterModelGrid(100, 100, 20.0)
elevation = np.random.rand(grid.number_of_nodes) * 1000
grid.add_zeros("node", "Elevation", units="m")
grid["node"]["Elevation"] = elevation
rad = Radiation(grid)
PET = PotentialEvapotranspiration(grid)
current_time = 0.56
rad.update(current_time)
PET.update(ConstantPotentialEvapotranspiration=10.0)

plt.figure(0)
imshow_field(grid, "RadiationFactor", values_at="cell", grid_units=("m", "m"))

plt.figure(1)
imshow_field(grid, "PotentialEvapotranspiration", values_at="cell", grid_units=("m", "m"))
plt.savefig("PET_test")
plt.show()
コード例 #2
0
# Sai Nudurupati and Erkan Istanbulluoglu - 14May2014 :
# Example to use radiation_field.py

import landlab
from landlab import RasterModelGrid
from landlab.components.radiation.radiation_field import Radiation
import numpy as np
import matplotlib.pyplot as plt
from landlab.plot.imshow import imshow_field

grid = RasterModelGrid(100, 100, 20.)
elevation = np.random.rand(grid.number_of_nodes) * 1000
grid.add_zeros('node', 'Elevation', units='m')
grid['node']['Elevation'] = elevation
rad = Radiation(grid)
current_time = 0.56
rad.update(current_time)

plt.figure(0)
imshow_field(grid,
             'TotalShortWaveRadiation',
             values_at='cell',
             grid_units=('m', 'm'))
plt.show()
コード例 #3
0
grid1['cell']['VegetationType'] = np.random.randint(0,4,grid1.number_of_cells)
# Age of the plants is randomnly generated by the constructor of vegca
# component. Seedlings of shrubs and trees are determined by their age
# within the constructor as well. Hence the random vegetation type
# field is called for types GRASS, SHRUB, TREE and BARE only. -SN 10Mar15

grid['cell']['VegetationType'] = np.arange(0,6)

# Create radiation, soil moisture and Vegetation objects
PD_D = PrecipitationDistribution(mean_storm = data['mean_storm_dry'],  \
                    mean_interstorm = data['mean_interstorm_dry'],
                    mean_storm_depth = data['mean_storm_depth_dry'])
PD_W = PrecipitationDistribution(mean_storm = data['mean_storm_wet'],  \
                    mean_interstorm = data['mean_interstorm_wet'],
                    mean_storm_depth = data['mean_storm_depth_wet'])
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, data )   # Soil Moisture object
VEG = Vegetation( grid, data )    # Vegetation object
vegca = VegCA( grid1, data )      # Cellular automaton object

##########