ARTS  2.0.49
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 VectorExtractFromMatrix (Vector &v, const Matrix &m, const Index &index, const String &direction, const Verbosity &)
 WORKSPACE METHOD: VectorExtractFromMatrix. More...
 
void ybatchCalc (Workspace &ws, Matrix &ybatch, 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, Matrix &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 Matrix &r_geoid, const Vector &lat_grid, const Vector &lon_grid, const Index &atmosphere_dim, const ArrayOfSingleScatteringData &scat_data_raw, 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, Matrix &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 Matrix &r_geoid, const Index &nelem_p_grid, const String &met_profile_path, const Verbosity &verbosity)
 WORKSPACE METHOD: ybatchMetProfilesClear. 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@r.nosp@m.ss.ch.nosp@m.alme.nosp@m.rs.se
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

◆ 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 69 of file m_batch.cc.

References CREATE_OUT1, and forloop_agendaExecute().

Referenced by ForLoop_g().

◆ VectorExtractFromMatrix()

void VectorExtractFromMatrix ( Vector v,
const Matrix m,
const Index i,
const String direction,
const Verbosity verbosity 
)

WORKSPACE METHOD: VectorExtractFromMatrix.

Extract a Vector from a Matrix.

Copies row or column with given Index from input Matrix variable to create output Vector.

Author
Patrick Eriksson, Oliver Lemke, Stefan Buehler
Parameters
[out]vGeneric output
[in]mGeneric Input
[in]iGeneric Input
[in]directionGeneric Input

Definition at line 95 of file m_batch.cc.

References joker, ConstMatrixView::ncols(), ConstMatrixView::nrows(), and Vector::resize().

Referenced by VectorExtractFromMatrix_g().

◆ ybatchCalc()

void ybatchCalc ( Workspace ws,
Matrix ybatch,
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 matrix ybatch will have dimension (y.nelem(),ybatch_n). So, indices in the output matrix 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 column 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_jacobiansWS Output
[in]ybatch_startWS Input
[in]ybatch_nWS Input
[in]ybatch_calc_agendaWS Input
[in]robustGeneric Input (Default: "0")

Definition at line 145 of file m_batch.cc.

References arts_exit(), arts_omp_get_thread_num(), CREATE_OUTS, exit_or_rethrow(), joker, ConstMatrixView::ncols(), ConstMatrixView::nrows(), Matrix::resize(), and ybatch_calc_agendaExecute().

Referenced by ybatchCalc_g().

◆ ybatchMetProfiles()

void ybatchMetProfiles ( Workspace ws,
Matrix 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 Matrix r_geoid,
const Vector lat_grid,
const Vector lon_grid,
const Index atmosphere_dim,
const ArrayOfSingleScatteringData scat_data_raw,
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]r_geoidWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]atmosphere_dimWS Input
[in]scat_data_rawWS Input
[in]nelem_p_gridGeneric Input
[in]met_profile_pathGeneric Input
[in]met_profile_pnd_pathGeneric Input

Definition at line 347 of file m_batch.cc.

References abs, cloudboxSetManually(), 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(), VectorNLogSpace(), and xml_read_from_file().

Referenced by ybatchMetProfiles_g().

◆ ybatchMetProfilesClear()

void ybatchMetProfilesClear ( Workspace ws,
Matrix 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 Matrix r_geoid,
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]r_geoidWS Input
[in]nelem_p_gridGeneric Input
[in]met_profile_pathGeneric Input

Definition at line 576 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().