VAPOR3 3.9.4
|
Wrapper for a collection of netCDF files. More...
#include <NetCDFCFCollection.h>
Public Member Functions | |
NetCDFCFCollection () | |
virtual | ~NetCDFCFCollection () |
virtual int | Initialize (const std::vector< string > &files) |
virtual bool | IsCoordVarCF (string var) const |
virtual bool | IsAuxCoordVarCF (string var) const |
virtual bool | IsCoordinateVar (string varName) const |
virtual bool | IsLatCoordVar (string var) const |
virtual bool | IsLonCoordVar (string var) const |
virtual bool | IsTimeCoordVar (string var) const |
virtual bool | IsVertCoordVar (string var) const |
virtual bool | IsVertCoordVarPressure (string var) const |
virtual bool | IsVertCoordVarLength (string var) const |
virtual bool | IsVertCoordVarUp (string var) const |
virtual std::vector< string > | GetLatCoordVars () const |
virtual std::vector< string > | GetLonCoordVars () const |
virtual std::vector< string > | GetTimeCoordVars () const |
virtual std::vector< string > | GetVertCoordVars () const |
virtual std::vector< string > | GetDataVariableNames (int ndim, bool spatial) const |
virtual int | GetVarCoordVarNames (string var, std::vector< string > &cvars) const |
virtual int | GetVarUnits (string var, string &units) const |
const UDUnits * | GetUDUnits () const |
virtual int | Convert (const string from, const string to, const double *src, double *dst, size_t n) const |
virtual int | Convert (const string from, const string to, const float *src, float *dst, size_t n) const |
virtual bool | GetMissingValue (string varname, double &mv) const |
virtual int | OpenRead (size_t ts, string varname) |
virtual bool | IsVertDimensionless (string cvar) const |
bool | GetMapProjectionProj4 (string varname, string &proj4string) const |
void | FormatTimeStr (double time, string &str) const |
Public Member Functions inherited from VAPoR::NetCDFCollection | |
NetCDFCollection () | |
virtual | ~NetCDFCollection () |
virtual int | Initialize (const std::vector< string > &files, const std::vector< string > &time_dimnames, const std::vector< string > &time_coordvar) |
virtual bool | VariableExists (string varname) const |
virtual bool | VariableExists (size_t ts, string varname) const |
virtual std::vector< string > | GetVariableNames (int ndim, bool spatial) const |
virtual std::vector< size_t > | GetSpatialDims (string varname) const |
virtual std::vector< string > | GetSpatialDimNames (string varname) const |
virtual size_t | GetTimeDim (string varname) const |
virtual string | GetTimeDimName (string varname) const |
virtual std::vector< size_t > | GetDims (string varname) const |
virtual std::vector< string > | GetDimNames (string varname) const |
virtual bool | IsTimeVarying (string varname) const |
int | GetXType (string varname) const |
std::vector< string > | GetAttNames (string varname) const |
int | GetAttType (string varname, string attname) const |
void | GetAtt (string varname, string attname, std::vector< double > &values) const |
void | GetAtt (string varname, string attname, std::vector< long > &values) const |
void | GetAtt (string varname, string attname, string &values) const |
virtual std::vector< string > | GetDimNames () const |
virtual std::vector< size_t > | GetDims () const |
virtual std::vector< bool > | GetDimsAreTimeVarying () const |
long | GetDimLengthAtTime (string name, long ts) |
virtual size_t | GetNumTimeSteps () const |
virtual size_t | GetNumTimeSteps (string varname) const |
virtual int | GetTime (size_t ts, double &time) const |
virtual int | GetTimes (string varname, std::vector< double > ×) const |
virtual std::vector< double > | GetTimes () const |
virtual int | GetFile (size_t ts, string varname, string &file, size_t &local_ts) const |
virtual int | GetVariableInfo (string varname, NetCDFSimple::Variable &varinfo) const |
virtual bool | GetMissingValue (string varname, double &mv) const |
virtual int | OpenRead (size_t ts, string varname) |
virtual int | Read (size_t start[], size_t count[], double *data, int fd=0) |
virtual int | Read (size_t start[], size_t count[], float *data, int fd=0) |
virtual int | Read (size_t start[], size_t count[], int *data, int fd=0) |
virtual int | Read (size_t start[], size_t count[], char *data, int fd=0) |
virtual int | Read (std::vector< size_t > start, std::vector< size_t > count, double *data, int fd=0) |
virtual int | Read (std::vector< size_t > start, std::vector< size_t > count, float *data, int fd=0) |
virtual int | Read (std::vector< size_t > start, std::vector< size_t > count, int *data, int fd=0) |
virtual int | Read (double *data, int fd=0) |
virtual int | Read (float *data, int fd=0) |
virtual int | Read (char *data, int fd=0) |
virtual int | Read (int *data, int fd=0) |
virtual int | ReadSlice (float *data, int fd=0) |
virtual int | SeekSlice (int offset, int whence, int fd=0) |
virtual int | Close (int fd=0) |
virtual void | SetMissingValueAttName (string attname) |
virtual std::vector< string > | GetFailedVars () const |
Public Member Functions inherited from Wasp::MyBase | |
MyBase () | |
const string & | getClassName () const |
Friends | |
std::ostream & | operator<< (std::ostream &o, const NetCDFCFCollection &ncdfc) |
Additional Inherited Members | |
Public Types inherited from Wasp::MyBase | |
typedef void(* | ErrMsgCB_T) (const char *msg, int err_code) |
typedef void(* | DiagMsgCB_T) (const char *msg) |
Static Public Member Functions inherited from Wasp::MyBase | |
static void | SetErrMsg (const char *format,...) |
Record a formatted error message. | |
static void | SetErrMsg (int errcode, const char *format,...) |
Record a formatted error message and an error code. | |
static const char * | GetErrMsg () |
static void | SetErrCode (int err_code) |
Record an error code. | |
static int | GetErrCode () |
Retrieve the current error code. | |
static void | SetErrMsgCB (ErrMsgCB_T cb) |
static ErrMsgCB_T | GetErrMsgCB () |
static void | SetErrMsgFilePtr (FILE *fp) |
static const FILE * | SetErrMsgFilePtr () |
static void | SetDiagMsg (const char *format,...) |
Record a formatted diagnostic message. | |
static const char * | GetDiagMsg () |
static void | SetDiagMsgCB (DiagMsgCB_T cb) |
static DiagMsgCB_T | GetDiagMsgCB () |
static void | SetDiagMsgFilePtr (FILE *fp) |
static bool | EnableErrMsg (bool enable) |
static bool | GetEnableErrMsg () |
Static Public Attributes inherited from Wasp::MyBase | |
static char * | ErrMsg |
static int | ErrCode |
static int | ErrMsgSize |
static FILE * | ErrMsgFilePtr |
static ErrMsgCB_T | ErrMsgCB |
static char * | DiagMsg |
static int | DiagMsgSize |
static FILE * | DiagMsgFilePtr |
static DiagMsgCB_T | DiagMsgCB |
static bool | Enabled |
Protected Member Functions inherited from VAPoR::NetCDFCollection | |
bool | _GetVariableInfo (string varname, NetCDFSimple::Variable &variable) const |
Protected Member Functions inherited from Wasp::MyBase | |
void | SetClassName (const string &name) |
Wrapper for a collection of netCDF files.
This class provides access to CF-1 compliant collection of netCDF files. This work is based on the "NetCDF Climate and Forecast (CF) Metadata Conventions", version 1.6, 5, December 2011.
Definition at line 34 of file NetCDFCFCollection.h.
VAPoR::NetCDFCFCollection::NetCDFCFCollection | ( | ) |
|
virtual |
|
virtual |
Convert an array of floating point values from one unit to another
This method uses the UDUnits class to convert an array of floating point values from one unit measure to another as supported by Unidata's udunits2 library. See @param from A string containing the unit to convert from (e.g. "meters") @param to A string containing the unit to convert to (e.g. "feet") @param src An array of input values to be converted @param dst An output buffer large enough to contained the converted data @param n The number of elements in src
@retval status a non-negative int is returned on success
|
virtual |
void VAPoR::NetCDFCFCollection::FormatTimeStr | ( | double | time, |
string & | str | ||
) | const |
|
virtual |
Return a list of data variables with a given rank
Returns a list of data variables having a dimension rank of ndim
. If spatial
is true only the data variable's spatial dimension rank is examined. Thus if spatial
is true, and the named variable is explicitly time varying, the time-varying dimension is not counted. For example, if a variable named 'v' is defined with 4 dimensions in the netCDF file, and the slowest varying dimension name matches a named dimension specified in Initialize() by time_dimnames
, then the variable 'v' would be returned by a query with ndim==3 and spatial==true.
Names of variables that are coordinate or auxiliary coordinate variables are not returned, nor are variables that are missing coordinate variables.
[in] | ndim | Rank of spatial dimensions |
[in] | spatial | Only compare spatial dimensions against ndim |
|
inlinevirtual |
Return a vector of all latitude coordinate variables
Definition at line 170 of file NetCDFCFCollection.h.
|
inlinevirtual |
Return a vector of all longitude coordinate variables
Definition at line 174 of file NetCDFCFCollection.h.
bool VAPoR::NetCDFCFCollection::GetMapProjectionProj4 | ( | string | varname, |
string & | proj4string | ||
) | const |
Get a map projection as a proj4 string
If a variable has a map projection generate a proj4 transformation string for converting from geographic to Cartographic coordinates. Returns false if no proj4 string could be generated: either no map projection exists, or one exists but is not supported.
|
virtual |
Return the missing value, if any, for a variable
This method returns the value of the missing data value marker, if defined, for the variable named by varname
.
Missing data values are indicated using the _FillValue
, or missing_value
attributes as defined in section 2.5.1 of the CF 1.6 spec.
[in] | varname | The variable name |
[out] | mv | The missing value for the variabled name by varname |
bool | The boolean true is returned if a missing value is defined. If no missing variable is defined the return value is false and the value of mv is not defined. |
Reimplemented from VAPoR::NetCDFCollection.
|
inlinevirtual |
Return a vector of all time coordinate variables
Definition at line 178 of file NetCDFCFCollection.h.
|
inline |
Return a pointer to the internal UDUnits object used to perform unit conversion.
Definition at line 262 of file NetCDFCFCollection.h.
|
virtual |
Return ordered list of coordinate or auxliary coordinate variables for the named variable.
This method returns in cvars
an ordered list of all of the spatio-temporal coordinate or auxliary coordinate variables associated with the variable named by var
. See Chapter 5 of the CF 1.X spec. for more detail, summarized here:
CF1.X Chap. 5 excerpt :
"The use of coordinate variables is required whenever they are applicable. That is, auxiliary coordinate variables may not be used as the only way to identify latitude and longitude coordinates that could be identified using coordinate variables. This is both to enhance conformance to COARDS and to facilitate the use of generic applications that recognize the NUG convention for coordinate variables. An application that is trying to find the latitude coordinate of a variable should always look first to see if any of the variable's dimensions correspond to a latitude coordinate variable. If the latitude coordinate is not found this way, then the auxiliary coordinate variables listed by the coordinates attribute should be checked. Note that it is permissible, but optional, to list coordinate variables as well as auxiliary coordinate variables in the coordinates attribute."
[in] | varname | A variable name |
[out] | cvars | A ordered vector of coordinate variable names |
status | a negative int is returned if the number of elements in cvars does not match the number of spatio-temporal dimensions of the variable named by var |
|
virtual |
Return the value of the 'units' attribute for the named variable
This method fetches the value of the 'units' attribute, if present, for the variable named by var
. If a units attribute is not present then units
will contain an empty string.
[in] | varname | A variable name |
[out] | units | The value of the variable's 'units' attribute. If the 'units' attribute is not present the parameter will contain the empty string. |
status | a non-negative int is returned on success |
|
inlinevirtual |
Return a vector of all vertical coordinate variables
Definition at line 182 of file NetCDFCFCollection.h.
|
virtual |
|
inlinevirtual |
Return boolean indicating whether the named variable is a CF auxiliary coordinate variable
This method returns true if the variable named by var
is a "auxiliary coordinate variable"
CF1.X Definition of auxiliary coordinate variable :
Any netCDF variable that contains coordinate data, but is not a coordinate variable (in the sense of that term defined by the NUG and used by this standard - see below). Unlike coordinate variables, there is no relationship between the name of an auxiliary coordinate variable and the name(s) of its dimension(s).
true | if var is an auxliary coordinate variable, false otherwise |
Definition at line 73 of file NetCDFCFCollection.h.
|
inlinevirtual |
Return boolean indicating whether the named variable is a NetCDF CF "coordinate" variable or a "auxilliary" coordinate variable.
Definition at line 82 of file NetCDFCFCollection.h.
|
inlinevirtual |
Return boolean indicating whether variable is a CF "coordinate" variable
This method returns true if the variable named by var
is a "coordinate" variable as defined by the CF specification. I.e. the variable has a single spatial dimension whose name matches var
name; the variable can be identified as a vertical, lat, lon, or time coordinate variable; or the variable is listed by some other variable's "coordinate" metadata attribute.
true | if var is a coordinate variable, false otherwise |
Definition at line 55 of file NetCDFCFCollection.h.
|
inlinevirtual |
Return boolean indicating whether the named variable represents latitude.
This method returns true if the variable named by var
is a latitude coordinate variable. See section 4.1 of the CF spec.
true | if var is latitude coordinate variable, false otherwise |
Definition at line 94 of file NetCDFCFCollection.h.
|
inlinevirtual |
Return boolean indicating whether the named variable represents longitude.
This method returns true if the variable named by var
is a longitude coordinate variable. See section 4.2 of the CF spec.
true | if var is longitude coordinate variable, false otherwise |
Definition at line 104 of file NetCDFCFCollection.h.
|
inlinevirtual |
Return boolean indicating whether the named variable represents time.
This method returns true if the variable named by var
is a time coordinate variable. See section 4.4 of the CF spec.
true | if var is a time coordinate variable, false otherwise |
Definition at line 114 of file NetCDFCFCollection.h.
|
inlinevirtual |
Return boolean indicating whether the named variable represents a vertical coordinate.
This method returns true if the variable named by var
is a dimesional or dimensionless vertical coordinate variable. See section 4.3 of the CF spec.
true | if var is a time coordinate variable, false otherwise |
Definition at line 125 of file NetCDFCFCollection.h.
|
virtual |
Return boolean indicating whether the named variable represents a vertical length coordinate.
This method returns true if the variable named by var
is a vertical coordinate variable with units of length (e.g. meters) See section 4.3 of the CF spec.
true | if var is a vertical length coordinate variable, false otherwise |
|
virtual |
Return boolean indicating whether the named variable represents a vertical pressure coordinate.
This method returns true if the variable named by var
is a vertical coordinate variable with units of pressure. See section 4.3 of the CF spec.
true | if var is a vertical pressure coordinate variable, false otherwise |
|
virtual |
Return true if the increasing direction of the named vertical coordinate variable is up
CF 1.x description of vertical coordinate direction:
The direction of positive (i.e., the direction in which the coordinate values are increasing), whether up or down, cannot in all cases be inferred from the units. The direction of positive is useful for applications displaying the data. For this reason the attribute positive as defined in the COARDS standard is required if the vertical axis units are not a valid unit of pressure (a determination which can be made using the udunits routine, utScan) – otherwise its inclusion is optional. The positive attribute may have the value up or down (case insensitive).
|
virtual |
Return true if the named variable is a dimensionless vertical coordinate variable.
This method returns true if the variable named by cvar
is both a vertical coordinate variable and it is dimensionless. See section 4.3.2 of the CF 1.6 spec.
|
virtual |
Open the named variable for reading
This method prepares a netCDF variable, indicated by a variable name and time step pair, for subsequent read operations by methods of this class. A small, non-negative integer for use in subsequent read operations is returned. The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently open for the process, starting with zero.
[in] | ts | Time step of the variable to read |
[in] | varname | Name of the variable to read |
status | Returns a non-negative file descriptor on success |
Reimplemented from VAPoR::NetCDFCollection.
|
friend |