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