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
Convert obs units #1329
Convert obs units #1329
Conversation
04c3700
to
e6e370f
Compare
e6e370f
to
85c03cc
Compare
85c03cc
to
d22f9cd
Compare
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.
This is a helpful change and I think (almost) everything looks clean!
c83e92a
to
71cebd2
Compare
f8f06ce
to
87c990f
Compare
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.
This is in really good shape. Just a minor change I noted.
src/metpy/plots/station_plot.py
Outdated
raise ValueError('To convert to plotting units, units must be attached to ' | ||
'scalar value being converted.') | ||
|
||
# Strip units, CartoPy transform doesn't like |
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.
Stripping units shouldn't be necessary, CartoPy only hates them for barbs because it does the extra work of re-projecting the vectors to the transformed coordinate system.
87c990f
to
e03c05f
Compare
Description Of Changes
This is an attempt to add an attribute to the declarative syntax to convert units if they are available in data object. So this will work if using the METAR parser or getting upper air observations from the Iowa State archive through Siphon. You can make it work through reading in another manner and adding in the appropriate units, but that takes some real effort with using the Pandas read_csv file.
Thoughts and feedback on the implementation are very welcome. The two current commits cover 1) adding a unit conversion to the
StationPlot
class and 2) adding the plot_units (for scalar quantities) and vector_plot_units (for vector quantities) as attributes toPlotObs
.Note: Missed some documentation in this initial PR for
PlotObs()
.Also did a slight refactor of
PlotObs()
to make better use of kwargs - don't know if that helps the code readability, but seemed like a good idea.Checklist