rigoudyg / climaf

CliMAF - a Climate Model Analysis Framework - doc at : http://climaf.readthedocs.org/
Other
17 stars 7 forks source link

Notes about cscalar documentation and usage #222

Open jypeter opened 3 years ago

jypeter commented 3 years ago

There is a slight ambiguity in the cscalar documentation

It is on the Functions returning ClimAF objects page but it returns a scalar, which is not a ClimAF object

Besides, contrary to the other functions listed on this page (the few that I have used), it can't operate on an ensemble. It could theoretically operate on an ensemble, and return a regular dictionary, but I have tried and it just fails

# Works on a dataset/member
>>> cscalar(diff_ens['NorESM1-F_NCC'])
-2.6253838e-07

# Fails on an ensemble
>>> cscalar(diff_ens)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/ciclad-home/jservon/Evaluation/CliMAF/climaf_installs/climaf_V2.0.0/climaf/functions.py", line 20, in cscalar
    return cvalue(dat)
  File "/ciclad-home/jservon/Evaluation/CliMAF/climaf_installs/climaf_V2.0.0/climaf/driver.py", line 1295, in cvalue
    return cMA(obj,deep=deep).data.flat[index]
AttributeError: 'dict' object has no attribute 'data'

Possible improvements: