Changing comments in header files for various functions added

This commit is contained in:
Aodhan Sweeney 2019-08-01 12:37:55 -06:00
parent 98ff20b32b
commit 7a5c5b8111
11 changed files with 43 additions and 75 deletions

View File

@ -169,17 +169,13 @@ void NcFile::sync(){
}
// Set fill mode for netCDF dataset open for writing and return current fill mode
void NcFile::set_Fill(int fillmode, int *old_modep){
cout<<"\n+++++++++++++++++++++ \n inside set_Fill() \n+++++++++++++++++++++\n";
ncCheck(nc_set_fill(myId, fillmode, old_modep),__FILE__,__LINE__);
cout<<"completed nc Check for set_Fill()";
}
// Put open netCDF dataset into define mode
void NcFile::redef(){
cout<<"\n+++++++++++++++++++++ \n inside redef() \n+++++++++++++++++++++\n";
ncCheck(nc_redef(myId),__FILE__,__LINE__);
cout<<"completed nc Check for redef()";
}
// Leave define mode, used for classic model

View File

@ -111,10 +111,10 @@ namespace netCDF
//! Synchronize an open netcdf dataset to disk
void sync();
//! Aodhan adding setFill
//! Elect a fill parameter different that the one currently being used
void set_Fill(int fillmode, int *old_modep);
//! Aodhan adding in the redef function declaration
//! Redefine variable
void redef();
//! Leave define mode, used for classic model

View File

@ -9,20 +9,20 @@
using namespace std;
using namespace netCDF;
//NcFill constructor
NcFill::~NcFill() {
};
/*
Change fill-value to improve write preformace. This member function is a wrapper
/* Change fill-value to improve write preformace. This member function is a wrapper
to the C library's nc_set_fill() function. *NOT TO BE CONFUSED WITH setFill() IN
THE ncVar FILE*. The function nc_set_fill() sets the fill
THE ncVar FILE*. The function nc_set_fill() sets the fill
mode for a netCDF dataset open for writing and returns the current fill mode in a return
parameter. The fill mode can be specified as either NC_FILL or NC_NOFILL. The default
behavior corresponding to NC_FILL is that data is pre-filled with fill values, that is
fill values are written when you create non-record variables or when you write a value
beyond data that has not yet been written.
*/
beyond data that has not yet been written. */
//NcFill constructor
NcFill::~NcFill() {
};
void NcFill::set_Fill( int ncid, int fillmode, int *old_modep ) {
ncCheck(nc_set_fill(ncid, fillmode, old_modep ),__FILE__,__LINE__);

View File

@ -6,6 +6,15 @@
#ifndef NcFillClass
#define NcFillClass
/* Change fill-value to improve write preformace. This member function is a wrapper
to the C library's nc_set_fill() function. *NOT TO BE CONFUSED WITH setFill() IN
THE ncVar FILE*. The function nc_set_fill() sets the fill
mode for a netCDF dataset open for writing and returns the current fill mode in a return
parameter. The fill mode can be specified as either NC_FILL or NC_NOFILL. The default
behavior corresponding to NC_FILL is that data is pre-filled with fill values, that is
fill values are written when you create non-record variables or when you write a value
beyond data that has not yet been written. */
namespace netCDF
{
class NcFill
@ -16,7 +25,7 @@ namespace netCDF
//constructor
NcFill();
//member functions
//member function
void set_Fill(int, int, int*);
};

View File

@ -1,6 +1,3 @@
//This will be the first test for creation of a nc_def_var_filter
//call function in the C++ library
#include <string>
#include <iostream>
#include <sstream>
@ -12,16 +9,20 @@
using namespace std;
using namespace netCDF;
// Constructor for filtering object
NcFilter::~NcFilter() {
};
// Define a new variable filter
/* Define a new variable filter for either compression or decompression. The below
method allows for setting of the filter which is to be used wen writing a variable. */
void NcFilter::setFilter(unsigned int ncid, unsigned int varid, unsigned int filterId, size_t nparams, const unsigned int* parms)
{
ncCheck(nc_def_var_filter(ncid,varid,filterId,nparams,parms),__FILE__,__LINE__);
}
/* This second API method makes it possible to query a varible to obtain information about
any associated filter using this signature */
void NcFilter::getFilter(unsigned int ncid, unsigned int varid, unsigned int* idp, size_t* nparamsp, unsigned int* params)
{
ncCheck(nc_inq_var_filter(ncid, varid, idp, nparamsp, params),__FILE__,__LINE__);

View File

@ -8,6 +8,7 @@
namespace netCDF
{
/* Definition of filter class. */
class NcFilter
{
public:
@ -16,7 +17,10 @@ namespace netCDF
//constructor
NcFilter ();
//member function
/* Member functions:
setFilter: allows for filter definition of a variable when writing
getFilter: querys about a filter (if any) associated with the variable
*/
void setFilter(unsigned int, unsigned int, unsigned int, size_t, const unsigned int*);
void getFilter(unsigned int, unsigned int, unsigned int*, size_t*, unsigned int*);
};

View File

@ -610,7 +610,6 @@ void NcVar::setCompression(bool enableShuffleFilter, bool enableDeflateFilter, i
deflateLevel),__FILE__,__LINE__);
}
// Gets the compression parameters
void NcVar::getCompressionParameters(bool& shuffleFilterEnabled, bool& deflateFilterEnabled, int& deflateLevel) const {
@ -624,31 +623,20 @@ void NcVar::getCompressionParameters(bool& shuffleFilterEnabled, bool& deflateFi
deflateFilterEnabled = static_cast<bool> (enableDeflateFilterInt);
}
////////////////////
//Aodhan adding stuff
////////////////////
// Define a new variable filter
// Define a variable filter to be used for compression (decompression)
void NcVar::setFilter( unsigned int id, size_t nparams,
const unsigned int* parms) const
{
cout<<"\n++++++++++++\n inside setFilter() \n++++++++++++\n";
cout<<"\ngoupID: "<< groupId <<"\nmyId: "<< myId <<"\nnparams: "<< nparams << "\nparms" <<parms;
ncCheck(nc_def_var_filter(groupId,myId,id,nparams,parms),__FILE__,__LINE__);
cout<< "\n setFilter filtering completed"<<endl;
}
// Find filter details (if any) associated with a variable
// Query filter details (if any) associated with a variable
void NcVar::getFilter( unsigned int* idp, size_t* nparamsp, unsigned int* params) const
{
cout<<"\n++++++++++++\n inside getFilter() \n++++++++++++\n";
cout<<"\nidp: " << idp << "\n nparamsp: " << nparamsp << "\n params: " << params;
ncCheck(nc_inq_var_filter(groupId, myId, idp, nparamsp, params),__FILE__,__LINE__);
cout<<"\n++++++++++++\n getFilter() completed \n++++++++++++\n";
}
// returns length of type
// Query the length of a given Type
void NcVar::getTypeLen(nc_type type) const
{
ncCheck(nctypelen(type),__FILE__,__LINE__);
@ -666,12 +654,6 @@ void NcVar::setChunkCache(size_t size, size_t nelems, float preemption) const
ncCheck(nc_set_var_chunk_cache(groupId, myId, size, nelems, preemption),__FILE__,__LINE__);
}
////////////////////
//End of Aodhan adding stuff
////////////////////
////////////////////
// Endianness details

View File

@ -104,31 +104,21 @@ namespace netCDF
/*! Rename the variable. */
void rename( const std::string& newname ) const;
/*! Define new variable for compression/decompression. */
void setFilter(unsigned int id, size_t nparams, const unsigned int* parms) const;
/*Aodhan Adding function for filter*/
void setFilter(unsigned int id, size_t nparams,
const unsigned int* parms) const;
/*! Query filter properties (if a filter has been applied). */
void getFilter(unsigned int* idp, size_t* nparamsp, unsigned int* params) const;
/*! Query the length of a given ncType. */
void getTypeLen(nc_type type) const;
/*! Free memory allocated for a string. */
void freeString(size_t len, char **data) const;
/*! Change cache setttings for a chunked variable. */
void setChunkCache(size_t size, size_t nelems, float preemption) const;
//void getShape(int ndims, size_t* shape) const;
//void is_recvar(size_t* nrecs);
//void inq_recvar(int* nrecdimsp, int* is_recdim) const;
//Now returning to the stuff that was here before
/*! Get the variable id. */
int getId() const;

View File

@ -57,10 +57,7 @@ NcVarAtt::NcVarAtt(const NcGroup& grp, const NcVar& ncVar, const int index):
myName = attName;
}
//Aodhan Entry
//Finds the type of an attribute.
// Query a variable attribute type
void NcVarAtt::inq_atttype(const char *name, nc_type *xtypep)
{
ncCheck(nc_inq_atttype(groupId, varId, name, xtypep),__FILE__,__LINE__);

View File

@ -20,7 +20,7 @@ namespace netCDF
/*! Constructor generates a \ref isNull "null object". */
NcVarAtt ();
/*! Query a variable attribute type. */
void inq_atttype(const char *name, nc_type *xtypep);
/*! The copy constructor. */

View File

@ -1,7 +1,6 @@
// Purpose: Converts ida3 format xma data to netcdf4
// Usage: xma2netcdf <shot number>
#include <iostream>
#include <ncFile.h>
#include <ncVar.h>
@ -43,8 +42,7 @@ int main()
// the units.
latVar.putAtt(UNITS, DEGREES_NORTH);
//latVar.putVar(lats);
//lonVar.putVar(lons);
vector<size_t> chunks;
for(int i = 0; i < NDIMS; i++) {
chunks.push_back(4);
@ -52,15 +50,6 @@ int main()
latVar.setChunking(NcVar::nc_CHUNKED,chunks);
/*cout << "Opening file...";
try {
file.open("test_ncFile_Flags_newFile.nc",NC_SHARE | NC_NOWRITE);
cout << "Success." << endl;
} catch (NcException &e) {
cout << "Caught unexpected exception." << endl;
return e.errorCode();
}*/
cout<<"Setting Filter....";
try{
latVar.setFilter(BZIP2_ID,BZIP2_NPARAMS,&level);