From ec5a587c0ab210e6dbe26e721eb7b28554f06a77 Mon Sep 17 00:00:00 2001 From: Taylor Denouden Date: Mon, 5 Dec 2022 17:17:49 -0800 Subject: [PATCH] Add support for ITRF2020 --- csrspy/enums.py | 1 + csrspy/factories.py | 4 ++++ tests/test_main.py | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/csrspy/enums.py b/csrspy/enums.py index 062d5be..8663880 100644 --- a/csrspy/enums.py +++ b/csrspy/enums.py @@ -25,6 +25,7 @@ class Reference(str, Enum): ITRF05 = 'itrf05' ITRF08 = 'itrf08' ITRF14 = 'itrf14' + ITRF20 = 'itrf20' class CoordType(str, Enum): diff --git a/csrspy/factories.py b/csrspy/factories.py index ef68282..be5fecf 100644 --- a/csrspy/factories.py +++ b/csrspy/factories.py @@ -104,6 +104,10 @@ def from_ref_frame(cls, ref_frame: Union[Reference, str]): return cls(1.00530, 0.00079, -1.90921, -0.00060, -0.54157, -0.00144, -26.78138, -0.06667, 0.42027, 0.75744, -10.93206, 0.05133, 0.36891, -0.07201, 2010) + elif ref_frame == Reference.ITRF20: + return cls(1.00390, 0.00079, -1.90961, -0.00070, -0.54117, -0.00124, -26.78138, + -0.06667, 0.42027, 0.75744, -10.93206, 0.05133, -0.05109, -0.07201, 2010) + else: raise KeyError(ref_frame) diff --git a/tests/test_main.py b/tests/test_main.py index bb5e000..c90945e 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -280,6 +280,17 @@ (472952.339, 5363983.280, 18.806), 0.001, 0.018 ), + ( + { + "s_ref_frame": Reference.ITRF20, 't_ref_frame': Reference.NAD83CSRS, + 's_coords': CoordType.UTM10, 't_coords': CoordType.UTM10, + 's_epoch': 2010, 't_epoch': 2010, + 's_vd': VerticalDatum.GRS80, 't_vd': VerticalDatum.GRS80 + }, + (472952.399, 5363983.346, 0.291), + (472953.729, 5363982.898, 0.580), + 0.001, 0.001 + ), ]) def test_csrs_transformer_itrf_to_nad83(transform_config, test_input, expected, xy_err, h_err): trans = CSRSTransformer(**transform_config) @@ -566,6 +577,17 @@ def test_csrs_transformer_itrf_to_nad83(transform_config, test_input, expected, (-123.365646, 48.428421, 0), 1e-7, 0.001 ), + ( + { + "t_ref_frame": Reference.ITRF20, 's_ref_frame': Reference.NAD83CSRS, + 't_coords': CoordType.UTM10, 's_coords': CoordType.UTM10, + 't_epoch': 2010.00, 's_epoch': 2010.000, + 't_vd': VerticalDatum.GRS80, 's_vd': VerticalDatum.GRS80 + }, + (472952.399, 5363983.346, 0.291), + (472951.069, 5363983.794, 0.002), + 0.001, 0.001 + ), ]) def test_csrs_transformer_nad83_to_itrf(transform_config, test_input, expected, xy_err, h_err): trans = CSRSTransformer(**transform_config)