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

ValueError 'init' because it is not a variable or dimension in this dataset #813

Closed
semvijverberg opened this issue Jan 31, 2023 · 2 comments
Labels

Comments

@semvijverberg
Copy link

Describe the bug
When executing he.verify(), it raises a ValueError that 'init' is not a variable or dimension in this dataset. However, when looking at the he object (and the input), init is a dimension. Is this correct behavior? Or am I doing something wrong?

Code Sample

he = climpred.HindcastEnsemble(init).add_observations(obs)

model_edges = (
    init
    # .groupby("init.month")
    .quantile(q=[1/2], dim=["init", "member"], skipna=False).rename(
        {"quantile": "category_edge"}
    )
)

obs_edges = obs.quantile(q=[1/2], dim=["time"], skipna=False).rename(
    {"quantile": "category_edge"}
)
# %%

skill = he.verify(
    metric="rps",
    comparison="m2o",
    alignment="same_inits",
    dim=["member", "init"],
    category_edges=(obs_edges, model_edges),
)

raises:
image

he object:
image

Expected behavior
That it does not raise this error ;).

Output of climpred.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:47) [Clang 12.0.1 ] python-bits: 64 OS: Darwin OS-release: 20.6.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: nl_NL.UTF-8 LOCALE: nl_NL.UTF-8

climpred: 2.3.0
xarray: 2023.1.0
pandas: 1.4.2
numpy: 1.23.2
scipy: 1.8.0
cftime: 1.6.0
netcdf4: None
nc_time_axis: 1.4.1
matplotlib: 3.5.1
...
pip: 22.0.4
conda: None
IPython: 7.32.0
sphinx: 4.5.0

@semvijverberg
Copy link
Author

Sorry, I found the error. My model_edges mist the dimension 'init'!

@aaronspring
Copy link
Collaborator

Thanks for raising it though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants