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

METAR/Station Plot fixes #3297

Merged
merged 3 commits into from
Nov 30, 2023
Merged

METAR/Station Plot fixes #3297

merged 3 commits into from
Nov 30, 2023

Conversation

dopplershift
Copy link
Member

Description Of Changes

Main thrust is fixing #3296, by adjusting our default formatter for plot_parameter() to use 'z.0f' to avoid '-0' (and an appropriate workaround on Python < 3.11).

Also fix an issue I noticed while digging in, where the units dictionary on the parsed DataFrame in our METAR code is a fixed instance; natural in-place modification of this dictionary (e.g. df.units['air_temperature'] = 'degF') would affect all other instances (past and future). We can avoid this by making sure returned DataFrames get a copy instead.

Checklist

Attach a copy of the dictionary of units to the DataFrame so that units
can be modified in-place without affecting future calls.
For modern Python, we can just use the 'z' format option. For earlier
Python versions, we need to manually round and add a positive 0 to the
result to clear the negative 0.
@dopplershift dopplershift added Type: Bug Something is not working like it should Area: Plots Pertains to producing plots Area: IO Pertains to reading data Area: Units Pertains to unit information labels Nov 29, 2023
@dopplershift dopplershift added this to the November 2023 milestone Nov 29, 2023
@dopplershift dopplershift requested a review from a team as a code owner November 29, 2023 22:52
@dopplershift dopplershift requested review from dcamron and removed request for a team November 29, 2023 22:52
@dopplershift
Copy link
Member Author

dopplershift commented Nov 29, 2023

Didn't think to run all tests locally, but it turns out some of our declarative tests were indeed plotting '-0', and this changes that. Need to update the images...

Copy link
Collaborator

@kgoebber kgoebber left a comment

Choose a reason for hiding this comment

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

Looks good to me. I never really minded the -0, but can understand that it is a bit awkward.

@kgoebber kgoebber merged commit 7efaedc into Unidata:main Nov 30, 2023
34 checks passed
@dopplershift dopplershift deleted the sfc-obs-fixes branch November 30, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: IO Pertains to reading data Area: Plots Pertains to producing plots Area: Units Pertains to unit information Type: Bug Something is not working like it should
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PlotObs plots minus zero when temperature is 0 F
2 participants