-
Notifications
You must be signed in to change notification settings - Fork 7
RadianceExample
Prev: Generating gas absorption coefficients (correlated-k)
The calculation of radiances using spherical harmonics in the Socrates code has been described in Ringer et. al. 2003 (10.1256/qj.02.61) for the long-wave and in Thelen & Edwards 2013 (10.1002/qj.2034) for the short-wave. These are good starting points if you wish to use the code for this purpose. Here we will just illustrate how to set up the input files and describe the options involved in a simple example.
The .view input file specifies from which points and in which directions the radiances are to be output. The variables in this file are explained further in the Socrates User Guide section 6.2.1. Here we will run through two different methods to generate this file using scripts written in Fortran and python. This example generates the rc3.view file found in the directory examples/rc3/. The Fortran routine can be run from the command line and the required information entered in response to the prompts:
$ gen_view_cdl
enter the number of longitudes.
1
enter the number of latitudes.
1
specify the longitudes.
0.0
specify the latitudes.
0.0
enter the number of viewing levels.
2
specify the viewing levels.
0.0 0.5
specify the number of viewing directions.
63
enter the polar viewing angles with longitude changing most
rapidly, THEN latitude, then direction.
.000000E+00 .258419E+02 .368699E+02 .455730E+02
.531301E+02 .600000E+02 .664218E+02 .725424E+02
.784630E+02 .842608E+02 .100000E-04 .957392E+02
.101537E+03 .107458E+03 .113578E+03 .120000E+03
.126870E+03 .134427E+03 .143130E+03 .154158E+03
.180000E+03 .000000E+00 .258419E+02 .368699E+02
.455730E+02 .531301E+02 .600000E+02 .664218E+02
.725424E+02 .784630E+02 .842608E+02 .100000E-04
.957392E+02 .101537E+03 .107458E+03 .113578E+03
.120000E+03 .126870E+03 .134427E+03 .143130E+03
.154158E+03 .180000E+03 .000000E+00 .258419E+02
.368699E+02 .455730E+02 .531301E+02 .600000E+02
.664218E+02 .725424E+02 .784630E+02 .842608E+02
.100000E-04 .957392E+02 .101537E+03 .107458E+03
.113578E+03 .120000E+03 .126870E+03 .134427E+03
.143130E+03 .154158E+03 .180000E+03
enter the azimuthal viewing angles with longitude changing
most rapidly, THEN latitude, then direction.
.000000E+00 .000000E+00 .000000E+00 .000000E+00
.000000E+00 .000000E+00 .000000E+00 .000000E+00
.000000E+00 .000000E+00 .000000E+00 .000000E+00
.000000E+00 .000000E+00 .000000E+00 .000000E+00
.000000E+00 .000000E+00 .000000E+00 .000000E+00
.000000E+00 .900000E+02 .900000E+02 .900000E+02
.900000E+02 .900000E+02 .900000E+02 .900000E+02
.900000E+02 .900000E+02 .900000E+02 .900000E+02
.900000E+02 .900000E+02 .900000E+02 .900000E+02
.900000E+02 .900000E+02 .900000E+02 .900000E+02
.900000E+02 .900000E+02 .180000E+03 .180000E+03
.180000E+03 .180000E+03 .180000E+03 .180000E+03
.180000E+03 .180000E+03 .180000E+03 .180000E+03
.180000E+03 .180000E+03 .180000E+03 .180000E+03
.180000E+03 .180000E+03 .180000E+03 .180000E+03
.180000E+03 .180000E+03 .180000E+03
enter the name of the output file.
cdl_rc3.view
This produces a file in ASCII CDL format (which may be converted to netCDF with cdl2cdf). Alternatively the python routine may be used:
$ cd $RAD_DIR/examples/rc3
$ python
from nctools import ncout_view
import numpy as np
direction=np.arange(1, 64)
level=[1,2]
lon=[0.0]
lat=[0.0]
pol=[
.000000E+00, .258419E+02, .368699E+02, .455730E+02,
.531301E+02, .600000E+02, .664218E+02, .725424E+02,
.784630E+02, .842608E+02, .100000E-04, .957392E+02,
.101537E+03, .107458E+03, .113578E+03, .120000E+03,
.126870E+03, .134427E+03, .143130E+03, .154158E+03,
.180000E+03, .000000E+00, .258419E+02, .368699E+02,
.455730E+02, .531301E+02, .600000E+02, .664218E+02,
.725424E+02, .784630E+02, .842608E+02, .100000E-04,
.957392E+02, .101537E+03, .107458E+03, .113578E+03,
.120000E+03, .126870E+03, .134427E+03, .143130E+03,
.154158E+03, .180000E+03, .000000E+00, .258419E+02,
.368699E+02, .455730E+02, .531301E+02, .600000E+02,
.664218E+02, .725424E+02, .784630E+02, .842608E+02,
.100000E-04, .957392E+02, .101537E+03, .107458E+03,
.113578E+03, .120000E+03, .126870E+03, .134427E+03,
.143130E+03, .154158E+03, .180000E+03]
azim=[
.000000E+00, .000000E+00, .000000E+00, .000000E+00,
.000000E+00, .000000E+00, .000000E+00, .000000E+00,
.000000E+00, .000000E+00, .000000E+00, .000000E+00,
.000000E+00, .000000E+00, .000000E+00, .000000E+00,
.000000E+00, .000000E+00, .000000E+00, .000000E+00,
.000000E+00, .900000E+02, .900000E+02, .900000E+02,
.900000E+02, .900000E+02, .900000E+02, .900000E+02,
.900000E+02, .900000E+02, .900000E+02, .900000E+02,
.900000E+02, .900000E+02, .900000E+02, .900000E+02,
.900000E+02, .900000E+02, .900000E+02, .900000E+02,
.900000E+02, .900000E+02, .180000E+03, .180000E+03,
.180000E+03, .180000E+03, .180000E+03, .180000E+03,
.180000E+03, .180000E+03, .180000E+03, .180000E+03,
.180000E+03, .180000E+03, .180000E+03, .180000E+03,
.180000E+03, .180000E+03, .180000E+03, .180000E+03,
.180000E+03, .180000E+03, .180000E+03]
rlev=[0.0,0.5]
ncout_view('cdf_rc3.view', lon, lat, direction, level, pol, azim, rlev)
This produces an equivalent file in netCDF format (which may be converted to CDL with cdf2cdl).
The use of this .view file is demonstrated in the rc3 example using the Crun_mono script to run the radiation code for one set of optical properties and on one level. This script is not yet documented and we will not use it further here. It can take similar options to the full Cl_run_cdl code (see the sbin/Crun_mono script directly to study the options).
For this example we will use the input profiles generated by a previous tutorial. If you have not already done so, the example4 directory and input files should be created following the instructions here. We will now create the additional input fields required for the radiance calculations.
cd $RAD_DIR/examples/example4
ATM=mls
BASE=wk_$ATM
Solar azimuthal angles are required. Here we simply set an azimuth angle of 0.0:
Cgen_horiz_cdl -o $BASE.sazim -n sazim \
-L "Solar azimuthal angle" -u "Degrees" \
-F 0.0 -N 0.0 -T 0.0
A simple viewing geometry is now created for the radiance calculations. The upward direction is 0.0 degrees in our convention (polar and azimuthal angles = 0.0). The viewing level of 0.0 corresponds to the top of the atmosphere.
Cgen_view_cdl -o $BASE.view -p 0.0 -a 0.0 -v 0.0 -N 0.0 -T 0.0
We can now calculate the radiances along this viewing direction:
echo "Calculating LW radiances for clear sky..."
Cl_run_cdl -B $BASE -s $RAD_DATA/spectra/ga7/sp_lw_ga7 -R 1 9 \
-I -g 2 -c -C 5 \
+S 3 7 0 0 -G 5 0 -H -T
fmove wk_$ATM lw_sph_clearsky_$ATM
echo "and cloudy sky..."
Cl_run_cdl -B $BASE -s $RAD_DATA/spectra/ga7/sp_lw_ga7 -R 1 9 \
-I -g 2 -c -C 3 -K 1 -i 8 +R \
+S 3 7 0 0 -G 5 0 -H -T
fmove wk_$ATM lw_sph_cloudy_$ATM
echo "Calculating SW radiances for clear sky..."
Cl_run_cdl -B $BASE -s $RAD_DATA/spectra/ga7/sp_sw_ga7 -R 1 6 \
-S -r -g 2 -c -C 5 \
+S 1 7 0 7 -G 5 0 -H -T
fmove wk_$ATM sw_sph_clearsky_$ATM
echo "and cloudy sky..."
Cl_run_cdl -B $BASE -s $RAD_DATA/spectra/ga7/sp_sw_ga7 -R 1 6 \
-S -r -g 2 -c -C 3 -K 1 -i 8 +R \
+S 1 7 0 7 -G 5 0 -H -T
fmove wk_$ATM sw_sph_cloudy_$ATM
We have used these options (for a more complete description see section 6.1 of the Socrates User Guide).
For cloudy calculations:
- -C 3: for spherical harmonics calculations there is only one method available for the treatment of vertical overlap of cloud, namely "Maximum overlap in a column model". This essentially lines up the cloud fractions against one edge of the column. The column is then decomposed into the required number of sub-columns so that each sub-column layer is entirely cloudy or clear. The radiative transfer can then be done separately for each sub-column.
For longwave calculations:
- +S 3 7 0 0: The truncation used for the series of spherical harmonics. In the IR there is no azimuthal dependence, so we do not require non-axisymmetric terms. We select truncation method 3 (symmetric) and zeros for the min and max m-order of spherical harmonics. We truncate at l-order 7 (the global order of truncation, which must be odd).
For shortwave calculations:
- +S 1 7 0 7: In the visible, the truncation method must be 1 to include non-axisymmetric terms (but 3 can be used if only fluxes are required). We set a global order of truncation as 7. For calculating solar radiances the azimuthal orders of truncation would normally have lowest order 0 and highest equal to the global order of truncation.
For both:
- -G 5 0: Specification of the bidirectional reflectance distribution function (BRDF). Currently this must be 5 for a Lambertian surface, with order of truncation 0.
- -H: Include the Heney-Greenstein approximation. The phase function for ice crystals in this spectral file only has one moment (the asymmetry) so is extended to higher order using this method.
- -T: Use the Iterative Source Function Technique. (Recommended over −Y: Direct Calculation of Radiances.)
The output (in CDL format for this example) can be viewed directly:
less lw_sph_clearsky_mls.radn
less lw_sph_cloudy_mls.radn
less sw_sph_clearsky_mls.radn
less sw_sph_cloudy_mls.radn
It is also possible to output multi-channel spectra using the -ch option as described for the flux example here. For example:
Cl_run_cdl -B $BASE -s $RAD_DATA/spectra/ga7_ref/sp_lw_300_jm2 -R 1 300 -ch 300 \
-I -g 4 -c -C 5 +S 3 7 0 0 -G 5 0 -H -T
less wk_mls.radn
Currently, radiance output is not handled by the ncplot utility.
Next: Contents