[Matplotlib-users] [basemap] EASE grid projection

2012-08-28 Thread Jose Gomez-Dans
Hi,
I'd like to plot some EASE Grid global data (the EASE grid is defined for a
cylindrical equal area projection). In proj4 parlance, it is defined as

+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +a=6371228 +b=6371228 +units=m
+no_defs

My data are gridded, and I want to use either pcolormesh or imshow to plot
them on a map. Apart from reprojecting into something that basemap deals
with natively, is there something else that I can do within
python/matplolib to plot the data without reprojecting it?

Thanks!
Jose
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Background basemaps in Basemap

2012-08-28 Thread klo uo
On Mon, Aug 27, 2012 at 9:32 PM, Jeff Whitaker wrote:
>
> Klo:  Yes.  And vice versa, some of those 4500 projections aren't supported
> by Basemap.
>
> Anyway, I went ahead and created a prototype 'wmsmap' method. You can try it
> by cloning my fork (https://github.com/jswhit/basemap) and running
> examples/testwms.py.  I created an extra kward 'epsg' for creating Basemap
> instances. To use the wmsmap function, you have to use that keyword.  Give
> it a try and let me know what you think.

Jeff it looks great, everything is parametrized including server name
and map name, so it should work for any additional service.
However on Windows with Python 2.7 and Basemap 1.0.5 I get an error
while trying to run the script:

Traceback (most recent call last):
  File "testwms.py", line 39, in 
m=Basemap2(epsg=epsg,resolution='h',width=width,height=height)
TypeError: __init__() got an unexpected keyword argument 'epsg'


I than added initial empty "epsg" arg to original Basemap class
declaration, but then after some time processing I get:

warning: width and height keywords ignored for Cylindrical Equidistant
projectionEPSG:
Traceback (most recent call last):
  File "testwms.py", line 47, in 
m.drawparallels(np.arange(0,80,1),labels=[1,0,0,0])
  File "testwms.py", line 15, in wmsmap
if not hasattr(self,'epsg'):
AttributeError: 'Basemap2' object has no attribute 'epsg'


So I leave it for now and assume it's some tiny issue not obvious at
this time to me.

I'll continue WMS search, but yesterday I spent couple of hours just
to look at those beautiful maps provided on arcgis server. I explored
on all and it's so nicely done and with high resolution zoom. They are
annotated though, but again, see i.e. Ocean Basemap, or overlay with
transparency over some more colored topo map like GEBCO_08 from
maps.ngdc.noaa.gov server - just great. World Topo also...

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Background basemaps in Basemap

2012-08-28 Thread Jeff Whitaker
On 8/28/12 9:56 AM, klo uo wrote:
> On Mon, Aug 27, 2012 at 9:32 PM, Jeff Whitaker wrote:
>> Klo:  Yes.  And vice versa, some of those 4500 projections aren't supported
>> by Basemap.
>>
>> Anyway, I went ahead and created a prototype 'wmsmap' method. You can try it
>> by cloning my fork (https://github.com/jswhit/basemap) and running
>> examples/testwms.py.  I created an extra kward 'epsg' for creating Basemap
>> instances. To use the wmsmap function, you have to use that keyword.  Give
>> it a try and let me know what you think.
> Jeff it looks great, everything is parametrized including server name
> and map name, so it should work for any additional service.
> However on Windows with Python 2.7 and Basemap 1.0.5 I get an error
> while trying to run the script:

Klo:  Just added a pull request for this

https://github.com/matplotlib/basemap/pull/73

Regarding your windows error - you have to rebuild basemap to get the 
needed updates (it's not just a matter of running the testwms.py script).

-Jeff
> 
> Traceback (most recent call last):
>File "testwms.py", line 39, in 
>  m=Basemap2(epsg=epsg,resolution='h',width=width,height=height)
> TypeError: __init__() got an unexpected keyword argument 'epsg'
> 
>
> I than added initial empty "epsg" arg to original Basemap class
> declaration, but then after some time processing I get:
> 
> warning: width and height keywords ignored for Cylindrical Equidistant
> projectionEPSG:
> Traceback (most recent call last):
>File "testwms.py", line 47, in 
>  m.drawparallels(np.arange(0,80,1),labels=[1,0,0,0])
>File "testwms.py", line 15, in wmsmap
>  if not hasattr(self,'epsg'):
> AttributeError: 'Basemap2' object has no attribute 'epsg'
> 
>
> So I leave it for now and assume it's some tiny issue not obvious at
> this time to me.
>
> I'll continue WMS search, but yesterday I spent couple of hours just
> to look at those beautiful maps provided on arcgis server. I explored
> on all and it's so nicely done and with high resolution zoom. They are
> annotated though, but again, see i.e. Ocean Basemap, or overlay with
> transparency over some more colored topo map like GEBCO_08 from
> maps.ngdc.noaa.gov server - just great. World Topo also...
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Background basemaps in Basemap

2012-08-28 Thread klo uo
>> Jeff it looks great, everything is parametrized including server name
>> and map name, so it should work for any additional service.
>> However on Windows with Python 2.7 and Basemap 1.0.5 I get an error
>> while trying to run the script:
>
>
> Klo:  Just added a pull request for this
>
> https://github.com/matplotlib/basemap/pull/73
>
> Regarding your windows error - you have to rebuild basemap to get the needed
> updates (it's not just a matter of running the testwms.py script).

Thanks will do that right now.

I was just investigating possibility of returning clear map without
annotations where it is possible.
For example World_Topo_Map
(http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer)
has additional layers and according layers parameter in export
function (http://atlas.resources.ca.gov/arcgis/SDK/REST/export.html):

Description: Determines which layers appear on the exported map. There
are four ways to specify which layers are shown:

show: Only the layers specified in this list will be exported.
hide: All layers except those specified in this list will be exported.
include: In addition to the layers exported by default, the layers
specified in this list will be exported.
exclude: The layers exported by default excluding those specified
in this list will be exported.


Syntax: [show | hide | include | exclude]:layerId1,layerId2
where layerId1, layerId2are the layer ids returned by the map service resource

Example: layers=show:2,4,7


if we add additional parameter "&layers=hide:5,6,7,8,9" I expected
annotations to be gone, but unfortunately not there yet

Will look further if it's somehow possible to clear annotations.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Background basemaps in Basemap

2012-08-28 Thread klo uo
Jeff, I just thought to mention this: function name "wmsmap" maybe
should be changed to "restmap" as for WMS servers will need to do
another template. Here is example urllib call for sample WMS function
GetMap:


basemap_url = "\
http://geonetwork3.fao.org/ows/14097?\
request=GetMap&\
service=WMS&\
version=1.1.1&\
layers=country_bnd&\
format=image/svg%2Bxml&\
bgcolor=0xFF&\
transparent=TRUE&\
srs=EPSG:4326&\
bbox=-180,-137.464503042596,180,137.464503042596&\
width=986&\
height=753\
"


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Background basemaps in Basemap

2012-08-28 Thread Jeff Whitaker
On 8/28/12 12:09 PM, klo uo wrote:
> Jeff, I just thought to mention this: function name "wmsmap" maybe
> should be changed to "restmap" as for WMS servers will need to do
> another template. Here is example urllib call for sample WMS function
> GetMap:

Klo:  Let's move this discussion over to the pull request

https://github.com/matplotlib/basemap/pull/73

-Jeff


>
> 
> basemap_url = "\
> http://geonetwork3.fao.org/ows/14097?\
> request=GetMap&\
> service=WMS&\
> version=1.1.1&\
> layers=country_bnd&\
> format=image/svg%2Bxml&\
> bgcolor=0xFF&\
> transparent=TRUE&\
> srs=EPSG:4326&\
> bbox=-180,-137.464503042596,180,137.464503042596&\
> width=986&\
> height=753\
> "
> 


-- 
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [basemap] EASE grid projection

2012-08-28 Thread Jeff Whitaker

On 8/28/12 9:31 AM, Jose Gomez-Dans wrote:

Hi,
I'd like to plot some EASE Grid global data (the EASE grid is defined 
for a cylindrical equal area projection). In proj4 parlance, it is 
defined as


+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +a=6371228 +b=6371228 
+units=m +no_defs


My data are gridded, and I want to use either pcolormesh or imshow to 
plot them on a map. Apart from reprojecting into something that 
basemap deals with natively, is there something else that I can do 
within python/matplolib to plot the data without reprojecting it?


Thanks!
Jose



Jose: Shouldn't be too hard to add support for that projection. Could 
you file a feature request at


https://github.com/matplotlib/basemap/issues  ??


-Jeff



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Legend Marker Color Bug

2012-08-28 Thread Sterling Smith
List,

Consider the following script:

import pylab
pylab.plot(pylab.linspace(0,1,100),label='Test',marker='o',ls='')
pylab.plot(pylab.linspace(0,1,100),label='Test2',marker='o',ls='-')
leg=pylab.legend(loc='best')
line=leg.get_lines()
line[0].set_color('black')
line[1].set_color('black')
pylab.draw()

I am attaching the results I see with the TkAgg baackend.  I am using version 
1.1.0.

I would expect the markers to change colors also.  However, I can't seem to 
find the markers recorded in the legend object to be able to change them.  Is 
this a bug or a feature (resetting the color could lead to inconsistencies 
between legend and plot)?

Thanks,
Sterling
<>--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [basemap] EASE grid projection

2012-08-28 Thread Jeff Whitaker

On 8/28/12 9:31 AM, Jose Gomez-Dans wrote:

Hi,
I'd like to plot some EASE Grid global data (the EASE grid is defined 
for a cylindrical equal area projection). In proj4 parlance, it is 
defined as


+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +a=6371228 +b=6371228 
+units=m +no_defs


My data are gridded, and I want to use either pcolormesh or imshow to 
plot them on a map. Apart from reprojecting into something that 
basemap deals with natively, is there something else that I can do 
within python/matplolib to plot the data without reprojecting it?


Thanks!hu
Jose


Jose: I went ahead and added support for the 'cea' projection to pull 
request 73.


https://github.com/matplotlib/basemap/pull/73

You can get it by cloning my fork (https://github.com/jswhit/basemap).

-Jeff




--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Need help with direction field plot

2012-08-28 Thread pf4d
I didn't try out your code, but I created a solution here (complete code) :



Output :
http://matplotlib.1069221.n5.nabble.com/file/n38697/8.png 



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Need-help-with-direction-field-plot-tp24886p38697.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users