This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> I'm trying to follow the directions given in the NetCDF users manual to > open a file and extract variables from it. I have put in a couple of > status messages, but each status message is a 0. X1 is a variable of > dimensions (1, 256). Any help would be great. I've included a snippit > of C code: > int ncidp; > int status; > int X1_id; > float X1_vals[256]; > status = nc_open("/home/odstrcil/opt/tim.0020.nc", NC_NOWRITE, > &ncidp); > cout << status << endl; > status = nc_inq_varid(ncidp, "X1", &X1_id); > cout << status << endl; > status = nc_get_var_float(ncidp, X1_id, X1_vals); > cout << status << endl; > cout << "X1_vals:" << X1_vals << endl; > cout << "X1_id:" << X1_id << endl; > the output: > 0 > 0 > 0 > X1_vals:0xbfff2620 > X1_id:0 > > -Patrick Boylan > > Try running ncdump on the file to be sure it contains the data you expect. There are C example programs in the netCDF distribution, under the examples/C directory. Thanks, Ed Ticket Details =================== Ticket ID: VGJ-382894 Department: Support netCDF Priority: High Status: Closed