/* This is part of the netCDF package. Copyright 2005-2011, University Corporation for Atmospheric Research/Unidata. See COPYRIGHT file for conditions of use. Test that NetCDF-4 can read HDF4 files. Dennis Heimbigner, Ward Fisher, Ed Hartnett */ #include #include #include "err_macros.h" #include #include #include #define CHUNKEDFILE "ref_chunked.hdf4" #define CHUNKEDVAR "LandWater" #define CONTIGFILE "ref_contiguous.hdf4" #define CONTIGVAR "pres" #define LAT_LEN 3 #define LON_LEN 2 #define DIMS_2 2 static size_t EXPECTED_CHUNKSIZES[2] = {1,1200}; int main(int argc, char **argv) { int ncid; int varid; int rank; int d; int storage; size_t chunksizes[NC_MAX_VAR_DIMS]; printf("\n*** Testing HDF4/NetCDF-4 chunking API: chunked..."); { /* Open with netCDF */ if (nc_open(CHUNKEDFILE, NC_NOWRITE, &ncid)) ERR; /* Get a variable id */ if(nc_inq_varid(ncid,CHUNKEDVAR,&varid)) ERR; /* get rank */ if(nc_inq_varndims(ncid,varid,&rank)) ERR; /* get chunk info */ memset(chunksizes,0,sizeof(chunksizes)); if(nc_inq_var_chunking(ncid,varid,&storage,chunksizes)) ERR; if(storage == NC_CONTIGUOUS) { fprintf(stderr,"nc_inq_var_chunking did not return CHUNKED\n"); ERR; } for(d=0;d