Pablo Romero wrote:
Here's a link to the website that's creating the basemap plots with the "H"'s and "L"'s:
As you can see, this website's "pressure chart" interface is based on creating individual images for each point in a time series. And, if you click on any one of the "region" links below the plot, you'll be presented with the same pressure plot for a sub-region; obviously, this needs to be based on an automated process, since I seriously doubt someone is manually creating each plot for each time step for each "sub-region" in their catalog...bottom line, there MUST be a systematic way to add those "H" and "L" characters to closed contours that are local min/max AND that are LARGE enough to hold an "H" or "L" character (as you mentioned, some of the smaller closed contours dont display the 'H'/'L' characters).
So the big question is: how could one go about setting something like this up???
Do you think it would be possible to accomplish this with the function/tutorial you provided???
If so, could you please help me understand a little more how I would go about using that function? (sorry, I wasnt very clear on how it should be applied to this problem).
I know for a fact that this website is using matplotlib/basemap to create these plots. Theyre using a python interface to matplolib/basemap named 'pygrads'; it provides basemap/mpl plotting capabilities to an existing application named GrADS. I just dont know how the heck they got those "H/L" characters there....
Thanks again for the help,
Pablo: I've added a script (attached to this email) called "plothighsandlows.py" in the basemap examples directory that shows how to do this. It uses scipy.ndimage.filters, so you'll need to have scipy installed to run it.
plothighsandlows.py (3.66 KB)
Date: Fri, 6 Mar 2009 06:07:10 -0700
Subject: Re: [Matplotlib-users] plotting air pressure data with contour() function
Jeff Whitaker wrote:
Pablo Romero wrote:
I have a question about plotting pressure contours with matplotlib.
I've seen other applications using matplotlib where the pressure contours are drawn with annoted text "H" and "L" characters being drawn in the centers of closed contours...
i.e., if there is a closed contour line, and its value is over a certain threshold value, plot an "H" to indicate a "high pressure zone", else plot a "L" to indicate a "low pressure zone."
This is standard weather map plotting stuff, and Ive definitely seen other plots produced using matplotlib that inlude these annoted "H" and "L" characters. In the application Ive seen, the process was most definitely automated, since it was applied to a large number of plots (i.e., the "H"'s and "L"'s werent added manually, since its not feasible). Unfortunately, the creators of these plots are not willing to share their technique.
I dont know how to set this up with matplotlib.
Does anyone have any experience with this???
Is there any way to identify a "closed contour" & its value from a "contour class" that is returned from matplotlib's contour() function???
Pablo: There is no easy way to do this in matplotlib. I guess you
would try to find closed contours with no other contours inside them,
the place the label at the center of that region. This might end up
being quite tricky. I see from your example that there are many such
regions that are not labelled (some are, some aren't).
Or, you might just try to find local minima and maxima in your gridded
data and plot H's and L's there. This ought to be easier.
Pablo: Regarding the latter method, here's a relevant thread from the
Windows Live� Contacts: Organize your contact list. http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009