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.
Hello, I don't have much experience using IDL, so I can't be certain, but I will try to provide some insight. The first thing you mention, the failure to find a .att file; netcdf does not store attributes in a separate file, nor does it use any sort of temporary file 'under the hood', so to speak, for this purpose. Without knowing how IDL handles it, I can only guess that perhaps IDL uses a temporary file for internal data management and this error is a symptom of a different problem. Namely, the error "NCDF_VARPUT: Operation Failed, bad file (15) or variable (74) id ? (NC_ERROR=-57)" suggests to me that perhaps this is a filesystem error. My guess is that the IDL process is unable to write out either a temporary '.att' file, or the 'test.nc' file. This is speculation, but it would explain the 'bad file' error you are seeing and the absence of the mystery .att file. Can you confirm that you have write access to that location, either directly from the command line or via IDL? -Ward > I use IDL and want to read/write netCDF files. I looked at some of the > example files on your web page and can read/write a particular example with > the following IDL commands: > > ; First run > infile='sresa1b_ncar_ccsm3-example.nc' > read_ncdf, infile, data > write_netCDF, data, 'test.nc' > read_ncdf, 'test.nc', data2 > > The structure 'data' and 'data2' are the same, however during writing the > file 'test.nc' I get the warning: > WARNING: write_netCDF could not find attributes file = .att > > My first question is, where do I find the .att file for this particular > example? > > Then I try something different: > > ; Second run > infile='sresa1b_ncar_ccsm3-example.nc' > attrib=1 > read_ncdf, infile, data, attrib=attrib > write_netCDF, data, 'test.nc' > > With the reading of the attributes the structure "data" is now very different > from the structure I obtained during the first run. Which is good and > expected. But when I try to write this new structure to the file 'test.nc' I > first get the same Warning and then an IDL error: > > WARNING: write_netCDF could not find attributes file = .att > % NCDF_VARPUT: Operation Failed, bad file (15) or variable (74) id ? > (NC_ERROR=-57) > % Execution halted at: WRITE_NETCDF 456 > /disks/sprite/disk1/hfrey/idl/icon/UV_WG/write_netcdf.pro > > What am I doing wrong? Any help and insight would be appreciated. > Best regards, > Harald Frey > > > -------------------------------------------------------- > AST:7731^29u18e3 > Harald U. Frey > Space Sciences Lab phone: 510-643-3323 > University of California fax: 510-643-2624 or 643-8302 > 7 Gauss Way email: address@hidden<mailto:address@hidden> > Berkeley, CA 94720-7450 > USA > > > Ticket Details =================== Ticket ID: UFL-447527 Department: Support netCDF Priority: Normal Status: Closed