[python #OAK-610358]: MetPy Monday No. 143 Questions
- Subject: [python #OAK-610358]: MetPy Monday No. 143 Questions
- Date: Fri, 09 Oct 2020 13:31:35 -0600
Hello! Thanks for reaching out.
There are a few ways to do this. One such could involve building off the MetPy
Mondays example, and looping with decadal increments. Here's an approximate
. . .
import numpy as np
from matplotlib import cm
decades = np.arange(1960, 2020, 10)
colors = cm.get_cmap('tab10', len(decades)).colors
for year, color in zip(decades, colors):
df_temp = df_hu[(datetime(year, 1, 1) <= df_hu['Time']) & (df_hu['Time']
< datetime(year+10, 1, 1))]
<insert plotting code from video with our new df_temp, now specify
. . .
but there are also potentially other clever Pandas ways to accomplish this
task, including using df.query and df.groupby. Look into these! Either way,
play around with this, and I hope this at least points you in the right
direction. If you have any trouble implementing this, don't hesitate to reach
out with further questions.
All the best,
> I was learning the material in the videos #142 and # 143, and I had a
> additional question. What would be the modification to the datetime function
> if I wanted to keep the original line :
> df_hu = df_hu [df_hu [âTimeâ]>datetime(2020-##,1,1)]
> but I also wanted to separate this prescribed increment by decades within the
> selection and color code them.
Ticket ID: OAK-610358
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.