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 "xml_io.h"

Include dependency graph for m_batch.cc:

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)
 WORKSPACE METHOD: ForLoop.
void VectorExtractFromMatrix (Vector &v, const Matrix &m, const Index &index, const String &direction)
 WORKSPACE METHOD: VectorExtractFromMatrix.
void ybatchCalc_implementation (Workspace &ws, Matrix &ybatch, const Index &ybatch_n, const Agenda &ybatch_calc_agenda, const Index &robust)
void ybatchCalc (Workspace &ws, Matrix &ybatch, const Index &ybatch_n, const Agenda &ybatch_calc_agenda, const Index &robust)
 WORKSPACE METHOD: ybatchCalc.
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)
 WORKSPACE METHOD: ybatchMetProfiles.
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)
 WORKSPACE METHOD: ybatchMetProfilesClear.
void ybatchUnit (Matrix &ybatch, const String &y_unit, const Vector &y_f)
 WORKSPACE METHOD: ybatchUnit.

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 <Patrick.Eriksson@rss.chalmers.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

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

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] ws Workspace
[in] forloop_agenda WS Input
[in] start Generic Input
[in] stop Generic Input
[in] step Generic Input

Definition at line 67 of file m_batch.cc.

References forloop_agendaExecute(), and out1.

Referenced by ForLoop_g().

void VectorExtractFromMatrix ( Vector gout1,
const Matrix gin1,
const Index gin2,
const String direction 
)

WORKSPACE METHOD: VectorExtractFromMatrix.

Extract a Vector from a Matrix.

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

Keywords: <br> direction : Must be either *row* or *column*.

Author:
Patrick Eriksson, Oliver Lemke, Stefan Buehler
Parameters:
[out] gout1 Generic output
[in] gin1 Generic Input
[in] gin2 Generic Input
[in] direction Generic Input

Definition at line 90 of file m_batch.cc.

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

Referenced by VectorExtractFromMatrix_g().

void ybatchCalc ( Workspace ws,
Matrix ybatch,
const Index ybatch_n,
const Agenda ybatch_calc_agenda,
const Index robust 
)

WORKSPACE METHOD: ybatchCalc.

Performs batch calculations.

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

This means that, beside the *ybatch_calc_agenda*, the WSV 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 *RteCalc* (or a similar method).

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> RteCalc{} <br> }

See the user guide for further practical examples.

Keywords: <br> robust : a flag with value 1 or 0. If set to one, the batch <br> calculation will continue, even if individual jobs <br> fail. In that case, a warning message is written to <br> screen and file (out1 output stream), and ybatch for the <br> failed job is set to -1. The robust behavior does only work <br> properly if you have compiled the program without OpenMP! <br> (Use the configure option "--disable-vectorize".)

Author:
Patrick Eriksson, Stefan Buehler
Parameters:
[in,out] ws Workspace
[out] ybatch WS Output
[in] ybatch_n WS Input
[in] ybatch_calc_agenda WS Input
[in] robust Generic Input (Default: "0")

Definition at line 242 of file m_batch.cc.

References out2, and ybatchCalc_implementation().

Referenced by ybatchCalc_g().

void ybatchCalc_implementation ( Workspace ws,
Matrix ybatch,
const Index ybatch_n,
const Agenda ybatch_calc_agenda,
const Index robust 
)

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 
)

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] ws Workspace
[out] ybatch WS Output
[in] abs_species WS Input
[in] met_profile_calc_agenda WS Input
[in] f_grid WS Input
[in] met_amsu_data WS Input
[in] sensor_pos WS Input
[in] r_geoid WS Input
[in] lat_grid WS Input
[in] lon_grid WS Input
[in] atmosphere_dim WS Input
[in] scat_data_raw WS Input
[in] nelem_p_grid Generic Input
[in] met_profile_path Generic Input
[in] met_profile_pnd_path Generic Input

Definition at line 268 of file m_batch.cc.

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

Referenced by ybatchMetProfiles_g().

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 
)

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] ws Workspace
[out] ybatch WS Output
[in] abs_species WS Input
[in] met_profile_calc_agenda WS Input
[in] f_grid WS Input
[in] met_amsu_data WS Input
[in] sensor_pos WS Input
[in] r_geoid WS Input
[in] nelem_p_grid Generic Input
[in] met_profile_path Generic Input

Definition at line 493 of file m_batch.cc.

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

Referenced by ybatchMetProfilesClear_g().

void ybatchUnit ( Matrix ybatch,
const String y_unit,
const Vector y_f 
)

WORKSPACE METHOD: ybatchUnit.

Conversion of *ybatch* to other spectral units.

As *yUnit* but operates on *ybatch*.

Author:
Patrick Eriksson
Parameters:
[out] ybatch WS Output
[in] y_unit WS Input
[in] y_f WS Input

Definition at line 656 of file m_batch.cc.

References invplanck(), invrayjean(), ConstMatrixView::ncols(), ConstVectorView::nelem(), and ConstMatrixView::nrows().

Referenced by jacobianUnit(), and ybatchUnit_g().


Variable Documentation

const Numeric PI


Generated on Mon Mar 23 14:06:39 2009 for ARTS by  doxygen 1.5.6