Hi Tony, Sorry to have taken so long to respond to your question ... > Has anyone had a chance to look at this problem? Do you need more > information? I looked at it briefly, but was unable to make any progress on it, because there isn't enough information for us to reproduce the problem here, so we can diagnose it. It doesn't appear to ba a netCDF problem, but rather a problem in the calling code. > What I am trying to do: Write a netCDF4 to hdfeos2 converter called > netCDF2hdfeos. > > Status: Wrote at least 90% of the code. Compiled it. Receiving strange > output from nc_inq_dim. After giving this output the program dies. > > The strange output: netcdf: 3 is not a valid cdfid That is not output from the netCDF library. The string "not a valid cdfid" doesn't appear anywhere in the netCDF library source code, as far as I can determine. So whatever is producing that output must be in your code that calls nc_inq_dim, but it's not in any of the program sources you attached. A guess at what might be happening is that your code is assuming that the dimension IDs in any group are just the consecutive integers from 0 to the number of dimensions in the group. That's true for netCDF-3 files but not for netCDF-4 files that use groups. Instead, dimension IDs are assigned globally within a netCDF-4 file in the order in which they are defined, so the IDs in a particular group may not be consecutive integers. So if are trying to access a dimension name or length corresponding to a dimension ID with the value 3, for example, it may be in a different group than the group ID you supply to nc_inq_dim (the first argument). The way to determine the dimension IDs in a group is to use the new function nc_inq_dimids. Then you can use nc_inq_dim on each of the dimids that are returned by nc_inq_dimids. > Why I think it is strange: I briefly looked at the netCDF4 code and it > looks to me like it is doing what it is suppose to. Why it is crashing > is a mystery. Any help will be much appreciated!!!!!! I repeat MUCH > APPRECIATED!!!!!!!! > > Attached are code snippets and debugger (gdb) snippets. Function main > (netCDF2hdfeos.c) calls function get_schema (line 115). Function > get_schema (get_schema.c) calls function inq_dims (line 74). Function > inq_dims (inq_dims.c) calls nc_inq_dim (line 47). Function nc_inq_dim > crashes. Sorry, but we can't figure out much from the gdb snippets in this case. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: QHD-994079 Department: Support netCDF Priority: High Status: Closed
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.