ARTS  2.0.49
abs_species_tags.h File Reference

Header file for stuff related to absorption species tags. More...

#include <stdexcept>
#include "matpackI.h"
#include "array.h"
#include "mystring.h"
#include "make_array.h"
#include "bifstream.h"

Go to the source code of this file.

Classes

class  SpeciesTag
 A tag group can consist of the sum of several of these. More...
 

Macros

#define SPECIES_INDEX_N2   0
 
#define SPECIES_INDEX_O2   1
 
#define SPECIES_INDEX_H2O   2
 
#define SPECIES_INDEX_O3   3
 
#define SPECIES_INDEX_CO2   4
 
#define SPECIES_INDEX_COUNT   5
 

Typedefs

typedef Array< SpeciesTagArrayOfSpeciesTag
 A tag group is an array of SpeciesTags. More...
 
typedef Array< ArrayOfSpeciesTagArrayOfArrayOfSpeciesTag
 Contains the available tag groups. More...
 

Functions

ostream & operator<< (ostream &os, const SpeciesTag &ot)
 Output operator for SpeciesTag. More...
 
String get_tag_group_name (const ArrayOfSpeciesTag &tg)
 Return the name of a tag group as a string. More...
 
String get_species_name (const ArrayOfSpeciesTag &tg)
 Return the species of a tag group as a string. More...
 
Index species_index_from_species_name (String name)
 Return species index for given species name. More...
 
Index find_first_species_tg (const ArrayOfArrayOfSpeciesTag &tgs, const Index &spec)
 Find first occurrence of species in tag groups. More...
 
Index find_next_species_tg (const ArrayOfArrayOfSpeciesTag &tgs, const Index &spec, const Index &start)
 Find next occurrence of species in tag groups. More...
 
void array_species_tag_from_string (ArrayOfSpeciesTag &tags, const String &names)
 Converts a String to ArrayOfSpeciesTag. More...
 
void get_tagindex_for_Strings (ArrayOfIndex &tags1_index, const ArrayOfArrayOfSpeciesTag &tags1, const ArrayOfString &tags2_Strings)
 
void get_tag_group_index_for_tag_group (Index &tags1_index, const ArrayOfArrayOfSpeciesTag &tags1, const Array< SpeciesTag > &tags2)
 Returns the index of the tag group tg2 within the array of tag groups tgs1. More...
 

Detailed Description

Header file for stuff related to absorption species tags.

Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Tue May 31 17:18:22 2005

This file contains class definition and function headers related to SpeciesTags. It is better to separate this from the other absorption functions, since this part was actually improved in arts-1-1 and should be kept, whereas most other absorption stuff is back-ported from arts-1-0.

Definition in file abs_species_tags.h.

Macro Definition Documentation

◆ SPECIES_INDEX_CO2

#define SPECIES_INDEX_CO2   4

Definition at line 169 of file abs_species_tags.h.

◆ SPECIES_INDEX_COUNT

#define SPECIES_INDEX_COUNT   5

Definition at line 170 of file abs_species_tags.h.

◆ SPECIES_INDEX_H2O

#define SPECIES_INDEX_H2O   2

Definition at line 167 of file abs_species_tags.h.

◆ SPECIES_INDEX_N2

#define SPECIES_INDEX_N2   0

Definition at line 165 of file abs_species_tags.h.

◆ SPECIES_INDEX_O2

#define SPECIES_INDEX_O2   1

Definition at line 166 of file abs_species_tags.h.

◆ SPECIES_INDEX_O3

#define SPECIES_INDEX_O3   3

Definition at line 168 of file abs_species_tags.h.

Typedef Documentation

◆ ArrayOfArrayOfSpeciesTag

Contains the available tag groups.

Contrary to the Bredbeck definition, tag groups may only consist of tags belonging to the same species. The reason for this is that there is one VMR profile associated with each tag group.

Author
Stefan Buehler

Definition at line 137 of file abs_species_tags.h.

◆ ArrayOfSpeciesTag

A tag group is an array of SpeciesTags.

This corresponds to one "species" in the controlfile. Example: "O3-666, O3-668"

Author
Stefan Buehler

Definition at line 129 of file abs_species_tags.h.

Function Documentation

◆ array_species_tag_from_string()

void array_species_tag_from_string ( ArrayOfSpeciesTag tags,
const String names 
)

Converts a String to ArrayOfSpeciesTag.

This function is used when preparing strings read from e.g. control files to be stored as SpeciesTag in abs_species.

Note: This is originally a part of abs_speciesSet.

Parameters
tagsArray of SpeciesTag.
namesString with species.
Author
Mattias Ekstroem
Date
2004-09-30

Definition at line 509 of file abs_species_tags.cc.

References Array< base >::nelem(), my_basic_string< charT >::npos, and SpeciesTag::Species().

Referenced by abs_speciesAdd(), abs_speciesAdd2(), get_pointers_for_analytical_jacobians(), jacobianCalcAbsSpeciesPerturbations(), and SpeciesSet().

◆ find_first_species_tg()

Index find_first_species_tg ( const ArrayOfArrayOfSpeciesTag tgs,
const Index spec 
)

Find first occurrence of species in tag groups.

The species to look for must be specified by its species index, not by the name. Use the helper function to get the species index from the species name if necessary.

See also
species_index_from_species_name.
Parameters
tgsThe species tags to search in.
specThe species index of the species to look for.
Returns
The index of spec in tgs, -1 if not found.
Author
Stefan Buehler
Date
2003-01-13

Definition at line 393 of file abs_species_tags.cc.

References find_next_species_tg(), and spec().

Referenced by abs_h2oSet(), abs_lookupSetup(), abs_lookupSetupBatch(), abs_lookupSetupWide(), abs_lookupTestAccMC(), abs_lookupTestAccuracy(), abs_n2Set(), GasAbsLookup::Extract(), refr_indexThayer(), and z_fieldFromHSE().

◆ find_next_species_tg()

Index find_next_species_tg ( const ArrayOfArrayOfSpeciesTag tgs,
const Index spec,
const Index start 
)

Find next occurrence of species in tag groups.

The species to look for must be specified by its species index, not by the name. Use the helper function to get the species index from the species name if necessary.

See also
species_index_from_species_name.
Parameters
tgsThe species tags to search in.
specThe species index of the species to look for.
startThe index position at which to start the search (0 would be the very beginning).
Returns
The index of spec in tgs, -1 if not found.
Author
Stefan Buehler
Date
2007-11-16

Definition at line 417 of file abs_species_tags.cc.

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

Referenced by choose_abs_nls(), and find_first_species_tg().

◆ get_species_name()

String get_species_name ( const ArrayOfSpeciesTag tg)

Return the species of a tag group as a string.

A tag group consists of several elementary SpeciesTags, which must all belong to the same molecular species. This function returns a string with the name of the species. This is nice for informational output messages, for example in the absorption routines.

E.g., if the tag group is: "H2O-161, H2O-181", then the function will return "H2O".

It also does a safety check that really all tags belong to the same species.

Parameters
tgThe tag group in question.
Returns
The name of the species, as it should be used in gridded atmospheric fields, for example.
Author
Stefan Buehler
Date
2009-06-11

Definition at line 349 of file abs_species_tags.cc.

References get_tag_group_name(), SpeciesRecord::Name(), Array< base >::nelem(), and species_data.

Referenced by abs_lookupSetupBatch().

◆ get_tag_group_index_for_tag_group()

void get_tag_group_index_for_tag_group ( Index tgs1_index,
const ArrayOfArrayOfSpeciesTag tgs1,
const ArrayOfSpeciesTag tg2 
)

Returns the index of the tag group tg2 within the array of tag groups tgs1.

Slightly modified copy of get_tagindex_for_Strings.

Exceptions
runtime_errorCould not find tg2 in tgs1.
Return values
tgs1_indexIndex in tgs1 for tg2
Parameters
tgs1The tags groups to search in.
tg2The tag group for which the index shall be found.
Author
Patrick Eriksson, Axel von Engeln, and Stefan Buehler
Date
2001-01-31

Definition at line 632 of file abs_species_tags.cc.

References Array< base >::nelem().

◆ get_tag_group_name()

String get_tag_group_name ( const ArrayOfSpeciesTag tg)

Return the name of a tag group as a string.

A tag group consists of several elementary SpeciesTags. This function returns a String with the name of the entire tag group. This is nice for informational output messages, for example in the absorption routines.

Parameters
tgThe tag group in question.
Returns
The full name of the tag group, as it could occur in the controlfile.
Author
Stefan Buehler
Date
2001-03-13

Definition at line 314 of file abs_species_tags.cc.

References Array< base >::nelem().

Referenced by abs_xsec_per_speciesAddLines(), GasAbsLookup::Adapt(), and get_species_name().

◆ get_tagindex_for_Strings()

void get_tagindex_for_Strings ( ArrayOfIndex tags1_index,
const ArrayOfArrayOfSpeciesTag tags1,
const ArrayOfString tags2_Strings 
)

◆ operator<<()

ostream& operator<< ( ostream &  os,
const SpeciesTag ot 
)

Output operator for SpeciesTag.

Author
Stefan Buehler

Definition at line 296 of file abs_species_tags.cc.

References SpeciesTag::Name().

◆ species_index_from_species_name()

Index species_index_from_species_name ( String  name)

Return species index for given species name.

This is useful in connection with other functions that need a species index.

See also
find_first_species_tg.
Parameters
nameSpecies name.
Returns
Species index, -1 means not found.
Author
Stefan Buehler
Date
2003-01-13

Definition at line 452 of file abs_species_tags.cc.

References my_basic_string< charT >::nelem(), and SpeciesMap.

Referenced by abs_h2oSet(), abs_lookupSetup(), abs_lookupSetupBatch(), abs_lookupSetupWide(), abs_lookupTestAccMC(), abs_lookupTestAccuracy(), abs_n2Set(), choose_abs_nls(), GasAbsLookup::Extract(), find_nonlinear_continua(), refr_indexThayer(), SpeciesTag::SpeciesTag(), and z_fieldFromHSE().