[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #EYS-770628]: NetCDF Processing
- Subject: [netCDF #EYS-770628]: NetCDF Processing
- Date: Tue, 21 Dec 2010 09:33:09 -0700
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:
https://code.zmaw.de/embedded/cdo/1.4.6/cdo.html
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:
http://www.unidata.ucar.edu/netcdf/examples/programs/nccopy3.c
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
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