Created April 15, 2015
Collection of functions to calculate various physical parameters
@author: Scott Havens
smrf.envphys.phys.
idewpt
Calculate the dew point given the vapor pressure
- array of vapor pressure values in [Pa] (vp) –
dew point temperature [C] (see Dingman 2002).
rh2vp
Calculate the vapor pressure given the air temperature and relative humidity
ta – array of air temperature in [C]
rh – array of relative humidity from 0-100 [%]
vapor pressure
satvp
Calculate the saturation vapor pressure at the dew point temperature.
dwpt – array of dew point temperature in [C]
vapor_pressure
Created on Apr 15, 2015
@author: scott
smrf.envphys.precip.
adjust_for_undercatch
Adjusts the vector precip station data for undercatchment. Relationships should be added to catchment_ratio().
catchment_ratio()
- The station vector data in pandas series (p_vec) –
- The vector wind data (wind) –
- The vector air_temp data (temp) –
- A dictionary of station names and the type of correction to apply (sta_type) –
- station metadata TODO merge in the station_dict info to metadata (station_metadata) –
adj_precip - Adjust precip accoding to the corrections applied.
catchment_ratios
Point models for catchment ratios of the
dist_precip_wind
Redistribute the precip based on wind speed and direciton to account for drifting.
precip – distributed precip
precip_temp – precip_temp array
az – wind direction
dir_round_cell – from wind module
wind_speed – wind speed array
cell_maxus – max upwind slope from maxus file
tbreak – relative local slope from tbreak file
tbreak_direction – direction array from tbreak file
veg_type – user input veg types to correct
veg_factor – interception correction for veg types. ppt mult is multiplied by 1/veg_factor
numpy array of precip redistributed for wind
precip_drift
mkprecip
Follows the IPW command mkprecip
The precipitation phase, or the amount of precipitation falling as rain or snow, can significantly alter the energy and mass balance of the snowpack, either leading to snow accumulation or inducing melt [2] [3]. The precipitation phase and initial snow density are based on the precipitation temperature (the distributed dew point temperature) and are estimated after Susong et al (1999) [4]. The table below shows the relationship to precipitation temperature:
Min Temp
Max Temp
Percent snow
Snow density
[deg C]
[%]
[kg/m^3]
-Inf
-5
100
75
-3
-1.5
150
-0.5
175
0
200
0.5
25
250
Inf
- array of precipitation values [mm] (precipitation) –
- array of temperature values, use dew point temperature (temperature) – if available [degree C]
returns the percent snow and estimated snow density
storms
Calculate the decimal days since the last storm given a precip time series, percent snow, mass threshold, and time threshold
Will look for pixels where perc_snow > 50% as storm locations A new storm will start if the mass at the pixel has exceeded the masslimit, this ensures that the enough has accumulated
Will look for pixels where perc_snow > 50% as storm locations
limit, this ensures that the enough has accumulated
- precipitation values (precipitation) –
- precent of precipitation that was snow (perc_snow) –
- threshold for the mass to start a new storm (mass) –
- threshold for the time to start a new storm (time) –
- if specified, this is the output from a previous run (stormDays) – of storms
- keeps track of the total storm precip (stormPrecip) –
and the total precipitation for the storm
Created April 17, 2015 @author: Scott Havens
storms_time
time_step – step in days of the model run
- if specified, this is the output from a previous run (stormDays) – of storms else it will be set to the date_time value
Created Janurary 5, 2016 @author: Scott Havens
smrf.envphys.radiation.
albedo
Calculate the abedo, adapted from IPW function albedo
- time since last snow storm (telapsed) –
- cosine local solar illumination angle matrix (cosz) –
- gsize is effective grain radius of snow after last storm (gsize) –
- maxgsz is maximum grain radius expected from grain growth (maxgsz) –
- dirt is effective contamination for adjustment to visible albedo (dirt) –
Returns a tuple containing the visible and IR spectral albedo
alb_v (numpy.array) - albedo for visible specturm
alb_ir (numpy.array) - albedo for ir spectrum
tuple
beta_0
we find the integral-sum
sum (n=0 to inf) g^n * (2*n+1) * Pn(u0) * int (u’=0 to 1) Pn(u’)
note that int of Pn vanishes for even values of n (Abramowitz & Stegun, eq 22.13.8-9); therefore the series becomes
sum (n=0 to inf) g^n * (2*n+1) * Pn(u0) * f(m)
where 2*m+1 = n and the f’s are computed recursively
cosz – cosine illumination angle
g – scattering asymmetry param
cf_cloud
Correct beam and diffuse irradiance for cloud attenuation at a single time, using input clear-sky global and diffuse radiation calculations supplied by locally modified toporad or locally modified stoporad
beam – global irradiance
diffuse – diffuse irradiance
cf – cloud attenuation factor - actual irradiance / clear-sky irradiance
cloud corrected gobal irradiance c_drad: cloud corrected diffuse irradiance
c_grad
20150610 Scott Havens - adapted from cloudcalc.c
decay_alb_hardy
Find a decrease in albedo due to litter acccumulation using method from [21] with storm_day as input.
Where is the fractional litter coverage and is the daily litter rate of the forest. The new albedo is a weighted average of the calculated albedo for the clean snow and the albedo of the litter.
Note: uses input of l_rate (litter rate) from config which is based on veg type. This is decimal percent litter coverage per day
litter – A dictionary of values for default,albedo,41,42,43 veg types
veg_type – An image of the basin’s NLCD veg type
storm_day – numpy array of decimal day since last storm
alb_v – numpy array of albedo for visibile spectrum
alb_ir – numpy array of albedo for IR spectrum
alb_litter – albedo of pure litter
Returns a tuple containing the corrected albedo arrays based on date, veg type - alb_v (numpy.array) - albedo for visible specturm
Created July 19, 2017 Micah Sandusky
decay_alb_power
Find a decrease in albedo due to litter acccumulation. Decay is based on max decay, decay power, and start and end dates. No litter decay occurs before start_date. Fore times between start and end of decay,
Where is albedo, is the maximum decay for albedo, is the decay power, , , and are the current, start, and end times for the litter decay.
start_decay – date to start albedo decay (datetime)
end_decay – date at which to end albedo decay curve (datetime)
t_curr – datetime object of current timestep
pwr – power for power law decay
Created July 18, 2017 Micah Sandusky
deg_to_dms
Decimal degree to degree, minutes, seconds
find_horizon
get_hrrr_cloud
Take the combined solar from HRRR and use the two stream calculation at the specific HRRR pixels to find the cloud_factor.
- solar dataframe from hrrr (df_solar) –
- meta_data from hrrr (df_meta) –
- smrf logger (logger) –
- basin lat (lat) –
- basin lon (lon) –
df_cf - cloud factor dataframe in same format as df_solar input
growth
Calculate grain size growth From IPW albedo > growth
hor1f
BROKEN: Haven’t quite figured this one out
Calculate the horizon pixel for all x,z This mimics the algorthim from Dozier 1981 and the hor1f.c from IPW
Works backwards from the end but looks forwards for the horizon
xrange stops one index before [stop]
- horizontal distances for points (x) –
- elevations for the points (z) –
h - index to the horizon point
20150601 Scott Havens
hor1f_simple
Calculate the horizon pixel for all x,z This mimics the simple algorthim from Dozier 1981 to help understand how it’s working
Works backwards from the end but looks forwards for the horizon 90% faster than rad.horizon
hord
x - horizontal distances for points z - elevations for the points
ihorizon
Calculate the horizon values for an entire DEM image for the desired azimuth
Assumes that the step size is constant
- vector of x-coordinates (X) –
- vector of y-coordinates (Y) –
- matrix of elevation data (Z) –
- azimuth to calculate the horizon at (azm) –
- 0 -> calculate cos (mu) –
>0 -> calculate a mask whether or not the point can see the sun
if mask=1 index along line to the point
20150602 Scott Havens
model_solar
Model solar radiation at a point Combines sun angle, solar and two stream
- datetime object (dt) –
- latitude (lat) –
- longitude (lon) –
- optical depth (tau) –
- time zone (tzone) –
corrected solar radiation
mwgamma
gamma’s for phase function for input using the MEADOR WEAVER method
Two-stream approximations to radiative transfer in planetary atmospheres: a unified description of existing methods and a new improvement, Meador & Weaver, 1980
omega – single-scattering albedo
gamma values
shade
Calculate the cosize of the local illumination angle over a DEM
Solves the following equation cos(ts) = cos(t0) * cos(S) + sin(t0) * sin(S) * cos(phi0 - A)
t0 is the illumination angle on a horizontal surface phi0 is the azimuth of illumination S is slope in radians A is aspect in radians
Slope and aspect are expected to come from the IPW gradient command. Slope is stored as sin(S) with range from 0 to 1. Aspect is stored as radians from south (aspect 0 is toward the south) with range from -pi to pi, with negative values to the west and positive values to the east
slope – numpy array of sine of slope angles sin(S)
aspect – numpy array of aspect in radians from south
azimuth – azimuth in degrees to the sun -180..180 (comes from sunang)
cosz – cosize of the zeinith angle 0..1 (comes from sunang)
zenith – the solar zenith angle 0..90 degrees
At least on of the cosz or zenith must be specified. If both are specified the zenith is ignored
numpy matrix of the cosize of the local illumination angle cos(ts)
mu
The python shade() function is an interpretation of the IPW shade() function and follows as close as possible. All equations are based on Dozier & Frew, 1990. ‘Rapid calculation of Terrain Parameters For Radiation Modeling From Digitial Elevation Data,’ IEEE TGARS
20150106 Scott Havens
shade_thread
See shade for input argument descriptions
queue – queue with illum_ang, cosz, azimuth
date_time – loop through dates to accesss queue
20160325 Scott Havens
solar
Solar calculates exoatmospheric direct solar irradiance. If two arguments to -w are given, the integral of solar irradiance over the range will be calculated. If one argument is given, the spectral irradiance will be calculated.
If no wavelengths are specified on the command line, single wavelengths in um will be read from the standard input and the spectral irradiance calculated for each.
- [um um2] If two arguments are given, the integral of solar (w) – irradiance in the range um to um2 will be calculated. If one argument is given, the spectral irradiance will be calculated.
- date object, This is used to calculate the solar radius vector (d) – which divides the result
s - direct solar irradiance
solar_data
Solar data from Thekaekara, NASA TR-R-351, 1979
solar_ipw
Wrapper for the IPW solar function
20151002 Scott Havens
solint
integral of solar constant from wavelengths a to b in micometers
This uses scipy functions which will produce different results from the IPW equvialents of ‘akcoef’ and ‘splint’
sunang_ipw
Wrapper for the IPW sunang function
- date to calculate sun angle for (date) –
- latitude in decimal degrees (lat) –
- longitude in decimal degrees (lon) –
- The time values are in the time zone which is min minutes (zone) – west of Greenwich (default: 0). For example, if input times are in Pacific Standard Time, then min would be 480.
slope (default=0) –
aspect (default=0) –
cosz - cosine of the zeinith angle azimuth - solar azimuth
Created April 17, 2015 Scott Havens
twostream
Provides twostream solution for single-layer atmosphere over horizontal surface, using solution method in: Two-stream approximations to radiative transfer in planetary atmospheres: a unified description of existing methods and a new improvement, Meador & Weaver, 1980, or will use the delta-Eddington method, if the -d flag is set (see: Wiscombe & Joseph 1977).
cosz – The cosine of the incidence angle is cos (from program sunang). An error if cosz is <= 0.0; set all outputs to 0.0 and go on. Program will fail if incidence angle is <= 0.0, unless -0 has been set.
S0 – The direct beam irradiance is S0 This is usually the solar constant for the specified wavelength band, on the specified date, at the top of the atmosphere, from radiation.solar.
tau – The optical depth is tau. 0 implies an infinite optical depth.
omega – The single-scattering albedo
g – The asymmetry factor is g.
R0 – The reflectance of the substrate is R0. If R0 is negative, it will be set to zero.
R[0] - reflectance R[1] - transmittance R[2] - direct transmittance R[3] - upwelling irradiance R[4] - total irradiance at bottom R[5] - direct irradiance normal to beam
twostream_ipw
Wrapper for the twostream.c IPW function
- The cosine of the incidence angle is cos (mu0) –
- Do not force an error if mu0 is <= 0.0; set all outputs to 0.0 and (0) – go on. Program will fail if incidence angle is <= 0.0, unless -0 has been set.
- The optical depth is tau. 0 implies an infinite optical depth. (tau) –
- The single-scattering albedo is omega. (omega) –
- The asymmetry factor is g. (g) –
- The reflectance of the substrate is R0. If R0 is negative, it (R0) – will be set to zero.
- The direct beam irradiance is S0 This is usually the solar (S0) – constant for the specified wavelength band, on the specified date, at the top of the atmosphere, from program solar. If S0 is negative, it will be set to 1/cos, or 1 if cos is not specified.
- The delta-Eddington method will be used. (d) –
veg_beam
Apply the vegetation correction to the beam irradiance using the equation from Links and Marks 1999
S_b,f = S_b,o * exp[ -k h sec(theta) ] or S_b,f = S_b,o * exp[ -k h / cosz ]
20150610 Scott Havens
veg_diffuse
Apply the vegetation correction to the diffuse irradiance using the equation from Links and Marks 1999
S_d,f = tau * S_d,o
Created on March 14, 2017 Originally written by Scott Havens in 2015 @author: Micah Johnson
When creating a new NASDE model make sure you adhere to the following: Add a new method with the other models with a unique name ideally with some reference to the origin of the model. For example see susong1999(). Add the new model to the dictionary available_models at the bottom of this module so that calc_phase_and_density() can see it. Create a custom distribution function with a unique in distribute() to create the structure for the new model. For an example see distribute_for_susong1999(). Update documentation and run smrf!
When creating a new NASDE model make sure you adhere to the following:
Add a new method with the other models with a unique name ideally with some reference to the origin of the model. For example see susong1999().
susong1999()
Add the new model to the dictionary available_models at the bottom of this module so that calc_phase_and_density() can see it.
available_models
calc_phase_and_density()
Create a custom distribution function with a unique in distribute() to create the structure for the new model. For an example see distribute_for_susong1999().
distribute()
distribute_for_susong1999()
Update documentation and run smrf!
smrf.envphys.snow.
calc_perc_snow
Calculates the percent snow for the nasde_models piecewise_susong1999 and marks2017.
Tpp – A numpy array of temperature, use dew point temperature if available [degree C].
Tmax – Max temperature that the percent snow is estimated. Default is 0.0 Degrees C.
Tmin – Minimum temperature that percent snow is changed. Default is -10.0 Degrees C.
A fraction of the precip at each pixel that is snow provided by Tpp.
numpy.array
calc_phase_and_density
Uses various new accumulated snow density models to estimate the snow density of precipitation that falls during sub-zero conditions. The models all are based on the dew point temperature and the amount of precipitation, All models used here must return a dictionary containing the keywords pcs and rho_s for percent snow and snow density respectively.
temperature – a single timestep of the distributed dew point temperature
precipitation – a numpy array of the distributed precipitation
nasde_model – string value set in the configuration file representing the method for estimating density of new snow that has just fallen.
Returns a tuple containing the snow density field and the percent snow as determined by the NASDE model.
snow_density (numpy.array) - Snow density values in kg/m^3
perc_snow (numpy.array) - Percent of the precip that is snow in values 0.0-1.0.
check_temperature
Sets the precipitation temperature and snow temperature.
Tpp – A numpy array of temperature, use dew point temperature if available [degrees C].
Tmax – Thresholds the max temperature of the snow [degrees C].
Tmin – Minimum temperature that the precipitation temperature [degrees C].
is thresholded with a minimum set by tmin.
set by the precipitation temperature and thresholded by tmax where tsnow > tmax = tmax.
marks2017
A new accumulated snow density model that accounts for compaction. The model builds upon piecewise_susong1999() by adding effects from compaction. Of four mechanisms for compaction, this model accounts for compaction by destructive metmorphosism and overburden. These two processes are accounted for by calculating a proportionalility using data from Kojima, Yosida and Mellor. The overburden is in part estimated using total storm deposition, where storms are defined in tracking_by_station(). Once this is determined the final snow density is applied through the entire storm only varying with hourly temperature.
piecewise_susong1999()
tracking_by_station()
Tpp – Numpy array of a single hour of temperature, use dew point if available [degrees C].
pp – Numpy array representing the total amount of precip deposited during a storm in millimeters
rho_s (numpy.array) - Density of the fresh snow in kg/m^3.
swe (numpy.array) - Snow water equivalent.
snow in values 0.0-1.0.
is equivalent to the output from piecewise_susong1999().
compaction from overburden.
compaction from melt.
rho_s (numpy.array) - Final density of the snow [kg/m^3].
continuously ranges from low density snow to pure liquid water (50-1000 kg/m^3).
zs (numpy.array) - Snow height added from the precipitation.
dictionary
piecewise_susong1999
Follows susong1999() but is the piecewise form of table shown there. This model adds to the former by accounting for liquid water effect near 0.0 Degrees C.
The table was estimated by Danny Marks in 2017 which resulted in the piecewise equations below:
Percent Snow: Snow Density:
precip – A numpy array of precip in millimeters.
Tmax – Max temperature that snow density is modeled. Default is 0.0 Degrees C.
Tmin – Minimum temperature that snow density is changing. Default is -10.0 Degrees C.
check_temps – A boolean value check to apply special temperature constraints, this is done using check_temperature(). Default is True.
check_temperature()
in values 0.0-1.0.
susong1999
- numpy array of precipitation values [mm] (precipitation) –
- array of temperature values, use dew point temperature (temperature) –
available [degrees C] (if) –
rho_s (numpy.array) - Snow density values in kg/m^3.
smrf.envphys.storms.
clip_and_correct
Meant to go along with the storm tracking, we correct the data here by adding in the precip we would miss by ignoring it. This is mostly because will get rain on snow events when there is snow because of the storm definitions and still try to distribute precip data.
precip – Vector station data representing the measured precipitation
storms – Storm list with dictionaries as defined in tracking_by_station()
stations – Desired stations that are being used for clipping. If stations is not passed, then use all in the dataframe
The correct precip that ensures there is no precip outside of the defined storms with the clipped amount of precip proportionally added back to storms.
Created May 3, 2017 @author: Micah Johnson
precipitation – Precipitation values
perc_snow – Precent of precipitation that was snow
mass – Threshold for the mass to start a new storm
time – Threshold for the time to start a new storm
stormDays – If specified, this is the output from a previous run of storms
stormPrecip – Keeps track of the total storm precip
a pixel
the most recent storm
time_since_storm
perc_snow – Percent of precipitation that was snow
time_step – Step in days of the model run
stormDays – If specified, this is the output from a previous run of storms else it will be set to the date_time value
time_since_storm_basin
Calculate the decimal days since the last storm given a precip time series, days since last storm in basin, and if it is currently storming
Will assign uniform decimal days since last storm to every pixel
storm – current or most recent storm
last_storm_day_basin – time since last storm for the basin
stormid – ID of current storm
storming – if it is currently storming
time – current time
stormDays – unifrom days since last storm on pixel basis
unifrom days since last storm on pixel basis
stormDays
Created May 9, 2017 @author: Scott Havens modified by Micah Sandusky
time_since_storm_pixel
Calculate the decimal days since the last storm given a precip time series
Will assign decimal days since last storm to every pixel
dpt – dew point values
perc_snow – percent_snow values
storming – if it is stomring
ps_thresh – Threshold for percent_snow
days since last storm on pixel basis
Created October 16, 2017 @author: Micah Sandusky
tracking_by_basin
precipitation – precipitation values
time – Time step that smrf is on
time_steps_since_precip – time steps since the last precipitation
storm_lst –
list that store the storm cycles in order. A storm is recorded by its start and its end. The list is passed by reference and modified internally. Each storm entry should be in the format of: [{start:Storm Start, end:Storm End}]
[ {start:date_time1,end:date_time2}, {start:date_time3,end:date_time4}, ]
#would be a two storms
mass_thresh – mass amount that constitutes a real precip event, default = 0.0.
steps_thresh – Number of time steps that constitutes the end of a precip event, default = 2 steps (typically 2 hours)
storm_lst - updated storm_lst time_steps_since_precip - updated time_steps_since_precip is_storming - True or False whether the storm is ongoing or not
Created March 3, 2017 @author: Micah Johnson
tracking_by_station
Processes the vector station data prior to the data being distributed
[ {start:date_time1,end:date_time2,’BOG1’:100, ‘ATL1’:85}, {start:date_time3,end:date_time4,’BOG1’:50, ‘ATL1’:45}, ]
#would be a two storms at stations BOG1 and ATL1
mass_thresh – mass amount that constitutes a real precip event, default = 0.01.
mass accumulated, of given storm.
storm_count - A total number of storms found
Created April 24, 2017 @author: Micah Johnson
smrf.envphys.sunang.
dsign
modified from /usr/src/lib/libF77/d_sign.c
ephemeris
Calculates radius vector, declination, and apparent longitude of sun, as function of the given date and time.
The routine is adapted from:
Wilson, Solar ephemeris algorithm, Reference 80-13, 70
pp., Scripps Institution of Oceanography, University of California, San Diego, La Jolla, CA, 1980.
dt – date time python object
solar declination angle, in radians omega: sun longitude, in radians r: Earth-Sun radius vector
declin
leapyear
leapyear determines if the given year is a leap year or not. year must be positive, and must not be abbreviated; i.e. 89 is 89 A.D. not 1989.
year –
True if a leap year, False if not a leap year
numdays
numdays returns the number of days in the given month of the given year.
month –
number of days in month
ndays
rotate
Calculates new spherical coordinates if system rotated about origin. Coordinates are right-hand system. All angles are in radians.
mu – cosine of angle theta from z-axis in old coordinate system, sin(declination)
azm – azimuth (+ccw from x-axis) in old coordinate system, hour angle of sun (long. where sun is vertical)
mu_r – cosine of angle theta_r of rotation of z-axis, sin(latitude)
lam_r – azimuth (+ccw) of rotation of x-axis, longitude
cosine of the solar zenith aPrime: solar azimuth in radians
muPrime
sunang
Calculate the sun angle (the azimuth and zenith angles of the sun’s position) for a given geodetic location for a single date time and coordinates. The function can take either latitude longitude position as a single point or numpy array.
date_time – python datetime object
latitude – value or np.ndarray (in degrees)
longitude – value or np.ndarray (in degrees)
truncate – True will replicate the IPW output precision, not applied if position is an array
cosz - cosine of the zenith angle, same shape as input position azimuth - solar azimuth, same shape as input position rad_vec - Earth-Sun radius vector
sunang_thread
See sunang for input descriptions
queue – queue with cosz, azimuth
date – loop through dates to accesss queue, must be same as rest of queues
sunpath
Sun angle from solar declination and longtitude
latitude – in radians
longitude – in radians
declination – solar declination (radians)
omega – solar longitude (radians)
cosz: cosine of solar zenith azimuth: solar azimuth in radians
yearday
yearday returns the yearday for the given date. yearday is the ‘day of the year’, sometimes called (incorrectly) ‘julian day’.
day –
day of year
yday
The module contains various physics calculations needed for estimating the thermal radition and associated values.
smrf.envphys.thermal_radiation.
Angstrom1918
Estimate clear-sky downwelling long wave radiation from Angstrom (1918) [13] as cited by Niemela et al (2001) [14] using the equation:
Where is the vapor pressure.
ta – distributed air temperature [degree C]
ea – distrubted vapor pressure [kPa]
clear sky long wave radiation [W/m2]
20170509 Scott Havens
Crawford1999
Cloud correction is based on Crawford and Duchon (1999) [18]
where is the ratio of measured solar radiation to the clear sky irradiance.
th – clear sky thermal radiation [W/m2]
ta – temperature in Celcius that the clear sky thermal radiation was calcualted from [C]
cloud_factor – fraction of sky that are not clouds, 1 equals no clouds, 0 equals all clouds
cloud corrected clear sky thermal radiation
20170515 Scott Havens
Dilly1998
Estimate clear-sky downwelling long wave radiation from Dilley & O’Brian (1998) [11] using the equation:
Where is the air temperature and is the amount of precipitable water. The preipitable water is estimated as from Prata (1996) [12].
Garen2005
Cloud correction is based on the relationship in Garen and Marks (2005) [15] between the cloud factor and measured long wave radiation using measurement stations in the Boise River Basin.
Kimball1982
Cloud correction is based on Kimball et al. (1982) [17]
where the original Kimball et al. (1982) [17] was for multiple cloud layers, which was simplified to one layer. is the cloud temperature and is assumed to be 11 K cooler than .
Prata1996
Estimate clear-sky downwelling long wave radiation from Prata (1996) [12] using the equation:
Where is the amount of precipitable water. The preipitable water is estimated as from Prata (1996) [12].
Unsworth1975
Cloud correction is based on Unsworth and Monteith (1975) [16]
where
ta – temperature in Celcius that the clear sky thermal radiation was calcualted from [C] cloud_factor: fraction of sky that are not clouds, 1 equals no clouds, 0 equals all clouds
brutsaert
Calculate atmosphere emissivity from Brutsaert (1975):cite:Brutsaert:1975
ta – air temp (K)
l – temperature lapse rate (deg/m)
ea – vapor pressure (Pa)
z – elevation (z)
pa – air pressure (Pa)
atmosphericy emissivity
20151027 Scott Havens
calc_long_wave
Apply the Stephan-Boltzman equation for longwave
hysat
integral of hydrostatic equation over layer with linear temperature variation
pb – base level pressure
tb – base level temp [K]
L – lapse rate [deg/km]
h – layer thickness [km]
g – grav accel [m/s^2]
m – molec wt [kg/kmole]
hydrostatic results
precipitable_water
Estimate the precipitable water from Prata (1996) [12]
sati
saturation vapor pressure over ice. From IPW sati
tk – temperature in Kelvin
saturated vapor pressure over ice
satw
Saturation vapor pressure of water. from IPW satw
saturated vapor pressure over water
thermal_correct_canopy
Correct thermal radiation for vegitation. It will only correct for pixels where the veg height is above a threshold. This ensures that the open areas don’t get this applied. Vegitation temp is assumed to be at air temperature
th – thermal radiation
ta – air temperature [C]
tau – transmissivity of the canopy
veg_height – vegitation height for each pixel
height_thresh – threshold hold for height to say that there is veg in the pixel
corrected thermal radiation
Equations from Link and Marks 1999 [8]
20150611 Scott Havens
thermal_correct_terrain
Correct the thermal radiation for terrain assuming that the terrain is at the air temperature and the pixel and a sky view
viewf – sky view factor from view_f
topotherm
Calculate the clear sky thermal radiation. topotherm calculates thermal radiation from the atmosphere corrected for topographic effects, from near surface air temperature Ta, dew point temperature DPT, and elevation. Based on a model by Marks and Dozier (1979) :citeL`Marks&Dozier:1979`.
tw – dew point temperature [C]
z – elevation [m]
skvfac – sky view factor
Long wave (thermal) radiation corrected for terrain