This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Miguel, It's good to know you got it working. I now see what the problem was. Te example you worked from used simple 1D latitude and longitude coordinate variables, but the file you were reading actually had much larger 2D latitude and longitude variables in it. So you had, for example, dimensioned real lats(NLATS), lons(NLONS) to declare fairly small 1D arrays, but then trying to read the large 2D lat arrays (with 253*669) values into the lat array that was only dimensioned for 253 values: retval = nf_get_var_real(ncid, lat_varid, lats) resulted in overwriting all the memory after where the lat variable was stored in memory, which may have also overwritten all the program in memory, explaining why the program never go beyond this point. A fix would be to either declare large 2D arrays for the lat and lon variables, corresponding to what's in the file, not use the netCDF functions that read a whole variable at once, or simply comment out those reads, as you have done. The documentation might be improved by warning that when using this interface, the user must be sure to declare a large enough array to hod all the data that will be read. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: MLP-485355 Department: Support netCDF Priority: Normal Status: Closed