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

Snow season length is 0 if there is 0 snow - fix solar_zenith_angle typo #1492

Merged
merged 7 commits into from
Oct 13, 2023

Conversation

aulemahal
Copy link
Collaborator

@aulemahal aulemahal commented Oct 5, 2023

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGES.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

snd_season_length and snw_season_length got implemented with the same check as their *_season_start and *_season_end counter parts, with a mask where : not at_least_n_valid(snw.where(snw > 0), n=1, freq=freq).

However, this means the output is NaN if all inputs are 0. This makes sense in the DOY case (can't a have a start/end date if there's no season), but it doesn't in the "length" case. Instead, I think (as does the issue raiser) an all-0 snow timeseries simply means a season length of 0. Thus, I removed the .where(snw > 0) part of the test for those two indicators.

EDIT: I also slipped in another fix for xc.indices.helpers.cosine_of_solar_zenith_angle. There was a typo in the xr.apply_ufunc call.

Does this PR introduce a breaking change?

Yes because it will change the output of two indicators, but I think this is for the best. The previous behaviour was not documented as such in the doc, I believe the new one is actually more intuitive. No need for a warning, IMO.

@aulemahal aulemahal requested review from huard and coxipi October 5, 2023 14:46
@aulemahal aulemahal marked this pull request as ready for review October 5, 2023 14:47
@github-actions github-actions bot added the indicators Climate indices and indicators label Oct 5, 2023
@github-actions
Copy link

github-actions bot commented Oct 5, 2023

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

@aulemahal aulemahal changed the title Snow season length is 0 if there is 0 snow Snow season length is 0 if there is 0 snow - fix solar_zenith_angle typo Oct 5, 2023
CHANGES.rst Outdated Show resolved Hide resolved
@aulemahal
Copy link
Collaborator Author

@Zeitsperre do you know why the coveralls action is still hanging here ?

@aulemahal aulemahal added the approved Approved for additional tests label Oct 13, 2023
@Zeitsperre
Copy link
Collaborator

Coveralls always expects a hook from GitHub with some stats to compare to. The problem is that because we aren't running all tests, the coverage will always be lower than expected, so the statistic is useless for developers until we build with the approved tag.

Maybe there's a way to send along a skip signal to coveralls when we're only building with Python3.9? I'll look into it.

@aulemahal
Copy link
Collaborator Author

Hum... Ok, but then is that the reason I can't merge ?

@github-actions github-actions bot added the CI Automation and Contiunous Integration label Oct 13, 2023
@github-actions
Copy link

Note
It appears that this Pull Request modifies the main.yml workflow.

On inspection, the XCLIM_TESTDATA_BRANCH environment variable is set to the most recent tag (v2023.9.12).

No further action is required.

@Zeitsperre
Copy link
Collaborator

Zeitsperre commented Oct 13, 2023

Oh, no, it isn't. For some reason, David's PR review didn't trigger the approved label. Weird.

@aulemahal aulemahal merged commit 435ea09 into master Oct 13, 2023
17 checks passed
@aulemahal aulemahal deleted the noseason-is-0 branch October 13, 2023 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests CI Automation and Contiunous Integration indicators Climate indices and indicators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"parallel" -> "parallelized" Number of days can be both nan and 0
3 participants