-
Notifications
You must be signed in to change notification settings - Fork 446
Open
Labels
Type: BugSomething is not working like it shouldSomething is not working like it should
Description
What went wrong?
As written, I get no contours in my frontogenesis plot, but if I comment out
f.smooth_contour = 2
I do get the expected plot.
Oddly, in the second plot, I see the contours whether I have o.smooth_contour = 2 or not.
This is with matplotlib 3.8.2
Operating System
Linux
Version
Current main branch
Python Version
3.12.0
Code to Reproduce
import datetime
import numpy as np
import metpy.calc as mpcalc
from metpy.io import GempakGrid
from metpy.plots import FilledContourPlot, MapPanel, PanelContainer
from metpy.units import units
nam_file = '/nfs/wxdata1/ldmdata/gempak/model/nam/24103112_nam211.gem'
level = 850*units.hPa
plot_time = datetime.datetime(2024, 10, 31, 12)
p = level.m
gem_data = GempakGrid(nam_file)
u = gem_data.gdxarray(parameter='UREL', date_time=plot_time, level=p)[0] * units('m/s')
v = gem_data.gdxarray(parameter='VREL', date_time=plot_time, level=p)[0] * units('m/s')
T = gem_data.gdxarray(parameter='TMPK', date_time=plot_time, level=p)[0] * units('K')
th = mpcalc.potential_temperature(level, T)
frnt = mpcalc.frontogenesis(th, u, v)
f = FilledContourPlot()
f.data = frnt
f.scale = 1.08e9
f.contours = list(np.arange(-2.5, 2.6, .5))
f.colormap = 'PuOr'
f.colorbar = 'horizontal'
f.smooth_contour = 2
mp = MapPanel()
mp.area = (-105, -70, 30, 50)
mp.layers = 'coastline', 'states', 'borders'
mp.layers_edgecolor = 'brown'
mp.plots = f,
pc = PanelContainer()
pc.size = (11, 8.5)
pc.panels = mp,
pc.show()
omeg = gem_data.gdxarray(parameter='OMEG', date_time=plot_time, level=p)[0] * units('hPa/s')
o = FilledContourPlot()
o.data = omeg
o.contours = range(-9, 10, 1)
o.colormap = 'BrBG_r'
o.colorbar = 'horizontal'
o.smooth_contour = 2
o.plot_units = 'microbar/s'
mp = MapPanel()
mp.area = (-105,-70,30,50)
mp.layers = 'coastline', 'states', 'borders'
mp.layers_edgecolor = 'brown'
mp.plots = o,
pc = PanelContainer()
pc.size = (11, 8.5)
pc.panels = mp,
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