-
Notifications
You must be signed in to change notification settings - Fork 447
Closed
Labels
Type: BugSomething is not working like it shouldSomething is not working like it should
Milestone
Description
What went wrong?
When I use the code below, I get the following plot:

I expect to see 0 rather than -0.
Presumably, this is from the round-off error going from 0 F to Celsius (-17.8 in the METAR) and back again (now -0.04).
Operating System
Linux
Version
1.5.1
Python Version
3.11.5
Code to Reproduce
import os
from datetime import datetime
from tempfile import NamedTemporaryFile
from metpy.io import metar
from metpy.plots import PlotObs, MapPanel, PanelContainer
msg = 'METAR KSNT 281500Z AUTO 00000KT 10SM CLR M18/M20 A3044 RMK AO2 T11781200'
f = NamedTemporaryFile(mode='w+', delete=False)
f.write(msg)
f.close()
sfc_obs = metar.parse_metar_file(f.name)
os.unlink(f.name)
obs = PlotObs()
obs.data = sfc_obs
obs.time = datetime(2023, 11, 28, 15)
obs.level = None
obs.fields = ['air_temperature']
obs.plot_units = ['degF']
obs.locations = ['C']
obs.colors = ['red']
obs.formats = [None]
panel = MapPanel()
panel.projection = 'lcc'
panel.area = 'id'
panel.layers = ['coastline','borders','states']
panel.plots = [obs]
pc = PanelContainer()
pc.size = (8, 6)
pc.panels = [panel]
pc.show()Errors, Traceback, and Logs
No response
Metadata
Metadata
Assignees
Labels
Type: BugSomething is not working like it shouldSomething is not working like it should