[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #DBA-624487]: metpy station plot question


That's interesting--apparently StationPlot doesn't like that. Could you open an 
issue at:


And include sample data and complete (and preferably minimal) code that 
generates the error? I'd be interested in seeing what we can do to make MetPy 
support this out of the box.

For now, I think your best bet to work around this shortcoming is to use 
matplotlib's `date2num` function to manually convert the dates to numbers for 
plotting (which is what matplotlib does under the hood normally for you):



> Hi there!
> Iâm in the CSU atmos science department.  You gave a great seminar last 
> summer and really appreciate your time.
> Iâve got a quick question for youâ
> Iâm trying to make a âmeteogramâ like plot.  I want to use a horizontal 
> axis to plot sky condition at a single station over time.  My x-axis uses a 
> date format.
> Metpy seems to have a problem with this.  For example,
> y=  np.ones(len(df2.index))
> x= np.arange(0,31,1)
> stationplot = StationPlot(ax, x , y, fontsize=12)
> stationplot.plot_symbol('C', df2['Sky'].astype(int) , sky_cover)
> works great.
> BUT, if make the x-axis
> x= df2.index   # a date,
> it plots fine but gives an error message, âinvalid type promotion'
> [cid:B6B4A47D-6C45-4234-984F-F05CD8D32F0B]
> Does âstationplotâ not like dates as x-axis values?  Is there a 
> workaround?

Ticket Details
Ticket ID: DBA-624487
Department: Support Python
Priority: Low
Status: Open
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.