The shortwave radiation component of RRTM (rrtm_sw) is supported with the following restrictions:
These restrictions could probably be lifted relatively easily so please contact me if you are interested in helping to support these features. As I do not require these features so am not planning on implementing them myself.
The shortwave radiation code is accessed using the SW class. The example below (see Example) shows a simple usage of the radiation code. The full documentation for the SW class is given in The SW Class.
We assume that T, p, H2O and O3 are numpy arrays of equal length. The surface temperature is set as equal to T[0]. Shortwave radiative transfer is then performed as follows:
sw = pyrrtm.SW(len(T))
sw.tavel = T
sw.pavel = p
sw.set_species('H2O', H2O, 'mmr')
sw.set_species('co2', 0.000358, 'vmr')
sw.set_species('o3', O3, 'vmr')
output = sw.run()
The output object has the following members:
output.totuflux # Upward flux through each level (W/m2)
output.totdflux # Downward flux through each level (W/m2)
output.fnet # Net flux through each level (W/m2)
output.htr # Heating rate for each layer (K/day)
Each member is a numpy array.
Performs the shortwave radiative transfer calculations. The attributes and methods for SW are very similar to those for LW, the longwave radiation class.
The average temperature of each layer. The layers are specified in ascending order.
Units : | Kelvin |
---|---|
Shape : | (nlayers, ) |
The average pressure of each layer. The layers are specified in ascending order, so pavel[i] > pavel[i+1].
Units : | hPa |
---|---|
Shape : | (nlayers, ) |
The temperature at each level. Levels are specified in ascending order.
Units : | Kelvin |
---|---|
Shape : | (nlayers+1, ) |
The pressure at each level. The levels are specified in ascending order.
Units : | hPa |
---|---|
Shape : | (nlayers+1, ) |
Note
RRTM requires both layer average and level data for pressure and temperature.
Given the level data SW.pz and SW.tz, the layer average data SW.pavel and SW.tavel can be reconstructed assuming linear interpolation of temperature between levels. Therefore, if SW.pz and SW.tz are specified, SW.pavel and SW.tavel are not required and will be calculated automatically.
Similarly, given SW.pavel and SW.tavel, values for SW.pz and SW.tz can be reconstructed. However, this is not a well posed problem, and so the method used is heuristic, and looks for smooth profiles that are consistent with the layer average data. In these circumstances, the resulting profiles for SW.pz and SW.tz should be good enough for most purposes, but you should check that they are satisfactory before using them.
Surface emissivity, between 0 and 1. Note that here reflectance is defined as 1 - emissivity, and so albedo = 1 - semis (see rrtm_sw_instructions). Default is 1.0.
Gets a profile of the concentration of one of the chemical species.
Parameters: |
|
---|---|
Returns: | Array of shape (nlayers,) |
Sets a profile of one of the chemical species.
Parameters: |
|
---|
Julian day of the year, from 1 to 365. This is only used to calculate the Earth-Sun distance. 0 means that the code does not take into account the day and uses an average Earth-Sun distance. Default is 0.
Rescales the solar source. Default is 1.0 (no rescaling).
Solar zenith angle (degrees). Default is 0 degrees (overhead).