m_atmosphere.cc File Reference

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

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

Include dependency graph for m_atmosphere.cc:

Go to the source code of this file.

Functions

void atm_fields_compactFromMatrix (GField4 &af, const Index &atmosphere_dim, const Matrix &im, const ArrayOfString &field_names)
 WORKSPACE METHOD: atm_fields_compactFromMatrix.
void atm_fields_compactAddConstant (GField4 &af, const String &name, const Numeric &value)
 WORKSPACE METHOD: atm_fields_compactAddConstant.
void batch_atm_fields_compactFromArrayOfMatrix (ArrayOfGField4 &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)
 WORKSPACE METHOD: batch_atm_fields_compactFromArrayOfMatrix.
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 GField4 &atm_fields_compact, const Index &atmosphere_dim)
 WORKSPACE METHOD: AtmFieldsFromCompact.
void AtmosphereSet1D (Index &atmosphere_dim, Vector &lat_grid, Vector &lon_grid)
 WORKSPACE METHOD: AtmosphereSet1D.
void AtmosphereSet2D (Index &atmosphere_dim, Vector &lon_grid, Numeric &lat_1d, Numeric &meridian_angle_1d)
 WORKSPACE METHOD: AtmosphereSet2D.
void AtmosphereSet3D (Index &atmosphere_dim, Numeric &latitude_1d, Numeric &meridian_angle_1d)
 WORKSPACE METHOD: AtmosphereSet3D.
void AtmFieldsCalc (Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const GField3 &t_field_raw, const GField3 &z_field_raw, const ArrayOfGField3 &vmr_field_raw, const Index &atmosphere_dim)
 WORKSPACE METHOD: AtmFieldsCalc.
void AtmFieldsCalcExpand1D (Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const GField3 &t_field_raw, const GField3 &z_field_raw, const ArrayOfGField3 &vmr_field_raw, const Index &atmosphere_dim)
 WORKSPACE METHOD: AtmFieldsCalcExpand1D.
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)
 WORKSPACE METHOD: AtmFieldsRefinePgrid.
void AtmRawRead (GField3 &t_field_raw, GField3 &z_field_raw, ArrayOfGField3 &vmr_field_raw, const ArrayOfArrayOfSpeciesTag &abs_species, const String &basename)
 WORKSPACE METHOD: AtmRawRead.
void InterpAtmFieldToRteGps (Numeric &outvalue, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const GridPos &rte_gp_p, const GridPos &rte_gp_lat, const GridPos &rte_gp_lon, const Tensor3 &field)
 WORKSPACE METHOD: InterpAtmFieldToRteGps.

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


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 <Patrick.Eriksson@rss.chalmers.se>
Date:
2002-05-16
These functions are listed in the doxygen documentation as entries of the file auto_md.h.

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

void atm_fields_compactAddConstant ( GField4 atm_fields_compact,
const String name,
const Numeric value 
)

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.

Keywords: <br> name : The field name. Use, e.g., vmr_o2 for oxygen VMR. <br> value : The constant value of this field.

Author:
Stefan Buehler
Parameters:
[out] atm_fields_compact WS Output
[in] name Generic Input
[in] value Generic Input

Definition at line 119 of file m_atmosphere.cc.

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

Referenced by atm_fields_compactAddConstant_g(), and batch_atm_fields_compactFromArrayOfMatrix().

void atm_fields_compactFromMatrix ( GField4 atm_fields_compact,
const Index atmosphere_dim,
const Matrix gin1,
const ArrayOfString field_names 
)

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. Recommended row format:

p[Pa] T[K] z[m] VMR_1[1] ... VMR[2]

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[1]"] <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_compact WS Output
[in] atmosphere_dim WS Input
[in] gin1 Generic Input
[in] field_names Generic Input

Definition at line 74 of file m_atmosphere.cc.

References GFIELD4_FIELD_NAMES, GFIELD4_LAT_GRID, GFIELD4_LON_GRID, GFIELD4_P_GRID, joker, ConstMatrixView::ncols(), Array< base >::nelem(), ConstMatrixView::nrows(), GField4::resize(), GField::set_grid(), and transpose().

Referenced by atm_fields_compactFromMatrix_g(), and batch_atm_fields_compactFromArrayOfMatrix().

void AtmFieldsCalc ( Tensor3 t_field,
Tensor3 z_field,
Tensor4 vmr_field,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const GField3 t_field_raw,
const GField3 z_field_raw,
const ArrayOfGField3 vmr_field_raw,
const Index atmosphere_dim 
)

WORKSPACE METHOD: AtmFieldsCalc.

Interpolate the 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 from the raw data (*t_field_raw*, *z_field_raw*) which can be stored on arbitrary grids on the grids for the calculation (*p_grid*, *lat_grid*, *lon_grid*).

Author:
Claudia Emde
Parameters:
[out] t_field WS Output
[out] z_field WS Output
[out] vmr_field WS Output
[in] p_grid WS Input
[in] lat_grid WS Input
[in] lon_grid WS Input
[in] t_field_raw WS Input
[in] z_field_raw WS Input
[in] vmr_field_raw WS Input
[in] atmosphere_dim WS Input

Definition at line 369 of file m_atmosphere.cc.

References chk_atm_grids(), chk_if_in_range(), GField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, gridpos(), interp(), interpweights(), joker, Array< base >::nelem(), ConstVectorView::nelem(), p2gridpos(), Tensor4::resize(), and Tensor3::resize().

Referenced by AtmFieldsCalc_g(), and 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 GField3 t_field_raw,
const GField3 z_field_raw,
const ArrayOfGField3 vmr_field_raw,
const Index atmosphere_dim 
)

WORKSPACE METHOD: AtmFieldsCalcExpand1D.

Interpolate 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.

Author:
Patrick Eriksson

Claudia Emde

Parameters:
[out] t_field WS Output
[out] z_field WS Output
[out] vmr_field WS Output
[in] p_grid WS Input
[in] lat_grid WS Input
[in] lon_grid WS Input
[in] t_field_raw WS Input
[in] z_field_raw WS Input
[in] vmr_field_raw WS Input
[in] atmosphere_dim WS Input

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

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 GField4 atm_fields_compact,
const Index atmosphere_dim 
)

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_grid WS Output
[out] lat_grid WS Output
[out] lon_grid WS Output
[out] t_field WS Output
[out] z_field WS Output
[out] vmr_field WS Output
[in] abs_species WS Input
[in] atm_fields_compact WS Input
[in] atmosphere_dim WS Input

Definition at line 212 of file m_atmosphere.cc.

References chk_atm_grids(), GField::get_grid_size(), GField::get_numeric_grid(), GField::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().

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 
)

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.)

Keywords: <br> p_step : Maximum step in log(p[Pa]) (natural logarithm, as always). If <br> the pressure grid is coarser than this, additional points <br> are added until each log step is smaller than this.

Author:
Stefan Buehler
Parameters:
[out] p_grid WS Output
[out] t_field WS Output
[out] z_field WS Output
[out] vmr_field WS Output
[in] lat_grid WS Input
[in] lon_grid WS Input
[in] atmosphere_dim WS Input
[in] p_step Generic Input

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

void AtmosphereSet1D ( Index atmosphere_dim,
Vector lat_grid,
Vector lon_grid 
)

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_dim WS Output
[out] lat_grid WS Output
[out] lon_grid WS Output

Definition at line 313 of file m_atmosphere.cc.

References out2, out3, and Vector::resize().

Referenced by AtmosphereSet1D_g().

void AtmosphereSet2D ( Index atmosphere_dim,
Vector lon_grid,
Numeric lat_1d,
Numeric meridian_angle_1d 
)

WORKSPACE METHOD: AtmosphereSet2D.

Sets the atmospheric dimension to be 2D.

Sets *atmosphere_dim* to 2 and gives some variables dummy values.

The longitude grid is set to be empty. The variables *lat_1d* and *meridian_angle_1d* are given values that cause an error message if used.

Author:
Patrick Eriksson
Parameters:
[out] atmosphere_dim WS Output
[out] lon_grid WS Output
[out] lat_1d WS Output
[out] meridian_angle_1d WS Output

Definition at line 331 of file m_atmosphere.cc.

References out2, out3, and Vector::resize().

Referenced by AtmosphereSet2D_g().

void AtmosphereSet3D ( Index atmosphere_dim,
Numeric lat_1d,
Numeric meridian_angle_1d 
)

WORKSPACE METHOD: AtmosphereSet3D.

Sets the atmospheric dimension to 3D.

Sets *atmosphere_dim* to 3 and gives some variables dummy values.

The variables *lat_1d* and *meridian_angle_1d* are given values that cause an error message if used.

Author:
Patrick Eriksson
Parameters:
[out] atmosphere_dim WS Output
[out] lat_1d WS Output
[out] meridian_angle_1d WS Output

Definition at line 351 of file m_atmosphere.cc.

References out2, and out3.

Referenced by AtmosphereSet3D_g().

void AtmRawRead ( GField3 t_field_raw,
GField3 z_field_raw,
ArrayOfGField3 vmr_field_raw,
const ArrayOfArrayOfSpeciesTag abs_species,
const String basename 
)

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*

Different atmospheric scenarios are available in arts data: For example tropical and midlatitude-summer. 3D scenarios are not available yet.

Files in the scenarios look like this: tropical.H2O.xml

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

Keywords: basename :The name and path of a particular atmospheric scenario. For example: /smiles_local/arts-data/atmosphere/fascod/tropical

Author:
Claudia Emde
Parameters:
[out] t_field_raw WS Output
[out] z_field_raw WS Output
[out] vmr_field_raw WS Output
[in] abs_species WS Input
[in] basename Generic Input

Definition at line 838 of file m_atmosphere.cc.

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

Referenced by AtmRawRead_g().

void batch_atm_fields_compactFromArrayOfMatrix ( ArrayOfGField4 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 
)

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. Row format:

p[Pa] T[K] z[m] VMR_1[1] ... VMR_N[1]

Keywords: <br> field_names : Field names to store in atm_fields_compact. <br> This should be, e.g.: <br> ["T", "z", "H2O", "O3"] <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_compact WS Output
[in] atmosphere_dim WS Input
[in] gin1 Generic Input
[in] field_names Generic Input
[in] extra_field_names Generic Input (Default: "[]")
[in] extra_field_values Generic Input (Default: "[]")

Definition at line 154 of file m_atmosphere.cc.

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

Referenced by batch_atm_fields_compactFromArrayOfMatrix_g().

void InterpAtmFieldToRteGps ( Numeric gout1,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const GridPos rte_gp_p,
const GridPos rte_gp_lat,
const GridPos rte_gp_lon,
const Tensor3 gin1 
)

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*.

Generic output: <br> Numeric : Value obtained by interpolation.

Generic input: <br> Tensor3 : Field to interpolate.

Author:
Patrick Eriksson
Parameters:
[out] gout1 Generic output
[in] atmosphere_dim WS Input
[in] p_grid WS Input
[in] lat_grid WS Input
[in] lon_grid WS Input
[in] rte_gp_p WS Input
[in] rte_gp_lat WS Input
[in] rte_gp_lon WS Input
[in] gin1 Generic Input

Definition at line 888 of file m_atmosphere.cc.

References interp_atmfield_by_gp(), and out3.

Referenced by InterpAtmFieldToRteGps_g().


Variable Documentation


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