[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #EYS-770628]: NetCDF Processing

Hi Ted,

> How do I split packed NetCDF files into individual daily .nc files?
> I've got Python and R.

There is an operator "splitday" that's part of the freely available
Climate Data Operators (CDO) software:


that may do what you want, if your input file is acceptable to CDO.

Usage would be:

  cdo -f nc splitday ifile day

that I think would result in output files

  ifile01.nc ifile02.nc ... ifile31.nc

for an input file named "ifile".

If this doesn't do exactly what you want, the source may be helpful
in seeing how to write a program to do what you want in Python or R.

Another possibility would be to modify the C nccopy utility, which just
copies all data from an input netCDF file to an output file, possibly
of a different netCDF format variant.  The completely general nccopy in
the current netCDF snapshot may be overkill, but the simpler nccopy3.c
that just copies netCDF classic data assuming a netCDF-3 library may
be useful:


You might be able to make a single pass over the input file, writing
all data for each day in the output files, depending on the organization
of your data.  For example, if the record dimension corresponded to days,
then your program would loop on input records, creating a new file for
each record with the same structure as the input file, except the record
dimension would be eliminated in the output files.


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: EYS-770628
Department: Support netCDF
Priority: Normal
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.