<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://www19.atwiki.jp/mcarats/">
    <title>MCARaTS Wiki</title>
    <link>http://www19.atwiki.jp/mcarats/</link>
    <description>MCARaTS Wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2010-08-04T12:09:16+09:00</dc:date>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/50.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/2.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/64.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/27.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/14.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/44.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/61.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/60.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/52.html" />
                <rdf:li rdf:resource="http://www19.atwiki.jp/mcarats/pages/57.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/50.html">
    <title>User&#039;s Guide v0.10/4c</title>
    <link>http://www19.atwiki.jp/mcarats/pages/50.html</link>
    <description>
      [[Next&gt;User&#039;s Guide v0.10/4d]] / [[Return&gt;User&#039;s Guide v0.10]]
#right(){Update: &amp;update()}
#contents()
#right(){&amp;link_edit(text=Edit)}
//------------------------------------------------------
**Namelist &amp;aname(mcarWld_nml_job){mcarWld_nml_job}
***Wld_nplcf &amp;color(cyan){-technical parameter-}
  integer,  save :: Wld_nplcf  = 0
Power exponent for local collision forcing (LCF), which forces collisions near the radiance detectors, by increasing extinction coefficients near the radiance detectors. The LCF is automatically deactivated if radiances are not target.
The LCF is effective when the 1st kind of radiances (Rad_mrkind = 1) are calculated. The formula of the 1st kind of radiance contribution has a term proportional to 1/r^2, where r is a distance between the collision point and radiance detector point. This type of local estimate has in general infinite variance. To reduce variance, LCF is useful. The power exponent should be 1 or 2 usually.
Scaled extinction coefficients (B_ext1) will be
 B_ext1 = max(B_min, B_ext)
for original extinction coefficient B_ext, and the min extinction coefficient is
 B_min = Wld_dtaumin / dz_lay * (zdif / Wld_rmlcf)**Wld_nplcf
where dz_lay is a layer geometrical thickness and zdif is height (z-coordinate) difference from the camera location. See also Wld_rmlcf and Wld_dtaumin.

***Wld_rmlcf &amp;color(cyan){-technical parameter-}
  real(R_), save :: Wld_rmlcf  = 100.0_R_
Scale length (m) for Local Collision-Forcing (LCF), which forces artificial collisions at locations near the radiance detectors. See also Wld_nplcf.

***Wld_dtaumin &amp;color(cyan){-technical parameter-}
  real(R_), save :: Wld_dtaumin = 0.0_R_
This has different effects on extinction coefficient scaling, depending on target radiative quantities. 
When fluxes and heating rates are target or the local collision forcing (LCF) is not used (Wld_nplcf = 0), Wld_dtaumin is a minimum layer optical thickness for collision forcing. If optical thickness of one layer is less than this threshold, then the collision-forcing method is used in that layer, and the scaled value of the optical thickness is set to Wld_dtaumin. Thus collision events are forced to occur with prescribed probability even in very optically thin layer.
When radiances are target and the LCF is used, then Wld_dtaumin is used for the LCF. See the description of Wld_nplcf for how each parameter is used in the code.

#right(){&amp;link_edit(text=Edit)}
//------------------------------------------------------
**Namelist &amp;aname(mcarAtm_nml_job){mcarAtm_nml_job}
Several 1-D vertical profiles of some variables can be specified in this namelist. Data for 3-D distribution of properties for horizontally-inhomogneous layers are usually very large. Therefore, they should be read in from the external data file. The 1-D and 3-D profile data are mixed and used in the code. Please work with care for how they are mixed, which could be different by variable.
See &amp;link_anchor(Atmosphere, page=User&#039;s Guide v0.10/3){here} (in Chapter 3) for how homogeneous and inhomogeneous layers are defined.

***Atm_idread
  integer,  save :: Atm_idread = 1
This controls how to import atmospheric dataset for the current job. Definition depends on the file format: binary or text. In both cases, if Atm_idread = 0, then namelist input for Atm_ext1d, Atm_omg1d, Atm_apf1d, and Atm_abs1d are all neglected. For the first job, Atm_idread should be &gt; 0.
This variable also controls what dataset is read in from the external data file, Atm_inpfile, for the current job. Note that it is assumed that multiple datasets are possibly stored in the file as in the figure below.
#image(datasets.png)
&amp;bold(){Binary format}: Atm_mfmt = 1
Variable Atm_idread is location index of data set to be read, in the 3-D atmospheric data file. One of data sets in the file can be chosen for each simulation job. The user can specify explicitly the data set index by this parameter or leave it as default value, which is 1 for the first job, and 0 for the subsequent jobs.
If Atm_idread = 0, then no new data set is read in for the current job, and atmospheric properties are the same as previous job. This is possible for second or subsequent job.
As described here, there are many ways to specify explicitly or implicitly the data set index for a job. For example,
-As default for all jobs
|Job index|1|2|3|4|5|6|
|Atm_idread|-|-|-|-|-|-|
|Index of used data set|1|1|1|1|1|1|
-Common single data set for all jobs
|Job index|1|2|3|4|5|6|
|Atm_idread|5|-|-|-|-|-|
|Index of used data set|5|5|5|5|5|5|
-To give explicitly all the indexes
|Job index|1|2|3|4|5|6|
|Atm_idread|5|2|1|3|5|4|
|Index of used data set|5|2|1|3|5|4|
-A combined aproach
|Job index|1|2|3|4|5|6|
|Atm_idread|5|-|-|3|0|4|
|Index of used data set|5|5|5|3|3|4|
where &quot;-&quot; denotes that no valye for Atm_idread is given in the namelist.
&amp;bold(){Text format}: Atm_mfmt = 0
Variable Atm_idread is on/off flag for data import. If 0, no data is read in for the current job, and previously imported data are used again. If 1, then a new data set is read in from the file. For text format file, there is no possibility of random access as in binary format. Thus data sets are read in sequentially for each job.

***Atm_dx, Atm_dy
  real(R_), save :: Atm_dx = 1.0e+4_R_ ! X size of cell
  real(R_), save :: Atm_dy = 1.0e+4_R_ ! Y size of cell
Cell sizes (m) along x and y-axes, respectively.

***Atm_zgrd0
  real(R_), save :: Atm_zgrd0(1:KNZ+1) = (/(10.0_R_*i, i = 1, KNZ+1)/)
Z-coordinate values (m) of layer boundaries. The bottom and top of a layer with index iz correspond to z=Atm_zgrd0(iz) and Atm_zgrd0(iz+1), respectively. The BOA (surface) corresponds to Atm_zgrd0(1), and TOA Atm_zgrd0(Atm_nz+1).
The following illustration shows the definitions of several geometrical parameters.
#image(fig_dimensions.png)

***Atm_wkd0
  real(R_), save :: Atm_wkd0(KNKD) = (/1.0_R_, (0.0_R_, i = 1, KNKD - 1)/) ! k-distribution weights
Weight coefficients of the correlated k-distribution. Give Atm_wkd0(1)=1 for monochromatic computation.

***Atm_tmp1d
  real(R_), save :: Atm_tmp1d(1:KNZ+1) = (/(300.0_R_,  i = 1, KNZ+1)/)
Horizontally-averaged atmospheric temperatures (K) defined
-at layers [1:Atm_nz] if Atm_mtprof=0, or
-at layer interfaces [1:Atm_nz+1] if Atm_mtprof=1.
Used for thermal emission when Src_mtype = 2 or 3.
When Atm_mtprof=1, an interface of iz=1 corresponds to BOA, and that of iz=Atm_nz+1 corresponds to TOA. Note that Atm_tmp1d is atmospheric temperature even when iz=0 (BOA). The surface temperature should be given by different variables. For horizontally inhomogeneous layer, data of perturbation in temperature could be specified in external data file.

***Atm_ext1d
  real(R_), save :: Atm_ext1d(KNZ, KNP1D)
Extinction coefficients (/m) for each layer and each scattering component, one of which can be gas, aerosol, hydrometeor, or their mixture. Extinction coefficient Atm_ext1d(iz, ip1d) corresponds to a layer iz and a component ip1d. Note that optical properties specified by Atm_*1d variables are assumed be horizontally homogeneous in every atmospheric layers.

***Atm_omg1d
  real(R_), save :: Atm_omg1d(KNZ, KNP1D)
As Atm_exp1d, but for single scattering albedo.

***Atm_apf1d
  real(R_), save :: Atm_apf1d(KNZ, KNP1D)
As Atm_exp1d, but for phase function specification parameters. Phase functions are specified in the following way:
 Atm_apf1d &lt;= -2      : isotropic scattering phase function
 -2 &lt; Atm_apf1d &lt;= -1 : Rayleigh scattering phase function
 -1 &lt; Atm_apf1d &lt; 1   : Henyey-Greenstein phase function with asymmetry parameter of Atm_apf1d
 1 &lt;= Atm_apf1d       : a tabulated phase function (given by the database file, see the namelist mcaSca_nml_init)
Note Atm_apf1d should be &lt;= Sca_npf (# of phase functions read in from the file). Even when Atm_apf1d &gt;= 1, this variable does not need to be integer. The phase function is assumed to follow an equation:
 P = (1 - a) * P_tab(i) + a * P_tab(i+1)
where
 i = int(Atm_apf1d)
 a = Atm_apf1d - i
That is, the phase function is linearly interpolated between P_tab(i) and P_tab(i+1). Thus, for better accuracy, the parameter Atm_apf1d should be given, taking into account a relationship between the phase function and a physical property of particles. For example, note that the phase function is linear to the inverse of the effective radius (Re), as a first order approximation:
 P ~ c + d / Re

***Atm_abs1d
  real(R_), save :: Atm_abs1d(KNZ, KNKD)
Horizontally-averaged absorption coefficients (/m) of purely-absorbing component, which can be gaseous mixture for instance. The correlated k-distribution is assumed. An element Atm_abs1d(iz, ikd) corresponds to a layer iz and a k-distribution index ikd. Note perturbations of the absorption coefficients in the horizontally inhomogeneous layers can be given by the data file (Atm_inpfile).

***Scaling optical properties
Input extinction and absorption coefficients can be easily scaled by user-specified factors, as described below. The scaling is performed immediately after reading in the data (from the namelist file or from 3-D atmospheric data file). Variables, Atm_fext1d, Atm_fext3d, Atm_fabs1d, Atm_fabs3d, have been introduced in the namelist. These are useful for simple adjustments of input data. For example, someone could try two simulations easily: one for cloudy sky with 3-D cloud extinction, the other without the cloud (e.g., by setting Atm_fext3d = 0 for cloud).
Note that these parameters are effective only when Atm_idread &gt;= 1. When Atm_idread = 0, no new dataset is read in, and no data scaling is applied.

***Atm_fext1d
  real(R_), save :: Atm_fext1d(KNP1D) = (/(1.0_R_, i = 1, KNP1D)/)
Scaling factor for Atm_ext1d(ip1d), where ip1d is component index. This is neglected when Atm_idread = 0: a new data set is not read in for the current job.
This provide a simple way to modify the original extinction coefficients given by Atm_ext1d. The data are modified just after reading in the namselist data, in the following way:
 B_ext(iz, ip1d) = Atm_ext1d(iz, ip1d) * Atm_fext1d(ip1d)
for all iz = [1, Atm_nz].
Note the values of Atm_ext1d are untouched by this scaling and modified data are saved in a different variable array. Therefore, values of Atm_ext1d will be saved in the subsequent jobs.

***Atm_fext3d
  real(R_), save :: Atm_fext3d(KNP3D) = (/(1.0_R_, i = 1, KNP3D)/)
As Atm_fext1d, but for modifying Atm_ext3d, 3-D spatial distribution of extinction coefficients. This is neglected when Atm_idread = 0: a new data set is not read in for the current job.
The 3-D data are read in from the external data file (Atm_inpfile). The data are modified just after reading in the 3-D data, in the following way:
 Atm_ext3d(ix, iy, iz3, ip3d) = Atm_ext3d(ix, iy, iz3, ip3d) * Atm_fext3d(ip3d)
for all iz3 = [1, Atm_nz3].
Note that a new data set is not always read in for each job and that the modification by Atm_fext3d is applied only when a new data set is read in. See also Atm_idread for when a new data set is read in for a job.

***Atm_fabs1d
  real(R_), save :: Atm_fabs1d = 1.0_R_
Scaling factor for Atm_abs1d. This is neglected when Atm_idread = 0: a new data set is not read in for the current job.
This provide a simple way to modify the original absorption coefficients given by Atm_abs1d. The data are modified just after reading in the namselist data, in the following way:
 B_abs(iz, ikd) = Atm_abs1d(iz, ikd) * Atm_fabs1d
for all iz = [1, Atm_nz] and all ikd = [1, Atm_nkd].
Note the values of Atm_abs1d are untouched by this scaling and modified data are saved in a different variable array. Therefore, values of Atm_abs1d will be saved in the subsequent jobs.

***Atm_fabs3d
  real(R_), save :: Atm_fabs3d = 1.0_R_
As Atm_fabs1d, but for modifying Atm_abs3d, 3-D spatial distribution of absorption coefficients. This is neglected when Atm_idread = 0: a new data set is not read in for the current job.
The 3-D data are read in from the external data file (Atm_inpfile). The data are modified just after reading in the 3-D data, in the following way:
 Atm_abs3d(ix, iy, iz3, ikd) = Atm_abs3d(ix, iy, iz3, ikd) * Atm_fabs3d
for all iz3 = [1, Atm_nz3] and all ikd = [1, Atm_nkd].
Note that a new data set is not always read in for each job and that the modification by Atm_fabs3d is applied only when a new data set is read in. See also Atm_idread for when a new data set is read in for a job.

***Atm_taumin &amp;color(cyan){-technical parameter-}
  real(R_), save :: Atm_taumin = 2.0_R_
Minimum column optical thickness used for collision forcing. If actual column optical thickness is less than this threshold, then the collision forcing method is used, and the scaled value of the total optical thickness is set to Atm_taumin. Recommended value is between 1 and 10.

***Atm_fsupg &amp;color(cyan){-technical parameter-}
  real(R_), save :: Atm_fsupg  = 2.0_R_
Geometrical threshold parameter for automatic, adaptive super-cell formation for maximum cross section method. In the preprocess, super-cells are formed by merging cells until one of conditions are met. Cells are merged until super-cell size (m) is larger, on average, than
 Atm_fsupg / E_max
where E_max is the maximum extinction coefficient (/m).
This is one of three conditions for adaptive super-cell formation. See also Atm_fsupi and Atm_nzzsup.

***Atm_fsupi &amp;color(cyan){-technical parameter-}
  real(R_), save :: Atm_fsupi  = 1.3_R_
Inhomogeneity threshold parameter for automatic, adaptive super-cell formation for maximum cross section method. Cells are merged when inhomogeneity of extinction coefficients within the super-cell is small enough, on average. If ratio of the maximum extinction coefficient (E_max) to super-cell average extinction coefficient (E_ave) is larger than Atm_fsupi, then cell merging will be stopped:
 E_max / E_ave &gt; Atm_fsupi
This is one of three conditions for adaptive super-cell formation. See also Atm_fsupg and Atm_nzzsup.

***Atm_nzzsup &amp;color(cyan){-technical parameter-}
  integer,  save :: Atm_nzzsup = 50
Possible max mumber of atmospheric layers merged into a single super-cell, in which the maximum cross section method is used.

#right(){&amp;link_edit(text=Edit)}
//------------------------------------------------------
**Namelist &amp;aname(mcarSfc_nml_job){mcarSfc_nml_job}
***Sfc_idread
  integer,  save :: Sfc_idread = 1
Location index of data set to be read, in the surface data file (Sfc_inpfile). Data set specification method is the same as Atm_idread. See Atm_idread for details.

***Sfc_tmp
  real(R_), save :: Sfc_tmp = 300.0_R_
Average surface temperature (K). Used for calculation of thermal emission when Src_mtype = 2 or 3. 2-D temperature perturbation can be specified by the external data file (Sfc_inpfile).

***Sfc_mtype
  integer,  save :: Sfc_mtype = 1
Type index of globally constant surface BRDF. Used only when Sfc_inpfile = &#039; &#039;, i.e. BRDF data are not given by the file, Sfc_inpfile. BRDF is assumed as follows:
 0: black
 1: Lambertian
 2: Flx_diffuse-specular mixture (DSM) model
 3: Rahman-Pinty-Verstraete (RPV) model
 4: Li-Sparse-Ross-Thick (LSRT) model

***Sfc_param
  real(R_), save :: Sfc_param(Sfc_NPAR) = (/1.0_R_, 0.0_R_, 0.0_R_, 0.0_R_, 0.0_R_/)
BRDF parameters for globally constant surface properties. Used only when Sfc_inpfile = &#039; &#039;, i.e. BRDF data are not given by the file, Sfc_inpfile. Definitions of Sfc_param(ipar) for respective ipar differs by the BRDF type, Sfc_mtype. 

Sfc_mtype = 0 (black): No specification is required for Sfc_param, which is dummy parameter.
Sfc_mtype = 1 (Lambertian):
-Sfc_param(ipar=1): albedo

//--------------
Sfc_mtype = 2 (DSM): The surface reflection is modeled by a microscopical mixture of diffuse and specular reflection.
-Sfc_param(ipar=1): diffuse albedo (A_d)
-Sfc_param(ipar=2): fraction of Flx_diffuse reflectors (f_d); Fraction of specular reflection is 1 - Sfc_param(ipar=2)
-Sfc_param(ipar=3): real part of refractive index of underlying material (e.g., water); Should be given as positive.
-Sfc_param(ipar=4): imaginary part of refractive index of underlying material (e.g., water); Should be given as positive.
-Sfc_param(ipar=5): variance of micro-scopic surface slope (tangent of the inclination angle). Give zero for flat surface. This is used for specular reflection. According to Cox and Munk&#039;s (1954) parameterization for ocean surface,
 Sfc_param(ipar=5) = 0.00512 * V + 0.003.
where V is wind velocity (m/s) at 10 m above the ocean surface.
The DSM model albedo (A) and BRDF (R) follow
 A = f_d * A_d + (1 - f_d) * A_s,
 R = f_d * R_d + (1 - f_d) * R_s,
 pi * R_d = cosQ * A_d
where A_s and R_s are albedo and BRDF for specular reflection.

//--------------
Sfc_mtype = 3 (RPV): Rahman-Pinty-Verstraete (RPV) BRDF model
-Sfc_param(ipar=1): the first parameter, alpha
-Sfc_param(ipar=2): the exponent parameter, k
-Sfc_param(ipar=3): the asymmetry parameter, THETA
-Sfc_param(ipar=4): delta
The RPV BRDF, R, is given as
 pi * R = alpha * [u0 * u1 / (u0 - 1) / (u1 - 1)]^(k - 1) * HG(THETA) * F(G)
where pi=3.141592653, u0 and u1 are respectively cosines of incidence and reflection vectors, and HG is the Heyney-Greenstein function. The function F is as follows:
 F(G) = 1 + (1 + G)/(delta + G),
where G is a geometrical parameter.

//--------------
Sfc_mtype = 4 (LSRT): Li-Sparse-Ross-Thick (LSRT) BRDF model
-Sfc_param(ipar=1): &quot;k_L&quot;, weight of Lambertian reflection
-Sfc_param(ipar=2): &quot;k_g&quot;, weight of geometrical optics reflection
-Sfc_param(ipar=3): &quot;k_v&quot;, weight of volume scattering
The LSRT BRDF, R, is given by
 pi * R = k_L * pi + k_g * K_geo + k_v * K_vol
where K_geo and K_vol are geometrical and volume scattering kernel functions.

***Sfc_nudsm, Sfc_nurpv, Sfc_nulsrt &amp;color(cyan){-technical parameter-}
  integer,  save :: Sfc_nudsm  = 14
  integer,  save :: Sfc_nurpv  = 8
  integer,  save :: Sfc_nulsrt = 14
Number of solar zenith angles for the look-up tables (LUTs) for DSM, RPV, and LSRT BRDF models, respectively. The LUTs contains parameters for albedo calculation and determination of reflection direction. In simulations, the parameters used are interpolated from the LUT. Thus larger Sfc_nudsm value achieves higher accuracy but requires larger memory for the LUTs.

***Sfc_nqpot &amp;color(cyan){-technical parameter-}
  integer,  save :: Sfc_nqpot  = 24
Number of quadrature points for surface albedo pre-calculations for the BRDF models, DSM and RPV models. Used when creating the LUTs for albedo, which is calculated by integration of the BRDF over the hemisphere. Larger quadrature points can achieve accurate results but may take longer CPU time. Usually 10 is enough to achieve high accuracy as 0.5% (relative unit).

***Sfc_rrmax &amp;color(cyan){-technical parameter-}
  real(R_), save :: Sfc_rrmax  = 5.0_R_
Parameter for determination of random reflection direction by the BRDF models, DSM, RPV, and LSRT models. The rejection method is used for sampling. Smaller value needs less computer time, but the determined reflection direction is more approximate. If Sfc_rrmax is very large (&gt;1.0e+8), then no such an approximation is used, and the simulation may require nearly infinite CPU time! Should be larger than or equally to 1. Default value is generally optimal.

***Sfc_rrexp &amp;color(cyan){-technical parameter-}
  real(R_), save :: Sfc_rrexp  = 0.5_R_
Parameter for determination of random reflection direction by the BRDF models, DSM and RPV models. Smaller value needs less computer time but the determined reflection direction is more approximate. If Sfc_rrexp=1, then no such an approximation is used, and the simulation may require nearly infinite CPU time! Should be between 0 and 1. Default value is generally optimal.

#right(){&amp;link_edit(text=Edit)}
//------------------------------------------------------
**Namelist &amp;aname(mcarSrc_nml_job){mcarSrc_nml_job}
***Src_mtype
  integer,  save :: Src_mtype(KNSRC) = (/(1, i = 1, KNSRC)/)
Flag for source type (0,1,2,3). Defines external and/or internal sources, as follows:
 0: localized sources (the location, direction, and angular width should be specified)
 1: solar sources (incidence from the top of atmosphere)
 2: solar plus thermal emission sources
 3: thermal emission sources

***Src_wlen
  real(R_), save :: Src_wlen(KNSRC)  = (/(10.0_R_,  i = 1, KNSRC)/)
Wavelength (micrometer) of light for thermal emission. This is used only when Src_mtype = 2 or 3. If the wavelength band width (Src_dwlen) is not zero, then Src_wlen is the lower limit of wavelength. See also Src_dwlen.

***Src_dwlen
  real(R_), save :: Src_dwlen(KNSRC) = (/(0.1_R_,   i = 1, KNSRC)/)
Wavelength band width (micrometer). Zero is acceptable. When Src_dwlen=0, the simulation is completely monochromatic, and output quantities are spectral ones. Otherwise (Src_dwlen &gt; 0), output quantities are spectrally averaged ones, and spectrally averaged thermal emission are calculated when Src_mtype = 2 or 3.
Note on output quantities and physical units:
a) Src_dwlen=0: spectral, monochromatic calculations, as the followings
-area-averaged spectral flux densities (e.g., W/m^2/micrometer),
-volume-averaged spectral heating rates (e.g., convergences, W/m^3/micrometer),
-spectral radiances (e.g., W/m^2/steradian/micrometer),
b) Src_dwlen &gt; 0: spectrally-averaged calculations; Units are the same as above.

***Src_flx
  real(R_), save :: Src_flx(KNSRC)   = (/(1.0_R_,   i = 1, KNSRC)/)
Spectral or spectrally-averaged source flux density or power.
-When the solar source is present (Src_mtype = 1 or 2), Src_flx is the solar source spectral irradiance (W/m^2/micrometer) at the top of atmosphere. The Src_flx is defined as integrated on the plane normal to the center direction of the source emission. The top-of-atmosphere solar source irradiance on the horizontal plane should be, for collimated solar incidence (Src_qmax=0),
 Src_flx * abs(cos(180 - Src_the))
-When the source is localized (Src_mtype = 0), Src_flx is the emitted spectral power (W/micrometer). 
Even if Src_dwlen &gt; 0, Src_flx should be spectrally-averaged quantity, averaged over the wavelength band. Then spectrally integrated solar source irradiance should be Src_dwlen*Src_flx, for example.

***Src_qmax
  real(R_), save :: Src_qmax(KNSRC)  = (/(0.0_R_,   i = 1, KNSRC)/)
Full cone angle (degrees) that determines angular width of solar or localized source, used only when Src_mtype = 0, 1 or 2. This should be 0.533133 (degree) for solar incidence at an annual-mean state of the sun-earth system. Give zero for cases in which sources are negligibly small or infinitely far.

***Src_the, Src_phi
  real(R_), save :: Src_the(KNSRC)   = (/(120.0_R_, i = 1, KNSRC)/) ! zenith angle
  real(R_), save :: Src_phi(KNSRC)   = (/(0.0_R_,   i = 1, KNSRC)/) ! azimuth angle
Zenith and azimuth angles (degrees), respectively, of the source emission direction vector. Used only when Src_mtype = 0, 1 or 2. Note the source direction is defined as transport direction of source light. If the source is solar light, then the transport direction corresponds to the sun-to-surface vector. Thus, the solar zenith angle should be (180 - Src_the).

***Src_mphi
  integer,  save :: Src_mphi(KNSRC)  = (/(0, i = 1, KNSRC)/)
Flag for random azimuth of source emission (0:no, 1:yes). If Src_mphi = 0, then the azimuth angles of the source vectors are set as Src_phi. Else if Src_mphi = 1, then the azimuth angles are set as random between 0 to 360 degrees.

***Src_xpos, Src_ypos
  real(R_), save :: Src_xpos(KNSRC) = (/(0.5_R_, i = 1, KNSRC)/)  ! X relative position
  real(R_), save :: Src_ypos(KNSRC) = (/(0.5_R_, i = 1, KNSRC)/)  ! Y relative position
Coordinates that specifies the location of the localized source, used when Src_mtype=0.

***Src_zloc
  real(R_), save :: Src_zloc(KNSRC)  = (/(0.0_R_, i = 1, KNSRC)/)
Z-coordinate that specifies the location of the localized source, used when Src_mtype=0.

***Src_apsize
  real(R_), save :: Src_apsize(KNSRC) = (/(0.0_R_,   i = 1, KNSRC)/)
Aperture size, diameter (m) of the local source surface (or the surface of the outmost lens of the artificial source), when Src_mtype = 0. The localized source should be very small compared to the model domain, but non-zero finite size is allowed. If Src_apsize = 0, then it means the source is from a point. Otherwise, the source surface is assumed to be circular. Emission surface is assumed to be on a plane perpendicular to the emission center direction (with Src_the &amp; Src_phi).

#right(){&amp;link_edit(text=Edit)}
//------------------------------------------------------
**Namelist &amp;aname(mcarRad_nml_job){mcarRad_nml_job}
***Rad_mrproj
  integer,  save :: Rad_mrproj = 0
Flag for angular weighting, when radiances are averaged over finite solid angle (Rad_mrkind = 1 or 3). Options are as follows:
 = 0 : w = 1, results are radiances simply averaged over solid angle
 = 1 : w = cosQ for Q = angle from the camera center direction, results are weighted average
where w is a weighting function. Output radiance will be
 R_out = integral{R(s) * w(s) * dS} / integral{w(s) * dS}
where R(s) is radiance in a direction s, and S is solid angle within the FOV.
Here are two examples. When FOV is a hemisphere (Rad_umax = 180 deg.),
 Rad_mrproj = 0: R_out = hemispherical-mean radiance
 Rad_mrproj = 1: R_out * pi = irradiance (radiative flux density)

***Rad_zloc
  real(R_), save :: Rad_zloc(KNRAD) = (/(  0.0_R_, i = 1, KNRAD)/)
Z coordinate, altitude (m) of the detector location. 
The pixel mapping for radiance image is performed at the detector altitude. Note that this differs from the method that is used for image projection of satellite observation image pixels, which are mapped at the ground level (not at the satellite altitude). In the next version, more useful option will be added.

***Rad_xpos, Rad_ypos
  real(R_), save :: Rad_xpos(KNRAD) = (/(  0.5_R_, i = 1, KNRAD)/) ! X relative position
  real(R_), save :: Rad_ypos(KNRAD) = (/(  0.5_R_, i = 1, KNRAD)/) ! Y relative position
Relative horizontal location along x and y-axes, respectively, for the detector. X and Y coordinates at the detector location are respectively
 X_cam = Rad_xpos * Atm_dx * Atm_nx
 Y_cam = Rad_ypos * Atm_dy * Atm_ny
Thus, Rad_xpos=0 corresponds to the X coordinate of 0, and Rad_xpos=1 corresponds to the uppermost X coordinate of the domain. If Rad_xpos or Rad_ypos is out of a range [0, 1], then they are reset in the code under the cyclic boundary condition. For example, Rad_xpos = 2.345 will be reset as 0.345, and -2.345 will be reset as 0.655.

***Rad_rmin0, Rad_rmax0
  real(R_), save :: Rad_rmin0(KNRAD) = (/(1.0e-17_R_, i = 1, KNRAD)/)
  real(R_), save :: Rad_rmax0(KNRAD) = (/(1.0e+17_R_, i = 1, KNRAD)/)
Minimum and maximum distances (m), respectively, between emission point and the detector. Used only when Rad_mrkind = 1 or 2, in order to limit the distance between emission/scattering point and the detector. A view region is defined for each detector, and the distance R between the emission point and the detector should be 
 Rad_rmin0 &lt; R &lt; Rad_rmax0
Emissions from out of the view region are all excluded from sampling. Transmittance between the line of sight segment for 0 &lt; R &lt; Rad_rmin0 is artificially set at 1, which may result in bias of computed radiances. 
Note current code has an intelligent way to automatically set the view region: Rad_rmin0, Rad_rmax0, and Rad_frmod are automatically set taking into account the domain size, detector location, and detector FOV. When Rad_mrkind = 2, default values are Rad_rmin0 = 0.0 and Rad_rmax0 = (a large enough value). Therefore, the user can leave the default setting as is. Alternatively set an explicit view region.
Basically, emission contributions from source emission, scattering, and reflection should be all sampled for calculating radiances. However, if the first kind of radiances are calculated (Rad_mrkind = 1), simulated images can be very noisy when Rad_rmin0 is too small, and scattering particles are present near the camera. This is because contribution function is proportional to 1/R^2. For that reason, emission near the camera should be excluded from sampling. 
For simulation of physically-correct results, Rad_rmax0 should be infinity. However, such a simulation could be highly time consuming, so that an upper limit should be set.
The figure below schematically illustrates the geometry of the view region and the detector.
#image(fig_camera_viewregion.png)
Figure. The geometry of the view region and the detector.

***Rad_frmod
  real(R_), save :: Rad_frmod = 0.3_R_
Factor for mode distance between emission point and the detector. Used only when the first kind of radiances are calculated (Rad_mrkind = 1). The mode distance (R_mod) will be
 R_mod = [ (1 - Rad_frmod) * sqrt(Rad_rmin0) + Rad_frmod * sqrt(Rad_rmax0) ]**2
Contribution function for the first kind of radiance is proportional to 1/R^2. This mode distance is used for variance reduction. Emission contribution from a point far enough from the detector (R &gt; R_mod), is scaled by the Russian roulette:
 Zeta_new = Zeta_old * (R / R_mod), if Xi &lt; R_mod / R
 Zeta_new = 0, otherwise
where Xi is a random number. This reduces populations of sampling from points far from the detector, reducing calculation time.

***Rad_the, Rad_phi, Rad_psi
  real(R_), save :: Rad_phi(KNRAD) = (/(0.0_R_,   i = 1, KNRAD)/) ! phi,   angle around Z0
  real(R_), save :: Rad_the(KNRAD) = (/(0.0_R_,   i = 1, KNRAD)/) ! theta, angle around Y1
  real(R_), save :: Rad_psi(KNRAD) = (/(270.0_R_, i = 1, KNRAD)/) ! psi,   angle around Z2
Rotation angles (degrees) for the camera (detector) coordinates, which are defined by rotating the original X-Y-Z world coordinates, following Z-Y-Z rotation rule. Values can be in a range (-Inf, +Inf). Three rotations are operated in the correct order:
 1: rotation about Z  (Z-axis in (X,Y,Z) world coordinates) by Rad_phi
 2: rotation about Y1 (Y-axis in (X1,Y1,Z1) coordinates) by Rad_theta
 3: rotation about Z2 (Z-axis in (X2,Y2,Z2) coordinates) by Rad_psi
Finally camera coordinates are (Xc,Yc,Zc), and the Zc axis corresponds to the reverse radiance direction (when Rad_mrkind = 2) or the center direction of radiance image projection (when Rad_mrkind = 1 or 3). Angle between Zc axis direction and the original Z axis direction should be Rad_theta, and azimuth angle of Zc axis direction in the original world coordinate system (X,Y,Z) should be Rad_phi. Therefore, Rad_theta and Rad_phi denotes the zenith and azimuth angles, respectively, in degrees, of the radiance reverse direction or the center direction of radiance image projection. The direction is here defined as the reverse of light transport, i.e. camera to target direction.
Rad_psi is dummy when Rad_mrkind = 2, i.e., detector FOV is infinitesimal. Rad_psi should be appropriately set when Rad_mrkind = 1 or 3, because the angular distribution of radiance will be mapped in an image, definition of which requires the rotation angle Rad_psi.
#image(fig_camera_coordinates2.png)
Figure. The camera coordinates and world coordinates, where theta_rad = Rad_theta, phi_rad = Rad_phi, psi_rad = Rad_psi.

***Camera coordinate system
The camera coordinates (Xc,Yc,Zc) are defined as described above, by the three angles (Rad_the, Rad_phi, Rad_psi). When Rad_mrkind = 2 (horizontal distribution of area-averaged radiances in specific direction), Zc axis is the single, specific direction. When Rad_mrkind = 1 or 3 (angular distribution of angle-averaged radiances), view directions are mapped in an image, which is defined for each camera. In the camera coordinate system, an arbitrary view direction (view point-to-target direction) is defined by the polar angle (theta_c) and the azimuth angle (phi_c), as illustrated in the figure below. The projection image coordinates are defined by U and V, as described below.
#image(fig_camera_viewDirection2.png)
Figure. Camera coordinates and a view direction.

***&amp;aname(Rad_umax){Rad_umax}, Rad_vmax
  real(R_), save :: Rad_umax(KNRAD) = (/(180.0_R_, i = 1, KNRAD)/) ! max angle along U coordinate
  real(R_), save :: Rad_vmax(KNRAD) = (/(180.0_R_, i = 1, KNRAD)/) ! max angle along V coordinate
Maximum angles (degrees) of projection image coordinates, U and V, respectively, for each camera. Used only when Rad_mrkind = 1 or 3. Both should be &lt;= 180 degrees. The pixel mapping method differs by Rad_mpmap.
Rad_mpmap = 1 (rectangular mapping)
 U = theta_c * cos(phi_c) + Rad_umax / 2, in [0, Rad_umax]
 V = theta_c * sin(phi_c) + Rad_vmax / 2, in [0, Rad_vmax]
Rad_mpmap = 2 (polar mapping)
 U = theta_c * 2, in [0, Rad_umax]
 V = phi_c,       in [0, 360]
where theta_c and phi_c are the polar and azimuth angles in the camera coordinate system, of the view direction. Figures below show the image geometry schematically. See also Rad_qmax and [[a page&gt;User&#039;s Guide v0.10/8]] for example applications. When Rad_mpmap = 2, Rad_vmax is not used.
#image(fig_camera_rectMap2.png)
Figure. Rectangular image mapping (Rad_mpmap=1).
#image(fig_camera_polarMap2.png)
Figure. Polar image mapping (Rad_mpmap=2).

Here is an example: Both show radiance angular distribution for an hemisphere, looking up a stratocumulus cloud deck. In both cases, Rad_umax = 180, and Rad_vmax = 180 (Rad_vmax is dummy when Rad_mpmap = 2).
|Rad_mpmap=1|2|
|&amp;blankimg(img_tut_out1.png,width=110,height=85)|&amp;blankimg(img_tut_out2.png,width=110,height=85)|

***Rad_qmax
  real(R_), save :: Rad_qmax(KNRAD) = (/(180.0_R_, i = 1, KNRAD)/)
Maximum angle (degrees), full cone angle of the field of view (FOV) of the detector. Should be &lt;= 180 degrees. If Rad_qmax = 180 degrees, the the FOV corresponds to a hemisphere, the normal of which corresponds to the direction with Rad_the and Rad_phi.

***Rad_apsize
  real(R_), save :: Rad_apsize(KNRAD) = (/(0.0_R_, i = 1, KNRAD)/)
Aperture size, diameter (m) of the detector surface (or the surface of the outmost lens of the detector). Used only when the first kind of radiances are calculated (Rad_mrkind = 1).
The detector size should be very small compared to the model domain, but non-zero finite size is allowed. If Rad_apsize = 0, then it means an infinitesimally small detector. Otherwise, the detector surface is assumed to be circular. Detector surface is assumed to be on a plane perpendicular to the FOV center direction.

***Rad_wfunc0
  real(R_), save :: Rad_wfunc0(KNZ, KNWF)
Weighting functions used when column averaged pathlengths are calculated (Rad_mplen=2). Unit is arbitrary. An element Rad_wfunc0(iz, iwf) corresponds to a layer index iz and a weighting function index iwf. The weighting function is used in the following formula: air mass factor (AMF),
 AMF(iwf) = sum{ L(iz) * Rad_wfunc0(iz, iwf) } / sum{ Rad_wfunc0(iz, iwf) } / Dz(iz)
where the sum is for all layers, iz = [1, Atm_nz], and L is pathlength and Dz is layer depth. 
Multiple weighting functions are useful for calculating multiple air mass factors for multiple gaseous species with different vertical profiles.

***Rad_zetamin &amp;color(cyan){-technical parameter-}
  real(R_), save :: Rad_zetamin = 0.3_R_
Threshold for each radiance contribution function sampled by the local estimation method. Radiance contribution from each emission/scattering/reflection event is calculated as the normalized angular distribution function multiplied by transmittance between the event point and the detector.

***Rad_difr0, Rad_difr1 &amp;color(cyan){-technical parameter-}
  real(R_), save :: Rad_difr0 = 30.0_R_
  real(R_), save :: Rad_difr1 = 0.01_R_
Artificial diffusion coefficients for radiances. Default values are generally optimal.

***What variables are actually used?
Different sets of variables are used depending on the kind of radiance (Rad_mrkind). The following table summarizes which variables are used for a given Rad_mrkind.
Here, &quot;y&quot; denotes that the variable is used, and &quot;-&quot; not used.
|Rad_mrkind  |1|2|3|Only when||Rad_mrkind  |1|2|3|Only when|
|Rad_zloc    |y|y|y|*||Rad_rmin0   |y|y|-|*|
|Rad_wfunc0  |y|y|y|Rad_mplen&gt;=1||Rad_rmax0   |y|y|-|*|
|Rad_the     |y|y|y|*||Rad_frmod   |y|-|-|*|
|Rad_phi     |y|y|y|*||Rad_apsize  |y|-|-|*|
|Rad_psi     |y|-|y|*||Rad_xpos    |y|-|-|*|
|Rad_mrproj  |y|-|y|*||Rad_ypos    |y|-|-|*|
|Rad_umax    |y|-|y|*|||||||
|Rad_vmax    |y|-|y|Rad_mpmap=2|||||||
|Rad_qmax    |y|-|y|*|||||||

#right(){&amp;link_edit(text=Edit)}
----
[[Next&gt;User&#039;s Guide v0.10/4d]] / [[Return&gt;User&#039;s Guide v0.10]]








----
----    </description>
    <dc:date>2010-08-04T12:09:16+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/2.html">
    <title>Menu</title>
    <link>http://www19.atwiki.jp/mcarats/pages/2.html</link>
    <description>
      **Public Info
■ [[Top Page]]
■ User&#039;s Guide
-[[v0.10&gt;User&#039;s Guide v0.10]]
-[[v0.9.5&gt;User&#039;s Guide v0.9.5]]
■ [[Roadmap]]
■ [[Change Log]]
#right(){{{{&amp;link_editmenu(text=Edit)}}}}
----
**Developer Only
■ Blogs
-[[2010 Q3]]
-[[2009 Q4]]
-[[2009 Q3]]
-[[2009 Q2]]
-[[2009 Q1]]
-[[2008 Q4]]
■ Tracks
-[[ToDo List]]
-[[Tracks - v1.1]]
-[[Tracks - v1.0]]
-[[Tracks - v0.10]]
-[[Tracks - v0.9.5]]
■ User&#039;s Guide
-v1.0
■ Developer&#039;s Guide
-[[v0.10&gt;Developer&#039;s Guide - v0.10]]
■ [[Tools]]
■ [[New Coding Style]]
-[[Coding Rule]]
-[[Coding Guideline]]
■ [[References]]
■ [[Links]]
■ [[On MCARaTS Project]]
■ [[@wiki Howto]]
■ &amp;link_pagelist(text=Page List)
■ [[Backup&gt;http://www19.atwiki.jp/_mng/backup2.php]]
----
#search3(and,title=,size=15)
#right(){{{{&amp;link_editmenu(text=Edit)}}}}
----
**Updates
#recent(20,ignore_head=プラグイン)

----
**Links
-[[@wiki&gt;http://atwiki.jp]]
-[[@wiki guide&gt;http://atwiki.jp/guide/]]
-[[@wiki plugins&gt;http://www1.atwiki.jp/guide/pages/264.html]]

----
#right(){{{{&amp;link_editmenu(text=Edit)}}}}






----
----    </description>
    <dc:date>2010-07-26T03:45:15+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/64.html">
    <title>2010 Q3</title>
    <link>http://www19.atwiki.jp/mcarats/pages/64.html</link>
    <description>
          </description>
    <dc:date>2010-07-26T03:40:15+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/27.html">
    <title>Top Page (JP)</title>
    <link>http://www19.atwiki.jp/mcarats/pages/27.html</link>
    <description>
      #ref(mcarats_title.jpg, Top Page)
Japanese / [[English&gt;Top Page]]
#right(){&amp;link_edit(text=Edit)}
#right(){Last modified: &amp;last_modified()}

**MCARaTS Developer&#039;s Site
-ここはMCARaTSの開発者のためのウェブサイトです。MCARaTSの開発者間の情報交換のため、最新情報、技術資料、ソースコードなどが提供されます。
-一部のページの閲覧と編集にはメンバー登録が必要です。
-開発者・テスターまたはマニュアル作成者として参加を希望する方は&amp;link_contributor(text=こちら)からご申請ください。または管理者（岩渕）までご連絡ください (E-mail: mcarats_developer at yahoo.co.jp (&quot; at &quot;=@))。
-[[MCARaTS&gt;http://www.geocities.jp/null2unity/mcarats/]] はモンテカルロ法を用いた汎用の3次元大気地表面系の放射伝達モデルです。多数の先進的な計算手法を組み込んでおり、高速かつ高精度です。カルテシアン座標系に基づいており、地表面は平面と仮定されています。単波長、または狭波長帯の放射伝達が扱われています。偏光、球面大気、非弾性散乱は扱っていません。
-[[GNU GPL&gt;http://www.gnu.org/licenses/gpl-3.0.html]]の下、free softwareとして公開されています。[[リリース版はこちら&gt;http://www.geocities.jp/null2unity/mcarats/]]のページで配布されています。

**お知らせ
-[[MCARaTS v0.10&gt;http://www.geocities.jp/null2unity/mcarats/]] をリリースしました。

#right(){{Accesses: &amp;counter()
&amp;link_edit(text=Edit)}}
----
**[[更新情報&gt;編集履歴]]
#recent(20,ignore_head=プラグイン)

----
**@wikiの利用法について
-[[基本操作&gt;http://atwiki.jp/guide/category2.html]]
-[[ご利用ガイド&gt;http://atwiki.jp/guide/]]
-[[プラグイン&gt;http://atwiki.jp/guide/category17.html]]
-[[プラグイン一覧&gt;http://www1.atwiki.jp/guide/pages/264.html]]
-[[便利ツール&gt;http://atwiki.jp/guide/category32.html]]
-[[@wiki構文&gt;http://atwiki.jp/guide/category16.html]]
----







----
----    </description>
    <dc:date>2010-07-26T02:28:46+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/14.html">
    <title>Roadmap</title>
    <link>http://www19.atwiki.jp/mcarats/pages/14.html</link>
    <description>
      //---------------------------------------------
#right(){{{Accesses: &amp;counter()}}}
#right(){&amp;link_edit(text=Edit)}
*Version 1.0
&amp;italic(){Due date: Aug. 1, 2011}
A big milestone!
-To fully comform to our modern coding rule and style
-Estimation of uncertainties of computed results

//---------------------------------------------
#right(){&amp;link_edit(text=Edit)}
*Version 1.1
&amp;italic(){Due date: Aug. 1, 2012}
Requests of new features are welcome. 
-Semi-analytical calculations of the first-order scattering of solar radiation and direct transmission of thermal radiation

//---------------------------------------------
#right(){&amp;link_edit(text=Edit)}
*Version 1.2 and higher
&amp;italic(){Due date: Aug. 1, 2013}
Several enhancements with new features are in consideration. Your feature request is welcome.
#right(){&amp;link_edit(text=Edit)}
----








----
----    </description>
    <dc:date>2010-07-26T02:19:38+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/44.html">
    <title>User&#039;s Guide v0.10</title>
    <link>http://www19.atwiki.jp/mcarats/pages/44.html</link>
    <description>
      #ref(mcarats_title.jpg, Top Page)
#right(){Update: &amp;update()}
#right(){&amp;link_edit(text=Edit)}
//--------------------------------------
*MCARaTS User&#039;s Guide (Version 0.10)
#ref(img_top.jpg)
This is a guide for users of MCARaTS (Monte Carlo Atmospheric Radiative Transfer Simulator).

(C) Copyright 2009 MCARaTS project. All rights reserved.

#right(){&amp;link_edit(text=Edit)}
//--------------------------------------
*Contents
[[1. Introduction&gt;User&#039;s Guide v0.10/1]]
[[2. Installation&gt;User&#039;s Guide v0.10/2]]
[[3. Model descriptions&gt;User&#039;s Guide v0.10/3]]
[[4a. Input to mcarats executable (a)&gt;User&#039;s Guide v0.10/4a]]: Structure of the namelist input file...
[[4b. Input to mcarats executable (b)&gt;User&#039;s Guide v0.10/4b]]: Namelist mcarWld_nml_init...
[[4c. Input to mcarats executable (c)&gt;User&#039;s Guide v0.10/4c]]: Namelist mcarWld_nml_job...
[[4d. Input to mcarats executable (d)&gt;User&#039;s Guide v0.10/4d]]: External input file Sca_inpfile...
[[5. Radiative transfer simulation&gt;User&#039;s Guide v0.10/5]]
[[6. Output from mcarats executable&gt;User&#039;s Guide v0.10/6]]
[[7. Utilities&gt;User&#039;s Guide v0.10/7]]
[[8. Using MCARaTS&gt;User&#039;s Guide v0.10/8]]
[[9. References&gt;User&#039;s Guide v0.10/9]]
A single page that includes all documents is available [[here&gt;User&#039;s Guide v0.10 - Full]].
A [[PDF version&gt;http://www.geocities.jp/null2unity/mcarats/download/MCARaTS-v0.10-UG.pdf]] of this guide is also available for download. However, HTML version on this wiki is always up-to-date.

*What&#039;s new
-July 24, 2010: Descriptions on radiance configuration have been improved with new figures.

//
//More detail content listing is as follows:
//#ls2(title)

#right(){{{Accesses: &amp;counter()}}}
#right(){&amp;link_edit(text=Edit)}
----







----
----    </description>
    <dc:date>2010-07-25T13:47:18+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/61.html">
    <title>User&#039;s Guide v0.10/9</title>
    <link>http://www19.atwiki.jp/mcarats/pages/61.html</link>
    <description>
      [[Return&gt;User&#039;s Guide v0.10]]
#right(){Update: &amp;update()}
#contents()
//-----------------------------------------------
#right(){&amp;link_edit(text=Edit)}
//-----------------------------------------------
*9. References

Iwabuchi, H., 2006: Efficient Monte Carlo methods for radiative transfer modeling. Journal of the Atmospheric Sciences, 63, No. 9, 2324–2339.

Iwabuchi, H., and H. Kobayashi, 2008: Modeling of radiative transfer in cloudy atmospheres and plant canopies using Monte Carlo methods. FRCGC Technical Report No. 8, 199 pp, 2008.

Iwabuchi, H., T. Suzuki: Fast and accurate radiance calculations for cloudy atmospheres using truncation approximation. In Press, Journal of Quantitative Spectroscopy &amp; Radiative Transfer, doi:10.1016/j.jqsrt.2009.04.006, 2009. 

Lucht W., C. B. Schaaf, A. H. Strahler, 2000: An algorithm for the retrieval of albedo from space using semiempirical BRDF models. IEEE Trans. Geosci. Remote Sens. 38, 977–998. 

Marchuk GI, Mikhailov GA, Nazaraliev MA, Darbinjan RA, Kargin BA, Elepov BS. The Monte Carlo methods in atmospheric optics. Berlin: Springer Series in Optical Sciences, Springer-Verlag, 208 pp, 1980.

Nakajima, T., and M. Tanaka, 1983: Effect of wind-generated waves on the transfer of solar radiation in the atmosphere-ocean system, J. Quant. Spectrosc. Radiat. Transfer, 29, 521-537.

Nakajima, T., and M. Tanaka 1988: Algorithms for radiative intensity calculations in moderately thick atmospheres using a truncation approximation. J. Quant. Spectrosc. Radiat. Transfer, 40, 51–69.

Rahman, H., B. Pinty, and M. M. Verstraete, 1993: Coupled surface-atmosphere reflectance (CSAR) model. 2. Semiempirical surface  model usable with NOAA advanced very high resolution radiometer data, J. Geophys. Res., 98, 20,791–20,801. 

#right(){&amp;link_edit(text=Edit)}
----
[[Return&gt;User&#039;s Guide v0.10]]








----
----    </description>
    <dc:date>2010-07-25T13:46:27+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/60.html">
    <title>User&#039;s Guide v0.10/8</title>
    <link>http://www19.atwiki.jp/mcarats/pages/60.html</link>
    <description>
      [[Next&gt;User&#039;s Guide v0.10/9]] / [[Return&gt;User&#039;s Guide v0.10]]
#right(){Update: &amp;update()}
#contents()
#right(){&amp;link_edit(text=Edit)}
//--------------------------------------
*8. Using MCARaTS
**Examples in the package
***Radiation budget applications
Input files: conf_hr0213 and conf_hr1100.
These are flux and heating rate calculation examples for two wavelengths, 2130 nm and 11000 nm. Spatial distribution of cloud water density for stratocumulus cloud scene was taken from a large eddy simulation. Rayleigh scattering and typical aerosol vertical profile are assumed. Surface reflection is represented by Lambertian model. Simulations are performed for two solar zenith angles (SZAs). Fluxes at top and bottom of the atmosphere and 3-D heating rates are computed. 
For these cases, important variables in the namelists are listed as follows:
 Wld_mtarget = 1 ! target mode (1=flux&amp;HR, 2=radiance, 3=volume rendering)
 Src_nsrc = 2    ! two SZAs
 Flx_mflx = 1    ! fluxes at TOA and BOA
 Flx_mhrt = 1    ! 3D heating rates
 Sfc_mtype = 1   ! Lambertian
 Src_the = 180.0, 120.0 ! zenith angles of the source transport directions
Results are shown below.
|Case|Direct-beam flux|Downward flux|Heating rate and fluxes|
|2130 nm, SZA = 0 |&amp;blankimg(img_hr0213_fdi_t1.png,width=200,height=150)|&amp;blankimg(img_hr0213_fdn_t1.png,width=200,height=150)|&amp;blankimg(img_hr0213_hrt_t1_y48.png,width=200,height=150)|
|2130 nm, SZA = 60|&amp;blankimg(img_hr0213_fdi_t2.png,width=200,height=150)|&amp;blankimg(img_hr0213_fdn_t2.png,width=200,height=150)|&amp;blankimg(img_hr0213_hrt_t2_y48.png,width=200,height=150)|
|11000 nm         |-|&amp;blankimg(img_hr1100_fdn_t1.png,width=200,height=150)|&amp;blankimg(img_hr1100_hrt_t1_y48.png,width=200,height=150)|

***Remote sensing applications
Input files: conf_rs0067 and conf_rs0213.
These are radiance calculation examples for two wavelengths, 670 nm and 2130 nm. The atmosphere is synthesized as the radiation budget examples. Surface reflection is represented by RPV BRDF model. Simulations are performed for two solar zenith angles (SZAs) at the near-infrared wavelength. Normalized nadir radiances and layer air mass factors are computed. 
For these cases, important variables in the namelists are listed as follows:
 Wld_mtarget = 2 ! target mode (1=flux&amp;HR, 2=radiance, 3=volume rendering)
 Src_nsrc = 2    ! two SZAs
 Rad_mrkind = 2  ! 2nd kind of radiance
 Rad_mplen = 1   ! LAMFs are calculated
 Rad_nrad = 1    ! one radiance direction
 Sfc_mtype = 3   ! RPV BRDF
 Src_the = 180.0, 120.0 ! zenith angles of the source transport directions
 Rad_the = 180.0   ! nadir looking
 Rad_zloc = 1.0e+5 ! from space
Results are shown below.
|Wavelength|SZA = 0|SZA = 60|
| 670|&amp;blankimg(img_rs0067_rad_t1.png,width=220,height=170)|&amp;blankimg(img_rs0067_rad_t2.png,width=220,height=170)|
|2130|&amp;blankimg(img_rs0213_rad_t1.png,width=220,height=170)|&amp;blankimg(img_rs0213_rad_t2.png,width=220,height=170)|
| 670|&amp;blankimg(img_rs0067_lamf_t1_y48.png,width=220,height=170)|&amp;blankimg(img_rs0067_lamf_t2_y48.png,width=220,height=170)|
|2130|&amp;blankimg(img_rs0213_lamf_t1_y48.png,width=220,height=170)|&amp;blankimg(img_rs0213_lamf_t2_y48.png,width=220,height=170)|

***Visualization applications
Input files: conf_ci0045,conf_ci0055, conf_ci0067
These are visualization examples for theree wavelengths, 450 nm, 550 nm, and 670 nm. The atmosphere is synthesized as the radiation budget examples. Surface reflection is represented by DSM BRDF model. Simulations are performed for one solar zenith angle (SZA). Normalized quasi-radiances are computed by the rendering method 4, the highest-quality method. Two images are generated. One view point is near the surface, and another is at slightly above the cloud bottom altitude. Wide field-of view camera is assumed.
For these cases, important variables in the namelists are listed as follows:
 Wld_mtarget = 3 ! target mode (1=flux&amp;HR, 2=radiance, 3=volume rendering)
 Src_nsrc = 1    ! one SZA
 Rad_mrkind = 1  ! the 1st kind of radiance
 Rad_mpmap = 1   ! rectangular pixel mapping
 Rad_nrad  = 2   ! two radiance images
 Rad_nxr   = 400 ! # of pixels - U
 Rad_nyr   = 300 ! # of pixels - V
 Vis_mrend  = 4  ! RTE-based rendering with TMS correction
 Sfc_mtype = 2   ! DSM BRDF
 Src_the   = 120.0 ! zenith angle of incident beam transport direction
 Rad_xpos  = 5*0.45
 Rad_ypos  = 5*0.5
 Rad_zloc  = 95, 305 ! altitudes of view points
 Rad_the   = 75, 90  ! zenith angles of the FOV center directions
 Rad_phi   = 0, 0    ! azimuth angles of the FOV center directions
 Rad_psi   = 5*90    ! image rotation around the FOV center
 Rad_umax  = 5*140   ! FOV U size
 Rad_vmax  = 5*110   ! FOV V size
 Rad_qmax  = 5*180.0 
Generated data can be converted to gray scale images, using a utility code bin_gray. Then, using some ImageMagick tools, true color images can be generated. An example shell script, ./examples/job_colorimg.csh, is available as a solution:
//-------------------- start of code
#highlight(bash){{{{
#!/bin/csh -f

## To generate color images from binary (GrADS compatible)  data files

# Arguments
if ($#argv &lt; 6) then
    echo &quot;$0 blue.ctl green.ctl red.ctl outfileHead pwr rmax (timeLag timeWid fmax)&quot;
    exit 2
endif
set imgc=./$argv[4]
set pwr=$argv[5]
set rmax=$argv[6]

# User variables
set fcol=(1.28 1.0 0.8) # color balance

# System variables
set bin_exposure=../bin/bin_exposure
set bin_gray=../bin/bin_gray
set tmp0=./$$.tmp.0
set imgs=(./$$.tmp_img_B ./$$.tmp_img_G ./$$.tmp_img_R)
set imgt=./$$.tmp_img.tif

# Gray images
if ($rmax == 0) then # automatic exposure
    echo $bin_exposure $argv[7] $argv[8] $argv[9] $argv[5] $argv[1] $argv[2] $argv[3]
    $bin_exposure $argv[7] $argv[8] $argv[9] $argv[5] $argv[1] $argv[2] $argv[3] &gt; $tmp0
    foreach c(1 2 3)
	$bin_gray $fcol[$c] $rmax $pwr $argv[$c] $imgs[$c] &lt; $tmp0
    end
else # manual exposure
    foreach c(1 2 3)
	$bin_gray $fcol[$c] $rmax $pwr $argv[$c] $imgs[$c]
    end
endif
set nx=(`grep XDEF $argv[1] | awk &#039;{print $2}&#039;`)
set ny=(`grep YDEF $argv[1] | awk &#039;{print $2}&#039;`)
set nz=(`grep ZDEF $argv[1] | awk &#039;{print $2}&#039;`)
set nt=(`grep TDEF $argv[1] | awk &#039;{print $2}&#039;`)
set nv=(`grep VARS $argv[1] | awk &#039;{print $2}&#039;`)

# Color images
@ t = 1
while($t &lt;= $nt)
    if ($t &lt;= 9) then
	set tstr=&quot;000&quot;$t
    else if ($t &lt;= 99) then
	set tstr=&quot;00&quot;$t
    else if ($t &lt;= 999) then
	set tstr=&quot;0&quot;$t
    else
	set tstr=$t
    endif
    @ v = 1
    while($v &lt;= $nv)
	@ z = 1
	while($z &lt;= $nz)
	    if ( -r $imgs[1]&quot;_t&quot;$t&quot;_var&quot;$v&quot;_z&quot;$z&quot;.gray&quot; ) then
		set str=&quot;_t&quot;$t&quot;_var&quot;$v&quot;_z&quot;$z
		set str1=&quot;_t&quot;$tstr&quot;_var&quot;$v&quot;_z&quot;$z
		set pwr1=$pwr
		@ ntry = 0
		while($ntry &lt; 30) # loop for trials
		    #// This is because the gray image file is sometimes broken.
		    set err=0
		    foreach c(1 2 3)
			convert -depth 8 -size $nx&quot;x&quot;$ny+0 $imgs[$c]$str&quot;.gray&quot; $imgs[$c]$str&quot;.png&quot;
			if ($status != 0) then
			    set err=1
			    echo Error: $imgs[$c]$str&quot;.gray&quot; &quot;with pwr1=&quot;$pwr1
			endif
		    end
		    if ($err == 0) then # success
			set ntry=1000000
		    else # error, then retry
			set pwr1=`echo $pwr1&quot;*1.00333&quot; | bc`
			foreach c(1 2 3)
			    if ($rmax == 0) then # automatic exposure
				$bin_gray $fcol[$c] $rmax $pwr1 $argv[$c] $imgs[$c] $z $v $t &lt; $tmp0
			    else # manual exposure
				$bin_gray $fcol[$c] $rmax $pwr1 $argv[$c] $imgs[$c] $z $v $t
			    endif
			end
		    endif
		    @ ntry = $ntry + 1
		end
		composite -compose CopyGreen $imgs[2]$str&quot;.png&quot; $imgs[3]$str&quot;.png&quot; $imgt
		composite -compose CopyBlue  $imgs[1]$str&quot;.png&quot; $imgt $imgc$str1&quot;.tif&quot;
		echo $imgc$str1&quot;.tif&quot; : complete
		rm -f $imgs[1]$str* $imgs[2]$str* $imgs[3]$str* $imgt
	    endif
	    @ z = $z + 1
	end
	@ v = $v + 1
    end
    @ t = $t + 1
end
rm -f $tmp0
}}}}
//------------------------ end of code
An example of usage:
 ./job_colorimg.csh out_ci0045.ctl out_ci0055.ctl out_ci0067.ctl img_ci 0.6 0 0 1 2
Color images in TIFF format will be generated. They can be viewed by, for example, display command (an ImageMagick tool).
Result color images are shown below.
|z=95|z=305|
|near surface|near cloud bottom|
|&amp;blankimg(img_out_t1_var1_z1.jpg,width=200,height=150)|&amp;blankimg(img_out_t1_var2_z1.jpg,width=200,height=150)|

**Photorealistic visualization of 3-D cloud scene
As shown above, MCARaTS can be used as a visualization tool. We can virtually observe 3-D cloud field from various view points. By modifying the atmospheric and surface properties in the example cases, various images can be generated as follows.

***Total sky imager simulation
|Upward, near surface|Downward, above cloud|
|&amp;blankimg(img_vis4_t1_var1_z1.jpg,width=200,height=200)|&amp;blankimg(img_vis4_t1_var2_z1.jpg,width=200,height=200)|

***Sunset scenes
|SH|z=455|z=755|z=3055|z=9050|z=28050|
|32|&amp;blankimg(img_vis5_t1_var1_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t1_var2_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t1_var3_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t1_var4_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t1_var5_z1.jpg,width=140,height=105)|
|18|&amp;blankimg(img_vis5_t2_var1_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t2_var2_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t2_var3_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t2_var4_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t2_var5_z1.jpg,width=140,height=105)|
|9|&amp;blankimg(img_vis5_t3_var1_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t3_var2_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t3_var3_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t3_var4_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t3_var5_z1.jpg,width=140,height=105)|
|5|&amp;blankimg(img_vis5_t4_var1_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t4_var2_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t4_var3_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t4_var4_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t4_var5_z1.jpg,width=140,height=105)|
|3|&amp;blankimg(img_vis5_t5_var1_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t5_var2_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t5_var3_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t5_var4_z1.jpg,width=140,height=105)|&amp;blankimg(img_vis5_t5_var5_z1.jpg,width=140,height=105)|
(SH: Solar height (deg.))

***Aerosol effects
Images were obtained by increasing and decreasing aerosol density by a factor of 3.
|Aerosol*(1/3)|Aerosol*1|Aerosol*3|
|&amp;blankimg(img_vis11_t1_var1_z1.jpg,width=200,height=150)|&amp;blankimg(img_vis10_t1_var1_z1.jpg,width=200,height=150)|&amp;blankimg(img_vis12_t1_var1_z1.jpg,width=200,height=150)|

***Radiance mapping
For Rad_mrkind = 1 or 3, one of two angular-pixel mapping methods can be chosen. A target mode Wld_mtarget can be 2 or 3. Image axes U and V are differently defined for the two methods.
The following two examples both show hemispherical distribution of radiance looking a cloud deck from ground.
|Rad_mpmap=1|2|
|Rectangular|Polar|
|&amp;blankimg(img_tut_out1.png,width=165,height=127)|&amp;blankimg(img_tut_out2.png,width=165,height=127)|

**Pathlength analyses
***Column air mass factors (CAMFs)
Can be calculated for each radiance pixel. Weighting functions for CAMFs can be specified by the user. In the following example, the weighting function was uniform within the entire atmosphere. We can see a negative correlation between radiance and CAMF, implying that the pathlength becomes longer at cloud gaps.
In more practical applications, the weighting function should correspond to some gas profile (e.g., O2 or O4) of interest.
|Radiance|CAMF|
|&amp;blankimg(img_tut_out4_rad.png,width=165,height=127)|&amp;blankimg(img_tut_out4_amf.png,width=165,height=127)|

***Radiance histogram wrt total pathlength
Can be calculated for each radiance pixel. The total pathlength is calculated as a sum of all photon flight paths, from radiation source to the detector. The total pathlength bins are specified by the user, with minimum and maximum values and the number of bins. This provides a time-resolved histogram, so that lidar signals can be simulated with localized radiative source, for example.
The following figure is plotted for a section at y=30, with solar radiative source.
&amp;blankimg(img_tut_out5.png,width=165,height=127)

#right(){&amp;link_edit(text=Edit)}
----
[[Next&gt;User&#039;s Guide v0.10/9]] / [[Return&gt;User&#039;s Guide v0.10]]









----
----    </description>
    <dc:date>2010-07-25T13:46:17+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/52.html">
    <title>User&#039;s Guide v0.10/7</title>
    <link>http://www19.atwiki.jp/mcarats/pages/52.html</link>
    <description>
      [[Next&gt;User&#039;s Guide v0.10/8]] / [[Return&gt;User&#039;s Guide v0.10]]
#right(){Update: &amp;update()}
#contents()
#right(){&amp;link_edit(text=Edit)}
//--------------------------------------
*7. Utilities
**Introduction
The output file of mcarats code is in a simple binary format, which is easily treated with GrADS. Several utility tools are provided to process the data files. It is not difficult to make a new tool to process the data files. If you made a useful tool, you can contribute to the project by providing it.
-bin_couple to do a simple calculation with a couple of binary data files
-bin_convert to convert a binary data with a simple equation
-bin_dump to convert binary data to a text format
-bin_exposure to diagnose recommended exposure data for image generation
-bin_gray to generate gray scale images from a binary data file
-bin_sample to (re)sample data from a binary data file
-bin_stat to calculate spatial statistics of binary-format data
-row_stat to calculate spatial statistics of text-format data
When operating GrADS data files, control files are assumed to exist at the same directory as the data files.

**bin_couple
This is used to do a simple calculation with a couple of binary data files.
 usage: bin_couple method thresh inCtlFile1 inCtlFile2 outfile
  method:
     0 (sum)              : in1 + in2
     1 (difference)       : in1 - in2
     2 (product)          : in1 * in2
     3 (ratio)            : in1 / in2
     4 (relative diff. 1) : (in1 - in2) / in2
     5 (relative diff. 2) : 2*(in1 - in2) / (in1 + in2)
     6 (square diff.)     : in1*in1 - in2*in2
     7 (root square diff.): sqrt(in1*in1 - in2*in2)
     8 (diff. square)     : (in1 - in2)*(in1 - in2)
     9 (root diff.)       : sqrt(in1) - sqrt(in2)
  thresh: threshold of the denominator when method=3-5. 
          If the denominator is less than the threshold, then the output value is reset
          at a very small value (-1.0E+30).  
  inCtlFile1 : GrADS control file for input data file 1
  inCtlFile2 : GrADS control file for input data file 2
  outfile : Output data file
The output file is in the same format as the input. Numbers of data elements and dimension sizes should be the same between the two input files.

**bin_convert
This is used to convert binary data with a simple equation.
 usage: bin_convert nx ny method A B inCtlFile outfile
  nx       : # of x-dimension elements for output.
  ny       : # of y-dimension elements for output.
  method=0 : v = u               (does nothing)
         1 : v = A + B * u       (linear)
         2 : v = A * u^B         (power-law)
         3 : v = exp(A + B*u)    (exponential)
         4 : v = ln(A + B*u)     (logarithmic)
         5 : v = A + (1 + B*G)*u (random noises are superimposed)
             where G is a normalized Gaussian noise (average: 0; variance:1).
 inCtlFile : GrADS control file for an input file
If nx*ny=0, then these are reset as defined in the input file. Otherwise the averaging is operated.
The output file is in the same format (binary) as the input, but if nx or ny is smaller than the input, then the amount of output data is reduced.

**bin_exposure
This computes recommended exposure data, which can be used as Rmax values for bin_gray utility. For multiple data files (e.g., each RGB channel), average exposure can be calculated. If data for multiple time steps are available, time series of exposure values can be convolved by a filter with a user-specified time width and time lag. The time lag is useful to realistically simulate that real optical instrument and human eyes adjust their aperture size with a time delay. 
This tool would be useful as a utility for image sequence generation, for example.
 usage: bin_exposure timeLag timeWid fmax ctlFile1 (ctlFile2 ctlFile3 ...) 
  timeLag : time lag (integer)
  timeWid : temporal filter width (integer, 1 means no filtering)
  fmax    : factor for automatic determination of Rmax (usually around 1.2)
  ctlFile : GrADS control files for binary data
See also bin_gray for how obtained data can be used.

**bin_gray
This generates gray scale images in a simple 1-byte-per-pixel format.
 usage: bin_gray factor Rmax power controlFile outfileHead (iz ivar it) (&lt; exposureFile)
  controlFile: GrADS control file for the input data file
  outfileHead: filename head for output files
  Scaling formula:    Y = min(Rmax, X * fac)
  Conversion formula: Z = int(Y / Rmax**pwr * 255) = [0, 255]
  If Rmax == 0, then Rmax is read in from standard input (exposureFile).
  If iz, ivar, and it are given, only the specified data will be processed.
Appropriate exposure data can be pre-determined and recorded in the exposureFile. If Rmax=0, then the pre-determined exposure data (Rmax values) will be read in from the stdin and used. A tool, bin_exposure, was made for this purpose.
Multiple output files will be generated if multiple data sets are stored in the input file. One output file should contains one image data.
Example of usage: at examples/ directory,
 $ ../bin/bin_gray 1.182 1.1 0.75 out_ci0045.ctl img_ci0045
         400         300   1.1000000     img_ci0045_t1_var1_z1.gray
         400         300   1.1000000     img_ci0045_t1_var2_z1.gray
Generated files will be listed with numbers of pixels and Rmax values. If ImageMagick is installed and &quot;convert&quot; command is available, then you can try
 $ convert -depth 8 -size 640x480+0 img_ci0045_t1_var1_z1.gray img_ci0045_t1_var1_z1.png
This will generate a PNG format image file. Then you can view the image, by
 $ display -rotate 180 img_ci0045_t1_var1_z1.gif
&amp;blankimg(img_ci0045_t1_var1_z1.gif,width=128,height=96)

**bin_dump
This converts binary data to a text format. 
 usage : bin_dump inCtlFile &gt; outfile
  inCtlFile : GrADS control file for an input file
  outfile   : output file (text format)
Results are printed in the standard output. Example of usage:
 $ bin/bin_dump examples/out_rs0067.ctl | less
 # it, ivar, n :            1           1           1
  0.43441936      0.39797837      0.37406304      0.43220648      0.42556950  ...
  ...

**bin_sample
This is used to resample data from a binary data file. This is useful to extract partial data from the file.
 usage: bin_sample ixi ixs nx iyi iys ny inCtlFile outfile
  ixi      : initial index for X
  ixs      : step of X-index
  nx       : # of x-pixels for output
  iyi      : initial index for Y
  iys      : step of Y-index
  ny       : # of y-pixels for output
An example is here: at examples/ directory,
 % ../bin/bin_sample 2 2 30 2 2 30 out_rs0067.ctl sample_rs0067
In this case, original data for 60x60 pixels are available, and output result from the above will be for 30x30 pixels.

**bin_stat
This is used to calculate basic statistics of binary-format datasets.
 usage : bin_stat inCtlFile (mmask thresh1 thresh2) &gt; outfile
  inCtlFile : input GrADS control file
  outfile   : output file (text format)
  mmask=0 : no data masking
        1 : dat &gt; thresh1
        2 : dat &lt; thresh1
        3 : thresh1 &lt; dat &lt; thresh2
        4 : dat &lt; thresh1 or dat &gt; thresh2
Output data file reports fraction of data possibly masked by the threshold(s), minimum, maximum, average, standard deviation, root-mean-square (rms), and skewness of read data set. One set of data corresponds to X*Y two dimensional array, which is defined in the control file. The output are printed to stdout.
Usage example:
 $ bin/bin_stat examples/test_rs0067.ctl
 # iz, ivar,   it,  frac,   min,        max,        average,    stdev,      rms,       skewness
     1     1     1  1.0000  3.3940E-01  6.8978E-01  4.8468E-01  7.1038E-02  4.8986E-01  4.2904E-01
     1     2     1  1.0000  3.6220E-01  2.2394E+00  1.0513E+00  4.2648E-01  1.1345E+00  8.8130E-01
    ...

**row_stat
This is used to calculate basic statistics of a text data sequence.
 usage: row_stat N func ithresh (thresh1 thresh2) &lt; infile &gt; outfile
  N         : # of sequential data for calculating statistics, in a line
  func      : 0, raw data; 1, ln(dat); 2, exp(dat);
             The conversion is performed before the statistics computation.
  ithresh
    =0 : no threshold,
    =1 : dat &gt;= thresh1,
    =2 : dat &lt;= thresh1,
    =3 : thresh1 &lt;= dat &lt;= thresh2,
    =4 : dat &lt;= thresh1 or dat &gt;= thresh2
Output data file reports fraction of data filtered by the threshold(s), minimum, maximum, average, standard deviation, root-mean-square (rms), and skewness of read data set. One set of data is read in from a line in the input.

Usage example:
 $ bin/bin_dump examples/out_rs0067.ctl &gt; tmp
 $ bin/row_stat 3600 0 0 &lt; tmp
 #    frac,   min,     max,    average,   stdev,    rms,    skewness
    1 1.0000  3.0509E-01  7.0611E-01  4.8130E-01  7.7988E-02  4.8757E-01  2.8613E-01
    2 1.0000  3.7049E-01  2.2713E+00  1.0711E+00  4.4416E-01  1.1595E+00  9.5030E-01
    ...
The output are printed to stdout. Statistics for data sequences, each one of which contains 3600 data, are reported in this example.

#right(){&amp;link_edit(text=Edit)}
----
[[Next&gt;User&#039;s Guide v0.10/8]] / [[Return&gt;User&#039;s Guide v0.10]]









----
----    </description>
    <dc:date>2010-07-25T13:46:06+09:00</dc:date>
  </item>
    <item rdf:about="http://www19.atwiki.jp/mcarats/pages/57.html">
    <title>User&#039;s Guide v0.10/6</title>
    <link>http://www19.atwiki.jp/mcarats/pages/57.html</link>
    <description>
      [[Next&gt;User&#039;s Guide v0.10/7]] / [[Return&gt;User&#039;s Guide v0.10]]
#right(){Update: &amp;update()}
#contents()
#right(){&amp;link_edit(text=Edit)}
//--------------------------------------
*6. Output data from the &quot;mcarats&quot; codes

**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-&gt; 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-&gt; set gxout shaded
 ga-&gt; set mproj off
 ga-&gt; set clevs 0.3 0.35 0.4 0.45 0.5 0.55 0.6
 ga-&gt; d a1
 ga-&gt; printim img_rs0067.png white
 ga-&gt; quit
When &quot;d a1&quot; command is entered, the window displays an image.
#image(img_rs0067.png)

**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=&#039;out_rs0067&#039;, access=&#039;direct&#039;, 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=&#039;out_hr0213&#039;, access=&#039;direct&#039;, 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=&#039;out_ci0067&#039;, access=&#039;direct&#039;, 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

#right(){&amp;link_edit(text=Edit)}
----
[[Next&gt;User&#039;s Guide v0.10/7]] / [[Return&gt;User&#039;s Guide v0.10]]









----
----    </description>
    <dc:date>2010-07-25T13:45:56+09:00</dc:date>
  </item>
  </rdf:RDF>

