Project

General

Profile

CDO Magics plot in Python

Added by David RAGATOA almost 5 years ago

Hi all,

I am trying to use CDO Magics plot in jupyter notebook but I cannot find a way out.
i.e:
cdo contour,device="png" ECMWF_ERA-40_subset.nc ECMWF_ERA-40_subset

what will be the python cdo correct writing to insert device="png" in the line?

Thank you


Replies (6)

RE: CDO Magics plot in Python - Added by Ralf Mueller almost 5 years ago

hi David!

AFAIK notebook behave just like regular python scripts. Please post the python code so that we can debug it

cheers
ralf

RE: CDO Magics plot in Python - Added by David RAGATOA almost 5 years ago

Hello Ralf,

Thank you for your prompt answer.
There is no script. I am just trying myself to py-cdo because I couldn't compile cdo with parallel on my new installed fedora 30 with deepin environment.
I discovered I can use the py-cdo to multiprocess and I find it very good.
I am trying the environment with the different combinations and hit the wall on this one:

cdo contour,device="png" ECMWF_ERA-40_subset.nc ECMWF_ERA-40_subset

the python code gives:

cdo.contour(input = "ECMWF_ERA-40_subset.nc", output = " test")

but the default output is in .ps.
"device=png" can change the output to ;png file but cannot find how to add it in the python line.

Thanks, cheers

RE: CDO Magics plot in Python - Added by Ralf Mueller almost 5 years ago

try this

cdo.contour('device=png',input = "ECMWF_ERA-40_subset.nc", output = "test")

RE: CDO Magics plot in Python - Added by David RAGATOA almost 5 years ago

Thank Ralf. It works perfectly. I'm a bit surprised, I tried it several times yesterday it didn't work.
Many thanks.

RE: CDO Magics plot in Python - Added by Ralf Mueller almost 5 years ago

you can set

cdo.debug = True
to see the internal CDO calls. could be helpful for debugging

cheers
ralf

RE: CDO Magics plot in Python - Added by David RAGATOA almost 5 years ago

Great. Thanks, I'll do.

    (1-6/6)