[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #VGJ-382894]: NetCDF reading



> 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