def __init__(self, longitude, latitude, altitude): # site terrestrial coordinates (WGS84) self.latnd, self.latnm, self.slatn = map(int, latitude.split(':')) self.lonwd, self.lonwm, self.slonw = map(int, longitude.split(':')) self.hm = altitude # transform to geocentric self.phi = erfa.af2a(self.latnd, self.latnm, self.slatn) self.elon = erfa.af2a(self.lonwd, self.lonwm, self.slonw) self.xyz = erfa.gd2gc(1, self.elon, self.phi, self.hm) self.u = math.hypot(self.xyz[0], self.xyz[1]) self.v = self.xyz[2]
def test_angle_ops(): sign, idmsf = erfa.a2af(6, -np.pi) assert sign == b'-' assert idmsf.item() == (180, 0, 0, 0) sign, ihmsf = erfa.a2tf(6, np.pi) assert sign == b'+' assert ihmsf.item() == (12, 0, 0, 0) rad = erfa.af2a('-', 180, 0, 0.0) np.testing.assert_allclose(rad, -np.pi) rad = erfa.tf2a('+', 12, 0, 0.0) np.testing.assert_allclose(rad, np.pi) rad = erfa.anp(3. * np.pi) np.testing.assert_allclose(rad, np.pi) rad = erfa.anpm(3. * np.pi) np.testing.assert_allclose(rad, -np.pi) sign, ihmsf = erfa.d2tf(1, -1.5) assert sign == b'-' assert ihmsf.item() == (36, 0, 0, 0) days = erfa.tf2d('+', 3, 0, 0.0) np.testing.assert_allclose(days, 0.125)
an observer at north latitude +19°28'52''.5, west longitude 155°55'59''.6, at sea level, on 2006 January 15 at 21:24:37.5 UTC requires the time in all other supported time scales''') # site terrestrial coordinates (WGS84) latnd = +19 latnm = 28 slatn = 52.5 lonwd = -155 lonwm = 55 slonw = 59.6 hm = 0. # transform to geocentric phi = erfa.af2a(np.array([[latnd, latnm, slatn]])) elon = erfa.af2a(np.array([[lonwd, lonwm, slonw]])) xyz = erfa.gd2gc(1, elon, phi, np.array([hm]))[0] u = np.array([math.hypot(xyz[0], xyz[1])]) v = np.array([xyz[2]]) # UTC date and time iy = np.array([2006]) mo = np.array([1]) d = np.array([15]) ih = np.array([21]) im = np.array([24]) sec = np.array([37.5]) # transform into intenal format utc1, utc2 = erfa.dtf2d("UTC", iy,mo,d,ih,im,sec)
import numpy as np import erfa def reprd(title, r, d): print("%25s" % title) for c, a in erfa.a2tf(7, r): print(" = %s" % c, end="") print("%2.2d %2.2d %2.2d.%7.7d" % tuple(a)) for c, a in erfa.a2af(6, d): print(" = %s" % c, end="") print("%2.2d %2.2d %2.2d.%6.6d" % tuple(a)) # site longitude, latitude (radians) and height above the geoid (m). phi = erfa.af2a(np.array([[-70, 44, 11.560]])) elong = erfa.af2a(np.array([[-30, 14, 26.731]])) hm = np.array([2738.0]) # Ambient pressure (HPa), temperature (C) and rel. humidity (frac). phpa = np.array([731.0]) tc = np.array([12.8]) rh = np.array([0.59]) # Effective color (microns). wl = np.array([0.55]) # UTC date y = np.array([2013], dtype="int32") m = np.array([4], dtype="int32") d = np.array([2], dtype="int32")
an observer at north latitude +19°28'52''.5, west longitude 155°55'59''.6, at sea level, on 2006 January 15 at 21:24:37.5 UTC requires the time in all other supported time scales''') # site terrestrial coordinates (WGS84) latnd = +19 latnm = 28 slatn = 52.5 lonwd = -155 lonwm = 55 slonw = 59.6 hm = 0. # transform to geocentric phi = erfa.af2a(latnd, latnm, slatn) elon = erfa.af2a(lonwd, lonwm, slonw) xyz = erfa.gd2gc(1, elon, phi, hm) u = math.hypot(xyz[0], xyz[1]) v = xyz[2] # UTC date and time iy = 2006 mo = 1 d = 15 ih = 21 im = 24 sec = 37.5 # transform into intenal format utc1, utc2 = erfa.dtf2d(iy, mo, d, ih, im, sec, "UTC")
'''example from sofa_ast_c.pdf''' import math import erfa def reprd(title, r, d): print("%25s"%title, " %s%2.2d %2.2d %2.2d.%7.7d"%erfa.a2tf(7, r), " %s%2.2d %2.2d %2.2d.%6.6d"%erfa.a2af(6, d)) # site longitude, latitude (radians) and height above the geoid (m). phi = erfa.af2a(-15,57,42.8) elong = erfa.af2a(-5,41,54.2) hm = 625.0 # Ambient pressure (HPa), temperature (C) and rel. humidity (frac). phpa = 952.0 tc = 18.5 rh = 0.83 # Effective color (microns). wl = 0.55 # UTC date utc1, utc2 = erfa.dtf2d(2013, 4, 2, 23, 15, 43.55, "UTC") # TT date tai1, tai2 = erfa.utctai(utc1, utc2) tt1, tt2 = erfa.taitt(tai1, tai2) # EOPs: polar motion in radians, UT1-UTC in seconds. xp = 50.995e-3 * erfa.DAS2R
an observer at north latitude +19°28'52''.5, west longitude 155°55'59''.6, at sea level, on 2006 January 15 at 21:24:37.5 UTC requires the time in all other supported time scales''') # site terrestrial coordinates (WGS84) latnd = +19 latnm = 28 slatn = 52.5 lonwd = -155 lonwm = 55 slonw = 59.6 hm = 0. # transform to geocentric phi = erfa.af2a(latnd, latnm, slatn) elon = erfa.af2a(lonwd, lonwm, slonw) xyz = erfa.gd2gc(1, elon, phi, hm) u = math.hypot(xyz[0], xyz[1]) v = xyz[2] # UTC date and time iy = 2006 mo = 1 d = 15 ih = 21 im = 24 sec = 37.5 # transform into intenal format utc1, utc2 = erfa.dtf2d(iy,mo,d,ih,im,sec, "UTC")
'''example from sofa_ast_c.pdf''' import math import erfa def reprd(title, r, d): print("%25s" % title, " %s%2.2d %2.2d %2.2d.%7.7d" % erfa.a2tf(7, r), " %s%2.2d %2.2d %2.2d.%6.6d" % erfa.a2af(6, d)) # site longitude, latitude (radians) and height above the geoid (m). phi = erfa.af2a(-15, 57, 42.8) elong = erfa.af2a(-5, 41, 54.2) hm = 625.0 # Ambient pressure (HPa), temperature (C) and rel. humidity (frac). phpa = 952.0 tc = 18.5 rh = 0.83 # Effective color (microns). wl = 0.55 # UTC date utc1, utc2 = erfa.dtf2d(2013, 4, 2, 23, 15, 43.55, "UTC") # TT date tai1, tai2 = erfa.utctai(utc1, utc2) tt1, tt2 = erfa.taitt(tai1, tai2) # EOPs: polar motion in radians, UT1-UTC in seconds.