41static char rcsid[] not_used ={
"$Id$"};
44#include <libdap/InternalErr.h>
49NCFloat64::NCFloat64(
const string &n,
const string &d) :
Float64(n, d)
57NCFloat64::~NCFloat64()
67 dynamic_cast<NCFloat64&
>(*this) = rhs;
74NCFloat64::ptr_duplicate()
76 return new NCFloat64(*
this);
86 size_t cor[MAX_NC_DIMS];
95 errstat = nc_open(dataset().c_str(), NC_NOWRITE, &ncid);
97 if (errstat != NC_NOERR)
99 string err =
"Could not open the dataset's file (" + dataset() +
")" ;
100 throw Error(errstat, err);
103 errstat = nc_inq_varid(ncid, name().c_str(), &varid);
104 if (errstat != NC_NOERR)
105 throw Error(errstat,
"Could not get variable ID.");
107 errstat = nc_inq_var(ncid, varid, (
char *)0, &datatype, &num_dim, (
int *)0,
109 if (errstat != NC_NOERR)
111 string(
"Could not read information about the variable `")
112 + name() +
string(
"'."));
114 for (
id = 0;
id <= num_dim &&
id < MAX_NC_DIMS;
id++)
117 if (datatype == NC_DOUBLE){
120 errstat = nc_get_var1_double(ncid, varid, cor, &dbl);
121 if (errstat != NC_NOERR)
123 string(
"Could not read the variable `") + name()
128 flt64 = (dods_float64) dbl;
129 val2buf((
void *) &flt64 );
131 if (nc_close(ncid) != NC_NOERR)
132 throw InternalErr(__FILE__, __LINE__,
133 "Could not close the dataset!");
136 throw InternalErr(__FILE__, __LINE__,
137 "Entered NCFloat64::read() with non-float64 variable!");