5#ifndef _NetCDFCollection_h_
6#define _NetCDFCollection_h_
124 virtual int Initialize(
const std::vector<string> &files,
const std::vector<string> &time_dimnames,
const std::vector<string> &time_coordvar);
249 virtual std::vector<size_t>
GetDims(
string varname)
const;
327 void GetAtt(
string varname,
string attname, std::vector<double> &values)
const;
328 void GetAtt(
string varname,
string attname, std::vector<long> &values)
const;
329 void GetAtt(
string varname,
string attname,
string &values)
const;
344 virtual std::vector<string>
GetDimNames()
const {
return (_dimNames); };
359 virtual std::vector<size_t>
GetDims()
const {
return (_dimLens); };
393 virtual size_t GetNumTimeSteps(
string varname)
const {
return (NetCDFCollection::GetTimeDim(varname)); }
410 virtual int GetTime(
size_t ts,
double &time)
const;
423 virtual int GetTimes(
string varname, std::vector<double> ×)
const;
435 virtual std::vector<double>
GetTimes()
const {
return (_times); };
450 virtual int GetFile(
size_t ts,
string varname,
string &file,
size_t &local_ts)
const;
520 virtual int Read(
size_t start[],
size_t count[],
double *data,
int fd = 0);
521 virtual int Read(
size_t start[],
size_t count[],
float *data,
int fd = 0);
522 virtual int Read(
size_t start[],
size_t count[],
int *data,
int fd = 0);
523 virtual int Read(
size_t start[],
size_t count[],
char *data,
int fd = 0);
524 virtual int Read(std::vector<size_t> start, std::vector<size_t> count,
double *data,
int fd = 0);
525 virtual int Read(std::vector<size_t> start, std::vector<size_t> count,
float *data,
int fd = 0);
526 virtual int Read(std::vector<size_t> start, std::vector<size_t> count,
int *data,
int fd = 0);
528 virtual int Read(
double *data,
int fd = 0);
529 virtual int Read(
float *data,
int fd = 0);
530 virtual int Read(
char *data,
int fd = 0);
531 virtual int Read(
int *data,
int fd = 0);
573 virtual int SeekSlice(
int offset,
int whence,
int fd = 0);
599 virtual std::vector<string>
GetFailedVars()
const {
return (_failedVars); };
634 std::vector<string> _files;
635 std::vector<tvmap_t> _tvmaps;
636 std::vector<size_t> _spatial_dims;
637 std::vector<string> _spatial_dim_names;
648 std::map<string, TimeVaryingVar> _variableList;
649 std::map<string, NetCDFSimple *> _ncdfmap;
650 std::vector<string> _dimNames;
651 std::vector<size_t> _dimLens;
652 std::vector<bool> _dimIsTimeVarying;
653 string _missingValAttName;
654 std::map<string, vector<double>> _timesMap;
655 std::vector<double> _times;
656 std::vector<string> _failedVars;
669 unsigned char *_slicebuf;
671 unsigned char *_linebuf;
675 double _missing_value;
680 std::map<int, NetCDFCollection::fileHandle> _ovr_table;
684 int _InitializeTimesMap(
const std::vector<string> &files,
const std::vector<string> &time_dimnames,
const std::vector<string> &time_coordvars, std::map<
string, std::vector<double>> ×Map,
685 std::map<string, size_t> &timeDimLens, std::vector<double> ×,
int &file_org)
const;
687 int _InitializeTimesMapCase1(
const std::vector<string> &files, std::map<
string, std::vector<double>> ×Map, std::map<string, size_t> &timeDimLens)
const;
689 int _InitializeTimesMapCase2(
const std::vector<string> &files,
const std::vector<string> &time_dimnames, std::map<
string, std::vector<double>> ×Map,
690 std::map<string, size_t> &timeDimLens)
const;
692 int _InitializeTimesMapCase3(
const std::vector<string> &files,
const std::vector<string> &time_dimnames,
const std::vector<string> &time_coordvars, std::map<
string, std::vector<double>> ×Map,
693 map<string, size_t> &timeDimLens)
const;
695 int _GetTimesMap(
NetCDFSimple *netcdf,
const std::vector<string> &time_coordvars,
const std::vector<string> &time_dimnames, std::map<
string, std::vector<double>> ×map)
const;
699 int _get_var_index(
const vector<NetCDFSimple::Variable> variables,
string varname)
const;
701 template<
typename T>
int _read_template(T *data,
int fd);
702 template<
typename T>
int _read_template(
size_t start[],
size_t count[], T *data,
int fd);
703 template<
typename T>
int _read_slice_template(T *data,
int fd);
std::vector< string > GetSpatialDimNames() const
std::vector< double > GetTimes() const
int GetFile(size_t ts, string &file) const
int Insert(const NetCDFSimple *netcdf, const NetCDFSimple::Variable &variable, string file, const std::vector< string > &time_dimnames, const std::map< string, std::vector< double > > ×map, int file_org)
bool GetTimeVarying() const
friend std::ostream & operator<<(std::ostream &o, const TimeVaryingVar &var)
void GetVariableInfo(NetCDFSimple::Variable &variable) const
int GetTimeStep(double time, size_t &ts) const
bool GetMissingValue(string attname, double &mv) const
int GetTime(size_t ts, double &time) const
size_t GetLocalTimeStep(size_t ts) const
size_t GetNumTimeSteps() const
std::vector< size_t > GetSpatialDims() const
string GetTimeDimName() const
Wrapper for a collection of netCDF files.
virtual int Read(size_t start[], size_t count[], float *data, int fd=0)
virtual int ReadSlice(float *data, int fd=0)
int GetXType(string varname) const
virtual string GetTimeDimName(string varname) const
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, double *data, int fd=0)
virtual bool GetMissingValue(string varname, double &mv) const
virtual size_t GetNumTimeSteps(string varname) const
virtual int GetVariableInfo(string varname, NetCDFSimple::Variable &varinfo) const
virtual std::vector< string > GetSpatialDimNames(string varname) const
virtual std::vector< size_t > GetDims(string varname) const
virtual bool IsTimeVarying(string varname) const
std::vector< string > GetAttNames(string varname) const
virtual bool VariableExists(string varname) const
virtual int Read(size_t start[], size_t count[], int *data, int fd=0)
virtual int Read(char *data, int fd=0)
void GetAtt(string varname, string attname, std::vector< long > &values) const
virtual std::vector< string > GetVariableNames(int ndim, bool spatial) const
void GetAtt(string varname, string attname, string &values) const
virtual int GetTime(size_t ts, double &time) const
virtual std::vector< double > GetTimes() const
void GetAtt(string varname, string attname, std::vector< double > &values) const
virtual size_t GetNumTimeSteps() const
virtual int Read(int *data, int fd=0)
long GetDimLengthAtTime(string name, long ts)
friend std::ostream & operator<<(std::ostream &o, const NetCDFCollection &ncdfc)
virtual int SeekSlice(int offset, int whence, int fd=0)
virtual std::vector< string > GetDimNames(string varname) const
virtual int Read(size_t start[], size_t count[], char *data, int fd=0)
virtual int Read(double *data, int fd=0)
virtual int GetFile(size_t ts, string varname, string &file, size_t &local_ts) const
virtual int OpenRead(size_t ts, string varname)
virtual bool VariableExists(size_t ts, string varname) const
virtual std::vector< size_t > GetDims() const
bool _GetVariableInfo(string varname, NetCDFSimple::Variable &variable) const
virtual int Close(int fd=0)
virtual std::vector< string > GetDimNames() const
virtual int Read(size_t start[], size_t count[], double *data, int fd=0)
virtual void SetMissingValueAttName(string attname)
virtual int Initialize(const std::vector< string > &files, const std::vector< string > &time_dimnames, const std::vector< string > &time_coordvar)
int GetAttType(string varname, string attname) const
virtual size_t GetTimeDim(string varname) const
virtual ~NetCDFCollection()
virtual int Read(std::vector< size_t > start, std::vector< size_t > count, int *data, int fd=0)
virtual int GetTimes(string varname, std::vector< double > ×) const
virtual std::vector< string > GetFailedVars() const
virtual std::vector< size_t > GetSpatialDims(string varname) const
virtual std::vector< bool > GetDimsAreTimeVarying() const
virtual int Read(float *data, int fd=0)
NetCDFSimple API interface.
NetCDFSimple API interface.