ARTS 2.5.4 (git: 4c0d3b4d)
m_checked.cc
Go to the documentation of this file.
1/* Copyright (C) 2013
2 Patrick Eriksson <Patrick.Eriksson@chalmers.se>
3 Stefan Buehler <sbuehler(at)ltu.se>
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 USA. */
19
20/*===========================================================================
21 === File description
22 ===========================================================================*/
23
35#include "arts.h"
36#include "auto_md.h"
37#include "check_input.h"
38#include "cloudbox.h"
39#include "matpackI.h"
40
41extern const Numeric DEG2RAD;
42extern const Numeric LAT_LON_MIN;
43
44/* Workspace method: Doxygen documentation will be auto-generated */
46 Index& abs_xsec_agenda_checked,
47 // WS Input:
48 const ArrayOfArrayOfSpeciesTag& abs_species,
49 const Agenda& abs_xsec_agenda,
50 const Verbosity&) {
51 bool needs_continua = false;
52 bool needs_cia = false;
53 // bool needs_hxsec = false;
54
55 for (Index sp = 0; sp < abs_species.nelem(); sp++) {
56 for (Index tgs = 0; tgs < abs_species[sp].nelem(); tgs++) {
57 switch (abs_species[sp][tgs].Type()) {
58 case Species::TagType::Plain:
59 break;
60 case Species::TagType::Zeeman:
61 break;
62 case Species::TagType::PredefinedLegacy:
63 needs_continua = true;
64 break;
65 case Species::TagType::PredefinedModern:
66 break;
67 case Species::TagType::Cia:
68 needs_cia = true;
69 break;
70 case Species::TagType::FreeElectrons:
71 break;
72 case Species::TagType::Particles:
73 break;
74 case Species::TagType::HitranXsec:
75 // needs_hxsec = true;
76 break;
77 default:
78 ARTS_USER_ERROR ("Unknown species type: ", abs_species[sp][tgs].Type())
79 break;
80 }
81 }
82 }
83
84 ARTS_USER_ERROR_IF (needs_continua &&
85 !abs_xsec_agenda.has_method("abs_xsec_per_speciesAddConts"),
86 "*abs_species* contains continuum species but *abs_xsec_agenda*\n"
87 "does not contain *abs_xsec_per_speciesAddConts*.");
88
89 ARTS_USER_ERROR_IF (needs_cia && !abs_xsec_agenda.has_method("abs_xsec_per_speciesAddCIA"),
90 "*abs_species* contains CIA species but *abs_xsec_agenda*\n"
91 "does not contain *abs_xsec_per_speciesAddCIA*.");
92
93 // If here, all OK
94 abs_xsec_agenda_checked = 1;
95}
96
97/* Workspace method: Doxygen documentation will be auto-generated */
98void atmfields_checkedCalc(Index& atmfields_checked,
99 const Index& atmosphere_dim,
100 const Vector& p_grid,
101 const Vector& lat_grid,
102 const Vector& lon_grid,
103 const ArrayOfArrayOfSpeciesTag& abs_species,
104 const Tensor3& t_field,
105 const Tensor4& vmr_field,
106 const Tensor3& wind_u_field,
107 const Tensor3& wind_v_field,
108 const Tensor3& wind_w_field,
109 const Tensor3& mag_u_field,
110 const Tensor3& mag_v_field,
111 const Tensor3& mag_w_field,
112 const Index& abs_f_interp_order,
113 const Index& negative_vmr_ok,
114 const Verbosity&) {
115 // Consistency between dim, grids and atmospheric fields/surfaces
116 chk_if_in_range("atmosphere_dim", atmosphere_dim, 1, 3);
117 chk_atm_grids(atmosphere_dim, p_grid, lat_grid, lon_grid);
118 chk_atm_field("t_field", t_field, atmosphere_dim, p_grid, lat_grid, lon_grid);
119 chk_atm_field("vmr_field",
120 vmr_field,
121 atmosphere_dim,
122 abs_species.nelem(),
123 p_grid,
124 lat_grid,
125 lon_grid);
126
127 // More for vmr_field.
128 ARTS_USER_ERROR_IF (!negative_vmr_ok && abs_species.nelem() && min(vmr_field) < 0,
129 "All values in *vmr_field* must be >= 0.");
130
131 // More for t_field.
132 ARTS_USER_ERROR_IF (min(t_field) <= 0,
133 "All temperatures in *t_field* must be > 0.");
134
135 // Winds
136 if (wind_w_field.npages() > 0) {
137 chk_atm_field("wind_w_field",
138 wind_w_field,
139 atmosphere_dim,
140 p_grid,
141 lat_grid,
142 lon_grid);
143 }
144 if (atmosphere_dim < 3 && wind_v_field.npages() > 0) {
145 chk_atm_field("wind_v_field",
146 wind_v_field,
147 atmosphere_dim,
148 p_grid,
149 lat_grid,
150 lon_grid);
151 }
152 if (atmosphere_dim > 2) {
153 if (wind_u_field.npages() > 0) {
154 if (wind_v_field.npages() > 0) {
155 bool chk_poles = false;
156 chk_atm_field("wind_u_field",
157 wind_u_field,
158 atmosphere_dim,
159 p_grid,
160 lat_grid,
161 lon_grid,
162 chk_poles);
163 chk_atm_field("wind_v_field",
164 wind_v_field,
165 atmosphere_dim,
166 p_grid,
167 lat_grid,
168 lon_grid,
169 chk_poles);
170 chk_atm_vecfield_lat90("wind_v_field",
171 wind_v_field,
172 "wind_u_field",
173 wind_u_field,
174 atmosphere_dim,
175 lat_grid);
176 } else {
177 chk_atm_field("wind_u_field",
178 wind_u_field,
179 atmosphere_dim,
180 p_grid,
181 lat_grid,
182 lon_grid);
183 }
184 } else {
185 if (wind_v_field.npages() > 0) {
186 chk_atm_field("wind_v_field",
187 wind_v_field,
188 atmosphere_dim,
189 p_grid,
190 lat_grid,
191 lon_grid);
192 }
193 }
194 }
195
196 // If any of the wind fields exist, abs_f_interp_order must not be zero.
197 if (wind_u_field.npages() > 0 || wind_v_field.npages() > 0 ||
198 wind_w_field.npages() > 0) {
199 ARTS_USER_ERROR_IF (abs_f_interp_order == 0,
200 "You have a wind field set, but abs_f_interp_order zero.\n"
201 "This is not allowed. Though abs_f_interp_order only is\n"
202 "required and has an effect if absorption lookup tables\n"
203 "are used, for safety reasons you also have to set it >0\n"
204 "in case of on-the-fly absorption.")
205 }
206
207 // Magnetic field
208 if (mag_w_field.npages() > 0) {
209 chk_atm_field("mag_w_field (vertical magfield component)",
210 mag_w_field,
211 atmosphere_dim,
212 p_grid,
213 lat_grid,
214 lon_grid);
215 }
216 if (mag_u_field.npages() > 0) {
217 if (mag_v_field.npages() > 0) {
218 bool chk_poles = false;
219 chk_atm_field("mag_v_field",
220 mag_v_field,
221 atmosphere_dim,
222 p_grid,
223 lat_grid,
224 lon_grid,
225 chk_poles);
226 chk_atm_field("mag_u_field",
227 mag_u_field,
228 atmosphere_dim,
229 p_grid,
230 lat_grid,
231 lon_grid,
232 chk_poles);
233 chk_atm_vecfield_lat90("mag_v_field",
234 mag_v_field,
235 "mag_u_field",
236 mag_u_field,
237 atmosphere_dim,
238 lat_grid);
239 } else {
240 chk_atm_field("mag_u_field",
241 mag_u_field,
242 atmosphere_dim,
243 p_grid,
244 lat_grid,
245 lon_grid);
246 }
247 } else {
248 if (mag_v_field.npages() > 0) {
249 chk_atm_field("mag_v_field",
250 mag_v_field,
251 atmosphere_dim,
252 p_grid,
253 lat_grid,
254 lon_grid);
255 }
256 }
257
258 // If here, all OK
259 atmfields_checked = 1;
260}
261
262/* Workspace method: Doxygen documentation will be auto-generated */
263void atmgeom_checkedCalc(Index& atmgeom_checked,
264 const Index& atmosphere_dim,
265 const Vector& p_grid,
266 const Vector& lat_grid,
267 const Vector& lon_grid,
268 const Tensor3& z_field,
269 const Vector& refellipsoid,
270 const Matrix& z_surface,
271 const Vector& lat_true,
272 const Vector& lon_true,
273 const Numeric& max500hpa_gradient,
274 const Verbosity&) {
275 // A repetition from atmfields_checked, but we do this to make the two parts
276 // independent (the other option would be to demand atmfields_checkec == 1)
277 chk_if_in_range("atmosphere_dim", atmosphere_dim, 1, 3);
278 chk_atm_grids(atmosphere_dim, p_grid, lat_grid, lon_grid);
279
280 // *refellipsoid*
281 ARTS_USER_ERROR_IF (refellipsoid.nelem() != 2,
282 "The WSV *refellispoid* must be a vector of "
283 "length 2*.");
284 ARTS_USER_ERROR_IF (refellipsoid[0] <= 0,
285 "The first element of *refellipsoid* must "
286 "be > 0.");
287 ARTS_USER_ERROR_IF (refellipsoid[1] < 0 || refellipsoid[1] > 1,
288 "The second element of *refellipsoid* must be "
289 "inside [0,1].");
290 ARTS_USER_ERROR_IF (atmosphere_dim == 1 && refellipsoid[1] != 0,
291 "For 1D, the second element of *refellipsoid* "
292 "(the eccentricity) must be 0.");
293
294 chk_atm_field("z_field", z_field, atmosphere_dim, p_grid, lat_grid, lon_grid);
295 chk_atm_surface("z_surface", z_surface, atmosphere_dim, lat_grid, lon_grid);
296
297 // Check that z_field has strictly increasing pages.
298 for (Index row = 0; row < z_field.nrows(); row++) {
299 for (Index col = 0; col < z_field.ncols(); col++) {
300 ostringstream os;
301 os << "z_field (for latitude nr " << row << " and longitude nr " << col
302 << ")";
303 chk_if_increasing(os.str(), z_field(joker, row, col));
304 }
305 }
306
307 // Check that there is no gap between the surface and lowest pressure
308 // level
309 // (A copy of this code piece is found in z_fieldFromHSE. Make this to an
310 // internal function if used in more places.)
311 for (Index row = 0; row < z_surface.nrows(); row++) {
312 for (Index col = 0; col < z_surface.ncols(); col++) {
313 ARTS_USER_ERROR_IF (z_surface(row, col) < z_field(0, row, col) ||
314 z_surface(row, col) >= z_field(z_field.npages() - 1, row, col),
315 "The surface altitude (*z_surface*) cannot be outside\n"
316 "of the altitudes in *z_field*.\n"
317 "z_surface: ", z_surface(row, col), "\n"
318 "min of z_field: ", z_field(0, row, col), "\n"
319 "max of z_field: ", z_field(z_field.npages() - 1, row, col),
320 "\n",
321 (atmosphere_dim > 1) ? var_string("\nThis was found to be the case for:\n", "latitude ", lat_grid[row]) : var_string(),
322 (atmosphere_dim > 2) ? var_string("\nlongitude ", lon_grid[col]) : var_string())
323 }
324 }
325
326 // A rough check of gradients in the 500 hPa level (or closest pressure level)
327 // This check is just run in the latitude direction, along some longitudes to
328 // save time
329 if (atmosphere_dim > 1) {
330 // Find 500 hPa
331 Index ip = -1; Numeric dpmin = 99e99;
332 for (Index i=0; i<p_grid.nelem(); i++) {
333 const Numeric dp = abs(p_grid[i] - 500e2);
334 if (dp < dpmin) {
335 ip = i;
336 dpmin = dp;
337 }
338 }
339 Numeric maxgrad = -1;
340 for (Index ilon=0; ilon<max(1,lon_grid.nelem()); ilon += 10) {
341 for (Index ilat=1; ilat<lat_grid.nelem(); ilat++) {
342 const Numeric grad = abs((z_field(ip,ilat,ilon)-z_field(ip,ilat-1,ilon)) /
343 (lat_grid[ilat]-lat_grid[ilat-1]));
344 if (grad > maxgrad)
345 maxgrad = grad;
346 }
347 }
348 // Scale to change over 100 km
349 maxgrad *= 100.0/111.0;
350 if (maxgrad > max500hpa_gradient) {
351 ostringstream os;
352 os << "A check of the altitude of the " << p_grid[ip]/100
353 << " hPa level has been made.\nThe maximum gradient found matches "
354 << maxgrad << " m/100km, that exceeds\nthe set limit of "
355 << max500hpa_gradient << " m/100km (by GIN *max500hpa_gradient*).\n"
356 << "Please check the smoothness of *z_field*.";
357 throw runtime_error(os.str());
358 }
359 }
360
361 // lat/lon true
362 if (atmosphere_dim < 3 && (lat_true.nelem() || lon_true.nelem())) {
363 if (atmosphere_dim == 1) {
364 ARTS_USER_ERROR_IF (lat_true.nelem() != 1,
365 "For 1D, *lat_true* must have length 1.");
366 ARTS_USER_ERROR_IF (lon_true.nelem() != 1,
367 "For 1D, *lon_true* must have length 1.");
368 } else if (atmosphere_dim == 2) {
369 ARTS_USER_ERROR_IF (lat_true.nelem() != lat_grid.nelem(),
370 "For 2D, *lat_true* must have same length as *lat_grid*.");
371 ARTS_USER_ERROR_IF (lon_true.nelem() != lat_grid.nelem(),
372 "For 2D, *lon_true* must have same length as *lat_grid*.");
373 }
374 ARTS_USER_ERROR_IF (lon_true.nelem() != lat_true.nelem(),
375 "If *lat_true* is set, also *lon_true* must be "
376 "set (and have the same length).");
377 ARTS_USER_ERROR_IF (min(lat_true) < -90 || max(lat_true) > 90,
378 "Values in *lat_true* must be inside [-90,90].");
379 ARTS_USER_ERROR_IF (min(lon_true) < -180 || max(lon_true) > 360,
380 "Values in *lon_true* must be inside [-180,360].");
381 }
382
383 // If here, all OK
384 atmgeom_checked = 1;
385}
386
387/* Workspace method: Doxygen documentation will be auto-generated */
388void cloudbox_checkedCalc(Index& cloudbox_checked,
389 const Index& atmfields_checked,
390 const Index& atmosphere_dim,
391 const Vector& p_grid,
392 const Vector& lat_grid,
393 const Vector& lon_grid,
394 const Tensor3& z_field,
395 const Matrix& z_surface,
396 const Tensor3& wind_u_field,
397 const Tensor3& wind_v_field,
398 const Tensor3& wind_w_field,
399 const Index& cloudbox_on,
400 const ArrayOfIndex& cloudbox_limits,
401 const Tensor4& pnd_field,
402 const ArrayOfTensor4& dpnd_field_dx,
403 const ArrayOfRetrievalQuantity& jacobian_quantities,
404 const ArrayOfArrayOfSingleScatteringData& scat_data,
405 const ArrayOfString& scat_species,
406 const Matrix& particle_masses,
407 const ArrayOfArrayOfSpeciesTag& abs_species,
408 const Index& demand_latlon_margin,
409 const Index& negative_pnd_ok,
410 const Verbosity&) {
411 ARTS_USER_ERROR_IF (atmfields_checked != 1,
412 "The atmospheric fields must be flagged to have "
413 "passed a consistency check (atmfields_checked=1).");
414
415 chk_if_bool("cloudbox_on", cloudbox_on);
416
417 if (cloudbox_on) {
418 // Winds, must be empty variables (i.e. no winds allowed)
419 ARTS_USER_ERROR_IF (!wind_w_field.empty() ||
420 !wind_v_field.empty() ||
421 !wind_u_field.empty(),
422 "The scattering methods are not (yet?) handling winds. For this\n"
423 "reason, the WSVs for wind fields must all be empty with an\n."
424 "active cloudbox.");
425
426 // no "particles" in abs_species if cloudbox is on (they act on the same
427 // scat_data! and there is no good reason to have some particles as
428 // abs-only, if we anyway do a scattering calculation.).
429 Index has_absparticles = 0;
430 for (Index sp = 0; sp < abs_species.nelem() && has_absparticles < 1; sp++) {
431 if (abs_species[sp].Particles()) {
432 has_absparticles = 1;
433 }
434 }
435 ARTS_USER_ERROR_IF (has_absparticles,
436 "For scattering calculations (cloudbox is on),"
437 "abs_species is not allowed to contain\n"
438 "'particles' (absorbing-only particles)!");
439
440 // Cloudbox limits
441 ARTS_USER_ERROR_IF (cloudbox_limits.nelem() != atmosphere_dim * 2,
442 "The array *cloudbox_limits* has incorrect length.\n"
443 "For atmospheric dim. = ", atmosphere_dim,
444 " the length shall be ", atmosphere_dim * 2, " but it is ",
445 cloudbox_limits.nelem(), ".")
446 ARTS_USER_ERROR_IF (cloudbox_limits[1] <= cloudbox_limits[0] || cloudbox_limits[0] < 0 ||
447 cloudbox_limits[1] >= p_grid.nelem(),
448 "Incorrect value(s) for cloud box pressure limit(s) found."
449 "\nValues are either out of range or upper limit is not "
450 "greater than lower limit.\nWith present length of "
451 "*p_grid*, OK values are 0 - ", p_grid.nelem() - 1,
452 ".\nThe pressure index limits are set to ", cloudbox_limits[0],
453 " - ", cloudbox_limits[1], ".")
454
455 Index nlat = 1, nlon = 1;
456
457 if (atmosphere_dim > 1) {
458 nlat = lat_grid.nelem();
459 if (demand_latlon_margin) {
460 ARTS_USER_ERROR_IF (cloudbox_limits[3] <= cloudbox_limits[2] ||
461 cloudbox_limits[2] < 1 ||
462 cloudbox_limits[3] >= nlat - 1,
463 "Incorrect value(s) for cloud box latitude limit(s) found."
464 "\nValues are either out of range or upper limit is not "
465 "greater than lower limit.\nWith present length of "
466 "*lat_grid* and demand_latlon_margin set to true, "
467 "OK values are 1 - ", nlat - 2,
468 ".\nThe latitude index limits are set to ", cloudbox_limits[2],
469 " - ", cloudbox_limits[3], ".")
470 ARTS_USER_ERROR_IF ((lat_grid[cloudbox_limits[2]] -
471 lat_grid[0] < LAT_LON_MIN) &&
472 (atmosphere_dim == 2 ||
473 (atmosphere_dim == 3 && lat_grid[0] > -90)),
474 "Too small distance between cloudbox and lower end of "
475 "latitude grid.\n"
476 "This distance must be ", LAT_LON_MIN, " degrees.\n"
477 "Cloudbox ends at ", lat_grid[cloudbox_limits[2]],
478 " and latitude grid starts at ", lat_grid[0], ".")
479 ARTS_USER_ERROR_IF ((lat_grid[nlat - 1] -
480 lat_grid[cloudbox_limits[3]] < LAT_LON_MIN) &&
481 (atmosphere_dim == 2 ||
482 (atmosphere_dim == 3 && lat_grid[nlat - 1] < 90)),
483 "Too small distance between cloudbox and upper end of "
484 "latitude grid.\n"
485 "This distance must be ", LAT_LON_MIN, " degrees.\n"
486 "Cloudbox ends at ", lat_grid[cloudbox_limits[3]],
487 " and latitude grid ends at ", lat_grid[nlat - 1], ".")
488 } else {
489 ARTS_USER_ERROR_IF (cloudbox_limits[3] <= cloudbox_limits[2] ||
490 cloudbox_limits[2] < 0 ||
491 cloudbox_limits[3] >= nlat,
492 "Incorrect value(s) for cloud box latitude limit(s) found."
493 "\nValues are either out of range or upper limit is not "
494 "greater than lower limit.\nWith present length of "
495 "*lat_grid* and demand_latlon_margin set to false, "
496 "OK values are 0 - ", nlat - 1,
497 ".\nThe latitude index limits are set to ", cloudbox_limits[2],
498 " - ", cloudbox_limits[3], ".")
499 }
500 }
501
502 if (atmosphere_dim > 2) {
503 nlon = lon_grid.nelem();
504 if (demand_latlon_margin) {
505 ARTS_USER_ERROR_IF (cloudbox_limits[5] <= cloudbox_limits[4] ||
506 cloudbox_limits[4] < 1 ||
507 cloudbox_limits[5] >= nlon - 1,
508 "Incorrect value(s) for cloud box longitude limit(s) found"
509 ".\nValues are either out of range or upper limit is not "
510 "greater than lower limit.\nWith present length of "
511 "*lon_grid* and demand_latlon_margin set to true,"
512 "OK values are 1 - ", nlon - 2,
513 ".\nThe longitude limits are set to ", cloudbox_limits[4],
514 " - ", cloudbox_limits[5], ".")
515 if (lon_grid[nlon - 1] - lon_grid[0] < 360) {
516 const Numeric latmax = max(abs(lat_grid[cloudbox_limits[2]]),
517 abs(lat_grid[cloudbox_limits[3]]));
518 const Numeric lfac = 1 / cos(DEG2RAD * latmax);
519 ARTS_USER_ERROR_IF (lon_grid[cloudbox_limits[4]] - lon_grid[0] <
520 LAT_LON_MIN / lfac,
521 "Too small distance between cloudbox and lower end of"
522 "the longitude\ngrid. This distance must here be ",
523 LAT_LON_MIN / lfac, " degrees.")
524 ARTS_USER_ERROR_IF (lon_grid[nlon - 1] - lon_grid[cloudbox_limits[5]] <
525 LAT_LON_MIN / lfac,
526 "Too small distance between cloudbox and upper end of"
527 "the longitude\ngrid. This distance must here be ",
528 LAT_LON_MIN / lfac, " degrees.")
529 }
530 } else {
531 ARTS_USER_ERROR_IF (cloudbox_limits[5] <= cloudbox_limits[4] ||
532 cloudbox_limits[4] < 0 ||
533 cloudbox_limits[5] >= nlon,
534 "Incorrect value(s) for cloud box longitude limit(s) found"
535 ".\nValues are either out of range or upper limit is not "
536 "greater than lower limit.\nWith present length of "
537 "*lon_grid* and demand_latlon_margin set to false,"
538 "OK values are 0 - ", nlon - 1,
539 ".\nThe longitude limits are set to ", cloudbox_limits[4],
540 " - ", cloudbox_limits[5], ".")
541 }
542 }
543
544 // Check with respect to z_surface
545 for (Index o = 0; o < nlon; o++) {
546 for (Index a = 0; a < nlat; a++) {
547 ARTS_USER_ERROR_IF (z_field(cloudbox_limits[1], a, o) <= z_surface(a, o),
548 "The upper vertical limit of the cloudbox must be above "
549 "the surface altitude (for all latitudes and longitudes).");
550 }
551 }
552
553 // Check pnd_field
554 //
555 const Index np = TotalNumberOfElements(scat_data);
556 // Dummy variables to mimic grids of correct size
557 Vector g1(cloudbox_limits[1] - cloudbox_limits[0] + 1), g2(0), g3(0);
558 if (atmosphere_dim > 1) {
559 g2.resize(cloudbox_limits[3] - cloudbox_limits[2] + 1);
560 }
561 if (atmosphere_dim > 2) {
562 g3.resize(cloudbox_limits[5] - cloudbox_limits[4] + 1);
563 }
564
565 chk_atm_field("pnd_field", pnd_field, atmosphere_dim, np, g1, g2, g3);
566
567 ARTS_USER_ERROR_IF (!negative_pnd_ok && min(pnd_field) < 0,
568 "Negative values in *pnd_field* not allowed.");
569
570 // No non-zero pnd at lower boundary unless lower boundary is at or below
571 // surface
572 for (Index a = 0; a < g2.nelem(); a++) {
573 for (Index o = 0; o < g3.nelem(); o++) {
574 ARTS_USER_ERROR_IF (max(pnd_field(joker, 0, a, o)) > 0 &&
575 z_field(cloudbox_limits[0], a, o) > z_surface(a, o),
576 "A non-zero value found in *pnd_field* at the"
577 " lower altitude limit of the cloudbox (but the "
578 "position is not at or below the surface altitude).");
579 }
580 }
581
582 // No non-zero pnd at upper boundary unless upper boundary is top of
583 // atmosphere
584 if (cloudbox_limits[1] != p_grid.nelem() - 1)
585 ARTS_USER_ERROR_IF (max(pnd_field(joker, g1.nelem() - 1, joker, joker)) > 0,
586 "A non-zero value found in *pnd_field* at "
587 "upper altitude limit of the cloudbox.");
588 if (atmosphere_dim >= 2) {
589 ARTS_USER_ERROR_IF (max(pnd_field(joker, joker, 0, joker)) > 0,
590 "A non-zero value found in *pnd_field* at "
591 "lower latitude limit of the cloudbox.");
592 ARTS_USER_ERROR_IF (max(pnd_field(joker, joker, g2.nelem() - 1, joker)) > 0,
593 "A non-zero value found in *pnd_field* at "
594 "upper latitude limit of the cloudbox.");
595 }
596 if (atmosphere_dim == 3) {
597 ARTS_USER_ERROR_IF (max(pnd_field(joker, joker, joker, 0)) > 0,
598 "A non-zero value found in *pnd_field* at "
599 "lower longitude limit of the cloudbox.");
600 ARTS_USER_ERROR_IF (max(pnd_field(joker, joker, joker, g3.nelem() - 1)) > 0,
601 "A non-zero value found in *pnd_field* at "
602 "upper longitude limit of the cloudbox.");
603 }
604
605 // And dpnd_field_dx
606 ARTS_USER_ERROR_IF (dpnd_field_dx.nelem() != jacobian_quantities.nelem(),
607 "Size of *dpnd_field_dx* inconsistent with number "
608 "of *jacobian_quantities*.");
609
610 // Check semi-mandatory variables, that are allowed to be empty
611 //
612
613 // scat_species:
614 if (scat_species.nelem() > 0)
615 ARTS_USER_ERROR_IF (scat_species.nelem() != scat_data.nelem(),
616 "Number of scattering species specified by scat_species does\n"
617 "not agree with number of scattering species in scat_data:\n"
618 "scat_species has ", scat_species.nelem(),
619 " entries, while scat_data has ", scat_data.nelem(), ".")
620
621 // particle_masses:
622 if (!particle_masses.empty()) {
623 ARTS_USER_ERROR_IF (particle_masses.nrows() != np,
624 "The WSV *particle_masses* must either be "
625 "empty or have a row size matching the "
626 "length of *scat_data*.");
627 ARTS_USER_ERROR_IF (min(particle_masses) < 0,
628 "All values in *particles_masses* must be >= 0.");
629 }
630 }
631
632 // If here, all OK
633 cloudbox_checked = 1;
634}
635
636/* Workspace method: Doxygen documentation will be auto-generated */
637void scat_data_checkedCalc(Index& scat_data_checked,
638 const ArrayOfArrayOfSingleScatteringData& scat_data,
639 const Vector& f_grid,
640 const Numeric& dfrel_threshold,
641 const String& check_level,
642 const Numeric& sca_mat_threshold,
643 const Verbosity& verbosity)
644// FIXME: when we allow K, a, Z to be on different f and T grids, their use in
645// the scatt solvers needs to be reviewed again and adapted to this!
646{
647 // Prevent the user from producing nonsense by using too much freedom in
648 // setting the single freq validity threshold...
649 ARTS_USER_ERROR_IF (dfrel_threshold > 0.5,
650 "*dfrel_threshold* too large (max. allowed: 0.5, your's: ",
651 dfrel_threshold, ").")
652
653 // freq range of calc covered?
654 ARTS_USER_ERROR_IF (f_grid.empty(), "The frequency grid is empty.");
655 if (f_grid.nelem() > 1) chk_if_increasing("f_grid", f_grid);
656
657 Index nf = f_grid.nelem();
658 Index N_ss = scat_data.nelem();
659 for (Index i_ss = 0; i_ss < N_ss; i_ss++) {
660 Index N_se = scat_data[i_ss].nelem();
661 for (Index i_se = 0; i_se < N_se; i_se++) {
662 // For each scattering element (se) check that se's f_grid is either
663 // identical to f_grid or contains a single entry only. In the latter
664 // case, the f/f_grid-ratio (equv. to a size parameter ratio) not allowed
665 // to exceed the dfrel_threshold.
666 Index nf_se = scat_data[i_ss][i_se].f_grid.nelem();
667 if (nf_se != 1) {
668 ARTS_USER_ERROR_IF (nf_se != nf,
669 "*scat_data* must have either one or *f_grid* (=", nf,
670 ") frequency entries,\n"
671 "but scattering element #", i_se, " in scattering species #",
672 i_ss, " has ", nf_se, ".")
673 for (Index f = 0; f < nf_se; f++) {
675 scat_data[i_ss][i_se].f_grid[f], f_grid[f], 0.5e-9),
676 "*scat_data* frequency grid has to be identical to *f_grid*\n"
677 "(or contain only a single entry),\n"
678 "but scattering element #", i_se,
679 " in scattering species #", i_ss,
680 " deviates for f_index ", f, ".")
681 }
682 } else {
683 ARTS_USER_ERROR_IF ((abs(1. - scat_data[i_ss][i_se].f_grid[0] / f_grid[0]) >
684 dfrel_threshold) or
685 (abs(1. - scat_data[i_ss][i_se].f_grid[0] / f_grid[nf - 1]) >
686 dfrel_threshold),
687 "Frequency entry (f=", scat_data[i_ss][i_se].f_grid[0],
688 "Hz) of scattering element #", i_se, "\n"
689 "in scattering species #", i_ss, " is too far (>",
690 dfrel_threshold * 1e2, "%) from one or more\n"
691 "of the f_grid limits (fmin=", f_grid[0],
692 "Hz, fmax=", f_grid[nf - 1], "Hz).")
693 }
694
695 // check that the freq dimension of sca_mat, ext_mat, and abs_vec is
696 // either ssd.f_grid.nelem() or 1 (FIXME: so far, being freq dim !=
697 // ssd.f_grid.nelem() switched off, as usage in scatt solvers so far
698 // doesn't allow this. see FIXME at start.).
699 {
700 ostringstream bs1, bs2;
701 bs1 << "Frequency dimension of ";
702 //bs2 << " must be either one or ssd.f_grid.nelem() (=" << nf_se << "),\n"
703 bs2 << " must be ssd.f_grid.nelem() (=" << nf_se << "),\n"
704 << "but scattering element #" << i_se << " in scattering species #"
705 << i_ss << " is ";
706 Index nf_sd = scat_data[i_ss][i_se].pha_mat_data.nlibraries();
707 ARTS_USER_ERROR_IF (nf_sd != nf_se,
708 bs1.str(), "pha_mat_data", bs2.str(), nf_se, ".")
709 nf_sd = scat_data[i_ss][i_se].ext_mat_data.nshelves();
710 ARTS_USER_ERROR_IF (nf_sd != nf_se,
711 bs1.str(), "ext_mat_data", bs2.str(), nf_se, ".")
712 nf_sd = scat_data[i_ss][i_se].abs_vec_data.nshelves();
713 ARTS_USER_ERROR_IF (nf_sd != nf_se,
714 bs1.str(), "abs_vec_data", bs2.str(), nf_se, ".")
715 }
716
717 // check that the temp dimension of K and a is ssd.T_grid.nelem(). For Z
718 // it might be ssd.T_grid.nelem() or 1.
719 {
720 ostringstream bs1, bs2;
721 Index nt_se = scat_data[i_ss][i_se].T_grid.nelem();
722 bs1 << "Temperature dimension of ";
723 //bs2 << " must be either one or ssd.T_grid.nelem(),\n"
724 bs2 << " must be ssd.T_grid.nelem() (=" << nt_se << "),\n"
725 << "but for scattering element #" << i_se
726 << " in scattering species #" << i_ss << " it is ";
727 Index nt_sd = scat_data[i_ss][i_se].pha_mat_data.nvitrines();
728 ARTS_USER_ERROR_IF (nt_sd != nt_se and nt_sd != 1,
729 bs1.str(), "pha_mat_data", bs2.str(), nt_sd, ".")
730 nt_sd = scat_data[i_ss][i_se].ext_mat_data.nbooks();
731 ARTS_USER_ERROR_IF (nt_sd != nt_se,
732 bs1.str(), "ext_mat_data", bs2.str(), nt_se, ".")
733 nt_sd = scat_data[i_ss][i_se].abs_vec_data.nbooks();
734 ARTS_USER_ERROR_IF (nt_sd != nt_se,
735 bs1.str(), "abs_vec_data", bs2.str(), nt_se, ".")
736 }
737 }
738 }
739
740 if (check_level.toupper() != "NONE") {
741 // handing over to scat_dataCheck which checks whether
742 // 1) scat_data containing any NaN?
743 // 2) any negative values in Z11, K11, or a1?
744 // 3) sca_mat norm sufficiently good (int(Z11)~=K11-a1?)
745 // 1) & 2) always done
746 // 3) only done if scat_data_check_level is "all"
747 scat_dataCheck(scat_data, check_level, sca_mat_threshold, verbosity);
748 }
749
750 // If here, all OK
751 scat_data_checked = 1;
752}
753
754/* Workspace method: Doxygen documentation will be auto-generated */
755void lbl_checkedCalc(Index& lbl_checked,
756 const ArrayOfArrayOfAbsorptionLines& abs_lines_per_species,
757 const ArrayOfArrayOfSpeciesTag& abs_species,
759 const Verbosity&)
760{
761 checkIsotopologueRatios(abs_lines_per_species, isotopologue_ratios);
762 checkPartitionFunctions(abs_lines_per_species);
763
764 lbl_checked = false;
765
766 ARTS_USER_ERROR_IF (abs_lines_per_species.nelem() not_eq abs_species.nelem(),
767 "abs_lines_per_species and abs_species must have same length.\n"
768 "Instead len(abs_lines_per_species) = ",
769 abs_lines_per_species.nelem(),
770 " and len(abs_species) = ",
771 abs_species.nelem(),
772 '\n')
773
774 for (Index i=0; i<abs_species.nelem(); i++) {
775 auto& specs = abs_species[i];
776 auto& lines = abs_lines_per_species[i];
777
778 if (not specs.nelem()) {
779 if (not lines.nelem()) {
780 continue;
781 }
782 ARTS_USER_ERROR ( "Lines for non-existent species discovered!\n");
783 }
784
785 const bool any_zeeman = std::any_of(specs.cbegin(), specs.cend(), [](auto& x){return x.Type() == Species::TagType::Zeeman;});
786 ARTS_USER_ERROR_IF (any_zeeman and (not std::all_of(specs.cbegin(), specs.cend(), [](auto& x){return x.Type() == Species::TagType::Zeeman;})),
787 "Zeeman species found but not all sub-species tags support Zeeman effect.\n"
788 "Offending tag: ", specs, '\n')
789
790 if (any_zeeman) {
791 for (auto& band: lines) {
792 ARTS_USER_ERROR_IF (band.cutoff not_eq Absorption::CutoffType::None,
793 "Zeeman effects are not symmetric, you cannot use cutoff.\n");
794 for (Index k=0; k<band.NumLines(); k++) {
795 bool hasJ = band.lines[k].localquanta.val.has(QuantumNumberType::J);
796 bool hasF = band.lines[k].localquanta.val.has(QuantumNumberType::F);
797 ARTS_USER_ERROR_IF (not(hasF or hasJ),
798 "No J(s) or F(s) yet declared Zeeman splitting.\n");
799
800 auto& qn = hasF ? band.lines[k].localquanta.val[QuantumNumberType::F] : band.lines[k].localquanta.val[QuantumNumberType::J];
802 "Bad Wigner numbers for upper state F or J. Try increasing the Wigner memory allocation.\n");
804 "Bad Wigner numbers for lower state F or J. Try increasing the Wigner memory allocation.\n");
805
806 auto Ze = band.lines[k].zeeman;
807 ARTS_USER_ERROR_IF (Ze.gu() == 0 ? false : not std::isnormal(Ze.gu()),
808 "Bad value(s) in the upper Zeeman data not allowed when modeling Zeeman effect.\n");
809 ARTS_USER_ERROR_IF (Ze.gl() == 0 ? false : not std::isnormal(Ze.gl()),
810 "Bad value(s) in the lower Zeeman data not allowed when modeling Zeeman effect.\n");
811 }
812 }
813 } else /*if (not any any_zeeman)*/ {
814 }
815
816 // Checks per band
817 for (auto& band: lines) {
818 ARTS_USER_ERROR_IF (band.mirroring not_eq Absorption::MirroringType::Manual and
819 std::any_of(band.lines.cbegin(), band.lines.cend(),
820 [](auto& x){return x.F0 <= 0;}),
821 "Negative or zero frequency in non-Manual mirrored band.\n");
822 }
823 }
824
825 for (auto& lines: abs_lines_per_species) {
826 for (auto& band: lines) {
827
828 // Mirroring checks
829 for (auto& line: band.lines) {
830 if (band.mirroring == Absorption::MirroringType::Manual) {
831 ARTS_USER_ERROR_IF(line.F0 >= 0,
832 "Must have negative frequency, finds " , line.F0)
833 } else {
834 ARTS_USER_ERROR_IF(line.F0 <= 0,
835 "Must have positive frequency, finds " , line.F0)
836 }
837 }
838
839 // Cutoff checks
840 switch (band.cutoff) {
841 case Absorption::CutoffType::None: break;
842 case Absorption::CutoffType::ByLine: {
843 ARTS_USER_ERROR_IF (not (band.mirroring == Absorption::MirroringType::None or
844 band.mirroring == Absorption::MirroringType::Manual),
845 "Cutoff only possible with symmetric mirroring types")
847 "Cannot have relaxation matrix line mixing with cutoff calculations")
848 ARTS_USER_ERROR_IF (not (band.lineshapetype == LineShape::Type::DP or
849 band.lineshapetype == LineShape::Type::LP or
850 band.lineshapetype == LineShape::Type::VP),
851 "Cutoff only possible with symmetric line shape types")
852 for (auto& line: band.lines) {
853 for (auto& single_data: line.lineshape.Data()) {
854 // Skipping G() intentionally, since the calculations technically works with it
856 single_data.Y().type not_eq LineShape::TemperatureModel::None or
857 single_data.DV().type not_eq LineShape::TemperatureModel::None,
858 "Cannot have Rosenkranz-style line mixing with cutoff calculations"
859 )
860 }
861 }
862 } break;
863 case Absorption::CutoffType::FINAL: ARTS_USER_ERROR("You have a band with undefined cutoff type.")
864 }
865 }
866 }
867
868 lbl_checked = true;
869}
870
871/* Workspace method: Doxygen documentation will be auto-generated */
873 Workspace& ws _U_,
874 Index& propmat_clearsky_agenda_checked,
875 // WS Input:
876 const ArrayOfArrayOfSpeciesTag& abs_species,
877 const Agenda& propmat_clearsky_agenda,
878 const Verbosity&) {
879 bool needs_lines = false;
880 bool needs_zeeman = false;
881 bool needs_predefined = false;
882 bool needs_continua = false;
883 bool needs_cia = false;
884 bool needs_free_electrons = false;
885 bool needs_particles = false;
886 bool needs_hxsec = false;
887
888 for (auto& tag_groups: abs_species) {
889 for (auto& tag: tag_groups) {
890 switch (tag.Type()) {
891 case Species::TagType::Plain:
892 needs_lines = true;
893 break;
894 case Species::TagType::Zeeman:
895 needs_zeeman = true;
896 break;
897 case Species::TagType::PredefinedModern:
898 needs_predefined = true;
899 break;
900 case Species::TagType::PredefinedLegacy:
901 needs_continua = true;
902 break;
903 case Species::TagType::Cia:
904 needs_cia = true;
905 break;
906 case Species::TagType::FreeElectrons:
907 needs_free_electrons = true;
908 break;
909 case Species::TagType::Particles:
910 needs_particles = true;
911 break;
912 case Species::TagType::HitranXsec:
913 needs_hxsec = true;
914 break;
915 default:
916 ARTS_ASSERT(false, "Unknown species type: ", tag.Type())
917 break;
918 }
919 }
920 }
921
923 needs_lines and
924 not(propmat_clearsky_agenda.has_method("propmat_clearskyAddLines") or
925 propmat_clearsky_agenda.has_method(
926 "propmat_clearskyAddFromLookup")),
927 "*abs_species* contains normal lines species but *propmat_clearsky_agenda*\n"
928 "cannot support lines.");
929
931 needs_continua and
932 not(propmat_clearsky_agenda.has_method("propmat_clearskyAddXsecAgenda") or
933 propmat_clearsky_agenda.has_method(
934 "propmat_clearskyAddFromLookup")),
935 "*abs_species* contains legacy continua but *propmat_clearsky_agenda*\n"
936 "cannot support these.");
937
939 needs_cia and
940 not(propmat_clearsky_agenda.has_method("propmat_clearskyAddXsecAgenda") or
941 propmat_clearsky_agenda.has_method(
942 "propmat_clearskyAddFromLookup")),
943 "*abs_species* contains CIA models but *propmat_clearsky_agenda*\n"
944 "cannot support these.");
945
947 needs_hxsec and
948 not(propmat_clearsky_agenda.has_method("propmat_clearskyAddXsecAgenda") or
949 propmat_clearsky_agenda.has_method("propmat_clearskyAddHitranXsec") or
950 propmat_clearsky_agenda.has_method(
951 "propmat_clearskyAddFromLookup")),
952 "*abs_species* contains Hitran XSEC models but *propmat_clearsky_agenda*\n"
953 "cannot support these.");
954
956 needs_predefined and
957 not(propmat_clearsky_agenda.has_method("propmat_clearskyAddPredefined") or
958 propmat_clearsky_agenda.has_method(
959 "propmat_clearskyAddFromLookup")),
960 "*abs_species* contains modern continua models but *propmat_clearsky_agenda*\n"
961 "cannot support these.");
962
963 ARTS_USER_ERROR_IF (needs_zeeman and
964 not propmat_clearsky_agenda.has_method("propmat_clearskyAddZeeman"),
965 "*abs_species* contains Zeeman species but *propmat_clearsky_agenda*\n"
966 "does not contain *propmat_clearskyAddZeeman*.");
967
968 ARTS_USER_ERROR_IF (needs_free_electrons and
969 not propmat_clearsky_agenda.has_method("propmat_clearskyAddFaraday"),
970 "*abs_species* contains Zeeman species but *propmat_clearsky_agenda*\n"
971 "does not contain *propmat_clearskyAddFaraday*.");
972
973 ARTS_USER_ERROR_IF (needs_particles &&
974 !(propmat_clearsky_agenda.has_method("propmat_clearskyAddParticles")),
975 "*abs_species* contains particles but *propmat_clearsky_agenda*\n"
976 "does not contain *propmat_clearskyAddParticles*.");
977
978 propmat_clearsky_agenda_checked = 1;
979}
980
981/* Workspace method: Doxygen documentation will be auto-generated */
982void sensor_checkedCalc(Index& sensor_checked,
983 const Index& atmosphere_dim,
984 const Index& stokes_dim,
985 const Vector& f_grid,
986 const Matrix& sensor_pos,
987 const Matrix& sensor_los,
988 const Matrix& transmitter_pos,
989 const Matrix& mblock_dlos_grid,
990 const Sparse& sensor_response,
991 const Vector& sensor_response_f,
992 const ArrayOfIndex& sensor_response_pol,
993 const Matrix& sensor_response_dlos,
994 const Verbosity&) {
995 // Some sizes
996 const Index nf = f_grid.nelem();
997 const Index nlos = mblock_dlos_grid.nrows();
998 const Index n1y = sensor_response.nrows();
999 const Index nmblock = sensor_pos.nrows();
1000 const Index niyb = nf * nlos * stokes_dim;
1001
1002 // Sensor position and LOS.
1003 //
1005 "*f_grid* must be a strictly increasing vector.");
1006
1007 // Sensor position and LOS.
1008 //
1009 ARTS_USER_ERROR_IF (sensor_pos.empty(),
1010 "*sensor_pos* is empty. This is not allowed.");
1011 ARTS_USER_ERROR_IF (sensor_los.empty(),
1012 "*sensor_los* is empty. This is not allowed.");
1013 //
1014 ARTS_USER_ERROR_IF (sensor_pos.ncols() != atmosphere_dim,
1015 "The number of columns of sensor_pos must be "
1016 "equal to the atmospheric dimensionality.");
1017 ARTS_USER_ERROR_IF (atmosphere_dim <= 2 && sensor_los.ncols() != 1,
1018 "For 1D and 2D, sensor_los shall have one column.");
1019 ARTS_USER_ERROR_IF (atmosphere_dim == 3 && sensor_los.ncols() != 2,
1020 "For 3D, sensor_los shall have two columns.");
1021 ARTS_USER_ERROR_IF (sensor_los.nrows() != nmblock,
1022 "The number of rows of sensor_pos and sensor_los must be "
1023 "identical, but sensor_pos has ", nmblock, " rows,\n"
1024 "while sensor_los has ", sensor_los.nrows(), " rows.")
1025 ARTS_USER_ERROR_IF (max(sensor_los(joker, 0)) > 180,
1026 "First column of *sensor_los* is not allowed to have values above 180.");
1027 if (atmosphere_dim == 2) {
1028 ARTS_USER_ERROR_IF (min(sensor_los(joker, 0)) < -180,
1029 "For atmosphere_dim = 2, first column of "
1030 "*sensor_los* is not allowed to have values below -180.");
1031 } else {
1032 ARTS_USER_ERROR_IF (min(sensor_los(joker, 0)) < 0,
1033 "For atmosphere_dim != 2, first column of "
1034 "*sensor_los* is not allowed to have values below 0.");
1035 }
1036 if (atmosphere_dim == 3) {
1037 ARTS_USER_ERROR_IF (max(sensor_los(joker, 1)) > 180,
1038 "Second column of *sensor_los* is not allowed to have values above 180.");
1039 ARTS_USER_ERROR_IF (min(sensor_los(joker, 1)) < -180,
1040 "Second column of *sensor_los* is not allowed to have values below -180.");
1041 }
1042
1043 // Transmission position.
1044 if (!transmitter_pos.empty()) {
1045 ARTS_USER_ERROR_IF (transmitter_pos.nrows() != sensor_pos.nrows(),
1046 "*transmitter_pos* must either be empty or have "
1047 "the same number of rows as *sensor_pos*.");
1048 ARTS_USER_ERROR_IF (transmitter_pos.ncols() != max(Index(2), atmosphere_dim),
1049 "*transmitter_pos* must either be empty, have "
1050 "2 for 1D/2D or 3 columns for 3D.");
1051 }
1052
1053 // mblock_dlos_grid
1054 //
1055 ARTS_USER_ERROR_IF (mblock_dlos_grid.empty(),
1056 "*mblock_dlos_grid* is empty.");
1057 ARTS_USER_ERROR_IF (mblock_dlos_grid.ncols() > 2,
1058 "The maximum number of columns in *mblock_dlos_grid* is two.");
1059 if (atmosphere_dim < 3) {
1060 ARTS_USER_ERROR_IF (mblock_dlos_grid.ncols() != 1,
1061 "For 1D and 2D *mblock_dlos_grid* must have exactly one column.");
1062 }
1063
1064 // Sensor
1065 //
1066 ARTS_USER_ERROR_IF (sensor_response.ncols() != niyb,
1067 "The *sensor_response* matrix does not have the right size,\n"
1068 "either the method *sensor_responseInit* has not been run or some\n"
1069 "of the other sensor response methods has not been correctly\n"
1070 "configured.")
1071
1072 // Sensor aux variables
1073 //
1074 ARTS_USER_ERROR_IF (n1y != sensor_response_f.nelem() || n1y != sensor_response_pol.nelem() ||
1075 n1y != sensor_response_dlos.nrows(),
1076 "Sensor auxiliary variables do not have the correct size.\n"
1077 "The following variables should all have same size:\n"
1078 "length of y for one block : ", n1y, "\n"
1079 "sensor_response_f.nelem() : ", sensor_response_f.nelem(),
1080 "\nsensor_response_pol.nelem() : ", sensor_response_pol.nelem(),
1081 "\nsensor_response_dlos.nrows(): ", sensor_response_dlos.nrows(),
1082 "\n")
1083
1084 // If here, all OK
1085 sensor_checked = 1;
1086}
void checkIsotopologueRatios(const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const Species::IsotopologueRatios &isoratios)
Check that isotopologue ratios for the given species are correctly defined.
Definition: absorption.cc:61
void checkPartitionFunctions(const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species)
Check that ARTS was compiled for all requested species tags.
Definition: absorption.cc:50
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
Definition: array.h:345
The global header file for ARTS.
void chk_atm_surface(const String &x_name, const Matrix &x, const Index &dim, ConstVectorView lat_grid, ConstVectorView lon_grid)
chk_atm_surface
void chk_if_bool(const String &x_name, const Index &x)
chk_if_bool
Definition: check_input.cc:65
void chk_atm_grids(const Index &dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid)
chk_atm_grids
void chk_atm_vecfield_lat90(const String &x1_name, ConstTensor3View x1, const String &x2_name, ConstTensor3View x2, const Index &dim, ConstVectorView lat_grid, const Numeric &threshold)
chk_atm_vecfield_lat90
void chk_if_in_range(const String &x_name, const Index &x, const Index &x_low, const Index &x_high)
chk_if_in_range
Definition: check_input.cc:86
void chk_atm_field(const String &x_name, ConstTensor3View x, const Index &dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, const bool &chk_lat90)
chk_atm_field (simple fields)
void chk_if_increasing(const String &x_name, const ArrayOfIndex &x)
chk_if_increasing
Definition: check_input.cc:111
The Agenda class.
Definition: agenda_class.h:51
bool has_method(const String &methodname) const
Check if method is in Agenda.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Definition: array.h:197
bool empty() const noexcept
Definition: matpackI.h:1066
Index nrows() const noexcept
Definition: matpackI.h:1061
Index ncols() const noexcept
Definition: matpackI.h:1062
bool empty() const noexcept
Definition: matpackIII.h:152
Index npages() const
Returns the number of pages.
Definition: matpackIII.h:140
Index nrows() const
Returns the number of rows.
Definition: matpackIII.h:143
Index ncols() const
Returns the number of columns.
Definition: matpackIII.h:146
Index nelem() const noexcept
Returns the number of elements.
Definition: matpackI.h:541
bool empty() const noexcept
Returns true if variable size is zero.
Definition: matpackI.h:530
The Matrix class.
Definition: matpackI.h:1270
The Tensor3 class.
Definition: matpackIII.h:344
The Tensor4 class.
Definition: matpackIV.h:427
The Vector class.
Definition: matpackI.h:908
void resize(Index n)
Resize function.
Definition: matpackI.cc:411
Workspace class.
Definition: workspace_ng.h:40
void toupper()
Convert to upper case.
Definition: mystring.h:75
Internal cloudbox functions.
#define _U_
Definition: config.h:180
#define ARTS_ASSERT(condition,...)
Definition: debug.h:83
#define ARTS_USER_ERROR(...)
Definition: debug.h:150
std::string var_string(Args &&... args)
Definition: debug.h:36
#define ARTS_USER_ERROR_IF(condition,...)
Definition: debug.h:134
#define abs(x)
#define min(a, b)
#define max(a, b)
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
Definition: logic.cc:215
bool is_same_within_epsilon(const Numeric &a, const Numeric &b, const Numeric &epsilon)
Check, if two numbers agree within a given epsilon.
Definition: logic.cc:351
void sensor_checkedCalc(Index &sensor_checked, const Index &atmosphere_dim, const Index &stokes_dim, const Vector &f_grid, const Matrix &sensor_pos, const Matrix &sensor_los, const Matrix &transmitter_pos, const Matrix &mblock_dlos_grid, const Sparse &sensor_response, const Vector &sensor_response_f, const ArrayOfIndex &sensor_response_pol, const Matrix &sensor_response_dlos, const Verbosity &)
WORKSPACE METHOD: sensor_checkedCalc.
Definition: m_checked.cc:982
void abs_xsec_agenda_checkedCalc(Workspace &ws, Index &abs_xsec_agenda_checked, const ArrayOfArrayOfSpeciesTag &abs_species, const Agenda &abs_xsec_agenda, const Verbosity &)
WORKSPACE METHOD: abs_xsec_agenda_checkedCalc.
Definition: m_checked.cc:45
void atmfields_checkedCalc(Index &atmfields_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &t_field, const Tensor4 &vmr_field, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Index &abs_f_interp_order, const Index &negative_vmr_ok, const Verbosity &)
WORKSPACE METHOD: atmfields_checkedCalc.
Definition: m_checked.cc:98
const Numeric LAT_LON_MIN
void cloudbox_checkedCalc(Index &cloudbox_checked, const Index &atmfields_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &z_surface, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSingleScatteringData &scat_data, const ArrayOfString &scat_species, const Matrix &particle_masses, const ArrayOfArrayOfSpeciesTag &abs_species, const Index &demand_latlon_margin, const Index &negative_pnd_ok, const Verbosity &)
WORKSPACE METHOD: cloudbox_checkedCalc.
Definition: m_checked.cc:388
void propmat_clearsky_agenda_checkedCalc(Workspace &ws, Index &propmat_clearsky_agenda_checked, const ArrayOfArrayOfSpeciesTag &abs_species, const Agenda &propmat_clearsky_agenda, const Verbosity &)
WORKSPACE METHOD: propmat_clearsky_agenda_checkedCalc.
Definition: m_checked.cc:872
void scat_data_checkedCalc(Index &scat_data_checked, const ArrayOfArrayOfSingleScatteringData &scat_data, const Vector &f_grid, const Numeric &dfrel_threshold, const String &check_level, const Numeric &sca_mat_threshold, const Verbosity &verbosity)
WORKSPACE METHOD: scat_data_checkedCalc.
Definition: m_checked.cc:637
void lbl_checkedCalc(Index &lbl_checked, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const ArrayOfArrayOfSpeciesTag &abs_species, const SpeciesIsotopologueRatios &isotopologue_ratios, const Verbosity &)
WORKSPACE METHOD: lbl_checkedCalc.
Definition: m_checked.cc:755
const Numeric DEG2RAD
void atmgeom_checkedCalc(Index &atmgeom_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &refellipsoid, const Matrix &z_surface, const Vector &lat_true, const Vector &lon_true, const Numeric &max500hpa_gradient, const Verbosity &)
WORKSPACE METHOD: atmgeom_checkedCalc.
Definition: m_checked.cc:263
void scat_dataCheck(const ArrayOfArrayOfSingleScatteringData &scat_data, const String &check_type, const Numeric &threshold, const Verbosity &verbosity)
WORKSPACE METHOD: scat_dataCheck.
Implementation of Matrix, Vector, and such stuff.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
const Joker joker
constexpr bool relaxationtype_relmat(PopulationType in) noexcept
SpeciesIsotopologueRatios isotopologue_ratios()
#define a
The Sparse class.
Definition: matpackII.h:67
Index nrows() const
Returns the number of rows.
Definition: matpackII.cc:66
Index ncols() const
Returns the number of columns.
Definition: matpackII.cc:69
bool is_wigner3_ready(const Rational &J)
Tells if the function is ready for Wigner 3J calculations.