[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:


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: 



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

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.