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 Cathy, Thank you for providing the file; it certainly helped me debug this issue! The problem appears to be that the uses a group, `Grid`. There isn't an easy way to remove the group with `ncdump` or `nccopy`, although NCO may let you do this. Alternatively, I was able to fix this with an intermediary step. I dumped the file you provided to a `.cdl` file as follows: $ ncdump precip.imerge.mon.202312.nc > tmp.cdl I then edited the cdl file to remove the `group: Grid {` line near the start of the file, and removed the corresponding closing '}' at the end of the file. I was then able to generate a binary `.nc` file using `ncgen` as follows: $ ncgen -7 -o tmp.nc tmp.cdl Running `ncdump -k tmp.nc` returns `netCDF-4 classic model`. That at least should answer the question; I will look into if there is an easier way to do this, but at the moment I'm not certain there is. I hope this helps! -Ward > Hi all > > We have run into issues converting files from netCDF4 to netCDF4-classic. > > The problem is this > > nccopy -k 4 precip.imerg.mon.202312.nc a.nc > NetCDF: Attempting netcdf-4 operation on strict nc3 netcdf-4 file > Location: file ../../ncdump/nccopy.c; line 657 > > and similarly for > > nccopy -k "netCDF-4 classic model" a.nc > > ncdump gives > > ncdump -k precip.imerg.mon.202312.nc > netCDF-4 > > and > > ncdump -hs precip.imerg.mon.202312.nc > > skip stuff > > float precip(time, lon, lat) ; > precip:DimensionNames = "time,lon,lat" ; > precip:Units = "mm/hr" ; > precip:units = "mm/hr" ; > precip:coordinates = "time lon lat" ; > precip:_FillValue = -9999.9f ; > precip:CodeMissingValue = "-9999.9" ; > precip:LongName = "Merged microwave-infrared-gauge > precipitation estimate" ; > precip:_Storage = "chunked" ; > precip:_ChunkSizes = 1, 145, 1800 ; > precip:_DeflateLevel = 6 ; > precip:_Endianness = "little" ; > > skip stuff > > // group attributes: > :GridHeader = > "BinMethod=ARITHMETIC_MEAN;\nRegistration=CENTER;\nLatitudeResolution=0.1;\nLongitudeResolution=0.1;\nNorthBoundingCoordinate=90;\nSouthBoundingCoordinate=-90;\nEastBoundingCoordinate=180;\nWestBoundingCoordinate=-180;\nOrigin=SOUTHWEST;\n" > ; > } // group Grid > > GrADS won't plot the files > > Scanning self-describing file: precip.imerg.mon.202312.nc > gadsdf: SDF file has no discernable X coordinate. > To open this file with GrADS, use a descriptor file with an XDEF entry. > Documentation is at > http://cola.gmu.edu/grads/gadoc/SDFdescriptorfile.html > > But of course the variable does have a good X coordinate > > CDO gives a similar error to the NCO command for converting > > cdo -f nc4c -O copy precip.imerg.mon.202312.nc > <http://precip.imerg.mon.202312.nc> ~/a.nc <http://a.nc> > Segmentation fault > > Is there anyway to convert the files from the command line from netCDF4 > to netCDF4-classic? We had the same issue with some unrelated files > produced from python code. > > I've put one file into /Public/csmith/ > > precip.imerg.mon.202312.nc > > ftp ftp.cdc.noaa.gov > > Thanks for any advice! > > Cathy Smith > > -- > ---------------------------------------------------------------- > Cooperative Institute for Research in Environmental Sciences , > University of Colorado Boulder > Working in the NOAA Physical Sciences Laboratory > https://psl.noaa.gov/people/cathy.smith/ > https://cires.colorado.edu/people/cathy-smith > > Emails about data/webpages may get quicker responses by emailing > address@hidden > > Ticket Details =================== Ticket ID: RJZ-836571 Department: Support netCDF Priority: Normal Status: Closed =================== NOTE: All email exchanges with NSF 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.