python-cdo mul
Added by Thomas Kroißenbrunner about 2 years ago
Hello! I was wondering what the correct way is to multiply two fields of a variable stored in netCDF files, using python-cdo.
Here is what i have, but doesnt work, because when i call cdo.info on the product, it just shows me a memory adress!
product = cdo.mul(field1, field2)
output is: <cdo.Cdo.__getattr__.<locals>.Operator object at 0x7f79049dd480>
I couldn't find any information on the python binding of this command, or really also never found a nice python-cdo documentation.
Thank you in advance!
Replies (2)
RE: python-cdo mul - Added by Thomas Kroißenbrunner about 2 years ago
Edit: out put as in
print(cdo.info(input=product))
RE: python-cdo mul - Added by Karin Meier-Fleischer about 2 years ago
Hi Thomas,
here is a short example script to demonstrate the use of cdo.mul:
#!/usr/bin/env python from cdo import Cdo cdo = Cdo() ofile = cdo.topo(options='-f nc') print(cdo.infon(input=ofile)) omul = cdo.mul(input=ofile+' '+ofile) print(cdo.infon(input=omul))