13 const String& method_name) {
21 for (
auto& output : method.Out()) {
22 auto& var = var_order.emplace_back();
29 for (Index i = 0; i < method.GOut().nelem(); i++) {
30 auto& var = var_order.emplace_back();
31 var.name = method.GOut()[i];
32 var.group = method.GOutType()[i];
35 var.any = var.group == any_pos;
38 for (
auto& input : method.In()) {
40 if (std::any_of(method.Out().begin(),
42 [input](
auto& output) { return input == output; }))
45 auto& var = var_order.emplace_back();
52 for (Index i = 0; i < method.GIn().nelem(); i++) {
53 auto& var = var_order.emplace_back();
54 var.name = method.GIn()[i];
55 var.group = method.GInType()[i];
58 var.any = var.group == any_pos;
61 if (method.GInDefault()[i] not_eq
NODEF) {
73 for (
auto& var : var_order) {
75 in.push_back(var.ws_pos);
77 out.push_back(var.ws_pos);
83 : test(
opt::NameOnly), str(x +
"=" + y) {}
93 const std::string_view expr = wsv.
str;
94 auto equal_sign = expr.find(
'=');
95 if (equal_sign == expr.npos) {
101 rhs.remove_prefix(equal_sign);
104 lhs.remove_suffix(rhs.size());
106 while (lhs.size() and (std::isspace(lhs.front()) or lhs.front() ==
'='))
107 lhs.remove_prefix(1);
108 while (lhs.size() and (std::isspace(lhs.back()) or lhs.back() ==
'='))
109 lhs.remove_suffix(1);
110 while (rhs.size() and (std::isspace(rhs.front()) or rhs.front() ==
'='))
111 rhs.remove_prefix(1);
112 while (rhs.size() and (std::isspace(rhs.back()) or rhs.back() ==
'='))
113 rhs.remove_suffix(1);
157 const std::string_view rhs) {
158 auto ptr = std::find_if(
159 list.begin(), list.end(), [rhs](
auto& x) { return x.name == rhs; });
161 ptr not_eq list.end(),
"Wrongly named parameter selection: ", rhs);
162 method_pos = std::distance(list.begin(), ptr);
172 : ws(workspace), agenda(ws) {
182 for (
auto& wsv: method.In()) input.push_back(wsv);
183 for (
auto& wsv: method.Out()) output.push_back(wsv);
185 std::sort(input.begin(), input.end());
186 std::sort(output.begin(), output.end());
189 for (
auto& wsv: agrecord.In()) {
190 auto test = [wsv](
auto& x){
return x == wsv;};
191 if (std::none_of(input.begin(), input.end(), test) and std::none_of(output.begin(), output.end(), test)) {
199 for (
auto& wsv: agrecord.Out()) {
200 auto test = [wsv](
auto& x){
return x == wsv;};
201 if (std::none_of(output.begin(), output.end(), test)) {
228 using enum Options::iy_main_agendaDefaultOptions;
229 switch (Options::toiy_main_agendaDefaultOptionsOrThrow(
option)) {
231 agenda.
add(
"ppathCalc");
232 agenda.
add(
"iyEmissionStandard");
233 agenda.
set(
"geo_pos", Vector{});
235 case EmissionPlaneParallel:
236 agenda.
add(
"ppathPlaneParallel");
237 agenda.
add(
"iyEmissionStandard");
238 agenda.
set(
"geo_pos", Vector{});
241 agenda.
add(
"ppathCalc");
242 agenda.
add(
"iyClearsky");
243 agenda.
set(
"geo_pos", Vector{});
246 agenda.
add(
"ppathCalc",
SetWsv{
"cloudbox_on", Index{0}});
247 agenda.
add(
"iyTransmissionStandard");
248 agenda.
set(
"geo_pos", Vector{});
250 case TransmissionUnitUnpolIntensity:
252 "MatrixUnitIntensity",
"iy_transmitter",
"stokes_dim",
"f_grid");
253 agenda.
add(
"ppathCalc",
SetWsv{
"cloudbox_on", Index{0}});
254 agenda.
add(
"iyTransmissionStandard");
255 agenda.
set(
"geo_pos", Vector{});
257 case TransmissionUnitPolIntensity:
258 agenda.
add(
"iy_transmitterSinglePol");
259 agenda.
add(
"ppathCalc",
SetWsv{
"cloudbox_on", Index{0}});
260 agenda.
add(
"iyTransmissionStandard");
261 agenda.
set(
"geo_pos", Vector{});
264 agenda.
add(
"iyLoopFrequencies");
265 agenda.
set(
"geo_pos", Vector{});
270 agenda.
set(
"geo_pos", Vector{});
283 using enum Options::iy_loop_freqs_agendaDefaultOptions;
284 switch (Options::toiy_loop_freqs_agendaDefaultOptionsOrThrow(
option)) {
286 agenda.
add(
"ppathCalc");
287 agenda.
add(
"iyEmissionStandard");
290 agenda.
add(
"ppathCalc");
291 agenda.
add(
"iyTransmissionStandard");
303 using enum Options::iy_space_agendaDefaultOptions;
304 switch (Options::toiy_space_agendaDefaultOptionsOrThrow(
option)) {
305 case CosmicBackground:
306 agenda.
add(
"MatrixCBR",
"iy",
"stokes_dim",
"f_grid");
318 using enum Options::iy_surface_agendaDefaultOptions;
319 switch (Options::toiy_surface_agendaDefaultOptionsOrThrow(
option)) {
320 case UseSurfaceRtprop:
321 agenda.
add(
"SurfaceDummy");
322 agenda.
add(
"iySurfaceRtpropAgenda");
334 using enum Options::iy_cloudbox_agendaDefaultOptions;
335 switch (Options::toiy_cloudbox_agendaDefaultOptionsOrThrow(
option)) {
337 agenda.
add(
"iyInterpCloudboxField");
339 case QuarticInterpField:
340 agenda.
add(
"iyInterpCloudboxField",
SetWsv{
"za_interp_order", Index{4}});
352 using enum Options::ppath_agendaDefaultOptions;
353 switch (Options::toppath_agendaDefaultOptionsOrThrow(
option)) {
354 case FollowSensorLosPath:
355 agenda.
add(
"ppathStepByStep");
358 agenda.
add(
"ppathPlaneParallel");
360 case TransmitterReceiverPath:
361 agenda.
add(
"rte_losGeometricFromRtePosToRtePos2");
362 agenda.
add(
"ppathFromRtePos2");
374 using enum Options::ppath_step_agendaDefaultOptions;
375 switch (Options::toppath_step_agendaDefaultOptionsOrThrow(
option)) {
377 agenda.
add(
"ppath_stepGeometric");
380 agenda.
add(
"ppath_stepRefractionBasic");
392 using enum Options::refr_index_air_agendaDefaultOptions;
393 switch (Options::torefr_index_air_agendaDefaultOptionsOrThrow(
option)) {
395 agenda.
set(
"refr_index_air", Numeric{1.0});
396 agenda.
set(
"refr_index_air_group", Numeric{1.0});
398 case GasMicrowavesEarth:
399 agenda.
set(
"refr_index_air", Numeric{1.0});
400 agenda.
set(
"refr_index_air_group", Numeric{1.0});
401 agenda.
add(
"refr_index_airMicrowavesEarth");
403 case GasInfraredEarth:
404 agenda.
set(
"refr_index_air", Numeric{1.0});
405 agenda.
set(
"refr_index_air_group", Numeric{1.0});
406 agenda.
add(
"refr_index_airInfraredEarth");
408 case GasMicrowavesGeneral:
409 agenda.
set(
"refr_index_air", Numeric{1.0});
410 agenda.
set(
"refr_index_air_group", Numeric{1.0});
411 agenda.
add(
"refr_index_airMicrowavesGeneral");
414 agenda.
set(
"refr_index_air", Numeric{1.0});
415 agenda.
set(
"refr_index_air_group", Numeric{1.0});
416 agenda.
add(
"refr_index_airFreeElectrons");
418 case GasMicrowavesGeneralAndElectrons:
419 agenda.
set(
"refr_index_air", Numeric{1.0});
420 agenda.
set(
"refr_index_air_group", Numeric{1.0});
421 agenda.
add(
"refr_index_airMicrowavesGeneral");
422 agenda.
add(
"refr_index_airFreeElectrons");
424 case GasMicrowavesEarthAndElectrons:
425 agenda.
set(
"refr_index_air", Numeric{1.0});
426 agenda.
set(
"refr_index_air_group", Numeric{1.0});
427 agenda.
add(
"refr_index_airMicrowavesEarth");
428 agenda.
add(
"refr_index_airFreeElectrons");
440 using enum Options::water_p_eq_agendaDefaultOptions;
441 switch (Options::towater_p_eq_agendaDefaultOptionsOrThrow(
option)) {
443 agenda.
add(
"water_p_eq_fieldMK05");
455 using enum Options::gas_scattering_agendaDefaultOptions;
456 switch (Options::togas_scattering_agendaDefaultOptionsOrThrow(
option)) {
469 using enum Options::surface_rtprop_agendaDefaultOptions;
470 switch (Options::tosurface_rtprop_agendaDefaultOptionsOrThrow(
option)) {
471 case Blackbody_SurfTFromt_surface:
472 agenda.
add(
"InterpSurfaceFieldToPosition",
473 "output=surface_skin_t",
475 agenda.
add(
"surfaceBlackbody");
477 case Blackbody_SurfTFromt_field:
479 "InterpAtmFieldToPosition",
"output=surface_skin_t",
"field=t_field");
480 agenda.
add(
"surfaceBlackbody");
482 case Specular_NoPol_ReflFix_SurfTFromt_surface:
483 agenda.
add(
"specular_losCalc");
484 agenda.
add(
"InterpSurfaceFieldToPosition",
485 "output=surface_skin_t",
487 agenda.
add(
"surfaceFlatScalarReflectivity");
489 case Specular_NoPol_ReflFix_SurfTFromt_field:
490 agenda.
add(
"specular_losCalc");
492 "InterpAtmFieldToPosition",
"output=surface_skin_t",
"field=t_field");
493 agenda.
add(
"surfaceFlatScalarReflectivity");
495 case Specular_WithPol_ReflFix_SurfTFromt_surface:
496 agenda.
add(
"specular_losCalc");
497 agenda.
add(
"InterpSurfaceFieldToPosition",
498 "output=surface_skin_t",
500 agenda.
add(
"surfaceFlatReflectivity");
502 case lambertian_ReflFix_SurfTFromt_surface:
503 agenda.
add(
"InterpSurfaceFieldToPosition",
504 "output=surface_skin_t",
506 agenda.
add(
"specular_losCalc");
507 agenda.
add(
"surfaceLambertianSimple");
509 case lambertian_ReflFix_SurfTFromt_field:
511 "InterpAtmFieldToPosition",
"output=surface_skin_t",
"field=t_field");
512 agenda.
add(
"specular_losCalc");
513 agenda.
add(
"surfaceLambertianSimple");
525 using enum Options::g0_agendaDefaultOptions;
526 switch (Options::tog0_agendaDefaultOptionsOrThrow(
option)) {
528 agenda.
add(
"g0Earth");
534 agenda.
add(
"g0Jupiter");
537 agenda.
add(
"g0Mars");
540 agenda.
add(
"g0Venus");
552 using enum Options::dobatch_calc_agendaDefaultOptions;
553 switch (Options::todobatch_calc_agendaDefaultOptionsOrThrow(
option)) {
564 using enum Options::ybatch_calc_agendaDefaultOptions;
565 switch (Options::toybatch_calc_agendaDefaultOptionsOrThrow(
option)) {
576 using enum Options::test_agendaDefaultOptions;
577 switch (Options::totest_agendaDefaultOptionsOrThrow(
option)) {
588 using enum Options::spt_calc_agendaDefaultOptions;
589 switch (Options::tospt_calc_agendaDefaultOptionsOrThrow(
option)) {
600 using enum Options::sensor_response_agendaDefaultOptions;
601 switch (Options::tosensor_response_agendaDefaultOptionsOrThrow(
option)) {
612 using enum Options::propmat_clearsky_agendaDefaultOptions;
613 switch (Options::topropmat_clearsky_agendaDefaultOptionsOrThrow(
option)) {
615 agenda.
add(
"propmat_clearskyInit");
626 using enum Options::pha_mat_spt_agendaDefaultOptions;
627 switch (Options::topha_mat_spt_agendaDefaultOptionsOrThrow(
option)) {
638 using enum Options::met_profile_calc_agendaDefaultOptions;
639 switch (Options::tomet_profile_calc_agendaDefaultOptionsOrThrow(
option)) {
650 using enum Options::main_agendaDefaultOptions;
651 switch (Options::tomain_agendaDefaultOptionsOrThrow(
option)) {
662 using enum Options::jacobian_agendaDefaultOptions;
663 switch (Options::tojacobian_agendaDefaultOptionsOrThrow(
option)) {
674 using enum Options::iy_radar_agendaDefaultOptions;
675 switch (Options::toiy_radar_agendaDefaultOptionsOrThrow(
option)) {
684 AgendaCreator agenda(ws,
"iy_independent_beam_approx_agenda");
686 using enum Options::iy_independent_beam_approx_agendaDefaultOptions;
687 switch (Options::toiy_independent_beam_approx_agendaDefaultOptionsOrThrow(
option)) {
698 using enum Options::inversion_iterate_agendaDefaultOptions;
699 switch (Options::toinversion_iterate_agendaDefaultOptionsOrThrow(
option)) {
710 using enum Options::forloop_agendaDefaultOptions;
711 switch (Options::toforloop_agendaDefaultOptionsOrThrow(
option)) {
722 using enum Options::doit_scat_field_agendaDefaultOptions;
723 switch (Options::todoit_scat_field_agendaDefaultOptionsOrThrow(
option)) {
734 using enum Options::doit_rte_agendaDefaultOptions;
735 switch (Options::todoit_rte_agendaDefaultOptionsOrThrow(
option)) {
746 using enum Options::doit_mono_agendaDefaultOptions;
747 switch (Options::todoit_mono_agendaDefaultOptionsOrThrow(
option)) {
758 using enum Options::doit_conv_test_agendaDefaultOptions;
759 switch (Options::todoit_conv_test_agendaDefaultOptionsOrThrow(
option)) {
Options for ARTS from enumeration (including error handling)
String name() const
Agenda name.
void check(Workspace &ws_in, const Verbosity &verbosity)
Checks consistency of an agenda.
void push_back(const MRecord &n)
Append a new method to end of list.
void set_name(const String &nname)
Set agenda name.
const Array< MRecord > & Methods() const
This can be used to make arrays out of anything.
std::string_view type() const
std::shared_ptr< wsv_data_type > wsv_data_ptr
Index add_wsv(const WsvRecord &wsv)
Add a new variable to this workspace.
Index nelem() const
Get the number of workspace variables.
std::shared_ptr< WsvMap_type > WsvMap_ptr
This class contains all static information for one workspace variable.
#define ARTS_ASSERT(condition,...)
std::string var_string(Args &&... args)
Index create_workspace_gin_default_internal(Workspace &ws, const std::string_view method, const std::string_view gin)
Agenda get_g0_agenda(Workspace &ws, const String &option)
std::ostream & operator<<(std::ostream &os, const AgendaMethodVariable &x)
Agenda get_ppath_agenda(Workspace &ws, const String &option)
Agenda get_iy_surface_agenda(Workspace &ws, const String &option)
Agenda get_ppath_step_agenda(Workspace &ws, const String &option)
Agenda get_iy_loop_freqs_agenda(Workspace &ws, const String &option)
Agenda get_iy_independent_beam_approx_agenda(Workspace &ws, const String &option)
Agenda get_main_agenda(Workspace &ws, const String &option)
Agenda get_iy_main_agenda(Workspace &ws, const String &option)
Agenda get_iy_cloudbox_agenda(Workspace &ws, const String &option)
std::pair< ArrayOfIndex, ArrayOfIndex > split_io(Array< AgendaMethodVariable > &var_order)
Split input and output of method variables.
Agenda get_water_p_eq_agenda(Workspace &ws, const String &option)
Agenda get_dobatch_calc_agenda(Workspace &ws, const String &option)
Agenda get_inversion_iterate_agenda(Workspace &ws, const String &option)
Agenda get_refr_index_air_agenda(Workspace &ws, const String &option)
Agenda get_spt_calc_agenda(Workspace &ws, const String &option)
Agenda get_pha_mat_spt_agenda(Workspace &ws, const String &option)
Agenda get_propmat_clearsky_agenda(Workspace &ws, const String &option)
Agenda get_met_profile_calc_agenda(Workspace &ws, const String &option)
Agenda get_test_agenda(Workspace &ws, const String &option)
Agenda get_doit_scat_field_agenda(Workspace &ws, const String &option)
Agenda get_iy_radar_agenda(Workspace &ws, const String &option)
Agenda get_forloop_agenda(Workspace &ws, const String &option)
Agenda get_doit_conv_test_agenda(Workspace &ws, const String &option)
Agenda get_ybatch_calc_agenda(Workspace &ws, const String &option)
Agenda get_gas_scattering_agenda(Workspace &ws, const String &option)
Agenda get_doit_rte_agenda(Workspace &ws, const String &option)
Agenda get_iy_space_agenda(Workspace &ws, const String &option)
Agenda get_doit_mono_agenda(Workspace &ws, const String &option)
Array< AgendaMethodVariable > sorted_mdrecord(Workspace &ws, const String &method_name)
Return a full list of all the Method Variables with defaults on the workspace.
Agenda get_sensor_response_agenda(Workspace &ws, const String &option)
Agenda get_surface_rtprop_agenda(Workspace &ws, const String &option)
Agenda get_jacobian_agenda(Workspace &ws, const String &option)
const ArrayOfGroupRecord wsv_groups
The names associated with Wsv groups as Strings.
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
const map< String, Index > MdMap
The map associated with md_data.
const Array< AgRecord > agenda_data
The lookup information for the agendas.
const map< String, Index > WsvGroupMap
The map associated with wsv_groups.
const map< String, Index > MdRawMap
The map associated with md_data_raw.
map< String, Index > AgendaMap
The map associated with agenda_data.
Helper class to create an agenda.
AgendaCreator(Workspace &workspace, const char *name)
void add(const std::string_view method, Input &&... input)
Add a method with as many inputs as you want. These inputs must be of type Wsv.
Agenda finalize()
Check the agenda and return a copy of it (ignoring/touching all agenda input/output not dealt with)
void set(const std::string_view var, const TokVal &value)
Set a variable to a value.
void ignore(const std::string_view var)
Ignores a variable (only call if the variable input is ignored despite being BOTH in- and output)
A Complete Description of a Method Variable.
void add_del(Workspace &ws, Agenda &a) const
void method_position(const Array< AgendaMethodVariable > &list, const std::string_view rhs)
void add_set(Workspace &ws, Agenda &a) const
constexpr MethodVariable()
void wsv_position(Workspace &ws, const TokVal &value)
opt
Checks for which type of information should be used later on.
SetWsv(const std::string &x, const std::string &y)
For named wsv1=wsv2.