#include <math.h>
#include <algorithm>
#include "arts.h"
#include "matpackI.h"
#include "array.h"
#include "messages.h"
#include "file.h"
#include "absorption.h"
#include "auto_wsv.h"
#include "auto_md.h"
#include "math_funcs.h"
#include "make_array.h"
#include "atm_funcs.h"
#include "continua.h"
#include "make_vector.h"
Go to the source code of this file.
Functions | |
void | lines_per_tgSetEmpty (ArrayOfArrayOfLineRecord &lines_per_tg, const TagGroups &tgs) |
See the the online help (arts -d FUNCTION_NAME). | |
void | linesReadFromHitran (ArrayOfLineRecord &lines, const String &filename, const Numeric &fmin, const Numeric &fmax) |
Reads line data in the Hitran 1986-2001 format (100 characters/record). | |
void | linesReadFromHitran2004 (ArrayOfLineRecord &lines, const String &filename, const Numeric &fmin, const Numeric &fmax) |
Reads line data in the Hitran 2004 format (160 characters/record). | |
void | linesReadFromMytran2 (ArrayOfLineRecord &lines, const String &filename, const Numeric &fmin, const Numeric &fmax) |
void | linesReadFromJpl (ArrayOfLineRecord &lines, const String &filename, const Numeric &fmin, const Numeric &fmax) |
void | linesReadFromArts (ArrayOfLineRecord &lines, const String &filename, const Numeric &fmin, const Numeric &fmax) |
void | linesElowToJoule (ArrayOfLineRecord &lines) |
void | lines_per_tgReadFromCatalogues (ArrayOfArrayOfLineRecord &lines_per_tg, const TagGroups &tgs, const ArrayOfString &filenames, const ArrayOfString &formats, const Vector &fmin, const Vector &fmax) |
This method can read lines from different line catalogues. | |
void | lines_per_tgCreateFromLines (ArrayOfArrayOfLineRecord &lines_per_tg, const ArrayOfLineRecord &lines, const TagGroups &tgs) |
void | lines_per_tgAddMirrorLines (ArrayOfArrayOfLineRecord &lines_per_tg) |
Adds mirror lines at negative frequencies to the lines_per_tg. | |
void | lines_per_tgCompact (ArrayOfArrayOfLineRecord &lines_per_tg, const ArrayOfLineshapeSpec &lineshape, const Vector &f_mono) |
Removes all lines outside the defined lineshape cutoff frequency from the lines_per_tg, in order to save computation time. | |
void | linesWriteAscii (const ArrayOfLineRecord &lines, const String &f) |
void | lines_per_tgWriteAscii (const ArrayOfArrayOfLineRecord &lines_per_tg, const String &f) |
void | tgsDefine (TagGroups &tgs, const ArrayOfString &tags) |
void | tgsDefineAllInScenario (TagGroups &tgs, const String &basename) |
void | lineshapeDefine (ArrayOfLineshapeSpec &lineshape, const TagGroups &tgs, const String &shape, const String &normalizationfactor, const Numeric &cutoff) |
void | lineshape_per_tgDefine (ArrayOfLineshapeSpec &lineshape, const TagGroups &tgs, const ArrayOfString &shape, const ArrayOfString &normalizationfactor, const Vector &cutoff) |
void | raw_vmrsReadFromScenario (ArrayOfMatrix &raw_vmrs, const TagGroups &tgs, const String &basename) |
void | raw_vmrsReadFromFiles (ArrayOfMatrix &raw_vmrs, const TagGroups &tgs, const ArrayOfString &seltags, const ArrayOfString &filenames, const String &basename) |
Reads in the profiles from the specified files in filenames for the tag list seltags and for all the other tags the atmospheric profile from the general scenario stated in basename. | |
void | WaterVaporSaturationInClouds (Matrix &vmrs, Vector &p_abs, const Vector &t_abs, const TagGroups &tgs) |
Calculates the water vapor saturation volume mixing ratio (VMR) in the vertical range where liquid or ice clouds are in the atmosphere. | |
void | AtmFromRaw (Vector &t_abs, Vector &z_abs, Matrix &vmrs, const TagGroups &tgs, const Vector &p_abs, const Matrix &raw_ptz, const ArrayOfMatrix &raw_vmrs) |
Interpolate atmospheric quantities from their individual grids to the common p_abs grid. | |
void | hseSet (Vector &hse, const Numeric &pref, const Numeric &zref, const Numeric &g0, const Index &niter) |
See the the online help (arts -d FUNCTION_NAME). | |
void | hseSetFromLatitude (Vector &hse, const Numeric &pref, const Numeric &zref, const Numeric &latitude, const Index &niter) |
See the the online help (arts -d FUNCTION_NAME). | |
void | hseSetFromLatitudeIndex (Vector &hse, const Vector &p_abs, const Vector &z_abs, const Numeric &latitude, const Index &index, const Index &niter) |
See the the online help (arts -d FUNCTION_NAME). | |
void | hseFromBottom (Vector &hse, const Vector &p_abs, const Vector &z_abs, const Numeric &g0, const Index &niter) |
See the the online help (arts -d FUNCTION_NAME). | |
void | hseOff (Vector &hse) |
See the the online help (arts -d FUNCTION_NAME). | |
void | hseCalc (Vector &z_abs, const Vector &p_abs, const Vector &t_abs, const Vector &h2o_abs, const Numeric &r_geoid, const Vector &hse) |
See the the online help (arts -d FUNCTION_NAME). | |
void | h2o_absSet (Vector &h2o_abs, const TagGroups &tgs, const Matrix &vmrs) |
See the the online help (arts -d FUNCTION_NAME). | |
void | vmrsScale (Matrix &vmrs, const TagGroups &tgs, const ArrayOfString &scaltgs, const Vector &scalfac) |
See the the online help (arts -d FUNCTION_NAME). | |
void | n2_absSet (Vector &n2_abs, const TagGroups &tgs, const Matrix &vmrs) |
See the the online help (arts -d FUNCTION_NAME) Just a copy of the function 'h2o_absSet' but now for nitrogen. | |
void | absCalc (Matrix &abs, ArrayOfMatrix &abs_per_tg, const TagGroups &tgs, const Vector &f_mono, const Vector &p_abs, const Vector &t_abs, const Vector &n2_abs, const Vector &h2o_abs, const Matrix &vmrs, const ArrayOfArrayOfLineRecord &lines_per_tg, const ArrayOfLineshapeSpec &lineshape, const ArrayOfString &cont_description_names, const ArrayOfString &cont_description_models, const ArrayOfVector &cont_description_parameters) |
Calculates the absorption coefficients by first calculating the cross sections per tag group and then the absorption from the cross sections. | |
void | absCalcSaveMemory (Matrix &abs, const TagGroups &tgs, const Vector &f_mono, const Vector &p_abs, const Vector &t_abs, const Vector &n2_abs, const Vector &h2o_abs, const Matrix &vmrs, const ArrayOfArrayOfLineRecord &lines_per_tg, const ArrayOfLineshapeSpec &lineshape, const ArrayOfString &cont_description_names, const ArrayOfString &cont_description_models, const ArrayOfVector &cont_description_parameters) |
Calculates the absorption coefficients by first calculating the cross sections per tag group and then the absorption from the cross sections. | |
void | absCalcFromXsec (Matrix &abs, ArrayOfMatrix &abs_per_tg, const ArrayOfMatrix &xsec_per_tg, const Matrix &vmrs) |
Calculates the absorption from a given cross section. | |
void | xsec_per_tgInit (ArrayOfMatrix &xsec_per_tg, const TagGroups &tgs, const Vector &f_mono, const Vector &p_abs) |
Initialize xsec_per_tg. | |
void | xsec_per_tgAddLines (ArrayOfMatrix &xsec_per_tg, const TagGroups &tgs, const Vector &f_mono, const Vector &p_abs, const Vector &t_abs, const Vector &h2o_abs, const Matrix &vmrs, const ArrayOfArrayOfLineRecord &lines_per_tg, const ArrayOfLineshapeSpec &lineshape) |
Calculates the line spectrum for each tag group and adds it to xsec_per_tg. | |
void | xsec_per_tgAddConts (ArrayOfMatrix &xsec_per_tg, const TagGroups &tgs, const Vector &f_mono, const Vector &p_abs, const Vector &t_abs, const Vector &n2_abs, const Vector &h2o_abs, const Matrix &vmrs, const ArrayOfString &cont_description_names, const ArrayOfVector &cont_description_parameters, const ArrayOfString &cont_description_models) |
Calculates the continuum for each tag group and adds it to xsec_per_tg. | |
void | abs_per_tgReduce (ArrayOfMatrix &abs_per_tg, const TagGroups &tgs, const TagGroups &wfs_tgs) |
Reduces the size of abs_per_tg. | |
void | refrSet (Index &refr, Index &refr_lfac, String &refr_model, const Index &on, const String &model, const Index &lfac) |
See the the online help (arts -d FUNCTION_NAME). | |
void | refrOff (Index &refr, Index &refr_lfac, String &refr_model) |
See the the online help (arts -d FUNCTION_NAME). | |
void | refrCalc (Vector &refr_index, const Vector &p_abs, const Vector &t_abs, const Vector &h2o_abs, const Index &refr, const String &refr_model) |
See the the online help (arts -d FUNCTION_NAME). | |
void | cont_descriptionInit (ArrayOfString &names, ArrayOfString &options, ArrayOfVector ¶meters) |
Initializes the two continuum description WSVs, `cont_description_names' and `cont_description_parameters'. | |
void | cont_descriptionAppend (ArrayOfString &cont_description_names, ArrayOfString &cont_description_models, ArrayOfVector &cont_description_parameters, const String &tagname, const String &model, const Vector &userparameters) |
Append a continuum description to `cont_description_names' and `cont_description_parameters'. |
Definition in file m_abs.cc.
void abs_per_tgReduce | ( | ArrayOfMatrix & | abs_per_tg, | |
const TagGroups & | tgs, | |||
const TagGroups & | wfs_tgs | |||
) |
Reduces the size of abs_per_tg.
Only absorption coefficients for which weighting functions are calculated are kept in memory.
abs_per_tg | absorption coefficients |
tgs | all selected tag groups | |
wfs_tgs | the tag groups for which we want weighting functions. |
void absCalc | ( | Matrix & | abs, | |
ArrayOfMatrix & | abs_per_tg, | |||
const TagGroups & | tgs, | |||
const Vector & | f_mono, | |||
const Vector & | p_abs, | |||
const Vector & | t_abs, | |||
const Vector & | n2_abs, | |||
const Vector & | h2o_abs, | |||
const Matrix & | vmrs, | |||
const ArrayOfArrayOfLineRecord & | lines_per_tg, | |||
const ArrayOfLineshapeSpec & | lineshape, | |||
const ArrayOfString & | cont_description_names, | |||
const ArrayOfString & | cont_description_models, | |||
const ArrayOfVector & | cont_description_parameters | |||
) |
Calculates the absorption coefficients by first calculating the cross sections per tag group and then the absorption from the cross sections.
abs | absorption coefficients | |
abs_per_tg | absorption coefficients per tag group |
tgs | the list of tag groups | |
f_mono | monochromatic frequency grid | |
p_abs | pressure levels | |
t_abs | temperature at pressure level | |
h2o_abs | total volume mixing ratio of water vapor | |
vmrs | volume mixing ratios per tag group | |
lines_per_tg | transition lines per tag group | |
lineshape | lineshape specifications to use per tag group | |
cont_description_names | names of different continuum models | |
cont_description_parameters | continuum parameters for the models listed in cont_description_names |
void absCalcFromXsec | ( | Matrix & | abs, | |
ArrayOfMatrix & | abs_per_tg, | |||
const ArrayOfMatrix & | xsec_per_tg, | |||
const Matrix & | vmrs | |||
) |
Calculates the absorption from a given cross section.
Only the cross section and the vmrs are required, it is assumed that the vmrs are in the order of the cross sections, only the dimension is checked.
abs | absorption coefficients | |
abs_per_tg | absorption coefficients per tag group |
xsec_per_tg | cross sections per tag group | |
vmrs | volume mixing ratios per tag group |
void absCalcSaveMemory | ( | Matrix & | abs, | |
const TagGroups & | tgs, | |||
const Vector & | f_mono, | |||
const Vector & | p_abs, | |||
const Vector & | t_abs, | |||
const Vector & | n2_abs, | |||
const Vector & | h2o_abs, | |||
const Matrix & | vmrs, | |||
const ArrayOfArrayOfLineRecord & | lines_per_tg, | |||
const ArrayOfLineshapeSpec & | lineshape, | |||
const ArrayOfString & | cont_description_names, | |||
const ArrayOfString & | cont_description_models, | |||
const ArrayOfVector & | cont_description_parameters | |||
) |
Calculates the absorption coefficients by first calculating the cross sections per tag group and then the absorption from the cross sections.
This is done in a loop over species, in order to save memory. we only calculate abs, not abs_per_tg!
abs | absorption coefficients |
tgs | the list of tag groups | |
f_mono | monochromatic frequency grid | |
p_abs | pressure levels | |
t_abs | temperature at pressure level | |
h2o_abs | total volume mixing ratio of water vapor | |
vmrs | volume mixing ratios per tag group | |
lines_per_tg | transition lines per tag group | |
lineshape | lineshape specifications to use per tag group | |
cont_description_names | names of different continuum models | |
cont_description_parameters | continuum parameters for the models listed in cont_description_names |
void AtmFromRaw | ( | Vector & | t_abs, | |
Vector & | z_abs, | |||
Matrix & | vmrs, | |||
const TagGroups & | tgs, | |||
const Vector & | p_abs, | |||
const Matrix & | raw_ptz, | |||
const ArrayOfMatrix & | raw_vmrs | |||
) |
Interpolate atmospheric quantities from their individual grids to the common p_abs grid.
See also arts -d online documentation.
This function does the following: 1. Interpolation of temperature and altitude 2. Interpolation of VMR profiles 3. Saturation adjustment VMR profiles of H2O tags in clouds
Step 3 is only carried out if keyword CloudSatWV is set to "yes".
void cont_descriptionAppend | ( | ArrayOfString & | cont_description_names, | |
ArrayOfString & | cont_description_models, | |||
ArrayOfVector & | cont_description_parameters, | |||
const String & | tagname, | |||
const String & | model, | |||
const Vector & | userparameters | |||
) |
void cont_descriptionInit | ( | ArrayOfString & | names, | |
ArrayOfString & | options, | |||
ArrayOfVector & | parameters | |||
) |
Initializes the two continuum description WSVs, `cont_description_names' and `cont_description_parameters'.
This method does not really do anything, except setting the two variables to empty Arrays. It is just necessary because the method `cont_descriptionAppend' wants to append to the variables.
Formally, the continuum description WSVs are required by the absorption calculation methods (e.g., `absCalc'). Therefore you always have to call `cont_descriptionInit'.
Usage example: cont_descriptionInit{}
void hseOff | ( | Vector & | hse | ) |
void lines_per_tgAddMirrorLines | ( | ArrayOfArrayOfLineRecord & | lines_per_tg | ) |
void lines_per_tgCompact | ( | ArrayOfArrayOfLineRecord & | lines_per_tg, | |
const ArrayOfLineshapeSpec & | lineshape, | |||
const Vector & | f_mono | |||
) |
Removes all lines outside the defined lineshape cutoff frequency from the lines_per_tg, in order to save computation time.
It should be particularly useful to call this method after lines_per_tgAddMirrorLines.
lines_per_tg | the old and newly compacted line list |
lineshape | the lineshape specifications | |
f_mono | the frequency grid |
void lines_per_tgCreateFromLines | ( | ArrayOfArrayOfLineRecord & | lines_per_tg, | |
const ArrayOfLineRecord & | lines, | |||
const TagGroups & | tgs | |||
) |
void lines_per_tgReadFromCatalogues | ( | ArrayOfArrayOfLineRecord & | lines_per_tg, | |
const TagGroups & | tgs, | |||
const ArrayOfString & | filenames, | |||
const ArrayOfString & | formats, | |||
const Vector & | fmin, | |||
const Vector & | fmax | |||
) |
This method can read lines from different line catalogues.
For each tag group, you can specify which catalogue to use. Because the method creates lines_per_tg directly, it replaces for example the following two method calls:
This method needs as input WSVs the list of tag groups. Keyword parameters must specify the names of the catalogue files to use and the matching formats. Names can be anything, formats can currently be HITRAN96 (for HITRAN 1986-2001 databases), HITRAN04 (for HITRAN 2004 databse), MYTRAN2, JPL, or ARTS. Furthermore, keyword parameters have to specify minimum and maximum frequency for each tag group. To safe typing, if there are less elements in the keyword parameters than there are tag groups, the last parameters are applied to all following tag groups.
Example usage:
lines_per_tgReadFromCatalogues{ filenames = [ "../data/cat1.dat", "../data/cat2.dat" ] formats = [ "MYTRAN2", "HITRAN96" ] fmin = [ 0, 0 ] fmax = [ 2000e9, 100e9 ] }
In this example, lines for the first tag group will be taken from cat1, lines for all other tag groups will be taken from cat2.
This methods allows you for example to use a special line file just for water vapor lines. This could be the improved water vapor line file generated by Thomas Kuhn.
Catalogues are only read once, even if several tag groups have the same catalogue. However, in that case the frequency ranges MUST be the same. (If you want to do fine-tuning of the frequency ranges, you can do this inside the tag definitions, e.g., "H2O-*-0-2000e9".)
This function uses the various reading routines (linesReadFromHitran, etc.), as well as lines_per_tgCreateFromLines.
void lines_per_tgSetEmpty | ( | ArrayOfArrayOfLineRecord & | lines_per_tg, | |
const TagGroups & | tgs | |||
) |
void lines_per_tgWriteAscii | ( | const ArrayOfArrayOfLineRecord & | lines_per_tg, | |
const String & | f | |||
) |
void linesElowToJoule | ( | ArrayOfLineRecord & | lines | ) |
void lineshape_per_tgDefine | ( | ArrayOfLineshapeSpec & | lineshape, | |
const TagGroups & | tgs, | |||
const ArrayOfString & | shape, | |||
const ArrayOfString & | normalizationfactor, | |||
const Vector & | cutoff | |||
) |
void lineshapeDefine | ( | ArrayOfLineshapeSpec & | lineshape, | |
const TagGroups & | tgs, | |||
const String & | shape, | |||
const String & | normalizationfactor, | |||
const Numeric & | cutoff | |||
) |
void linesReadFromArts | ( | ArrayOfLineRecord & | lines, | |
const String & | filename, | |||
const Numeric & | fmin, | |||
const Numeric & | fmax | |||
) |
void linesReadFromHitran | ( | ArrayOfLineRecord & | lines, | |
const String & | filename, | |||
const Numeric & | fmin, | |||
const Numeric & | fmax | |||
) |
Reads line data in the Hitran 1986-2001 format (100 characters/record).
For Hitran version 2004 use linesReadFromHitran2004().
void linesReadFromHitran2004 | ( | ArrayOfLineRecord & | lines, | |
const String & | filename, | |||
const Numeric & | fmin, | |||
const Numeric & | fmax | |||
) |
Reads line data in the Hitran 2004 format (160 characters/record).
For Hitran versions 1986-2001 use linesReadFromHitran().
void linesReadFromJpl | ( | ArrayOfLineRecord & | lines, | |
const String & | filename, | |||
const Numeric & | fmin, | |||
const Numeric & | fmax | |||
) |
void linesReadFromMytran2 | ( | ArrayOfLineRecord & | lines, | |
const String & | filename, | |||
const Numeric & | fmin, | |||
const Numeric & | fmax | |||
) |
void linesWriteAscii | ( | const ArrayOfLineRecord & | lines, | |
const String & | f | |||
) |
void raw_vmrsReadFromFiles | ( | ArrayOfMatrix & | raw_vmrs, | |
const TagGroups & | tgs, | |||
const ArrayOfString & | seltags, | |||
const ArrayOfString & | filenames, | |||
const String & | basename | |||
) |
Reads in the profiles from the specified files in filenames for the tag list seltags and for all the other tags the atmospheric profile from the general scenario stated in basename.
raw_vmrs | volume mixing ratios per tag group (output) | |
tgs | the list of tag groups (input) | |
seltags | selected tags for special input files (input) | |
filenames | specific files for list of seltags (input) | |
basename | general scenario base name (input) |
void raw_vmrsReadFromScenario | ( | ArrayOfMatrix & | raw_vmrs, | |
const TagGroups & | tgs, | |||
const String & | basename | |||
) |
void tgsDefine | ( | TagGroups & | tgs, | |
const ArrayOfString & | tags | |||
) |
void vmrsScale | ( | Matrix & | vmrs, | |
const TagGroups & | tgs, | |||
const ArrayOfString & | scaltgs, | |||
const Vector & | scalfac | |||
) |
void WaterVaporSaturationInClouds | ( | Matrix & | vmrs, | |
Vector & | p_abs, | |||
const Vector & | t_abs, | |||
const TagGroups & | tgs | |||
) |
Calculates the water vapor saturation volume mixing ratio (VMR) in the vertical range where liquid or ice clouds are in the atmosphere.
At the pressure/altitude grid points where the liquid water content (LWC) or ice water content (IWC) is larger than zero the H2O-VMR is set to liquid water/ice saturation VMR (=e_s/p_tot).
The saturation pressure (e_s) is calculated according to the Goff-Gratch equations (see functions WVSatPressureLiquidWater and WVSatPressureIce in file continua.cc).
Before adjustment:
VMRH2O | = | H2O volume mixing ratio |
Ptot | = | total air pressure |
PH2O | = | H2O partial pressure |
Pdry | = | dry air partial pressure |
after adjustment:
VMR'H2O | = | H2O volume mixing ratio |
P'tot | = | total air pressure |
P'H2O | = | H2O partial pressure |
H2O saturation pressure over water / ice:
es
calculation of the adjustment:
PH2O | = | VMRH2O * Ptot |
Pdry | = | Ptot * (1.0 - VMRH2O) |
P'H2O | = | es |
P'tot | = | es + Pdry |
VMR'H2O | = | P'H2O / P'tot |
vmrs | [1] volume mixing ratios per tag group (input/output) | |
t_abs | [K] temperature at pressure level (input) | |
p_abs | [Pa] pressure levels (input) | |
tgs | [1] the list of tag groups (input) |
void xsec_per_tgAddConts | ( | ArrayOfMatrix & | xsec_per_tg, | |
const TagGroups & | tgs, | |||
const Vector & | f_mono, | |||
const Vector & | p_abs, | |||
const Vector & | t_abs, | |||
const Vector & | n2_abs, | |||
const Vector & | h2o_abs, | |||
const Matrix & | vmrs, | |||
const ArrayOfString & | cont_description_names, | |||
const ArrayOfVector & | cont_description_parameters, | |||
const ArrayOfString & | cont_description_models | |||
) |
Calculates the continuum for each tag group and adds it to xsec_per_tg.
xsec_per_tg | cross section per tag group |
tgs | the list of tag groups | |
f_mono | monochromatic frequency grid | |
p_abs | pressure levels | |
t_abs | temperature at pressure level | |
n2_abs | total volume mixing ratio of nitrogen | |
h2o_abs | total volume mixing ratio of water vapor | |
vmrs | volume mixing ratios per tag group | |
cont_description_names | names of different continuum models | |
cont_description_parameters | continuum parameters for the models listed in cont_description_names |
runtime_error | something went wrong |
void xsec_per_tgAddLines | ( | ArrayOfMatrix & | xsec_per_tg, | |
const TagGroups & | tgs, | |||
const Vector & | f_mono, | |||
const Vector & | p_abs, | |||
const Vector & | t_abs, | |||
const Vector & | h2o_abs, | |||
const Matrix & | vmrs, | |||
const ArrayOfArrayOfLineRecord & | lines_per_tg, | |||
const ArrayOfLineshapeSpec & | lineshape | |||
) |
Calculates the line spectrum for each tag group and adds it to xsec_per_tg.
xsec_per_tg | cross section per tag group |
tgs | the list of tag groups | |
f_mono | monochromatic frequency grid | |
p_abs | pressure levels | |
t_abs | temperature at pressure level | |
h2o_abs | total volume mixing ratio of water vapor | |
vmrs | volume mixing ratios per tag group | |
lines_per_tg | transition lines per tag group | |
lineshape | lineshape specifications to use per tag group |
void xsec_per_tgInit | ( | ArrayOfMatrix & | xsec_per_tg, | |
const TagGroups & | tgs, | |||
const Vector & | f_mono, | |||
const Vector & | p_abs | |||
) |
Initialize xsec_per_tg.
The initialization is necessary, because methods `xsec_per_tgAddLines' and `xsec_per_tgAddConts' just add to xsec_per_tg.
xsec_per_tg | cross section per tag group |
tgs | the list of tag groups | |
f_mono | monochromatic frequency grid | |
p_abs | pressure levels |