-
Notifications
You must be signed in to change notification settings - Fork 61
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
Dynamic time selection #2055
base: main
Are you sure you want to change the base?
Dynamic time selection #2055
Conversation
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
Please make sure you've read our contributing guide. We look forward to reviewing your Pull Request shortly ✨ |
Warning This Pull Request is coming from a fork and must be manually tagged |
@baptistehamon Thanks so much for the Pull Request! I'm curious about the error and failure you ran into. Do you think you could post the stack trace of those problems, either in a comment here or in a gist? The |
Here is the stack trace when I run ============================= test session starts ============================= tests\test_analog.py ......................... [ 1%] =================================== ERRORS ====================================
P:\My Documents\GitHub\GitHub-Contribs\xclim\tests\test_sdba\conftest.py:107
E AttributeError: module '_locale' has no attribute 'nl_langinfo' tests\test_modules.py:286: AttributeError tests/test_generic_indicators.py::TestFit::test_nan tests/test_indices.py: 12 warnings tests/test_units.py::test_to_agg_units[\xb0C-argmax-doymax-0-1] tests/test_sdba/test_adjustment.py::TestExtremeValues::test_nan_values -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html |
@baptistehamon Sorry for the delay, last days were busy at Ouranos. I took the liberty to edit your code, I hope you don't mind too much... My first goal was to add support to the case where the doy bounds are DataArrays with non-temporal dimensions, and I got carried away. The logic for the "time" case is pretty much the same though. I tried to simplify where I could and use purer xarray syntax to cover more cases. I'll write a summary of the major changes I made tomorrow. |
I haven't thought about cases without a 'time' dimension, thanks a lot for implementing and for improving my PR ! |
Woops, when I wrote my last comment, I forgot that it was friday. So by « tomorrow » I meant « the next working day » ;). My changes:
I'll add a few tests for the new cases when I get more time to work on this! |
Ok, so the last commit finished up the work on |
…im into dynamic-time-selection
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Ouf. That required more change than I first thought! @huard Most notably, this PR makes three significant changes to the missing methods:
The results are now a bit different than before as one can see with the The tests I added are quite simple, but they should cover most cases of normal use. @baptistehamon thanks for starting this PR, even if it took me more work, it accelerated long-needed changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read through the code and could mostly understand what's going on. The only thing that I believe is missing from the testing is the include_bounds
logic. It's simple enough that I assume its working, but still.
Pull Request Checklist:
number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
The PR improves the
select_time
function providing the possibility to select time based onxr.DataArray
of days of year._get_doys
outsideselect_time
mask_between_doys
functionselect_time
to work with the new workflow to select time with doysOther information:
I've run pytest but I had an error (ERROR tests/test_sdba/test_adjustment.py::TestLoci::test_reduce_dims) and a failed (FAILED tests/test_modules.py::test_encoding - AttributeError: module '_locale' has no attribute 'nl_langinfo') but I don't know how to fix this.