netCDFについて

西田顕郎

http://www.gfd-dennou.org/arch/netcdf/

http://www.gfd-dennou.org/arch/netcdf/netcdf-jman/

$ ncdump vbdsf.sfc.gauss.2002.nc


/* compile: $ gcc test.c -I/usr/local/netcdf-3.5.1/include -L/usr/local/netcdf-3.5.1/lib -lnetcdf
 */

# include <stdio.h>
# include <netcdf.h>

main(int argc, char **argv)
{int ncid;
 int varid;
 short *data;

 nc_open("vbdsf.sfc.gauss.2002.nc", NC_NOWRITE, &ncid); 
 nc_inq_varid(ncid, "vddsf", &varid);
 data=calloc(192*94*365, sizeof(short));
 nc_get_var_short(ncid, varid, data);
 fwrite(data, sizeof(short), 192*94*365, stdout);
 nc_close(ncid); 
}