Extension: Json and NetCDF utilities
#include "dg/file/file.h" (includes both Json and NetCDF utilities)
dg::file Namespace Reference

Namespace for netCDF output related classes and functions following the CF-conventions and netCDF conventions More...

Classes

struct  NC_Error
 Class thrown by the NC_Error_Handle. More...
 
struct  NC_Error_Handle
 Empty utitlity class that handles return values of netcdf functions and throws NC_Error(status) if( status != NC_NOERR) More...
 
struct  WrappedJsonValue
 Wrapped Access to Json values with error handling. More...
 

Enumerations

enum class  error { error::is_throw , error::is_warning , error::is_silent }
 Switch between how to handle errors in a Json utitlity functions. More...
 
enum class  comments { comments::are_kept , comments::are_discarded , comments::are_forbidden }
 Switch how comments are treated in a json string or file. More...
 

Functions

template<class host_vector >
void put_var_double (int ncid, int varid, const dg::aTopology2d &grid, const host_vector &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
template<class host_vector >
void put_vara_double (int ncid, int varid, unsigned slice, const dg::aTopology2d &grid, const host_vector &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
template<class host_vector >
void put_var_double (int ncid, int varid, const dg::aTopology3d &grid, const host_vector &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
template<class host_vector >
void put_vara_double (int ncid, int varid, unsigned slice, const dg::aTopology3d &grid, const host_vector &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
template<class host_vector >
void put_var_double (int ncid, int varid, const dg::aMPITopology2d &grid, const dg::MPI_Vector< host_vector > &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
template<class host_vector >
void put_vara_double (int ncid, int varid, unsigned slice, const dg::aMPITopology2d &grid, const dg::MPI_Vector< host_vector > &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
template<class host_vector >
void put_var_double (int ncid, int varid, const dg::aMPITopology3d &grid, const dg::MPI_Vector< host_vector > &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
template<class host_vector >
void put_vara_double (int ncid, int varid, unsigned slice, const dg::aMPITopology3d &grid, const dg::MPI_Vector< host_vector > &data, bool parallel=false)
 Convenience wrapper around nc_put_vara_double() More...
 
static void file2Json (std::string filename, Json::Value &js, enum comments comm=file::comments::are_discarded, enum error err=file::error::is_throw)
 Convenience wrapper to open a file and parse it into a Json::Value. More...
 
static void string2Json (std::string input, Json::Value &js, enum comments comm=file::comments::are_discarded, enum error err=file::error::is_throw)
 Convenience wrapper to parse a string into a Json::Value. More...
 
template<class T >
int define_real_time (int ncid, const char *name, int *dimID, int *tvarID)
 Define an unlimited time dimension and coordinate variable. More...
 
static int define_time (int ncid, const char *name, int *dimID, int *tvarID)
 Define an unlimited time dimension and coordinate variable. More...
 
static int define_limited_time (int ncid, const char *name, int size, int *dimID, int *tvarID)
 Define a limited time dimension and coordinate variable. More...
 
template<class T >
int define_dimension (int ncid, int *dimID, const dg::RealGrid1d< T > &g, std::string name_dim="x", std::string axis="X")
 Define a 1d dimension and associated coordinate variable. More...
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, int *tvarID, const dg::RealGrid1d< T > &g, std::array< std::string, 2 > name_dims={"time","x"})
 Define an unlimited time and a dimension together with their coordinate variables. More...
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, const dg::aRealTopology2d< T > &g, std::array< std::string, 2 > name_dims={"y", "x"})
 Define 2 dimensions and associated coordiante variables. More...
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, int *tvarID, const dg::aRealTopology2d< T > &g, std::array< std::string, 3 > name_dims={"time", "y", "x"})
 Define an unlimited time and 2 dimensions and associated coordinate variables. More...
 
template<class T >
int define_limtime_xy (int ncid, int *dimsIDs, int size, int *tvarID, const dg::aRealTopology2d< T > &g, std::array< std::string, 3 > name_dims={"time", "y", "x"})
 Define a limited time and 2 dimensions and associated coordinate variables. More...
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, const dg::aRealTopology3d< T > &g, std::array< std::string, 3 > name_dims={"z", "y", "x"})
 Define 3 dimensions and associated coordinate variables. More...
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, int *tvarID, const dg::aRealTopology3d< T > &g, std::array< std::string, 4 > name_dims={"time", "z", "y", "x"})
 Define an unlimited time and 3 dimensions together with their coordinate varariables. More...
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, const dg::aRealMPITopology2d< T > &g, std::array< std::string, 2 > name_dims={"y", "x"})
 Only master process should call this!! Convenience function that just calls the corresponding serial version with the global grid.
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, int *tvarID, const dg::aRealMPITopology2d< T > &g, std::array< std::string, 3 > name_dims={"time", "y", "x"})
 Only master process should call this!! Convenience function that just calls the corresponding serial version with the global grid.
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, const dg::aRealMPITopology3d< T > &g, std::array< std::string, 3 > name_dims={"z", "y", "x"})
 Only master process should call this!! Convenience function that just calls the corresponding serial version with the global grid.
 
template<class T >
int define_dimensions (int ncid, int *dimsIDs, int *tvarID, const dg::aRealMPITopology3d< T > &g, std::array< std::string, 4 > name_dims={"time", "z", "y", "x"})
 Only master process should call this!! Convenience function that just calls the corresponding serial version with the global grid.
 

Detailed Description

Namespace for netCDF output related classes and functions following the CF-conventions and netCDF conventions

See also
JsonCPP utilities and NetCDF utilities