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

[python #MDL-836889]: metpy station plot



Hi!

Thanks for providing your data and code. The issue is that your lat and lon 
variables are lists, when they need to be Numpy arrays. We'll work on fixing 
StationPlot to allow lists to be passed in, but in the meantime, just wrap 
'slat' and 'slon' with np.array() (you'll need to import Numpy in the script as 
well).

Hope that helps!
Zach

> Hi Zach,
> 
> Sure, no problem. Here’s a link to a tarball containing my code as well as 
> some data.
> 
> https://cardmaillouisville-my.sharepoint.com/:u:/g/personal/j0nayl02_louisville_edu/EYzvdiI-YSFIirOCd2M0Yv4B9bwriUXLbzakkBHx-38riQ?e=Lr3naU
>  
> <https://cardmaillouisville-my.sharepoint.com/:u:/g/personal/j0nayl02_louisville_edu/EYzvdiI-YSFIirOCd2M0Yv4B9bwriUXLbzakkBHx-38riQ?e=Lr3naU>
> 
> 
> > On Jul 9, 2019, at 11:29 AM, Unidata Python Support <address@hidden> wrote:
> >
> > Hi!
> >
> > I ran our station plot example within the MetPy repository on the versions 
> > of Cartopy and Metpy that you provided, but was unable to recreate your 
> > issue. Can you provide your full code and data so that we can recreate the 
> > issue on our side and see what's going on?
> >
> > Thanks,
> > Zach Bruick
> >
> >> Hi,
> >>
> >> I’ve been using station_plot to create maps of a local observation 
> >> network. It was working great, but I was having unrelated issues with my 
> >> anaconda installation and decided to start clean. Now when I run the same 
> >> code, I get the following error message:
> >>
> >> File 
> >> "/Users/jnaylor/anaconda3/lib/python3.7/site-packages/metpy/plots/station_plot.py",
> >>  line 299, in plot_barb
> >> u, v = self.ax.projection.transform_vectors(trans, self.x, self.y, u, v)
> >>
> >> File "lib/cartopy/_crs.pyx", line 437, in 
> >> cartopy._crs.CRS.transform_vectors
> >>
> >> AttributeError: 'list' object has no attribute ‘shape'
> >>
> >> Here’s a little snippet of my code that calls station_plot:
> >> u,v=wind_components(wsparr*units('m/s'), wdirarr*units.deg)
> >> stationplot.plot_barb(u,v)
> >>
> >> I’ve checked the u and v wind components that are being passed into 
> >> station_plot, and they do have a shape attribute:
> >> u.shape
> >> Out[9]: (9,)
> >>
> >>
> >> If I comment out line 299 in station_plot.py ( u, v = 
> >> self.ax.projection.transform_vectors(trans, self.x, self.y, u, v) ), 
> >> things seem to work as they should.
> >>
> >> By the way, this is with version 0.10.0 of metpy and 0.17.0 of cartopy. 
> >> I’m not sure which package versions I was using before when things worked 
> >> fine.
> >
> > Ticket Details
> > ===================
> > Ticket ID: MDL-836889
> > 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 Details
===================
Ticket ID: MDL-836889
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.