8 #include "ioda/io/ObsIoGenerateUtils.h"
14 #include "oops/util/missingValues.h"
19 const std::vector<float> & lonVals,
20 const std::vector<std::string> & dtStrings,
21 const std::vector<std::string> & obsVarNames,
22 const std::vector<float> & obsErrors,
35 float missingFloat = util::missingValue(missingFloat);
36 std::string missingString(
"missing");
39 float_params.
chunk =
true;
44 float_params.
chunk =
true;
48 std::string
latName(
"MetaData/latitude");
49 std::string
lonName(
"MetaData/longitude");
50 std::string dtName(
"MetaData/datetime");
54 .write<float>(latVals)
55 .
atts.
add<std::string>(
"units", std::string(
"degrees_east"));
57 .write<float>(lonVals)
58 .
atts.
add<std::string>(
"units", std::string(
"degrees_north"));
60 .write<std::string>(dtStrings)
61 .
atts.
add<std::string>(
"units", std::string(
"ISO 8601 format"));
63 for (std::size_t i = 0; i < obsVarNames.size(); ++i) {
64 std::string varName = std::string(
"ObsError/") + obsVarNames[i];
65 std::vector<float> obsErrVals(latVals.size(), obsErrors[i]);
67 .write<float>(obsErrVals);
Describe the dimensions of a ioda::Attribute or ioda::Variable.
Interfaces for ioda::ObsGroup and related classes.
Interfaces for ioda::Variable and related classes.
An ObsGroup is a specialization of a ioda::Group. It provides convenience functions and guarantees th...
DerivedHasAtts add(const std::string &attrname, ::gsl::span< const DataType > data, const ::std::vector< Dimensions_t > &dimensions)
Create and write an Attribute, for arbitrary dimensions.
Has_Variables vars
Use this to access variables.
Variable createWithScales(const std::string &name, const std::vector< Variable > &dimension_scales, const VariableCreationParameters ¶ms=VariableCreationParameters::defaulted< DataType >())
Convenience function to create a Variable from certain dimension scales.
Has_Attributes atts
Attributes.
void storeGenData(const std::vector< float > &latVals, const std::vector< float > &lonVals, const std::vector< std::string > &dtStrings, const std::vector< std::string > &obsVarNames, const std::vector< float > &obsErrors, ObsGroup &obsGroup)
store generated data into an ObsGroup
Used to specify Variable creation-time properties.
void compressWithGZIP(int level=6)
VariableCreationParameters & setFillValue(DataType fill)
bool chunk
Do we chunk this variable? Required for extendible / compressible Variables.