Project

General

Profile

problem with the setgridtype function in python

Added by Chloé Prodhomme over 9 years ago

Hello,

I have recently started to use cdo from python instead of bash and I am re-writting old bash script in python. So in my bash script, I was using the following command line:
cdo -r -t ecmwf -f nc setgridtype,regular /cfunas/exp/ecearth/b0cm/daily_grb/tas_6hourly/tas_19810501.grb test1.nc
And in python I use the following line:
f="/cfunas/exp/ecearth/b0cm/daily_grb/tas_6hourly/tas_19810501.grb"
cdo.setgridtype("regular", input=f, output="test2.nc", option="-r -t ecmwf -f nc")

In both cases the line executes without error, but then when I do:
ncdump -h test1.nc
I successfully get the header of the file test1.nc.

While if I do:
ncdump -h test2.nc

I get the following error:
ncdump: test2.nc: NetCDF: Unknown file format

Do you have any idea about this issue ?

Thank you very much in adavance for your help.

Best regards.

Chloé