Tuples not accepted for dim keyword.
See original GitHub issueDescribe the bug
When passing dimensions to dim=...
in .verify(...)
, tuples break it and they should not, since it’s a base python type similar to list.
Code Sample
import climpred
hind = climpred.tutorial.load_dataset("CESM-DP-SST-3D")
verif = climpred.tutorial.load_dataset("FOSI-SST-3D")
hindcast = climpred.HindcastEnsemble(hind).add_observations(verif)
# works
hindcast.verify(
metric="acc", comparison="e2o", alignment="maximize", dim=("nlat")
)
# works
hindcast.verify(
metric="acc", comparison="e2o", alignment="maximize", dim=["init", "nlat"]
)
# breaks
hindcast.verify(
metric="acc", comparison="e2o", alignment="maximize", dim=("init", "nlat")
)
Expected behavior
We should be able to pass in tuples of len > 1 to dim
.
Additional context Should be an easy fix. Track wherever this error is thrown:
ValueError: Expected `dim` as `str`, `list` or None, found ('nlat', 'nlon') as type <class 'tuple'>.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Working with Members, Tuples, and Sets (MDX)
MDX provides several functions that return sets. Explicitly typing tuples and enclosing them in braces is not the only way to retrieve a...
Read more >How to flatten a tuple in python - Stack Overflow
First it will be checked if type is tuple, if not, it "tuples" the argument ... for each value of the internal tuple...
Read more >Python Return Multiple Values – How to Return a Tuple, List ...
In this article, we'll explore how to return multiple values from these data structures: tuples, lists, and dictionaries. Tuples. A tuple is an ......
Read more >Better support for operators that return (named) tuples of tensors
In the max example above, in particular, adding a dim argument to max requires rewriting the left-hand side of that expression to make...
Read more >Mapping over a tuple | Apple Developer Forums
I currently have code that looks like this: let pxLeft = abs(left.spec.pixelsForDimension(left.dimension, imageSize: size)). let pxRight = abs(right.spec.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you want any Iterable (str, list, tuple, np.array, pd.Series, xr.DataArray), you can do
Or define a constant somewhere
Haha yea true. The most dimensions I’ve worked with experiment, member, initialization, forecast_step, level, lat, lon
But ( just reminded me of pd.cut and the results are like (3, 4], where ] is inclusive of 4 or something