6 #include <vapor/Compressor.h>
7 #include <vapor/EasyThreads.h>
8 #include <vapor/utils.h>
112 WASP(
int nthreads = 0);
136 string path,
int cmode,
size_t initialsz,
137 size_t &bufrsizehintp,
int numfiles
147 virtual int Open(
string path,
int mode);
151 virtual int SetFill(
int fillmode,
int &old_modep);
155 virtual int EndDef()
const;
190 virtual int InqVarDimlens(
191 string name,
int level, vector <size_t> &dims, vector <size_t> &bs
196 virtual int InqVarDims(
197 string name, vector <string> &dimnames, vector <size_t> &dims
214 virtual int InqVarCompressionParams(
215 string name,
string &wname, vector <size_t> &bs, vector <size_t> &cratios
243 static int InqDimsAtLevel(
244 string wname,
int level, vector <size_t> dims, vector <size_t> bs,
245 vector <size_t> &dims_at_level, vector <size_t> &bs_at_level
262 virtual int InqVarNumRefLevels(
string name)
const;
284 static bool InqCompressionInfo(
285 vector <size_t> bs,
string wname,
size_t &nlevels,
size_t &maxcratio
322 string name,
int xtype, vector <string> dimnames,
323 string wname, vector <size_t> bs, vector <size_t> cratios
341 string name,
int xtype, vector <string> dimnames,
342 string wname, vector <size_t> bs, vector <size_t> cratios,
349 string name,
int xtype, vector <string> dimnames
356 int DefDim(
string name,
size_t len)
const;
365 virtual int InqVarCompressed(
366 string varname,
bool &compressed
376 string varname,
bool &wasp
401 virtual int OpenVarWrite(
string name,
int lod);
425 virtual int OpenVarRead(
string name,
int level,
int lod);
435 virtual int CloseVar();
461 vector <size_t> start, vector <size_t> count,
const float *data
463 virtual int PutVar(
const float *data);
466 vector <size_t> start, vector <size_t> count,
const double *data
468 virtual int PutVar(
const double *data);
471 vector <size_t> start, vector <size_t> count,
const int *data
473 virtual int PutVar(
const int *data);
476 vector <size_t> start, vector <size_t> count,
const unsigned char *data
478 virtual int PutVar(
const unsigned char *data);
497 vector <size_t> start, vector <size_t> count,
const float *data,
498 const unsigned char *mask
500 virtual int PutVar(
const float *data,
const unsigned char *mask);
503 vector <size_t> start, vector <size_t> count,
const double *data,
504 const unsigned char *mask
506 virtual int PutVar(
const double *data,
const unsigned char *mask);
509 vector <size_t> start, vector <size_t> count,
const int *data,
510 const unsigned char *mask
512 virtual int PutVar(
const int *data,
const unsigned char *mask);
515 vector <size_t> start, vector <size_t> count,
const unsigned char *data,
516 const unsigned char *mask
518 virtual int PutVar(
const unsigned char *data,
const unsigned char *mask);
545 vector <size_t> start, vector <size_t> count,
float *data
548 vector <size_t> start, vector <size_t> count,
double *data
551 vector <size_t> start, vector <size_t> count,
int *data
555 vector <size_t> start, vector <size_t> count,
unsigned char *data
578 virtual int GetVaraBlock(
579 vector <size_t> start, vector <size_t> count,
float *data
581 virtual int GetVaraBlock(
582 vector <size_t> start, vector <size_t> count,
double *data
584 virtual int GetVaraBlock(
585 vector <size_t> start, vector <size_t> count,
int *data
587 virtual int GetVaraBlock(
588 vector <size_t> start, vector <size_t> count,
unsigned char *data
609 virtual int GetVar(
float *data);
610 virtual int GetVar(
double *data);
611 virtual int GetVar(
int *data);
612 virtual int GetVar(
unsigned char *data);
625 static std::vector <string>
GetPaths(
string path,
int numfiles) {
627 return(mkmultipaths(path, numfiles));
630 std::vector <string> t(1,path);
return(t);
662 VetsUtil::EasyThreads *_et;
664 vector <NetCDFCpp> _ncdfcs;
665 vector <NetCDFCpp *> _ncdfcptrs;
670 VetsUtil::SmartBuf _blockbuf;
671 VetsUtil::SmartBuf _coeffbuf;
672 VetsUtil::SmartBuf _sigbuf;
676 vector <size_t> _open_bs;
677 vector <size_t> _open_cratios;
678 vector <size_t> _open_udims;
679 vector <size_t> _open_dims;
684 string _open_varname;
685 nc_type _open_varxtype;
686 vector <Compressor *> _open_compressors;
689 int _GetBlockAlignedDims(
690 vector <string> dimnames,
692 vector <string> &badimnames,
693 vector <size_t> &badims
696 int _GetCompressedDims(
697 vector <string> dimnames,
700 vector <size_t> cratios,
702 vector <string> &cdimnames,
703 vector <size_t> &cdims,
704 vector <string> &encoded_dim_names,
705 vector <size_t> &encoded_dims
708 int _InqDimlen(
string name,
size_t &len)
const;
710 void _get_encoding_vectors(
711 string wname, vector <size_t> bs, vector <size_t> cratios,
int xtype,
712 vector <size_t> &ncoeffs, vector <size_t> &encoded_dims
716 bool _validate_compression_params(
717 string wname, vector <size_t> dims,
718 vector <size_t> bs, vector <size_t> cratios
721 bool _validate_put_vara_compressed(
722 vector <size_t> start, vector <size_t> count,
723 vector <size_t> bs, vector <size_t> udims, vector <size_t> cratios
726 bool _validate_get_vara_compressed(
727 vector <size_t> start, vector <size_t> count,
728 vector <size_t> bs, vector <size_t> udims, vector <size_t> cratios,
732 int _get_compression_params(
733 string name, vector <size_t> &bs, vector <size_t> &cratios,
734 vector <size_t> &udims, vector <size_t> &dims,
string &wname
737 template <
class T,
class U>
739 vector <size_t> start, vector <size_t> count,
bool unblock, T *data,
745 vector <size_t> start, vector <size_t> count,
bool unblock_flag, T *data
748 static void _dims_at_level(
749 vector <size_t> dims, vector <size_t> bs,
int level,
750 string wname, vector <size_t> &dims_level, vector <size_t> &bs_level
753 static vector <string> mkmultipaths(
string path,
int n);
756 template <
class T,
class U>
758 vector <size_t> start, vector <size_t> count,
const T *data,
759 const unsigned char *mask, U dummy
764 vector <size_t> start, vector <size_t> count,
const T *data,
765 const unsigned char *mask
static string AttNameCRatios()
NetCDF attribute name specifying compression ratios.
virtual int DefVar(string name, int xtype, vector< string > dimnames)
Define a variable.
Implements WASP compression conventions for NetCDF.
static string AttNameWavelet()
NetCDF attribute name specifying Wavelet name.
static string AttNameBlockSize()
NetCDF attribute name specifying compression block dimensions.
virtual int DefVar(string name, int xtype, vector< string > dimnames)
Define a variable.
static std::vector< string > GetPaths(string path, int numfiles)
Defines simple C++ wrapper for NetCDF.
static string AttNameVersion()
NetCDF attribute name specifying WASP version number.
static string AttNameWASP()
static string AttNameNumFiles()
NetCDF attribute name specifying number of compression files.
static string AttNameDimNames()
NetCDF attribute name specifying names of uncompressed dimensions.
static string AttNameMissingValue()
NetCDF attribute name specifying if missing data values are present.