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

relax dim requirements #407

Merged
merged 12 commits into from
Aug 28, 2020
Merged

Conversation

aaronspring
Copy link
Collaborator

@aaronspring aaronspring commented Aug 2, 2020

Description

  • allows verification over spatial dimensions he.verify(dim=['lon','lat'])
  • internally: dim is converted to list
  • no automatically resetting of correct dim any more, when dim doesnt match metric/comparison/dataset.dims (breaking change): fix tests relying on that
  • all items of dim are not present in skill, for e2r and e2o member does not need to be provided as dim, but still gets reduced in forecast.mean('member')
  • refactor for probabilistic metrics using logical, needed for doppyo PRs

Closes #282

Prepares: doppyo integration

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Performance (if you touched existing code run asv to detect performance changes)
  • refactoring

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. This could point to a cell in the updated notebooks. Or a snippet of code with accompanying figures here.

Checklist (while developing)

  • I have added docstrings to all new functions.
  • I have commented my code, particularly in hard-to-understand areas
  • Tests added for pytest, if necessary.
  • I have updated the sphinx documentation, if necessary.

Pre-Merge Checklist (final steps)

  • I have rebased onto master or develop (wherever I am merging) and dealt with any conflicts.
  • I have squashed commits to a reasonable amount, and force-pushed the squashed commits.

References

Please add any references to manuscripts, textbooks, etc.

@aaronspring aaronspring self-assigned this Aug 2, 2020
@aaronspring aaronspring marked this pull request as draft August 2, 2020 12:24
@aaronspring aaronspring changed the title relax dim requirements to allow spatial dimension to perform metrics … relax dim requirements Aug 2, 2020
Comment on lines +123 to +125
# set default dim # TODO: should we still do this?
if dim is None:
dim = 'init' if kind == 'hindcast' else ['init', 'member']
# check allowed dims
if kind == 'hindcast':
is_in_list(dim, ['member', 'init'], 'dim')
elif kind == 'PM':
is_in_list(dim, ['member', 'init', ['init', 'member']], 'dim')
dim = ['init'] if kind == 'hindcast' else ['init', 'member']
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also prevent default keywords for comparison in this PR. should we @bradyrx?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just keep this as is for this PR. We can discuss the requirement of dim for .verify() funcs. I feel like it's very common to expect a reduction over init for users, but makes sense to expect them to know metric, alignment, etc. We can talk more about it

@coveralls
Copy link

coveralls commented Aug 2, 2020

Coverage Status

Coverage decreased (-0.1%) to 93.66% when pulling 58d1527 on aaronspring:AS_allow_dims into 78eee11 on bradyrx:master.

climpred/metrics.py Outdated Show resolved Hide resolved
@aaronspring aaronspring marked this pull request as ready for review August 2, 2020 18:09
@aaronspring aaronspring mentioned this pull request Aug 2, 2020
19 tasks
Copy link
Member

@ahuang11 ahuang11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only half reviewed

climpred/classes.py Show resolved Hide resolved
climpred/prediction.py Outdated Show resolved Hide resolved
climpred/prediction.py Outdated Show resolved Hide resolved
climpred/prediction.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@bradyrx bradyrx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patience here. This looks awesome and makes things a lot more flexible.

@bradyrx bradyrx merged commit 2259945 into pangeo-data:master Aug 28, 2020
@aaronspring aaronspring deleted the AS_allow_dims branch March 10, 2021 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass dim to xskillscore for spatial dims?
4 participants