48 VDCNetCDF(
int numthreads = 0,
size_t master_theshold = 10 * 1024 * 1024,
size_t variable_threshold = 100 * 1024 * 1024);
55 virtual int GetHyperSliceInfo(
string varname,
int level, std::vector<size_t> &dims,
size_t &nslice);
89 virtual int GetPath(
string varname,
size_t ts,
string &path,
size_t &file_ts,
size_t &max_ts)
const;
93 virtual int getDimLensAtLevel(
string varname,
int level, std::vector<size_t> &dims_at_level, vector<size_t> &bs_at_level)
const;
110 virtual int Initialize(
const vector<string> &paths,
const vector<string> &options = {}, AccessMode mode = VDC::R, vector<size_t> bs = {64, 64, 64},
size_t chunksizehint = 0);
111 virtual int Initialize(
string path,
const vector<string> &options,
AccessMode mode, vector<size_t> bs = {64, 64, 64},
size_t chunksizehint = 0)
113 std::vector<string> paths;
114 paths.push_back(path);
115 return (Initialize(paths, options, mode, bs, chunksizehint));
138 int Write(
int fd,
const float *region) {
return (_writeTemplate(fd, region)); }
139 int Write(
int fd,
const int *region) {
return (_writeTemplate(fd, region)); }
141 int WriteSlice(
int fd,
const float *slice) {
return (_writeSliceTemplate(fd, slice)); };
142 int WriteSlice(
int fd,
const int *slice) {
return (_writeSliceTemplate(fd, slice)); };
143 int WriteSlice(
int fd,
const unsigned char *slice) {
return (_writeSliceTemplate(fd, slice)); }
147 int PutVar(
string varname,
int lod,
const float *data) {
return (_putVarTemplate(varname, lod, data)); }
148 int PutVar(
string varname,
int lod,
const int *data) {
return (_putVarTemplate(varname, lod, data)); }
152 int PutVar(
size_t ts,
string varname,
int lod,
const float *data) {
return (_putVarTemplate(ts, varname, lod, data)); }
153 int PutVar(
size_t ts,
string varname,
int lod,
const int *data) {
return (_putVarTemplate(ts, varname, lod, data)); }
155 int CopyVar(
DC &dc,
string varname,
int srclod,
int dstlod);
156 int CopyVar(
DC &dc,
size_t ts,
string varname,
int srclod,
int dstlod);
160 bool CompressionInfo(std::vector<size_t> bs,
string wname,
size_t &nlevels,
size_t &maxcratio)
const;
173 #ifndef DOXYGEN_SKIP_THIS
174 virtual int _WriteMasterMeta();
175 virtual int _ReadMasterMeta();
182 int readRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
183 int readRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
double *region);
184 int readRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
int *region);
186 virtual bool variableExists(
size_t ts,
string varname,
int reflevel = 0,
int lod = 0)
const;
194 VDCFileObject(
size_t ts,
string varname,
int level,
int lod,
size_t file_ts,
WASP *wasp_data,
WASP *wasp_mask,
string varname_mask,
int level_mask,
size_t file_ts_mask,
double mv)
195 : FileObject(ts, varname, level, lod), _file_ts(file_ts), _wasp_data(wasp_data), _wasp_mask(wasp_mask), _varname_mask(varname_mask), _level_mask(level_mask), _file_ts_mask(file_ts_mask),
200 size_t GetFileTS()
const {
return (_file_ts); }
201 WASP * GetWaspData()
const {
return (_wasp_data); }
202 WASP * GetWaspMask()
const {
return (_wasp_mask); }
203 string GetVarnameMask()
const {
return (_varname_mask); }
204 int GetLevelMask()
const {
return (_level_mask); }
205 size_t GetFileTSMask()
const {
return (_file_ts_mask); }
206 double GetMissingValue()
const {
return (_mv); }
212 string _varname_mask;
214 size_t _file_ts_mask;
221 size_t _chunksizehint;
222 size_t _master_threshold;
223 size_t _variable_threshold;
226 int _WriteMasterDimensions();
227 int _WriteMasterAttributes(
string prefix,
const map<string, Attribute> &atts);
228 int _WriteMasterAttributes();
229 int _WriteMasterMeshDefs();
230 int _WriteMasterBaseVarDefs(
string prefix,
const BaseVar &var);
231 int _WriteMasterCoordVarsDefs();
232 int _WriteMasterDataVarsDefs();
234 template<
class T>
int _writeTemplate(
int fd,
const T *data);
236 template<
class T>
int _writeSliceTemplate(
int fd,
const T *slice);
238 int _ReadMasterDimensions();
239 int _ReadMasterAttributes(
string prefix, map<string, Attribute> &atts);
240 int _ReadMasterAttributes();
241 int _ReadMasterMeshDefs();
242 int _ReadMasterBaseVarDefs(
string prefix, BaseVar &var);
243 int _ReadMasterCoordVarsDefs();
244 int _ReadMasterDataVarsDefs();
246 template<
class T>
int _ReadSlice(WASP *file, T *slice);
248 int _PutAtt(WASP *ncdf,
string varname,
string tag,
const Attribute &attr);
250 int _WriteAttributes(WASP *wasp,
string varname,
const map<string, Attribute> &atts);
251 int _DefBaseVar(WASP *ncdf,
const VDC::BaseVar &var,
size_t max_ts);
252 int _DefDataVar(WASP *ncdf,
const VDC::DataVar &var,
size_t max_ts);
253 int _DefCoordVar(WASP *ncdf,
const VDC::CoordVar &var,
size_t max_ts);
255 bool _var_in_master(
const VDC::BaseVar &var)
const;
257 string _get_mask_varname(
string varname,
double &mv)
const;
259 unsigned char *_read_mask_var(WASP *wasp,
string varname,
string varname_mask, vector<size_t> start, vector<size_t> count);
261 WASP *_OpenVariableRead(
size_t ts,
string varname,
int clevel,
int lod,
size_t &file_ts);
263 int _ReadHelper(vector<size_t> &start, vector<size_t> &count)
const;
265 template<
class T>
int _putVarTemplate(
string varname,
int lod,
const T *data);
267 template<
class T>
int _putVarTemplate(
size_t ts,
string varname,
int lod,
const T *data);
269 int _copyVar0d(DC &dc,
size_t ts,
const BaseVar &varInfo);
272 int _copyVarHelper(DC &dc,
int fdr,
int fdw, vector<size_t> &buffer_dims, vector<size_t> &src_hslice_dims, vector<size_t> &dst_hslice_dims,
size_t src_nslice,
size_t dst_nslice, T *buffer);
274 template<
class T>
int _readRegionTemplate(
int fd,
const vector<size_t> &min,
const vector<size_t> &max, T *region);
A Template Method design pattern for reading a collection of data.
Implements the VDC abstract class, providing storage of VDC data in NetCDF files.
int PutVar(size_t ts, string varname, int lod, const float *data)
int CopyVar(DC &dc, string varname, int srclod, int dstlod)
int closeVariable(int fd)
virtual int Initialize(const vector< string > &paths, const vector< string > &options={}, AccessMode mode=VDC::R, vector< size_t > bs={64, 64, 64}, size_t chunksizehint=0)
int OpenVariableWrite(size_t ts, string varname, int lod=-1)
VDCNetCDF(int numthreads=0, size_t master_theshold=10 *1024 *1024, size_t variable_threshold=100 *1024 *1024)
int WriteSlice(int fd, const float *slice)
int PutVar(string varname, int lod, const float *data)
int openVariableRead(size_t ts, string varname, int level=0, int lod=-1)
int Write(int fd, const int *region)
int SetFill(int fillmode)
bool CompressionInfo(std::vector< size_t > bs, string wname, size_t &nlevels, size_t &maxcratio) const
int WriteSlice(int fd, const unsigned char *slice)
static bool DataDirExists(string path)
int readRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, double *region)
size_t GetMasterThreshold() const
int CloseVariableWrite(int fd)
virtual int Initialize(string path, const vector< string > &options, AccessMode mode, vector< size_t > bs={64, 64, 64}, size_t chunksizehint=0)
size_t GetVariableThreshold() const
int readRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, int *region)
virtual int GetHyperSliceInfo(string varname, int level, std::vector< size_t > &dims, size_t &nslice)
int PutVar(size_t ts, string varname, int lod, const int *data)
virtual int getDimLensAtLevel(string varname, int level, std::vector< size_t > &dims_at_level, vector< size_t > &bs_at_level) const
virtual bool variableExists(size_t ts, string varname, int reflevel=0, int lod=0) const
virtual int GetPath(string varname, size_t ts, string &path, size_t &file_ts, size_t &max_ts) const
int WriteSlice(int fd, const int *slice)
int PutVar(string varname, int lod, const int *data)
int CopyVar(DC &dc, size_t ts, string varname, int srclod, int dstlod)
static string GetDataDir(string path)
int Write(int fd, const float *region)
int readRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
Defines API for reading, writing, and appending data to a VAPOR Data Collection (Version 3)
Implements WASP compression conventions for NetCDF.