Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FIX: allow zero and one as dates via wrapping#15416

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

jklymak
Copy link
Member

PR Summary

Unit converters should not simply fail if given legitimate floating point numbers. Right nownum2date fails ifx<1, and that causes problems like#15409 because our default axes limits are0, 1.

This PR simply wraps the date to a valid date between 1 and 3652059 days. This means that the default [0, 1] maps to [9999-12-31, 0001-01-01], which is nonsense, but its perhaps better than errorring out.

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@dstansby
Copy link
Member

I agree that converters shouldn't fail, but I think with these changes they give very misleading/nonsense answers which is worse! Maybe I'm missing something though - is there a larger motivation to make this change other than just "converters shouldn't fail"?

@jklymak
Copy link
MemberAuthor

We have times where an axes is dates but during draw gets temporarily set back to default limits of zero and one. This errors out. See#15409 for the latest incantation of this problem but there have been quite a few.

This suggestion does return nonesense if the user somehow uses the wrong x/ylimits or puts bad data on the date axis. Right now we error if the data is bad enough (ie x<1) but not if it’s sort of bad (x>1).

See#15148 for a different approach. But we really can’t be in a position where a unit converter throws errors on zero.

@jklymak
Copy link
MemberAuthor

jklymak commentedOct 14, 2019
edited
Loading

Of course the other option is to change the epoch so zero isn’t year 0001. See#15008.

@tacaswell
Copy link
Member

This can invert the direction of the axis, I don't recall off the top of my head how 'sticky' that is.

@efiring
Copy link
Member

If the problem is the default [0, 1], how about changing that to [1, 2] or [1, 10], or ...?

@jklymak
Copy link
MemberAuthor

The 0-1 default is the default for all axes. I guess we could change that, but folks who make an axes and position text on it by data position will find their code broken.

@efiring
Copy link
Member

I don't like the nonsense aspect of this solution; my reaction is the same as@dstansby's, that this cure is worse than the disease.

@jklymak
Copy link
MemberAuthor

My strong preference is that we change the epoch.

@jklymak
Copy link
MemberAuthor

I'll close this as a bit of a silly idea, however, I still think we should do#15008

@jklymakjklymak deleted the fix-allow-zero-one-dates branchOctober 26, 2019 21:06
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@jklymak@dstansby@tacaswell@efiring

[8]ページ先頭

©2009-2025 Movatter.jp