ARTS  2.0.49
m_atmosphere.cc File Reference

Workspace functions to set variables defining the atmosphere (excluding the surface). More...

#include <cmath>
#include <algorithm>
#include "agenda_class.h"
#include "arts.h"
#include "check_input.h"
#include "matpackIII.h"
#include "messages.h"
#include "special_interp.h"
#include "absorption.h"
#include "abs_species_tags.h"
#include "gridded_fields.h"
#include "interpolation.h"
#include "interpolation_poly.h"
#include "xml_io.h"

Go to the source code of this file.

Functions

void atm_fields_compactExpand (GriddedField4 &af, Index &nf, const String &name, const Verbosity &)
 atm_fields_compactExpand More...
 
void atm_fields_compactFromMatrix (GriddedField4 &af, const Index &atmosphere_dim, const Matrix &im, const ArrayOfString &field_names, const Verbosity &)
 WORKSPACE METHOD: atm_fields_compactFromMatrix. More...
 
void atm_fields_compactFromMatrixChevalAll (GriddedField4 &af_all, GriddedField4 &af_vmr, const Index &atmosphere_dim, const Matrix &im, const ArrayOfString &field_names, const Verbosity &)
 WORKSPACE METHOD: atm_fields_compactFromMatrixChevalAll. More...
 
void atm_fields_compactAddConstant (GriddedField4 &af, const String &name, const Numeric &value, const Verbosity &verbosity)
 WORKSPACE METHOD: atm_fields_compactAddConstant. More...
 
void atm_fields_compactAddSpecies (GriddedField4 &atm_fields_compact, const String &name, const GriddedField3 &species, const Verbosity &verbosity)
 WORKSPACE METHOD: atm_fields_compactAddSpecies. More...
 
void basics_checkedCalc (Index &basics_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &z_field, const Tensor3 &t_field, const Tensor4 &vmr_field, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Matrix &r_geoid, const Matrix &z_surface, const Index &stokes_dim, const Vector &f_grid, const Verbosity &)
 WORKSPACE METHOD: basics_checkedCalc. More...
 
void batch_atm_fields_compactAddConstant (ArrayOfGriddedField4 &batch_atm_fields_compact, const String &name, const Numeric &value, const Verbosity &verbosity)
 WORKSPACE METHOD: batch_atm_fields_compactAddConstant. More...
 
void batch_atm_fields_compactAddSpecies (ArrayOfGriddedField4 &batch_atm_fields_compact, const String &name, const GriddedField3 &species, const Verbosity &verbosity)
 WORKSPACE METHOD: batch_atm_fields_compactAddSpecies. More...
 
void batch_atm_fields_compactFromArrayOfMatrix (ArrayOfGriddedField4 &batch_atm_fields_compact, const Index &atmosphere_dim, const ArrayOfMatrix &am, const ArrayOfString &field_names, const ArrayOfString &extra_field_names, const Vector &extra_field_values, const Verbosity &verbosity)
 WORKSPACE METHOD: batch_atm_fields_compactFromArrayOfMatrix. More...
 
void batch_atm_fields_compactFromArrayOfMatrixChevalAll (ArrayOfGriddedField4 &batch_atm_fields_compact, ArrayOfGriddedField4 &batch_atm_fields_compact_all, const Index &atmosphere_dim, const ArrayOfMatrix &am, const ArrayOfString &field_names, const ArrayOfString &extra_field_names, const Vector &extra_field_values, const Verbosity &verbosity)
 WORKSPACE METHOD: batch_atm_fields_compactFromArrayOfMatrixChevalAll. More...
 
void AtmFieldsFromCompactChevalAll (Vector &p_grid, Vector &lat_grid, Vector &lon_grid, Tensor3 &t_field, Tensor3 &z_field, Tensor4 &massdensity_field, Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const GriddedField4 &atm_fields_compact_all, const Index &atmosphere_dim, const Verbosity &)
 WORKSPACE METHOD: AtmFieldsFromCompactChevalAll. More...
 
void AtmFieldsFromCompact (Vector &p_grid, Vector &lat_grid, Vector &lon_grid, Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const GriddedField4 &atm_fields_compact, const Index &atmosphere_dim, const Verbosity &)
 WORKSPACE METHOD: AtmFieldsFromCompact. More...
 
void AtmosphereSet1D (Index &atmosphere_dim, Vector &lat_grid, Vector &lon_grid, const Verbosity &verbosity)
 WORKSPACE METHOD: AtmosphereSet1D. More...
 
void AtmosphereSet2D (Index &atmosphere_dim, Vector &lon_grid, const Verbosity &verbosity)
 WORKSPACE METHOD: AtmosphereSet2D. More...
 
void AtmosphereSet3D (Index &atmosphere_dim, const Verbosity &verbosity)
 WORKSPACE METHOD: AtmosphereSet3D. More...
 
void AtmFieldsCalc (Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const GriddedField3 &t_field_raw, const GriddedField3 &z_field_raw, const ArrayOfGriddedField3 &vmr_field_raw, const Index &atmosphere_dim, const Index &interp_order, const Verbosity &verbosity)
 WORKSPACE METHOD: AtmFieldsCalc. More...
 
void AtmFieldsCalcExpand1D (Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const GriddedField3 &t_field_raw, const GriddedField3 &z_field_raw, const ArrayOfGriddedField3 &vmr_field_raw, const Index &atmosphere_dim, const Index &interp_order, const Verbosity &verbosity)
 WORKSPACE METHOD: AtmFieldsCalcExpand1D. More...
 
void AtmFieldsExpand1D (Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Index &atmosphere_dim, const Verbosity &)
 WORKSPACE METHOD: AtmFieldsExpand1D. More...
 
void AtmFieldsRefinePgrid (Vector &p_grid, Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, const Vector &lat_grid, const Vector &lon_grid, const Index &atmosphere_dim, const Numeric &p_step, const Verbosity &)
 WORKSPACE METHOD: AtmFieldsRefinePgrid. More...
 
void AtmRawRead (GriddedField3 &t_field_raw, GriddedField3 &z_field_raw, ArrayOfGriddedField3 &vmr_field_raw, const ArrayOfArrayOfSpeciesTag &abs_species, const String &basename, const Verbosity &verbosity)
 WORKSPACE METHOD: AtmRawRead. More...
 
void InterpAtmFieldToRteGps (Numeric &outvalue, const Index &atmosphere_dim, const GridPos &rte_gp_p, const GridPos &rte_gp_lat, const GridPos &rte_gp_lon, const Tensor3 &field, const Verbosity &verbosity)
 WORKSPACE METHOD: InterpAtmFieldToRteGps. More...
 
void p_gridFromAtmRaw (Vector &p_grid, const GriddedField3 &z_field_raw, const Verbosity &)
 WORKSPACE METHOD: p_gridFromAtmRaw. More...
 
void z2g (Numeric &g, const Numeric &r, const Numeric &g0, const Numeric &z)
 
void z_fieldFromHSE (Tensor3 &z_field, 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 Matrix &r_geoid, const Matrix &z_surface, const Index &basics_checked, const Numeric &p_hse, const Numeric &z_hse_accuracy, const Verbosity &)
 WORKSPACE METHOD: z_fieldFromHSE. More...
 

Variables

const Index GFIELD3_P_GRID
 
const Index GFIELD3_LAT_GRID
 
const Index GFIELD3_LON_GRID
 
const Index GFIELD4_FIELD_NAMES
 
const Index GFIELD4_P_GRID
 
const Index GFIELD4_LAT_GRID
 
const Index GFIELD4_LON_GRID
 
const Numeric DEG2RAD
 

Detailed Description

Workspace functions to set variables defining the atmosphere (excluding the surface).

Workspace functions associated with the geoid and the surface.

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
2002-05-16

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

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
2008-09-17

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

Definition in file m_atmosphere.cc.

Function Documentation

◆ atm_fields_compactAddConstant()

void atm_fields_compactAddConstant ( GriddedField4 atm_fields_compact,
const String name,
const Numeric value,
const Verbosity verbosity 
)

WORKSPACE METHOD: atm_fields_compactAddConstant.

Adds a constant field to atm_fields_compact.

This is handy for nitrogen or oxygen. The constant value is appended at the end of the fields that are already there. All dimensions (pressure, latitude, longitude) are filled up, so this works for 1D, 2D, or 3D atmospheres.

Author
Stefan Buehler
Parameters
[out]atm_fields_compactWS Output
[in]nameGeneric Input
[in]valueGeneric Input

Definition at line 312 of file m_atmosphere.cc.

References atm_fields_compactExpand(), GriddedField4::data, and joker.

Referenced by atm_fields_compactAddConstant_g(), batch_atm_fields_compactAddConstant(), batch_atm_fields_compactFromArrayOfMatrix(), and batch_atm_fields_compactFromArrayOfMatrixChevalAll().

◆ atm_fields_compactAddSpecies()

void atm_fields_compactAddSpecies ( GriddedField4 atm_fields_compact,
const String name,
const GriddedField3 value,
const Verbosity verbosity 
)

WORKSPACE METHOD: atm_fields_compactAddSpecies.

Adds a field to atm_fields_compact, with interpolation.

This method appends a GriddedField3 to atm_fields_compact. The GriddedField3 is interpolated upon the grid of atm_fields_compact. A typical use case for this method may be to add a climatology of some gas when this gas is needed for radiative transfer calculations, but not yet present in atm_fields_compact. One case where this happens is when using the Chevalier dataset for infrared simulations.

The grids in atm_fields_compact must fully encompass the grids in the GriddedField3 to be added, for interpolation to succeed. If this is not the case, a RuntimeError is thrown.

Author
Gerrit Holl
Parameters
[out]atm_fields_compactWS Output
[in]nameGeneric Input
[in]valueGeneric Input

Definition at line 330 of file m_atmosphere.cc.

References atm_fields_compactExpand(), GriddedField3::checksize(), GriddedField4::checksize(), chk_interpolation_grids(), GriddedField3::data, GriddedField4::data, GriddedField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, GFIELD4_LAT_GRID, GFIELD4_LON_GRID, GFIELD4_P_GRID, gridpos(), interp(), interpweights(), joker, Array< base >::nelem(), ConstVectorView::nelem(), and p2gridpos().

Referenced by atm_fields_compactAddSpecies_g(), and batch_atm_fields_compactAddSpecies().

◆ atm_fields_compactExpand()

void atm_fields_compactExpand ( GriddedField4 af,
Index nf,
const String name,
const Verbosity  
)

atm_fields_compactExpand

Add a species to an atm_fields_compact. Does not add any content, but only resizes the data and adds a field to the ArrayOfString respresenting the species for this GriddedField4. This helper function is used by e.g. atm_fields_compactAddSpecies* and atm_fields_compactAddConstant.

Return values
afThe new atm_fields_compact
nfThe new number of fields
Parameters
nameName of new field
Author
Gerrit Holl
Date
2011-05-04

Definition at line 89 of file m_atmosphere.cc.

References GriddedField4::data, GriddedField::get_string_grid(), GFIELD4_FIELD_NAMES, joker, ConstTensor4View::ncols(), Array< base >::nelem(), ConstTensor4View::npages(), ConstTensor4View::nrows(), and GriddedField4::resize().

Referenced by atm_fields_compactAddConstant(), and atm_fields_compactAddSpecies().

◆ atm_fields_compactFromMatrix()

void atm_fields_compactFromMatrix ( GriddedField4 atm_fields_compact,
const Index atmosphere_dim,
const Matrix gin1,
const ArrayOfString field_names,
const Verbosity verbosity 
)

WORKSPACE METHOD: atm_fields_compactFromMatrix.

Set atm_fields_compact from 1D profiles in a matrix.

For clear-sky batch calculations it is handy to store atmospheric profiles in an array of matrix. We take such a matrix, and create atm_fields_compact* from it.

The matrix must contain one row for each pressure level. The matrix can contain some additional fields which are not directly used by ARTS for calculations but can be required for further processing, for e.g. wind speed and direction. In this case, additional fields must be put at the end of the matrix and they must be flagged by 'ignore', large or small letters, in the field names. Recommended row format:

p[Pa] T[K] z[m] VMR_1[fractional] ... VMR[fractional] IGNORE ... IGNORE

Works only for atmosphere_dim==1.

Keywords: <br> field_names : Field names to store in atm_fields_compact. <br> This should be, e.g.: <br> ["T[K]", "z[m]", "vmr_h2o[fractional]", "ignore"] <br> There must be one name less than matrix columns, <br> because the first column must contain pressure.

Author
Stefan Buehler
Parameters
[out]atm_fields_compactWS Output
[in]atmosphere_dimWS Input
[in]gin1Generic Input
[in]field_namesGeneric Input

Definition at line 135 of file m_atmosphere.cc.

References GriddedField4::data, GFIELD4_FIELD_NAMES, GFIELD4_LAT_GRID, GFIELD4_LON_GRID, GFIELD4_P_GRID, joker, ConstMatrixView::ncols(), Array< base >::nelem(), ConstMatrixView::nrows(), GriddedField4::resize(), GriddedField::set_grid(), transform(), and transpose().

Referenced by atm_fields_compactFromMatrix_g(), and batch_atm_fields_compactFromArrayOfMatrix().

◆ atm_fields_compactFromMatrixChevalAll()

void atm_fields_compactFromMatrixChevalAll ( GriddedField4 atm_fields_compact_all,
GriddedField4 atm_fields_compact,
const Index atmosphere_dim,
const Matrix gin1,
const ArrayOfString field_names,
const Verbosity verbosity 
)

WORKSPACE METHOD: atm_fields_compactFromMatrixChevalAll.

Set atm_fields_compact and atm_fields_compact_all from 1D profiles in a matrix.

This WSM replaces atm_fields_compactFromMatrix in case of calculations, including scattering. atm_fields_compact_all additionally contains the mass concentration profiles of scattering particles.

In case of batch calculations, this WSM is called internally by batch_atm_fields_compactFromArrayOfMatrixChevalAll*. In this case atm_fields_compact is also still needed, for the WSM abs_lookupSetupBatch. For that reason both GriddedField4 are defined as output here.

For further documentation see: atm_fields_compactFromMatrix

Row format:

p[Pa] T[K] z[m] LWC[kg/m3] IWC[kg/m3] Rain[kg/m2/s] Snow[kg/m2/s] VMR_1[fractional] ... VMR[fractional] IGNORE ... IGNORE

Works only for atmosphere_dim==1.

Possible future changes: name should fit naming conventions. WSM abs_lookupSetupBatch could be edited to handle batch_atm_fields_compact including scattering particles. Then two different *batch_atm_fields_compact*s and two different *atm_fields_compact*s would no longer be necessary.

Author
Daniel Kreyling
Parameters
[out]atm_fields_compact_allWS Output
[out]atm_fields_compactWS Output
[in]atmosphere_dimWS Input
[in]gin1Generic Input
[in]field_namesGeneric Input

Definition at line 199 of file m_atmosphere.cc.

References GriddedField4::data, GFIELD4_FIELD_NAMES, GFIELD4_LAT_GRID, GFIELD4_LON_GRID, GFIELD4_P_GRID, joker, ConstMatrixView::ncols(), Array< base >::nelem(), ConstMatrixView::nrows(), GriddedField4::resize(), GriddedField::set_grid(), transform(), and transpose().

Referenced by atm_fields_compactFromMatrixChevalAll_g(), and batch_atm_fields_compactFromArrayOfMatrixChevalAll().

◆ AtmFieldsCalc()

void AtmFieldsCalc ( Tensor3 t_field,
Tensor3 z_field,
Tensor4 vmr_field,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const GriddedField3 t_field_raw,
const GriddedField3 z_field_raw,
const ArrayOfGriddedField3 vmr_field_raw,
const Index atmosphere_dim,
const Index interp_order,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmFieldsCalc.

Interpolation of raw atmospheric fields.

An atmospheric scenario includes the following data for each position (pressure, latitude, longitude) in the atmosphere: <br> 1. temperature field <br> 2. the corresponding altitude field <br> 3. vmr fields for the gaseous species This method interpolates the fields of raw data (t_field_raw, z_field_raw*) which can be stored on arbitrary grids to the calculation grids (p_grid, lat_grid, lon_grid).

With parameter interp_order you can control the order of interpolation. The default is 1 (linear interpolation).

Author
Claudia Emde
Stefan Buehler
Parameters
[out]t_fieldWS Output
[out]z_fieldWS Output
[out]vmr_fieldWS Output
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]t_field_rawWS Input
[in]z_field_rawWS Input
[in]vmr_field_rawWS Input
[in]atmosphere_dimWS Input
[in]interp_orderGeneric Input (Default: "1")

Definition at line 1008 of file m_atmosphere.cc.

References chk_atm_grids(), chk_if_in_range(), chk_interpolation_grids(), CREATE_OUT2, GriddedField3::data, GriddedField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, gridpos_poly(), interp(), interpweights(), joker, Array< base >::nelem(), ConstVectorView::nelem(), p2gridpos_poly(), Tensor4::resize(), and Tensor3::resize().

Referenced by AtmFieldsCalc_g(), and AtmFieldsCalcExpand1D().

◆ AtmFieldsCalcExpand1D()

void AtmFieldsCalcExpand1D ( Tensor3 t_field,
Tensor3 z_field,
Tensor4 vmr_field,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const GriddedField3 t_field_raw,
const GriddedField3 z_field_raw,
const ArrayOfGriddedField3 vmr_field_raw,
const Index atmosphere_dim,
const Index interp_order,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmFieldsCalcExpand1D.

Interpolation of 1D raw atmospheric fields to create 2D or 3D homogeneous atmospheric fields.

The method works as AtmFieldsCalc, but accepts only raw 1D atmospheres. The raw atmosphere is interpolated to p_grid and the obtained values are applied for all latitudes, and also longitudes for 3D, to create a homogeneous atmosphere.

The method deals only with the atmospheric fields, and to create a true 2D or 3D version of a 1D case, a demand is also that the geoid radius is set to be constant for all latitudes/longitudes.

With parameter interp_order you can control the order of interpolation. The default is 1 (linear interpolation).

Author
Patrick Eriksson
Claudia Emde
Stefan Buehler
Parameters
[out]t_fieldWS Output
[out]z_fieldWS Output
[out]vmr_fieldWS Output
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]t_field_rawWS Input
[in]z_field_rawWS Input
[in]vmr_field_rawWS Input
[in]atmosphere_dimWS Input
[in]interp_orderGeneric Input (Default: "1")

Definition at line 1416 of file m_atmosphere.cc.

References AtmFieldsCalc(), chk_atm_grids(), chk_if_in_range(), ConstTensor4View::nbooks(), ConstVectorView::nelem(), ConstTensor3View::npages(), Tensor4::resize(), and Tensor3::resize().

Referenced by AtmFieldsCalcExpand1D_g().

◆ AtmFieldsExpand1D()

void AtmFieldsExpand1D ( Tensor3 t_field,
Tensor3 z_field,
Tensor4 vmr_field,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Index atmosphere_dim,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmFieldsExpand1D.

Maps a 1D case to 2D or 3D homogeneous atmospheric fields.

This method takes a 1D atmospheric case and converts it to the corresponding case for 2D or 3D. The atmospheric fields (t_field, z_field and vmr_field) must be 1D and match p_grid. The size of the new data is determined by atmosphere_dim, lat_grid and lon_grid*. That is, these later variables have been changed since the original fields were created.

The method deals only with the atmospheric fields, and to create a true 2D or 3D version of a 1D case, a demand is also that the geoid radius is set to be constant for all latitudes/longitudes.

Author
Patrick Eriksson
Parameters
[out]t_fieldWS Output
[out]z_fieldWS Output
[out]vmr_fieldWS Output
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]atmosphere_dimWS Input

Definition at line 1475 of file m_atmosphere.cc.

References chk_atm_field(), chk_atm_grids(), chk_if_in_range(), max, ConstTensor4View::nbooks(), ConstVectorView::nelem(), Tensor4::resize(), and Tensor3::resize().

Referenced by AtmFieldsExpand1D_g().

◆ AtmFieldsFromCompact()

void AtmFieldsFromCompact ( Vector p_grid,
Vector lat_grid,
Vector lon_grid,
Tensor3 t_field,
Tensor3 z_field,
Tensor4 vmr_field,
const ArrayOfArrayOfSpeciesTag abs_species,
const GriddedField4 atm_fields_compact,
const Index atmosphere_dim,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmFieldsFromCompact.

Extract pressure grid and atmospheric fields from atm_fields_compact*.

An atmospheric scenario includes the following data for each position (pressure, latitude, longitude) in the atmosphere: <br> 1. temperature field <br> 2. the corresponding altitude field <br> 3. vmr fields for the gaseous species

This method just splits up the data found in atm_fields_compact to p_grid, lat_grid, lon_grid, and the various fields. No interpolation. See documentation of atm_fields_compact for a definition of the data.

There are some safety checks on the names of the fields: The first field must be called "T", the second "z"*. Remaining fields must be trace gas species volume mixing ratios, named for example "H2O", "O3", and so on. The species names must fit the species in abs_species. (Same species in same order.) Only the species name must fit, not the full tag.

Possible future extensions: Add a keyword parameter to refine the pressure grid if it is too coarse. Or a version that interpolates onto given grids, instead of using and returning the original grids.

Author
Stefan Buehler
Parameters
[out]p_gridWS Output
[out]lat_gridWS Output
[out]lon_gridWS Output
[out]t_fieldWS Output
[out]z_fieldWS Output
[out]vmr_fieldWS Output
[in]abs_speciesWS Input
[in]atm_fields_compactWS Input
[in]atmosphere_dimWS Input

Definition at line 850 of file m_atmosphere.cc.

References chk_atm_grids(), GriddedField4::data, GriddedField::get_grid_size(), GriddedField::get_numeric_grid(), GriddedField::get_string_grid(), GFIELD4_FIELD_NAMES, GFIELD4_LAT_GRID, GFIELD4_LON_GRID, GFIELD4_P_GRID, joker, ns, Tensor4::resize(), Tensor3::resize(), and species_data.

Referenced by AtmFieldsFromCompact_g().

◆ AtmFieldsFromCompactChevalAll()

void AtmFieldsFromCompactChevalAll ( Vector p_grid,
Vector lat_grid,
Vector lon_grid,
Tensor3 t_field,
Tensor3 z_field,
Tensor4 massdensity_field,
Tensor4 vmr_field,
const ArrayOfArrayOfSpeciesTag abs_species,
const GriddedField4 atm_fields_compact_all,
const Index atmosphere_dim,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmFieldsFromCompactChevalAll.

Extract pressure grid and atmospheric fields from atm_fields_compact_all*.

In contrast to atm_fields_compact, atm_fields_compact_all also contains mass concentrations for scattering particles

An atmospheric scenario includes the following data for each position (pressure, latitude, longitude) in the atmosphere: <br> 1. temperature field <br> 2. the corresponding altitude field <br> 3. mass concentration fields for the scattering particles <br> 4. vmr fields for the gaseous species This method just splits up the data found in atm_fields_compact_all to p_grid, lat_grid, lon_grid, and the various fields. No interpolation. See documentation of atm_fields_compact_all for a definition of the data.

NOTE: HARD WIRED code!

There are some safety checks on the names of the fields: The first field must be called "T", the second "z". The following 4 fields must be "LWC", "IWC", "Rain" and "Snow". Remaining fields must be trace gas species volume mixing ratios, named for example "H2O", "O3", and so on. The species names must fit the species in abs_species. (Same species in same order.) Only the species name must fit, not the full tag.

Possible future extensions: Add a keyword parameter to refine the pressure grid if it is too coarse. Or a version that interpolates onto given grids, instead of using and returning the original grids. Name should fit naming conventions.

Author
Daniel Kreyling
Parameters
[out]p_gridWS Output
[out]lat_gridWS Output
[out]lon_gridWS Output
[out]t_fieldWS Output
[out]z_fieldWS Output
[out]massdensity_fieldWS Output
[out]vmr_fieldWS Output
[in]abs_speciesWS Input
[in]atm_fields_compact_allWS Input
[in]atmosphere_dimWS Input

Definition at line 703 of file m_atmosphere.cc.

References chk_atm_grids(), GriddedField4::data, GriddedField::get_grid_size(), GriddedField::get_numeric_grid(), GriddedField::get_string_grid(), GFIELD4_FIELD_NAMES, GFIELD4_LAT_GRID, GFIELD4_LON_GRID, GFIELD4_P_GRID, joker, ns, Tensor4::resize(), Tensor3::resize(), and species_data.

Referenced by AtmFieldsFromCompactChevalAll_g().

◆ AtmFieldsRefinePgrid()

void AtmFieldsRefinePgrid ( Vector p_grid,
Tensor3 t_field,
Tensor3 z_field,
Tensor4 vmr_field,
const Vector lat_grid,
const Vector lon_grid,
const Index atmosphere_dim,
const Numeric p_step,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmFieldsRefinePgrid.

Refine the pressure grid in the atmospheric fields.

This method is used for absorption lookup table testing. It probably has no other application.

It adds additional vertical grid points to the atmospheric fields, by interpolating them in the usual ARTS way (linear in log pressure).

How fine the new grid will be is determined by the keyword parameter p_step. The definition of p_step, and the interpolation behavior, is consistent with abs_lookupSetup and abs_lookupSetupBatch. (New points are added between the original ones, so that the spacing is always below p_step.)

Author
Stefan Buehler
Parameters
[out]p_gridWS Output
[out]t_fieldWS Output
[out]z_fieldWS Output
[out]vmr_fieldWS Output
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]atmosphere_dimWS Input
[in]p_stepGeneric Input

Definition at line 1528 of file m_atmosphere.cc.

References chk_atm_field(), chk_atm_grids(), gridpos(), interp(), interpweights(), joker, ConstTensor4View::nbooks(), Array< base >::nelem(), ConstVectorView::nelem(), and transform().

Referenced by AtmFieldsRefinePgrid_g().

◆ AtmosphereSet1D()

void AtmosphereSet1D ( Index atmosphere_dim,
Vector lat_grid,
Vector lon_grid,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmosphereSet1D.

Sets the atmospheric dimension to 1D.

Sets atmosphere_dim to 1 and gives some variables dummy values.

The latitude and longitude grids are set to be empty.

Author
Patrick Eriksson
Parameters
[out]atmosphere_dimWS Output
[out]lat_gridWS Output
[out]lon_gridWS Output

Definition at line 952 of file m_atmosphere.cc.

References CREATE_OUT2, CREATE_OUT3, and Vector::resize().

Referenced by AtmosphereSet1D_g().

◆ AtmosphereSet2D()

void AtmosphereSet2D ( Index atmosphere_dim,
Vector lon_grid,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmosphereSet2D.

Sets the atmospheric dimension to be 2D.

Sets atmosphere_dim to 2 and the longitude grid to be empty.

Author
Patrick Eriksson
Parameters
[out]atmosphere_dimWS Output
[out]lon_gridWS Output

Definition at line 974 of file m_atmosphere.cc.

References CREATE_OUT2, CREATE_OUT3, and Vector::resize().

Referenced by AtmosphereSet2D_g().

◆ AtmosphereSet3D()

void AtmosphereSet3D ( Index atmosphere_dim,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmosphereSet3D.

Sets the atmospheric dimension to 3D.

Author
Patrick Eriksson
Parameters
[out]atmosphere_dimWS Output

Definition at line 992 of file m_atmosphere.cc.

References CREATE_OUT2, and CREATE_OUT3.

Referenced by AtmosphereSet3D_g().

◆ AtmRawRead()

void AtmRawRead ( GriddedField3 t_field_raw,
GriddedField3 z_field_raw,
ArrayOfGriddedField3 vmr_field_raw,
const ArrayOfArrayOfSpeciesTag abs_species,
const String basename,
const Verbosity verbosity 
)

WORKSPACE METHOD: AtmRawRead.

Reads atmospheric data from a scenario.

An atmospheric scenario includes the following data for each position (pressure, latitude, longitude) in the atmosphere: <br> 1. temperature field <br> 2. the corresponding altitude field <br> 3. vmr fields for the gaseous species The data is stored in different files. This methods reads all files and creates the variables t_field_raw, z_field_raw and vmr_field_raw*.

Files in a scenarios should be named matching the pattern of: tropical.H2O.xml

The files can be anywhere, but they must be all in the same directory, selected by 'basename'. The files are chosen by the species name. If you have more than one tag group for the same species, the same profile will be used.

Author
Claudia Emde
Parameters
[out]t_field_rawWS Output
[out]z_field_rawWS Output
[out]vmr_field_rawWS Output
[in]abs_speciesWS Input
[in]basenameGeneric Input

Definition at line 1682 of file m_atmosphere.cc.

References CREATE_OUT3, Array< base >::nelem(), species_data, and xml_read_from_file().

Referenced by AtmRawRead_g().

◆ basics_checkedCalc()

void basics_checkedCalc ( Index basics_checked,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const ArrayOfArrayOfSpeciesTag abs_species,
const Tensor3 z_field,
const Tensor3 t_field,
const Tensor4 vmr_field,
const Tensor3 wind_u_field,
const Tensor3 wind_v_field,
const Tensor3 wind_w_field,
const Matrix r_geoid,
const Matrix z_surface,
const Index stokes_dim,
const Vector f_grid,
const Verbosity verbosity 
)

WORKSPACE METHOD: basics_checkedCalc.

Checks consistency of the (clear sky) atmosphere.

The following WSVs are treated: f_grid, stokes_dim, p_grid, lat_grid, lon_grid, t_field, z_field, vmr_field, wind_u/v/w_field, r_geoid and z_surface. If any of these variables are changed, then this method shall be called again (no automatic check that this is fulfilled!).

The tests include: <br> 1. That basic control variables stokes_dim and atmosphere_dim <br> are inside defined ranges. <br> 2. That f_grid is sorted and increasing. <br> 3. If atmospheric grids (p/lat/lon_grid) are OK with respect to <br> atmosphere_dim. <br> 4. If atmospheric fields, r_geoid and z_surface have sizes <br> consistent with the atmospheric grids. <br> 5. There is no gap between z_surface and z_field.

If any test fails, there is an error. Otherwise, basics_checked is set to 1.

The cloudbox is covered by cloudbox_checked.

Author
Patrick Eriksson
Parameters
[out]basics_checkedWS Output
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]abs_speciesWS Input
[in]z_fieldWS Input
[in]t_fieldWS Input
[in]vmr_fieldWS Input
[in]wind_u_fieldWS Input
[in]wind_v_fieldWS Input
[in]wind_w_fieldWS Input
[in]r_geoidWS Input
[in]z_surfaceWS Input
[in]stokes_dimWS Input
[in]f_gridWS Input

Definition at line 411 of file m_atmosphere.cc.

References chk_atm_field(), chk_atm_grids(), chk_atm_surface(), chk_if_in_range(), chk_if_increasing(), joker, min, ConstMatrixView::ncols(), ConstTensor3View::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), ConstTensor3View::npages(), ConstMatrixView::nrows(), and ConstTensor3View::nrows().

Referenced by basics_checkedCalc_g().

◆ batch_atm_fields_compactAddConstant()

void batch_atm_fields_compactAddConstant ( ArrayOfGriddedField4 batch_atm_fields_compact,
const String name,
const Numeric value,
const Verbosity verbosity 
)

WORKSPACE METHOD: batch_atm_fields_compactAddConstant.

Adds a constant field to batch_atm_fields_compact.

Applies atm_fields_compactAddConstant to each batch. The format is equal to that WSM.

Author
Gerrit Holl
Parameters
[out]batch_atm_fields_compactWS Output
[in]nameGeneric Input
[in]valueGeneric Input

Definition at line 516 of file m_atmosphere.cc.

References atm_fields_compactAddConstant(), and Array< base >::nelem().

Referenced by batch_atm_fields_compactAddConstant_g().

◆ batch_atm_fields_compactAddSpecies()

void batch_atm_fields_compactAddSpecies ( ArrayOfGriddedField4 batch_atm_fields_compact,
const String name,
const GriddedField3 value,
const Verbosity verbosity 
)

WORKSPACE METHOD: batch_atm_fields_compactAddSpecies.

Adds a field to batch_atm_fields_compact, with interpolation.

This method appends a GriddedField3 to each atm_fields_compact. in batch_atm_fields_compact. For details, see atm_fields_compactAddSpecies.

Author
Gerrit Holl
Parameters
[out]batch_atm_fields_compactWS Output
[in]nameGeneric Input
[in]valueGeneric Input

Definition at line 532 of file m_atmosphere.cc.

References atm_fields_compactAddSpecies(), and Array< base >::nelem().

Referenced by batch_atm_fields_compactAddSpecies_g().

◆ batch_atm_fields_compactFromArrayOfMatrix()

void batch_atm_fields_compactFromArrayOfMatrix ( ArrayOfGriddedField4 batch_atm_fields_compact,
const Index atmosphere_dim,
const ArrayOfMatrix gin1,
const ArrayOfString field_names,
const ArrayOfString extra_field_names,
const Vector extra_field_values,
const Verbosity verbosity 
)

WORKSPACE METHOD: batch_atm_fields_compactFromArrayOfMatrix.

Expand batch of 1D atmospheric states to a batch_atm_fields_compact.

This is used to handle 1D batch cases, for example from the Chevallier data set, stored in a matrix.

The matrix must contain one row for each pressure level. The matrix can contain some additional fiels which are not directly used by ARTS for calculations but can be required for further processing, for e.g. wind speed and direction. In this case, additional fields must be put at the end of the matrix and they must be flagged by 'ignore', large or small letters, in the field names. Row format:

p[Pa] T[K] z[m] VMR_1[fractional] ... VMR[fractional] IGNORE ... IGNORE

Keywords: <br> field_names : Field names to store in atm_fields_compact. <br> This should be, e.g.: <br> ["T", "z", "H2O", "O3", "ignore"] <br> There must be one name less than matrix columns, <br> because the first column must contain pressure.

<br> extra_field_names : You can add additional constant VMR fields, <br> which is handy for O2 and N2. Give here the <br> field name, e.g., "O2". Default: Empty.

<br> extra_field_values : Give here the constant field value. Default: <br> Empty. Dimension must match extra_field_names.

Author
Stefan Buehler
Parameters
[out]batch_atm_fields_compactWS Output
[in]atmosphere_dimWS Input
[in]gin1Generic Input
[in]field_namesGeneric Input
[in]extra_field_namesGeneric Input (Default: "[]")
[in]extra_field_valuesGeneric Input (Default: "[]")

Definition at line 551 of file m_atmosphere.cc.

References atm_fields_compactAddConstant(), atm_fields_compactFromMatrix(), CREATE_OUT0, exit_or_rethrow(), Array< base >::nelem(), and ConstVectorView::nelem().

Referenced by batch_atm_fields_compactFromArrayOfMatrix_g().

◆ batch_atm_fields_compactFromArrayOfMatrixChevalAll()

void batch_atm_fields_compactFromArrayOfMatrixChevalAll ( ArrayOfGriddedField4 batch_atm_fields_compact,
ArrayOfGriddedField4 batch_atm_fields_compact_all,
const Index atmosphere_dim,
const ArrayOfMatrix gin1,
const ArrayOfString field_names,
const ArrayOfString extra_field_names,
const Vector extra_field_values,
const Verbosity verbosity 
)

WORKSPACE METHOD: batch_atm_fields_compactFromArrayOfMatrixChevalAll.

Expand batch of 1D atmospheric states to a batch_atm_fields_compact_all.

In contrast to batch_atm_fields_compactFromArrayOfMatrix, this WSM includes reading scattering particle profiles from the Chevallier data set, stored in a matrix.

This WSM fully replaces batch_atm_fields_compactFromArrayOfMatrix, since the batch_atm_fields_compact* without scattering particle profiles is also still an output. It is needed for lookup table creation in WSM abs_lookupSetupBatch.

Please also see:batch_atm_fields_compactFromArrayOfMatrix.

Row format:

p[Pa] T[K] z[m] LWC[kg/m3] IWC[kg/m3] Rain[kg/m2/s] Snow[kg/m2/s] VMR_1[fractional] ... VMR[fractional] IGNORE ... IGNORE

Keywords: <br> field_names : Field names to store in atm_fields_compact_all. <br> This should be, e.g.: <br> ["T", "z", "LWC", "IWC", "Rain", "Snow", "H2O", "O3", "ignore"] <br> There must be one name less than matrix columns, <br> because the first column must contain pressure.

<br> extra_field_names : You can add additional constant VMR fields, <br> which is handy for O2 and N2. Give here the <br> field name, e.g., "O2". Default: Empty.

<br> extra_field_values : Give here the constant field value. Default: <br> Empty. Dimension must match extra_field_names.

Possible future changes: <br> Either: <br> Name should fit naming convention. <br> Or: <br> WSM abs_lookupSetupBatch could be edited to handle batch_atm_fields_compact <br> including scattering particles. Then two different *batch_atm_fields_compact*s <br> and two different *atm_fields_compact*s would no longer be necessary.

Author
Daniel Kreyling
Parameters
[out]batch_atm_fields_compactWS Output
[out]batch_atm_fields_compact_allWS Output
[in]atmosphere_dimWS Input
[in]gin1Generic Input
[in]field_namesGeneric Input
[in]extra_field_namesGeneric Input (Default: "[]")
[in]extra_field_valuesGeneric Input (Default: "[]")

Definition at line 623 of file m_atmosphere.cc.

References atm_fields_compactAddConstant(), atm_fields_compactFromMatrixChevalAll(), CREATE_OUT0, exit_or_rethrow(), Array< base >::nelem(), and ConstVectorView::nelem().

Referenced by batch_atm_fields_compactFromArrayOfMatrixChevalAll_g().

◆ InterpAtmFieldToRteGps()

void InterpAtmFieldToRteGps ( Numeric x,
const Index atmosphere_dim,
const GridPos rte_gp_p,
const GridPos rte_gp_lat,
const GridPos rte_gp_lon,
const Tensor3 field,
const Verbosity verbosity 
)

WORKSPACE METHOD: InterpAtmFieldToRteGps.

Scalar interpolation of atmospheric fields.

The position is specified by the combination of rte_gp_p, rte_gp_lat* and rte_gp_lon.

Author
Patrick Eriksson
Parameters
[out]xGeneric output
[in]atmosphere_dimWS Input
[in]rte_gp_pWS Input
[in]rte_gp_latWS Input
[in]rte_gp_lonWS Input
[in]fieldGeneric Input

Definition at line 1735 of file m_atmosphere.cc.

References CREATE_OUT3, and interp_atmfield_by_gp().

Referenced by InterpAtmFieldToRteGps_g().

◆ p_gridFromAtmRaw()

void p_gridFromAtmRaw ( Vector p_grid,
const GriddedField3 z_field_raw,
const Verbosity verbosity 
)

WORKSPACE METHOD: p_gridFromAtmRaw.

Sets p_grid according to input atmosphere defined using AtmRawRead. Only pressure values corresponding to altitudes >= 0 are extracted.

Author
Claudia Emde
Parameters
[out]p_gridWS Output
[in]z_field_rawWS Input

Definition at line 1753 of file m_atmosphere.cc.

References GriddedField3::data, GriddedField::get_numeric_grid(), GFIELD3_P_GRID, and ConstVectorView::nelem().

Referenced by p_gridFromAtmRaw_g().

◆ z2g()

void z2g ( Numeric g,
const Numeric r,
const Numeric g0,
const Numeric z 
)

Definition at line 1771 of file m_atmosphere.cc.

Referenced by z_fieldFromHSE().

◆ z_fieldFromHSE()

void z_fieldFromHSE ( Tensor3 z_field,
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 Matrix r_geoid,
const Matrix z_surface,
const Index basics_checked,
const Numeric p_hse,
const Numeric z_hse_accuracy,
const Verbosity verbosity 
)

WORKSPACE METHOD: z_fieldFromHSE.

Altitudes to fulfil hydrostatic equilibrium.

The method applies hydrostatic equilibrium, considering the effect of water vapour (but not liquid or ice water). Several variables are hard-coded and the method is only valid for the Earth

The output is an update of z_field. This variable is expected to contain approximative altitudes when calling the function. The altitude matching p_hse is kept constant. Other altitudes are basically arbitrary, but good estimates give quicker calculations.

The calculations are repeated until the change in altitude is below z_hse_accuracy*. An iterative process is needed as gravity varies with altitude.

The values in lat_grid must be "geophysical" latitudes. For 1D, this method requires that the length of lat_grid is 1.

As a last step, it is checked that no gap between z_surface and z_field* has been genereted.

Author
Patrick Eriksson
Parameters
[out]z_fieldWS Output
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]abs_speciesWS Input
[in]t_fieldWS Input
[in]vmr_fieldWS Input
[in]r_geoidWS Input
[in]z_surfaceWS Input
[in]basics_checkedWS Input
[in]p_hseWS Input
[in]z_hse_accuracyWS Input

Definition at line 1781 of file m_atmosphere.cc.

References DEG2RAD, find_first_species_tg(), interp(), interpweights(), joker, max, ConstMatrixView::ncols(), ConstTensor3View::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), ConstMatrixView::nrows(), ConstTensor3View::nrows(), p2gridpos(), species_index_from_species_name(), and z2g().

Referenced by jacobianCalcTemperaturePerturbations(), and z_fieldFromHSE_g().

Variable Documentation

◆ DEG2RAD

const Numeric DEG2RAD
extern

Referenced by z_fieldFromHSE().

◆ GFIELD3_LAT_GRID

const Index GFIELD3_LAT_GRID
extern

◆ GFIELD3_LON_GRID

const Index GFIELD3_LON_GRID
extern

◆ GFIELD3_P_GRID

const Index GFIELD3_P_GRID
extern

◆ GFIELD4_FIELD_NAMES

◆ GFIELD4_LAT_GRID

◆ GFIELD4_LON_GRID

◆ GFIELD4_P_GRID