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

[netCDF #EYS-770628]: NetCDF Processing



> I'm trying to get the packaged netCDF file into individual files for
> manipulation using ArcGIS.

OK, I thought of one other possibility that might be simploer than trying
to use CDO or adapt nccopy.  If you can build and install the NCO package:

  http://www.unidata.ucar.edu/netcdf/software.html#NCO

you may be able to use the "ncks" utility directly to create a one-day
file with each invocation of ncks, so you could write a script of ncks
commands that would do what you want.

Specifically, you might be able to use something like

  ncks -d time,1.0,2.0 in.nc out01.nc
  ncks -d time,2.0,3.0 in.nc out02.nc
   ...

where "time" is a coordinate variable that uses units of days since some
base time.  If you used different time unints, you would need to use
different limits for the values of the coordinate variable, given as
floating-point values in the string provided with the "-d" option.

--Russ

P.S.  Also I see a correction is needed to the CDO explanation I provided,
which should have said:

 Usage would be:
 
   cdo -f nc splitday ifile day
 
 that I think would result in output files
 
   day01.nc day02.nc ... day31.nc
 
 for an input file named "ifile".


> -----Original Message-----
> From: Unidata netCDF Support [mailto:address@hidden]
> Sent: Tuesday, December 21, 2010 7:33 AM
> To: address@hidden
> Cc: address@hidden
> Subject: [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:
> 
> 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
> 
> 

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