UFO
|
GeoVaLs: geophysical values at locations. More...
#include <GeoVaLs.h>
Public Member Functions | |
GeoVaLs (std::shared_ptr< const ioda::Distribution >, const oops::Variables &) | |
Deprecated default constructor - does not allocate fields. More... | |
GeoVaLs (const Locations &, const oops::Variables &) | |
Deprecated constructor given Locations and Variables. More... | |
GeoVaLs (const Locations &locs, const oops::Variables &vars, const std::vector< size_t > &nlevs) | |
Allocating constructor for specified Locations locs , Variables vars and number of levels nlevs . More... | |
GeoVaLs (const eckit::Configuration &, const ioda::ObsSpace &, const oops::Variables &) | |
Constructor for tests. More... | |
GeoVaLs (const GeoVaLs &, const int &) | |
Construct a new GeoVaLs with just one location. More... | |
GeoVaLs (const GeoVaLs &) | |
Copy constructor. More... | |
~GeoVaLs () | |
GeoVaLs & | operator= (const GeoVaLs &) |
Copy operator. More... | |
GeoVaLs & | operator*= (const double) |
Multiply by a constant scalar. More... | |
GeoVaLs & | operator*= (const std::vector< float > &) |
Multiply by a constant scalar for each profile. More... | |
GeoVaLs & | operator+= (const GeoVaLs &) |
Add another GeoVaLs. More... | |
GeoVaLs & | operator-= (const GeoVaLs &) |
Subtract another GeoVaLs. More... | |
GeoVaLs & | operator*= (const GeoVaLs &) |
Multiply another GeoVaLs. More... | |
double | dot_product_with (const GeoVaLs &) const |
Scalar product of two GeoVaLs. More... | |
void | split (GeoVaLs &, GeoVaLs &) const |
Split two GeoVaLs. More... | |
void | merge (const GeoVaLs &, const GeoVaLs &) |
Merge two GeoVaLs. More... | |
void | allocate (const int &nlev, const oops::Variables &vars) |
Deprecated method. Allocates GeoVaLs for vars variables with nlev number of levels. More... | |
void | zero () |
Zero out the GeoVaLs. More... | |
void | reorderzdir (const std::string &, const std::string &) |
Reorder GeoVaLs in vertical dimension based on vertical coordinate variable. More... | |
void | random () |
Randomize GeoVaLs. More... | |
double | rms () const |
Calculate rms. More... | |
double | normalizedrms (const GeoVaLs &) const |
Calculate normalized rms. More... | |
bool | has (const std::string &var) const |
const oops::Variables & | getVars () const |
size_t | nlevs (const std::string &var) const |
Return number of levels for a specified variable. More... | |
void | get (std::vector< double > &, const std::string &var) const |
Get 2D GeoVaLs for variable var (fails for 3D GeoVaLs) More... | |
void | get (std::vector< float > &, const std::string &var) const |
Get 2D GeoVaLs for variable var (fails for 3D GeoVaLs), and convert to float. More... | |
void | get (std::vector< int > &, const std::string &var) const |
Get 2D GeoVaLs for variable var (fails for 3D GeoVaLs), and convert to int. More... | |
void | getAtLevel (std::vector< double > &, const std::string &, const int) const |
Get GeoVaLs at a specified level. More... | |
void | getAtLevel (std::vector< float > &, const std::string &, const int) const |
Get GeoVaLs at a specified level and convert to float. More... | |
void | getAtLevel (std::vector< int > &, const std::string &, const int) const |
Get GeoVaLs at a specified level and convert to int. More... | |
void | getAtLocation (std::vector< double > &, const std::string &, const int) const |
Get GeoVaLs at a specified location. More... | |
void | getAtLocation (std::vector< float > &, const std::string &, const int) const |
Get GeoVaLs at a specified location and convert to float. More... | |
void | getAtLocation (std::vector< int > &, const std::string &, const int) const |
Get GeoVaLs at a specified location and convert to int. More... | |
void | putAtLevel (const std::vector< double > &vals, const std::string &var, const int lev) const |
Put GeoVaLs for double variable var at level lev . More... | |
void | putAtLevel (const std::vector< float > &vals, const std::string &var, const int lev) const |
Put GeoVaLs for float variable var at level lev . More... | |
void | putAtLevel (const std::vector< int > &vals, const std::string &var, const int lev) const |
Put GeoVaLs for int variable var at level lev . More... | |
void | putAtLocation (const std::vector< double > &vals, const std::string &var, const int loc) const |
Put GeoVaLs for double variable var at location loc . More... | |
void | putAtLocation (const std::vector< float > &vals, const std::string &var, const int loc) const |
Put GeoVaLs for float variable var at location loc . More... | |
void | putAtLocation (const std::vector< int > &vals, const std::string &var, const int loc) const |
Put GeoVaLs for int variable var at location loc . More... | |
void | read (const eckit::Configuration &, const ioda::ObsSpace &) |
Read GeoVaLs from the file. More... | |
void | write (const eckit::Configuration &) const |
Write GeoVaLs to the file. More... | |
size_t | nlocs () const |
Return the number of geovals. More... | |
int & | toFortran () |
const int & | toFortran () const |
Static Public Member Functions | |
static const std::string | classname () |
Private Member Functions | |
void | print (std::ostream &) const |
Output GeoVaLs to a stream. More... | |
Private Attributes | |
F90goms | keyGVL_ |
oops::Variables | vars_ |
std::shared_ptr< const ioda::Distribution > | dist_ |
GeoVaLs: geophysical values at locations.
Definition at line 38 of file src/ufo/GeoVaLs.h.
ufo::GeoVaLs::GeoVaLs | ( | std::shared_ptr< const ioda::Distribution > | dist, |
const oops::Variables & | vars | ||
) |
Deprecated default constructor - does not allocate fields.
Please do not use this constructor in new code.
Definition at line 35 of file GeoVaLs.cc.
ufo::GeoVaLs::GeoVaLs | ( | const Locations & | locs, |
const oops::Variables & | vars | ||
) |
Deprecated constructor given Locations and Variables.
Please do not use in any new code. This constructor is currently only used for ObsDiagnostics and will be removed soon. Use the GeoVaLs(const Locations &, const oops::Variables &, const std::vector<size_t> &) constructor instead. This ufo::GeoVaLs constructor is used to initialize GeoVaLs for specified ufo::Locations and oops::Variables hold all. Note that nothing is allocated when this constructor is called.
Definition at line 54 of file GeoVaLs.cc.
ufo::GeoVaLs::GeoVaLs | ( | const Locations & | locs, |
const oops::Variables & | vars, | ||
const std::vector< size_t > & | nlevs | ||
) |
Allocating constructor for specified Locations locs
, Variables vars
and number of levels nlevs
.
This ufo::GeoVaLs constructor is used in all oops H(x) and DA applications. Sizes of GeoVaLs for i-th variable at a single location are defined by i-th value of nlevs
.
Definition at line 71 of file GeoVaLs.cc.
ufo::GeoVaLs::GeoVaLs | ( | const eckit::Configuration & | config, |
const ioda::ObsSpace & | obspace, | ||
const oops::Variables & | vars | ||
) |
Constructor for tests.
This ufo::GeoVaLs constructor is typically used in tests, GeoVaLs are read from the file.
Definition at line 86 of file GeoVaLs.cc.
ufo::GeoVaLs::GeoVaLs | ( | const GeoVaLs & | other, |
const int & | index | ||
) |
Construct a new GeoVaLs with just one location.
This ufo::GeoVaLs constructor takes a GeoVaLs object and an index to create a new GeoVaLs with just one location
Definition at line 103 of file GeoVaLs.cc.
ufo::GeoVaLs::GeoVaLs | ( | const GeoVaLs & | other | ) |
Copy constructor.
Definition at line 113 of file GeoVaLs.cc.
ufo::GeoVaLs::~GeoVaLs | ( | ) |
void ufo::GeoVaLs::allocate | ( | const int & | nlev, |
const oops::Variables & | vars | ||
) |
Deprecated method. Allocates GeoVaLs for vars
variables with nlev
number of levels.
Please do not use in any new code. This method is currently only used for ObsDiagnostics and will be removed soon. Rely on GeoVaLs(const Locations &, const oops::Variables &, const std::vector<size_t> &) to allocate GeoVaLs correctly. Fails if at least one of the vars
doesn't exist in GeoVaLs. Only allocates variables that haven't been allocated before. Fails if one of vars
is already allocated with number of levels different than nlev
; doesn't reallocate variables that are already allocated with nlev
.
Definition at line 128 of file GeoVaLs.cc.
|
inlinestatic |
Definition at line 41 of file src/ufo/GeoVaLs.h.
double ufo::GeoVaLs::dot_product_with | ( | const GeoVaLs & | other | ) | const |
Scalar product of two GeoVaLs.
Definition at line 229 of file GeoVaLs.cc.
void ufo::GeoVaLs::get | ( | std::vector< double > & | vals, |
const std::string & | var | ||
) | const |
Get 2D GeoVaLs for variable var
(fails for 3D GeoVaLs)
Return all values for a specific 2D variable.
Definition at line 359 of file GeoVaLs.cc.
void ufo::GeoVaLs::get | ( | std::vector< float > & | vals, |
const std::string & | var | ||
) | const |
Get 2D GeoVaLs for variable var
(fails for 3D GeoVaLs), and convert to float.
Return all values for a specific 2D variable.
Call method to get double values (Fortran data structure stores data in double) and convert to floats
Definition at line 319 of file GeoVaLs.cc.
void ufo::GeoVaLs::get | ( | std::vector< int > & | vals, |
const std::string & | var | ||
) | const |
Get 2D GeoVaLs for variable var
(fails for 3D GeoVaLs), and convert to int.
Return all values for a specific 2D variable.
Call method to get double values (Fortran data structure stores data in double) and convert to ints
Definition at line 369 of file GeoVaLs.cc.
void ufo::GeoVaLs::getAtLevel | ( | std::vector< double > & | vals, |
const std::string & | var, | ||
const int | lev | ||
) | const |
Get GeoVaLs at a specified level.
Return all values for a specific variable and level.
Definition at line 330 of file GeoVaLs.cc.
void ufo::GeoVaLs::getAtLevel | ( | std::vector< float > & | vals, |
const std::string & | var, | ||
const int | lev | ||
) | const |
Get GeoVaLs at a specified level and convert to float.
Return all values for a specific variable and level and convert to float.
Definition at line 340 of file GeoVaLs.cc.
void ufo::GeoVaLs::getAtLevel | ( | std::vector< int > & | vals, |
const std::string & | var, | ||
const int | lev | ||
) | const |
Get GeoVaLs at a specified level and convert to int.
Return all values for a specific variable and level and convert to int.
Definition at line 350 of file GeoVaLs.cc.
void ufo::GeoVaLs::getAtLocation | ( | std::vector< double > & | vals, |
const std::string & | var, | ||
const int | loc | ||
) | const |
Get GeoVaLs at a specified location.
Return all values for a specific variable and location.
Definition at line 380 of file GeoVaLs.cc.
void ufo::GeoVaLs::getAtLocation | ( | std::vector< float > & | vals, |
const std::string & | var, | ||
const int | loc | ||
) | const |
Get GeoVaLs at a specified location and convert to float.
Return all values for a specific variable and location and convert to float.
Definition at line 392 of file GeoVaLs.cc.
void ufo::GeoVaLs::getAtLocation | ( | std::vector< int > & | vals, |
const std::string & | var, | ||
const int | loc | ||
) | const |
Get GeoVaLs at a specified location and convert to int.
Return all values for a specific variable and location and convert to int.
Definition at line 403 of file GeoVaLs.cc.
|
inline |
|
inline |
Merge two GeoVaLs.
Definition at line 267 of file GeoVaLs.cc.
size_t ufo::GeoVaLs::nlevs | ( | const std::string & | var | ) | const |
Return number of levels for a specified variable.
Definition at line 310 of file GeoVaLs.cc.
size_t ufo::GeoVaLs::nlocs | ( | ) | const |
Return the number of geovals.
Definition at line 502 of file GeoVaLs.cc.
double ufo::GeoVaLs::normalizedrms | ( | const GeoVaLs & | other | ) | const |
Calculate normalized rms.
Definition at line 160 of file GeoVaLs.cc.
GeoVaLs & ufo::GeoVaLs::operator*= | ( | const double | zz | ) |
Multiply by a constant scalar.
Definition at line 177 of file GeoVaLs.cc.
Multiply another GeoVaLs.
Definition at line 221 of file GeoVaLs.cc.
GeoVaLs & ufo::GeoVaLs::operator*= | ( | const std::vector< float > & | vals | ) |
Multiply by a constant scalar for each profile.
Definition at line 185 of file GeoVaLs.cc.
Add another GeoVaLs.
Definition at line 205 of file GeoVaLs.cc.
Subtract another GeoVaLs.
Definition at line 213 of file GeoVaLs.cc.
|
private |
Output GeoVaLs to a stream.
Verbose print statement (debug mode)
\detail If the min value across all variables is positive, then this may be an error measurement. If so, compute the rms over the vertical profile and tell the user where the maximum rms value occurs, in terms of the observation number and the variable number. This is intended to help with debugging.
Definition at line 275 of file GeoVaLs.cc.
void ufo::GeoVaLs::putAtLevel | ( | const std::vector< double > & | vals, |
const std::string & | var, | ||
const int | lev | ||
) | const |
Put GeoVaLs for double variable var
at level lev
.
Put double values for a specific variable and level.
Definition at line 414 of file GeoVaLs.cc.
void ufo::GeoVaLs::putAtLevel | ( | const std::vector< float > & | vals, |
const std::string & | var, | ||
const int | lev | ||
) | const |
Put GeoVaLs for float variable var
at level lev
.
Put float values for a specific variable and level.
Definition at line 426 of file GeoVaLs.cc.
void ufo::GeoVaLs::putAtLevel | ( | const std::vector< int > & | vals, |
const std::string & | var, | ||
const int | lev | ||
) | const |
Put GeoVaLs for int variable var
at level lev
.
Put int values for a specific variable and level.
Definition at line 439 of file GeoVaLs.cc.
void ufo::GeoVaLs::putAtLocation | ( | const std::vector< double > & | vals, |
const std::string & | var, | ||
const int | loc | ||
) | const |
Put GeoVaLs for double variable var
at location loc
.
Put double values for a specific variable and location.
Definition at line 451 of file GeoVaLs.cc.
void ufo::GeoVaLs::putAtLocation | ( | const std::vector< float > & | vals, |
const std::string & | var, | ||
const int | loc | ||
) | const |
Put GeoVaLs for float variable var
at location loc
.
Put float values for a specific variable and location.
Definition at line 462 of file GeoVaLs.cc.
void ufo::GeoVaLs::putAtLocation | ( | const std::vector< int > & | vals, |
const std::string & | var, | ||
const int | loc | ||
) | const |
Put GeoVaLs for int variable var
at location loc
.
Put int values for a specific variable and location.
Definition at line 474 of file GeoVaLs.cc.
void ufo::GeoVaLs::random | ( | ) |
Randomize GeoVaLs.
Definition at line 170 of file GeoVaLs.cc.
void ufo::GeoVaLs::read | ( | const eckit::Configuration & | config, |
const ioda::ObsSpace & | obspace | ||
) |
Read GeoVaLs from the file.
Definition at line 487 of file GeoVaLs.cc.
void ufo::GeoVaLs::reorderzdir | ( | const std::string & | varname, |
const std::string & | vardir | ||
) |
Reorder GeoVaLs in vertical dimension based on vertical coordinate variable.
Definition at line 143 of file GeoVaLs.cc.
double ufo::GeoVaLs::rms | ( | ) | const |
Calculate rms.
Definition at line 151 of file GeoVaLs.cc.
Split two GeoVaLs.
Definition at line 259 of file GeoVaLs.cc.
|
inline |
Definition at line 129 of file src/ufo/GeoVaLs.h.
|
inline |
Definition at line 130 of file src/ufo/GeoVaLs.h.
void ufo::GeoVaLs::write | ( | const eckit::Configuration & | config | ) | const |
Write GeoVaLs to the file.
Definition at line 495 of file GeoVaLs.cc.
void ufo::GeoVaLs::zero | ( | ) |
Zero out the GeoVaLs.
Definition at line 136 of file GeoVaLs.cc.
|
private |
Definition at line 137 of file src/ufo/GeoVaLs.h.
|
private |
Definition at line 135 of file src/ufo/GeoVaLs.h.
|
private |
Definition at line 136 of file src/ufo/GeoVaLs.h.