[python #DCS-251943]: MetPy time series plots
- Subject: [python #DCS-251943]: MetPy time series plots
- Date: Fri, 02 Oct 2020 14:27:48 -0600
Can you share the code you're using, at least for plotting the bottom frame?
It's hard to guess what's going on. There's no reason I can think of why you
couldn't plot all the precip data.
Without seeing the code, my only suggestions are to use separate arrays of time
for precip vs. current weather, or to use the same full list of times from
precip, but fill in missing (0) current weather reports for the times when you
don't want to plot any symbol.
> One more question about plotting the weather symbols on a timeseries plot.
> I'm making three hour time series plots and would like to plot ALL of the
> precip accum data but only plot the weather symbols every hour. From what
> I've tried it seems the number of precip accum data points I plot must be
> the same as the number of weather symbols I plot. Is there some way around
> this so I can get a more continuous precip plot?
> In the attached image, the last plot is the one I'm working on.
> address@hidden> wrote:
> > Greetings!
> > You can actually accomplish this using MetPy's `StationPlot` class. A
> > basic example of using this for a standard 2D plot is here:
> > https://unidata.github.io/MetPy/latest/examples/plots/Station_Plot.html#sphx-glr-examples-plots-station-plot-py
> > and the full documentation of this class is here:
> > https://unidata.github.io/MetPy/latest/api/generated/metpy.plots.StationPlot.html#metpy.plots.StationPlot
> > `StationPlot` works just fine for plotting on any axis coordinates, not
> > just spatial, so you can use it with standard matplotlib timeseries plots,
> > as done in this example code:
> > from datetime import datetime, timedelta
> > import matplotlib.pyplot as plt
> > from metpy.plots import StationPlot, current_weather
> > import numpy as np
> > # Create some dummy data, including WMO codes for current weather
> > cur_wx_codes = [65, 85, 95, 99, 54, 57, 59, 67, 88, 82, 79, 75]
> > dummy_y_vals = np.zeros(len(cur_wx_codes)) # only to place on plot
> > dates = [datetime.utcnow() + timedelta(hours=i) for i in
> > range(len(cur_wx_codes))]
> > temps = np.random.randn(len(dates)) * 10 + 70
> > # Create a plot using matplotlib's StationPlot
> > fig = plt.figure()
> > ax = fig.add_subplot(1, 1, 1)
> > sp = StationPlot(ax, dates, dummy_y_vals)
> > ax.plot(dates, temps)
> > sp.plot_symbol('C', cur_wx_code, current_weather, fontsize=16,
> > color='red')
> > Hope this helps,
> > Ryan
> > > I have ASOS csv data that I read into a dataframe and turn into a series
> > of
> > > time series plots (see attachment called ops.asos.202002070440.kbgm.png).
> > >
> > > I'd like to modify the last time series plot in the image (Precip) by
> > > adding in hourly weather condition symbols along the bottom as in the
> > > attached gempak image (gempak_timeseries_with_currentWeatherSymbols.pdf).
> > >
> > > Are there MetPy utilities that might help me do this?
> > Ticket Details
> > ===================
> > Ticket ID: DCS-251943
> > Department: Support Python
> > Priority: Low
> > Status: Closed
> > ===================
> > 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.
Ticket ID: DCS-251943
Department: Support Python
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.