2
0
mirror of https://github.com/Unidata/netcdf-c.git synced 2025-03-19 17:30:27 +08:00

removed fortran and cxx

This commit is contained in:
Ed Hartnett 2011-08-15 11:13:48 +00:00
parent 24e5b0618b
commit 922ed6a303
300 changed files with 0 additions and 60158 deletions

@ -1,72 +0,0 @@
## This is a automake file, part of Unidata's netCDF package.
# Copyright 2005, see the COPYRIGHT file for more information.
# This file builds the C++ interface.
include $(top_srcdir)/lib_flags.am
# nctst creates a simple data file in each format, then uses ncdump to
# create CDL files, which are compared with some reference files
# shipped with the code. tst_failure is a program that is intended to
# fail.
TESTFILES = nctst$(EXEEXT) tst_failure$(EXEEXT)
tst_many_writes_SOURCES = tst_many_writes.cpp
nctst_SOURCES = nctst.cpp
tst_failure_SOURCES = tst_failure.cpp
XFAIL_TESTS = tst_failure$(EXEEXT)
if USE_NETCDF4
if BUILD_BENCHMARKS
# This is for valgrind script.
TESTS_ENVIRONMENT=USE_NETCDF4=1
# This is a netCDF-4 test.
TESTFILES += tst_many_writes$(EXEEXT)
#tst_many_writes_SOURCES = tst_many_writes.cpp
endif # BUILD_BENCHMARKS
endif # USE_NETCDF4
# Build and run these tests.
check_PROGRAMS = $(TESTFILES)
TESTS = $(TESTFILES)
# This will run a bunch of the test programs with valgrind, the memory
# checking tool. (Valgrind must be present for this to work.)
if USE_VALGRIND_TESTS
TESTS += run_valgrind_tests.sh
endif # USE_VALGRIND_TESTS
# If the utilities have been built, run these extra tests.
if !BUILD_DLL
if BUILD_UTILITIES
TESTS += run_nc_tests.sh
endif
endif
AM_CPPFLAGS += -I${top_srcdir}/liblib
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
LDADD = $(top_builddir)/cxx/libnetcdf_c++.la ${AM_LDFLAGS}
# These headers will be installed in the users header directory.
include_HEADERS = netcdfcpp.h ncvalues.h netcdf.hh
# This is our output library.
lib_LTLIBRARIES = libnetcdf_c++.la
libnetcdf_c___la_SOURCES = netcdf.cpp ncvalues.cpp
libnetcdf_c___la_LDFLAGS = -version-number 4:1:0
libnetcdf_c___la_CPPFLAGS = ${AM_CPPFLAGS}
libnetcdf_c___la_LIBADD = $(top_builddir)/liblib/libnetcdf.la
# If we are building the dll (under MinGW) then set the correct flags.
if BUILD_DLL
libnetcdf_c___la_CPPFLAGS += -DDLL_EXPORT
libnetcdf_c___la_LDFLAGS += -no-undefined \
-Wl,--output-def,netcdf_c++dll.def
endif
CLEANFILES = nctst_classic.nc nctst_64bit_offset.nc nctst_netcdf4.nc \
nctst_netcdf4_classic.nc nctst_classic.cdl nctst_64bit_offset.cdl \
tst_*.nc
EXTRA_DIST = ref_nctst.cdl ref_nctst_64bit_offset.cdl \
ref_nctst_netcdf4.cdl ref_nctst_netcdf4_classic.cdl run_nc_tests.sh \
run_nc4_tests.sh run_valgrind_tests.sh

@ -1,28 +0,0 @@
netcdfcpp.h the C++ interface
netcdf.cpp the implementation of the interface, on top of the current
C library interface
nctst.cpp a test program for the interface that creates a netCDF file
and then dumps out its contents in ASCII form to stdout.
This example may also be helpful in understanding how the
interface is intended to be used.
example.c example of C code needed to create a small netCDF file
example.cpp analogous example of C++ code needed to do the same thing
Makefile makefile for building nctst
ncvalues.cpp interface for auxilliary classes of typed arrays needed by
netCDF interface; fairly simple
ncvalues.cpp implementation of auxilliary classes of typed arrays needed by
netCDF interface
README this file

@ -1,4 +0,0 @@
example.o: ../libsrc/netcdf.h
example.o: ../libsrc/netcdf.h
example.o: example.c
example.o: example.c

@ -1,147 +0,0 @@
#include "netcdf.h"
int
main() { /* create example.nc, uses old netCDF-2 interface */
int ncid; /* netCDF id */
/* dimension ids */
int lat_dim, lon_dim, frtime_dim, timelen_dim;
/* variable ids */
int P_id, lat_id, lon_id, frtime_id, reftime_id, scalarv_id;
/* variable shapes */
int dims[3];
/* containers for scalar attributes */
float float_val;
double double_val;
/* attribute vectors */
float P_valid_range[2];
/* enter define mode */
ncid = nccreate("example.nc", NC_CLOBBER);
/* define dimensions */
lat_dim = ncdimdef(ncid, "lat", 4L);
lon_dim = ncdimdef(ncid, "lon", 3L);
frtime_dim = ncdimdef(ncid, "frtime", NC_UNLIMITED);
timelen_dim = ncdimdef(ncid, "timelen", 20L);
/* define variables and assign attributes */
dims[0] = frtime_dim;
dims[1] = lat_dim;
dims[2] = lon_dim;
P_id = ncvardef (ncid, "P", NC_FLOAT, 3, dims);
ncattput (ncid, P_id, "long_name", NC_CHAR, 24,
(void *)"pressure at maximum wind");
ncattput (ncid, P_id, "units", NC_CHAR, 12,
(void *)"hectopascals");
P_valid_range[0] = 0;
P_valid_range[1] = 1500;
ncattput (ncid, P_id, "valid_range", NC_FLOAT, 2,
(void *) P_valid_range);
float_val = -9999;
ncattput (ncid, P_id, "_FillValue", NC_FLOAT, 1,
(void *) &float_val);
dims[0] = lat_dim;
lat_id = ncvardef (ncid, "lat", NC_FLOAT, 1, dims);
ncattput (ncid, lat_id, "long_name", NC_CHAR, 8,
(void *)"latitude");
ncattput (ncid, lat_id, "units", NC_CHAR, 13,
(void *)"degrees_north");
dims[0] = lon_dim;
lon_id = ncvardef (ncid, "lon", NC_FLOAT, 1, dims);
ncattput (ncid, lon_id, "long_name", NC_CHAR, 9,
(void *)"longitude");
ncattput (ncid, lon_id, "units", NC_CHAR, 12,
(void *)"degrees_east");
dims[0] = frtime_dim;
frtime_id = ncvardef (ncid, "frtime", NC_INT, 1, dims);
ncattput (ncid, frtime_id, "long_name", NC_CHAR, 13,
(void *)"forecast time");
ncattput (ncid, frtime_id, "units", NC_CHAR, 5,
(void *)"hours");
dims[0] = timelen_dim;
reftime_id = ncvardef (ncid, "reftime", NC_CHAR, 1, dims);
ncattput (ncid, reftime_id, "long_name", NC_CHAR, 14,
(void *)"reference time");
ncattput (ncid, reftime_id, "units", NC_CHAR, 9,
(void *)"text_time");
scalarv_id = ncvardef (ncid, "scalarv", NC_INT, 0, 0);
double_val = 1;
ncattput (ncid, scalarv_id, "scalar_att", NC_DOUBLE, 1,
(void *) &double_val);
/* Global attributes */
ncattput (ncid, NC_GLOBAL, "history", NC_CHAR, 41,
(void *)"created by Unidata LDM from NPS broadcast");
ncattput (ncid, NC_GLOBAL, "title", NC_CHAR, 48,
(void *)"NMC Global Product Set: Pressure at Maximum Wind");
/* leave define mode */
ncendef (ncid);
{ /* store lat */
static long lat_start[] = {0};
static long lat_edges[] = {4};
static float lat[] = {-90, -87.5, -85, -82.5};
ncvarput(ncid, lat_id, lat_start, lat_edges, (void *)lat);
}
{ /* store lon */
static long lon_start[] = {0};
static long lon_edges[] = {3};
static float lon[] = {-180, -175, -170};
ncvarput(ncid, lon_id, lon_start, lon_edges, (void *)lon);
}
{ /* store frtime */
static long frtime_start[] = {0};
static long frtime_edges[] = {1};
static long frtime[] = {12};
ncvarput(ncid, frtime_id, frtime_start, frtime_edges,
(void *)frtime);
}
{ /* store frtime */
static long frtime_start[] = {1};
static long frtime_edges[] = {1};
static long frtime[] = {18};
ncvarput(ncid, frtime_id, frtime_start, frtime_edges,
(void *)frtime);
}
{ /* store reftime */
static long reftime_start[] = {0};
static long reftime_edges[] = {20};
static char reftime[] = {"1992 03 04 12:00"};
ncvarput(ncid, reftime_id, reftime_start, reftime_edges,
(void *)reftime);
}
{ /* store P */
static long P_start[] = {0, 0, 0};
static long P_edges[] = {2, 4, 3};
static float P[2][4][3] = {
{{950, 951, 952}, {953, 954, 955}, {956, 957, 958}, {959, 960, 961}},
{{962, 963, 964}, {965, 966, 967}, {968, 969, 970}, {971, 972, 973}}
};
ncvarput(ncid, P_id, P_start, P_edges, (void *)&P[0][0][0]);
}
{ /* store scalarv */
static long scalarv = {-2147483647};
ncvarput1(ncid, scalarv_id, (long *)0, (void *)&scalarv);
}
ncclose (ncid);
return 0;
}

@ -1,81 +0,0 @@
#include <string.h>
#include "netcdfcpp.h"
#define NUM(array) (sizeof(array)/sizeof(array[0]))
int
main( void )
{
const char* path = "Example.nc";
NcFile nc (path, NcFile::Replace); // Create and leave in define mode
// Check if the file was opened
if (! nc.is_valid()) {
std::cerr << "can't create netCDF file " << path << "\n";
return 0;
}
// Create dimensions
NcDim* latd = nc.add_dim("lat", 4);
NcDim* lond = nc.add_dim("lon", 3);
NcDim* frtimed = nc.add_dim("frtime");
NcDim* timelend = nc.add_dim("timelen",20);
// Create variables and their attributes
NcVar* P = nc.add_var("P", ncFloat, frtimed, latd, lond);
P->add_att("long_name", "pressure at maximum wind");
P->add_att("units", "hectopascals");
static float range[] = {0., 1500.};
P->add_att("valid_range", NUM(range), range);
P->add_att("_FillValue", -9999.0f);
NcVar* lat = nc.add_var("lat", ncFloat, latd);
lat->add_att("long_name", "latitude");
lat->add_att("units", "degrees_north");
NcVar* lon = nc.add_var("lon", ncFloat, lond);
lon->add_att("long_name", "longitude");
lon->add_att("units", "degrees_east");
NcVar* frtime = nc.add_var("frtime", ncLong, frtimed);
frtime->add_att("long_name", "forecast time");
frtime->add_att("units", "hours");
NcVar* reftime = nc.add_var("reftime",ncChar,timelend);
reftime->add_att("long_name", "reference time");
reftime->add_att("units", "text_time");
NcVar* scalar = nc.add_var("scalarv",ncLong);
scalar->add_att("scalar_att", 1.0);
// Global attributes
nc.add_att("history", "created by Unidata LDM from NPS broadcast");
nc.add_att("title", "NMC Global Product Set: Pressure at Maximum Wind");
// Start writing data, implictly leaves define mode
float* lats = new float[latd->size()];
int i;
for(i = 0; i < latd->size(); i++)
lats[i] = -90. + 2.5*i;
lat->put(lats, latd->size());
float* lons = new float[lond->size()];
for(i = 0; i < lond->size(); i++)
lons[i] = -180. + 5.*i;
lon->put(lons, lond->size());
static int frtimes[] = {12, 18};
frtime->put(frtimes, NUM(frtimes));
static const char* s = "1992 03 04 12:00" ;
reftime->put(s, strlen(s));
static float P_data[2][4][3] = {
{{950, 951, 952}, {953, 954, 955}, {956, 957, 958}, {959, 960, 961}},
{{962, 963, 964}, {965, 966, 967}, {968, 969, 970}, {971, 972, 973}}
};
P->put(&P_data[0][0][0], P->edges());
// close of nc takes place in destructor
}

@ -1,518 +0,0 @@
/*********************************************************************
* Copyright 2005, UCAR/Unidata See COPYRIGHT file for copying and
* redistribution conditions.
*
* This runs the C++ tests for netCDF.
*
* $Id: nctst.cpp,v 1.28 2007/04/02 21:01:12 ed Exp $
*********************************************************************/
#include <config.h>
#include <iostream>
using namespace std;
#include <string.h>
#include "netcdfcpp.h"
const char LAT[] = "lat";
const char LON[] = "lon";
const char FRTIME[] = "frtime";
const char TIMELEN1[] = "timelen";
const char P_NAME[] = "P";
const char PRES_MAX_WIND[] = "pressure at maximum wind";
const char LONG_NAME[] = "long_name";
const char UNITS[] = "units";
const char VALID_RANGE[] = "valid_range";
const char FILL_VALUE[] = "_FillValue";
const char DEGREES_NORTH[] = "degrees_north";
const char LONGITUDE[] = "longitude";
const char LATITUDE[] = "latitude";
const char HECTOPASCALS[] = "hectopascals";
const char DEGREES_EAST[] = "degrees_east";
const char HOURS[] = "hours";
const char FORECAST_TIME[] = "forecast time";
const char REFERENCE_TIME[] = "reference time";
const char REFTIME[] = "reftime";
const char TEXT_TIME[] = "text_time";
const char SCALARV[] = "scalarv";
const char SCALAR_ATT[] = "scalar_att";
const int SCALAR_VALUE = 1;
const char HISTORY[] = "history";
const char TITLE[] = "title";
const char HISTORY_STR[] = "created by Unidata LDM from NPS broadcast";
const char TITLE_STR[] = "NMC Global Product Set: Pressure at Maximum Wind";
const int NC_ERR = 2;
const int NLATS = 4;
const int NLONS = 3;
const int NFRTIMES = 2;
const int TIMESTRINGLEN = 20;
const int NRANGES = 2;
// These are data values written out by the gen() function, and read
// in again and checked by the read() function.
static float range[] = {0., 1500.};
static float lats[NLATS] = {-90, -87.5, -85, -82.5};
static float lons[NLONS] = {-180, -175, -170};
static int frtimes[NFRTIMES] = {12, 18};
static const char* s = "1992-3-21 12:00";
static float fill_value = -9999.0;
static float P_data[NFRTIMES][NLATS][NLONS] = {
{{950, 951, 952}, {953, 954, 955}, {956, 957, 958}, {959, 960, 961}},
{{962, 963, 964}, {965, 966, 967}, {968, 969, 970}, {971, 972, 973}}
};
// Check a string attribute to make sure it has the correct value.
int
check_string_att(NcAtt *att, const char *theName, const char *value)
{
if (!att->is_valid() || strncmp(att->name(), theName, strlen(theName)) ||
att->type() != ncChar || att->num_vals() != (long)strlen(value))
return NC_ERR;
char *value_in = att->as_string(0);
if (strncmp(value_in, value, strlen(value)))
return NC_ERR;
delete value_in;
return 0;
}
// Check the units and long_name attributes of a var to make sure they
// are what is expected.
int
check_u_ln_atts(NcVar *var, const char *units, const char *long_name)
{
NcAtt *att;
if (!(att = var->get_att(UNITS)))
return NC_ERR;
if (check_string_att(att, UNITS, units))
return NC_ERR;
delete att;
if (!(att = var->get_att(LONG_NAME)))
return NC_ERR;
if (check_string_att(att, LONG_NAME, long_name))
return NC_ERR;
delete att;
return 0;
}
// This reads the netCDF file created by gen() and ensures that
// everything is there as expected.
int read(const char* path, NcFile::FileFormat format)
{
NcAtt *att;
// open the file
NcFile nc(path);
if (!nc.is_valid())
return NC_ERR;
// Check the format.
if (nc.get_format() != format)
return NC_ERR;
// Check the numbers of things.
if (nc.num_dims() != 4 || nc.num_vars() != 6 ||
nc.num_atts() != 2)
return NC_ERR;
// Check the global attributes.
if (!(att = nc.get_att(HISTORY)))
return NC_ERR;
if (check_string_att(att, HISTORY, HISTORY_STR))
return NC_ERR;
delete att;
if (!(att = nc.get_att(TITLE)))
return NC_ERR;
if (check_string_att(att, TITLE, TITLE_STR))
return NC_ERR;
delete att;
// Check the dimensions.
NcDim *latDim, *lonDim, *frtimeDim, *timeLenDim;
if (!(latDim = nc.get_dim(LAT)))
return NC_ERR;
if (!latDim->is_valid() || strncmp(latDim->name(), LAT, strlen(LAT)) ||
latDim->size() != NLATS || latDim->is_unlimited())
return NC_ERR;
if (!(lonDim = nc.get_dim(LON)))
return NC_ERR;
if (!lonDim->is_valid() || strncmp(lonDim->name(), LON, strlen(LON)) ||
lonDim->size() != NLONS || lonDim->is_unlimited())
return NC_ERR;
if (!(frtimeDim = nc.get_dim(FRTIME)))
return NC_ERR;
if (!frtimeDim->is_valid() || strncmp(frtimeDim->name(), FRTIME, strlen(FRTIME)) ||
frtimeDim->size() != 2 || !frtimeDim->is_unlimited())
return NC_ERR;
if (!(timeLenDim = nc.get_dim(TIMELEN1)))
return NC_ERR;
if (!timeLenDim->is_valid() || strncmp(timeLenDim->name(), TIMELEN1, strlen(TIMELEN1)) ||
timeLenDim->size() != TIMESTRINGLEN || timeLenDim->is_unlimited())
return NC_ERR;
// Check the coordinate variables.
NcVar *latVar, *lonVar, *frtimeVar, *refTimeVar;
// Get the latitude.
if (!(latVar = nc.get_var(LAT)))
return NC_ERR;
// Check units and long name.
if (check_u_ln_atts(latVar, DEGREES_NORTH, LATITUDE))
return NC_ERR;
// Get the longitude.
if (!(lonVar = nc.get_var(LON)))
return NC_ERR;
// Check units and long name.
if (check_u_ln_atts(lonVar, DEGREES_EAST, LONGITUDE))
return NC_ERR;
// Get the forecast time coordinate variable.
if (!(frtimeVar = nc.get_var(FRTIME)))
return NC_ERR;
// Check units and long name.
if (check_u_ln_atts(frtimeVar, HOURS, FORECAST_TIME))
return NC_ERR;
// Get the refTime coordinate variable.
if (!(refTimeVar = nc.get_var(REFTIME)))
return NC_ERR;
// Check units and long name.
if (check_u_ln_atts(refTimeVar, TEXT_TIME, REFERENCE_TIME))
return NC_ERR;
// Check the data variables.
NcVar *pVar, *scalarVar;
if (!(pVar = nc.get_var(P_NAME)))
return NC_ERR;
// Check units and long name.
if (check_u_ln_atts(pVar, HECTOPASCALS, PRES_MAX_WIND))
return NC_ERR;
// Check the valid range, and check the values.
if (!(att = pVar->get_att(VALID_RANGE)))
return NC_ERR;
if (!att->is_valid() || strncmp(att->name(), VALID_RANGE, strlen(VALID_RANGE)) ||
att->type() != ncFloat || att->num_vals() != NRANGES)
return NC_ERR;
float range_in[NRANGES] = {att->as_float(0), att->as_float(1)};
if (range_in[0] != range[0] || range_in[1] != range[1])
return NC_ERR;
delete att;
// Check the fill value, and check the value.
if (!(att = pVar->get_att(FILL_VALUE)))
return NC_ERR;
if (!att->is_valid() || strncmp(att->name(), FILL_VALUE, strlen(FILL_VALUE)) ||
att->type() != ncFloat || att->num_vals() != 1)
return NC_ERR;
float fill_value_in = att->as_float(0);
if (fill_value_in != fill_value)
return NC_ERR;
delete att;
// Check the data in the pressure variable.
float P_data_in[NFRTIMES][NLATS][NLONS];
pVar->get(&P_data_in[0][0][0], NFRTIMES, NLATS, NLONS);
for (int f = 0; f < NFRTIMES; f++)
for (int la = 0; la < NLATS; la++)
for (int lo = 0; lo < NLONS; lo++)
if (P_data_in[f][la][lo] != P_data[f][la][lo])
return NC_ERR;
// Get the scalar variable.
if (!(scalarVar = nc.get_var(SCALARV)))
return NC_ERR;
// Check for the scalar attribute of the scalar variable and check its value.
if (!(att = scalarVar->get_att(SCALAR_ATT)))
return NC_ERR;
if (!att->is_valid() || strncmp(att->name(), SCALAR_ATT, strlen(SCALAR_ATT)) ||
att->type() != ncInt || att->num_vals() != 1)
return NC_ERR;
int value_in = att->as_int(0);
if (value_in != SCALAR_VALUE)
return NC_ERR;
delete att;
// Check the value of the scalar variable.
return 0;
}
int gen(const char* path, NcFile::FileFormat format) // Generate a netCDF file
{
NcFile nc(path, NcFile::Replace, NULL, 0, format); // Create, leave in define mode
// Check if the file was opened successfully
if (! nc.is_valid()) {
cerr << "can't create netCDF file " << path << "\n";
return NC_ERR;
}
// Create dimensions
NcDim* latd = nc.add_dim(LAT, NLATS);
NcDim* lond = nc.add_dim(LON, NLONS);
NcDim* frtimed = nc.add_dim(FRTIME); // unlimited dimension
NcDim* timelend = nc.add_dim(TIMELEN1, TIMESTRINGLEN);
// Create variables and their attributes
NcVar* P = nc.add_var(P_NAME, ncFloat, frtimed, latd, lond);
P->add_att(LONG_NAME, PRES_MAX_WIND);
P->add_att(UNITS, HECTOPASCALS);
P->add_att(VALID_RANGE, NRANGES, range);
P->add_att(FILL_VALUE, fill_value);
NcVar* lat = nc.add_var(LAT, ncFloat, latd);
lat->add_att(LONG_NAME, LATITUDE);
lat->add_att(UNITS, DEGREES_NORTH);
NcVar* lon = nc.add_var(LON, ncFloat, lond);
lon->add_att(LONG_NAME, LONGITUDE);
lon->add_att(UNITS, DEGREES_EAST);
NcVar* frtime = nc.add_var(FRTIME, ncLong, frtimed);
frtime->add_att(LONG_NAME, FORECAST_TIME);
frtime->add_att(UNITS, HOURS);
NcVar* reftime = nc.add_var(REFTIME, ncChar, timelend);
reftime->add_att(LONG_NAME, REFERENCE_TIME);
reftime->add_att(UNITS, TEXT_TIME);
NcVar* scalar = nc.add_var(SCALARV, ncInt);
scalar->add_att(SCALAR_ATT, SCALAR_VALUE);
// Global attributes
nc.add_att(HISTORY, HISTORY_STR);
nc.add_att(TITLE, TITLE_STR);
// Start writing data, implictly leaves define mode
lat->put(lats, NLATS);
lon->put(lons, NLONS);
frtime->put(frtimes, NFRTIMES);
reftime->put(s, strlen(s));
// We could write all P data at once with P->put(&P_data[0][0][0], P->edges()),
// but instead we write one record at a time, to show use of setcur().
long rec = 0; // start at zero-th
const long nrecs = 1; // # records to write
P->put(&P_data[0][0][0], nrecs, NLATS, NLONS); // write zero-th record
P->set_cur(++rec); // set to next record
P->put(&P_data[1][0][0], nrecs, NLATS, NLONS); // write next record
// close of nc takes place in destructor
return 0;
}
/*
* Convert pathname of netcdf file into name for CDL, by taking last component
* of path and stripping off any extension. The returned string is in static
* storage, so copy it if you need to keep it.
*/
static char*
cdl_name(const char* path)
{
const char* cp = path + strlen(path);
while (*(cp-1) != '/' && cp != path) // assumes UNIX path separator
cp--;
static char np[NC_MAX_NAME];
strncpy(&np[0], cp, NC_MAX_NAME);
char* ep = np + strlen(np);
while (*ep != '.' && ep != np)
ep--;
if (*ep == '.')
*ep = '\0';
return np;
}
// A derived class, just like NcFile except knows how to "dump" its
// dimensions, variables, global attributes, and data in ASCII form.
class DumpableNcFile : public NcFile
{
public:
DumpableNcFile(const char* path, NcFile::FileMode mode = ReadOnly)
: NcFile(path, mode) {} ;
void dumpdims( void );
void dumpvars( void );
void dumpgatts( void );
void dumpdata( void );
};
void DumpableNcFile::dumpdims( void )
{
for (int n=0; n < num_dims(); n++) {
NcDim* dim = get_dim(n);
cout << "\t" << dim->name() << " = " ;
if (dim->is_unlimited())
cout << "UNLIMITED" << " ;\t " << "// " << dim->size() <<
" currently\n";
else
cout << dim->size() << " ;\n";
}
}
void dumpatts(NcVar& var)
{
NcToken vname = var.name();
NcAtt* ap;
for(int n = 0; (ap = var.get_att(n)); n++) {
cout << "\t\t" << vname << ":" << ap->name() << " = " ;
NcValues* vals = ap->values();
cout << *vals << " ;" << endl ;
delete ap;
delete vals;
}
}
void DumpableNcFile::dumpvars( void )
{
int n;
static const char* types[] =
{"","byte","char","short","long","float","double"};
NcVar* vp;
for(n = 0; (vp = get_var(n)); n++) {
cout << "\t" << types[vp->type()] << " " << vp->name() ;
if (vp->num_dims() > 0) {
cout << "(";
for (int d = 0; d < vp->num_dims(); d++) {
NcDim* dim = vp->get_dim(d);
cout << dim->name();
if (d < vp->num_dims()-1)
cout << ", ";
}
cout << ")";
}
cout << " ;\n";
// now dump each of this variable's attributes
dumpatts(*vp);
}
}
void DumpableNcFile::dumpgatts( void )
{
NcAtt* ap;
for(int n = 0; (ap = get_att(n)); n++) {
cout << "\t\t" << ":" << ap->name() << " = " ;
NcValues* vals = ap->values();
cout << *vals << " ;" << endl ;
delete vals;
delete ap;
}
}
void DumpableNcFile::dumpdata( )
{
NcVar* vp;
for (int n = 0; (vp = get_var(n)); n++) {
cout << " " << vp->name() << " = ";
NcValues* vals = vp->values();
cout << *vals << " ;" << endl ;
delete vals;
}
}
void dump(const char* path)
{
DumpableNcFile nc(path); // default is open in read-only mode
cout << "netcdf " << cdl_name(path) << " {" << endl <<
"dimensions:" << endl ;
nc.dumpdims();
cout << "variables:" << endl;
nc.dumpvars();
if (nc.num_atts() > 0)
cout << "// global attributes" << endl ;
nc.dumpgatts();
cout << "data:" << endl;
nc.dumpdata();
cout << "}" << endl;
}
/* Test everything for classic and 64-bit offsetfiles. If netcdf-4 is
* included, that means another whole round of testing. */
#ifdef USE_NETCDF4
#define NUM_FORMATS (4)
#else
#define NUM_FORMATS (2)
#endif
int
main( void ) // test new netCDF interface
{
cout << "*** Testing C++ API with " << NUM_FORMATS
<< " different netCDF formats.\n";
// Set up the format constants.
NcFile::FileFormat format[NUM_FORMATS] = {NcFile::Classic, NcFile::Offset64Bits
#ifdef USE_NETCDF4
, NcFile::Netcdf4, NcFile::Netcdf4Classic
#endif
};
// Set up the file names.
char file_name[NUM_FORMATS][NC_MAX_NAME] =
{"nctst_classic.nc", "nctst_64bit_offset.nc"
#ifdef USE_NETCDF4
, "nctst_netcdf4.nc", "nctst_netcdf4_classic.nc"
#endif
};
int errs = 0;
for (int i = 0; i < NUM_FORMATS; i++)
{
if (gen(file_name[i], format[i]) ||
read(file_name[i], format[i]))
{
cout << "*** FAILURE with file " << file_name[i] << "\n";
errs++;
}
else
cout << "*** SUCCESS with file " << file_name[i] << "\n";
}
cout << "\n*** Total number of failures: " << errs << "\n";
if (errs)
cout << "*** nctst FAILURE!\n";
else
cout << "*** nctst SUCCESS!\n";
return errs;
}

@ -1,331 +0,0 @@
/*********************************************************************
* Copyright 1992, University Corporation for Atmospheric Research
* See netcdf/README file for copying and redistribution conditions.
*
* Purpose: implementation of classes of typed arrays for netCDF
*
* $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.cpp,v 1.12 2008/03/05 16:45:32 russ Exp $
*********************************************************************/
#include <config.h>
#include <iostream>
#include <string>
#include <cstring>
#include "ncvalues.h"
NcValues::NcValues( void ) : the_type(ncNoType), the_number(0)
{}
NcValues::NcValues(NcType type, long num)
: the_type(type), the_number(num)
{}
NcValues::~NcValues( void )
{}
long NcValues::num( void )
{
return the_number;
}
std::ostream& operator<< (std::ostream& os, const NcValues& vals)
{
return vals.print(os);
}
implement(NcValues,ncbyte)
implement(NcValues,char)
implement(NcValues,short)
implement(NcValues,int)
implement(NcValues,nclong)
implement(NcValues,long)
implement(NcValues,float)
implement(NcValues,double)
Ncbytes_for_one_implement(ncbyte)
Ncbytes_for_one_implement(char)
Ncbytes_for_one_implement(short)
Ncbytes_for_one_implement(int)
Ncbytes_for_one_implement(nclong)
Ncbytes_for_one_implement(long)
Ncbytes_for_one_implement(float)
Ncbytes_for_one_implement(double)
as_ncbyte_implement(short)
as_ncbyte_implement(int)
as_ncbyte_implement(nclong)
as_ncbyte_implement(long)
as_ncbyte_implement(float)
as_ncbyte_implement(double)
inline ncbyte NcValues_char::as_ncbyte( long n ) const
{
return the_values[n];
}
inline ncbyte NcValues_ncbyte::as_ncbyte( long n ) const
{
return the_values[n];
}
as_char_implement(short)
as_char_implement(int)
as_char_implement(nclong)
as_char_implement(long)
as_char_implement(float)
as_char_implement(double)
inline char NcValues_ncbyte::as_char( long n ) const
{
return the_values[n] > CHAR_MAX ? ncBad_char : (char) the_values[n];
}
inline char NcValues_char::as_char( long n ) const
{
return the_values[n];
}
as_short_implement(int)
as_short_implement(nclong)
as_short_implement(long)
as_short_implement(float)
as_short_implement(double)
inline short NcValues_ncbyte::as_short( long n ) const
{
return the_values[n];
}
inline short NcValues_char::as_short( long n ) const
{
return the_values[n];
}
inline short NcValues_short::as_short( long n ) const
{
return the_values[n];
}
as_int_implement(float)
as_int_implement(double)
inline int NcValues_ncbyte::as_int( long n ) const
{
return the_values[n];
}
inline int NcValues_char::as_int( long n ) const
{
return the_values[n];
}
inline int NcValues_short::as_int( long n ) const
{
return the_values[n];
}
inline int NcValues_int::as_int( long n ) const
{
return the_values[n];
}
inline int NcValues_nclong::as_int( long n ) const
{
return the_values[n];
}
inline int NcValues_long::as_int( long n ) const
{
return the_values[n];
}
as_nclong_implement(float)
as_nclong_implement(double)
inline nclong NcValues_ncbyte::as_nclong( long n ) const
{
return the_values[n];
}
inline nclong NcValues_char::as_nclong( long n ) const
{
return the_values[n];
}
inline nclong NcValues_short::as_nclong( long n ) const
{
return the_values[n];
}
inline nclong NcValues_int::as_nclong( long n ) const
{
return the_values[n];
}
inline nclong NcValues_nclong::as_nclong( long n ) const
{
return the_values[n];
}
inline nclong NcValues_long::as_nclong( long n ) const
{
return the_values[n];
}
as_long_implement(float)
as_long_implement(double)
inline long NcValues_ncbyte::as_long( long n ) const
{
return the_values[n];
}
inline long NcValues_char::as_long( long n ) const
{
return the_values[n];
}
inline long NcValues_short::as_long( long n ) const
{
return the_values[n];
}
inline long NcValues_int::as_long( long n ) const
{
return the_values[n];
}
inline long NcValues_nclong::as_long( long n ) const
{
return the_values[n];
}
inline long NcValues_long::as_long( long n ) const
{
return the_values[n];
}
as_float_implement(ncbyte)
as_float_implement(char)
as_float_implement(short)
as_float_implement(int)
as_float_implement(nclong)
as_float_implement(long)
as_float_implement(float)
as_float_implement(double)
as_double_implement(ncbyte)
as_double_implement(char)
as_double_implement(short)
as_double_implement(int)
as_double_implement(nclong)
as_double_implement(long)
as_double_implement(float)
as_double_implement(double)
as_string_implement(short)
as_string_implement(int)
as_string_implement(nclong)
as_string_implement(long)
as_string_implement(float)
as_string_implement(double)
inline char* NcValues_ncbyte::as_string( long n ) const
{
char* s = new char[the_number + 1];
s[the_number] = '\0';
strncpy(s, (const char*)the_values + n, (int)the_number);
return s;
}
inline char* NcValues_char::as_string( long n ) const
{
char* s = new char[the_number + 1];
s[the_number] = '\0';
strncpy(s, (const char*)the_values + n, (int)the_number);
return s;
}
std::ostream& NcValues_short::print(std::ostream& os) const
{
for(int i = 0; i < the_number - 1; i++)
os << the_values[i] << ", ";
if (the_number > 0)
os << the_values[the_number-1] ;
return os;
}
std::ostream& NcValues_int::print(std::ostream& os) const
{
for(int i = 0; i < the_number - 1; i++)
os << the_values[i] << ", ";
if (the_number > 0)
os << the_values[the_number-1] ;
return os;
}
std::ostream& NcValues_nclong::print(std::ostream& os) const
{
for(int i = 0; i < the_number - 1; i++)
os << the_values[i] << ", ";
if (the_number > 0)
os << the_values[the_number-1] ;
return os;
}
std::ostream& NcValues_long::print(std::ostream& os) const
{
for(int i = 0; i < the_number - 1; i++)
os << the_values[i] << ", ";
if (the_number > 0)
os << the_values[the_number-1] ;
return os;
}
std::ostream& NcValues_ncbyte::print(std::ostream& os) const
{
for(int i = 0; i < the_number - 1; i++)
os << the_values[i] << ", ";
if (the_number > 0)
os << the_values[the_number-1] ;
return os;
}
std::ostream& NcValues_char::print(std::ostream& os) const
{
os << '"';
long len = the_number;
while (the_values[--len] == '\0') // don't output trailing null bytes
;
for(int i = 0; i <= len; i++)
os << the_values[i] ;
os << '"';
return os;
}
std::ostream& NcValues_float::print(std::ostream& os) const
{
std::streamsize save=os.precision();
os.precision(7);
for(int i = 0; i < the_number - 1; i++)
os << the_values[i] << ", ";
if (the_number > 0)
os << the_values[the_number-1] ;
os.precision(save);
return os;
}
std::ostream& NcValues_double::print(std::ostream& os) const
{
std::streamsize save=os.precision();
os.precision(15);
for(int i = 0; i < the_number - 1; i++)
os << the_values[i] << ", ";
if (the_number > 0)
os << the_values[the_number-1];
os.precision(save);
return os;
}

@ -1,279 +0,0 @@
/*********************************************************************
* Copyright 1992, University Corporation for Atmospheric Research
* See netcdf/README file for copying and redistribution conditions.
*
* Purpose: interface for classes of typed arrays for netCDF
*
* $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.h,v 1.7 2006/07/26 21:12:06 russ Exp $
*********************************************************************/
#ifndef Ncvalues_def
#define Ncvalues_def
#include <iostream>
#include <sstream>
#include <limits.h>
#include "netcdf.h"
// Documentation warned this might change and now it has, for
// consistency with C interface
typedef signed char ncbyte;
#define NC_UNSPECIFIED ((nc_type)0)
// C++ interface dates from before netcdf-3, still uses some netcdf-2 names
#ifdef NO_NETCDF_2
#define NC_LONG NC_INT
#define FILL_LONG NC_FILL_INT
typedef int nclong;
#define NC_FATAL 1
#define NC_VERBOSE 2
#endif
enum NcType
{
ncNoType = NC_UNSPECIFIED,
ncByte = NC_BYTE,
ncChar = NC_CHAR,
ncShort = NC_SHORT,
ncInt = NC_INT,
ncLong = NC_LONG, // deprecated, someday want to use for 64-bit ints
ncFloat = NC_FLOAT,
ncDouble = NC_DOUBLE
};
#define ncBad_ncbyte ncBad_byte
static const ncbyte ncBad_byte = NC_FILL_BYTE;
static const char ncBad_char = NC_FILL_CHAR;
static const short ncBad_short = NC_FILL_SHORT;
static const nclong ncBad_nclong = FILL_LONG; // deprecated
static const int ncBad_int = NC_FILL_INT;
static const long ncBad_long = FILL_LONG; // deprecated
static const float ncBad_float = NC_FILL_FLOAT;
static const double ncBad_double = NC_FILL_DOUBLE;
// macros to glue tokens together to form new names (used to be in generic.h)
#define name2(a,b) a ## b
#define declare(clas,t) name2(clas,declare)(t)
#define implement(clas,t) name2(clas,implement)(t)
// This is the same as the name2 macro, but we need to define our own
// version since rescanning something generated with the name2 macro
// won't necessarily cause name2 to be expanded again.
#define makename2(z, y) makename2_x(z, y)
#define makename2_x(z, y) z##y
#define NcVal(TYPE) makename2(NcValues_,TYPE)
#define NcValuesdeclare(TYPE) \
class NcVal(TYPE) : public NcValues \
{ \
public: \
NcVal(TYPE)( void ); \
NcVal(TYPE)(long num); \
NcVal(TYPE)(long num, const TYPE* vals); \
NcVal(TYPE)(const NcVal(TYPE)&); \
virtual NcVal(TYPE)& operator=(const NcVal(TYPE)&); \
virtual ~NcVal(TYPE)( void ); \
virtual void* base( void ) const; \
virtual int bytes_for_one( void ) const; \
virtual ncbyte as_ncbyte( long n ) const; \
virtual char as_char( long n ) const; \
virtual short as_short( long n ) const; \
virtual int as_int( long n ) const; \
virtual int as_nclong( long n ) const; \
virtual long as_long( long n ) const; \
virtual float as_float( long n ) const; \
virtual double as_double( long n ) const; \
virtual char* as_string( long n ) const; \
virtual int invalid( void ) const; \
private: \
TYPE* the_values; \
std::ostream& print(std::ostream&) const; \
};
#define NcTypeEnum(TYPE) makename2(_nc__,TYPE)
#define _nc__ncbyte ncByte
#define _nc__char ncChar
#define _nc__short ncShort
#define _nc__int ncInt
#define _nc__nclong ncLong
#define _nc__long ncLong
#define _nc__float ncFloat
#define _nc__double ncDouble
#define NcValuesimplement(TYPE) \
NcVal(TYPE)::NcVal(TYPE)( void ) \
: NcValues(NcTypeEnum(TYPE), 0), the_values(0) \
{} \
\
NcVal(TYPE)::NcVal(TYPE)(long num, const TYPE* vals) \
: NcValues(NcTypeEnum(TYPE), num) \
{ \
the_values = new TYPE[num]; \
for(int i = 0; i < num; i++) \
the_values[i] = vals[i]; \
} \
\
NcVal(TYPE)::NcVal(TYPE)(long num) \
: NcValues(NcTypeEnum(TYPE), num), the_values(new TYPE[num]) \
{} \
\
NcVal(TYPE)::NcVal(TYPE)(const NcVal(TYPE)& v) : \
NcValues(v) \
{ \
delete[] the_values; \
the_values = new TYPE[v.the_number]; \
for(int i = 0; i < v.the_number; i++) \
the_values[i] = v.the_values[i]; \
} \
\
NcVal(TYPE)& NcVal(TYPE)::operator=(const NcVal(TYPE)& v) \
{ \
if ( &v != this) { \
NcValues::operator=(v); \
delete[] the_values; \
the_values = new TYPE[v.the_number]; \
for(int i = 0; i < v.the_number; i++) \
the_values[i] = v.the_values[i]; \
} \
return *this; \
} \
\
void* NcVal(TYPE)::base( void ) const \
{ \
return the_values; \
} \
\
NcVal(TYPE)::~NcVal(TYPE)( void ) \
{ \
delete[] the_values; \
} \
\
int NcVal(TYPE)::invalid( void ) const \
{ \
for(int i=0;i<the_number;i++) \
if (the_values[i] == makename2(ncBad_,TYPE)) return 1; \
return 0; \
} \
#define Ncbytes_for_one_implement(TYPE) \
int NcVal(TYPE)::bytes_for_one( void ) const \
{ \
return sizeof(TYPE); \
}
#define as_ncbyte_implement(TYPE) \
ncbyte NcVal(TYPE)::as_ncbyte( long n ) const \
{ \
if (the_values[n] < 0 || the_values[n] > UCHAR_MAX) \
return ncBad_byte; \
return (ncbyte) the_values[n]; \
}
#define as_char_implement(TYPE) \
char NcVal(TYPE)::as_char( long n ) const \
{ \
if (the_values[n] < CHAR_MIN || the_values[n] > CHAR_MAX) \
return ncBad_char; \
return (char) the_values[n]; \
}
#define as_short_implement(TYPE) \
short NcVal(TYPE)::as_short( long n ) const \
{ \
if (the_values[n] < SHRT_MIN || the_values[n] > SHRT_MAX) \
return ncBad_short; \
return (short) the_values[n]; \
}
#define NCINT_MIN INT_MIN
#define NCINT_MAX INT_MAX
#define as_int_implement(TYPE) \
int NcVal(TYPE)::as_int( long n ) const \
{ \
if (the_values[n] < NCINT_MIN || the_values[n] > NCINT_MAX) \
return ncBad_int; \
return (int) the_values[n]; \
}
#define NCLONG_MIN INT_MIN
#define NCLONG_MAX INT_MAX
#define as_nclong_implement(TYPE) \
nclong NcVal(TYPE)::as_nclong( long n ) const \
{ \
if (the_values[n] < NCLONG_MIN || the_values[n] > NCLONG_MAX) \
return ncBad_nclong; \
return (nclong) the_values[n]; \
}
#define as_long_implement(TYPE) \
long NcVal(TYPE)::as_long( long n ) const \
{ \
if (the_values[n] < LONG_MIN || the_values[n] > LONG_MAX) \
return ncBad_long; \
return (long) the_values[n]; \
}
#define as_float_implement(TYPE) \
inline float NcVal(TYPE)::as_float( long n ) const \
{ \
return (float) the_values[n]; \
}
#define as_double_implement(TYPE) \
inline double NcVal(TYPE)::as_double( long n ) const \
{ \
return (double) the_values[n]; \
}
#define as_string_implement(TYPE) \
char* NcVal(TYPE)::as_string( long n ) const \
{ \
char* s = new char[32]; \
std::ostringstream ostr; \
ostr << the_values[n]; \
ostr.str().copy(s, std::string::npos); \
s[ostr.str().length()] = 0; \
return s; \
}
class NcValues // ABC for value blocks
{
public:
NcValues( void );
NcValues(NcType, long);
virtual ~NcValues( void );
virtual long num( void );
virtual std::ostream& print(std::ostream&) const = 0;
virtual void* base( void ) const = 0;
virtual int bytes_for_one( void ) const = 0;
// The following member functions provide conversions from the value
// type to a desired basic type. If the value is out of range, the
// default "fill-value" for the appropriate type is returned.
virtual ncbyte as_ncbyte( long n ) const = 0; // nth value as a byte
virtual char as_char( long n ) const = 0; // nth value as char
virtual short as_short( long n ) const = 0; // nth value as short
virtual int as_int( long n ) const = 0; // nth value as int
virtual int as_nclong( long n ) const = 0; // nth value as nclong
virtual long as_long( long n ) const = 0; // nth value as long
virtual float as_float( long n ) const = 0; // nth value as floating-point
virtual double as_double( long n ) const = 0; // nth value as double
virtual char* as_string( long n ) const = 0; // value as string
protected:
NcType the_type;
long the_number;
friend std::ostream& operator<< (std::ostream&, const NcValues&);
};
declare(NcValues,ncbyte)
declare(NcValues,char)
declare(NcValues,short)
declare(NcValues,int)
declare(NcValues,nclong)
declare(NcValues,long)
declare(NcValues,float)
declare(NcValues,double)
#endif

File diff suppressed because it is too large Load Diff

@ -1 +0,0 @@
#include <netcdfcpp.h>

@ -1,469 +0,0 @@
/*********************************************************************
* Copyright 1992, University Corporation for Atmospheric Research
* See netcdf/README file for copying and redistribution conditions.
*
* Purpose: C++ class interface for netCDF
*
* $Header: /upc/share/CVS/netcdf-3/cxx/netcdfcpp.h,v 1.15 2009/03/10 15:20:54 russ Exp $
*********************************************************************/
#ifndef NETCDF_HH
#define NETCDF_HH
#include "ncvalues.h" // arrays that know their element type
typedef const char* NcToken; // names for netCDF objects
typedef unsigned int NcBool; // many members return 0 on failure
class NcDim; // dimensions
class NcVar; // variables
class NcAtt; // attributes
/*
* ***********************************************************************
* A netCDF file.
* ***********************************************************************
*/
class NcFile
{
public:
virtual ~NcFile( void );
enum FileMode {
ReadOnly, // file exists, open read-only
Write, // file exists, open for writing
Replace, // create new file, even if already exists
New // create new file, fail if already exists
};
enum FileFormat {
Classic, // netCDF classic format (i.e. version 1 format)
Offset64Bits, // netCDF 64-bit offset format
Netcdf4, // netCDF-4 using HDF5 format
Netcdf4Classic, // netCDF-4 using HDF5 format using only netCDF-3 calls
BadFormat
};
NcFile( const char * path, FileMode = ReadOnly ,
size_t *bufrsizeptr = NULL, // optional tuning parameters
size_t initialsize = 0,
FileFormat = Classic );
NcBool is_valid( void ) const; // opened OK in ctr, still valid
int num_dims( void ) const; // number of dimensions
int num_vars( void ) const; // number of variables
int num_atts( void ) const; // number of (global) attributes
NcDim* get_dim( NcToken ) const; // dimension by name
NcVar* get_var( NcToken ) const; // variable by name
NcAtt* get_att( NcToken ) const; // global attribute by name
NcDim* get_dim( int ) const; // n-th dimension
NcVar* get_var( int ) const; // n-th variable
NcAtt* get_att( int ) const; // n-th global attribute
NcDim* rec_dim( void ) const; // unlimited dimension, if any
// Add new dimensions, variables, global attributes.
// These put the file in "define" mode, so could be expensive.
virtual NcDim* add_dim( NcToken dimname, long dimsize );
virtual NcDim* add_dim( NcToken dimname ); // unlimited
virtual NcVar* add_var( NcToken varname, NcType type, // scalar
const NcDim* dim0=0, // 1-dim
const NcDim* dim1=0, // 2-dim
const NcDim* dim2=0, // 3-dim
const NcDim* dim3=0, // 4-dim
const NcDim* dim4=0 ); // 5-dim
virtual NcVar* add_var( NcToken varname, NcType type, // n-dim
int ndims, const NcDim** dims );
NcBool add_att( NcToken attname, char ); // scalar attributes
NcBool add_att( NcToken attname, ncbyte );
NcBool add_att( NcToken attname, short );
NcBool add_att( NcToken attname, long );
NcBool add_att( NcToken attname, int );
NcBool add_att( NcToken attname, float );
NcBool add_att( NcToken attname, double );
NcBool add_att( NcToken attname, const char*); // string attribute
NcBool add_att( NcToken attname, int, const char* ); // vector attributes
NcBool add_att( NcToken attname, int, const ncbyte* );
NcBool add_att( NcToken attname, int, const short* );
NcBool add_att( NcToken attname, int, const long* );
NcBool add_att( NcToken attname, int, const int* );
NcBool add_att( NcToken attname, int, const float* );
NcBool add_att( NcToken attname, int, const double* );
enum FillMode {
Fill = NC_FILL, // prefill (default)
NoFill = NC_NOFILL, // don't prefill
Bad
};
NcBool set_fill( FillMode = Fill ); // set fill-mode
FillMode get_fill( void ) const; // get fill-mode
FileFormat get_format( void ) const; // get format version
NcBool sync( void ); // synchronize to disk
NcBool close( void ); // to close earlier than dtr
NcBool abort( void ); // back out of bad defines
// Needed by other Nc classes, but users will not need them
NcBool define_mode( void ); // leaves in define mode, if possible
NcBool data_mode( void ); // leaves in data mode, if possible
int id( void ) const; // id used by C interface
protected:
int the_id;
int in_define_mode;
FillMode the_fill_mode;
NcDim** dimensions;
NcVar** variables;
NcVar* globalv; // "variable" for global attributes
};
/*
* For backward compatibility. We used to derive NcOldFile and NcNewFile
* from NcFile, but that was over-zealous inheritance.
*/
#define NcOldFile NcFile
#define NcNewFile NcFile
#define Clobber Replace
#define NoClobber New
/*
* **********************************************************************
* A netCDF dimension, with a name and a size. These are only created
* by NcFile member functions, because they cannot exist independently
* of an open netCDF file.
* **********************************************************************
*/
class NcDim
{
public:
NcToken name( void ) const;
long size( void ) const;
NcBool is_valid( void ) const;
NcBool is_unlimited( void ) const;
NcBool rename( NcToken newname );
int id( void ) const;
NcBool sync( void );
private:
NcFile *the_file; // not const because of rename
int the_id;
char *the_name;
NcDim(NcFile*, int num); // existing dimension
NcDim(NcFile*, NcToken name, long sz); // defines a new dim
virtual ~NcDim( void );
// to construct dimensions, since constructor is private
friend class NcFile;
};
/*
* **********************************************************************
* Abstract base class for a netCDF variable or attribute, both of which
* have a name, a type, and associated values. These only exist as
* components of an open netCDF file.
* **********************************************************************
*/
class NcTypedComponent
{
public:
virtual ~NcTypedComponent( void ) {}
virtual NcToken name( void ) const = 0;
virtual NcType type( void ) const = 0;
virtual NcBool is_valid( void ) const = 0;
virtual long num_vals( void ) const = 0;
virtual NcBool rename( NcToken newname ) = 0;
virtual NcValues* values( void ) const = 0; // block of all values
// The following member functions provide conversions from the value
// type to a desired basic type. If the value is out of range,
// the default "fill-value" for the appropriate type is returned.
virtual ncbyte as_ncbyte( long n ) const; // nth value as an unsgnd char
virtual char as_char( long n ) const; // nth value as char
virtual short as_short( long n ) const; // nth value as short
virtual int as_int( long n ) const; // nth value as int
virtual int as_nclong( long n ) const; // nth value as nclong (deprecated)
virtual long as_long( long n ) const; // nth value as long
virtual float as_float( long n ) const; // nth value as floating-point
virtual double as_double( long n ) const; // nth value as double
virtual char* as_string( long n ) const; // nth value as string
protected:
NcFile *the_file;
NcTypedComponent( NcFile* );
virtual NcValues* get_space( long numVals = 0 ) const; // to hold values
};
/*
* **********************************************************************
* netCDF variables. In addition to a name and a type, these also have
* a shape, given by a list of dimensions
* **********************************************************************
*/
class NcVar : public NcTypedComponent
{
public:
virtual ~NcVar( void );
NcToken name( void ) const;
NcType type( void ) const;
NcBool is_valid( void ) const;
int num_dims( void ) const; // dimensionality of variable
NcDim* get_dim( int ) const; // n-th dimension
long* edges( void ) const; // dimension sizes
int num_atts( void ) const; // number of attributes
NcAtt* get_att( NcToken ) const; // attribute by name
NcAtt* get_att( int ) const; // n-th attribute
long num_vals( void ) const; // product of dimension sizes
NcValues* values( void ) const; // all values
// Put scalar or 1, ..., 5 dimensional arrays by providing enough
// arguments. Arguments are edge lengths, and their number must not
// exceed variable's dimensionality. Start corner is [0,0,..., 0] by
// default, but may be reset using the set_cur() member. FALSE is
// returned if type of values does not match type for variable.
NcBool put( const ncbyte* vals,
long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
NcBool put( const char* vals,
long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
NcBool put( const short* vals,
long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
NcBool put( const int* vals,
long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
NcBool put( const long* vals,
long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
NcBool put( const float* vals,
long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
NcBool put( const double* vals,
long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
// Put n-dimensional arrays, starting at [0, 0, ..., 0] by default,
// may be reset with set_cur().
NcBool put( const ncbyte* vals, const long* counts );
NcBool put( const char* vals, const long* counts );
NcBool put( const short* vals, const long* counts );
NcBool put( const int* vals, const long* counts );
NcBool put( const long* vals, const long* counts );
NcBool put( const float* vals, const long* counts );
NcBool put( const double* vals, const long* counts );
// Get scalar or 1, ..., 5 dimensional arrays by providing enough
// arguments. Arguments are edge lengths, and their number must not
// exceed variable's dimensionality. Start corner is [0,0,..., 0] by
// default, but may be reset using the set_cur() member.
NcBool get( ncbyte* vals, long c0=0, long c1=0,
long c2=0, long c3=0, long c4=0 ) const;
NcBool get( char* vals, long c0=0, long c1=0,
long c2=0, long c3=0, long c4=0 ) const;
NcBool get( short* vals, long c0=0, long c1=0,
long c2=0, long c3=0, long c4=0 ) const;
NcBool get( int* vals, long c0=0, long c1=0,
long c2=0, long c3=0, long c4=0 ) const;
NcBool get( long* vals, long c0=0, long c1=0,
long c2=0, long c3=0, long c4=0 ) const;
NcBool get( float* vals, long c0=0, long c1=0,
long c2=0, long c3=0, long c4=0 ) const;
NcBool get( double* vals, long c0=0, long c1=0,
long c2=0, long c3=0, long c4=0 ) const;
// Get n-dimensional arrays, starting at [0, 0, ..., 0] by default,
// may be reset with set_cur().
NcBool get( ncbyte* vals, const long* counts ) const;
NcBool get( char* vals, const long* counts ) const;
NcBool get( short* vals, const long* counts ) const;
NcBool get( int* vals, const long* counts ) const;
NcBool get( long* vals, const long* counts ) const;
NcBool get( float* vals, const long* counts ) const;
NcBool get( double* vals, const long* counts ) const;
NcBool set_cur(long c0=-1, long c1=-1, long c2=-1,
long c3=-1, long c4=-1);
NcBool set_cur(long* cur);
// these put file in define mode, so could be expensive
NcBool add_att( NcToken, char ); // add scalar attributes
NcBool add_att( NcToken, ncbyte );
NcBool add_att( NcToken, short );
NcBool add_att( NcToken, int );
NcBool add_att( NcToken, long );
NcBool add_att( NcToken, float );
NcBool add_att( NcToken, double );
NcBool add_att( NcToken, const char* ); // string attribute
NcBool add_att( NcToken, int, const char* ); // vector attributes
NcBool add_att( NcToken, int, const ncbyte* );
NcBool add_att( NcToken, int, const short* );
NcBool add_att( NcToken, int, const int* );
NcBool add_att( NcToken, int, const long* );
NcBool add_att( NcToken, int, const float* );
NcBool add_att( NcToken, int, const double* );
NcBool rename( NcToken newname );
long rec_size ( void ); // number of values per record
long rec_size ( NcDim* ); // number of values per dimension slice
// Though following are intended for record variables, they also work
// for other variables, using first dimension as record dimension.
// Get a record's worth of data
NcValues *get_rec(void); // get current record
NcValues *get_rec(long rec); // get specified record
NcValues *get_rec(NcDim* d); // get current dimension slice
NcValues *get_rec(NcDim* d, long slice); // get specified dimension slice
// Put a record's worth of data in current record
NcBool put_rec( const ncbyte* vals );
NcBool put_rec( const char* vals );
NcBool put_rec( const short* vals );
NcBool put_rec( const int* vals );
NcBool put_rec( const long* vals );
NcBool put_rec( const float* vals );
NcBool put_rec( const double* vals );
// Put a dimension slice worth of data in current dimension slice
NcBool put_rec( NcDim* d, const ncbyte* vals );
NcBool put_rec( NcDim* d, const char* vals );
NcBool put_rec( NcDim* d, const short* vals );
NcBool put_rec( NcDim* d, const int* vals );
NcBool put_rec( NcDim* d, const long* vals );
NcBool put_rec( NcDim* d, const float* vals );
NcBool put_rec( NcDim* d, const double* vals );
// Put a record's worth of data in specified record
NcBool put_rec( const ncbyte* vals, long rec );
NcBool put_rec( const char* vals, long rec );
NcBool put_rec( const short* vals, long rec );
NcBool put_rec( const int* vals, long rec );
NcBool put_rec( const long* vals, long rec );
NcBool put_rec( const float* vals, long rec );
NcBool put_rec( const double* vals, long rec );
// Put a dimension slice worth of data in specified dimension slice
NcBool put_rec( NcDim* d, const ncbyte* vals, long slice );
NcBool put_rec( NcDim* d, const char* vals, long slice );
NcBool put_rec( NcDim* d, const short* vals, long slice );
NcBool put_rec( NcDim* d, const int* vals, long slice );
NcBool put_rec( NcDim* d, const long* vals, long slice );
NcBool put_rec( NcDim* d, const float* vals, long slice );
NcBool put_rec( NcDim* d, const double* vals, long slice );
// Get first record index corresponding to specified key value(s)
long get_index( const ncbyte* vals );
long get_index( const char* vals );
long get_index( const short* vals );
long get_index( const int* vals );
long get_index( const long* vals );
long get_index( const float* vals );
long get_index( const double* vals );
// Get first index of specified dimension corresponding to key values
long get_index( NcDim* d, const ncbyte* vals );
long get_index( NcDim* d, const char* vals );
long get_index( NcDim* d, const short* vals );
long get_index( NcDim* d, const int* vals );
long get_index( NcDim* d, const long* vals );
long get_index( NcDim* d, const float* vals );
long get_index( NcDim* d, const double* vals );
// Set current record
void set_rec ( long rec );
// Set current dimension slice
void set_rec ( NcDim* d, long slice );
int id( void ) const; // rarely needed, C interface id
NcBool sync( void );
private:
int dim_to_index(NcDim* rdim);
int the_id;
long* the_cur;
char* the_name;
long* cur_rec;
// private constructors because only an NcFile creates these
NcVar( void );
NcVar(NcFile*, int);
int attnum( NcToken attname ) const;
NcToken attname( int attnum ) const;
void init_cur( void );
// to make variables, since constructor is private
friend class NcFile;
};
/*
* **********************************************************************
* netCDF attributes. In addition to a name and a type, these are each
* associated with a specific variable, or are global to the file.
* **********************************************************************
*/
class NcAtt : public NcTypedComponent
{
public:
virtual ~NcAtt( void );
NcToken name( void ) const;
NcType type( void ) const;
NcBool is_valid( void ) const;
long num_vals( void ) const;
NcValues* values( void ) const;
NcBool rename( NcToken newname );
NcBool remove( void );
private:
const NcVar* the_variable;
char* the_name;
// protected constructors because only NcVars and NcFiles create
// attributes
NcAtt( NcFile*, const NcVar*, NcToken);
NcAtt( NcFile*, NcToken); // global attribute
// To make attributes, since constructor is private
friend class NcFile;
friend NcAtt* NcVar::get_att( NcToken ) const;
};
/*
* **********************************************************************
* To control error handling. Declaring an NcError object temporarily
* changes the error-handling behavior until the object is destroyed, at
* which time the previous error-handling behavior is restored.
* **********************************************************************
*/
class NcError {
public:
enum Behavior {
silent_nonfatal = 0,
silent_fatal = 1,
verbose_nonfatal = 2,
verbose_fatal = 3
};
// constructor saves previous error state, sets new state
NcError( Behavior b = verbose_fatal );
// destructor restores previous error state
virtual ~NcError( void );
int get_err( void ); // returns most recent error number
const char* get_errmsg( void ) {return nc_strerror(get_err());}
static int set_err( int err );
private:
int the_old_state;
int the_old_err;
static int ncopts;
static int ncerr;
};
#endif /* NETCDF_HH */

@ -1,52 +0,0 @@
netcdf ref_nctst {
dimensions:
lat = 4 ;
lon = 3 ;
frtime = UNLIMITED ; // (2 currently)
timelen = 20 ;
variables:
float P(frtime, lat, lon) ;
P:long_name = "pressure at maximum wind" ;
P:units = "hectopascals" ;
P:valid_range = 0.f, 1500.f ;
P:_FillValue = -9999.f ;
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
float lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
int frtime(frtime) ;
frtime:long_name = "forecast time" ;
frtime:units = "hours" ;
char reftime(timelen) ;
reftime:long_name = "reference time" ;
reftime:units = "text_time" ;
int scalarv ;
scalarv:scalar_att = 1 ;
// global attributes:
:history = "created by Unidata LDM from NPS broadcast" ;
:title = "NMC Global Product Set: Pressure at Maximum Wind" ;
data:
P =
950, 951, 952,
953, 954, 955,
956, 957, 958,
959, 960, 961,
962, 963, 964,
965, 966, 967,
968, 969, 970,
971, 972, 973 ;
lat = -90, -87.5, -85, -82.5 ;
lon = -180, -175, -170 ;
frtime = 12, 18 ;
reftime = "1992-3-21 12:00" ;
scalarv = _ ;
}

@ -1,52 +0,0 @@
netcdf ref_nctst {
dimensions:
lat = 4 ;
lon = 3 ;
frtime = UNLIMITED ; // (2 currently)
timelen = 20 ;
variables:
float P(frtime, lat, lon) ;
P:long_name = "pressure at maximum wind" ;
P:units = "hectopascals" ;
P:valid_range = 0.f, 1500.f ;
P:_FillValue = -9999.f ;
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
float lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
int frtime(frtime) ;
frtime:long_name = "forecast time" ;
frtime:units = "hours" ;
char reftime(timelen) ;
reftime:long_name = "reference time" ;
reftime:units = "text_time" ;
int scalarv ;
scalarv:scalar_att = 1 ;
// global attributes:
:history = "created by Unidata LDM from NPS broadcast" ;
:title = "NMC Global Product Set: Pressure at Maximum Wind" ;
data:
P =
950, 951, 952,
953, 954, 955,
956, 957, 958,
959, 960, 961,
962, 963, 964,
965, 966, 967,
968, 969, 970,
971, 972, 973 ;
lat = -90, -87.5, -85, -82.5 ;
lon = -180, -175, -170 ;
frtime = 12, 18 ;
reftime = "1992-3-21 12:00" ;
scalarv = _ ;
}

@ -1,52 +0,0 @@
netcdf ref_nctst {
dimensions:
lat = 4 ;
lon = 3 ;
frtime = UNLIMITED ; // (2 currently)
timelen = 20 ;
variables:
float P(frtime, lat, lon) ;
P:long_name = "pressure at maximum wind" ;
P:units = "hectopascals" ;
P:valid_range = 0.f, 1500.f ;
P:_FillValue = -9999.f ;
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
float lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
int frtime(frtime) ;
frtime:long_name = "forecast time" ;
frtime:units = "hours" ;
char reftime(timelen) ;
reftime:long_name = "reference time" ;
reftime:units = "text_time" ;
int scalarv ;
scalarv:scalar_att = 1 ;
// global attributes:
:history = "created by Unidata LDM from NPS broadcast" ;
:title = "NMC Global Product Set: Pressure at Maximum Wind" ;
data:
P =
950, 951, 952,
953, 954, 955,
956, 957, 958,
959, 960, 961,
962, 963, 964,
965, 966, 967,
968, 969, 970,
971, 972, 973 ;
lat = -90, -87.5, -85, -82.5 ;
lon = -180, -175, -170 ;
frtime = 12, 18 ;
reftime = "1992-3-21 12:00" ;
scalarv = _ ;
}

@ -1,52 +0,0 @@
netcdf ref_nctst {
dimensions:
lat = 4 ;
lon = 3 ;
frtime = UNLIMITED ; // (2 currently)
timelen = 20 ;
variables:
float P(frtime, lat, lon) ;
P:long_name = "pressure at maximum wind" ;
P:units = "hectopascals" ;
P:valid_range = 0.f, 1500.f ;
P:_FillValue = -9999.f ;
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
float lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
int frtime(frtime) ;
frtime:long_name = "forecast time" ;
frtime:units = "hours" ;
char reftime(timelen) ;
reftime:long_name = "reference time" ;
reftime:units = "text_time" ;
int scalarv ;
scalarv:scalar_att = 1 ;
// global attributes:
:history = "created by Unidata LDM from NPS broadcast" ;
:title = "NMC Global Product Set: Pressure at Maximum Wind" ;
data:
P =
950, 951, 952,
953, 954, 955,
956, 957, 958,
959, 960, 961,
962, 963, 964,
965, 966, 967,
968, 969, 970,
971, 972, 973 ;
lat = -90, -87.5, -85, -82.5 ;
lon = -180, -175, -170 ;
frtime = 12, 18 ;
reftime = "1992-3-21 12:00" ;
scalarv = _ ;
}

@ -1,21 +0,0 @@
#!/bin/sh
# This shell script runs some netCDF C++ API tests for netcdf-4 and
# netcdf-4 classic formats.
# $Id: run_nc4_tests.sh,v 1.1 2006/05/08 02:00:27 ed Exp $
set -e
echo ""
echo "*** Testing C++ API test program output for netCDF-4."
echo "*** dumping netcdf-4 format file to nctst_netcdf4.cdl and comparing..."
../ncdump/ncdump -n ref_nctst nctst_netcdf4.nc > nctst_netcdf4.cdl
cmp nctst_netcdf4.cdl $srcdir/ref_nctst_netcdf4.cdl
echo "*** dumping netcdf-4 classic format file to nctst_netcdf4_classic.cdl and comparing..."
../ncdump/ncdump -n ref_nctst nctst_netcdf4_classic.nc > nctst_netcdf4_classic.cdl
cmp nctst_netcdf4_classic.cdl $srcdir/ref_nctst_netcdf4_classic.cdl
echo "*** All tests of C++ API test output passed!"
exit 0

@ -1,21 +0,0 @@
#!/bin/sh
# This shell script runs some netCDF C++ API tests for classic and
# 64-bit offset format.
# $Id: run_nc_tests.sh,v 1.2 2006/07/31 15:17:20 ed Exp $
set -e
echo ""
echo "*** Testing C++ API test program output."
echo "*** dumping classic format file to nctst_classic.cdl and comparing..."
../ncdump/ncdump -n ref_nctst nctst_classic.nc > nctst_classic.cdl
diff -w nctst_classic.cdl $srcdir/ref_nctst.cdl
echo "*** dumping 64-bit offset format file to nctst_64bit_offset.cdl and comparing..."
../ncdump/ncdump -n ref_nctst nctst_64bit_offset.nc > nctst_64bit_offset.cdl
diff -w nctst_64bit_offset.cdl $srcdir/ref_nctst_64bit_offset.cdl
echo "*** All tests of C++ API test output passed!"
exit 0

@ -1,26 +0,0 @@
#!/bin/sh
# This shell runs the tests with valgrind.
# $Id: run_valgrind_tests.sh,v 1.9 2010/01/26 20:24:18 ed Exp $
set -e
echo ""
echo "Testing programs with valgrind..."
# These are my test programs.
list=""
# If we are running with netcdf4, then add tst_atts
if test "x$USE_NETCDF4" = "x1" ; then
list="$list tst_many_writes"
fi
for tst in $list; do
echo ""
echo "Memory testing with $tst:"
valgrind -q --error-exitcode=2 --leak-check=full ./$tst
done
echo "SUCCESS!!!"
exit 0

@ -1,47 +0,0 @@
/*********************************************************************
* Copyright 2006, UCAR/Unidata See COPYRIGHT file for copying and
* redistribution conditions.
*
* This runs the C++ tests for netCDF to test for failure.
*
* $Id: tst_failure.cpp,v 1.2 2007/05/14 14:10:59 ed Exp $
*********************************************************************/
#include <config.h>
#include <iostream>
using namespace std;
#include <string.h>
#include "netcdfcpp.h"
#define FILE "tst_failure.nc"
#define LAT "lat"
int
main( void ) // test new netCDF interface
{
const int NLATS = 4;
// Cause program to exit horribly on failure.
NcError *err = new NcError(NcError::verbose_fatal);
// Create a file.
NcFile nc(FILE, NcFile::Replace, NULL, 0, NcFile::Classic);
// Check if the file was opened successfully. But if it wasn't
// return 0 to cause make check to fail (since make check is
// expecting this program to return a non-zero value.)
if (! nc.is_valid()) {
cerr << "can't create netCDF file " << FILE << "\n";
return 0;
}
// Create a dimension.
NcDim* latd = nc.add_dim(LAT, NLATS);
// This will fail, because the dim already exists.
NcDim* latd1 = nc.add_dim(LAT, NLATS);
// If we get here, that's bad.
return 0;
}

@ -1,86 +0,0 @@
/*********************************************************************
* Copyright 2006, UCAR/Unidata See COPYRIGHT file for copying and
* redistribution conditions.
*
* This run a C++ test for netCDF involving very large files (> 2GB).
*
* $Id: tst_large.cpp,v 1.1 2006/04/03 18:56:52 ed Exp $
*********************************************************************/
#include "config.h"
#include <iostream>
using namespace std;
#include <string.h>
#include "netcdfcpp.h"
/* This is the magic number for classic format limits: 2 GiB - 4
bytes. */
#define MAX_CLASSIC_BYTES 2147483644
/* This is the magic number for 64-bit offset format limits: 4 GiB - 4
bytes. */
#define MAX_64OFFSET_BYTES 4294967292
/* Handy for constucting tests. */
#define QTR_CLASSIC_MAX (MAX_CLASSIC_BYTES/4)
#define ERR -2
// Generate a netCDF file
int
gen(const char* path, NcFile::FileFormat format)
{
// Create, leave in define mode
NcFile nc(path, NcFile::Replace, NULL, 0, format);
// Check if the file was opened successfully
if (! nc.is_valid()) {
cerr << "can't create netCDF file " << path << "\n";
return ERR;
}
// Turn off fill mode.
nc.set_fill(NcFile::NoFill);
// Create dimension
NcDim* latd = nc.add_dim("lat", QTR_CLASSIC_MAX);
// Create variable
NcVar* P = nc.add_var("P", ncFloat, latd);
// Start writing data, implictly leaves define mode
static float *data;
if (!(data = (float *)malloc(QTR_CLASSIC_MAX * sizeof(float))))
return ERR;
P->put(data, QTR_CLASSIC_MAX);
free(data);
return 0;
}
int
main( void ) // test new netCDF interface
{
cout << "Creating large netCDF file with C++ API...";
if (gen("tst_large.nc", NcFile::Offset64Bits))
return ERR;
cout << "ok\n";
#ifdef USE_NETCDF4
// Uncomment the following line to get lots of feedback from the library.
// nc_set_log_level(5);
// cout << "Creating netCDF4 file with C++ API...";
// gen("nctst_netcdf4.nc", NcFile::Netcdf4); // create a netCDF file
// cout << "ok\n";
// nc_set_log_level(0);
// cout << "Creating netCDF4 classic file with C++ API...";
// gen("nctst_netcdf4_classic.nc", NcFile::Netcdf4Classic); // create a netCDF file
// cout << "ok\n";
#endif
return 0;
}

@ -1,122 +0,0 @@
#include <config.h>
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <netcdf.h>
using namespace std;
#ifdef EXTRA_TESTS
#define MEGABYTE 1048576
void
get_mem_used2(int *mem_used)
{
char buf[30];
FILE *pf;
size_t page_size = 4092; /* For spock... */
unsigned size; /* total program size */
unsigned resident;/* resident set size */
unsigned share;/* shared pages */
unsigned text;/* text (code) */
unsigned lib;/* library */
unsigned data;/* data/stack */
/*unsigned dt; dirty pages (unused in Linux 2.6)*/
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
if ((pf = fopen(buf, "r")))
{
fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
&text, &lib, &data);
*mem_used = (data * page_size) / MEGABYTE;
}
else
*mem_used = -1;
fclose(pf);
}
#endif /* EXTRA_TESTS */
//Exception class
class NcErrorException : public exception
{
public:
NcErrorException(const string& descr) throw(): exception(), _descr(descr) {};
~NcErrorException() throw() {};
const char* what() const throw() { ostringstream err; err << "NcErrorException: " << _descr; return err.str().c_str(); };
private:
string _descr;
};
void handle_error(int status) {
if (status != NC_NOERR) {
throw NcErrorException(nc_strerror(status));
}
};
/******MAIN********/
int main(int argc, char** argv)
{
int NUMVARS = 1;
size_t NUMREC=10000;
int fileId, dimId, varId[1];
string filename("tst_many_writes.nc");
cout << "\n*** Testing netCDF-4 file with user-provided test (thanks Marica!)\n";
try{
//create the netcdf-4 file
handle_error(nc_create(filename.c_str(), NC_NETCDF4, &fileId));
//define the unlimited dimension "rec"
handle_error(nc_def_dim(fileId, "rec", NC_UNLIMITED, &dimId)); //--> Segmentation Fault
//handle_error ( nc_def_dim(fileId, "rec", NUMREC, &dimId) ); //--> Good!!
int dimids[1] = {dimId};
//define NUMVARS variables named field_%i using a loop
for (int v = 0; v < NUMVARS; v++)
{
size_t chunkSize[1] = {100000};
ostringstream varName; varName << "field_" << v;
handle_error(nc_def_var(fileId, varName.str().c_str(), NC_DOUBLE, 1, dimids , &varId[v]));
handle_error(nc_def_var_chunking(fileId, varId[v], NC_CHUNKED, chunkSize));
}
handle_error (nc_enddef(fileId));
//write data to the NUMVARS variables using nc_put_var1_double
double data = 100;
size_t start[1];
size_t count[1] = {1};
char charName[NC_MAX_NAME+1];
for (int v = 0; v < NUMVARS; v++)
{
handle_error(nc_inq_varname(fileId, varId[v], charName));
cout << "var " << v << "\n";
for (size_t start = 0; start < NUMREC; start++)
{
#ifdef EXTRA_TESTS
if (start % 1000 == 0)
{
int mem_used;
get_mem_used2(&mem_used);
cout << mem_used << "\n";
}
#endif /* EXTRA_TESTS */
handle_error(nc_put_vara_double(fileId, varId[v], &start, count, &data));
}
}
//close file
handle_error(nc_close(fileId));
cout << "*** nctst SUCCESS!\n";
}
catch(exception &ex) //exception handling
{
cerr << "Exception caught: " << ex.what() << endl;
cout << "*** nctst FAILURE!\n";
return -1;
}
}

@ -1,27 +0,0 @@
#!/bin/sh
export LOCAL=/home/lynton/local
export CPLUS_INCLUDE_PATH=$LOCAL/include
export C_INCLUDE_PATH=$LOCAL/include
export LIBRARY_PATH=$LOCAL/lib
export CPLUS_INCLUDE_PATH=$LOCAL/include:/usr/local/fusion/netcdf-4/include
export C_INCLUDE_PATH=$LOCAL/include:/usr/local/fusion/netcdf-4/include
export LIBRARY_PATH=$LOCAL/lib:/usr/local/fusion/netcdf-4/lib
#g++ -g test_group.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#g++ -g test_dim.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#g++ -g test_att.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#g++ -g test_var.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#g++ -g test_var2.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
g++ -g test_type.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#g++ -g test_type4.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#gcc -g test_type4.c -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#gcc -g test_type4.c -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#g++ -g test_type2.cpp -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#gcc -g test_type2.c -lnetcdf_c++4 -lnetcdf -lhdf5_hl -lhdf5 -lz -I include
#NcFile:: should enums be inside or outside class defintion?

@ -1,298 +0,0 @@
# Doxyfile 1.5.5
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = netcdf-C++
PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = YES
SORT_GROUP_NAMES = YES
SORT_BY_SCOPE_NAME = YES
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./ \
mainPage
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py \
*.f90 \
*.f \
*.vhd \
*.vhdl \
*.C \
*.CC \
*.C++ \
*.II \
*.I++ \
*.H \
*.HH \
*.H++ \
*.CS \
*.PHP \
*.PHP3 \
*.M \
*.MM \
*.PY \
*.F90 \
*.F \
*.VHD \
*.VHDL
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH = .\
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

@ -1,56 +0,0 @@
## This is a automake file, part of Unidata's netCDF package.
# Copyright 2007, see the COPYRIGHT file for more information.
# This file builds the new C++-4 interface.
# $Id: Makefile.am,v 1.18 2010/05/29 00:20:16 dmh Exp $
# Point pre-preprocessor to netcdf-4 directory (libsrc4).
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_LDFLAGS = ${top_builddir}/liblib/libnetcdf.la
LDADD = $(top_builddir)/cxx4/libnetcdf_c++4.la \
$(top_builddir)/liblib/libnetcdf.la
# This is our output library.
lib_LTLIBRARIES = libnetcdf_c++4.la
# See comments in libsrc/Makefile.am about the version number.
libnetcdf_c__4_la_LDFLAGS = -version-info 1:1:0
libnetcdf_c__4_la_LIBADD = $(top_builddir)/liblib/libnetcdf.la
# These headers will be installed in the users header directory.
include_HEADERS = netcdf ncAtt.h ncCheck.h ncDim.h ncException.h \
ncGroup.h ncOpaqueType.h ncVar.h ncVlenType.h ncCompoundType.h \
ncEnumType.h ncFile.h ncGroupAtt.h ncType.h ncVarAtt.h ncByte.h \
ncChar.h ncShort.h ncInt.h ncFloat.h ncDouble.h ncUbyte.h ncUshort.h \
ncUint.h ncInt64.h ncUint64.h ncString.h
# Library source.
libnetcdf_c__4_la_SOURCES = ncAtt.cpp ncCheck.cpp ncCompoundType.cpp \
ncDim.cpp ncEnumType.cpp ncException.cpp ncFile.cpp ncGroup.cpp \
ncGroupAtt.cpp ncOpaqueType.cpp ncType.cpp ncVar.cpp ncVarAtt.cpp \
ncVlenType.cpp ncByte.cpp ncChar.cpp ncShort.cpp ncInt.cpp ncFloat.cpp \
ncDouble.cpp ncUbyte.cpp ncUshort.cpp ncUint.cpp ncInt64.cpp \
ncUint64.cpp ncString.cpp
TESTFILES = test_group$(EXEEXT) test_dim$(EXEEXT) test_att$(EXEEXT) \
test_var$(EXEEXT) test_var2$(EXEEXT) test_type$(EXEEXT)
test_group_SOURCES = test_group.cpp
test_dim_SOURCES = test_dim.cpp
test_att_SOURCES = test_att.cpp test_utilities.h
test_var_SOURCES = test_var.cpp test_utilities.h
test_var2_SOURCES = test_var2.cpp test_utilities.h
test_type_SOURCES = test_type.cpp test_utilities.h
# Build and run these tests.
check_PROGRAMS = $(TESTFILES)
TESTS = $(TESTFILES)
CLEANFILES = firstFile.cdf
# Empty file that gets time-stamped after docs are generated
doxygen_stamp: $(libnetcdf_c__4_la_SOURCES) $(include_HEADERS)
doxygen
touch doxygen_stamp

@ -1,9 +0,0 @@
#!/bin/sh
export LOCAL=/projects/codes/equilibrium/efit++/efit++Data/netCDF/development/local
export CPLUS_INCLUDE_PATH=$LOCAL/include
export LIBRARY_PATH=$LOCAL/lib
export LD_LIBRARY_PATH=$LIBRARY_PATH":"$LD_LIBRARY_PATH
# headers only
# ./ncdump -h firstFile.cdf
./ncdump -s $1

@ -1,7 +0,0 @@
#!/bin/sh
export LOCAL=/projects/codes/equilibrium/efit++/efit++Data/netCDF/development/local
export CPLUS_INCLUDE_PATH=$LOCAL/include
export LIBRARY_PATH=$LOCAL/lib
export LD_LIBRARY_PATH=$LIBRARY_PATH":"$LD_LIBRARY_PATH
# generate c-code
./ncgen4 $1

@ -1 +0,0 @@
getAttCount () line 360 in ncGroup.cpp ............

@ -1,27 +0,0 @@
(1)
Exception
case NC_EBADTYPID // netcdf.h file inconsistent with documentation!!
case NC_EBADFIELD // netcdf.h file inconsistent with documentation!!
case NC_EUNKNAME // netcdf.h file inconsistent with documentation!!
There are lots of undocumented error codes.
eg. -What is the error code if try to use nc_create to open a file that exists using the NC_NOCLOBBER flag?
- What is the error code if try to use nc_open with NC_WRITE and the file does not exist?
(2)
need to add const for pointers (these are mainly char* pointers):
nc_insert_compound(int ncid, nc_type typeid, char *name, size_t offset,nc_type field_typeid)
nc_insert_array_compound(int ncid, int typeid, char *name,size_t offset, nc_type field_typeid,int ndims, int *dim_sizesp)
nc_inq_compound_fieldindex(groupId,myId, const_cast<char*>(memberName.c_str()),&fieldidp)
nc_def_grp(myId,name.c_str(),&new_ncid)
nc_def_vlen(myId, const_cast<char*>(name.c_str()),baseType.getId(),&typeId)
nc_def_opaque(myId, size,const_cast<char*>(name.c_str()), &typeId)
nc_def_compound(myId, size,const_cast<char*>(name.c_str()),&typeId)
(3)
If you open a file with "read" access, and try to define a group, you get an error "NC_ENAMEINUSE". This is inappropriate.
(4)
The following error used by nc_inq_grp_parent isn't properly documented in the c documentation.
NC_ENOGRP : throw NcEnogrp("No netCDF group found");

@ -1,10 +0,0 @@
#!/bin/sh
export LOCAL=/home/lynton/local
export LD_LIBRARY_PATH=$LOCAL/lib:/usr/local/fusion/netcdf-4/lib
case "$#" in
0)
a.out;;
# ~/local/bin/valgrind --tool=memcheck a.out ;;
1)
$1 a.out;;
esac

@ -1 +0,0 @@
4.0.1-beta3

@ -1,9 +0,0 @@
## This is a automake file, part of Unidata's netCDF package.
# Copyright 2010, see the COPYRIGHT file for more information.
# This file includes html directory.
# $Id: Makefile.am,v 1.3 2010/03/26 13:53:51 ed Exp $
SUBDIRS = html

@ -1,189 +0,0 @@
## This is a automake file, part of Unidata's netCDF package.
# Copyright 2010, see the COPYRIGHT file for more information.
# This file packs up cxx4 documentation.
# $Id: Makefile.am,v 1.3 2010/03/26 13:53:51 ed Exp $
EXTRA_DIST = annotated.html classes.html \
classnetCDF_1_1exceptions_1_1NcAttExists.html \
classnetCDF_1_1exceptions_1_1NcAttExists-members.html \
classnetCDF_1_1exceptions_1_1NcAttMeta.html \
classnetCDF_1_1exceptions_1_1NcAttMeta-members.html \
classnetCDF_1_1exceptions_1_1NcBadDim.html \
classnetCDF_1_1exceptions_1_1NcBadDim-members.html \
classnetCDF_1_1exceptions_1_1NcBadFieldId.html \
classnetCDF_1_1exceptions_1_1NcBadFieldId-members.html \
classnetCDF_1_1exceptions_1_1NcBadGroupId.html \
classnetCDF_1_1exceptions_1_1NcBadGroupId-members.html \
classnetCDF_1_1exceptions_1_1NcBadId.html \
classnetCDF_1_1exceptions_1_1NcBadId-members.html \
classnetCDF_1_1exceptions_1_1NcBadName.html \
classnetCDF_1_1exceptions_1_1NcBadName-members.html \
classnetCDF_1_1exceptions_1_1NcBadType.html \
classnetCDF_1_1exceptions_1_1NcBadTypeId.html \
classnetCDF_1_1exceptions_1_1NcBadTypeId-members.html \
classnetCDF_1_1exceptions_1_1NcBadType-members.html \
classnetCDF_1_1exceptions_1_1NcCantCreate.html \
classnetCDF_1_1exceptions_1_1NcCantCreate-members.html \
classnetCDF_1_1exceptions_1_1NcCantRead.html \
classnetCDF_1_1exceptions_1_1NcCantRead-members.html \
classnetCDF_1_1exceptions_1_1NcCantWrite.html \
classnetCDF_1_1exceptions_1_1NcCantWrite-members.html \
classnetCDF_1_1exceptions_1_1NcChar.html \
classnetCDF_1_1exceptions_1_1NcChar-members.html \
classnetCDF_1_1exceptions_1_1NcDimMeta.html \
classnetCDF_1_1exceptions_1_1NcDimMeta-members.html \
classnetCDF_1_1exceptions_1_1NcDimSize.html \
classnetCDF_1_1exceptions_1_1NcDimSize-members.html \
classnetCDF_1_1exceptions_1_1NcEdge.html \
classnetCDF_1_1exceptions_1_1NcEdge-members.html \
classnetCDF_1_1exceptions_1_1NcElateDef.html \
classnetCDF_1_1exceptions_1_1NcElateDef-members.html \
classnetCDF_1_1exceptions_1_1NcEnoGrp.html \
classnetCDF_1_1exceptions_1_1NcEnoGrp-members.html \
classnetCDF_1_1exceptions_1_1NcException.html \
classnetCDF_1_1exceptions_1_1NcException-members.html \
classnetCDF_1_1exceptions_1_1NcExist.html \
classnetCDF_1_1exceptions_1_1NcExist-members.html \
classnetCDF_1_1exceptions_1_1NcFileMeta.html \
classnetCDF_1_1exceptions_1_1NcFileMeta-members.html \
classnetCDF_1_1exceptions_1_1NcGlobal.html \
classnetCDF_1_1exceptions_1_1NcGlobal-members.html \
classnetCDF_1_1exceptions_1_1NcHdfErr.html \
classnetCDF_1_1exceptions_1_1NcHdfErr-members.html \
classnetCDF_1_1exceptions_1_1NcInDefineMode.html \
classnetCDF_1_1exceptions_1_1NcInDefineMode-members.html \
classnetCDF_1_1exceptions_1_1NcInvalidArg.html \
classnetCDF_1_1exceptions_1_1NcInvalidArg-members.html \
classnetCDF_1_1exceptions_1_1NcInvalidCoords.html \
classnetCDF_1_1exceptions_1_1NcInvalidCoords-members.html \
classnetCDF_1_1exceptions_1_1NcInvalidWrite.html \
classnetCDF_1_1exceptions_1_1NcInvalidWrite-members.html \
classnetCDF_1_1exceptions_1_1NcMaxAtts.html \
classnetCDF_1_1exceptions_1_1NcMaxAtts-members.html \
classnetCDF_1_1exceptions_1_1NcMaxDims.html \
classnetCDF_1_1exceptions_1_1NcMaxDims-members.html \
classnetCDF_1_1exceptions_1_1NcMaxName.html \
classnetCDF_1_1exceptions_1_1NcMaxName-members.html \
classnetCDF_1_1exceptions_1_1NcMaxVars.html \
classnetCDF_1_1exceptions_1_1NcMaxVars-members.html \
classnetCDF_1_1exceptions_1_1NcNameInUse.html \
classnetCDF_1_1exceptions_1_1NcNameInUse-members.html \
classnetCDF_1_1exceptions_1_1NcNFile.html \
classnetCDF_1_1exceptions_1_1NcNFile-members.html \
classnetCDF_1_1exceptions_1_1NcNoCompound.html \
classnetCDF_1_1exceptions_1_1NcNoCompound-members.html \
classnetCDF_1_1exceptions_1_1NcNoMem.html \
classnetCDF_1_1exceptions_1_1NcNoMem-members.html \
classnetCDF_1_1exceptions_1_1NcNoRecVars.html \
classnetCDF_1_1exceptions_1_1NcNoRecVars-members.html \
classnetCDF_1_1exceptions_1_1NcNotAtt.html \
classnetCDF_1_1exceptions_1_1NcNotAtt-members.html \
classnetCDF_1_1exceptions_1_1NcNotInDefineMode.html \
classnetCDF_1_1exceptions_1_1NcNotInDefineMode-members.html \
classnetCDF_1_1exceptions_1_1NcNotNc4.html \
classnetCDF_1_1exceptions_1_1NcNotNc4-members.html \
classnetCDF_1_1exceptions_1_1NcNotNCF.html \
classnetCDF_1_1exceptions_1_1NcNotNCF-members.html \
classnetCDF_1_1exceptions_1_1NcNotVar.html \
classnetCDF_1_1exceptions_1_1NcNotVar-members.html \
classnetCDF_1_1exceptions_1_1NcNullDim.html \
classnetCDF_1_1exceptions_1_1NcNullDim-members.html \
classnetCDF_1_1exceptions_1_1NcNullGrp.html \
classnetCDF_1_1exceptions_1_1NcNullGrp-members.html \
classnetCDF_1_1exceptions_1_1NcNullType.html \
classnetCDF_1_1exceptions_1_1NcNullType-members.html \
classnetCDF_1_1exceptions_1_1NcRange.html \
classnetCDF_1_1exceptions_1_1NcRange-members.html \
classnetCDF_1_1exceptions_1_1NcStrictNc3.html \
classnetCDF_1_1exceptions_1_1NcStrictNc3-members.html \
classnetCDF_1_1exceptions_1_1NcStride.html \
classnetCDF_1_1exceptions_1_1NcStride-members.html \
classnetCDF_1_1exceptions_1_1NcSts.html \
classnetCDF_1_1exceptions_1_1NcSts-members.html \
classnetCDF_1_1exceptions_1_1NcTrunc.html \
classnetCDF_1_1exceptions_1_1NcTrunc-members.html \
classnetCDF_1_1exceptions_1_1NcUnknownName.html \
classnetCDF_1_1exceptions_1_1NcUnknownName-members.html \
classnetCDF_1_1exceptions_1_1NcUnlimit.html \
classnetCDF_1_1exceptions_1_1NcUnlimit-members.html \
classnetCDF_1_1exceptions_1_1NcUnlimPos.html \
classnetCDF_1_1exceptions_1_1NcUnlimPos-members.html \
classnetCDF_1_1exceptions_1_1NcVarMeta.html \
classnetCDF_1_1exceptions_1_1NcVarMeta-members.html \
classnetCDF_1_1exceptions_1_1NcVarSize.html \
classnetCDF_1_1exceptions_1_1NcVarSize-members.html \
classnetCDF_1_1NcAtt.html \
classnetCDF_1_1NcAtt-members.html \
classnetCDF_1_1NcByte.html \
classnetCDF_1_1NcByte-members.html \
classnetCDF_1_1NcChar.html \
classnetCDF_1_1NcChar-members.html \
classnetCDF_1_1NcCompoundType.html \
classnetCDF_1_1NcCompoundType-members.html \
classnetCDF_1_1NcDim.html \
classnetCDF_1_1NcDim-members.html \
classnetCDF_1_1NcDouble.html \
classnetCDF_1_1NcDouble-members.html \
classnetCDF_1_1NcEnumType.html \
classnetCDF_1_1NcEnumType-members.html \
classnetCDF_1_1NcFile.html \
classnetCDF_1_1NcFile-members.html \
classnetCDF_1_1NcFloat.html \
classnetCDF_1_1NcFloat-members.html \
classnetCDF_1_1NcGroupAtt.html \
classnetCDF_1_1NcGroupAtt-members.html \
classnetCDF_1_1NcGroup.html \
classnetCDF_1_1NcGroup-members.html \
classnetCDF_1_1NcInt64.html \
classnetCDF_1_1NcInt64-members.html \
classnetCDF_1_1NcInt.html \
classnetCDF_1_1NcInt-members.html \
classnetCDF_1_1NcOpaqueType.html \
classnetCDF_1_1NcOpaqueType-members.html \
classnetCDF_1_1NcShort.html \
classnetCDF_1_1NcShort-members.html \
classnetCDF_1_1NcString.html \
classnetCDF_1_1NcString-members.html \
classnetCDF_1_1NcType.html \
classnetCDF_1_1NcType-members.html \
classnetCDF_1_1NcUbyte.html \
classnetCDF_1_1NcUbyte-members.html \
classnetCDF_1_1NcUint64.html \
classnetCDF_1_1NcUint64-members.html \
classnetCDF_1_1NcUint.html \
classnetCDF_1_1NcUint-members.html \
classnetCDF_1_1NcUshort.html \
classnetCDF_1_1NcUshort-members.html \
classnetCDF_1_1NcVarAtt.html \
classnetCDF_1_1NcVarAtt-members.html \
classnetCDF_1_1NcVar.html \
classnetCDF_1_1NcVar-members.html \
classnetCDF_1_1NcVlenType.html \
classnetCDF_1_1NcVlenType-members.html doxygen.css \
doxygen.png functions_0x63.html \
functions_0x65.html functions_0x66.html \
functions_0x67.html functions_0x69.html \
functions_0x6c.html functions_0x6d.html \
functions_0x6e.html functions_0x6f.html \
functions_0x70.html functions_0x72.html \
functions_0x73.html functions_0x77.html \
functions_0x7e.html functions_enum.html \
functions_eval.html functions_func_0x67.html \
functions_func_0x69.html functions_func_0x6e.html \
functions_func_0x6f.html functions_func_0x70.html \
functions_func_0x72.html functions_func_0x73.html \
functions_func_0x7e.html functions_func.html \
functions.html functions_rela.html \
functions_vars.html graph_legend.dot \
graph_legend.html hierarchy.html index.html \
inherit__graph__0.md5 \
inherits.html namespacemembers_func.html \
namespacemembers.html namespacemembers_vars.html \
namespacenetCDF_1_1exceptions.html \
namespacenetCDF.html namespaces.html \
tab_b.gif tab_l.gif tab_r.gif \
tabs.css
# inherit__graph__0.dot

@ -1,498 +0,0 @@
/* The standard CSS for doxygen */
body, table, div, p, dl {
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
font-size: 12px;
}
/* @group Heading Levels */
h1 {
text-align: center;
font-size: 150%;
}
h2 {
font-size: 120%;
}
h3 {
font-size: 100%;
}
dt {
font-weight: bold;
}
div.multicol {
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
-moz-column-count: 3;
-webkit-column-count: 3;
}
p.startli, p.startdd {
margin-top: 2px;
}
p.endli {
margin-bottom: 0px;
}
p.enddd {
margin-bottom: 4px;
}
/* @end */
caption {
font-weight: bold;
}
span.legend {
font-size: 70%;
text-align: center;
}
div.qindex, div.navtab{
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
}
div.qindex, div.navpath {
width: 100%;
line-height: 140%;
}
div.navtab {
margin-right: 15px;
}
/* @group Link Styling */
a {
color: #153788;
font-weight: normal;
text-decoration: none;
}
.contents a:visited {
color: #1b77c5;
}
a:hover {
text-decoration: underline;
}
a.qindex {
font-weight: bold;
}
a.qindexHL {
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
.contents a.qindexHL:visited {
color: #ffffff;
}
a.el {
font-weight: bold;
}
a.elRef {
}
a.code {
}
a.codeRef {
}
/* @end */
dl.el {
margin-left: -1cm;
}
.fragment {
font-family: monospace, fixed;
font-size: 105%;
}
pre.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
body {
background: white;
color: black;
margin-right: 20px;
margin-left: 20px;
}
td.indexkey {
background-color: #e8eef2;
font-weight: bold;
border: 1px solid #CCCCCC;
margin: 2px 0px 2px 0;
padding: 2px 10px;
}
td.indexvalue {
background-color: #e8eef2;
border: 1px solid #CCCCCC;
padding: 2px 10px;
margin: 2px 0px;
}
tr.memlist {
background-color: #f0f0f0;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
img.footer {
border: 0px;
vertical-align: middle;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
/* @end */
.search {
color: #003399;
font-weight: bold;
}
form.search {
margin-bottom: 0px;
margin-top: 0px;
}
input.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
td.tiny {
font-size: 75%;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #84b0c7;
}
th.dirtab {
background: #e8eef2;
font-weight: bold;
}
hr {
height: 0;
border: none;
border-top: 1px solid #666;
}
/* @group Member Descriptions */
.mdescLeft, .mdescRight,
.memItemLeft, .memItemRight,
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
background-color: #FAFAFA;
border: none;
margin: 4px;
padding: 1px 0 0 8px;
}
.mdescLeft, .mdescRight {
padding: 0px 8px 4px 8px;
color: #555;
}
.memItemLeft, .memItemRight, .memTemplParams {
border-top: 1px solid #ccc;
}
.memItemLeft, .memTemplItemLeft {
white-space: nowrap;
}
.memTemplParams {
color: #606060;
white-space: nowrap;
}
/* @end */
/* @group Member Details */
/* Styles for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #606060;
font-weight: normal;
margin-left: 3px;
}
.memnav {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.memitem {
padding: 0;
margin-bottom: 10px;
}
.memname {
white-space: nowrap;
font-weight: bold;
}
.memproto, .memdoc {
border: 1px solid #84b0c7;
}
.memproto {
padding: 0;
background-color: #d5e1e8;
font-weight: bold;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
}
.memdoc {
padding: 2px 5px;
background-color: #eef3f5;
border-top-width: 0;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
}
.paramkey {
text-align: right;
}
.paramtype {
white-space: nowrap;
}
.paramname {
color: #602020;
white-space: nowrap;
}
.paramname em {
font-style: normal;
}
/* @end */
/* @group Directory (tree) */
/* for the tree view */
.ftvtree {
font-family: sans-serif;
margin: 0.5em;
}
/* these are for tree view when used as main index */
.directory {
font-size: 9pt;
font-weight: bold;
}
.directory h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
/*
The following two styles can be used to replace the root node title
with an image of your choice. Simply uncomment the next two styles,
specify the name of your image and be sure to set 'height' to the
proper pixel height of your image.
*/
/*
.directory h3.swap {
height: 61px;
background-repeat: no-repeat;
background-image: url("yourimage.gif");
}
.directory h3.swap span {
display: none;
}
*/
.directory > h3 {
margin-top: 0;
}
.directory p {
margin: 0px;
white-space: nowrap;
}
.directory div {
display: none;
margin: 0px;
}
.directory img {
vertical-align: -30%;
}
/* these are for tree view when not used as main index */
.directory-alt {
font-size: 100%;
font-weight: bold;
}
.directory-alt h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
.directory-alt > h3 {
margin-top: 0;
}
.directory-alt p {
margin: 0px;
white-space: nowrap;
}
.directory-alt div {
display: none;
margin: 0px;
}
.directory-alt img {
vertical-align: -30%;
}
/* @end */
address {
font-style: normal;
color: #333;
}

Binary file not shown.

Before

(image error) Size: 1.3 KiB

@ -1,23 +0,0 @@
digraph G
{
bgcolor="transparent";
edge [fontname="FreeSans",fontsize="10",labelfontname="FreeSans",labelfontsize="10"];
node [fontname="FreeSans",fontsize="10",shape=record];
Node9 [shape="box",label="Inherited",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",fillcolor="grey75",style="filled" fontcolor="black"];
Node10 -> Node9 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"];
Node10 [shape="box",label="PublicBase",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classPublicBase.html"];
Node11 -> Node10 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"];
Node11 [shape="box",label="Truncated",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="red",URL="$classTruncated.html"];
Node13 -> Node9 [dir=back,color="darkgreen",fontsize="10",style="solid",fontname="FreeSans"];
Node13 [shape="box",label="ProtectedBase",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classProtectedBase.html"];
Node14 -> Node9 [dir=back,color="firebrick4",fontsize="10",style="solid",fontname="FreeSans"];
Node14 [shape="box",label="PrivateBase",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classPrivateBase.html"];
Node15 -> Node9 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"];
Node15 [shape="box",label="Undocumented",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="grey75"];
Node16 -> Node9 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"];
Node16 [shape="box",label="Templ< int >",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classTempl.html"];
Node17 -> Node16 [dir=back,color="orange",fontsize="10",style="dashed",label="< int >",fontname="FreeSans"];
Node17 [shape="box",label="Templ< T >",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classTempl.html"];
Node18 -> Node9 [dir=back,color="darkorchid3",fontsize="10",style="dashed",label="m_usedClass",fontname="FreeSans"];
Node18 [shape="box",label="Used",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classUsed.html"];
}

Binary file not shown.

Before

(image error) Size: 18 KiB

@ -1,56 +0,0 @@
<map id="G" name="G">
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcException.html" title="netCDF::exceptions::NcException" alt="" coords="7,1323,260,1349"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcAttExists.html" title="netCDF::exceptions::NcAttExists" alt="" coords="337,5,588,32"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcAttMeta.html" title="netCDF::exceptions::NcAttMeta" alt="" coords="340,56,585,83"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcBadDim.html" title="netCDF::exceptions::NcBadDim" alt="" coords="343,107,583,133"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcBadFieldId.html" title="netCDF::exceptions::NcBadFieldId" alt="" coords="336,157,589,184"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcBadGroupId.html" title="netCDF::exceptions::NcBadGroupId" alt="" coords="331,208,595,235"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcBadId.html" title="netCDF::exceptions::NcBadId" alt="" coords="351,259,575,285"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcBadName.html" title="netCDF::exceptions::NcBadName" alt="" coords="337,309,588,336"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcBadType.html" title="netCDF::exceptions::NcBadType" alt="" coords="341,360,584,387"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcBadTypeId.html" title="netCDF::exceptions::NcBadTypeId" alt="" coords="335,411,591,437"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcCantCreate.html" title="netCDF::exceptions::NcCantCreate" alt="" coords="329,461,596,488"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcCantRead.html" title="netCDF::exceptions::NcCantRead" alt="" coords="336,512,589,539"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcCantWrite.html" title="netCDF::exceptions::NcCantWrite" alt="" coords="335,563,591,589"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcChar.html" title="netCDF::exceptions::NcChar" alt="" coords="355,613,571,640"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcDimMeta.html" title="netCDF::exceptions::NcDimMeta" alt="" coords="339,664,587,691"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcDimSize.html" title="netCDF::exceptions::NcDimSize" alt="" coords="343,715,583,741"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcEdge.html" title="netCDF::exceptions::NcEdge" alt="" coords="353,765,572,792"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcElateDef.html" title="netCDF::exceptions::NcElateDef" alt="" coords="339,816,587,843"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcEnoGrp.html" title="netCDF::exceptions::NcEnoGrp" alt="" coords="345,867,580,893"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcExist.html" title="netCDF::exceptions::NcExist" alt="" coords="353,917,572,944"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcFileMeta.html" title="netCDF::exceptions::NcFileMeta" alt="" coords="341,968,584,995"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcGlobal.html" title="netCDF::exceptions::NcGlobal" alt="" coords="349,1019,576,1045"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcHdfErr.html" title="netCDF::exceptions::NcHdfErr" alt="" coords="349,1069,576,1096"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcInDefineMode.html" title="netCDF::exceptions::NcInDefineMode" alt="" coords="323,1120,603,1147"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcInvalidArg.html" title="netCDF::exceptions::NcInvalidArg" alt="" coords="337,1171,588,1197"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcInvalidCoords.html" title="netCDF::exceptions::NcInvalidCoords" alt="" coords="325,1221,600,1248"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcInvalidWrite.html" title="netCDF::exceptions::NcInvalidWrite" alt="" coords="331,1272,595,1299"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcMaxAtts.html" title="netCDF::exceptions::NcMaxAtts" alt="" coords="341,1323,584,1349"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcMaxDims.html" title="netCDF::exceptions::NcMaxDims" alt="" coords="339,1373,587,1400"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcMaxName.html" title="netCDF::exceptions::NcMaxName" alt="" coords="336,1424,589,1451"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcMaxVars.html" title="netCDF::exceptions::NcMaxVars" alt="" coords="341,1475,584,1501"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNameInUse.html" title="netCDF::exceptions::NcNameInUse" alt="" coords="331,1525,595,1552"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNFile.html" title="netCDF::exceptions::NcNFile" alt="" coords="353,1576,572,1603"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNoCompound.html" title="netCDF::exceptions::NcNoCompound" alt="" coords="325,1627,600,1653"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNoMem.html" title="netCDF::exceptions::NcNoMem" alt="" coords="344,1677,581,1704"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNoRecVars.html" title="netCDF::exceptions::NcNoRecVars" alt="" coords="333,1728,592,1755"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNotAtt.html" title="netCDF::exceptions::NcNotAtt" alt="" coords="345,1779,580,1805"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNotInDefineMode.html" title="netCDF::exceptions::NcNotInDefineMode" alt="" coords="311,1829,615,1856"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNotNc4.html" title="netCDF::exceptions::NcNotNc4" alt="" coords="344,1880,581,1907"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNotNCF.html" title="netCDF::exceptions::NcNotNCF" alt="" coords="343,1931,583,1957"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNotVar.html" title="netCDF::exceptions::NcNotVar" alt="" coords="347,1981,579,2008"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNullDim.html" title="netCDF::exceptions::NcNullDim" alt="" coords="344,2032,581,2059"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNullGrp.html" title="netCDF::exceptions::NcNullGrp" alt="" coords="347,2083,579,2109"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcNullType.html" title="netCDF::exceptions::NcNullType" alt="" coords="343,2133,583,2160"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcRange.html" title="netCDF::exceptions::NcRange" alt="" coords="348,2184,577,2211"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcStrictNc3.html" title="netCDF::exceptions::NcStrictNc3" alt="" coords="337,2235,588,2261"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcStride.html" title="netCDF::exceptions::NcStride" alt="" coords="349,2285,576,2312"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcSts.html" title="netCDF::exceptions::NcSts" alt="" coords="359,2336,567,2363"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcTrunc.html" title="netCDF::exceptions::NcTrunc" alt="" coords="352,2387,573,2413"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcUnknownName.html" title="netCDF::exceptions::NcUnknownName" alt="" coords="320,2437,605,2464"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcUnlimit.html" title="netCDF::exceptions::NcUnlimit" alt="" coords="347,2488,579,2515"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcUnlimPos.html" title="netCDF::exceptions::NcUnlimPos" alt="" coords="340,2539,585,2565"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcVarMeta.html" title="netCDF::exceptions::NcVarMeta" alt="" coords="341,2589,584,2616"/>
<area shape="rect" href="$classnetCDF_1_1exceptions_1_1NcVarSize.html" title="netCDF::exceptions::NcVarSize" alt="" coords="345,2640,580,2667"/>
</map>

@ -1 +0,0 @@
e3ba1f28092043a916a22286a7ce6f32

Binary file not shown.

Before

(image error) Size: 385 KiB

@ -1,5 +0,0 @@
<map id="G" name="G">
<area shape="rect" href="$classnetCDF_1_1NcAtt.html" title="netCDF::NcAtt" alt="" coords="7,31,129,57"/>
<area shape="rect" href="$classnetCDF_1_1NcGroupAtt.html" title="netCDF::NcGroupAtt" alt="" coords="180,5,343,32"/>
<area shape="rect" href="$classnetCDF_1_1NcVarAtt.html" title="netCDF::NcVarAtt" alt="" coords="189,56,333,83"/>
</map>

@ -1 +0,0 @@
405d84ab191f5fffd08911dc3d65ff59

Binary file not shown.

Before

(image error) Size: 4.9 KiB

@ -1,3 +0,0 @@
<map id="G" name="G">
<area shape="rect" href="$classnetCDF_1_1NcDim.html" title="netCDF::NcDim" alt="" coords="5,5,133,32"/>
</map>

@ -1 +0,0 @@
7e88c133d7f417327cf64818b054ae1b

Binary file not shown.

Before

(image error) Size: 1.1 KiB

@ -1,4 +0,0 @@
<map id="G" name="G">
<area shape="rect" href="$classnetCDF_1_1NcGroup.html" title="netCDF::NcGroup" alt="" coords="7,5,145,32"/>
<area shape="rect" href="$classnetCDF_1_1NcFile.html" title="netCDF::NcFile" alt="" coords="196,5,319,32"/>
</map>

@ -1 +0,0 @@
1ece86699836e065dc875a5665e7242e

Binary file not shown.

Before

(image error) Size: 2.0 KiB

@ -1,19 +0,0 @@
<map id="G" name="G">
<area shape="rect" href="$classnetCDF_1_1NcType.html" title="netCDF::NcType" alt="" coords="7,385,137,412"/>
<area shape="rect" href="$classnetCDF_1_1NcByte.html" title="netCDF::NcByte" alt="" coords="221,5,357,32"/>
<area shape="rect" href="$classnetCDF_1_1NcChar.html" title="netCDF::NcChar" alt="" coords="224,56,355,82"/>
<area shape="rect" href="$classnetCDF_1_1NcCompoundType.html" title="netCDF::NcCompoundType" alt="" coords="188,106,391,133"/>
<area shape="rect" href="$classnetCDF_1_1NcDouble.html" title="netCDF::NcDouble" alt="" coords="216,157,363,184"/>
<area shape="rect" href="$classnetCDF_1_1NcEnumType.html" title="netCDF::NcEnumType" alt="" coords="204,208,375,234"/>
<area shape="rect" href="$classnetCDF_1_1NcFloat.html" title="netCDF::NcFloat" alt="" coords="221,258,357,285"/>
<area shape="rect" href="$classnetCDF_1_1NcInt.html" title="netCDF::NcInt" alt="" coords="229,309,349,336"/>
<area shape="rect" href="$classnetCDF_1_1NcInt64.html" title="netCDF::NcInt64" alt="" coords="221,360,357,386"/>
<area shape="rect" href="$classnetCDF_1_1NcOpaqueType.html" title="netCDF::NcOpaqueType" alt="" coords="197,410,381,437"/>
<area shape="rect" href="$classnetCDF_1_1NcShort.html" title="netCDF::NcShort" alt="" coords="221,461,357,488"/>
<area shape="rect" href="$classnetCDF_1_1NcString.html" title="netCDF::NcString" alt="" coords="220,512,359,538"/>
<area shape="rect" href="$classnetCDF_1_1NcUbyte.html" title="netCDF::NcUbyte" alt="" coords="219,562,360,589"/>
<area shape="rect" href="$classnetCDF_1_1NcUint.html" title="netCDF::NcUint" alt="" coords="225,613,353,640"/>
<area shape="rect" href="$classnetCDF_1_1NcUint64.html" title="netCDF::NcUint64" alt="" coords="217,664,361,690"/>
<area shape="rect" href="$classnetCDF_1_1NcUshort.html" title="netCDF::NcUshort" alt="" coords="217,714,361,741"/>
<area shape="rect" href="$classnetCDF_1_1NcVlenType.html" title="netCDF::NcVlenType" alt="" coords="209,765,369,792"/>
</map>

@ -1 +0,0 @@
25938dc4660c26544b92bd5316c3208c

Binary file not shown.

Before

(image error) Size: 62 KiB

@ -1,3 +0,0 @@
<map id="G" name="G">
<area shape="rect" href="$classnetCDF_1_1NcVar.html" title="netCDF::NcVar" alt="" coords="5,5,128,32"/>
</map>

@ -1 +0,0 @@
ee6d15a19c276fa754e02e4dd616a9ad

Binary file not shown.

Before

(image error) Size: 1.2 KiB

Binary file not shown.

Before

(image error) Size: 35 B

Binary file not shown.

Before

(image error) Size: 706 B

Binary file not shown.

Before

(image error) Size: 2.5 KiB

@ -1,105 +0,0 @@
/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
DIV.tabs
{
float : left;
width : 100%;
background : url("tab_b.gif") repeat-x bottom;
margin-bottom : 4px;
}
DIV.tabs UL
{
margin : 0px;
padding-left : 10px;
list-style : none;
}
DIV.tabs LI, DIV.tabs FORM
{
display : inline;
margin : 0px;
padding : 0px;
}
DIV.tabs FORM
{
float : right;
}
DIV.tabs A
{
float : left;
background : url("tab_r.gif") no-repeat right top;
border-bottom : 1px solid #84B0C7;
font-size : 80%;
font-weight : bold;
text-decoration : none;
}
DIV.tabs A:hover
{
background-position: 100% -150px;
}
DIV.tabs A:link, DIV.tabs A:visited,
DIV.tabs A:active, DIV.tabs A:hover
{
color: #1A419D;
}
DIV.tabs SPAN
{
float : left;
display : block;
background : url("tab_l.gif") no-repeat left top;
padding : 5px 9px;
white-space : nowrap;
}
DIV.tabs #MSearchBox
{
float : right;
display : inline;
font-size : 1em;
}
DIV.tabs TD
{
font-size : 80%;
font-weight : bold;
text-decoration : none;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
DIV.tabs SPAN {float : none;}
/* End IE5-Mac hack */
DIV.tabs A:hover SPAN
{
background-position: 0% -150px;
}
DIV.tabs LI.current A
{
background-position: 100% -150px;
border-width : 0px;
}
DIV.tabs LI.current SPAN
{
background-position: 0% -150px;
padding-bottom : 6px;
}
DIV.navpath
{
background : none;
border : none;
border-bottom : 1px solid #84B0C7;
text-align : center;
margin : 2px;
padding : 2px;
}

@ -1,42 +0,0 @@
#include <iostream>
#include <iomanip>
#include <netcdf>
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;
int main()
{
try
{
cout<<"Opening file \"firstFile.cdf\" with NcFile::replace"<<endl;
NcFile ncFile("firstFile.cdf",NcFile::replace);
cout<<left<<setw(50)<<"Testing addGroup(\"groupName\")";
NcGroup groupA(ncFile.addGroup("groupA"));
NcGroup groupA0(ncFile.addGroup("groupA0"));
NcGroup groupB(groupA.addGroup("groupB"));
NcGroup groupC(groupA.addGroup("groupC"));
cout <<left<<setw(50)<<"Number of groups in the top-level group is"<ncFile.getGroupCount()<<endl;
// create two dimensions
ncFile.addDim("dim1",11);
ncFile.addDim("dim2");
// create a variable
NcVar var1 = ncFile.addVar("varA",ncByte,dim1);
// create another variable
vector<string> stringArray(2);
stringArray[0] = "dim1";
stringArray[1] = "dim2";
NcVar var2 = ncFile.addVar("varB",ncByte,stringArray);
}
catch (NcException& e)
{
cout << "unknown error"<<endl;
e.what();
}
}

@ -1,64 +0,0 @@
/*! \mainpage netCDF C++ Interface Guide
\section intro_sec Introduction
Lynton Appel, of the Culham Centre for Fusion Energy (CCFE) in
Oxfordshire, has developed and contributed a new %netCDF-4 C++
interface, which is included in %netCDF version 4.1.1. The %netCDF-4
C++ API was developed for use in managing fusion research data from
CCFE's innovative MAST (Mega Amp Spherical Tokamak) experiment.
Appel's C++ implementation is a complete read/write interface for
%netCDF-4, but can also be used as an alternative to the older %netCDF-3
C++ interface, to write classic-format %netCDF-3 files as well as
%netCDF-4 classic model files. The new API is implemented as a layer
over the %netCDF-4 C interface, which means bug fixes and performance
enhancements in the C interface will be immediately available to C++
developers as well. It replaces a previous partial
%netCDF-4 C++ interface developed by Shanna Forbes.
The new API makes use of standard C++ features such as namespaces,
exceptions, and templates, none of which were included in the first
%netCDF-3 C++ API developed in the mid-90's. The earlier %netCDF-3 C++
API is still supported and available in the source distribution, but
devvelopers who are thinking of eventually upgrading to use of the
enhanced data model should consider using Lynton's new API.
We're grateful for Appel's development and CCFE's contribution of the
new open-source code for the %netCDF-4 C++ API, and hope C++ developers
in the %netCDF community will find it useful! Feedback is appreciated,
and should be directed to <Lynton.Appel@ccfe.ac.uk>.
\section install_sec Installation
Installing the C++ interface requires the additional flag --enable-netcdf-4 to be used during the
configure stage of the installation, ie example enter
\verbatim
./configure --enable-cxx-4 [plus other options]
\endverbatim
To build the C++ interface guide, change to the cxx4 directory of the netCDF distribution and enter
\verbatim
doxygen
\endverbatim
By default html documentation will be installed in cxx4/doc/html; other options may be specified according to the settings contained in the file "Doxfile" (details of alternative settings are documented at http://www.stack.nl/~dimitri/doxygen).
Note that as a prerequisite for generating the documentation, the system will need to have doxygen (http://www.stack.nl/~dimitri/doxygen) and Graphviz (http://www.graphviz.org)installed.
\subsection step1 Examples of usage.
Examples codes can be found by selecting the "Examples" tab.
\page
\example test_group.cpp
\section sectionName section title
\example test_group.cpp
This example test group methods.
\example test_att.cpp
This example test attributes.
\example test_var.cpp
This example variable creation.
\example test_type.cpp
This example compound type creation.
\example example1.cpp
This is a short test example.
*/

@ -1,231 +0,0 @@
#include "ncAtt.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include <vector>
using namespace std;
using namespace netCDF;
// destructor (defined even though it is virtual)
NcAtt::~NcAtt() {}
// assignment operator
NcAtt& NcAtt::operator=(const NcAtt& rhs)
{
nullObject = rhs.nullObject;
myName = rhs.myName;
groupId = rhs.groupId;
varId =rhs.varId;
return *this;
}
// Constructor generates a null object.
NcAtt::NcAtt() :
nullObject(true)
{}
// Constructor for non-null instances.
NcAtt::NcAtt(bool nullObject):
nullObject(nullObject)
{}
// The copy constructor.
NcAtt::NcAtt(const NcAtt& rhs) :
nullObject(rhs.nullObject),
myName(rhs.myName),
groupId(rhs.groupId),
varId(rhs.varId)
{}
// equivalence operator
bool NcAtt::operator==(const NcAtt & rhs) const
{
if(nullObject)
return nullObject == rhs.nullObject;
else
return myName == rhs.myName && groupId == rhs.groupId && varId == rhs.varId;
}
// != operator
bool NcAtt::operator!=(const NcAtt & rhs) const
{
return !(*this == rhs);
}
// Gets parent group.
netCDF::NcGroup NcAtt::getParentGroup() const {
return netCDF::NcGroup(groupId);
}
// Returns the attribute type.
NcType NcAtt::getType() const{
// get the identifier for the netCDF type of this attribute.
nc_type xtypep;
ncCheck(nc_inq_atttype(groupId,varId,myName.c_str(),&xtypep),__FILE__,__LINE__);
if(xtypep <= 12)
// This is an atomic type
return NcType(xtypep);
else
// this is a user-defined type
{
// now get the set of NcType objects in this file.
multimap<string,NcType> typeMap(getParentGroup().getTypes(NcGroup::ParentsAndCurrent));
multimap<string,NcType>::iterator iter;
// identify the Nctype object with the same id as this attribute.
for (iter=typeMap.begin(); iter!= typeMap.end();iter++) {
if(iter->second.getId() == xtypep) return iter->second;
}
// return a null object, as no type was identified.
return NcType();
}
}
// Gets attribute length.
size_t NcAtt::getAttLength() const{
size_t lenp;
ncCheck(nc_inq_attlen(groupId, varId, myName.c_str(), &lenp),__FILE__,__LINE__);
return lenp;
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(string& dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
size_t att_len=getAttLength();
char* tmpValues;
tmpValues = (char *) malloc(att_len + 1); /* + 1 for trailing null */
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),tmpValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_text(groupId,varId,myName.c_str(),tmpValues),__FILE__,__LINE__);
dataValues=string(tmpValues,att_len);
free(tmpValues);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(char* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_text(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned char* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_uchar(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(signed char* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_schar(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(short* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_short(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(int* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_int(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(long* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_long(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(float* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_float(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(double* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_double(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned short* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_ushort(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned int* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_uint(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(long long* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_longlong(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned long long* dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_ulonglong(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(char** dataValues) const {
NcType::ncType typeClass(getType().getTypeClass());
if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND)
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
else
ncCheck(nc_get_att_string(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(void* dataValues) const {
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__);
}

@ -1,121 +0,0 @@
#include "ncType.h"
#include "ncException.h"
#include <string>
#include <typeinfo>
#ifndef NcAttClass
#define NcAttClass
namespace netCDF
{
/*! Abstract base class represents inherited by ncVarAtt and ncGroupAtt. */
class NcAtt
{
public:
/*! destructor */
virtual ~NcAtt()=0;
/*! Constructor generates a \ref isNull "null object". */
NcAtt ();
/*! Constructor for non-null instances. */
NcAtt(bool nullObject);
/*! The copy constructor. */
NcAtt(const NcAtt& rhs);
/*! Get the attribute name. */
std::string getName() const {return myName;}
/*! Gets attribute length. */
size_t getAttLength() const;
/*! Returns the attribute type. */
NcType getType() const;
/*! Gets parent group. */
NcGroup getParentGroup() const;
/*! equivalence operator */
bool operator== (const NcAtt& rhs) const;
/*! != operator */
bool operator!=(const NcAtt& rhs) const;
/*! \overload
*/
void getValues(char* dataValues) const;
/*! \overload
*/
void getValues(unsigned char* dataValues) const;
/*! \overload
*/
void getValues(signed char* dataValues) const;
/*! \overload
*/
void getValues(short* dataValues) const;
/*! \overload
*/
void getValues(int* dataValues) const;
/*! \overload
*/
void getValues(long* dataValues) const;
/*! \overload
*/
void getValues(float* dataValues) const;
/*! \overload
*/
void getValues(double* dataValues) const;
/*! \overload
*/
void getValues(unsigned short* dataValues) const;
/*! \overload
*/
void getValues(unsigned int* dataValues) const;
/*! \overload
*/
void getValues(long long* dataValues) const;
/*! \overload
*/
void getValues(unsigned long long* dataValues) const;
/*! \overload
*/
void getValues(char** dataValues) const;
/*! \overload
(The string variable does not need preallocating.)
*/
void getValues(std::string& dataValues) const;
/*!
Gets a netCDF attribute.
The user must ensure that the variable "dataValues" has sufficient space to hold the attribute.
\param dataValues On return contains the value of the attribute.
If the type of data values differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void getValues(void* dataValues) const;
/*! Returns true if this object is null (i.e. it has no contents); otherwise returns false. */
bool isNull() const {return nullObject;}
protected:
/*! assignment operator */
NcAtt& operator= (const NcAtt& rhs);
bool nullObject;
std::string myName;
int groupId;
int varId;
};
}
#endif

@ -1,158 +0,0 @@
#include "ncAtt.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include <vector>
#include <iostream>
using namespace std;
using namespace netCDF;
// destructor (defined even though it is virtual)
NcAtt::~NcAtt() {}
// assignment operator
NcAtt& NcAtt::operator=(const NcAtt& rhs)
{
if (&rhs != this) {
nullObject = rhs.nullObject;
myName = rhs.myName;
groupId = rhs.groupId;
varId =rhs.varId;
}
return *this;
}
// Constructor generates a null object.
NcAtt::NcAtt() :
nullObject(true)
{}
// Constructor for non-null instances.
NcAtt::NcAtt(bool nullObject):
nullObject(nullObject)
{}
// The copy constructor.
NcAtt::NcAtt(const NcAtt& rhs):
nullObject(rhs.nullObject),
myName(rhs.myName),
groupId(rhs.groupId),
varId(rhs.varId)
{}
// equivalence operator
bool NcAtt::operator==(const NcAtt & rhs) const
{
if(nullObject)
return nullObject == rhs.nullObject;
else
return myName == rhs.myName && groupId == rhs.groupId && varId == rhs.varId;
}
// != operator
bool NcAtt::operator!=(const NcAtt & rhs) const
{
return !(*this == rhs);
}
// Gets parent group.
netCDF::NcGroup NcAtt::getParentGroup() const {
return netCDF::NcGroup(groupId);
}
// Returns the attribute type.
NcType NcAtt::getNcType() const{
// get the attribute type identifier
// create an NcType called ncTmpwith this identifier
// get the NcType called ncTmp from a parent or current group.
// Gets the NcType object with a given name, searching up the tree until the object is found.
groupId;
cout <<"groupID ="<<groupId<<endl;
NcGroup tmpGroup(groupId);
NcType(tmpGroup,myName);
NcType(NcGroup(groupId),myName);
return netCDF::NcType(NcGroup(groupId),myName);
}
// Gets attribute length.
size_t NcAtt::getAttLength() const{
size_t lenp;
ncCheck(nc_inq_attlen(groupId, varId, myName.c_str(), &lenp),__FILE__,__LINE__,__FUNCTION__);
return lenp;
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(char* dataValues) const {
ncCheck(nc_get_att_text(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned char* dataValues) const {
ncCheck(nc_get_att_uchar(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(signed char* dataValues) const {
ncCheck(nc_get_att_schar(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(short* dataValues) const {
ncCheck(nc_get_att_short(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(int* dataValues) const {
ncCheck(nc_get_att_int(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(long* dataValues) const {
ncCheck(nc_get_att_long(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(float* dataValues) const {
ncCheck(nc_get_att_float(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(double* dataValues) const {
ncCheck(nc_get_att_double(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned short* dataValues) const {
ncCheck(nc_get_att_ushort(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned int* dataValues) const {
ncCheck(nc_get_att_uint(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(long long* dataValues) const {
ncCheck(nc_get_att_longlong(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(unsigned long long* dataValues) const {
ncCheck(nc_get_att_ulonglong(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(char** dataValues) const {
ncCheck(nc_get_att_string(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}
// Gets a netCDF variable attribute.
void NcAtt::getValues(void* dataValues) const {
ncCheck(nc_get_att(groupId,varId,myName.c_str(),dataValues),__FILE__,__LINE__,__FUNCTION__);
}

@ -1,24 +0,0 @@
#include "ncByte.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcByte called netCDF::ncByte
namespace netCDF {
NcByte ncByte;
}
// constructor
NcByte::NcByte() : NcType(NC_BYTE){
}
NcByte::~NcByte() {
}
int NcByte::sizeoff(){char a;return sizeof(a);};
// equivalence operator
bool NcByte::operator==(const NcByte & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,30 +0,0 @@
#include "ncType.h"
#ifndef NcByteClass
#define NcByteClass
namespace netCDF
{
/*! Class represents a netCDF atomic Byte type. */
class NcByte : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcByte & rhs);
/*! storage size */
int sizeoff();
~NcByte();
/*! Constructor */
NcByte();
};
/*! A global instance of the NcByte class within the netCDF namespace. */
extern NcByte ncByte;
}
#endif

@ -1,22 +0,0 @@
#include "ncChar.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcChar called netCDF::ncChar
namespace netCDF {
NcChar ncChar;
}
// constructor
NcChar::NcChar() : NcType(NC_CHAR){
}
NcChar::~NcChar() {
}
// equivalence operator
bool NcChar::operator==(const NcChar & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,27 +0,0 @@
#include "ncType.h"
#ifndef NcCharClass
#define NcCharClass
namespace netCDF
{
/*! Class represents a netCDF atomic Char type. */
class NcChar : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcChar & rhs);
~NcChar();
/*! Constructor */
NcChar();
};
/*! A global instance of the NcChar class within the netCDF namespace. */
extern NcChar ncChar;
}
#endif

@ -1,74 +0,0 @@
#include "netcdf.h"
#include <ncException.h>
using namespace std;
using namespace netCDF::exceptions;
// C++ API for netCDF4.
namespace netCDF
{
// function checks error code and if necessary throws appropriate exception.
void ncCheck(int retCode,char* file,int line){
switch(retCode) {
case NC_NOERR : return; /* No Error */
case NC_EBADID : throw NcBadId("Not a netcdf id",file,line);
case NC_ENFILE : throw NcNFile("Too many netcdfs open",file,line);
case NC_EEXIST : throw NcExist("netcdf file exists && NC_NOCLOBBER",file,line);
case NC_EINVAL : throw NcInvalidArg("Invalid Argument",file,line);
case NC_EPERM : throw NcInvalidWrite("Write to read only",file,line);
case NC_ENOTINDEFINE : throw NcNotInDefineMode("Operation not allowed in data mode",file,line);
case NC_EINDEFINE : throw NcInDefineMode("Operation not allowed in define mode",file,line);
case NC_EINVALCOORDS : throw NcInvalidCoords("Index exceeds dimension bound",file,line);
case NC_EMAXDIMS : throw NcMaxDims("NC_MAX_DIMS is exceeded",file,line);
case NC_ENAMEINUSE : throw NcNameInUse("String match to name in use",file,line);
case NC_ENOTATT : throw NcNotAtt("Attribute not found",file,line);
case NC_EMAXATTS : throw NcMaxAtts("NC_MAX_ATTRS exceeded",file,line);
case NC_EBADTYPE : throw NcBadType("Not a netcdf data type",file,line);
case NC_EBADDIM : throw NcBadDim("Invalid dimension id or name",file,line);
case NC_EUNLIMPOS : throw NcUnlimPos("NC_UNLIMITED is in the wrong index",file,line);
case NC_EMAXVARS : throw NcMaxVars("NC_MAX_VARS is exceeded",file,line);
case NC_ENOTVAR : throw NcNotVar("Variable is not found",file,line);
case NC_EGLOBAL : throw NcGlobal("Action prohibited on NC_GLOBAL varid",file,line);
case NC_ENOTNC : throw NcNotNCF("Not a netcdf file",file,line);
case NC_ESTS : throw NcSts("In Fortran, string too short",file,line);
case NC_EMAXNAME : throw NcMaxName("NC_MAX_NAME exceeded",file,line);
case NC_EUNLIMIT : throw NcUnlimit("NC_UNLIMITED size already in use",file,line);
case NC_ENORECVARS : throw NcNoRecVars("nc_rec op when there are no record vars",file,line);
case NC_ECHAR : throw NcChar("Attempt to convert between text & numbers",file,line);
case NC_EEDGE : throw NcEdge("Edge+start exceeds dimension bound",file,line);
case NC_ESTRIDE : throw NcStride("Illegal stride",file,line);
case NC_EBADNAME : throw NcBadName("Attribute or variable name contains illegal characters",file,line);
case NC_ERANGE : throw NcRange("Math result not representable",file,line);
case NC_ENOMEM : throw NcNoMem("Memory allocation (malloc) failure",file,line);
case NC_EVARSIZE : throw NcVarSize("One or more variable sizes violate format constraints",file,line);
case NC_EDIMSIZE : throw NcDimSize("Invalid dimension size",file,line);
case NC_ETRUNC : throw NcTrunc("File likely truncated or possibly corrupted",file,line);
// The following are specific netCDF4 errors.
case NC_EHDFERR : throw NcHdfErr("An error was reported by the HDF5 layer.",file,line);
case NC_ECANTREAD : throw NcCantRead("Cannot Read",file,line);
case NC_ECANTWRITE : throw NcCantWrite("Cannott write",file,line);
case NC_ECANTCREATE : throw NcCantCreate("Cannot create",file,line);
case NC_EFILEMETA : throw NcFileMeta("File meta",file,line);
case NC_EDIMMETA : throw NcDimMeta("dim meta",file,line);
case NC_EATTMETA : throw NcAttMeta("att meta",file,line);
case NC_EVARMETA : throw NcVarMeta("var meta",file,line);
case NC_ENOCOMPOUND : throw NcNoCompound("No compound",file,line);
case NC_EATTEXISTS : throw NcAttExists("Attribute exists",file,line);
case NC_ENOTNC4 : throw NcNotNc4("Attempting netcdf-4 operation on netcdf-3 file.",file,line);
case NC_ESTRICTNC3 : throw NcStrictNc3("Attempting netcdf-4 operation on strict nc3 netcdf-4 file.",file,line);
case NC_EBADGRPID : throw NcBadGroupId("Bad group id.",file,line);
case NC_EBADTYPID : throw NcBadTypeId("Bad type id.",file,line); // netcdf.h file inconsistent with documentation!!
case NC_EBADFIELD : throw NcBadFieldId("Bad field id.",file,line); // netcdf.h file inconsistent with documentation!!
// case NC_EUNKNAME : throw NcUnkownName("Cannot find the field id.",file,line); // netcdf.h file inconsistent with documentation!!
case NC_ENOGRP : throw NcEnoGrp("No netCDF group found",file,line);
case NC_ELATEDEF : throw NcElateDef("Operation to set the deflation, chunking, endianness, fill, compression, or checksum of a NcVar object has been made after a call to getVar or putVar."
,file,line);
default:
throw NcException("NcException","Unknown error",file,line);
}
}
}

@ -1,20 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifndef NcCheckFunction
#define NcCheckFunction
namespace netCDF
{
/*!
Function checks error code and if necessary throws an exception.
\param retCode Integer value returned by %netCDF C-routines.
\param file The name of the file from which this call originates.
\param line The line number in the file from which this call originates.
*/
void ncCheck(int retCode,char* file,int line);
};
#endif

@ -1,145 +0,0 @@
#include "ncGroup.h"
#include "ncCheck.h"
#include "ncCompoundType.h"
#include "ncByte.h"
#include "ncUbyte.h"
#include "ncChar.h"
#include "ncShort.h"
#include "ncUshort.h"
#include "ncInt.h"
#include "ncUint.h"
#include "ncInt64.h"
#include "ncUint64.h"
#include "ncFloat.h"
#include "ncDouble.h"
#include "ncString.h"
#include "ncException.h"
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;
// Class represents a netCDF variable.
// assignment operator
NcCompoundType& NcCompoundType::operator=(const NcCompoundType& rhs)
{
NcType::operator=(rhs); // assign base class parts
return *this;
}
// assignment operator
NcCompoundType& NcCompoundType::operator=(const NcType& rhs)
{
if (&rhs != this) {
// check the rhs is the base of a Compound type
if(getTypeClass() != nc_COMPOUND) throw NcException("NcException","The NcType object must be the base of a Compound type.",__FILE__,__LINE__);
// assign base class parts
NcType::operator=(rhs);
}
return *this;
}
// The copy constructor.
NcCompoundType::NcCompoundType(const NcCompoundType& rhs):
NcType(rhs)
{
}
// equivalence operator
bool NcCompoundType::operator==(const NcCompoundType& rhs)
{
if(nullObject)
return nullObject == rhs.nullObject;
else
return myId ==rhs.myId && groupId == rhs.groupId;
}
// Constructor generates a null object.
NcCompoundType::NcCompoundType() :
NcType() // invoke base class constructor
{}
// constructor
NcCompoundType::NcCompoundType(const NcGroup& grp, const string& name):
NcType(grp,name)
{
}
// Inserts a named field.
void NcCompoundType::addMember(const string& memberName, const NcType& newMemberType,size_t offset)
{
ncCheck(nc_insert_compound(groupId,myId,const_cast<char*>(memberName.c_str()),offset,newMemberType.getId()),__FILE__,__LINE__);
}
// Inserts a named array field.
void NcCompoundType::addMember(const string& memberName, const NcType& newMemberType, size_t offset, const vector<int>& shape)
{
ncCheck(nc_insert_array_compound(groupId, myId,const_cast<char*>(memberName.c_str()), offset, newMemberType.getId(), shape.size(), const_cast<int*>(&shape[0])),__FILE__,__LINE__);
}
// Returns number of members in this NcCompoundType object.
size_t NcCompoundType::getMemberCount() const
{
size_t nfieldsp;
ncCheck(nc_inq_compound_nfields(groupId,myId,&nfieldsp),__FILE__,__LINE__);
return nfieldsp;
}
// Returns a NcType object for a single member. */
NcType NcCompoundType::getMember(int memberIndex) const
{
nc_type fieldtypeidp;
ncCheck(nc_inq_compound_fieldtype(groupId,myId,memberIndex,&fieldtypeidp),__FILE__,__LINE__);
switch (fieldtypeidp) {
case NC_BYTE : return ncByte;
case NC_UBYTE : return ncUbyte;
case NC_CHAR : return ncChar;
case NC_SHORT : return ncShort;
case NC_USHORT : return ncUshort;
case NC_INT : return ncInt;
case NC_UINT : return ncUint;
case NC_INT64 : return ncInt64;
case NC_UINT64 : return ncUint64;
case NC_FLOAT : return ncFloat;
case NC_DOUBLE : return ncDouble;
case NC_STRING : return ncString;
default:
// this is a user defined type
return NcType(getParentGroup(),fieldtypeidp);
}
}
// Returns the number of dimensions of a member with the given index.
int NcCompoundType::getMemberDimCount(int memberIndex) const
{
int ndimsp;
ncCheck(nc_inq_compound_fieldndims(groupId,myId,memberIndex, &ndimsp),__FILE__,__LINE__);
return ndimsp;
}
// Returns the shape of the given member.
vector<int> NcCompoundType::getMemberShape(int memberIndex) const
{
vector<int> dim_size;
dim_size.resize(getMemberDimCount(memberIndex));
ncCheck(nc_inq_compound_fielddim_sizes(groupId,myId,memberIndex,&dim_size[0]),__FILE__,__LINE__);
return dim_size;
}
// Returns the offset of the member with given index.
size_t NcCompoundType::getMemberOffset(const int index) const
{
size_t offsetp;
ncCheck(nc_inq_compound_fieldoffset(groupId,myId, index,&offsetp),__FILE__,__LINE__);
return offsetp;
}

@ -1,113 +0,0 @@
#include <string>
#include <vector>
#include "ncType.h"
#include "netcdf.h"
#ifndef NcCompoundTypeClass
#define NcCompoundTypeClass
namespace netCDF
{
class NcGroup; // forward declaration.
/*!
Class represents a netCDF compound type
*/
class NcCompoundType : public NcType
{
public:
/*! Constructor generates a \ref isNull "null object". */
NcCompoundType();
/*!
Constructor.
The compound Type must already exist in the netCDF file. New netCDF compound types can be
added using NcGroup::addNcCompoundType();
\param grp The parent group where this type is defined.
\param name Name of new type.
*/
NcCompoundType(const NcGroup& grp, const std::string& name);
/*!
Constructor.
Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of a Compound type.
\param ncType A Nctype object.
*/
NcCompoundType(const NcType& ncType);
/*! assignment operator */
NcCompoundType& operator=(const NcCompoundType& rhs);
/*!
Assignment operator.
This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of a Compound type.
*/
NcCompoundType& operator=(const NcType& rhs);
/*! The copy constructor. */
NcCompoundType(const NcCompoundType& rhs);
/*! equivalence operator */
bool operator==(const NcCompoundType & rhs);
/*! destructor */
~NcCompoundType(){;}
/*!
Adds a named field.
\param memName Name of new field.
\param newMemberType The type of the new member.
\param offset Offset of this member in bytes, obtained by a call to offsetof. For example
the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4).
*/
void addMember(const std::string& memName, const NcType& newMemberType,size_t offset);
/*!
Adds a named array field.
\param memName Name of new field.
\param newMemberType The type of the new member.
\param offset Offset of this member in bytes, obtained by a call to offsetof. For example
the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4).
\param shape The shape of the array field.
*/
void addMember(const std::string& memName, const NcType& newMemberType, size_t offset, const std::vector<int>& shape);
/*! Returns number of members in this NcCompoundType object. */
size_t getMemberCount() const;
/*! Returns a NcType object for a single member. */
NcType getMember(int memberIndex) const;
/*! Returns the offset of the member with given index. */
size_t getMemberOffset(const int index) const;
/*!
Returns the number of dimensions of a member with the given index.
\param Index of member (numbering starts at zero).
\return The number of dimensions of the field. Non-array fields have 0 dimensions.
*/
int getMemberDimCount(int memberIndex) const;
/*!
Returns the shape of a given member.
\param Index of member (numbering starts at zero).
\return The size of the dimensions of the field. Non-array fields have 0 dimensions.
*/
std::vector<int> getMemberShape(int memberIndex) const;
private:
int myOffset;
};
}
#endif

@ -1,116 +0,0 @@
#include "ncDim.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include <algorithm>
using namespace std;
namespace netCDF {
// Global comparator operator ==============
// comparator operator
bool operator<(const NcDim& lhs,const NcDim& rhs)
{
return false;
}
// comparator operator
bool operator>(const NcDim& lhs,const NcDim& rhs)
{
return true;
}
}
using namespace netCDF;
// assignment operator
NcDim& NcDim::operator=(const NcDim & rhs)
{
nullObject = rhs.nullObject;
myId = rhs.myId;
groupId = rhs.groupId;
return *this;
}
// The copy constructor.
NcDim::NcDim(const NcDim& rhs):
nullObject(rhs.nullObject),
myId(rhs.myId),
groupId(rhs.groupId)
{}
// equivalence operator
bool NcDim::operator==(const NcDim& rhs) const
{
if(nullObject)
return nullObject == rhs.nullObject;
else
return myId == rhs.myId && groupId == rhs.groupId;
}
// != operator
bool NcDim::operator!=(const NcDim & rhs) const
{
return !(*this == rhs);
}
// Gets parent group.
NcGroup NcDim::getParentGroup() const {
return NcGroup(groupId);
}
// Constructor generates a null object.
NcDim::NcDim() :
nullObject(true)
{}
// Constructor for a dimension (must already exist in the netCDF file.)
NcDim::NcDim(const NcGroup& grp, int dimId) :
nullObject(false)
{
groupId = grp.getId();
myId = dimId;
}
// gets the size of the dimension, for unlimited, this is the current number of records.
size_t NcDim::getSize() const
{
size_t dimSize;
ncCheck(nc_inq_dimlen(groupId, myId, &dimSize),__FILE__,__LINE__);
return dimSize;
}
// returns true if this dimension is unlimited.
bool NcDim::isUnlimited() const
{
int numlimdims;
int* unlimdimidsp=NULL;
// get the number of unlimited dimensions
ncCheck(nc_inq_unlimdims(groupId,&numlimdims,unlimdimidsp),__FILE__,__LINE__);
// get all the unlimited dimension ids in this group
vector<int> unlimdimid(numlimdims);
ncCheck(nc_inq_unlimdims(groupId,&numlimdims,&unlimdimid[0]),__FILE__,__LINE__);
vector<int>::iterator it;
// now look to see if this dimension is unlimited
it = find(unlimdimid.begin(),unlimdimid.end(),myId);
return it != unlimdimid.end();
}
// gets the name of the dimension.
const string NcDim::getName() const
{
char dimName[NC_MAX_NAME+1];
ncCheck(nc_inq_dimname(groupId, myId, dimName),__FILE__,__LINE__);
return string(dimName);
}
// renames this dimension.
void NcDim::rename(const string& name)
{
ncCheck(nc_rename_dim(groupId, myId, name.c_str()),__FILE__,__LINE__);
}

@ -1,84 +0,0 @@
#include <string>
#include "netcdf.h"
#ifndef NcDimClass
#define NcDimClass
namespace netCDF
{
class NcGroup; // forward declaration.
/*! Class represents a netCDF dimension */
class NcDim {
public:
/*! destructor*/
~NcDim(){};
/*! Constructor generates a \ref isNull "null object". */
NcDim ();
/*!
Constructor for a dimension .
The dimension must already exist in the netCDF file. New netCDF variables can be added using NcGroup::addNcDim();
\param grp Parent NcGroup object.
\param dimId Id of the NcDim object.
*/
NcDim(const NcGroup& grp, int dimId);
/*! assignment operator */
NcDim& operator =(const NcDim &);
/*! equivalence operator */
bool operator==(const NcDim& rhs) const;
/*! != operator */
bool operator!=(const NcDim& rhs) const;
/*! The copy constructor. */
NcDim(const NcDim& ncDim);
/*! The name of this dimension.*/
const std::string getName() const;
/*! The netCDF Id of this dimension. */
const int getId() const {return myId;};
/*! Gets a NcGroup object of the parent group. */
NcGroup getParentGroup() const;
/*! Returns true if this is an unlimited dimension */
bool isUnlimited() const;
/*! The size of the dimension; for unlimited, this is the number of records written so far. */
size_t getSize() const;
/*!renames the dimension */
void rename( const std::string& newName);
/*! Returns true if this object is null (i.e. it has no contents); otherwise returns false. */
bool isNull() const {return nullObject;}
/*! comparator operator */
friend bool operator<(const NcDim& lhs,const NcDim& rhs);
/*! comparator operator */
friend bool operator>(const NcDim& lhs,const NcDim& rhs);
private:
bool nullObject;
int myId;
int groupId;
};
}
#endif

@ -1,22 +0,0 @@
#include "ncDouble.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcDouble called netCDF::ncDouble
namespace netCDF {
NcDouble ncDouble;
}
// constructor
NcDouble::NcDouble() : NcType(NC_DOUBLE){
}
NcDouble::~NcDouble() {
}
// equivalence operator
bool NcDouble::operator==(const NcDouble & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,28 +0,0 @@
#include "ncType.h"
#ifndef NcDoubleClass
#define NcDoubleClass
namespace netCDF
{
/*! Class represents a netCDF atomic Double type. */
class NcDouble : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcDouble & rhs);
/*! destructor */
~NcDouble();
/*! Constructor */
NcDouble();
};
/*! A global instance of the NcDouble class within the netCDF namespace. */
extern NcDouble ncDouble;
}
#endif

@ -1,112 +0,0 @@
#include "ncEnumType.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include "ncByte.h"
#include "ncUbyte.h"
#include "ncChar.h"
#include "ncShort.h"
#include "ncUshort.h"
#include "ncInt.h"
#include "ncUint.h"
#include "ncInt64.h"
#include "ncUint64.h"
#include "ncFloat.h"
#include "ncDouble.h"
#include "ncString.h"
#include "ncException.h"
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;
// Class represents a netCDF variable.
// assignment operator
NcEnumType& NcEnumType::operator=(const NcEnumType& rhs)
{
NcType::operator=(rhs); // assign base class parts
return *this;
}
// assignment operator
NcEnumType& NcEnumType::operator=(const NcType& rhs)
{
if (&rhs != this) {
// check the rhs is the base of an Enum type
if(getTypeClass() != NC_ENUM) throw NcException("NcException","The NcType object must be the base of an Enum type.",__FILE__,__LINE__);
// assign base class parts
NcType::operator=(rhs);
}
return *this;
}
// The copy constructor.
NcEnumType::NcEnumType(const NcEnumType& rhs):
NcType(rhs)
{
}
// Constructor generates a null object.
NcEnumType::NcEnumType() :
NcType() // invoke base class constructor
{}
// constructor
NcEnumType::NcEnumType(const NcGroup& grp, const string& name):
NcType(grp,name)
{}
// constructor
NcEnumType::NcEnumType(const NcType& ncType):
NcType(ncType)
{
// check the nctype object is the base of an Enum type
if(getTypeClass() != NC_ENUM) throw NcException("NcException","The NcType object must be the base of an Enum type.",__FILE__,__LINE__);
}
// Returns the base type.
NcType NcEnumType::getBaseType() const
{
char charName[NC_MAX_NAME+1];
nc_type base_nc_typep;
size_t *base_sizep=NULL;
size_t *num_membersp=NULL;
ncCheck(nc_inq_enum(groupId,myId,charName,&base_nc_typep,base_sizep,num_membersp),__FILE__,__LINE__);
switch (base_nc_typep) {
case NC_BYTE : return ncByte;
case NC_UBYTE : return ncUbyte;
case NC_CHAR : return ncChar;
case NC_SHORT : return ncShort;
case NC_USHORT : return ncUshort;
case NC_INT : return ncInt;
case NC_UINT : return ncUint;
case NC_INT64 : return ncInt64;
case NC_UINT64 : return ncUint64;
case NC_FLOAT : return ncFloat;
case NC_DOUBLE : return ncDouble;
case NC_STRING : return ncString;
default:
// this is a user defined type
return NcType(getParentGroup(),base_nc_typep);
}
}
// Returns number of members in this NcEnumType object.
size_t NcEnumType::getMemberCount() const{
char charName[NC_MAX_NAME+1];
nc_type* base_nc_typep=NULL;
size_t* base_sizep=NULL;
size_t num_membersp;
ncCheck(nc_inq_enum(groupId,myId,charName,base_nc_typep,base_sizep,&num_membersp),__FILE__,__LINE__);
return num_membersp;
};
// Returns the member name for the given zero-based index.
string NcEnumType::getMemberNameFromIndex(int index) const{
void* value=NULL;
char charName[NC_MAX_NAME+1];
ncCheck(nc_inq_enum_member(groupId,myId,index,charName,value),__FILE__,__LINE__);
return static_cast<string> (charName);
};

@ -1,107 +0,0 @@
#include <string>
#include "ncType.h"
#include "netcdf.h"
#include "ncCheck.h"
#ifndef NcEnumTypeClass
#define NcEnumTypeClass
namespace netCDF
{
class NcGroup; // forward declaration.
/*! Class represents a netCDF enum type */
class NcEnumType : public NcType
{
public:
/*! List of NetCDF-4 Enumeration types.*/
enum ncEnumType {
nc_BYTE = NC_BYTE, //!< signed 1 byte integer
nc_SHORT = NC_SHORT, //!< signed 2 byte integer
nc_INT = NC_INT, //!< signed 4 byte integer
nc_UBYTE = NC_UBYTE, //!< unsigned 1 byte int
nc_USHORT = NC_USHORT, //!< unsigned 2-byte int
nc_UINT = NC_UINT, //!< unsigned 4-byte int
nc_INT64 = NC_INT64, //!< signed 8-byte int
nc_UINT64 = NC_UINT64 //!< unsigned 8-byte int
};
/*! Constructor generates a \ref isNull "null object". */
NcEnumType();
/*!
Constructor.
The enum Type must already exist in the netCDF file. New netCDF enum types can
be added using NcGroup::addNcEnumType();
\param grp The parent group where this type is defined.
\param name Name of new type.
*/
NcEnumType(const NcGroup& grp, const std::string& name);
/*!
Constructor.
Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of an Enum type.
\param ncType A Nctype object.
*/
NcEnumType(const NcType& ncType);
/*! assignment operator */
NcEnumType& operator=(const NcEnumType& rhs);
/*!
Assignment operator.
This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of an Enum type.
*/
NcEnumType& operator=(const NcType& rhs);
/*! The copy constructor. */
NcEnumType(const NcEnumType& rhs);
/*! Destructor */
~NcEnumType(){}
/*!
Adds a new member to this NcEnumType type.
\param name Name for this new Enum memebr.
\param memberValue Member value, must be of the correct NcType.
*/
template <class T> void addMember(const std::string& name, T memberValue)
{
ncCheck(nc_insert_enum(groupId, myId, name.c_str(), (void*) &memberValue),__FILE__,__LINE__);
}
/*! Returns number of members in this NcEnumType object. */
size_t getMemberCount() const;
/*! Returns the member name for the given zero-based index. */
std::string getMemberNameFromIndex(int index) const;
/*! Returns the member name for the given NcEnumType value. */
template <class T> std::string getMemberNameFromValue(const T memberValue) const {
char charName[NC_MAX_NAME+1];
ncCheck(nc_inq_enum_ident(groupId,myId,static_cast<long long>(memberValue),charName),__FILE__,__LINE__);
return std::string(charName);
}
/*!
Returns the value of a member with the given zero-based index.
\param name Name for this new Enum member.
\param memberValue Member value, returned by this routine.
*/
template <class T> void getMemberValue(int index, T& memberValue) const
{
char* charName=NULL;
ncCheck(nc_inq_enum_member(groupId,myId,index,charName,&memberValue),__FILE__,__LINE__);
}
/*! Returns the base type. */
NcType getBaseType() const;
};
}
#endif

@ -1,236 +0,0 @@
#include <ncException.h>
#include <sstream>
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;
// Default object thrown if a netCDF exception is encountered.
NcException::NcException(const string& exceptionNameIn,const string& complaintIn,const char* fileNameIn,int lineNumberIn)
:exceptionName(exceptionNameIn), complaint(complaintIn),fileName(fileNameIn), lineNumber(lineNumberIn)
{}
NcException::~NcException()throw() {}
const char* NcException::what() const throw()
{
std::ostringstream oss;
oss << lineNumber;
string message(exceptionName+": "+complaint+"\nfile: "+fileName+" line:"+oss.str());
return message.c_str();
}
// Thrown if the specified netCDF ID does not refer to an open netCDF dataset.
NcBadId::NcBadId(const string& complaint,const char* file,int line) :
NcException("NcBadId",complaint,file,line) { }
// Thrown if too many netcdf files are open.
NcNFile::NcNFile(const string& complaint,const char* file,int line) :
NcException("NcFile",complaint,file,line) { }
// Thrown if, having set NC_NOCLOBBER, the specified dataset already exists.
NcExist::NcExist(const string& complaint,const char* file,int line) :
NcException("NcExist",complaint,file,line) { }
// Thrown if not a netCDF id.
NcInvalidArg::NcInvalidArg(const string& complaint,const char* file,int line) :
NcException("NcInvalidArg",complaint,file,line) { }
// Thrown if invalid argument.
NcInvalidWrite::NcInvalidWrite(const string& complaint,const char* file,int line) :
NcException("NcInvalidWrite",complaint,file,line) { }
// Thrown if operation not allowed in data mode.
NcNotInDefineMode::NcNotInDefineMode(const string& complaint,const char* file,int line) :
NcException("NcNotIndDefineMode",complaint,file,line) { }
// Thrown if operation not allowed in defined mode.
NcInDefineMode::NcInDefineMode(const string& complaint,const char* file,int line) :
NcException("NcInDefineMode",complaint,file,line) { }
// Index exceeds dimension bound
NcInvalidCoords::NcInvalidCoords(const string& complaint,const char* file,int line) :
NcException("NcInvalidCoords",complaint,file,line) { }
// Thrown if NC_MAX_DIMS is exceeded.
NcMaxDims::NcMaxDims(const string& complaint,const char* file,int line) :
NcException("NcMaxDims",complaint,file,line) { }
// Thrown if string match to name is in use.
NcNameInUse::NcNameInUse(const string& complaint,const char* file,int line) :
NcException("NcNameInUse",complaint,file,line) { }
// Thrown if attribute is not found.
NcNotAtt::NcNotAtt(const string& complaint,const char* file,int line) :
NcException("NcNotAtt",complaint,file,line) { }
// Thrown if Nc_MAX_ATTRS is exceeded.
NcMaxAtts::NcMaxAtts(const string& complaint,const char* file,int line) :
NcException("NcMaxAtts",complaint,file,line) { }
// Thrown if not a valid netCDF data type.
NcBadType::NcBadType(const string& complaint,const char* file,int line) :
NcException("NcBadType",complaint,file,line) { }
// Thrown if an invalid dimension id or name.
NcBadDim::NcBadDim(const string& complaint,const char* file,int line) :
NcException("NcBadDim",complaint,file,line) { }
// Thrown if Nc_UNLIMITED is in the wrong index.
NcUnlimPos::NcUnlimPos(const string& complaint,const char* file,int line) :
NcException("NcUnlimPos",complaint,file,line) { }
// Thrown if NC_MAX_VARS is exceeded.
NcMaxVars::NcMaxVars(const string& complaint,const char* file,int line) :
NcException("NcMaxVars",complaint,file,line) { }
// Thrown if variable is not found.
NcNotVar::NcNotVar(const string& complaint,const char* file,int line) :
NcException("NcNotVar",complaint,file,line) { }
// Thrown if the action is prohibited on the NC_GLOBAL varid.
NcGlobal::NcGlobal(const string& complaint,const char* file,int line) :
NcException("NcGlobal",complaint,file,line) { }
// Thrown if not a netCDF file.
NcNotNCF::NcNotNCF(const string& complaint,const char* file,int line) :
NcException("NcNotNCF",complaint,file,line) { }
// Thrown if in FORTRAN, string is too short.
NcSts::NcSts(const string& complaint,const char* file,int line) :
NcException("NcSts",complaint,file,line) { }
// Thrown if NC_MAX_NAME is exceeded.
NcMaxName::NcMaxName(const string& complaint,const char* file,int line) :
NcException("NcMaxName",complaint,file,line) { }
// Thrown if NC_UNLIMITED size is already in use.
NcUnlimit::NcUnlimit(const string& complaint,const char* file,int line) :
NcException("NcUnlimit",complaint,file,line) { }
// Thrown if nc_rec op when there are no record vars.
NcNoRecVars::NcNoRecVars(const string& complaint,const char* file,int line) :
NcException("NcNoRecVars",complaint,file,line) { }
// Thrown if attempt to convert between text and numbers.
NcChar::NcChar(const string& complaint,const char* file,int line) :
NcException("NcChar",complaint,file,line) { }
// Thrown if edge+start exceeds dimension bound.
NcEdge::NcEdge(const string& complaint,const char* file,int line) :
NcException("NcEdge",complaint,file,line) { }
// Thrown if illegal stride.
NcStride::NcStride(const string& complaint,const char* file,int line) :
NcException("NcStride",complaint,file,line) { }
// Thrown if attribute or variable name contains illegal characters.
NcBadName::NcBadName(const string& complaint,const char* file,int line) :
NcException("NcBadName",complaint,file,line) { }
// Thrown if math result not representable.
NcRange::NcRange(const string& complaint,const char* file,int line) :
NcException("NcRange",complaint,file,line) { }
// Thrown if memory allocation (malloc) failure.
NcNoMem::NcNoMem(const string& complaint,const char* file,int line) :
NcException("NcNoMem",complaint,file,line) { }
// Thrown if one or more variable sizes violate format constraints
NcVarSize::NcVarSize(const string& complaint,const char* file,int line) :
NcException("NcVarSize",complaint,file,line) { }
// Thrown if invalid dimension size.
NcDimSize::NcDimSize(const string& complaint,const char* file,int line) :
NcException("NcDimSize",complaint,file,line) { }
// Thrown if file likely truncated or possibly corrupted.
NcTrunc::NcTrunc(const string& complaint,const char* file,int line) :
NcException("NcTrunc",complaint,file,line) { }
// Thrown if an error was reported by the HDF5 layer.
NcHdfErr::NcHdfErr(const string& complaint,const char* file,int line) :
NcException("NcHdfErr",complaint,file,line) { }
// Thrown if cannot read.
NcCantRead::NcCantRead(const string& complaint,const char* file,int line) :
NcException("NcCantRead",complaint,file,line) { }
// Thrown if cannot write.
NcCantWrite::NcCantWrite(const string& complaint,const char* file,int line) :
NcException("NcCantWrite",complaint,file,line) { }
// Thrown if cannot create.
NcCantCreate::NcCantCreate(const string& complaint,const char* file,int line) :
NcException("NcCantCreate",complaint,file,line) { }
// Thrown if file meta.
NcFileMeta::NcFileMeta(const string& complaint,const char* file,int line) :
NcException("NcFileMeta",complaint,file,line) { }
// Thrown if dim meta.
NcDimMeta::NcDimMeta(const string& complaint,const char* file,int line) :
NcException("NcDimMeta",complaint,file,line) { }
// Thrown if attribute meta.
NcAttMeta::NcAttMeta(const string& complaint,const char* file,int line) :
NcException("NcAttMeta",complaint,file,line) { }
// Thrown if variable meta.
NcVarMeta::NcVarMeta(const string& complaint,const char* file,int line) :
NcException("NcVarMeta",complaint,file,line) { }
// Thrown if no compound.
NcNoCompound::NcNoCompound(const string& complaint,const char* file,int line) :
NcException("NcNoCompound",complaint,file,line) { }
// Thrown if attribute exists.
NcAttExists::NcAttExists(const string& complaint,const char* file,int line) :
NcException("NcAttExists",complaint,file,line) { }
// Thrown if attempting netcdf-4 operation on netcdf-3 file.
NcNotNc4::NcNotNc4(const string& complaint,const char* file,int line) :
NcException("NcNotNc4",complaint,file,line) { }
// Thrown if attempting netcdf-4 operation on strict nc3 netcdf-4 file.
NcStrictNc3::NcStrictNc3(const string& complaint,const char* file,int line) :
NcException("NcStrictNc3",complaint,file,line) { }
// Thrown if bad group id.
NcBadGroupId::NcBadGroupId(const string& complaint,const char* file,int line) :
NcException("NcBadGroupId",complaint,file,line) { }
// Thrown if bad type id.
NcBadTypeId::NcBadTypeId(const string& complaint,const char* file,int line) :
NcException("NcBadTypeId",complaint,file,line) { }
// Thrown if bad field id.
NcBadFieldId::NcBadFieldId(const string& complaint,const char* file,int line) :
NcException("NcBadFieldId",complaint,file,line) { }
// Thrown if cannot find the field id.
NcUnknownName::NcUnknownName(const string& complaint,const char* file,int line) :
NcException("NcUnknownName",complaint,file,line) { }
// Thrown if cannot find the field id.
NcEnoGrp::NcEnoGrp(const string& complaint,const char* file,int line) :
NcException("NcEnoGrp",complaint,file,line) { }
// Thrown if cannot find the field id.
NcNullGrp::NcNullGrp(const string& complaint,const char* file,int line) :
NcException("NcNullGrp",complaint,file,line) { }
// Thrown if cannot find the field id.
NcNullDim::NcNullDim(const string& complaint,const char* file,int line) :
NcException("NcNullDim",complaint,file,line) { }
// Thrown if cannot find the field id.
NcNullType::NcNullType(const string& complaint,const char* file,int line) :
NcException("NcNullType",complaint,file,line) { }
// Thrown if an operation to set the deflation, chunking, endianness, fill, compression, or checksum of a NcVar object is issued after a call to NcVar::getVar or NcVar::putVar.
NcElateDef::NcElateDef(const string& complaint,const char* file,int line) :
NcException("NcElateDef",complaint,file,line) { }

@ -1,432 +0,0 @@
#include <exception>
#include <string>
#include <iostream>
#ifndef NcExceptionClasses
#define NcExceptionClasses
namespace netCDF
{
//! Exception classes.
/*!
These exceptions are thrown if the netCDF-4 API encounters an error.
*/
namespace exceptions
{
/*!
Base object is thrown if a netCDF exception is encountered.
An unsatisfactory return from a call to one of the netCDF C-routines
generates an exception using an object inheriting this class. All other netCDF-related
errors including those originating in the C++ binding, generates an NcException.
*/
class NcException : public std::exception {
public:
NcException(const std::string& exceptionName,const std::string& complaint,const char* fileName,int lineNumber);
virtual ~NcException() throw();
const char* what() const throw();
private:
std::string exceptionName, complaint, fileName;
int lineNumber;
};
/*! Thrown if the specified netCDF ID does not refer to an open netCDF dataset. */
class NcBadId : public NcException
{
public:
NcBadId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if too many netcdf files are open. */
class NcNFile : public NcException
{
public:
NcNFile(const std::string& complaint,const char* file,int line);
};
/*! Thrown if, having set NC_NOCLOBBER, the specified dataset already exists. */
class NcExist : public NcException
{
public:
NcExist(const std::string& complaint,const char* file,int line);
};
/*! Thrown if not a netCDF id. */
class NcInvalidArg : public NcException
{
public:
NcInvalidArg(const std::string& complaint,const char* file,int line);
};
/*! Thrown if invalid argument. */
class NcInvalidWrite : public NcException
{
public:
NcInvalidWrite(const std::string& complaint,const char* file,int line);
};
/*! Thrown if operation not allowed in data mode. */
class NcNotInDefineMode : public NcException
{
public:
NcNotInDefineMode(const std::string& complaint,const char* file,int line);
};
/*! Thrown if operation not allowed in defined mode. */
class NcInDefineMode : public NcException
{
public:
NcInDefineMode(const std::string& complaint,const char* file,int line);
};
/*!
Index exceeds dimension bound.
Exception may be generated during operations to get or put netCDF variable data.
The exception is thrown if the specified indices were out of range for the rank of the
specified variable. For example, a negative index or an index that is larger than
the corresponding dimension length will cause an error.
*/
class NcInvalidCoords : public NcException
{
public:
NcInvalidCoords(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_MAX_DIMS is exceeded. */
class NcMaxDims : public NcException
{
public:
NcMaxDims(const std::string& complaint,const char* file,int line);
};
/*! Thrown if string match to name is in use. */
class NcNameInUse : public NcException
{
public:
NcNameInUse(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute is not found. */
class NcNotAtt : public NcException
{
public:
NcNotAtt(const std::string& complaint,const char* file,int line);
};
/*! Thrown if Nc_MAX_ATTRS is exceeded. */
class NcMaxAtts : public NcException
{
public:
NcMaxAtts(const std::string& complaint,const char* file,int line);
};
/*! Thrown if not a valid netCDF data type. */
class NcBadType : public NcException
{
public:
NcBadType(const std::string& complaint,const char* file,int line);
};
/*! Thrown if an invalid dimension id or name. */
class NcBadDim : public NcException
{
public:
NcBadDim(const std::string& complaint,const char* file,int line);
};
/*! Thrown if Nc_UNLIMITED is in the wrong index. */
class NcUnlimPos : public NcException
{
public:
NcUnlimPos(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_MAX_VARS is exceeded. */
class NcMaxVars : public NcException
{
public:
NcMaxVars(const std::string& complaint,const char* file,int line);
};
/*! Thrown if variable is not found. */
class NcNotVar : public NcException
{
public:
NcNotVar(const std::string& complaint,const char* file,int line);
};
/*! Thrown if the action is prohibited on the NC_GLOBAL varid. */
class NcGlobal : public NcException
{
public:
NcGlobal(const std::string& complaint,const char* file,int line);
};
/*! Thrown if not a netCDF file. */
class NcNotNCF : public NcException
{
public:
NcNotNCF(const std::string& complaint,const char* file,int line);
};
/*! Thrown if in FORTRAN, string is too short. */
class NcSts : public NcException
{
public:
NcSts(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_MAX_NAME is exceeded. */
class NcMaxName : public NcException
{
public:
NcMaxName(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_UNLIMITED size is already in use. */
class NcUnlimit : public NcException
{
public:
NcUnlimit(const std::string& complaint,const char* file,int line);
};
/*! Thrown if nc_rec op when there are no record vars. */
class NcNoRecVars : public NcException
{
public:
NcNoRecVars(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attempt to convert between text and numbers. */
class NcChar : public NcException
{
public:
NcChar(const std::string& complaint,const char* file,int line);
};
/*! Thrown if edge+start exceeds dimension bound. */
class NcEdge : public NcException
{
public:
NcEdge(const std::string& complaint,const char* file,int line);
};
/*! Thrown if illegal stride. */
class NcStride : public NcException
{
public:
NcStride(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute or variable name contains illegal characters. */
class NcBadName : public NcException
{
public:
NcBadName(const std::string& complaint,const char* file,int line);
};
/*! Thrown if math result not representable. */
class NcRange : public NcException
{
public:
NcRange(const std::string& complaint,const char* file,int line);
};
/*! Thrown if memory allocation (malloc) failure. */
class NcNoMem : public NcException
{
public:
NcNoMem(const std::string& complaint,const char* file,int line);
};
/*! Thrown if one or more variable sizes violate format constraints */
class NcVarSize : public NcException
{
public:
NcVarSize(const std::string& complaint,const char* file,int line);
};
/*! Thrown if invalid dimension size. */
class NcDimSize : public NcException
{
public:
NcDimSize(const std::string& complaint,const char* file,int line);
};
/*! Thrown if file likely truncated or possibly corrupted. */
class NcTrunc : public NcException
{
public:
NcTrunc(const std::string& complaint,const char* file,int line);
};
/*! Thrown if an error was reported by the HDF5 layer. */
class NcHdfErr : public NcException
{
public:
NcHdfErr(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot read. */
class NcCantRead : public NcException
{
public:
NcCantRead(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot write. */
class NcCantWrite : public NcException
{
public:
NcCantWrite(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot create. */
class NcCantCreate : public NcException
{
public:
NcCantCreate(const std::string& complaint,const char* file,int line);
};
/*! Thrown if file meta. */
class NcFileMeta : public NcException
{
public:
NcFileMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if dim meta. */
class NcDimMeta : public NcException
{
public:
NcDimMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute meta. */
class NcAttMeta : public NcException
{
public:
NcAttMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if variable meta. */
class NcVarMeta : public NcException
{
public:
NcVarMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if no compound. */
class NcNoCompound : public NcException
{
public:
NcNoCompound(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute exists. */
class NcAttExists : public NcException
{
public:
NcAttExists(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attempting netcdf-4 operation on netcdf-3 file. */
class NcNotNc4 : public NcException
{
public:
NcNotNc4(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attempting netcdf-4 operation on strict nc3 netcdf-4 file. */
class NcStrictNc3 : public NcException
{
public:
NcStrictNc3(const std::string& complaint,const char* file,int line);
};
/*! Thrown if bad group id. */
class NcBadGroupId : public NcException
{
public:
NcBadGroupId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if bad type id. */
class NcBadTypeId : public NcException
{
public:
NcBadTypeId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if bad field id. */
class NcBadFieldId : public NcException
{
public:
NcBadFieldId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot find the field id. */
class NcUnknownName : public NcException
{
public:
NcUnknownName(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot return a netCDF group. */
class NcEnoGrp : public NcException
{
public:
NcEnoGrp(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if the requested operation is on a NULL group.
This exception is thrown if an operation on a NcGroup object is requested which is empty. To test if the object is empty used NcGroup::isNull()
*/
class NcNullGrp : public NcException
{
public:
NcNullGrp(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if the requested operation is on a NULL type.
This exception is thrown if an operation on a NcType object is requested which is empty. To test if the object is empty used NcType::isNull()
*/
class NcNullType : public NcException
{
public:
NcNullType(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if the requested operation is on a NULL dimension.
This exception is thrown if an operation on a NcDim object is requested which is empty. To test if the object is empty used NcDim::isNull()
*/
class NcNullDim : public NcException
{
public:
NcNullDim(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if an operation to set the chunking, endianness, fill of a NcVar object is issued after a
call to NcVar::getVar or NcVar::putVar has been made.
*/
class NcElateDef : public NcException
{
public:
NcElateDef(const std::string& complaint,const char* file,int line);
};
}
}
#endif

@ -1,92 +0,0 @@
#include "ncFile.h"
#include "ncCheck.h"
#include "ncException.h"
#include "ncByte.h"
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;
// destructor
NcFile::~NcFile()
{
ncCheck(nc_close(myId),__FILE__,__LINE__);
}
// assignment operator
NcFile& NcFile::operator=(const NcGroup & rhs)
{
NcGroup::operator=(rhs); // assign base class parts
return *this;
}
//! The copy constructor.
NcFile::NcFile(const NcGroup& rhs):
NcGroup(rhs) // intialize base class parts
{}
// Constructor generates a null object.
NcFile::NcFile() :
NcGroup() // invoke base class constructor
{}
// constructor
NcFile::NcFile(const string& filePath, const FileMode fMode)
{
switch (fMode)
{
case NcFile::write:
ncCheck(nc_open(filePath.c_str(), NC_WRITE, &myId),__FILE__,__LINE__);
break;
case NcFile::read:
ncCheck(nc_open(filePath.c_str(), NC_NOWRITE, &myId),__FILE__,__LINE__);
break;
case NcFile::newFile:
ncCheck(nc_create(filePath.c_str(), NC_NETCDF4 | NC_NOCLOBBER, &myId),__FILE__,__LINE__);
break;
case NcFile::replace:
ncCheck(nc_create(filePath.c_str(), NC_NETCDF4 | NC_CLOBBER, &myId),__FILE__,__LINE__);
break;
}
nullObject=false;
}
// constructor with file type specified
NcFile::NcFile(const string& filePath, const FileMode fMode, const FileFormat fFormat )
{
int format;
switch (fFormat)
{
case NcFile::classic:
format = 0;
break;
case NcFile::classic64:
format = NC_64BIT_OFFSET;
break;
case NcFile::nc4:
format = NC_NETCDF4;
break;
case NcFile::nc4classic:
format = NC_NETCDF4 | NC_CLASSIC_MODEL;
break;
}
switch (fMode)
{
case NcFile::write:
ncCheck(NC_EINVAL,__FILE__,__LINE__);
break;
case NcFile::read:
ncCheck(NC_EINVAL,__FILE__,__LINE__);
break;
case NcFile::newFile:
ncCheck(nc_create(filePath.c_str(), format | NC_NOCLOBBER, &myId),__FILE__,__LINE__);
break;
case NcFile::replace:
ncCheck(nc_create(filePath.c_str(), format | NC_CLOBBER, &myId),__FILE__,__LINE__);
break;
}
nullObject=false;
}

@ -1,79 +0,0 @@
#include <string>
#include "ncGroup.h"
#include "netcdf.h"
#ifndef NcFileClass
#define NcFileClass
//! C++ API for netCDF4.
namespace netCDF
{
/*!
Class represents a netCDF root group.
The Ncfile class is the same as the NcGroup class with the additional functionality for opening
and closing files.
*/
class NcFile : public NcGroup
{
public:
enum FileMode
{
read, //!< File exists, open read-only.
write, //!< File exists, open for writing.
replace, //!< Create new file, even if already exists.
newFile //!< Create new file, fail if already exists.
};
enum FileFormat
{
classic, //!< Classic format, classic data model
classic64, //!< 64-bit offset format, classic data model
nc4, //!< (default) netCDF-4/HDF5 format, enhanced data model
nc4classic //!< netCDF-4/HDF5 format, classic data model
};
/*! assignment operator */
NcFile& operator =(const NcGroup & rhs);
/*!
The copy constructor. */
NcFile(const NcGroup& rhs);
/*! Constructor generates a \ref isNull "null object". */
NcFile();
/*!
Opens a netCDF file.
\param filePath Name of netCDF optional path.
\param fMode The file mode:
- 'read' File exists, open for read-only.
- 'write' File exists, open for writing.
- 'replace' Create new file, even it already exists.
- 'newFile' Create new file, fail it exists already.
*/
NcFile(const std::string& filePath, FileMode fMode);
/*!
Creates a netCDF file of a specified format.
\param filePath Name of netCDF optional path.
\param fMode The file mode:
- 'replace' Create new file, even it already exists.
- 'newFile' Create new file, fail it exists already.
*/
NcFile(const std::string& filePath, FileMode fMode, FileFormat fFormat);
/*! destructor */
virtual ~NcFile(); //closes file and releases all resources
};
}
#endif

@ -1,22 +0,0 @@
#include "ncFloat.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcFloat called netCDF::ncFloat
namespace netCDF {
NcFloat ncFloat;
}
// constructor
NcFloat::NcFloat() : NcType(NC_FLOAT){
}
NcFloat::~NcFloat() {
}
// equivalence operator
bool NcFloat::operator==(const NcFloat & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,28 +0,0 @@
#include "ncType.h"
#ifndef NcFloatClass
#define NcFloatClass
namespace netCDF
{
/*! Class represents a netCDF atomic Float type. */
class NcFloat : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcFloat & rhs);
/*! destructor */
~NcFloat();
/*! Constructor */
NcFloat();
};
/*! A global instance of the NcFloat class within the netCDF namespace. */
extern NcFloat ncFloat;
}
#endif

File diff suppressed because it is too large Load Diff

@ -1,564 +0,0 @@
#include <string>
#include <vector>
#include <set>
#include <map>
#include "ncType.h"
#include "ncEnumType.h"
#include "ncGroupAtt.h"
#ifndef NcGroupClass
#define NcGroupClass
namespace netCDF
{
class NcVar; // forward declaration.
class NcDim; // forward declaration.
class NcVlenType; // forward declaration.
class NcCompoundType; // forward declaration.
class NcOpaqueType; // forward declaration.
/*! Class represents a netCDF group. */
class NcGroup
{
public:
/*!
The enumeration list contains the options for selecting groups (used for returned set of NcGroup objects).
*/
enum GroupLocation
{
ChildrenGrps, //!< Select from the set of children in the current group.
ParentsGrps, //!< Select from set of parent groups (excludes the current group).
ChildrenOfChildrenGrps, //!< Select from set of all children of children in the current group.
AllChildrenGrps, //!< Select from set of all children of the current group and beneath.
ParentsAndCurrentGrps, //!< Select from set of parent groups(includes the current group).
AllGrps //!< Select from set of parent groups, current groups and all the children beneath.
};
/*!
The enumeration list contains the options for selecting groups.
*/
enum Location
{
Current, //!< Select from contents of current group.
Parents, //!< Select from contents of parents groups.
Children, //!< Select from contents of children groups.
ParentsAndCurrent, //!< Select from contents of current and parents groups.
ChildrenAndCurrent, //!< Select from contents of current and child groups.
All //!< Select from contents of current, parents and child groups.
};
/*! assignment operator */
NcGroup& operator=(const NcGroup& rhs);
/*! Constructor generates a \ref isNull "null object". */
NcGroup();
//* constructor */
NcGroup(int groupId);
/*! The copy constructor. */
NcGroup(const NcGroup& rhs);
/*! destructor */
virtual ~NcGroup();
/*! equivalence operator */
bool operator==(const NcGroup& rhs) const;
/*! != operator */
bool operator!=(const NcGroup& rhs) const;
/*! comparator operator */
friend bool operator<(const NcGroup& lhs,const NcGroup& rhs);
/*! comparator operator */
friend bool operator>(const NcGroup& lhs,const NcGroup& rhs);
// /////////////
// NcGroup-related methods
// /////////////
/*! Gets the group name. */
/*!
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
\param fullName If true then the full name is returned with subgroups separated by a forward slash "/" (default is false)
\return The group name.
*/
std::string getName(bool fullName=false) const;
/*!
Gets the parent group.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
If the current root is the parent group, then return a null group.
*/
NcGroup getParentGroup() const ;
/*!
Gets the group id.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
*/
int getId() const;
/*!
Gets the number of NcGroup objects.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
\param location Enumeration type controlling the groups to search.
\return Number of groups.
*/
int getGroupCount(NcGroup::GroupLocation location=ChildrenGrps) const;
/*!
Gets the collection of NcGroup objects.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
\param location Enumeration type controlling the groups to search.
\return A STL multimap object, containing pairs of <attribute name, NcGroup object> entities.
*/
std::multimap<std::string,NcGroup> getGroups(NcGroup::GroupLocation location=ChildrenGrps) const;
/*!
Gets NcGroup objects with a given name.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
\param name Name of group.
\param location Enumeration type controlling the groups to search.
\return Set of NcGroup objects with given name.
*/
std::set<NcGroup> getGroups(const std::string& name,NcGroup::GroupLocation location=ChildrenGrps) const;
/*!
Gets the named child NcGroup object.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
\param name Group name.
\param location Enumeration type controlling the groups to search.
\return An NcGroup object. If there are multiple objects indentied with the same name,
the object closest to the current group is returned. If no valid object is found ,
a \ref NcGroup::isNull "null node" is returned.
*/
NcGroup getGroup(const std::string& name,NcGroup::GroupLocation location=ChildrenGrps) const;
/*!
Adds a new child netCDF group object.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
\param name Variable name.
\return NcGroup The NcGroup object for this new netCDF group.
*/
NcGroup addGroup(const std::string& name) const;
/*! Returns true if this object is null (i.e. it has no contents); otherwise returns false. */
bool isNull() const {return nullObject;}
/*! Returns true if this is the root group, otherwise returns false. */
bool isRootGroup() const;
// /////////////
// NcVar-related accessors
// /////////////
/*!
Gets the number of NcVar objects in this group.
\param location Enumeration type controlling the groups to search.
\return Number of variables.
*/
int getVarCount(NcGroup::Location location=Current) const;
/*!
Get the collection of NcVar objects.
\param location Enumeration type controlling the groups to search.
\return A STL multimap object, containing pairs of <attribute name, NcVar object> entities.
*/
std::multimap<std::string,NcVar> getVars(NcGroup::Location location=Current) const;
/*!
Gets all NcVar objects with a given name.
\param name Name of attribute
\param location Enumeration type controlling the groups to search.
\return Set of NcVar objects.
*/
std::set<NcVar> getVars(const std::string& name,NcGroup::Location location=Current) const;
/*!
Gets the named NcVar object..
\param name Variable name.
\param location Enumeration type controlling the groups to search.
\return A NcVar object. If there are multiple objects indentied with the
same name, the object closest to the current group is returned.
If no valid object is found , a \ref NcVar::isNull "null node" is returned.
*/
NcVar getVar(const std::string& name,NcGroup::Location location=Current) const;
/*!
Adds a new netCDF variable.
The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
An NcNullType exception is thrown if the NcType object is invalid.
An NcNullDim exception is thrown if the NcDim object is invalid.
\param name Variable name.
\param typeName Type name.
\param dimName Dimension name.
\return The NcVar object for this new netCDF variable.
*/
NcVar addVar(const std::string& name, const std::string& typeName, const std::string& dimName) const;
/*!
Adds a new netCDF variable.
The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
An NcNullType exception is thrown if the NcType object is invalid.
An NcNullDim exception is thrown if the NcDim object is invalid.
\param name Variable name.
\param ncType NcType object.
\param ncDim NcDim object.
\return The NcVar object for this new netCDF variable.
*/
NcVar addVar(const std::string& name, const NcType& ncType, const NcDim& ncDim) const;
/*!
Adds a new netCDF multi-dimensional variable.
The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
An NcNullType exception is thrown if the NcType object is invalid.
An NcNullDim exception is thrown if the NcDim object is invalid.
\param name Variable name.
\param typeName Type name.
\param dimNames Vector of dimension names.
\return The NcVar object for this new netCDF variable.
*/
NcVar addVar(const std::string& name, const std::string& typeName, const std::vector<std::string>& dimNames) const;
/*!
Adds a new multi-dimensional netCDF variable.
The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
An NcNullType exception is thrown if the NcType object is invalid.
An NcNullDim exception is thrown if any of the the NcDim objects are invalid.
\param name Variable name.
\param ncType NcType object.
\param ncDimvector Vector of NcDim objects.
\return The NcVar object for this new netCDF variable.
*/
NcVar addVar(const std::string& name, const NcType& ncType, const std::vector<NcDim>& ncDimVector) const;
// /////////////
// NcGroupAtt-related methods
// /////////////
/*!
Gets the number of group attributes.
\param location Enumeration type controlling the groups to search.
\return Number of attributes.
*/
int getAttCount(NcGroup::Location location=Current) const;
/*!
Gets the collection of NcGroupAtt objects.
\param location Enumeration type controlling the groups to search.
\return A STL multimap object, containing pairs of <attribute name, NcGroupAtt object> entities.
*/
std::multimap<std::string,NcGroupAtt> getAtts(NcGroup::Location location=Current) const;
/*!
Gets all NcGroupAtt objects with a given name.
\param name Name of attribute
\param location Enumeration type controlling the groups to search.
\return Set of NcGroupAtt objects.
*/
std::set<NcGroupAtt> getAtts(const std::string& name,NcGroup::Location location=Current) const;
/*!
Gets the named NcGroupAtt object.
\param name Name of attribute
\param location Enumeration type controlling the groups to search.
\return A NcGroupAtt object. If there are multiple objects indentied with the
same name, the object closest to the current group is returned. If no valid object is found ,
a \ref NcGroupAtt::isNull "null node" is returned.
*/
NcGroupAtt getAtt(const std::string& name,NcGroup::Location location=Current) const;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, size_t len, const char** dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const std::string& dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, short datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, int datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, long datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, float datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, double datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, unsigned short datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, unsigned int datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, unsigned long long datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, long long datumValue) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned char* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const signed char* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const short* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const int* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const long* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const float* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const double* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned short* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned int* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned long long* dataValues) const ;
/*! \overload
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const long long* dataValues) const ;
/*!
Creates a new NetCDF group attribute or if already exisiting replaces it.
If you are writing a _Fill_Value_ attribute, and will tell the HDF5 layer to use
the specified fill value for that variable.
\par
Although it's possible to create attributes of all types, text and double attributes are adequate for most purposes.
\param name Name of attribute.
\param type The attribute type.
\param len The length of the attribute (number of Nctype repeats).
\param dataValues Data Values to put into the new attribute.
If the type of data values differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
\return The NcGroupAtt object for this new netCDF attribute.
*/
NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const void* dataValues) const ;
// /////////////
// NcDim-related methods
// /////////////
/*!
Gets the number of NcDim objects.
\param location Enumeration type controlling the groups to search.
\return Number of dimensions.
*/
int getDimCount(NcGroup::Location location=Current) const;
/*!
Gets the collection of NcDim objects.
\param location Enumeration type controlling the groups to search.
\return A STL multimap object, containing pairs of <attribute name, NcDim object> entities.
*/
std::multimap<std::string,NcDim> getDims(NcGroup::Location location=Current) const;
/*!
Gets NcDim objects with a given name.
\param name Name of dimension.
\param location Enumeration type controlling the groups to search.
\return Set of NcDim objects with given name.
*/
std::set<NcDim> getDims(const std::string& name,NcGroup::Location location=Current) const;
/*!
Gets the named NcDim object.
\param name Name of dimension.
\param location Enumeration type controlling the groups to search.
\return An NcDim object. If there are multiple objects indentied with the same name,
the object closest to the current group is returned. If no valid object is found , a \ref NcDim::isNull "null node" is returned.
*/
NcDim getDim(const std::string& name,NcGroup::Location location=Current) const;
/*!
Adds a new netCDF dimension.
\param The name of new dimension.
\param Length of dimension; that is, number of values for this dimension as an index to variables
that use it.
\return The NcDim object for this new netCDF dimension.
*/
NcDim addDim(const std::string& name, size_t dimSize) const;
/*!
Adds a new unlimited netCDF dimension.
\param The name of new dimension.
\return The NcDim object for this new netCDF dimension.
*/
NcDim addDim(const std::string& name) const;
// /////////////
// NcType-related methods
// /////////////
/*!
Gets the number of type objects.
\param location Enumeration type controlling the groups to search.
\return Number of types.
*/
int getTypeCount(NcGroup::Location location=Current) const;
/*!
Gets the number of type objects with a given enumeration type.
\param enumType The enumeration value of the object type.
\param location Enumeration type controlling the groups to search.
\return Number of types of the given enumeration type.
*/
int getTypeCount(NcType::ncType enumType, NcGroup::Location location=Current) const;
/*!
Gets the collection of NcType objects.
\param location Enumeration type controlling the groups to search.
\return A STL multimap object, on return contains pairs of <Type name, NcType object> entities.
For atomic types, the type returned is the CDL name.
*/
std::multimap<std::string,NcType> getTypes(NcGroup::Location location=Current) const;
/*!
Gets the collection of NcType objects with a given name.
\param name Name of type. For atomic types, the CDL name is expected. This is consistent with the
string returned from NcType::getName().
\param location Enumeration type controlling the groups to search.
\return Set of NcType objects.
*/
std::set<NcType> getTypes(const std::string& name, NcGroup::Location location=Current) const;
/*!
Gets the collection of NcType objects with a given data type.
\param enumType Enumeration type specifying the data type.
\param location Enumeration type controlling the groups to search.
\return Set of Nctype objects.
*/
std::set<NcType> getTypes(NcType::ncType enumType, NcGroup::Location location=Current) const;
/*!
Gets the collection of NcType objects with a given name and data type.
\param name Name of type. For atomic types, the CDL name is expected. This is consistent with the
string returned from NcType::getName().
\param enumType Enumeration type specifying the data type.
\param location Enumeration type controlling the groups to search.
\return Set of Nctype objects.
*/
std::set<NcType> getTypes(const std::string& name, NcType::ncType enumType, NcGroup::Location location=Current) const;
/*!
Gets the NcType object with a given name.
\param name Name of type. For atomic types, the CDL name is expected. This is consistent with the
string returned from NcType::getName().
\param location Enumeration type controlling the groups to search.
\return NcType object. If there are multiple objects indentied with the same name,
the object closest to the current group is returned. If no valid object is found , a \ref NcType::isNull "null node" is returned.
*/
NcType getType(const std::string& name, NcGroup::Location location=Current) const;
/*!
Adds a new netCDF enum type.
\param name Name of type. For atomic types, the CDL name is expected. This is consistent with the
string returned from NcType::getName().
\param enumType The enumeration value of the object type.
\return The NcEnumType object for this new netCDF enum type.
*/
NcEnumType addEnumType(const std::string& name,NcEnumType::ncEnumType basetype) const;
/*!
Adds a new netCDF Vlen type.
\param name Name of type.
\param basetype A NcType object to be used for the basetype.
\return The NcVlenType object for this new netCDF vlen type.
*/
NcVlenType addVlenType(const std::string& name,NcType& basetype) const;
/*!
Adds a new netCDF Opaque type.
\param name Name of type.
\param size The size of the new type in bytes.
\return The NcOpaqueType object for this new netCDF opaque type..
*/
NcOpaqueType addOpaqueType(const std::string& name, size_t size) const;
/*!
Adds a new netCDF UserDefined type.
\param name Name of type.
\param size The size of the new type in bytes.
\return The new NcCompoundType object for this new netCDF userDefined type.
*/
NcCompoundType addCompoundType(const std::string& name, size_t size) const;
/*!
Gets a collection of coordinate variables.
Coordinate variable have an NcDim and NcVar object with the same name defined in the same group.
\par
The method returns STL map object containing a coordinate variables in the current group and optionally
in the parent and child groups. It is expected that within each group, the names of dimensions are unique and
the the names of variables are unique. However, if this is not the case, this method will still work correctly.
\param location Enumeration type controlling the groups to search.
\return The NcVar dimension variable. If no valid object is found , a \ref NcVar::isNull "null node" is returned.
*/
std::map<std::string,NcGroup> getCoordVars(NcGroup::Location location=Current) const;
/*!
Gets the NcDim and NcVar object pair for a named coordinate variable.
Coordinate variable have an NcDim and NcVar object with the same name defined in the same group.
\par
The method returns two objects for the named coordinate variable. The method searches first in the current
group and optionally in the parent and child group and returns the first instance found.
\param location Enumeration type controlling the groups to search.
\return The set of names of dimension variables.
*/
void getCoordVar(std::string& coordVarName, NcDim& ncDim, NcVar& ncVar, NcGroup::Location location=Current) const;
protected:
/*! assignment operator */
/* NcGroup& operator=(const NcGroup& rhs); */
bool nullObject;
int myId;
};
}
#endif

@ -1,65 +0,0 @@
#include "ncGroupAtt.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include <netcdf.h>
using namespace std;
namespace netCDF {
// Global comparator operator ==============
// comparator operator
bool operator<(const NcGroupAtt& lhs,const NcGroupAtt& rhs)
{
return false;
}
// comparator operator
bool operator>(const NcGroupAtt& lhs,const NcGroupAtt& rhs)
{
return true;
}
}
using namespace netCDF;
// assignment operator
NcGroupAtt& NcGroupAtt::operator=(const NcGroupAtt & rhs)
{
NcAtt::operator=(rhs); // assign base class parts
return *this;
}
//! The copy constructor.
NcGroupAtt::NcGroupAtt(const NcGroupAtt& rhs):
NcAtt(rhs) // invoke base class copy constructor
{}
// Constructor generates a null object.
NcGroupAtt::NcGroupAtt() :
NcAtt() // invoke base class constructor
{}
// equivalence operator (doesn't bother compaing varid's of each object).
bool NcGroupAtt::operator==(const NcGroupAtt & rhs)
{
if(nullObject)
return nullObject == rhs.isNull();
else
return myName == rhs.myName && groupId == rhs.groupId;
}
// Constructor for an existing global attribute.
NcGroupAtt::NcGroupAtt(const NcGroup& grp, const int index):
NcAtt(false)
{
groupId = grp.getId();
varId = NC_GLOBAL;
// get the name of this attribute
char attName[NC_MAX_NAME+1];
ncCheck(nc_inq_attname(groupId,varId, index, attName),__FILE__,__LINE__);
ncCheck(nc_inq_attname(groupId,varId,index,attName),__FILE__,__LINE__);
myName = attName;
}

@ -1,45 +0,0 @@
#include "ncAtt.h"
#include "netcdf.h"
#ifndef NcGroupAttClass
#define NcGroupAttClass
namespace netCDF
{
class NcGroup; // forward declaration.
/*! Class represents a netCDF group attribute */
class NcGroupAtt : public NcAtt
{
public:
/*! assignment operator */
NcGroupAtt& operator= (const NcGroupAtt& rhs);
/*! Constructor generates a \ref isNull "null object". */
NcGroupAtt ();
/*! The copy constructor. */
NcGroupAtt(const NcGroupAtt& rhs) ;
/*!
Constructor for an existing global attribute.
\param grp Parent Group object.
\param index The index (id) of the attribute.
*/
NcGroupAtt(const NcGroup& grp, const int index);
/*! equivalence operator */
bool operator== (const NcGroupAtt& rhs);
/*! comparator operator */
friend bool operator<(const NcGroupAtt& lhs,const NcGroupAtt& rhs);
/*! comparator operator */
friend bool operator>(const NcGroupAtt& lhs,const NcGroupAtt& rhs);
};
}
#endif

@ -1,22 +0,0 @@
#include "ncInt.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcInt called netCDF::ncInt
namespace netCDF {
NcInt ncInt;
}
// constructor
NcInt::NcInt() : NcType(NC_INT){
}
NcInt::~NcInt() {
}
// equivalence operator
bool NcInt::operator==(const NcInt & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,28 +0,0 @@
#include "ncType.h"
#ifndef NcIntClass
#define NcIntClass
namespace netCDF
{
/*! Class represents a netCDF atomic Int type. */
class NcInt : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcInt & rhs);
/*! destructor */
~NcInt();
/*! Constructor */
NcInt();
};
/*! A global instance of the NcInt class within the netCDF namespace. */
extern NcInt ncInt;
}
#endif

@ -1,22 +0,0 @@
#include "ncInt64.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcInt64 called netCDF::ncInt64
namespace netCDF {
NcInt64 ncInt64;
}
// constructor
NcInt64::NcInt64() : NcType(NC_INT64){
}
NcInt64::~NcInt64() {
}
// equivalence operator
bool NcInt64::operator==(const NcInt64 & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,28 +0,0 @@
#include "ncType.h"
#ifndef NcInt64Class
#define NcInt64Class
namespace netCDF
{
/*! Class represents a netCDF atomic Int64 type. */
class NcInt64 : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcInt64 & rhs);
/*! destructor */
~NcInt64();
/*! Constructor */
NcInt64();
};
/*! A global instance of the NcInt64 class within the netCDF namespace. */
extern NcInt64 ncInt64;
}
#endif

@ -1,68 +0,0 @@
#include "ncOpaqueType.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include "ncException.h"
#include <netcdf.h>
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;
// Class represents a netCDF variable.
using namespace netCDF;
// assignment operator
NcOpaqueType& NcOpaqueType::operator=(const NcOpaqueType& rhs)
{
// assign base class parts
NcType::operator=(rhs);
return *this;
}
// assignment operator
NcOpaqueType& NcOpaqueType::operator=(const NcType& rhs)
{
if (&rhs != this) {
// check the rhs is the base of an Opaque type
if(getTypeClass() != NC_OPAQUE) throw NcException("NcException","The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
// assign base class parts
NcType::operator=(rhs);
}
return *this;
}
// The copy constructor.
NcOpaqueType::NcOpaqueType(const NcOpaqueType& rhs):
NcType(rhs)
{
}
// Constructor generates a null object.
NcOpaqueType::NcOpaqueType() :
NcType() // invoke base class constructor
{}
// constructor
NcOpaqueType::NcOpaqueType(const NcGroup& grp, const string& name) :
NcType(grp,name)
{}
// constructor
NcOpaqueType::NcOpaqueType(const NcType& ncType) :
NcType(ncType)
{
// check the nctype object is the base of a Opaque type
if(getTypeClass() != NC_OPAQUE) throw NcException("NcException","The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
}
// Returns the size of the opaque type in bytes.
size_t NcOpaqueType::getTypeSize() const
{
char* charName;
charName=NULL;
size_t sizep;
ncCheck(nc_inq_opaque(groupId,myId,charName,&sizep),__FILE__,__LINE__);
return sizep;
}

@ -1,59 +0,0 @@
#include <string>
#include "ncType.h"
#include "netcdf.h"
#ifndef NcOpaqueTypeClass
#define NcOpaqueTypeClass
namespace netCDF
{
class NcGroup; // forward declaration.
/*! Class represents a netCDF opaque type */
class NcOpaqueType : public NcType
{
public:
/*! Constructor generates a \ref isNull "null object". */
NcOpaqueType();
/*!
Constructor.
The opaque Type must already exist in the netCDF file. New netCDF opaque types #
can be added using NcGroup::addNcOpaqueType();
\param grp The parent group where this type is defined.
\param name Name of new type.
*/
NcOpaqueType(const NcGroup& grp, const std::string& name);
/*!
Constructor.
Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of a Opaque type.
\param ncType A Nctype object.
*/
NcOpaqueType(const NcType& ncType);
/*! assignment operator */
NcOpaqueType& operator=(const NcOpaqueType& rhs);
/*!
Assignment operator.
This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of an Opaque type.
*/
NcOpaqueType& operator=(const NcType& rhs);
/*! The copy constructor.*/
NcOpaqueType(const NcOpaqueType& rhs);
/*! destructor */
~NcOpaqueType(){;}
/*! Returns the size of the opaque type in bytes. */
size_t getTypeSize() const;
};
}
#endif

@ -1,22 +0,0 @@
#include "ncShort.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcShort called netCDF::ncShort
namespace netCDF {
NcShort ncShort;
}
// constructor
NcShort::NcShort() : NcType(NC_SHORT){
}
NcShort::~NcShort() {
}
// equivalence operator
bool NcShort::operator==(const NcShort & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,28 +0,0 @@
#include "ncType.h"
#ifndef NcShortClass
#define NcShortClass
namespace netCDF
{
/*! Class represents a netCDF atomic Short type. */
class NcShort : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcShort & rhs);
/*! destructor */
~NcShort();
/*! Constructor */
NcShort();
};
/*! A global instance of the NcShort class within the netCDF namespace. */
extern NcShort ncShort;
}
#endif

@ -1,22 +0,0 @@
#include "ncString.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcString called netCDF::ncString
namespace netCDF {
NcString ncString;
}
// constructor
NcString::NcString() : NcType(NC_STRING){
}
NcString::~NcString() {
}
// equivalence operator
bool NcString::operator==(const NcString & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

@ -1,28 +0,0 @@
#include "ncType.h"
#ifndef NcStringClass
#define NcStringClass
namespace netCDF
{
/*! Class represents a netCDF atomic String type. */
class NcString : public NcType
{
public:
/*! equivalence operator */
bool operator==(const NcString & rhs);
/*! destructor */
~NcString();
/*! Constructor */
NcString();
};
/*! A global instance of the NcString class within the netCDF namespace. */
extern NcString ncString;
}
#endif

@ -1,161 +0,0 @@
#include <string>
#include "ncType.h"
#include "ncGroup.h"
#include "ncCheck.h"
using namespace std;
namespace netCDF {
// Global comparator operator ==============
// comparator operator
bool operator<(const NcType& lhs,const NcType& rhs)
{
return false;
}
// comparator operator
bool operator>(const NcType& lhs,const NcType& rhs)
{
return true;
}
}
using namespace netCDF;
// assignment operator
NcType& NcType::operator=(const NcType & rhs)
{
nullObject = rhs.nullObject;
myId= rhs.myId;
groupId = rhs.groupId;
return *this;
}
// The copy constructor.
NcType::NcType(const NcType& rhs):
nullObject(rhs.nullObject),
myId(rhs.myId),
groupId(rhs.groupId)
{}
// Constructor generates a null object.
NcType::NcType() :
nullObject(true)
{}
// constructor
NcType::NcType(const NcGroup& grp, const string& name) :
nullObject (false)
{
groupId= grp.getId();
NcType typTmp(grp.getType(name,NcGroup::ParentsAndCurrent));
myId = typTmp.getId();
}
// constructor for a global type
NcType::NcType(nc_type id) :
nullObject(false),
myId(id),
groupId(0)
{
}
// Constructor for a non-global type
NcType::NcType(const netCDF::NcGroup& grp, nc_type id):
nullObject(false),
myId(id),
groupId(grp.getId())
{}
// equivalence operator
bool NcType::operator==(const NcType & rhs) const
{
if(nullObject)
return nullObject == rhs.nullObject;
else
return groupId == rhs.groupId && myId == rhs.myId;
}
// != operator
bool NcType::operator!=(const NcType & rhs) const
{
return !(*this == rhs);
}
// Gets parent group.
NcGroup NcType::getParentGroup() const {
if(groupId == 0) return NcGroup(); else return NcGroup(groupId);
}
// Returns the type name.
string NcType::getName() const{
char charName[NC_MAX_NAME+1];
size_t *sizep=NULL;
ncCheck(nc_inq_type(groupId,myId,charName,sizep),__FILE__,__LINE__);
return string(charName);
// }
};
// Returns the size in bytes
size_t NcType::getSize() const{
char* charName=NULL;
size_t sizep;
ncCheck(nc_inq_type(groupId,myId,charName,&sizep),__FILE__,__LINE__);
return sizep;
};
// The type class returned as an enumeration type.
NcType::ncType NcType::getTypeClass() const{
switch (myId) {
case NC_BYTE : return nc_BYTE;
case NC_UBYTE : return nc_UBYTE;
case NC_CHAR : return nc_CHAR;
case NC_SHORT : return nc_SHORT;
case NC_USHORT : return nc_USHORT;
case NC_INT : return nc_INT;
case NC_UINT : return nc_UINT;
case NC_INT64 : return nc_INT64;
case NC_UINT64 : return nc_UINT64;
case NC_FLOAT : return nc_FLOAT;
case NC_DOUBLE : return nc_DOUBLE;
case NC_STRING : return nc_STRING;
default:
// this is a user defined type
// establish its type class, ie whether it is: NC_VLEN, NC_OPAQUE, NC_ENUM, or NC_COMPOUND.
char* name=NULL;
size_t* sizep=NULL;
nc_type* base_nc_typep=NULL;
size_t* nfieldsp=NULL;
int classp;
ncCheck(nc_inq_user_type(groupId,myId,name,sizep,base_nc_typep,nfieldsp,&classp),__FILE__,__LINE__);
return static_cast<ncType>(classp);
}
}
// The type class returned as a string.
string NcType::getTypeClassName() const{
ncType typeClass=getTypeClass();
switch (typeClass) {
case nc_BYTE : return string("nc_BYTE");
case nc_UBYTE : return string("nc_UBYTE");
case nc_CHAR : return string("nc_CHAR");
case nc_SHORT : return string("nc_SHORT");
case nc_USHORT : return string("nc_USHORT");
case nc_INT : return string("nc_INT");
case nc_UINT : return string("nc_UINT");
case nc_INT64 : return string("nc_INT64");
case nc_UINT64 : return string("nc_UINT64");
case nc_FLOAT : return string("nc_FLOAT");
case nc_DOUBLE : return string("nc_DOUBLE");
case nc_STRING : return string("nc_STRING");
case nc_VLEN : return string("nc_VLEN");
case nc_OPAQUE : return string("nc_OPAQUE");
case nc_ENUM : return string("nc_ENUM");
case nc_COMPOUND: return string("nc_COMPOUND");
}
// we never get here!
return "Dummy";
}

@ -1,156 +0,0 @@
#include <string>
#include "netcdf.h"
#ifndef NcTypeClass
#define NcTypeClass
namespace netCDF
{
class NcGroup; // forward declaration to avoid cyclic reference.
/*! Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes. */
class NcType
{
public:
/*!
List of netCDF types that can be represented.
The enumeration list contains the complete set of netCDF variable types. In addition, the type NC_TYPE
is included. This enables the user to instantiate a netCDF type object without explcitly needing to know
it precise type.
*/
enum ncType
{
nc_BYTE = NC_BYTE, //!< signed 1 byte integer
nc_CHAR = NC_CHAR, //!< ISO/ASCII character
nc_SHORT = NC_SHORT, //!< signed 2 byte integer
nc_INT = NC_INT, //!< signed 4 byte integer
nc_FLOAT = NC_FLOAT, //!< single precision floating point number
nc_DOUBLE = NC_DOUBLE, //!< double precision floating point number
nc_UBYTE = NC_UBYTE, //!< unsigned 1 byte int
nc_USHORT = NC_USHORT, //!< unsigned 2-byte int
nc_UINT = NC_UINT, //!< unsigned 4-byte int
nc_INT64 = NC_INT64, //!< signed 8-byte int
nc_UINT64 = NC_UINT64, //!< unsigned 8-byte int
nc_STRING = NC_STRING, //!< string
nc_VLEN = NC_VLEN, //!< "NcVlen type"
nc_OPAQUE = NC_OPAQUE, //!< "NcOpaque type"
nc_ENUM = NC_ENUM, //!< "NcEnum type"
nc_COMPOUND = NC_COMPOUND //!< "NcCompound type"
};
/*! Constructor generates a \ref isNull "null object". */
NcType();
/*!
Constructor for a non-global type.
This object describes the "essential" information for all netCDF types required by NcVar, NcAtt objects.
New netCDF types can be added using the appropriate "add" method in the NcGroup object.
\param grp Parent NcGroup object.
\param name Name of this type.
*/
NcType(const netCDF::NcGroup& grp, const std::string& name);
/*!
Constructor for a non-global type.
This object describes the "essential" information for all netCDF types required by NcVar, NcAtt objects.
New netCDF types can be added using the appropriate "add" method in the NcGroup object.
\param grp Parent NcGroup object.
\param id type id
*/
NcType(const netCDF::NcGroup& grp, nc_type id);
/*!
Constructor for a global type
This object describes the "essential" information for a netCDF global type.
\param id type id
*/
NcType(nc_type id);
/*! The copy constructor. */
NcType(const NcType& rhs);
/*! destructor */
virtual ~NcType() {}
/*! equivalence operator */
bool operator==(const NcType&) const;
/*! != operator */
bool operator!=(const NcType &) const;
// accessors to private data.
/*! The netCDF Id of this type. */
nc_type getId() const {return myId;}
/*! Gets parent group. For an atomic type, returns a Null object.*/
netCDF::NcGroup getParentGroup() const;
/*!
The name of this type. For atomic types, the CDL type names are returned. These are as follows:
- NcByte String returned is "byte".
- NcUbyte String returned is "ubyte".
- NcChar String returned is "char".
- NcShort String returned is "short".
- NcUshort String returned is "ushort".
- NcInt String returned is "int".
- NcUint String returned is "uint".
- NcInt64 String returned is "int64".
- NcUint64 String returned is "uint64".
- NcFloat String returned is "float".
- NcDouble String returned is "double".
- NcString String returned is "string".
*/
std::string getName() const;
/*!
The size in bytes.
This function will work on any type, including atomic and any user defined type, whether
compound, opaque, enumeration, or variable length array.
*/
size_t getSize() const;
/*!
The type class returned as enumeration type.
Valid for all types, whether atomic or user-defined. User-defined types are returned as one of the following
enumeration types: nc_VLEN, nc_OPAQUE, nc_ENUM, or nc_COMPOUND.
*/
ncType getTypeClass() const;
/*!
Return a string containing the name of the enumerated type. (ie one of the following strings:
"nc_BYTE", "nc_CHAR", "nc_SHORT", "nc_INT", "nc_FLOAT", "nc_DOUBLE", "nc_UBYTE", "nc_USHORT",
"nc_UINT", "nc_INT64", "nc_UINT64", "nc_STRING", "nc_VLEN", "nc_OPAQUE", "nc_ENUM", "nc_COMPOUND"
*/
std::string getTypeClassName() const;
/*! Returns true if this object is null (i.e. it has no contents); otherwise returns false. */
bool isNull() const {return nullObject;}
/*! comparator operator */
friend bool operator<(const NcType& lhs,const NcType& rhs);
/*! comparator operator */
friend bool operator>(const NcType& lhs,const NcType& rhs);
protected:
/*! assignment operator */
NcType& operator=(const NcType& rhs);
bool nullObject;
/*! the type Id */
nc_type myId;
/*! the group Id */
int groupId;
};
}
#endif

@ -1,22 +0,0 @@
#include "ncUbyte.h"
#include "netcdf.h"
using namespace netCDF;
// create an instance of NcUbyte called netCDF::ncUbyte
namespace netCDF {
NcUbyte ncUbyte;
}
// constructor
NcUbyte::NcUbyte() : NcType(NC_UBYTE){
}
NcUbyte::~NcUbyte() {
}
// equivalence operator
bool NcUbyte::operator==(const NcUbyte & rhs) {
// simply check the netCDF id.
return myId == rhs.myId;
}

Some files were not shown because too many files have changed in this diff Show More