The longwave radiation component of RRTM 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.
The longwave radiation code is accessed using the LW class. The example below (see Example) shows a simple usage of the radiation code. The full documentation for the LW class is given in The LW Class.
Here is a simple example that can be found in the examples/basic.py:
import pyrrtm
import numpy
import scipy.io.netcdf
import pylab
# read in the data
nc = scipy.io.netcdf.netcdf_file('tests_data.nc', 'r')
tavel = nc.variables['tavel'][:] # layer average temperature
pavel = nc.variables['pavel'][:] # layer average pressure
tz = nc.variables['tz'][:] # level temperature
pz = nc.variables['pz'][:] # level pressure
co2 = nc.variables['co2'][:]
o3 = nc.variables['o3'][:]
h2o = nc.variables['h2o'][:]
nc.close()
# set up the radiation code
nlayers = len(tavel)
lw = pyrrtm.LW(nlayers)
lw.tavel = tavel
lw.pavel = pavel
lw.tz = tz
lw.pz = pz
lw.set_species('co2', co2, 'molecules/cm2')
lw.set_species('h2o', h2o, 'molecules/cm2')
lw.set_species('o3', o3, 'molecules/cm2')
# run the radiation code
output = lw.run()
# plot the result
pylab.figure(1)
pylab.clf()
pylab.plot(output.htr, pavel)
pylab.xlim(-4, 0)
pylab.ylim(1000, 0)
pylab.show()
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 longwave radiative transfer calculations. nlayers must be an integer and sets the number of layers in the model.
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 LW.pz and LW.tz, the layer average data LW.pavel and LW.tavel can be reconstructed assuming linear interpolation of temperature between levels. Therefore, if LW.pz and LW.tz are specified, LW.pavel and LW.tavel are not required and will be calculated automatically.
Similarly, given LW.pavel and LW.tavel, values for LW.pz and LW.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 LW.pz and LW.tz should be good enough for most purposes, but you should check that they are satisfactory before using them.
The surface temperature. A value of -1 means that the code will use tz[0] as the surface temperature.
Units : | Kelvin |
---|---|
Type : | float |
Surface emissivity. 0.0 would correspond to no long wave emission from the surface. 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: |
|
---|
Performs the radiative transfer using RRTM.
Returns: | An instance of the Output class. |
---|---|
Raises : | On an error in the RRTM code, raises an instance of RRTMError. |
The total upwelling flux (integrated over all bands) through each level.
Units : | W/m2 |
---|---|
Shape : | (nlayers + 1, ) |
The total downwelling flux (integrated over all bands) through each level.
Units : | W/m2 |
---|---|
Shape : | (nlayers + 1, ) |
The net flux through each level. Equal to totdflux + totuflux.
Units : | W/m2 |
---|---|
Shape : | (nlayers + 1, ) |
The heating rate for each layer.
Units : | K/day |
---|---|
Shape : | (nlayers, ) |
These arguments control the details of how the radiation calculation is performed.
0 for Lambertian reflection (default). 1 for specular reflection, where angle is equal to downwelling angle.
0 for no scattering. 1 for no scattering, but the calculation is performed using the DISORT code. 2 includes scattering but does not do anything as we have not allowed aerosols or clouds. Default is 0.
0, 1, 2 or 3. Controls the number of angles used by the radiation scheme as quadrature points if iscat = 0, or the number of streams if iscat = 1. The default is 2.