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

  • To: Bryan Guarente <guarente@xxxxxxxx>
  • Subject: Re: [python-users] Decluttering Surface Observations with MetPy
  • From: Ryan May <rmay@xxxxxxxx>
  • Date: Mon, 19 Jun 2017 15:53:15 -0600
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?
>


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
  • 2017 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: