Parallel Analog Ensemble
Functions
Ncdf Namespace Reference

Functions

std::size_t readDimLength (const std::string &file_path, const std::string dim_name)
 
void checkExists (const std::string &file_path)
 
bool checkExists (const std::string &file_path, bool overwrite, bool append)
 
void checkExtension (const std::string &, const std::string &ext=".nc")
 
void checkIndex (size_t start, size_t count, size_t len)
 
void checkDims (const netCDF::NcGroup &nc, const std::vector< std::string > &names)
 
void checkVars (const netCDF::NcGroup &nc, const std::vector< std::string > &names)
 
void checkVarShape (const netCDF::NcGroup &nc, const std::string &var_name, const std::vector< std::string > &dim_names)
 
bool dimExists (const netCDF::NcGroup &nc, const std::string &name)
 
bool varExists (const netCDF::NcGroup &nc, const std::string &name)
 
void readStringVector (const netCDF::NcGroup &nc, std::string var_name, std::vector< std::string > &results, size_t start=0, size_t count=0, const std::string &name_char="num_chars")
 
netCDF::NcDim getDimension (netCDF::NcGroup &, const std::string &, bool unlimited=false, size_t len=0)
 
void writeStringVector (netCDF::NcGroup &, const std::string &, const std::string &, const std::vector< std::string > &, bool unlimited=false)
 
void writeArray4D (netCDF::NcGroup &, const Array4D &, const std::string &, const std::array< std::string, 4 > &, const std::array< bool, 4 > &unlimited={false, false, false, false})
 
void purge (std::string &str)
 
void purge (std::vector< std::string > &strs)
 
template<typename nctype , typename valuetype >
void writeAttribute (nctype &nc, const std::string &, const valuetype &, netCDF::NcType, bool overwrite=false)
 
template<typename nctype >
void writeStringAttribute (nctype &nc, const std::string &, const std::string &, bool overwrite=false)
 
template<typename T >
void writeVector (netCDF::NcGroup &, const std::string &, const std::string &, const std::vector< T > &, netCDF::NcType, bool unlimited=false)
 
template<typename T >
void readVector (const netCDF::NcGroup &nc, std::string var_name, std::vector< T > &results, std::vector< size_t > start={}, std::vector< size_t > count={})
 

Detailed Description

Namespace ReadNcdf provides a collection of helper functions to examine and read NetCDF files. This is not made into a class because these functions are considered "free" functions that are just wrappers over netCDF data types and functions.

Function Documentation

◆ checkDims()

void Ncdf::checkDims ( const netCDF::NcGroup &  nc,
const std::vector< std::string > &  names 
)

◆ checkExists() [1/2]

void Ncdf::checkExists ( const std::string &  file_path)

◆ checkExists() [2/2]

bool Ncdf::checkExists ( const std::string &  file_path,
bool  overwrite,
bool  append 
)

◆ checkExtension()

void Ncdf::checkExtension ( const std::string &  ,
const std::string &  ext = ".nc" 
)

◆ checkIndex()

void Ncdf::checkIndex ( size_t  start,
size_t  count,
size_t  len 
)

◆ checkVars()

void Ncdf::checkVars ( const netCDF::NcGroup &  nc,
const std::vector< std::string > &  names 
)

◆ checkVarShape()

void Ncdf::checkVarShape ( const netCDF::NcGroup &  nc,
const std::string &  var_name,
const std::vector< std::string > &  dim_names 
)

◆ dimExists()

bool Ncdf::dimExists ( const netCDF::NcGroup &  nc,
const std::string &  name 
)

◆ getDimension()

netCDF::NcDim Ncdf::getDimension ( netCDF::NcGroup &  ,
const std::string &  ,
bool  unlimited = false,
size_t  len = 0 
)

◆ purge() [1/2]

void Ncdf::purge ( std::string &  str)

◆ purge() [2/2]

void Ncdf::purge ( std::vector< std::string > &  strs)

◆ readDimLength()

std::size_t Ncdf::readDimLength ( const std::string &  file_path,
const std::string  dim_name 
)

◆ readStringVector()

void Ncdf::readStringVector ( const netCDF::NcGroup &  nc,
std::string  var_name,
std::vector< std::string > &  results,
size_t  start = 0,
size_t  count = 0,
const std::string &  name_char = "num_chars" 
)

◆ readVector()

template<typename T >
void Ncdf::readVector ( const netCDF::NcGroup &  nc,
std::string  var_name,
std::vector< T > &  results,
std::vector< size_t >  start = {},
std::vector< size_t >  count = {} 
)

◆ varExists()

bool Ncdf::varExists ( const netCDF::NcGroup &  nc,
const std::string &  name 
)

◆ writeArray4D()

void Ncdf::writeArray4D ( netCDF::NcGroup &  ,
const Array4D ,
const std::string &  ,
const std::array< std::string, 4 > &  ,
const std::array< bool, 4 > &  unlimited = {false, false, false, false} 
)

◆ writeAttribute()

template<typename nctype , typename valuetype >
void Ncdf::writeAttribute ( nctype &  nc,
const std::string &  ,
const valuetype &  ,
netCDF::NcType  ,
bool  overwrite = false 
)

◆ writeStringAttribute()

template<typename nctype >
void Ncdf::writeStringAttribute ( nctype &  nc,
const std::string &  ,
const std::string &  ,
bool  overwrite = false 
)

◆ writeStringVector()

void Ncdf::writeStringVector ( netCDF::NcGroup &  ,
const std::string &  ,
const std::string &  ,
const std::vector< std::string > &  ,
bool  unlimited = false 
)

◆ writeVector()

template<typename T >
void Ncdf::writeVector ( netCDF::NcGroup &  ,
const std::string &  ,
const std::string &  ,
const std::vector< T > &  ,
netCDF::NcType  ,
bool  unlimited = false 
)