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.
Hi This has got me tearing out my remaining hair!It's a program that creates a NetCDF file and populates it with data read from ASCII files (HadCM3 monthly model data, actually).
What I found was that everything went fine (dims, vars, atts, undef, add lons, add lats, etc) until I tried to write a time value to the 'time' variable (which is based on the UNLIMITED 'time' dimension):
status = nf_put_var1_double(ncid,timvarid,t,tim)This gave a -45 error ('Not a netCDF data type or _FillValue type mismatch'). However I can confirm that all four arguments are correctly typed ('int','int','int', 'double precision'), and all have in-range, as-expected values.
I tried putting the main data 'put' before it - and that gave the same error.
Then I tried preassigning an array of times to the 'time' variable - that gave the same error.
I extracted the key interface calls to a short dummy program, assigned parameters as necessary, and that worked perfectly!!
This is where it gets freaky. I made 'time' fixed length (120), not UNLIMITED. Now I get the same -45 error when I call:
status = nf_enddef(ncid)I realise that nf_enddef is the point at which the definitions are written, so perhaps they're parsed there?
Does anyone have any idea what might be causing this? The whole program is a bit large, so I'm not attaching it yet, I'd like to see if anyone's had similar confusions..
Cheers Harry Ian "Harry" Harris Climatic Research Unit School of Environmental Sciences University of East Anglia Norwich NR4 7TJ United Kingdom
netcdfgroup
archives: