3
#include <grass/glocale.h>
7
#include "AtmosModel.h"
9
void AtmosModel::tropic()
11
static const float z1[34] =
13
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f,
14
12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f,
15
22.f, 23.f, 24.f, 25.f, 30.f, 35.f, 40.f, 45.f, 50.f, 70.f, 100.f, 99999.f
18
static const float p1[34] =
20
1013.f, 904.f, 805.f, 715.f, 633.f, 559.f, 492.f, 432.f, 378.f,
21
329.f, 286.f, 247.f, 213.f, 182.f, 156.f, 132.f, 111.f, 93.7f,
22
78.9f, 66.6f, 56.5f, 48.f, 40.9f, 35.f, 30.f, 25.7f, 12.2f, 6.f,
23
3.05f, 1.59f, .854f, .0579f, 3e-4f, 0.f
26
static const float t1[34] =
28
300.f, 294.f, 288.f, 284.f, 277.f, 270.f, 264.f, 257.f, 250.f,
29
244.f, 237.f, 230.f, 224.f, 217.f, 210.f, 204.f, 197.f, 195.f,
30
199.f, 203.f, 207.f, 211.f, 215.f, 217.f, 219.f, 221.f, 232.f,
31
243.f, 254.f, 265.f, 270.f, 219.f, 210.f, 210.f
34
static const float wh1[34] =
36
19.f, 13.f, 9.3f, 4.7f, 2.2f, 1.5f, .85f, .47f, .25f, .12f, .05f,
39
.017f, .006f, .0018f, .001f, 7.6e-4f, 6.4e-4f, 5.6e-4f, 5e-4f,
40
4.9e-4f, 4.5e-4f, 5.1e-4f, 5.1e-4f, 5.4e-4f, 6e-4f, 6.7e-4f,
41
3.6e-4f, 1.1e-4f, 4.3e-5f, 1.9e-5f, 6.3e-6f, 1.4e-7f, 1e-9f, 0.f
44
static const float wo1[34] =
46
5.6e-5f, 5.6e-5f, 5.4e-5f, 5.1e-5f, 4.7e-5f, 4.5e-5f,
47
4.3e-5f, 4.1e-5f, 3.9e-5f, 3.9e-5f, 3.9e-5f, 4.1e-5f, 4.3e-5f, 4.5e-5f,
48
4.5e-5f, 4.7e-5f, 4.7e-5f, 6.9e-5f, 9e-5f, 1.4e-4f, 1.9e-4f, 2.4e-4f,
49
2.8e-4f, 3.2e-4f, 3.4e-4f, 3.4e-4f, 2.4e-4f, 9.2e-5f, 4.1e-5f, 1.3e-5f,
50
4.3e-6f, 8.6e-8f, 4.3e-11f, 0.f
53
/* model: tropical mc clatchey */
54
for (int i = 0; i < 34; i++)
64
void AtmosModel::midsum()
66
static const float z1[34] =
68
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f,
69
12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f, 23.f,
70
24.f, 25.f, 30.f, 35.f, 40.f, 45.f, 50.f, 70.f, 100.f, 99999.f
73
static const float p1[34] =
75
1013.f, 902.f, 802.f, 710.f, 628.f, 554.f, 487.f, 426.f,
76
372.f, 324.f, 281.f, 243.f, 209.f, 179.f, 153.f, 130.f, 111.f, 95.f,
77
81.2f, 69.5f, 59.5f, 51.f, 43.7f, 37.6f, 32.2f, 27.7f, 13.2f, 6.52f,
78
3.33f, 1.76f, .951f, .0671f, 3e-4f, 0.f
81
static const float t1[34] =
83
294.f, 290.f, 285.f, 279.f, 273.f, 267.f, 261.f, 255.f,
84
248.f, 242.f, 235.f, 229.f, 222.f, 216.f, 216.f, 216.f, 216.f, 216.f,
85
216.f, 217.f, 218.f, 219.f, 220.f, 222.f, 223.f, 224.f, 234.f, 245.f, 258.f,
86
270.f, 276.f, 218.f, 210.f, 210.f
89
static const float wh1[34] =
91
14.f, 9.3f, 5.9f, 3.3f, 1.9f, 1.f, .61f, .37f, .21f, .12f,
92
.064f, .022f, .006f, .0018f, .001f, 7.6e-4f, 6.4e-4f, 5.6e-4f, 5e-4f,
93
4.9e-4f, 4.5e-4f, 5.1e-4f, 5.1e-4f, 5.4e-4f, 6e-4f, 6.7e-4f, 3.6e-4f,
94
1.1e-4f, 4.3e-5f, 1.9e-5f, 1.3e-6f, 1.4e-7f, 1e-9f, 0.f
97
static const float wo1[34] =
99
6e-5f, 6e-5f, 6e-5f, 6.2e-5f, 6.4e-5f, 6.6e-5f, 6.9e-5f,
100
7.5e-5f, 7.9e-5f, 8.6e-5f, 9e-5f, 1.1e-4f, 1.2e-4f, 1.5e-4f, 1.8e-4f,
101
1.9e-4f, 2.1e-4f, 2.4e-4f, 2.8e-4f, 3.2e-4f, 3.4e-4f, 3.6e-4f, 3.6e-4f,
102
3.4e-4f, 3.2e-4f, 3e-4f, 2e-4f, 9.2e-5f, 4.1e-5f, 1.3e-5f, 4.3e-6f,
103
8.6e-8f, 4.3e-11f, 0.f
106
/* model: midlatitude summer mc clatchey */
107
for (int i = 0; i < 34; i++)
117
void AtmosModel::midwin()
119
static const float z1[34] =
121
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f,
122
12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f, 23.f,
123
24.f, 25.f, 30.f, 35.f, 40.f, 45.f, 50.f, 70.f, 100.f, 99999.f
126
static const float p1[34] =
128
1018.f, 897.3f, 789.7f, 693.8f, 608.1f, 531.3f, 462.7f,
129
401.6f, 347.3f, 299.2f, 256.8f, 219.9f, 188.2f, 161.f, 137.8f, 117.8f,
130
100.7f, 86.1f, 73.5f, 62.8f, 53.7f, 45.8f, 39.1f, 33.4f, 28.6f, 24.3f,
131
11.1f, 5.18f, 2.53f, 1.29f, .682f, .0467f, 3e-4f, 0.f
134
static const float t1[34] =
136
272.2f, 268.7f, 265.2f, 261.7f, 255.7f, 249.7f, 243.7f,
137
237.7f, 231.7f, 225.7f, 219.7f, 219.2f, 218.7f, 218.2f, 217.7f, 217.2f,
138
216.7f, 216.2f, 215.7f, 215.2f, 215.2f, 215.2f, 215.2f, 215.2f, 215.2f,
139
215.2f, 217.4f, 227.8f, 243.2f, 258.5f, 265.7f, 230.7f, 210.2f, 210.f
142
static const float wh1[34] =
144
3.5f, 2.5f, 1.8f, 1.2f, .66f, .38f, .21f, .085f, .035f,
145
.016f, .0075f, .0069f, .006f, .0018f, .001f, 7.6e-4f, 6.4e-4f, 5.6e-4f,
146
5e-4f, 4.9e-4f, 4.5e-4f, 5.1e-4f, 5.1e-4f, 5.4e-4f, 6e-4f, 6.7e-4f,
147
3.6e-4f, 1.1e-4f, 4.3e-5f, 1.9e-5f, 6.3e-6f, 1.4e-7f, 1e-9f, 0.f
150
static const float wo1[34] =
152
6e-5f, 5.4e-5f, 4.9e-5f, 4.9e-5f, 4.9e-5f, 5.8e-5f,
153
6.4e-5f, 7.7e-5f, 9e-5f, 1.2e-4f, 1.6e-4f, 2.1e-4f, 2.6e-4f, 3e-4f,
154
3.2e-4f, 3.4e-4f, 3.6e-4f, 3.9e-4f, 4.1e-4f, 4.3e-4f, 4.5e-4f, 4.3e-4f,
155
4.3e-4f, 3.9e-4f, 3.6e-4f, 3.4e-4f, 1.9e-4f, 9.2e-5f, 4.1e-5f, 1.3e-5f,
156
4.3e-6f, 8.6e-8f, 4.3e-11f, 0.f
159
/* model: midlatitude winter mc clatchey */
160
for (int i = 0; i < 34; i++)
170
void AtmosModel::subsum()
172
static const float z1[34] =
174
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f,
175
12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f, 23.f,
176
24.f, 25.f, 30.f, 35.f, 40.f, 45.f, 50.f, 70.f, 100.f, 99999.f
179
static const float p1[34] =
181
1010.f, 896.f, 792.9f, 700.f, 616.f, 541.f, 473.f, 413.f,
182
359.f, 310.7f, 267.7f, 230.f, 197.7f, 170.f, 146.f, 125.f, 108.f, 92.8f,
183
79.8f, 68.6f, 58.9f, 50.7f, 43.6f, 37.5f, 32.27f, 27.8f, 13.4f, 6.61f,
184
3.4f, 1.81f, .987f, .0707f, 3e-4f, 0.f
187
static const float t1[34] =
189
287.f, 282.f, 276.f, 271.f, 266.f, 260.f, 253.f, 246.f,
190
239.f, 232.f, 225.f, 225.f, 225.f, 225.f, 225.f, 225.f, 225.f, 225.f,
191
225.f, 225.f, 225.f, 225.f, 225.f, 225.f, 226.f, 228.f, 235.f, 247.f, 262.f,
192
274.f, 277.f, 216.f, 210.f, 210.f
195
static const float wh1[34] =
197
9.1f, 6.f, 4.2f, 2.7f, 1.7f, 1.f, .54f, .29f, .13f, .042f,
198
.015f, .0094f, .006f, .0018f, .001f, 7.6e-4f, 6.4e-4f, 5.6e-4f, 5e-4f,
199
4.9e-4f, 4.5e-4f, 5.1e-4f, 5.1e-4f, 5.4e-4f, 6e-4f, 6.7e-4f, 3.6e-4f,
200
1.1e-4f, 4.3e-5f, 1.9e-5f, 6.3e-6f, 1.4e-7f, 1e-9f, 0.f
203
static const float wo1[34] =
205
4.9e-5f, 5.4e-5f, 5.6e-5f, 5.8e-5f, 6e-5f, 6.4e-5f,
206
7.1e-5f, 7.5e-5f, 7.9e-5f, 1.1e-4f, 1.3e-4f, 1.8e-4f, 2.1e-4f, 2.6e-4f,
207
2.8e-4f, 3.2e-4f, 3.4e-4f, 3.9e-4f, 4.1e-4f, 4.1e-4f, 3.9e-4f, 3.6e-4f,
208
3.2e-4f, 3e-4f, 2.8e-4f, 2.6e-4f, 1.4e-4f, 9.2e-5f, 4.1e-5f, 1.3e-5f,
209
4.3e-6f, 8.6e-8f, 4.3e-11f, 0.f
212
/* model: subarctique summer mc clatchey */
213
for (int i = 0; i < 34; i++)
223
void AtmosModel::subwin()
225
static const float z1[34] =
227
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f,
228
12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f, 23.f,
229
24.f, 25.f, 30.f, 35.f, 40.f, 45.f, 50.f, 70.f, 100.f, 99999.f
232
static const float p1[34] =
234
1013.f, 887.8f, 777.5f, 679.8f, 593.2f, 515.8f, 446.7f,
235
385.3f, 330.8f, 282.9f, 241.8f, 206.7f, 176.6f, 151.f, 129.1f, 110.3f,
236
94.31f, 80.58f, 68.82f, 58.75f, 50.14f, 42.77f, 36.47f, 31.09f, 26.49f,
237
22.56f, 10.2f, 4.701f, 2.243f, 1.113f, .5719f, .04016f, 3e-4f, 0.f
240
static const float t1[34] =
242
257.1f, 259.1f, 255.9f, 252.7f, 247.7f, 240.9f, 234.1f,
243
227.3f, 220.6f, 217.2f, 217.2f, 217.2f, 217.2f, 217.2f, 217.2f, 217.2f,
244
216.6f, 216.f, 215.4f, 214.8f, 214.1f, 213.6f, 213.f, 212.4f, 211.8f,
245
211.2f, 216.f, 222.2f, 234.7f, 247.f, 259.3f, 245.7f, 210.f, 210.f
248
static const float wh1[34] =
250
1.2f, 1.2f, .94f, .68f, .41f, .2f, .098f, .054f, .011f,
251
.0084f, .0055f, .0038f, .0026f, .0018f, .001f, 7.6e-4f, 6.4e-4f, 5.6e-4f,
252
5e-4f, 4.9e-4f, 4.5e-4f, 5.1e-4f, 5.1e-4f, 5.4e-4f, 6e-4f, 6.7e-4f,
253
3.6e-4f, 1.1e-4f, 4.3e-5f, 1.9e-5f, 6.3e-6f, 1.4e-7f, 1e-9f, 0.f
256
static const float wo1[34] =
258
4.1e-5f, 4.1e-5f, 4.1e-5f, 4.3e-5f, 4.5e-5f, 4.7e-5f,
259
4.9e-5f, 7.1e-5f, 9e-5f, 1.6e-4f, 2.4e-4f, 3.2e-4f, 4.3e-4f, 4.7e-4f,
260
4.9e-4f, 5.6e-4f, 6.2e-4f, 6.2e-4f, 6.2e-4f, 6e-4f, 5.6e-4f, 5.1e-4f,
261
4.7e-4f, 4.3e-4f, 3.6e-4f, 3.2e-4f, 1.5e-4f, 9.2e-5f, 4.1e-5f, 1.3e-5f,
262
4.3e-6f, 8.6e-8f, 4.3e-11f, 0.f
265
/* model: subarctique winter mc clatchey */
266
for (int i = 0; i < 34; i++)
276
void AtmosModel::us62()
278
static const float z1[34] =
280
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f,
281
12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f, 23.f,
282
24.f, 25.f, 30.f, 35.f, 40.f, 45.f, 50.f, 70.f, 100.f, 99999.f
285
static const float p1[34] =
287
1013.f, 898.6f, 795.f, 701.2f, 616.6f, 540.5f, 472.2f,
288
411.1f, 356.5f, 308.f, 265.f, 227.f, 194.f, 165.8f, 141.7f, 121.1f,
289
103.5f, 88.5f, 75.65f, 64.67f, 55.29f, 47.29f, 40.47f, 34.67f, 29.72f, 25.49f,
290
11.97f, 5.746f, 2.871f, 1.491f, .7978f, .0552f, 3.008e-4f, 0.f
293
static const float t1[34] =
295
288.1f, 281.6f, 275.1f, 268.7f, 262.2f, 255.7f, 249.2f,
296
242.7f, 236.2f, 229.7f, 223.2f, 216.8f, 216.6f, 216.6f, 216.6f, 216.6f,
297
216.6f, 216.6f, 216.6f, 216.6f, 216.6f, 217.6f, 218.6f, 219.6f, 220.6f,
298
221.6f, 226.5f, 236.5f, 253.4f, 264.2f, 270.6f, 219.7f, 210.f, 210.f
301
static const float wh1[34] =
303
5.9f, 4.2f, 2.9f, 1.8f, 1.1f, .64f, .38f, .21f, .12f,
304
.046f, .018f, .0082f, .0037f, .0018f, 8.4e-4f, 7.2e-4f, 6.1e-4f, 5.2e-4f,
305
4.4e-4f, 4.4e-4f, 4.4e-4f, 4.8e-4f, 5.2e-4f, 5.7e-4f, 6.1e-4f, 6.6e-4f,
306
3.8e-4f, 1.6e-4f, 6.7e-5f, 3.2e-5f, 1.2e-5f, 1.5e-7f, 1e-9f, 0.f
309
static const float wo1[34] =
311
5.4e-5f, 5.4e-5f, 5.4e-5f, 5e-5f, 4.6e-5f, 4.6e-5f,
312
4.5e-5f, 4.9e-5f, 5.2e-5f, 7.1e-5f, 9e-5f, 1.3e-4f, 1.6e-4f, 1.7e-4f,
313
1.9e-4f, 2.1e-4f, 2.4e-4f, 2.8e-4f, 3.2e-4f, 3.5e-4f, 3.8e-4f, 3.8e-4f,
314
3.9e-4f, 3.8e-4f, 3.6e-4f, 3.4e-4f, 2e-4f, 1.1e-4f, 4.9e-5f, 1.7e-5f,
315
4e-6f, 8.6e-8f, 4.3e-11f, 0.f
318
/* model: us standard 62 mc clatchey */
319
for (int i = 0; i < 34; i++)
330
void AtmosModel::parse()
333
cin.ignore(numeric_limits<int>::max(),'\n'); /* read the rest of the scraps, like comments */
340
case 0: us62(); break;
341
case 1: tropic(); break;
342
case 2: midsum(); break;
343
case 3: midwin(); break;
344
case 4: subsum(); break;
345
case 5: subwin(); break;
346
case 6: us62(); break;
350
for(int i = 0; i < 34; i++)
357
cin.ignore(numeric_limits<int>::max(),'\n'); /* read the rest of the scraps, like comments */
365
cin.ignore(numeric_limits<int>::max(),'\n'); /* read the rest of the scraps, like comments */
369
default: G_warning(_("Unknown atmospheric model!"));
373
/* --- atmospheric model ---- */
374
void AtmosModel::print()
376
static const string head(" atmospheric model description ");
377
static const string line(" ----------------------------- ");
378
Output::Begin(); Output::Repeat(22,' '); Output::Print(head); Output::End();
379
Output::Begin(); Output::Repeat(22,' '); Output::Print(line); Output::End();
383
static const string atmid[7] = {
384
string("no absorption computed "),
385
string("tropical (uh2o=4.12g/cm2,uo3=.247cm-atm)"),
386
string("midlatitude summer (uh2o=2.93g/cm2,uo3=.319cm-atm)"),
387
string("midlatitude winter (uh2o=.853g/cm2,uo3=.395cm-atm)"),
388
string("subarctic summer (uh2o=2.10g/cm2,uo3=.480cm-atm)"),
389
string("subarctic winter (uh2o=.419g/cm2,uo3=.480cm-atm)"),
390
string("us standard 1962 (uh2o=1.42g/cm2,uo3=.344cm-atm)")
394
Output::Repeat(10,' ');
395
Output::Print(" atmospheric model identity : ");
399
Output::Repeat(15,' ');
400
Output::Print(atmid[idatm]);
406
Output::Print(" atmospheric model identity : ");
410
Output::Repeat(12, ' ');
411
Output::Print(" user defined atmospheric model ");
415
Output::Repeat(12, ' ');
416
Output::Print("*altitude *pressure *temp. *h2o dens. *o3 dens. ");
419
for(int i = 0; i < 34; i++)
422
Output::Repeat(12, ' ');
424
s.setf(ios::fixed, ios::floatfield);
425
s << setprecision(4);
426
s << setw(9) << z[i] << " ";
427
s << setw(9) << p[i] << " ";
428
s << setw(9) << t[i] << " ";
429
s << setw(9) << wh[i] << " ";
430
s << setw(9) << wo[i] << " ";
432
Output::Print(s.str());
439
Output::Repeat(10, ' ');
440
Output::Print(" atmospheric model identity : ");
444
Output::Repeat(12, ' ');
446
s1.setf(ios::fixed, ios::floatfield);
447
s1 << setprecision(3);
448
s1 << " user defined water content : uh2o=" << setw(9) << uw << " g/cm2 ";
449
Output::Print(s1.str());
453
Output::Repeat(12, ' ');
455
s2.setf(ios::fixed, ios::floatfield);
456
s2 << setprecision(3);
457
s2 << " user defined ozone content : uo3 =" << setw(9) << uo3 << " cm-atm";
458
Output::Print(s2.str());
462
Output::Begin(); Output::End();
465
AtmosModel AtmosModel::Parse()