krischer / instaseis

Instant high-frequency seismograms from an AxiSEM database
http://instaseis.net
Other
49 stars 23 forks source link

Minor future request: WGS84 to Geocentric conversion #15

Closed sceylan closed 9 years ago

sceylan commented 9 years ago

The wgs84-geocentric conversion only uses the min/max radius of the Earth. Can you make it a parameter to be used for other planets as well?

krischer commented 9 years ago

Good idea. It now works like this (I also renamed the functions):

elliptic_to_geocentric_latitude(lat, axis_a=6378137.0, axis_b=6356752.314245)

axis_a and axis_b are the major and minor axes of the planet. Units don't matter as long as they are identical. They default to the values of WGS84 ellipsoid but can be changed. Does this work for you?

sceylan commented 9 years ago

It works great! Thanks.

sceylan commented 9 years ago

OK. A new idea on this issue. Is it too difficult to pull these radius values out directly from the a running instateis database? I am very new to your very useful tool here. Please let me know if I can contribute more other than suggestions.

krischer commented 9 years ago

No that is not possible. The point is that instaseis assumes a perfect sphere for everything so the coordinates you give it must be defined on the sphere (also called geocentric coordinates). Earth is not a perfect sphere. An often used approximation is an ellipsoid (WGS84 is an example). In these coordinate systems latitude is usually defined as the angle of the surface normal to the equatorial plane.

So any coordinates you have (quite likely in WGS84) have to be converted to geocentric coordinates before being used with instaseis. Instaseis does not know the coordinate system of your data thus it cannot provide the values you are looking for.