Erroneous Horizontal Lines when Using Basemap

Hatch, Sara J wrote:


My plan was to use the orthographic projection to represent the Moon (hence the 1737.4 km radius) and to plot a spacecraft trajectory around it. If I had read the rsphere documentation past the first half sentence I would have noticed that it was in meters instead of kilometers, sorry about that. Once I implemented this change, the horizontal lines go away.
Sara: OK, great.
Regarding the origin location: I have my spacecraft trajectory calculated with the origin being coincident with the center of the Moon. I can easily translate my coordinates to work with the origin not being the center of the projection, but would it be possible to implement some way to change where the origin is on the projection?
No, sorry - there's no easy way to do that.




-----Original Message-----
From: Jeff Whitaker [mailto:jswhit@…146…] Sent: Thursday, March 12, 2009 4:05 PM
To: Hatch, Sara J
Subject: Re: [Matplotlib-users] Erroneous Horizontal Lines when Using Basemap

Hatch, Sara J wrote:

Matplotlib Folks,

I tried to use the orthographic projection in the basemap toolkit and I'm finding that the parallel lines are not behaving correctly, i.e., there are horizontal lines connecting the left and right side of the map boundary where a curved latitude line intersects the map boundary. I've included a sample script below and a figure illustrating the problem.

import pylab

import mpl_toolkits.basemap as basemap

ortho = basemap.Basemap(projection='ortho',lon_0=0,lat_0=50,rsphere=1737.4)




In addition, how do I change the x/y coordinates the center of the projection to be (0,0)? With the above code, the center of the bounding circle is at (1737.4,1737.4).

Thanks for the help,


Sara: If you take out the rsphere=1734.4 (thereby using the default value of 6370997), the jumpy lines go away. rsphere=1734.4 means assume the earth is a perfect sphere with a radius of 1734.4 meters. That's an awfully small earth - I think the jumpy lines are a result of roundoff errors in the map projection calculation for very small spheres. Still, that shouldn't happen, so I will look into it.

Regarding the x/y coordinate of the middle of the plot - Basemap assigns the lower left corner of the map projection region an x/y value of 0,0 for most map projections.