OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
TmProcess.h
Go to the documentation of this file.
1 /*
2  * TmProcess.h
3  *
4  * Created on: April, 2018
5  * Author: ssander2
6  *
7 
8  * INPUT PARAMETERS:
9  *
10  * RAT = 1 - particle size is specified in terms of the
11  * equal-volume-sphere radius
12  * RAT.NE.1 - particle size is specified in terms of the
13  * equal-surface-area-sphere radius
14  * NDISTR specifies the distribution of equivalent-sphere radii
15  * NDISTR = 1 - modified gamma distribution
16  * [Eq. (40) of Ref. 7]
17  * AXI=alpha
18  * B=r_c
19  * GAM=gamma
20  * NDISTR = 2 - log-normal distribution
21  * [Eq. 41) of Ref. 7]
22  * AXI=r_g
23  * B=[ln(sigma_g)]**2
24  * NDISTR = 3 - power law distribution
25  * [Eq. (42) of Ref. 7]
26  * AXI=r_eff (effective radius)
27  * B=v_eff (effective variance)
28  * Parameters R1 and R2 (see below) are calculated
29  * automatically for given AXI and B
30  * NDISTR = 4 - gamma distribution
31  * [Eq. (39) of Ref. 7]
32  * AXI=a
33  * B=b
34  * NDISTR = 5 - modified power law distribution
35  * [Eq. (24) in M. I. Mishchenko et al.,
36  * Bidirectional reflectance of flat,
37  * optically thick particulate laters: an efficient radiative
38  * transfer solution and applications to snow and soil surfaces,
39  * J. Quant. Spectrosc. Radiat. Transfer, Vol. 63, 409-432 (1999)].
40  * B=alpha
41  *
42  * The code computes NPNAX size distributions of the same type
43  * and with the same values of B and GAM in one run.
44  * The parameter AXI varies from AXMAX to AXMAX/NPNAX in steps of
45  * AXMAX/NPNAX. To compute a single size distribution, use
46  * NPNAX=1 and AXMAX equal to AXI of this size distribution.
47  *
48  * R1 and R2 - minimum and maximum equivalent-sphere radii
49  * in the size distribution. They are calculated automatically
50  * for the power law distribution with given AXI and B
51  * but must be specified for other distributions
52  * after the lines
53  *
54  * DO 600 IAX=1,NPNAX
55  * AXI=AXMAX-DAX*DFLOAT(IAX-1)
56  *
57  * in the main program.
58  * For the modified power law distribution (NDISTR=5), the
59  * minimum radius is 0, R2 is the maximum radius,
60  * and R1 is the intermediate radius at which the
61  * n(r)=const dependence is replaced by the power law
62  * dependence.
63  *
64  * NKMAX.LE.988 is such that NKMAX+2 is the
65  * number of Gaussian quadrature points used in
66  * integrating over the size distribution for particles with
67  * AXI=AXMAX. For particles with AXI=AXMAX-AXMAX/NPNAX,
68  * AXMAX-2*AXMAX/NPNAX, etc. the number of Gaussian points
69  * linearly decreases.
70  * For the modified power law distribution, the number
71  * of integration points on the interval [0,R1] is also
72  * equal to NKMAX.
73  *
74  * LAM - wavelength of light
75  * MRR and MRI - real and imaginary parts of the refractive
76  * index (MRI.GE.0)
77  * EPS and NP - specify the shape of the particles.
78  * For spheroids NP=-1 and EPS is the ratio of the
79  * horizontal to rotational axes. EPS is larger than
80  * 1 for oblate spheroids and smaller than 1 for
81  * prolate spheroids.
82  * For cylinders NP=-2 and EPS is the ratio of the
83  * diameter to the length.
84  * For Chebyshev particles NP must be positive and
85  * is the degree of the Chebyshev polynomial, while
86  * EPS is the deformation parameter
87  * [Eq. (33) of Ref. 7].
88  * DDELT - accuracy of the computations
89  * NPNA - number of equidistant scattering angles (from 0
90  * to 180 deg) for which the scattering matrix is
91  * calculated.
92  * NDGS - parameter controlling the number of division points
93  * in computing integrals over the particle surface.
94  * For compact particles, the recommended value is 2.
95  * For highly aspherical particles larger values (3, 4,...)
96  * may be necessary to obtain convergence.
97  * The code does not check convergence over this parameter.
98  * Therefore, control comparisons of results obtained with
99  * different NDGS-values are recommended.
100  *
101  */
102 
103 #ifndef INCLUDE_TmProcess_H_
104 #define INCLUDE_TmProcess_H_
105 
106 #include <netcdf>
107 #include <TmConstants.h>
108 
109 using namespace std;
110 using namespace netCDF;
111 using namespace netCDF::exceptions;
112 
113 static const double EQUAL_VOLUME = 1.0;
114 static const double EQUAL_AREA = 0.5;
115 static const int RADIUS_MAXIMUM = 2.0;
116 
117 static const int SPHEROID = -1;
118 static const int CYLINDER = -2;
119 static const int CHEBYSHEV = 1;
120 
121 static const int MODIFIED_GAMMA = 1;
122 static const int LOGNORMAL = 2;
123 static const int POWERLAW = 3;
124 static const int GAMMA = 4;
125 static const int MODIFIED_POWERLAW = 5;
126 
127 struct tmatrix_in {
128  double rat; // equal-volume-sphere radius (1) or equal-surface-area-sphere radius
129  double* lam; // wavelength of light
130  double eps_max; // maximum ratio of the horizontal to rotational axes
131  double eps_min; // minimum ratio of the horizontal to rotational axes
132  double eps_num; // number of ratios of the horizontal to rotational axes
133  double mrr_max; // maximum real part of the refractive index
134  double mrr_min; // minimum real part of the refractive index
135  double mrr_num; // number of real part of the refractive index
136  double mri_max; // maximum imaginary part of the refractive index
137  double mri_min; // number of imaginary part of the refractive index
138  double mri_num; // imaginary part of the refractive index
139  double b_max; // effective radius distribution parameter
140  double b_min; // effective radius distribution parameter
141  double b_num; // effective radius distribution parameter
142  double ddelt; // accuracy of the computations
143  double axmax; // AXI varies from AXMAX to AXMAX/NPNAX in steps of AXMAX/NPNAX
144  double gam; // effective variance distribution parameter
145  int np; // spheroid (-1), cylinder (-2), Chebyshev(degree)
146  int ndgs; // number of division points (default 2)
147  int npnax; // number of size distributions of the same type
148  int ndistr; // specifies the distribution of equivalent-sphere radii
149  int nkmax; // number of Gaussian quadrature points used in integrating over the size distribution
150  int npna; // number of scattering angles
151  int ncoeff; // number of expansion coefficients
152 };
153 
154 static const int ALPHA_COEFF = 4;
155 static const int BETA_COEFF = 2;
156 static const int STOKES = 4;
157 static const int STOKES6 = 6;
158 static const int NPL = 801;
159 static const double fillvalue = -999.9;
160 
161 struct tmatrix_out {
178 };
179 
180 static const int NUM_PACE_BANDS = 127;
181 static const int NUM_DTDB_BANDS = 12;
182 
183 extern const double pace_wavelengths[NUM_PACE_BANDS];
184 extern const double dtdb_wavelengths[NUM_DTDB_BANDS];
185 
187 {
188 public:
190 
191  // output file attributes
192 
193  string title_ ;
194  string prod_name_ ;
195 
196  // output file global attributes
197 
199  string Conventions_ ;
200  string institution_;
201  string license_ ;
203  string date_created_ ;
205  string versionid_;
206 
207  string shape_;
209  string rad_type_;
210 
214  TmProcess();
215 
219  virtual ~TmProcess ();
220 
224  virtual int initialize();
225 
229  virtual int compute_pace();
230  virtual int compute_dtdb();
231 
236  int create_output();
237 
238  int write_wavelength( const int wl );
239 
244  int write_global_attributes( NcFile* nc_output );
245 
246 
250  string history_;
251 
253  history_ = history;
254  }
256  return history_;
257  }
258 
259 
264 protected:
265 
267 
270 
271 };
272 
273 #endif /* INCLUDE_TmProcess_H_ */
string history_
Definition: TmProcess.h:250
boost::multi_array< double, 6 > double_6darray
Definition: AfrtConstants.h:24
double axmax
Definition: TmProcess.h:143
string date_created_
Definition: TmProcess.h:203
const double pace_wavelengths[NUM_PACE_BANDS]
double_6darray asymm
Definition: TmProcess.h:174
string Conventions_
Definition: TmProcess.h:199
double mri_num
Definition: TmProcess.h:138
string institution_
Definition: TmProcess.h:200
string source_files_
Definition: TmProcess.h:204
double_6darray cext
Definition: TmProcess.h:171
double_7darray alpha
Definition: TmProcess.h:175
double eps_min
Definition: TmProcess.h:131
string naming_authority_
Definition: TmProcess.h:202
void setHistory(std::string history)
Definition: TmProcess.h:252
void initialize(int pixref_flag, int blkref_flag)
Definition: Usds.c:1371
double eps_max
Definition: TmProcess.h:130
boost::multi_array< double, 7 > double_7darray
Definition: AfrtConstants.h:25
boost::multi_array< double, 1 > double_1darray
Definition: AfrtConstants.h:17
double_7darray beta
Definition: TmProcess.h:176
string distribution_
Definition: TmProcess.h:208
@ string
double ddelt
Definition: TmProcess.h:142
boost::multi_array< double, 8 > double_8darray
Definition: AfrtConstants.h:26
double mrr_min
Definition: TmProcess.h:134
const double dtdb_wavelengths[NUM_DTDB_BANDS]
Definition: TmProcess.cpp:54
string shape_
Definition: TmProcess.h:207
double_1darray a
Definition: TmProcess.h:166
double_1darray wl
Definition: TmProcess.h:162
double_8darray f
Definition: TmProcess.h:177
double * lam
Definition: TmProcess.h:129
double mrr_num
Definition: TmProcess.h:135
int ndistr
Definition: TmProcess.h:148
double mrr_max
Definition: TmProcess.h:133
string processing_version_
Definition: TmProcess.h:198
double_1darray mri
Definition: TmProcess.h:164
double rat
Definition: TmProcess.h:128
double_6darray cscat
Definition: TmProcess.h:172
double eps_num
Definition: TmProcess.h:132
double_1darray angles
Definition: TmProcess.h:168
double_6darray reff
Definition: TmProcess.h:169
int ncoeff
Definition: TmProcess.h:151
string history
Definition: ncattredit.py:30
double b_min
Definition: TmProcess.h:140
tmatrix_in * tin_
Definition: TmProcess.h:268
double gam
Definition: TmProcess.h:144
string output_filepath_
Definition: TmProcess.h:189
double_1darray mrr
Definition: TmProcess.h:163
string prod_name_
Definition: TmProcess.h:194
tmatrix_out * tout_
Definition: TmProcess.h:269
int num_bands_
Definition: TmProcess.h:266
double_1darray eps
Definition: TmProcess.h:165
double mri_min
Definition: TmProcess.h:137
double b_num
Definition: TmProcess.h:141
double b_max
Definition: TmProcess.h:139
double_1darray b
Definition: TmProcess.h:167
std::string getHistory()
Definition: TmProcess.h:255
double mri_max
Definition: TmProcess.h:136
string license_
Definition: TmProcess.h:201
string title_
Definition: TmProcess.h:193
string rad_type_
Definition: TmProcess.h:209
string versionid_
Definition: TmProcess.h:205
double_6darray walb
Definition: TmProcess.h:173
double_6darray veff
Definition: TmProcess.h:170