NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdfgroup] Windows crash accessing pathfinderAgg OPeNDAP dataset?

Hello again,
  I just upgraded our netCDF version to 4.3.3.1, and am testing whether we 
still get a segmentation fault in Windows when using the MATLAB high-level 
ncinfo function to read the following OPeNDAP dataset:
    
http://data.nodc.noaa.gov/thredds/dodsC/testdata/pathfinderAgg/pathFinderV5.2_night.ncml
 I confirmed this still happens with 4.3.3.1 in MATLAB.  Note this does not 
happen in Linux or Mac, only Windows.
  I attempted to isolate the problem by writing a standalone C function that 
links to netCDF 4.3.3.1, bypassing MATLAB.
  I compiled the function in Linux using make, and Visual Studio 2012.
  In Linux, the program runs fine.  In Windows, it gets to the nc_close(ncid) 
line and then throws an unhandled exception.
  I copied the standalone program below.  Do you know if there is still a 
problem accessing this pathfinderAgg dataset in Windows?
  Thank you!
    Ellen
    Software Engineer
    Image and Scientific File Formats
    MathWorks

#include <netcdf.h>

static char* 
URL="http://data.nodc.noaa.gov/thredds/dodsC/testdata/pathfinderAgg/pathFinderV5.2_night.ncml";;

int
main()
{
     int ncid;
     int ncstatus;
     int lat_id;
     nc_type lat_type;
     int lat_ndims;
     int lat_dimids[NC_MAX_VAR_DIMS];
     int lat_natts;
     int format_p;
     float lat_data[4320];

     printf(" \n");
     printf("********************\n");
     printf("open URL %s\n",URL);
     printf(" \n");
     ncstatus = nc_open(URL, NC_NOWRITE, &ncid);
     if(ncstatus != NC_NOERR) {
         printf("Could not open: %s; server may be down; test ignored\n",URL);
         exit(0);
     }
     printf("status after open = %d\n", ncstatus);

     // get the format
     ncstatus = nc_inq_format(ncid, &format_p);
     printf("lat id = %d\n", format_p);

     // get varid for latitude
     ncstatus = nc_inq_varid(ncid,"lat",&lat_id);
     printf("status after inq lat id = %d\n", ncstatus);
     printf("lat id = %d\n", lat_id);

     ncstatus = nc_inq_var(ncid, lat_id, 0, &lat_type, &lat_ndims, lat_dimids, 
&lat_natts);
     printf("status after inq lat var = %d\n", ncstatus);
     printf("lat type = %d\n", lat_type);

     // extract the first latitude value
     ncstatus = nc_get_var_float(ncid, lat_id, &lat_data[0]);
     printf("status after get = %d\n", ncstatus);
     printf("my datum = %f\n", lat_data[0]);

     // This code works okay in Linux and Mac
     // Everything works okay up until here in Windows then an exception occurs
     ncstatus = nc_close(ncid);
     printf("status after close = %d\n", ncstatus);
     printf("End of test.\n\n");

     return 0;
}



  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: