The shortwave radiation component of RRTM (rrtm_sw) is supported with the following restrictions:

• Specified temperature and pressure profiles, so IATM = 0
• No clouds, so ICLD = 0
• No aerosols, so IAER = 0
• Output fluxes only for 10-3250 cm-1, so IOUT = 0

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.

## Example¶

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.

## The SW Class¶

class SW(nlayers)

Performs the shortwave radiative transfer calculations. The attributes and methods for SW are very similar to those for LW, the longwave radiation class.

### The Profile of Temperature and Pressure¶

SW.tavel

The average temperature of each layer. The layers are specified in ascending order.

Units : Kelvin (nlayers, )
SW.pavel

The average pressure of each layer. The layers are specified in ascending order, so pavel[i] > pavel[i+1].

Units : hPa (nlayers, )
SW.tz

The temperature at each level. Levels are specified in ascending order.

Units : Kelvin (nlayers+1, )
SW.pz

The pressure at each level. The levels are specified in ascending order.

Units : hPa (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¶

SW.semis

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.

### Chemical Composition¶

SW.get_species(species, unit='vmr')

Gets a profile of the concentration of one of the chemical species.

Parameters: species – String, one of ‘H2O’, ‘CO2’, ‘O3’, ‘N2O’, ‘CO’, ‘CH4’, ‘O2’ (case insensitive). unit – One of ‘vmr’, ‘mmr’, ‘molecules/cm2’. Specifies the unit of value. Array of shape (nlayers,)
SW.set_species(species, value, unit='vmr')

Sets a profile of one of the chemical species.

Parameters: species – String, one of ‘H2O’, ‘CO2’, ‘O3’, ‘N2O’, ‘CO’, ‘CH4’, ‘O2’ (case insensitive). value – (Array of shape (nlayers,) or float). Specifies the concentration of the gas in each layer. If a float, the concentration is constant for all layers. unit – One of ‘vmr’, ‘mmr’, ‘molecules/cm2’. Specifies the unit of value.

### Solar Forcing Parameters¶

SW.juldat

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.

SW.solvar

Rescales the solar source. Default is 1.0 (no rescaling).

SW.sza

Solar zenith angle (degrees). Default is 0 degrees (overhead).

### Running the Model¶

SW.run()

Performs the radiative transfer using RRTM.

Returns: An instance of the Output class. On an error in the RRTM code, raises an instance of RRTMError.

SW.ireflect

0 for Lambertian reflection (default). 1 for specular reflection, where angle is equal to downwelling angle.

SW.nstr

Controls the number of streams used by the DISORT code. Options are 0, 1 and 2 (corresponding to 4, 8 and 16 streams).