MeteoIODoc  2.10.0
mio::ACDD Class Reference

Detailed Description

This class contains and handles NetCDF Attribute Conventions Dataset Discovery attributes (see ACDD).

A few attributes can get their default value automatically from the data. For the others, some "best efforts" are made in order to keep the whole process as simple as possible. It is however possible to provide some of these attributes in the INI configuration file, using the following keys (all in the [Output] section):

  • ACDD_CREATOR: the name of the creator of the data set (default: login name);
  • ACDD_CREATOR_EMAIL: the email of the creator;
  • ACDD_CREATOR_INSTITUTION: the institution of the creator; should uniquely identify the creator's institution;
  • ACDD_CREATOR_URL: the URL of the creator principally responsible for creating this data;
  • ACDD_CREATOR_TYPE: either person, group, institution, or position (default: person);
  • ACDD_INSTITUTION: the institution providing the data set (default: domain name);
  • ACDD_PUBLISHER: the name of the person / entity responsible for publishing the data file or product to users, with its current metadata and format;
  • ACDD_PUBLISHER_EMAIL: the email of the person / entity responsible for publishing the data file or product to users;
  • ACDD_PUBLISHER_URL: the url of the person / entity responsible for publishing the data file or product to users;
  • ACDD_PUBLISHER_TYPE: either person, group, institution, or position (default: person);
  • ACDD_KEYWORDS: a list of AGU Index Terms (default: hard-coded list);
  • ACDD_KEYWORDS_VOCABULARY: the unique name or identifier of the vocabulary from which keywords are taken (default: AGU);
  • ACDD_TITLE: a short title for the data set;
  • ACDD_PROJECT: the scientific project that created the data;
  • ACDD_PROGRAM: The overarching program(s) of which the dataset is a part;
  • ACDD_SOURCE: The method of production of the original data;
  • ACDD_ID: an identifier for the data set, provided by and unique within its naming authority. Example: DOI, URL, text string, but without white spaces
  • ACDD_NAMING_AUTHORITY: The organization that provides the initial id (see above) for the dataset
  • ACDD_PROCESSING_LEVEL: a textual description of the processing level
  • ACDD_SUMMARY: a paragraph describing the dataset;
  • ACDD_SUMMARY_FILE: a file containing a description of the dataset, it overwrites the value of ACDD_SUMMARY if present;
  • ACDD_COMMENT: miscellaneous informartion about the dataset;
  • ACDD_ACKNOWLEDGEMENT: acknowledgement for the various types of support for the project that produced this data;
  • ACDD_METADATA_LINK: A URL/DOI that gives more complete metadata;
  • ACDD_REFERENCES: Published or web-based references that describe the data or methods used to produce it;
  • ACDD_LICENSE: describes the license applicable to the dataset;
  • ACDD_PRODUCT_VERSION: Version identifier of the data file or product as assigned by the data creator (default: 1.0);
  • ACDD_ACTIVITY_TYPE: Activity types are used to identify the origin of the dataset. Pick one from this controlled vocabulary;
  • ACDD_OPERATIONAL_STATUS: The current operational status of the product. Choose from the controlled vocabulary;
  • WIGOS_ID: although this is not an ACDD key, it can be very useful in linking datasets together through their WIGOS ID.

This list contains all mandatory ACDD fields as listed at the Arctic Data Centre as well as most of the optional fields (please note that the geospatial and time coverage are automatically generated based on the data itself and the history is also automatically handled).

Example of ACDD configuration for a NetCDF file generated for the WMO's Global Cryosphere Watch (GCW) data portal:

[Output]
ACDD_WRITE = TRUE
ACDD_CREATOR = Mathias Bavay
ACDD_CREATOR_EMAIL = bavay@slf.ch
ACDD_CREATOR_INSTITUTION = SLF
ACDD_CREATOR_URL = https://slf.ch
ACDD_CREATOR_TYPE = person
ACDD_PUBLISHER = Mathias Bavay
ACDD_PUBLISHER_EMAIL = bavay@slf.ch
ACDD_PUBLISHER_URL = https://slf.ch
ACDD_PUBLISHER_TYPE = person
ACDD_INSTITUTION = SLF
ACDD_ID = 5LAR1_MeteoBase
ACDD_NAMING_AUTHORITY = SLF
ACDD_TITLE = Meteo station at Laret val/cal site
ACDD_SUMMARY = Meteo station at Laret val/cal site
ACDD_LICENSE = CC-BY-NC
ACDD_PROCESSING_LEVEL = raw
ACDD_ACTIVITY_TYPE = in situ land-based station
ACDD_OPERATIONAL_STATUS = scientific
@ raw
Definition: IOUtils.h:55

#include <libacdd.h>

Public Types

enum  Mode { MERGE , REPLACE , APPEND }
 

Public Member Functions

 ACDD (const bool &set_enable)
 Constructor, the argument allows the object to know if the acdd metadata should be written out or not. More...
 
void setEnabled (const bool &i_enable)
 Set an internal boolean as a helper for the caller to know if ACDD support should be enabled or not. More...
 
void setUserConfig (const mio::Config &cfg, const std::string &section, const bool &allow_multi_line=true)
 Read all config keys from the selected section and apply some special processing for some keys. More...
 
void addAttribute (const std::string &att_name, const std::string &att_value, const std::string &att_cfg_key="", Mode mode=MERGE)
 Add an attribute and its content to the internal list. More...
 
void addAttribute (const std::string &att_name, const double &att_value, const std::string &att_cfg_key="", const Mode &mode=MERGE)
 
bool isEnabled () const
 Get an internal boolean as a helper for the caller to know if ACDD support should be enabled or not. More...
 
void getAttribute (const size_t ii, std::string &att_name, std::string &att_value) const
 
size_t getNrAttributes () const
 
void setGeometry (const mio::Grid2DObject &grid, const bool &isLatLon)
 
void setGeometry (const std::vector< std::vector< mio::MeteoData > > &vecMeteo, const bool &isLatLon)
 
void setGeometry (const mio::Coords &location, const bool &isLatLon)
 
void setGeometry (const std::vector< mio::Coords > &vecLocation, const bool &isLatLon)
 
void setTimeCoverage (const std::vector< std::vector< mio::MeteoData > > &vecMeteo)
 
void setTimeCoverage (const std::vector< mio::MeteoData > &vecMeteo)
 
void setTimeCoverage (const std::vector< std::string > &vec_timestamp, const double &TZ)
 

Member Enumeration Documentation

◆ Mode

Enumerator
MERGE 
REPLACE 
APPEND 

Constructor & Destructor Documentation

◆ ACDD()

mio::ACDD::ACDD ( const bool &  set_enable)
inline

Constructor, the argument allows the object to know if the acdd metadata should be written out or not.

Parameters
[in]set_enableenable ACDD support?

Member Function Documentation

◆ addAttribute() [1/2]

void mio::ACDD::addAttribute ( const std::string &  att_name,
const double &  att_value,
const std::string &  att_cfg_key = "",
const Mode mode = MERGE 
)

◆ addAttribute() [2/2]

void mio::ACDD::addAttribute ( const std::string &  att_name,
const std::string &  att_value,
const std::string &  att_cfg_key = "",
Mode  mode = MERGE 
)

Add an attribute and its content to the internal list.

This allows to create or edit attributes. For the MERGE or APPEND modes, if the attribute name is not found, it will be created.

Parameters
[in]att_nameattribute name
[in]att_valueattribute value
[in]att_cfg_keyassociated configuration key (to read user provided values from a mio::Config object)
[in]modewrite mode: MERGE (currently empty values will be replaced by the given arguments), APPEND (the value content will be expanded by what is provided in att_value, separated by ", ", REPLACE (the current attribute will be fully replaced by the provided arguments)

◆ getAttribute()

void mio::ACDD::getAttribute ( const size_t  ii,
std::string &  att_name,
std::string &  att_value 
) const

◆ getNrAttributes()

size_t mio::ACDD::getNrAttributes ( ) const
inline

◆ isEnabled()

bool mio::ACDD::isEnabled ( ) const
inline

Get an internal boolean as a helper for the caller to know if ACDD support should be enabled or not.

Returns
enable ACDD support from the caller side?

◆ setEnabled()

void mio::ACDD::setEnabled ( const bool &  i_enable)
inline

Set an internal boolean as a helper for the caller to know if ACDD support should be enabled or not.

Parameters
[in]i_enableenable ACDD support?

◆ setGeometry() [1/4]

void mio::ACDD::setGeometry ( const mio::Coords location,
const bool &  isLatLon 
)

◆ setGeometry() [2/4]

void mio::ACDD::setGeometry ( const mio::Grid2DObject grid,
const bool &  isLatLon 
)

◆ setGeometry() [3/4]

void mio::ACDD::setGeometry ( const std::vector< mio::Coords > &  vecLocation,
const bool &  isLatLon 
)

◆ setGeometry() [4/4]

void mio::ACDD::setGeometry ( const std::vector< std::vector< mio::MeteoData > > &  vecMeteo,
const bool &  isLatLon 
)

◆ setTimeCoverage() [1/3]

void mio::ACDD::setTimeCoverage ( const std::vector< mio::MeteoData > &  vecMeteo)

◆ setTimeCoverage() [2/3]

void mio::ACDD::setTimeCoverage ( const std::vector< std::string > &  vec_timestamp,
const double &  TZ 
)

◆ setTimeCoverage() [3/3]

void mio::ACDD::setTimeCoverage ( const std::vector< std::vector< mio::MeteoData > > &  vecMeteo)

◆ setUserConfig()

void mio::ACDD::setUserConfig ( const mio::Config cfg,
const std::string &  section,
const bool &  allow_multi_line = true 
)

Read all config keys from the selected section and apply some special processing for some keys.

This is used as some sort of caching, only keeping the section of interest.

Parameters
[in]cfgConfig object to read the configuration keys from
[in]sectionsection to read the keys from (all keys from the section will be read at this point)
[in]allow_multi_lineshould multi-line content be supported?

The documentation for this class was generated from the following files: