0

I need to permute the dimensions of my netcdf file from time,lat,lon, to lat,lon,time.

The NCO command for that purpose is : " ncpdq -a lat,lon,time input.nc input_fixed.nc"

How can I run this command using Python library 'pynco' please ?

2 Answers2

1

Please read the example on this page: https://github.com/nco/pynco Those instructions suggest this invocation

from nco import Nco
nco = Nco()
nco.ncpdq(input=in.nc, output=out.nc, options="-a lat,lon,time")
Charlie Zender
  • 5,929
  • 14
  • 19
0

The other answer didn't work for me, and there is no longer any mention of ncpdq in the github example. However, the following syntax seems to work:

nco.ncpdq(input="in.nc", output="out.nc", options=['-a', 'lat,lon,time'])

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
tmpst
  • 51
  • 1