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

[netCDF #LJJ-126826]: How to restructure a variable so that time becomes the slowest changing dimension?



Hi James,

> I want to restructure a NetCDF variable which has dimensions (lat, lon,
> time) to an orientation with dimensions (time, lat, lon).  Is there a way
> to do this simpler than writing a conversion program myself (I am using
> Python with NumPy and the Google NetCDF4 API)? I wrote the variables in
> this (lat, lon, time) orientation because that worked out to be much faster
> (see
> http://stackoverflow.com/questions/17051107/does-each-assignment-of-values-to-an-output-netcdf-variable-result-in-a-rewrite/17069811#17069811)
> but now that the data is in NetCDF it needs to be reoriented so that time
> is the slowest changing (outermost) dimension, i.e. (time, lat, lon).  Is
> this easily done, and if so then how?

It's easily done with the NetCDF Operators package:

  http://nco.sourceforge.net/

using the NCO program named ncpdq (Permute Dimensions Quickly):

  ncpdq -a time,lat,lon in.nc out.nc

> P.S. Sorry if this is a question more suited to the mailing list, if so
> please let me know and I can send there instead, but this seems beginner
> level so I thought I'd run it past you guys first.

No problem, if you have any troubles with building nco or using it, you should
ask on the NCO forums at sourceforge: 

  http://sourceforge.net/projects/nco/forums/forum/9830

--Russ

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



Ticket Details
===================
Ticket ID: LJJ-126826
Department: Support netCDF
Priority: Normal
Status: Closed