Project

General

Profile

How to read data into a numpy array?

Added by Arne Kriegsmann over 12 years ago

I have a dataset which I want to read into a numpy-Array.
But all examples I have found make use of a cdo operator like cdo.fldsum, and thus, do not return the original field.

But what I need is the original data without doing some calculation on it.
Is there something like a cdo.read Operator?


Replies (1)

RE: How to read data into a numpy array? - Added by Ralf Mueller over 12 years ago

in the current release 1.0.5 there is a new operator called readCdf, which directly returns a pycdf objects. Use it like

cdf = cdo.readCdf("ifile.nc")
or
cdf = cdo.readCdf(cdo.copy(input="ifile.grb",options="-f nc"))
and get the list of variable names with
cdf.variables().keys()

regards
ralf

    (1-1/1)