UAH LTG IDL Library

IDL Routines from Phillip Bitzer and UAH Lightning Group

summary     class     fields     routine details     file attributes

pmb_xyz2lla.pro

Misc

Given a set of Cartesian (i.e., XYZ) coordinates, convert to latitude, longitude, altitude. You should provide the lat, lon, alt of the origin of the Cartesian coordiante system. If none is given, I'll use NSSTC on the campus of UAH in Huntsville, AL.

To do this, we convert from the local Cartesian grid to Earth Centered, Earth Fixed (ECEF) coordinates. Then, the inversion from ECEF to latitude, longitude, altitude is performed following the algorithm in:

 Zhu "Conversion of Earth-centered Earth-fixed coordinates to geodetic coordinates," Aerospace and Electronic Systems, IEEE Transactions on, vol. 30, pp. 957–961, 1994. 
The WGS-84 ellipsoid is used, same as in pmb_lla2xyz' Essentially, this routine is the inverse of pmb_lla2xyz.

Examples

Given a location:

 lat = 34.927 & lon = -86.080 & alt = 0.567 
Get the XYZ coordinates, using ARMOR as the center:
 xyz = PMB_LLA2XYZ(lat, lon, alt, /ARMOR) print, xyz print, SQRT(xyz.x^2 + xyz.y^2) ;get the 2d distance, for kicks and giggles 
And get the original lat, lon, alt back:
 print, PMB_XYZ2LLA(xyz.x, xyz.y, xyz.z, /ARMOR) 
(You might recognize this as the location of the HYTOP radar.)

You can also simply pass the structure:

 print, PMB_XYZ2LLA(xyz) 
Of course, it also works for arrays of positions:
 x = [0.0, 10.0, -10.0, -10.0, 10.0] y = [0.0, 10.0, 10.0, -10.0, -10.0] z = [0.0, 2.0, 3.0, 3.0, 2.0] 
Assuming NSSTC is center of the grid (default):
 lla = PMB_XYZ2LLA(x, y, z) print, lla 

Author information

Author

Phillip M. Bitzer, University of Alabama in Huntsville, pm.bitzer "AT" uah.edu

History

Modification History:

 Rewritten and renamed from legacy code: May 22, 2014 PMB 

Uses:

pmb_lla2xyz

top pmb_xyz2lla

result = pmb_xyz2lla(x [, y] [, z] [, /CENTER_LAT] [, /CENTER_LON] [, /CENTER_ALT] [, /ARMOR])

Convert a set of values from XYZ coordinates to lat, lon, altitude.

Return value

An array of structures containg the fields lat, lon, and alt.

Parameters

x in required type=array or structure

If this is the only parameter passed, then this should be a structure with 3 fields: x, y, z (like might be returned by pmb_lla2xyz). Otherwise, this should be an array of x positions, in units of km.

y in optional type=array

If x is an array, then this is required. An array of y positions, in units of km.

z in optional type=array default=array of zeros

If x and y are passed (and are arrays), then this is the array of z positions, in units of km. If x is not a structure and this is not given, then it is assumed all positions are at z=0.

Keywords

CENTER_LAT in optional type=boolean default=34.724511D

The latitude of the center of the grid of XYZ values. Setting ARMOR will override this keyword.

CENTER_LON in optional type=boolean default= -86.644905D

The longitude of the center of the grid of XYZ values. Setting ARMOR will override this keyword.

CENTER_ALT in optional type=boolean default=0.193D

The altitude of the center of the grid of XYZ values. Setting ARMOR will override this keyword.

ARMOR in optional type=boolean default=default

If set, the center of the grid will be set to the ARMOR radar in Huntsville, AL.

Uses:

pmb_lla2xyz

File attributes

 Modification date: Tue Apr 4 15:07:29 2017 Lines: 70 Docformat: rst rst