Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes about cscalar documentation and usage #222

Open
jypeter opened this issue Oct 5, 2021 · 0 comments
Open

Notes about cscalar documentation and usage #222

jypeter opened this issue Oct 5, 2021 · 0 comments

Comments

@jypeter
Copy link

jypeter commented Oct 5, 2021

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:

  • add details to the cscalar documentation
  • display an error message when called on an ensemble
  • or return a dictionary with scalars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant