6 #include <vapor/NetCDFCollection.h>
7 #include <vapor/Proj4API.h>
8 #include <vapor/UDUnitsClass.h>
53 virtual int Initialize(
const vector <string> &paths);
57 virtual bool GetDimension(
63 virtual std::vector <string> GetDimensionNames()
const;
67 virtual bool GetCoordVarInfo(
string varname,
DC::CoordVar &cvar)
const;
71 virtual bool GetDataVarInfo(
string varname,
DC::DataVar &datavar)
const;
75 virtual bool GetBaseVarInfo(
string varname,
DC::BaseVar &var)
const;
80 virtual std::vector <string> GetDataVarNames()
const;
85 virtual std::vector <string> GetCoordVarNames()
const;
94 virtual int GetMapProjection(
95 string lonname,
string latname,
string &projstring
102 string varname,
string attname, vector <double> &values
105 string varname,
string attname, vector <long> &values
108 string varname,
string attname,
string &values
113 virtual std::vector <string> GetAttNames(
string varname)
const;
117 virtual XType GetAttType(
string varname,
string attname)
const;
121 virtual int GetDimLensAtLevel(
122 string varname,
int level, std::vector <size_t> &dims_at_level,
123 std::vector <size_t> &bs_at_level
130 size_t ts,
string varname,
int ,
int
135 virtual int OpenVariableRead(
136 size_t ts,
string varname
142 virtual int CloseVariable();
146 int virtual Read(
float *data);
150 virtual int ReadSlice(
float *slice);
154 virtual int ReadRegion(
155 const vector <size_t> &min,
const vector <size_t> &max,
float *region
160 virtual int ReadRegionBlock(
161 const vector <size_t> &min,
const vector <size_t> &max,
float *region
166 virtual int GetVar(
string varname,
int,
int,
float *data) {
169 virtual int GetVar(
string varname,
float *data);
174 size_t ts,
string varname,
int,
int,
float *data
180 size_t ts,
string varname,
float *data
186 virtual bool VariableExists(
194 NetCDFCollection *_ncdfc;
195 VAPoR::UDUnits _udunits;
216 class DerivedVarHorizontal;
217 DerivedVarHorizontal *_derivedX;
218 DerivedVarHorizontal *_derivedY;
219 DerivedVarHorizontal *_derivedXU;
220 DerivedVarHorizontal *_derivedYU;
221 DerivedVarHorizontal *_derivedXV;
222 DerivedVarHorizontal *_derivedYV;
224 class DerivedVarElevation;
225 DerivedVarElevation *_derivedElev;
226 DerivedVarElevation *_derivedElevU;
227 DerivedVarElevation *_derivedElevV;
228 DerivedVarElevation *_derivedElevW;
230 class DerivedVarTime;
231 DerivedVarTime *_derivedTime;
233 std::map <string, DC::Dimension> _dimsMap;
234 std::map <string, DC::CoordVar> _coordVarsMap;
235 std::map <string, DC::DataVar> _dataVarsMap;
236 std::vector <size_t> _timeLookup;
239 vector <size_t> _GetSpatialDims(
240 NetCDFCollection *ncdfc,
string varname
243 vector <string> _GetSpatialDimNames(
244 NetCDFCollection *ncdfc,
string varname
247 int _InitAtts(NetCDFCollection *ncdfc);
250 NetCDFCollection *ncdfc,
float radius,
int map_proj,
string &projstring
253 int _InitProjection(NetCDFCollection *ncdfc,
float radius);
255 int _InitHorizontalCoordinates(NetCDFCollection *ncdfc, Proj4API *proj4API);
257 int _InitVerticalCoordinates(NetCDFCollection *ncdfc);
259 int _InitTime(NetCDFCollection *ncdfc);
261 int _InitDimensions(NetCDFCollection *ncdfc);
264 NetCDFCollection *ncdfc,
265 string varname, vector <string> &cvarnames
268 bool _GetVarCoordinates(
269 NetCDFCollection *ncdfc,
string varname,
270 vector <DC::Dimension> &dimensions,
271 vector <string> &coordvars
274 int _InitVars(NetCDFCollection *ncdfc);
288 class DerivedVarElevation :
public VAPoR::NetCDFCollection::DerivedVar {
291 NetCDFCollection *ncdfc,
string name,
292 const vector <DC::Dimension> &dims,
float grav
294 virtual ~DerivedVarElevation();
296 virtual int Open(
size_t ts);
297 virtual int ReadSlice(
float *slice,
int );
298 virtual int Read(
float *buf,
int );
299 virtual int SeekSlice(
int offset,
int whence,
int );
300 virtual int Close(
int fd);
301 virtual bool TimeVarying()
const {
return(
true); };
302 virtual std::vector <size_t> GetSpatialDims()
const {
return(_sdims); }
303 virtual std::vector <string> GetSpatialDimNames()
const {
return(_sdimnames);}
304 virtual size_t GetTimeDim()
const {
return(_time_dim); }
305 virtual string GetTimeDimName()
const {
return(_time_dim_name); }
306 virtual bool GetMissingValue(
double &mv)
const {
return(
false); }
311 string _time_dim_name;
312 std::vector <size_t> _sdims;
313 std::vector <string> _sdimnames;
327 std::vector <size_t>_ph_dims;
330 int _ReadSlice(
float *slice);
339 class DerivedVarHorizontal :
public NetCDFCollection::DerivedVar {
341 DerivedVarHorizontal(
342 NetCDFCollection *ncdfc,
string name,
const vector <DC::Dimension> &dims,
343 const vector <size_t> latlondims, Proj4API *proj4API
345 virtual ~DerivedVarHorizontal();
347 virtual int Open(
size_t ts);
348 virtual int ReadSlice(
float *slice,
int );
349 virtual int Read(
float *buf,
int );
350 virtual int SeekSlice(
int offset,
int whence,
int );
351 virtual int Close(
int fd);
352 virtual bool TimeVarying()
const {
return(
true); };
353 virtual std::vector <size_t> GetSpatialDims()
const {
return(_sdims); }
354 virtual std::vector <string> GetSpatialDimNames()
const {
return(_sdimnames);}
355 virtual size_t GetTimeDim()
const {
return(_time_dim); }
356 virtual string GetTimeDimName()
const {
return(_time_dim_name); }
357 virtual bool GetMissingValue(
double &mv)
const {
return(
false); }
361 string _time_dim_name;
362 std::vector <size_t> _sdims;
363 std::vector <string> _sdimnames;
378 int _GetCartCoords(
size_t ts);
385 class DerivedVarTime :
public NetCDFCollection::DerivedVar {
388 NetCDFCollection *ncdfc, DC::Dimension dims,
389 const std::vector <float> &timecoords
391 virtual ~DerivedVarTime() {}
393 virtual int Open(
size_t ts);
394 virtual int ReadSlice(
float *slice,
int );
395 virtual int Read(
float *buf,
int );
396 virtual int SeekSlice(
int offset,
int whence,
int );
397 virtual int Close(
int fd);
398 virtual bool TimeVarying()
const {
return(
true); };
399 virtual std::vector <size_t> GetSpatialDims()
const {
return(_sdims); }
400 virtual std::vector <string> GetSpatialDimNames()
const {
return(_sdimnames);}
401 virtual size_t GetTimeDim()
const {
return(_timecoords.size()); }
402 virtual string GetTimeDimName()
const {
return(_time_dim_name); }
403 virtual bool GetMissingValue(
double &mv)
const {
return(
false); }
405 string _time_dim_name;
406 std::vector <size_t> _sdims;
407 std::vector <string> _sdimnames;
408 vector <float> _timecoords;
Base class for storing variable metadata.
virtual int OpenVariableRead(size_t ts, string varname, int, int)
Coordinate variable metadata.
Class for reading a WRF data set stored as a series of NetCDF files.
virtual int GetVar(string varname, int, int, float *data)
Metadata describing a coordinate dimension.
virtual int GetNumRefLevels(string varname) const
virtual int GetVar(size_t ts, string varname, int, int, float *data)
Defines API for reading a collection of data.