6. Output from mcarats executable
Quick visualization using GrADS
The output file from the mcarats executable is in a simple binary format. GrADS can be used to quickly visualize the results. If GrADS is installed in your system, you can try the followings:
% ./bin/mcarats 1e5 0 ./examples/conf_rs0067 out
% grads -l
...
ga-> open out.ctl
...
LON set to 1 60
LAT set to 1 60
LEV set to 1 1
Time values set: 1:1:0:0 1:1:0:0
E set to 1 1
ga-> set gxout shaded
ga-> set mproj off
ga-> set clevs 0.3 0.35 0.4 0.45 0.5 0.55 0.6
ga-> d a1
ga-> printim img_rs0067.png white
ga-> quit
When "d a1" command is entered, the window displays an image.
General format of the output file
The GrADS control files fully describe the output data. An example of GrADS control file, ./examples/out_rs0067.ctl:
DSET ^out_rs0067
*OPTIONS LITTLE_ENDIAN
*OPTIONS BIG_ENDIAN
OPTIONS template
TITLE out_rs0067
UNDEF 1.0e+37
XDEF 60 LINEAR 1 1
YDEF 60 LINEAR 1 1
ZDEF 41 LINEAR 1 1
TDEF 2 LINEAR 00:00Z00JAN0001 1YR
VARS 2
a1 1 99 Radiance
b1 41 99 Pathlength Statistics
ENDVARS
In the example above, the control file explains the followings:
Data are stored in 4 dimensions
Numbers of elements in X/Y/Z/T-dimensions are 60, 60, 41, and 2, respectively
Two variables are stored: One is radiance, and another is pathlength statistics
The radiance array is in 3-dimension: (60, 60, 2)
The pathlength array is in 4-dimension: (60, 60, 41, 2)
In this example, dimension X/Y/Z corresponds to spatial X/Y/Z dimension. Dimension T corresponds to different sources (with solar directions). Pathlength statistics are here layer air mass factor, which is average pathlength in a layer, normalized by each layer geometrical thickness. Output quantity and number of elements depends on how the user sets up the namelist parameters.
Pseudo Fortran code to read in the data above:
real(4) :: radi(60, 60, 2)
real(4) :: lamf(60, 60, 41, 2)
open (10, file='out_rs0067', access='direct', recl=1*60*60)
!// Note recl depends on compiler. Should be 4*60*60 sometimes.
do isrc = 1, 2
read (10) radi(:, :, isrc)
do iz = 1, 41
read (10) lamf(:, :, iz, isrc)
end do
end do
Flux data output
An example of flux and heating rate calculation result is examples/out_hr0213. GrADS control file:
DSET ^out_hr0213
*OPTIONS LITTLE_ENDIAN
*OPTIONS BIG_ENDIAN
OPTIONS template
TITLE out_hr0213
UNDEF 1.0e+37
XDEF 60 LINEAR 1 1
YDEF 60 LINEAR 1 1
ZDEF 41 LINEAR 1 1
TDEF 2 LINEAR 00:00Z00JAN0001 1YR
VARS 4
a1 2 99 Flux Density
a2 2 99 Flux Density
a3 2 99 Flux Density
b1 41 99 Heating Rate
ENDVARS
The three flux variables, a1, a2, and a3, in the above respectively denote solar direct beam flux, total downward flux, and upward flux.
In this example, fluxes at top and bottom of atmosphere were calculated, and heating rates were calculated in full 3-D atmospheric cells, by setting the namelist parameters:
Wld_mtarget = 1
Flx_mflx = 1
Flx_mhrt = 1
These control what quantities are calculated and output. If Flx_mflx = 3, for example, then fluxes at all layer boundaries will be output.
Pseudo Fortran code to read in the data above:
real(4) :: flx(60, 60, 3, 2)
real(4) :: hrt(60, 60, 41, 2)
open (10, file='out_hr0213', access='direct', recl=1*60*60)
!// Note recl depends on compiler. Should be 4*60*60 sometimes.
do isrc = 1, 2
do i = 1, 3
read (10) flx(:, :, i, isrc)
end do
do iz = 1, 41
read (10) hrt(:, :, iz, isrc)
end do
end do
Radiance data output
Radiance calculation mode (Wld_mtarget = 2) and visualization mode (Wld_mtarget = 3) produce output file in a similar format. An example of GrADS control file:
DSET ^out_ci0067
*OPTIONS LITTLE_ENDIAN
*OPTIONS BIG_ENDIAN
OPTIONS template
TITLE out_ci0067
UNDEF 1.0e+37
XDEF 640 LINEAR 1 1
YDEF 480 LINEAR 1 1
ZDEF 1 LINEAR 1 1
TDEF 6 LINEAR 00:00Z00JAN0001 1YR
VARS 1
a1 1 99 Radiance
ENDVARS
Pseudo Fortran code to read in the data above:
real(4) :: rad(640, 480, 6)
open (10, file='out_ci0067', access='direct', recl=1*640*480)
!// Note recl depends on compiler. Should be 4*640*480 sometimes.
do it = 1, 6
read (10) rad(:, :, it)
end do