Re: [python-users] Decluttering Surface Observations with MetPy

  • To: Ryan May <rmay@xxxxxxxx>
  • Subject: Re: [python-users] Decluttering Surface Observations with MetPy
  • From: Kiko <kikocorreoso@xxxxxxxxx>
  • Date: Tue, 20 Jun 2017 10:53:28 +0200
2017-06-19 23:53 GMT+02:00 Ryan May <rmay@xxxxxxxx>:

> On Mon, Jun 19, 2017 at 3:36 PM, Bryan Guarente <guarente@xxxxxxxx> wrote:
>
>> I am trying to plot the surface observations for some archived datasets
>> over ALL of Canada, Greenland, and the northern United States for a course
>> I am going to be teaching.  Is there a declutter option like in IDV for
>> surface observations in MetPy or Python more generally?  I have already
>> reduced the font size, so the surface plots are smaller which makes it
>> slightly better, but doesn't fix all of the problems.  I also added color
>> to make it more obvious when overlapping numbers were for different
>> portions of the surface obs.
>>
>> I considered looping through the dataset and masking out the ones that
>> are within X degrees of one another in the lat and long dimensions, but
>> that might drop some "good" observation stations in favor of the less
>> accurate ones.  Maybe this means it would be best to plot data only from
>> certain types of observation stations like ASOS and AWOS, or non-AUTO
>> stations.  Is there a way to do that easily within MetPy or Python?
>>
>> Are there other solutions out there to this problem?
>>
>
>
If you are using Jupyter notebook for the course maybe you could check
folium [1][2]. Folium uses leaflet [3] under the hood and you delegate all
this stuff to the library plus it is interactive. If you are not using the
notebook Folium can create standalone HTML documents that maybe could be
also helpful.

[1] http://python-visualization.github.io/folium/
[2]
http://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/1000_MarkerCluster.ipynb
(interesting example)
[3] http://leafletjs.com/


> Bryan,
>
> MetPy, in 0.5, added a `reduce_point_density` function to solve this very
> problem:
>
> https://unidata.github.io/MetPy/api/generated/metpy.
> calc.reduce_point_density.html#metpy.calc.reduce_point_density
>
> The approach it takes is just like the one you described, dropping all
> points within a radius of stations that are kept (working with lon/lat or
> you can use map projection coordinates); it takes a `priority` argument to
> allow you to specify a value for each station that dictates how "important"
> that station is (essentially it controls the sorted order of the stations).
> You could do something like assign 1 to ASOS/AWOS and 0 to others (or could
> do something more sophisticated if you have the information). Sadly, this
> function isn't *yet* featured in our examples (new issue now:
> https://github.com/Unidata/MetPy/issues/460), but you can see it in some
> of our workshop materials:
>
> https://github.com/Unidata/unidata-python-workshop/blob/
> master/notebooks/Surface_Data/Surface%20Data%20with%
> 20Siphon%20and%20MetPy.ipynb
>
> For times when text is overlaid, you can use matplotlib's path effects to
> increase the legibility, like we do here for satellite images:
>
> https://github.com/Unidata/unidata-python-workshop/blob/
> master/notebooks/Satellite_Data/Working%20with%20Satellite%20Data.ipynb
>
> There shouldn't be any issues with passing `patheffects=[...]` to the
> station plotting methods.
>
> Ryan
>
> --
> Ryan May, Ph.D.
> Software Engineer
> UCAR/Unidata
> Boulder, CO
>
> _______________________________________________
> NOTE: All exchanges posted to Unidata maintained email lists are
> recorded in the Unidata inquiry tracking system and made publicly
> available through the web.  Users who post to any of the lists we
> maintain are reminded to remove any personal information that they
> do not want to be made public.
>
>
> python-users mailing list
> python-users@xxxxxxxxxxxxxxxxxxxxxxxx
> For list information, to unsubscribe, or change your membership options,
> visit: http://www.unidata.ucar.edu/mailing_lists/
>
  • 2017 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: