Open Chrismarsh opened 6 years ago
Follow up: my lat long grid does not, of course, have a time dimension. So reading individual x,y values like
// startp_2.push_back(0);
startp_2.push_back(y);
startp_2.push_back(x);
// countp_2.push_back(1);
countp_2.push_back(1);
countp_2.push_back(1);
double dlat,dlon;
latVar.getVar(startp_2,countp_2, &dlat);
lonVar.getVar(startp_2,countp_2, &dlon);
Appears to work as expected. However, reading the entire grid as:
// startp.push_back(0);
startp.push_back(0);
startp.push_back(0);
// countp.push_back(1);
countp.push_back(NLAT);
countp.push_back(NLON);
netCDF::NcVar latVar, lonVar;
latVar = data.getVar("gridlat_0");
if(latVar.isNull()) return -1;
lonVar = data.getVar("gridlon_0");
if(lonVar.isNull()) return -1;
does not work and still results in 0,0 values
I'm seeing some very odd behaviour with the getVar method. Specifically, I'm seeing it return what looks to be uninitialised data, 0s, and repeated data when reading back an entire record's grid.
I'm seeing this behaviour across the following machines: Machine details: Fedora 27 -- netcdf-cxx4-devel 4.3.0-3 (from dnf); netcdf-4.4.1.1-6 (from dnf) MacOSX High Sierra-- netcdf-cxx4 (built from git); netcdf-4.5.0 (via homebrew) Ubuntu 16.04 -- netcdf (built from src, 4.5.1.-dev); netcdf-cxx4 (latest git); hdf5 5.1.10.1 (built from src) Building with gcc and clang.
Test program is as follows:
I get the following output
As you can see, the array reads are a mess, where the single value read appears to be correct. However, on a much larger and production ncfile, I get output like the following:
where the array calls all return 0, and the individual calls end up returning duplicate data.
I've attached the files for this mwe below. It contains the tests data I've been using. mwe.zip