Project

General

Profile

python: getting

Added by Arne Kriegsmann about 11 years ago

Greetings...

I am having a problem when I try to read an array directy into a python-variable:

t=cdo.fldsum(input=filen,returnArray='pr')
print t

The output:
<scipy.io.netcdf.netcdf_file object at 0x2752410>

I am using python/2.7-ve1 and cdo/1.5.9 on snow.

Thanks for your help,
Arne


Replies (5)

RE: python: getting - Added by Ralf Mueller about 11 years ago

could you upload the file?

RE: python: getting - Added by Ralf Mueller about 11 years ago

which version of cdo.py do you use? Try

pip search cdo

RE: python: getting - Added by Arne Kriegsmann about 11 years ago

cdo - python bindings to CDO
INSTALLED: 1.0.10
LATEST: 1.2.1

RE: python: getting - Added by Ralf Mueller about 11 years ago

You'll need 1.2.0 for your code example. But you could use the methods

cdo.fldsum(input=filen,returnArray='pr').variables['tsurf'][:]
to get the numpy array. The more direct access was introduced in 1.2.0. Unfortunately the system installation from CIS prevents user updates. I will mail to CIS to update cdo.py.

    (1-5/5)