[ANN] basemap matplotlib toolkit 0.1.1

The first matplotlib toolkit has been released.

Matplotlib toolkits are collections of application-specific functions that extend matplotlib.

This is hopefully the first of many - additional contributions are encouraged!

The basemap toolkit allows matplotlib to plot regularly-space latitiude/longitude grids on map projections, including drawing coastlines, political boundaries, parallels and meridians. It currently supports six map projections (cylindrical equidistant, mercator, lambert conformal conic, lambert azimuthal equal area, albers equal area and stereographic).

It uses routines from the proj.4 library (http://proj.maptools.org) to perform cartographic transformations.

Documentation - http://matplotlib.sourceforge.net/toolkits.html.

Screenshot - http://matplotlib.sourceforge.net/screenshots/plotmap_large.png

Example Code - http://matplotlib.sourceforge.net/screenshots/plotmap.py

Examples for each map projection are included in the source release (available at the sf download page (http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=142792).

Windows binaries are provided (thanks John!) - but they do not include the examples.

Comments/bug reports/suggestions are welcome.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

Jeff,
Great timing! I was just reviewing some requirements from our users to be able to create ground track plots of spacecraft right after launch. Your package looks like it should easily do most of the work for us!

One thing I do need to be able to do is to create line plots that "wrap around" a map. We generate a lot of ground tracks that use a Mercator projection covering the whole globe (x=-180->180, y=-90->90) and if the line goes off one edge, we need to wrap it around to the other edge instead of drawing a line segment all the way across the page.

I had planning on creating a front end script to pre-process the data to handle this type of capability. The only issue with this approach is that it requires multiple lines be drawn (as if you're plotting multiple curves) but only one of them should show up in the legend. I was wondering anyone else has need of this and if there is a better way to implement this wrapping feature when doing map plots?

Ted
ps: John I promise I'll get you a Qt backend this week. We hit a few delays but I should be able to get you something this afternoon. It's basically a refactorization of the Qt backend that's in CVS right now with some drawing improvements to reduce flickering.

···

At 05:04 AM 2/10/2005, Jeff Whitaker wrote:

The first matplotlib toolkit has been released.

Matplotlib toolkits are collections of application-specific functions that extend matplotlib.

This is hopefully the first of many - additional contributions are encouraged!

The basemap toolkit allows matplotlib to plot regularly-space latitiude/longitude grids on map projections, including drawing coastlines, political boundaries, parallels and meridians. It currently supports six map projections (cylindrical equidistant, mercator, lambert conformal conic, lambert azimuthal equal area, albers equal area and stereographic).

It uses routines from the proj.4 library (http://proj.maptools.org) to perform cartographic transformations.

Documentation - http://matplotlib.sourceforge.net/toolkits.html.

Screenshot - http://matplotlib.sourceforge.net/screenshots/plotmap_large.png

Example Code - http://matplotlib.sourceforge.net/screenshots/plotmap.py

Examples for each map projection are included in the source release (available at the sf download page (matplotlib - Browse /matplotlib-toolkits at SourceForge.net).

Windows binaries are provided (thanks John!) - but they do not include the examples.

Comments/bug reports/suggestions are welcome.

-Jeff

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Ted Drain wrote:

Jeff,
One thing I do need to be able to do is to create line plots that "wrap around" a map. We generate a lot of ground tracks that use a Mercator projection covering the whole globe (x=-180->180, y=-90->90) and if the line goes off one edge, we need to wrap it around to the other edge instead of drawing a line segment all the way across the page.

Yes, this really is a pain. If you work out a good solution, please let me know, or post it to the list. I'd love to have a similar feature in my wxPython FloatCanvas.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

What I did in the past was to use a heuristic that said something like: if the next point jumps more than 80% (or something like that) of the full map range, then do a linear interpolation to find the point at the boundary and add that to the line. Then split the line and start a new curve on the other side.

We probably won't get to working on this until Apr-May but I'll let you know what we come up with. I'll try to set up some type of general purpose functions and then you can decide if they have a place in the basemap module.

Ted

···

At 09:52 AM 2/10/2005, Chris Barker wrote:

Ted Drain wrote:

Jeff,
One thing I do need to be able to do is to create line plots that "wrap around" a map. We generate a lot of ground tracks that use a Mercator projection covering the whole globe (x=-180->180, y=-90->90) and if the line goes off one edge, we need to wrap it around to the other edge instead of drawing a line segment all the way across the page.

Yes, this really is a pain. If you work out a good solution, please let me know, or post it to the list. I'd love to have a similar feature in my wxPython FloatCanvas.

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Ted Drain wrote:

Jeff,
Great timing! I was just reviewing some requirements from our users to be able to create ground track plots of spacecraft right after launch. Your package looks like it should easily do most of the work for us!

One thing I do need to be able to do is to create line plots that "wrap around" a map. We generate a lot of ground tracks that use a Mercator projection covering the whole globe (x=-180->180, y=-90->90) and if the line goes off one edge, we need to wrap it around to the other edge instead of drawing a line segment all the way across the page.

Ted: That is a pain - I had to work around this a couple of times in the basemap code (when drawing coastlines and when drawing parallels and meridians).

BTW: You won't be able to define a mercator projection that goes from -90 to 90 (it's singular at the poles). You'll have to stop it at 80 or 85 degrees.

I had planning on creating a front end script to pre-process the data to handle this type of capability. The only issue with this approach is that it requires multiple lines be drawn (as if you're plotting multiple curves) but only one of them should show up in the legend. I was wondering anyone else has need of this and if there is a better way to implement this wrapping feature when doing map plots?

That would be useful for lots of people I think - I don't know of any better way (other than using a non-cylindrical projection, like a polar stereographic).

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/CDC R/CDC1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

Ted Drain wrote:

One thing I do need to be able to do is to create line plots that "wrap around" a map. We generate a lot of ground tracks that use a Mercator projection covering the whole globe (x=-180->180, y=-90->90) and if the line goes off one edge, we need to wrap it around to the other edge instead of drawing a line segment all the way across the page.

Ted: It just occured to me that if you plot the track as a scatterplot of points instead of a line then this is not a problem (i.e. you won't get that line segment running across the page)

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

I could use a scatter plot but user's actually want a line drawn so that's out. I think either the plot has to be really smart about it (which is probably a bad idea), or this type of functionality has to be in a utility or wrapper that can be used. I think I'm stuck doing linear interpolation and somehow separating the line segments at the boundary of the map.

Is there an easy way to plot multiple collections of points connected by a line and have only a single legend entry show up? It would also be nice if any modifications to that entry (marker, color, etc) would affect all the line segments.

Ted
PS: we also need some way to draw only the n'th marker in a line plot. We plot a lot of trajectories where time is progressing along the line so it's useful to generate the plot using 1 minute data (for example) and then have a marker be displayed every 60'th point.

···

At 05:28 AM 2/11/2005, Jeff Whitaker wrote:

Ted Drain wrote:

One thing I do need to be able to do is to create line plots that "wrap around" a map. We generate a lot of ground tracks that use a Mercator projection covering the whole globe (x=-180->180, y=-90->90) and if the line goes off one edge, we need to wrap it around to the other edge instead of drawing a line segment all the way across the page.

Ted: It just occured to me that if you plot the track as a scatterplot of points instead of a line then this is not a problem (i.e. you won't get that line segment running across the page)

-Jeff

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Ted Drain Jet Propulsion Laboratory ted.drain@...369...