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

Fix time indexer encoder and parser in fitting standardized index and… #1843

Merged
merged 6 commits into from
Jul 19, 2024

Conversation

Hem-W
Copy link
Contributor

@Hem-W Hem-W commented Jul 18, 2024

Pull Request Checklist:

What kind of change does this PR introduce?

Fix the encoder and parser for the time indexer in the xc.indices.stats.standardized_index_fit_params and xc.indices.stats.standardized_index to allow no indexer, non-array indexers, and multiple indexers.

Does this PR introduce a breaking change?

No. But the new parser is not compatible with the previous as the format of params.attrs["time_indexer"] is different. If any saved params from previous version were reloaded, it may lead to errors.

Other information:

Copy link

github-actions bot commented Jul 18, 2024

Welcome, new contributor!

It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the AUTHORS.rst and .zenodo.json:

  • The relevant author information has been added to AUTHORS.rst and .zenodo.json

Please make sure you've read our contributing guide. We look forward to reviewing your Pull Request shortly ✨

@github-actions github-actions bot added the docs Improvements to documenation label Jul 18, 2024
Copy link
Collaborator

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

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

This looks excellent! Thanks a lot.

Copy link
Collaborator

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

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

Now that I think of it, was there a need for using jsonpickle instead of the builtin json ?

jsonpickle is a dependency in xclim because of some stuff in sdba where json can't do the job. When the plan of taking sdba out of xclim is executed, we'll want to remove unneeded dependencies.

xclim/indices/stats.py Outdated Show resolved Hide resolved
xclim/indices/stats.py Outdated Show resolved Hide resolved
xclim/indices/stats.py Outdated Show resolved Hide resolved
@Hem-W
Copy link
Contributor Author

Hem-W commented Jul 19, 2024

Now that I think of it, was there a need for using jsonpickle instead of the builtin json ?

jsonpickle is a dependency in xclim because of some stuff in sdba where json can't do the job. When the plan of taking sdba out of xclim is executed, we'll want to remove unneeded dependencies.

Thank you for pointing out. I believe json can meet the needs.

@Hem-W Hem-W requested a review from aulemahal July 19, 2024 02:01
Copy link

Warning

This Pull Request is coming from a fork and must be manually tagged approved in order to perform additional testing.

Copy link
Collaborator

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

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

Approved again, thanks!

@aulemahal aulemahal added the approved Approved for additional tests label Jul 19, 2024
@coveralls
Copy link

Coverage Status

coverage: 90.679% (+0.02%) from 90.658%
when pulling 683e2a7 on Hem-W:fix-SI-time-indexer
into e01541e on Ouranosinc:main.

@aulemahal aulemahal merged commit 32341d9 into Ouranosinc:main Jul 19, 2024
19 checks passed
@Hem-W Hem-W deleted the fix-SI-time-indexer branch July 21, 2024 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests docs Improvements to documenation
Projects
None yet
3 participants