ARTS 2.5.0 (git: 9ee3ac6c)
m_batch.cc File Reference

Workspace functions for doing batch calculations. More...

#include <cmath>
#include "arts.h"
#include "arts_omp.h"
#include "auto_md.h"
#include "math_funcs.h"
#include "physics_funcs.h"
#include "rte.h"
#include "xml_io.h"

Go to the source code of this file.

Functions

void ForLoop (Workspace &ws, const Agenda &forloop_agenda, const Index &start, const Index &stop, const Index &step, const Verbosity &verbosity)
 WORKSPACE METHOD: ForLoop. More...
 
void ybatchCalc (Workspace &ws, ArrayOfVector &ybatch, ArrayOfArrayOfVector &ybatch_aux, ArrayOfMatrix &ybatch_jacobians, const Index &ybatch_start, const Index &ybatch_n, const Agenda &ybatch_calc_agenda, const Index &robust, const Verbosity &verbosity)
 WORKSPACE METHOD: ybatchCalc. More...
 
void ybatchMetProfiles (Workspace &ws, ArrayOfVector &ybatch, const ArrayOfArrayOfSpeciesTag &abs_species, const Agenda &met_profile_calc_agenda, const Vector &f_grid, const Matrix &met_amsu_data, const Matrix &sensor_pos, const Vector &refellipsoid, const Vector &lat_grid, const Vector &lon_grid, const Index &atmosphere_dim, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &nelem_p_grid, const String &met_profile_path, const String &met_profile_pnd_path, const Verbosity &verbosity)
 WORKSPACE METHOD: ybatchMetProfiles. More...
 
void ybatchMetProfilesClear (Workspace &ws, ArrayOfVector &ybatch, const ArrayOfArrayOfSpeciesTag &abs_species, const Agenda &met_profile_calc_agenda, const Vector &f_grid, const Matrix &met_amsu_data, const Matrix &sensor_pos, const Vector &refellipsoid, const Index &nelem_p_grid, const String &met_profile_path, const Verbosity &verbosity)
 WORKSPACE METHOD: ybatchMetProfilesClear. More...
 
void DOBatchCalc (Workspace &ws, ArrayOfTensor7 &dobatch_cloudbox_field, ArrayOfTensor5 &dobatch_radiance_field, ArrayOfTensor4 &dobatch_irradiance_field, ArrayOfTensor5 &dobatch_spectral_irradiance_field, const Index &ybatch_start, const Index &ybatch_n, const Agenda &dobatch_calc_agenda, const Index &robust, const Verbosity &verbosity)
 WORKSPACE METHOD: DOBatchCalc. More...
 

Variables

const Numeric PI
 
const Numeric DEG2RAD
 
const Numeric RAD2DEG
 
const Index GFIELD3_P_GRID
 

Detailed Description

Workspace functions for doing batch calculations.

Author
Patrick Eriksson Patri.nosp@m.ck.E.nosp@m.rikss.nosp@m.on@c.nosp@m.halme.nosp@m.rs.s.nosp@m.e
Date
2004-09-15

These functions are listed in the doxygen documentation as entries of the file auto_md.h.

Definition in file m_batch.cc.

Function Documentation

◆ DOBatchCalc()

void DOBatchCalc ( Workspace ws,
ArrayOfTensor7 dobatch_cloudbox_field,
ArrayOfTensor5 dobatch_radiance_field,
ArrayOfTensor4 dobatch_irradiance_field,
ArrayOfTensor5 dobatch_spectral_irradiance_field,
const Index ybatch_start,
const Index ybatch_n,
const Agenda dobatch_calc_agenda,
const Index robust,
const Verbosity verbosity 
)

WORKSPACE METHOD: DOBatchCalc.

Performs batch calculations for radiation fields.

We perform ybatch_n jobs, starting at index ybatch_start. (Zero based indexing, as usual.) The output arrays will have ybatch_n elements. Indices in the output array start with zero, independent of ybatch_start.

WARNING, MEMORY INTENSIVE!!!: Since the outputs of this methods can be very large, make sure you only pass back output you need. Estimate the size of your output by looking at the dimensions beforehand. If you only want to pass back some fields, make sure to empty the others at the end of your dobatch_calc_agenda. E.g.: Tensor7SetConstant(cloudbox_field, 0, 0, 0, 0, 0, 0, 0, 0.)

The method performs the following: <br> 1. Sets ybatch_index = ybatch_start. <br> 2. Performs a-d until <br> ybatch_index = ybatch_start + ybatch_n. <br> a. Executes dobatch_calc_agenda. <br> b. If ybatch_index = ybatch_start, resizes the output <br> arrays based on ybatch_n. <br> c. Copies calculated fields to ybatch_index - ybatch_start <br> of output arrays. <br> d. Adds 1 to ybatch_index.

Beside the dobatch_calc_agenda, the WSVs ybatch_start and ybatch_n must be set before calling this method.

The input variable ybatch_start is set to a default of zero in general.arts*.

Author
Oliver Lemke
Parameters
[in,out]wsWorkspace
[out]dobatch_cloudbox_fieldWS Output
[out]dobatch_radiance_fieldWS Output
[out]dobatch_irradiance_fieldWS Output
[out]dobatch_spectral_irradiance_fieldWS Output
[in]ybatch_startWS Input
[in]ybatch_nWS Input
[in]dobatch_calc_agendaWS Input
[in]robustGeneric Input (Default: "0")

Definition at line 652 of file m_batch.cc.

References arts_omp_get_thread_num(), CREATE_OUTS, and dobatch_calc_agendaExecute().

Referenced by DOBatchCalc_g().

◆ ForLoop()

void ForLoop ( Workspace ws,
const Agenda forloop_agenda,
const Index start,
const Index stop,
const Index step,
const Verbosity verbosity 
)

WORKSPACE METHOD: ForLoop.

A simple for-loop.

This method is handy when you quickly want to test out a calculation with a set of different settings.

It does a for-loop from start to stop in steps of step (who would have guessed that). For each iteration, the agenda forloop_agenda is executed. Inside the agenda, the variable forloop_index is available as index counter.

There are no other inputs to forloop_agenda, and also no outputs. That means, if you want to get any results out of this loop, you have to save it to files (for example with WriteXMLIndexed), since variables used inside the agenda will only be local.

Note that this kind of for loop is not parallel.

The method is intended for simple testing, not as a replacement of ybatchCalc*. However, it is compatible with ybatchCalc, in the sense that ybatchCalc may occur inside forloop_agenda.

Author
Stefan Buehler
Parameters
[in,out]wsWorkspace
[in]forloop_agendaWS Input
[in]startGeneric Input
[in]stopGeneric Input
[in]stepGeneric Input

Definition at line 62 of file m_batch.cc.

References CREATE_OUT1, forloop_agendaExecute(), and Zeeman::start().

Referenced by ForLoop_g().

◆ ybatchCalc()

void ybatchCalc ( Workspace ws,
ArrayOfVector ybatch,
ArrayOfArrayOfVector ybatch_aux,
ArrayOfMatrix ybatch_jacobians,
const Index ybatch_start,
const Index ybatch_n,
const Agenda ybatch_calc_agenda,
const Index robust,
const Verbosity verbosity 
)

WORKSPACE METHOD: ybatchCalc.

Performs batch calculations for the measurement vector y.

We perform ybatch_n jobs, starting at index ybatch_start. (Zero based indexing, as usual.) The output array ybatch will have ybatch_n elements. Indices in the output array start with zero, independent of ybatch_start.

The method performs the following: <br> 1. Sets ybatch_index = ybatch_start. <br> 2. Performs a-d until <br> ybatch_index = ybatch_start + ybatch_n. <br> a. Executes ybatch_calc_agenda. <br> b. If ybatch_index = ybatch_start, resizes ybatch <br> based on ybatch_n and length of y. <br> c. Copies y to ybatch_index - ybatch_start <br> of ybatch. <br> d. Adds 1 to ybatch_index.

Beside the ybatch_calc_agenda, the WSVs ybatch_start and ybatch_n must be set before calling this method. Further, ybatch_calc_agenda is expected to produce a spectrum and should accordingly include a call of yCalc (or asimilar method).

The input variable ybatch_start is set to a default of zero in general.arts*.

An agenda that calculates spectra for different temperature profiles could look like this:

<br> AgendaSet(ybatch_calc_agenda){ <br> Extract(t_field,tensor4_1,ybatch_index) <br> yCalc <br> }

Jacobians are also collected, and stored in output variable ybatch_jacobians. (This will be empty if yCalc produces empty Jacobians.)

See the user guide for further practical examples.

Author
Stefan Buehler
Parameters
[in,out]wsWorkspace
[out]ybatchWS Output
[out]ybatch_auxWS Output
[out]ybatch_jacobiansWS Output
[in]ybatch_startWS Input
[in]ybatch_nWS Input
[in]ybatch_calc_agendaWS Input
[in]robustGeneric Input (Default: "0")

Definition at line 79 of file m_batch.cc.

References arts_omp_get_thread_num(), CREATE_OUTS, ConstMatrixView::ncols(), ConstVectorView::nelem(), ConstMatrixView::nrows(), and ybatch_calc_agendaExecute().

Referenced by ybatchCalc_g().

◆ ybatchMetProfiles()

void ybatchMetProfiles ( Workspace ws,
ArrayOfVector ybatch,
const ArrayOfArrayOfSpeciesTag abs_species,
const Agenda met_profile_calc_agenda,
const Vector f_grid,
const Matrix met_amsu_data,
const Matrix sensor_pos,
const Vector refellipsoid,
const Vector lat_grid,
const Vector lon_grid,
const Index atmosphere_dim,
const ArrayOfArrayOfSingleScatteringData scat_data,
const Index nelem_p_grid,
const String met_profile_path,
const String met_profile_pnd_path,
const Verbosity verbosity 
)

WORKSPACE METHOD: ybatchMetProfiles.

This method is used for simulating ARTS for metoffice model fields This method reads in met_amsu_data which contains the lat-lon of the metoffice profile files as a Matrix. It then loops over the number of profiles and corresponding to each longitude create the appropriate profile basename. Then, corresponding to each basename we have temperature field, altitude field, humidity field, and particle number density field. The temperature field and altitude field are stored in the same dimensions as t_field_raw and z_field_raw. The oxygen and nitrogen VMRs are set to constant values of 0.209 and 0.782, respectively and are used along with humidity field to generate vmr_field_raw.

The three fields t_field_raw, z_field_raw, and vmr_field_raw are given as input to met_profile_calc_agenda which is called in this method. See documentation of WSM met_profile_calc_agenda for more information on this agenda.

The method also converts satellite zenith angle to appropriate sensor_los*. It also sets the p_grid and cloudbox_limits from the profiles inside the function

Author
Sreerekha T.R.
Parameters
[in,out]wsWorkspace
[out]ybatchWS Output
[in]abs_speciesWS Input
[in]met_profile_calc_agendaWS Input
[in]f_gridWS Input
[in]met_amsu_dataWS Input
[in]sensor_posWS Input
[in]refellipsoidWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]atmosphere_dimWS Input
[in]scat_dataWS Input
[in]nelem_p_gridGeneric Input
[in]met_profile_pathGeneric Input
[in]met_profile_pnd_pathGeneric Input

Definition at line 238 of file m_batch.cc.

References abs, cloudboxSetManually(), data, GriddedField3::data, DEG2RAD, GriddedField::get_numeric_grid(), GFIELD3_P_GRID, joker, met_profile_calc_agendaExecute(), Array< base >::nelem(), ConstVectorView::nelem(), ConstMatrixView::nrows(), RAD2DEG, Vector::resize(), Matrix::resize(), TotalNumberOfElements(), VectorNLogSpace(), and xml_read_from_file().

Referenced by ybatchMetProfiles_g().

◆ ybatchMetProfilesClear()

void ybatchMetProfilesClear ( Workspace ws,
ArrayOfVector ybatch,
const ArrayOfArrayOfSpeciesTag abs_species,
const Agenda met_profile_calc_agenda,
const Vector f_grid,
const Matrix met_amsu_data,
const Matrix sensor_pos,
const Vector refellipsoid,
const Index nelem_p_grid,
const String met_profile_path,
const Verbosity verbosity 
)

WORKSPACE METHOD: ybatchMetProfilesClear.

This method is used for simulating ARTS for metoffice model fields for clear sky conditions.

This method reads in met_amsu_data which contains the lat-lon of the metoffice profile files as a Matrix. It then loops over the number of profiles and corresponding to each longitude create the appropriate profile basename. Then, Corresponding to each basename we have temperature field, altitude field, humidity field, and particle number density field. The temperature field and altitude field are stored in the same dimensions as t_field_raw and z_field_raw. The oxygen and nitrogen VMRs are set to constant values of 0.209 and 0.782, respectively and are used along with humidity field to generate vmr_field_raw.

The three fields t_field_raw, z_field_raw, and vmr_field_raw are given as input to met_profile_calc_agenda which is called in this method. See documentation of WSM met_profile_calc_agenda for more information on this agenda.

The method also converts satellite zenith angle to appropriate sensor_los*. It also sets the p_grid and cloudbox_limits from the profiles inside the function

Author
Seerekha T.R.
Parameters
[in,out]wsWorkspace
[out]ybatchWS Output
[in]abs_speciesWS Input
[in]met_profile_calc_agendaWS Input
[in]f_gridWS Input
[in]met_amsu_dataWS Input
[in]sensor_posWS Input
[in]refellipsoidWS Input
[in]nelem_p_gridGeneric Input
[in]met_profile_pathGeneric Input

Definition at line 476 of file m_batch.cc.

References abs, GriddedField3::data, FILE_TYPE_ASCII, GriddedField::get_numeric_grid(), GFIELD3_P_GRID, joker, met_profile_calc_agendaExecute(), Array< base >::nelem(), ConstVectorView::nelem(), ConstMatrixView::nrows(), PI, Vector::resize(), Matrix::resize(), VectorNLogSpace(), xml_read_from_file(), and xml_write_to_file().

Referenced by ybatchMetProfilesClear_g().

Variable Documentation

◆ DEG2RAD

const Numeric DEG2RAD
extern

Referenced by ybatchMetProfiles().

◆ GFIELD3_P_GRID

const Index GFIELD3_P_GRID
extern

◆ PI

const Numeric PI
extern

Referenced by ybatchMetProfilesClear().

◆ RAD2DEG

const Numeric RAD2DEG
extern

Referenced by ybatchMetProfiles().