Reputation: 149
I'm working with some sizeable data, with variables temp
, dewpt
, pressure
, u_wind
, and v_wind
.
There are thousands of days of data, and I found several percentiles of the data, and am looking to create sounding plots using the percentile data.
After finding the percentiles and combining each variable's percentile into one dataframe for each percentile, I wind up with dataframes that look like this:
pressure | temp | dewpt |
---|---|---|
897 | 17 | 0 |
889 | 16 | 0 |
885 | 16 | 0 |
... | ... | ... |
I then use the standard advanced sounding code provided by metpy:
T_50th = data_50th['temp'].values * units.degC
Td_50th = data_50th['dewpt'].values * units.degC
p_50th = data_50th['pressure'].values * units.hPa
fig = plt.figure(figsize=(9,9))
add_metpy_logo(fig, 115, 100)
skew = SkewT
skew.plot(p_50th, T_50th, 'r')
skew.plot(p_50th, Td_50th, 'g')
skew.ax.set_ylim(1000,10)
skew.ax.set_xlim(-50, 60)
However, whenever I try to run from the skew.plot
lines and on, I get the error:
AttributeError: Neither Quantity object nor its magnitude ([bunch of numbers]) has attribute 'ax'
I've tried getting it to work, but am out of ideas. Any suggestions on how to get around this error?
Upvotes: 0
Views: 520
Reputation: 5853
I think the problem is that this line:
skew = SkewT
isn't creating a new SkewT
instance, it's making the name skew
point to the SkewT
class (kinda like an alias). To create a new instance, you need to add ()
. Also, if you want it to use the fig
you created above, you need to pass that as well, so I think you want this:
skew = SkewT(fig)
Upvotes: 2