IODA
|
Observation Data. More...
#include <ObsData.h>
Classes | |
struct | TreeTrait |
Public Types | |
typedef std::map< std::size_t, std::vector< std::size_t > > | RecIdxMap |
typedef RecIdxMap::const_iterator | RecIdxIter |
typedef eckit::KDTreeMemory< TreeTrait > | KDTree |
Public Member Functions | |
ObsData (const eckit::Configuration &, const eckit::mpi::Comm &, const util::DateTime &, const util::DateTime &, const eckit::mpi::Comm &) | |
ObsData (const ObsData &) | |
~ObsData () | |
std::size_t | gnlocs () const |
std::size_t | nlocs () const |
std::size_t | nrecs () const |
std::size_t | nvars () const |
const std::vector< std::size_t > & | recnum () const |
const std::vector< std::size_t > & | index () const |
bool | has (const std::string &, const std::string &) const |
ObsDtype | dtype (const std::string &, const std::string &) const |
std::string | obs_group_var () const |
std::string | obs_sort_var () const |
std::string | obs_sort_order () const |
void | get_db (const std::string &group, const std::string &name, std::vector< int > &vdata) const |
transfer data from the obs container to vdata More... | |
void | get_db (const std::string &group, const std::string &name, std::vector< float > &vdata) const |
void | get_db (const std::string &group, const std::string &name, std::vector< double > &vdata) const |
void | get_db (const std::string &group, const std::string &name, std::vector< std::string > &vdata) const |
void | get_db (const std::string &group, const std::string &name, std::vector< util::DateTime > &vdata) const |
void | put_db (const std::string &group, const std::string &name, const std::vector< int > &vdata) |
transfer data from vdata to the obs container More... | |
void | put_db (const std::string &group, const std::string &name, const std::vector< float > &vdata) |
void | put_db (const std::string &group, const std::string &name, const std::vector< double > &vdata) |
void | put_db (const std::string &group, const std::string &name, const std::vector< std::string > &vdata) |
void | put_db (const std::string &group, const std::string &name, const std::vector< util::DateTime > &vdata) |
KDTree & | getKDTree () |
const RecIdxIter | recidx_begin () const |
const RecIdxIter | recidx_end () const |
bool | recidx_has (const std::size_t RecNum) const |
std::size_t | recidx_recnum (const RecIdxIter &Irec) const |
const std::vector< std::size_t > & | recidx_vector (const RecIdxIter &Irec) const |
const std::vector< std::size_t > & | recidx_vector (const std::size_t RecNum) const |
std::vector< std::size_t > | recidx_all_recnums () const |
const std::string & | obsname () const |
const eckit::Configuration & | getConfig () const |
const util::DateTime & | windowStart () const |
const util::DateTime & | windowEnd () const |
const eckit::mpi::Comm & | comm () const |
void | printJo (const ObsVector &, const ObsVector &) |
const oops::Variables & | obsvariables () const |
const std::shared_ptr< Distribution > | distribution () const |
Private Member Functions | |
void | print (std::ostream &) const |
ObsData & | operator= (const ObsData &) |
void | generateDistribution (const eckit::Configuration &) |
void | genDistRandom (const eckit::Configuration &conf, std::vector< float > &Lats, std::vector< float > &Lons, std::vector< util::DateTime > &Dtimes) |
void | genDistList (const eckit::Configuration &conf, std::vector< float > &Lats, std::vector< float > &Lons, std::vector< util::DateTime > &Dtimes) |
void | InitFromFile (const std::string &filename, const std::size_t MaxFrameSize) |
std::vector< std::size_t > | GenFrameIndexRecNums (const std::unique_ptr< IodaIO > &FileIO, const std::size_t FrameStart, const std::size_t FrameSize) |
bool | InsideTimingWindow (const util::DateTime &ObsDt) |
void | BuildSortedObsGroups () |
void | createKDTree () |
template<typename VarType > | |
std::vector< VarType > | ApplyIndex (const std::vector< VarType > &FullData, const std::vector< std::size_t > &FullShape, const std::vector< std::size_t > &Index, std::vector< std::size_t > &IndexedShape) const |
void | SaveToFile (const std::string &file_name, const std::size_t MaxFrameSize) |
Static Private Member Functions | |
static std::string | DesiredVarType (std::string &GroupName, std::string &FileVarType) |
Private Attributes | |
std::string | obsname_ |
name of obs space More... | |
const eckit::LocalConfiguration | config_ |
Configuration file. More... | |
const util::DateTime | winbgn_ |
Beginning of DA timing window. More... | |
const util::DateTime | winend_ |
End of DA timing window. More... | |
const eckit::mpi::Comm & | commMPI_ |
MPI communicator. More... | |
std::shared_ptr< KDTree > | kd_ |
KD Tree. More... | |
std::size_t | gnlocs_ |
total number of locations More... | |
std::size_t | nlocs_ |
number of locations on this domain More... | |
std::size_t | nvars_ |
number of variables More... | |
std::size_t | nrecs_ |
number of records More... | |
bool | file_unexpected_dtypes_ |
flag, file has variables with unexpected data types More... | |
bool | file_excess_dims_ |
flag, file has variables with excess dimensions More... | |
std::string | filein_ |
path to input file More... | |
std::string | fileout_ |
path to output file More... | |
std::size_t | in_max_frame_size_ |
max frame size for input file More... | |
std::size_t | out_max_frame_size_ |
max frame size for output file More... | |
std::vector< std::size_t > | indx_ |
indexes of locations to extract from the input obs file More... | |
std::vector< std::size_t > | recnums_ |
record numbers associated with the location indexes More... | |
RecIdxMap | recidx_ |
profile ordering More... | |
ObsSpaceContainer< int > | int_database_ |
Multi-index containers. More... | |
ObsSpaceContainer< float > | float_database_ |
ObsSpaceContainer< std::string > | string_database_ |
ObsSpaceContainer< util::DateTime > | datetime_database_ |
oops::Variables | obsvars_ |
Observation "variables" to be simulated. More... | |
std::string | distname_ |
Distribution type. More... | |
std::string | obs_group_variable_ |
Variable that location grouping is based upon. More... | |
std::string | obs_sort_variable_ |
Variable that location group sorting is based upon. More... | |
std::string | obs_sort_order_ |
Sort order for obs grouping. More... | |
std::shared_ptr< Distribution > | dist_ |
MPI distribution object. More... | |
ObsGroupingMap< int > | int_obs_grouping_ |
maps for obs grouping via integer, float or string values More... | |
ObsGroupingMap< float > | float_obs_grouping_ |
ObsGroupingMap< std::string > | string_obs_grouping_ |
std::size_t | next_rec_num_ |
next available record number More... | |
std::set< std::size_t > | unique_rec_nums_ |
unique record numbers More... | |
Observation Data.
Observation data class for IODA
This class handles the memory store of observation data. It handles the transfer of data between memory and files, the distribution of obs data across multiple process elements, the filtering out of obs data that is outside the DA timing window, the transfer of data between UFO, OOPS and IODA, and data type conversion that is "missing value aware".
During the DA run, all data transfers are done in memory. The only time file I/O is invoked is during the constructor (read from the file into the obs container) and optionally during the the destructor (write from obs container into the file).
typedef eckit::KDTreeMemory<TreeTrait> ioda::ObsData::KDTree |
typedef RecIdxMap::const_iterator ioda::ObsData::RecIdxIter |
typedef std::map<std::size_t, std::vector<std::size_t> > ioda::ObsData::RecIdxMap |
ioda::ObsData::ObsData | ( | const eckit::Configuration & | config, |
const eckit::mpi::Comm & | comm, | ||
const util::DateTime & | bgn, | ||
const util::DateTime & | end, | ||
const eckit::mpi::Comm & | timeComm | ||
) |
Config based constructor for an ObsData object. This constructor will read in from the obs file and transfer the variables into the obs container. Obs falling outside the DA timing window, specified by bgn and end, will be discarded before storing them in the obs container.
[in] | config | ECKIT configuration segment holding obs types specs |
[in] | bgn | DateTime object holding the start of the DA timing window |
[in] | end | DateTime object holding the end of the DA timing window |
Definition at line 51 of file ObsData.cc.
ioda::ObsData::~ObsData | ( | ) |
Destructor for an ObsData object. This destructor will clean up the ObsData object and optionally write out the contents of the obs container into the output file. The save-to-file operation is invoked when an output obs file is specified in the ECKIT configuration segment associated with the ObsData object.
Definition at line 167 of file ObsData.cc.
|
private |
This method applys the distribution index on data read from the input obs file. It is expected that when this method is called that the distribution index will have the process element and DA timing window effects accounted for.
[in] | FullData | Vector holding data to be indexed |
[in] | FullShape | Shape (dimension sizes) of FullData |
[in] | Index | Index to be applied to FullData |
[out] | IndexedShape | Shape (dimension sizes) of data after indexing |
Definition at line 1155 of file ObsData.cc.
|
private |
This method will construct a data structure that holds the location order within each group sorted by the values of the specified sort variable.
Definition at line 948 of file ObsData.cc.
|
inline |
|
private |
This method creates a private KDTree class member that can be used for searching for local obs to create an ObsSpace.
Definition at line 1209 of file ObsData.cc.
|
staticprivate |
This method will return the desired numeric data type for variables read from the input obs file. The rule for now is any variable in the group "PreQC" is to be an integer, and any variable that is a double is to be a float (single precision). For cases outside of this rule, the data type from the file is used.
[in] | GroupName | Name of obs container group |
[in] | FileVarType | Name of the data type of the variable from the input obs file |
Definition at line 1180 of file ObsData.cc.
|
inline |
ObsDtype ioda::ObsData::dtype | ( | const std::string & | group, |
const std::string & | name | ||
) | const |
This method returns the data type of the variable stored in the obs container.
Definition at line 289 of file ObsData.cc.
|
private |
This method will generate a set of latitudes and longitudes of which can be used for testing without reading in an obs file. The values are simply read from lists in the configuration file. The purpose of this method is to allow the user to exactly specify obs locations.
[in] | conf | ECKIT configuration segment built from an input configuration file. |
[out] | Lats | Generated latitude values |
[out] | Lons | Generated longitude values |
[out] | Dtims | Generated datetime values |
Definition at line 628 of file ObsData.cc.
|
private |
This method will generate a set of latitudes and longitudes of which can be used for testing without reading in an obs file. Two latitude values, two longitude values, the number of locations (nobs keyword) and an optional random seed are specified in the configuration given by the conf parameter. Random locations between the two latitudes and two longitudes are generated and stored in the obs container as meta data. Random time stamps that fall inside the given timing window (which is specified in the configuration file) are alos generated and stored in the obs container as meta data.
[in] | conf | ECKIT configuration segment built from an input configuration file. |
[out] | Lats | Generated latitude values |
[out] | Lons | Generated longitude values |
[out] | Dtims | Generated datetime values |
Definition at line 531 of file ObsData.cc.
|
private |
This method will generate a set of latitudes, longitudes and datetimes which can be used for testing without reading in an obs file. Two methods are supported, the first generating random values between specified latitudes, longitudes and a timing window, and the second copying lists specified by the user. This method is triggered using the "Generate" keyword in the configuration file and either of the two methods above are specified using the sub keywords "Random" or "List".
[in] | conf | ECKIT configuration segment built from an input configuration file. |
Definition at line 482 of file ObsData.cc.
|
private |
This method generates an list of indices with their corresponding record numbers, where the indices denote which locations are to be read into this process element.
[in] | FileIO | File id (pointer to IodaIO object) |
[in] | FrameStart | Row number at beginning of frame. |
[out] | FrameIndex | Vector of indices indicating rows belonging to this process element |
[out] | FrameRecNums | Vector containing record numbers corresponding to FrameIndex |
Definition at line 799 of file ObsData.cc.
void ioda::ObsData::get_db | ( | const std::string & | group, |
const std::string & | name, | ||
std::vector< double > & | vdata | ||
) | const |
void ioda::ObsData::get_db | ( | const std::string & | group, |
const std::string & | name, | ||
std::vector< float > & | vdata | ||
) | const |
void ioda::ObsData::get_db | ( | const std::string & | group, |
const std::string & | name, | ||
std::vector< int > & | vdata | ||
) | const |
transfer data from the obs container to vdata
The following four get_db methods are the same except for the data type of the data being transferred (integer, float, double, DateTime). The caller needs to allocate the memory that the vdata parameter points to.
[in] | group | Name of container group (ObsValue, ObsError, MetaData, etc.) |
[in] | name | Name of container variable |
[out] | vdata | Vector where container data is being transferred to |
Definition at line 191 of file ObsData.cc.
void ioda::ObsData::get_db | ( | const std::string & | group, |
const std::string & | name, | ||
std::vector< std::string > & | vdata | ||
) | const |
void ioda::ObsData::get_db | ( | const std::string & | group, |
const std::string & | name, | ||
std::vector< util::DateTime > & | vdata | ||
) | const |
Definition at line 218 of file ObsData.cc.
|
inline |
ObsData::KDTree & ioda::ObsData::getKDTree | ( | ) |
This method returns the KDTree class member that can be used for searching for local obs when creating an ObsSpace.
Definition at line 1241 of file ObsData.cc.
std::size_t ioda::ObsData::gnlocs | ( | ) | const |
This method returns the number of unique locations in the input obs file. Note that nlocs from the obs container may be smaller than nlocs from the input obs file due to the removal of obs outside the DA timing window and/or due to distribution of obs across multiple process elements.
Definition at line 339 of file ObsData.cc.
bool ioda::ObsData::has | ( | const std::string & | group, |
const std::string & | name | ||
) | const |
This method checks for the existence of the group, name combination in the obs container. If the combination exists, "true" is returned, otherwise "false" is returned.
Definition at line 278 of file ObsData.cc.
const std::vector< std::size_t > & ioda::ObsData::index | ( | ) | const |
This method returns a reference to the index vector data member. This is for read only access.
Definition at line 389 of file ObsData.cc.
|
private |
This method will initialize the obs container from the input obs file. All the variables from the input file will be read in and loaded into the obs container. Obs that fall outside the DA timing window will be filtered out before loading into the container. This method will also apply obs distribution across multiple process elements. For these reasons, the number of locations in the obs container may be smaller than the number of locations in the input obs file.
[in] | filename | Path to input obs file |
Definition at line 679 of file ObsData.cc.
|
private |
This method will return true/false according to whether the observation datetime (ObsDt) is inside the DA timing window.
[in] | ObsDt | Observation date time object |
Definition at line 938 of file ObsData.cc.
std::size_t ioda::ObsData::nlocs | ( | ) | const |
This method returns the number of unique locations in the obs container. Note that nlocs from the obs container may be smaller than nlocs from the input obs file due to the removal of obs outside the DA timing window and/or due to distribution of obs across multiple process elements.
Definition at line 351 of file ObsData.cc.
std::size_t ioda::ObsData::nrecs | ( | ) | const |
This method returns the number of unique records in the obs container. A record is an atomic unit of locations that belong together such as a single radiosonde sounding.
Definition at line 361 of file ObsData.cc.
std::size_t ioda::ObsData::nvars | ( | ) | const |
This method returns the number of unique variables in the obs container. "Variables" refers to the quantities that can be assimilated as opposed to meta data.
Definition at line 371 of file ObsData.cc.
std::string ioda::ObsData::obs_group_var | ( | ) | const |
This method returns the setting of the YAML configuration parameter: obsdatain.obsgrouping.group variable
Definition at line 309 of file ObsData.cc.
std::string ioda::ObsData::obs_sort_order | ( | ) | const |
This method returns the setting of the YAML configuration parameter: obsdatain.obsgrouping.sort order
Definition at line 327 of file ObsData.cc.
std::string ioda::ObsData::obs_sort_var | ( | ) | const |
This method returns the setting of the YAML configuration parameter: obsdatain.obsgrouping.sort variable
Definition at line 318 of file ObsData.cc.
|
inline |
|
inline |
|
private |
This method provides a way to print an ObsData object in an output stream. It simply prints a dummy message for now.
Definition at line 663 of file ObsData.cc.
This method provides a means for printing Jo in an output stream. For now a dummy message is printed.
Definition at line 1201 of file ObsData.cc.
void ioda::ObsData::put_db | ( | const std::string & | group, |
const std::string & | name, | ||
const std::vector< double > & | vdata | ||
) |
void ioda::ObsData::put_db | ( | const std::string & | group, |
const std::string & | name, | ||
const std::vector< float > & | vdata | ||
) |
void ioda::ObsData::put_db | ( | const std::string & | group, |
const std::string & | name, | ||
const std::vector< int > & | vdata | ||
) |
transfer data from vdata to the obs container
The following four put_db methods are the same except for the data type of the data being transferred (integer, float, double, DateTime). The caller needs to allocate and assign the memory that the vdata parameter points to.
[in] | group | Name of container group (ObsValue, ObsError, MetaData, etc.) |
[in] | name | Name of container variable |
[out] | vdata | Vector where container data is being transferred from |
Definition at line 238 of file ObsData.cc.
void ioda::ObsData::put_db | ( | const std::string & | group, |
const std::string & | name, | ||
const std::vector< std::string > & | vdata | ||
) |
void ioda::ObsData::put_db | ( | const std::string & | group, |
const std::string & | name, | ||
const std::vector< util::DateTime > & | vdata | ||
) |
Definition at line 265 of file ObsData.cc.
std::vector< std::size_t > ioda::ObsData::recidx_all_recnums | ( | ) | const |
This method returns the all of the record numbers from the recidx_ data member (ie, all the key values) in a vector.
Definition at line 460 of file ObsData.cc.
const ObsData::RecIdxIter ioda::ObsData::recidx_begin | ( | ) | const |
This method returns the begin iterator associated with the recidx_ data member.
Definition at line 398 of file ObsData.cc.
const ObsData::RecIdxIter ioda::ObsData::recidx_end | ( | ) | const |
This method returns the end iterator associated with the recidx_ data member.
Definition at line 407 of file ObsData.cc.
bool ioda::ObsData::recidx_has | ( | const std::size_t | RecNum | ) | const |
This method returns a boolean value indicating whether the given record number exists in the recidx_ data member.
Definition at line 416 of file ObsData.cc.
std::size_t ioda::ObsData::recidx_recnum | ( | const RecIdxIter & | Irec | ) | const |
This method returns the current record number, pointed to by the given iterator, from the recidx_ data member.
Definition at line 426 of file ObsData.cc.
const std::vector< std::size_t > & ioda::ObsData::recidx_vector | ( | const RecIdxIter & | Irec | ) | const |
This method returns the current vector, pointed to by the given iterator, from the recidx_ data member.
Definition at line 435 of file ObsData.cc.
const std::vector< std::size_t > & ioda::ObsData::recidx_vector | ( | const std::size_t | RecNum | ) | const |
This method returns the current vector, pointed to by the given iterator, from the recidx_ data member.
Definition at line 444 of file ObsData.cc.
const std::vector< std::size_t > & ioda::ObsData::recnum | ( | ) | const |
This method returns a reference to the record number vector data member. This is for read only access.
Definition at line 380 of file ObsData.cc.
|
private |
This method will save the contents of the obs container into the given file. Currently, all variables in the obs container are written into the file. This may change in the future where we can select which variables we want saved.
[in] | file_name | Path to output obs file. |
Definition at line 1004 of file ObsData.cc.
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
Distribution type.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |