Re: [Matplotlib-users] Calculating distance from center of Earth

2013-03-28 Thread John Gleeson

On 2013-03-28, at 7:29 AM, KURT PETERS wrote:

> If I'm using this SGP4 library: https://pypi.python.org/pypi/sgp4/
> which provides x,y,z of a satellite with respect to the center of  
> the Earth, what do you think would be the best way to calculate the  
> distance from the satellite to a lat/long point on the Earth using  
> MATPLOT library basemaps?
>
> I suppose using WGS 84, I could do something like:
> # setup of basemap ('lcc' = lambert conformal conic).
> # use major and minor sphere radii from WGS84 ellipsoid.
> m =  
> Basemap 
> (llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
> rsphere=(6378137.00,6356752.3142),\
> resolution='l',area_thresh=1000.,projection='lcc',\
> lat_1=50.,lon_0=-107.,ax=ax)
>
> x,y = m(lon, lat)
>
> But how could I get "Z" for a particular coordinate so I could be  
> this norm calculation?  And... would the x,y yielded above be in the  
> same coordinate frame (ie, from the center of the Earth) as the SGP4  
> library in the first place?
>
> Regards,
> Kurt


The x,y you get from Basemap appear to be tailored to the particular  
projection
you are using. If you change the projection, then you will probably  
get different
x,y values for the same (lat,lon). This is very useful for mapping,  
but it is not what you need.

You need convert your position P from geodetic coordinates (lat, lon)  
(more generally, (lat, lon, elevation)) to geocentric coordinates  
(x,y,z). Geocentric coordinates are also called Earth-centered-Earth- 
fixed (ECEF or ECF) coordinates.

Here is a link to the formulas you need. Notice that the author uses  
the terminology Latitude,Longitude,Altitude (LLA) to refer to geodetic  
coordinates.

http://www.satsleuth.com/GPS_ECEF_Datum_transformation.htm

This can be difficult to interpret if you are doing it for the first  
time (and even if you have done it many times before!!). Feel free to  
email me directly if you have any questions. I would be glad to help.

-John

--
Own the Future-IntelĀ® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Affine2D on scatter

2013-04-04 Thread John Gleeson

On 2013-04-04, at 10:51 AM, Derek Thomas wrote:

> ...screen capture of the display...
> 

Derek,

I just tried Phil's version of the code on my Mac (MP 1.2.0), and I  
see exactly the same problem as in your grab.tiff. This is using the  
default TkAgg backend.

I happen to have built MP 1.2.0 with the Qt4 backend option. When I  
prepend the lines

 from matplotlib import use
 use("QT4Agg")

to use Qt4, I get the expected (correct) display output.

Apparently this is a bug somewhere in the chain TkAgg/Tkinter/Tk.

John


--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Affine2D on scatter

2013-04-05 Thread John Gleeson
Phil and Derek,

I just created this as the following issue

https://github.com/matplotlib/matplotlib/issues/1886

I was wrong about TkAgg having a problem. The default backend for  
Derek and me is MacOSX. Both TkAgg and QT4Agg display correctly for me.

John




--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users