Rad_Factor = np.empty([365, grid.number_of_cells]) EP30 = np.empty([365, grid.number_of_cells ]) # 30 day average PET to determine season PET_threshold = 0 # Initializing PET_threshold to ETThresholddown ## Initializing inputs for Soil Moisture object grid['cell']['LiveLeafAreaIndex'] = 1.6 * np.ones(grid.number_of_cells) SM._SO = 0.59 * np.ones(grid.number_of_cells) # Initializing Soil Moisture #TG = np.array([104, 365, 365, 365, 365, 365])#365 # Growing season in days ## Calculate current time in years such that Julian time can be calculated current_time = 0 # Start from first day of June for i in range(0, 365): Rad.update(float(i) / 365.25) PET_Tree.update(float(i) / 365.25) PET_Shrub.update(float(i) / 365.25) PET_Grass.update(float(i) / 365.25) PET_[i] = [ PET_Grass._PET_value, PET_Shrub._PET_value, PET_Tree._PET_value, 0., PET_Shrub._PET_value, PET_Tree._PET_value ] Rad_Factor[i] = grid['cell']['RadiationFactor'] if i < 30: if i == 0: EP30[0] = PET_[0] else: EP30[i] = np.mean(PET_[:i], axis=0) else: EP30[i] = np.mean(PET_[i - 30:i], axis=0)
Rad_Factor = np.empty([365,grid.number_of_cells]) EP30 = np.empty([365, grid.number_of_cells]) # 30 day average PET to determine season PET_threshold = 0 # Initializing PET_threshold to ETThresholddown ## Initializing inputs for Soil Moisture object grid['cell']['LiveLeafAreaIndex'] = 1.6 * np.ones( grid.number_of_cells ) SM._SO = 0.59 * np.ones(grid.number_of_cells) # Initializing Soil Moisture Tg = 365 # Growing season in days ## Calculate current time in years such that Julian time can be calculated current_time = 0 # Start from first day of June for i in range(0,365): Rad.update( float(i)/365.25) PET_Tree.update( float(i)/365.25 ) PET_Shrub.update( float(i)/365.25 ) PET_Grass.update( float(i)/365.25 ) PET_[i] = [PET_Grass._PET_value, PET_Shrub._PET_value, PET_Tree._PET_value, 0., PET_Shrub._PET_value, PET_Tree._PET_value] Rad_Factor[i] = grid['cell']['RadiationFactor'] if i < 30: if i == 0: EP30[0] = PET_[0] else: EP30[i] = np.mean(PET_[:i],axis = 0) else: EP30[i] = np.mean(PET_[i-30:i], axis = 0) time_check = 0. # Buffer to store current_time at previous storm
# Sai Nudurupati and Erkan Istanbulluoglu- 16May2014 : # Example to use potential_evapotranspiration_field.py #import landlab from landlab import RasterModelGrid from landlab.components.radiation import Radiation from landlab.components.pet import PotentialEvapotranspiration import numpy as np import matplotlib.pyplot as plt from landlab.plot.imshow import imshow_grid 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 ) PET = PotentialEvapotranspiration( grid ) current_time = 0.56 rad.update( current_time ) PET.update( ConstantPotentialEvapotranspiration = 10.0 ) plt.figure(0) imshow_grid(grid,'RadiationFactor', values_at = 'cell', grid_units = ('m','m')) plt.figure(1) imshow_grid(grid,'PotentialEvapotranspiration', values_at = 'cell', grid_units = ('m','m')) plt.savefig('PET_test') plt.show()