Skip to content

Instantly share code, notes, and snippets.

@betolink
Created August 9, 2023 16:40
Show Gist options
  • Save betolink/77469f38f7b25aa16b1550a0e24e6474 to your computer and use it in GitHub Desktop.
Save betolink/77469f38f7b25aa16b1550a0e24e6474 to your computer and use it in GitHub Desktop.
from collections import namedtuple
from functools import partial
from shapely.affinity import translate
from shapely.geometry.multipolygon import MultiPolygon
from shapely.geometry.point import Point
from shapely.geometry.polygon import Polygon
from shapely.ops import transform
# For some plates, points that cross the meridian need to be adjusted
# to be negative for coordinate continuity. This allows us to test for
# point inclusion correctly with Shapely.
def _shift_large_longitudes(threshold, x, y):
if x > threshold:
return (x - 360, y)
else:
return (x, y)
ANTA = Polygon([
(359.70, -54.50),
(359.30, -54.80),
(358.90, -54.80),
(358.60, -55.10),
(358.40, -55.30),
(358.40, -55.60),
(355.30, -55.80),
(353.00, -57.80),
(343.80, -58.30),
(343.80, -59.00),
(342.00, -59.10),
(342.00, -59.60),
(341.50, -59.60),
(341.50, -60.20),
(341.10, -60.20),
(341.00, -60.50),
(340.70, -60.50),
(340.60, -60.80),
(340.10, -60.90),
(339.50, -60.90),
(338.80, -61.00),
(338.10, -61.00),
(337.40, -61.00),
(336.70, -61.00),
(336.10, -61.00),
(335.60, -60.90),
(335.10, -60.80),
(334.40, -60.70),
(326.70, -60.00),
(322.50, -61.00),
(312.50, -60.00),
(304.00, -60.70),
(289.20, -55.40),
(288.00, -54.90),
(286.90, -54.40),
(285.70, -53.60),
(284.80, -53.00),
(284.70, -51.90),
(284.60, -50.70),
(284.60, -49.60),
(284.30, -48.80),
(284.10, -47.70),
(284.00, -46.90),
(283.80, -45.80),
(283.80, -45.30),
(283.40, -45.60),
(282.70, -45.60),
(281.50, -45.20),
(280.40, -45.00),
(279.40, -44.90),
(277.70, -44.80),
(277.30, -44.30),
(277.10, -43.30),
(276.90, -41.90),
(276.10, -41.80),
(275.30, -41.70),
(273.60, -41.50),
(271.30, -41.30),
(268.90, -41.20),
(268.30, -40.30),
(268.20, -39.10),
(267.50, -38.80),
(266.30, -38.40),
(266.40, -37.40),
(265.40, -37.20),
(263.70, -37.10),
(263.70, -36.50),
(263.00, -36.40),
(261.60, -36.30),
(259.70, -36.10),
(258.20, -35.90),
(256.30, -35.80),
(254.70, -35.70),
(253.40, -35.50),
(252.30, -35.30),
(251.10, -35.20),
(249.80, -35.20),
(249.10, -35.10),
(248.00, -34.90),
(248.30, -38.40),
(247.80, -40.70),
(247.30, -42.70),
(246.70, -45.20),
(245.90, -48.30),
(245.00, -50.00),
(243.60, -49.60),
(243.00, -50.80),
(241.60, -53.20),
(242.00, -53.30),
(241.00, -54.50),
(239.50, -54.30),
(237.70, -55.80),
(233.60, -54.70),
(233.00, -55.30),
(231.30, -54.90),
(227.60, -54.10),
(227.00, -54.90),
(223.10, -54.00),
(222.40, -55.00),
(222.10, -54.90),
(220.80, -56.20),
(220.10, -56.00),
(219.20, -56.80),
(215.30, -55.70),
(213.40, -57.30),
(212.90, -57.10),
(210.70, -58.70),
(210.90, -58.80),
(209.20, -60.00),
(207.90, -59.60),
(202.50, -63.10),
(198.70, -61.70),
(195.60, -63.30),
(194.10, -62.80),
(189.20, -65.10),
(188.10, -64.70),
(182.30, -66.70),
(174.80, -63.70),
(173.40, -64.10),
(170.50, -62.50),
(168.40, -63.00),
(167.40, -62.60),
(166.40, -62.90),
(165.00, -62.00),
(163.80, -62.30),
(163.20, -61.80),
(155.90, -63.00),
(155.70, -62.90),
(153.80, -60.10),
(150.40, -60.50),
(148.80, -57.50),
(147.50, -57.60),
(147.20, -55.60),
(146.20, -55.70),
(146.10, -54.70),
(145.00, -54.70),
(144.50, -54.30),
(143.90, -54.40),
(143.60, -54.10),
(141.20, -54.20),
(140.80, -52.70),
(140.00, -52.80),
(139.60, -51.90),
(138.60, -52.00),
(137.70, -50.60),
(136.40, -50.80),
(136.00, -50.40),
(134.40, -50.40),
(134.20, -50.30),
(132.30, -50.30),
(132.30, -50.10),
(130.90, -50.10),
(130.80, -50.30),
(127.50, -49.90),
(127.70, -49.00),
(126.90, -48.90),
(126.60, -49.70),
(125.70, -49.60),
(125.80, -49.40),
(125.40, -49.30),
(125.40, -49.20),
(125.00, -49.10),
(124.80, -49.40),
(124.50, -49.40),
(124.50, -49.70),
(123.90, -49.60),
(123.70, -50.00),
(122.70, -49.80),
(122.90, -49.30),
(122.30, -49.20),
(121.70, -50.20),
(118.80, -49.70),
(118.60, -49.90),
(118.10, -49.80),
(118.00, -50.10),
(116.40, -49.80),
(115.90, -50.70),
(114.80, -50.40),
(114.30, -51.20),
(100.40, -47.60),
(99.70, -48.20),
(95.10, -46.30),
(95.50, -46.00),
(88.30, -42.00),
(87.20, -43.00),
(85.30, -41.80),
(83.50, -43.20),
(81.10, -41.20),
(79.60, -42.20),
(75.90, -39.10),
(79.00, -36.30),
(78.30, -35.80),
(79.10, -35.10),
(77.40, -33.70),
(78.10, -32.90),
(74.80, -30.20),
(75.50, -29.50),
(74.10, -28.40),
(74.20, -28.20),
(73.00, -27.40),
(72.80, -27.50),
(71.20, -26.20),
(70.80, -26.30),
(70.05, -25.51),
(70.05, -25.51),
(69.30, -25.80),
(68.90, -26.00),
(67.80, -26.60),
(66.10, -27.70),
(63.20, -28.10),
(61.00, -29.00),
(60.80, -30.70),
(59.00, -30.70),
(58.30, -31.80),
(57.00, -31.90),
(57.00, -33.80),
(55.10, -34.70),
(54.20, -34.70),
(54.10, -35.40),
(53.40, -35.30),
(53.30, -36.10),
(52.30, -36.10),
(52.20, -37.50),
(49.00, -37.80),
(46.20, -38.80),
(46.00, -40.10),
(42.70, -40.90),
(42.40, -42.80),
(39.30, -43.70),
(35.70, -44.80),
(34.80, -47.20),
(32.50, -47.00),
(30.50, -49.80),
(29.50, -50.20),
(27.80, -52.80),
(26.20, -52.50),
(25.50, -53.80),
(22.50, -53.00),
(20.00, -52.80),
(18.50, -52.70),
(15.90, -51.70),
(15.10, -52.20),
(13.90, -51.80),
(12.70, -52.80),
(11.50, -52.20),
(8.30, -54.00),
(7.60, -53.60),
(5.00, -54.80),
(4.00, -54.20),
(3.00, -53.60),
(0.80, -54.90),
(0.00, -54.90), # Synthetic
(0.00, -90.00), # Synthetic
(360.00, -90.00), # Synthetic
(360.00, -54.50), # Synthetic
(359.70, -54.50), # Synthetic
])
ANTA_FALSE_EASTING = 0.0
ARAB = Polygon([
(65.80, 25.20),
(65.00, 25.20),
(64.00, 25.20),
(63.00, 25.00),
(62.00, 24.90),
(61.00, 25.00),
(60.00, 25.20),
(59.80, 25.20),
(59.00, 25.40),
(58.70, 25.40),
(58.10, 25.60),
(57.00, 25.80),
(56.00, 26.00),
(55.10, 26.20),
(54.30, 26.30),
(53.30, 26.50),
(52.40, 27.30),
(51.80, 28.00),
(51.20, 28.70),
(50.40, 29.70),
(49.80, 30.40),
(49.30, 31.30),
(48.70, 32.10),
(48.10, 32.80),
(47.70, 33.50),
(47.10, 34.10),
(46.40, 35.00),
(45.90, 35.50),
(45.40, 36.00),
(44.90, 36.40),
(44.30, 37.20),
(44.00, 37.60),
(43.60, 38.00),
(43.60, 38.00),
(43.00, 38.30),
(42.30, 38.90),
(41.60, 39.20),
(40.70, 39.20),
(40.10, 39.00),
(39.50, 38.70),
(39.00, 38.40),
(38.50, 38.20),
(37.90, 37.90),
(37.40, 37.50),
(36.80, 37.20),
(36.30, 36.70),
(35.90, 36.40),
(35.60, 35.90),
(35.80, 35.70),
(35.70, 34.90),
(35.50, 34.00),
(35.20, 32.90),
(35.00, 32.10),
(35.00, 31.30),
(34.90, 30.80),
(34.90, 30.00),
(34.90, 29.50),
(34.70, 29.00),
(34.50, 28.40),
(34.20, 27.90),
(34.20, 27.10),
(34.60, 26.60),
(35.30, 25.30),
(36.20, 23.80),
(37.20, 22.00),
(38.50, 19.80),
(39.40, 18.10),
(40.50, 16.00),
(41.60, 14.30),
(42.50, 13.20),
(43.50, 12.20),
(43.70, 11.90),
(46.30, 12.20),
(46.50, 12.50),
(48.20, 12.60),
(48.80, 13.00),
(49.80, 13.10),
(50.20, 13.40),
(51.20, 13.10),
(52.20, 14.60),
(52.80, 14.40),
(53.00, 14.60),
(53.80, 14.30),
(54.50, 15.20),
(56.10, 14.30),
(56.30, 14.50),
(57.50, 13.50),
(58.30, 12.70),
(58.60, 13.00),
(58.90, 13.50),
(59.10, 14.00),
(59.50, 14.50),
(59.80, 15.00),
(59.90, 15.50),
(60.00, 16.00),
(60.00, 16.50),
(60.10, 17.00),
(60.20, 17.50),
(60.30, 18.00),
(60.45, 18.50),
(60.80, 19.00),
(61.20, 20.00),
(61.60, 20.50),
(62.00, 21.00),
(62.25, 21.50),
(62.50, 22.00),
(63.00, 22.50),
(63.50, 23.00),
(63.80, 23.20),
(64.80, 23.30),
(65.20, 24.00),
(65.70, 25.00),
(65.80, 25.20),
])
ARAB_FALSE_EASTING = 0.0
AUST = Polygon([
(91.80, 9.30),
(90.00, 5.00),
(89.50, 0.00),
(89.00, -5.00),
(80.00, -5.00),
(68.73, -4.51),
(68.36, -4.90),
(68.60, -5.10),
(68.78, -5.24),
(67.98, -6.08),
(68.50, -6.56),
(67.92, -7.12),
(68.25, -7.40),
(67.86, -7.75),
(68.28, -8.20),
(66.54, -9.64),
(66.84, -9.88),
(66.28, -10.40),
(66.79, -10.78),
(66.20, -11.30),
(66.32, -11.56),
(65.75, -12.00),
(65.56, -12.14),
(66.44, -12.88),
(66.49, -13.12),
(66.70, -13.34),
(65.86, -13.99),
(66.38, -14.80),
(66.72, -14.90),
(67.24, -15.44),
(67.08, -15.68),
(67.38, -16.00),
(66.47, -16.61),
(66.82, -16.96),
(65.02, -17.98),
(66.23, -20.25),
(66.82, -19.95),
(67.24, -20.38),
(67.64, -20.13),
(67.91, -20.64),
(68.40, -20.46),
(69.22, -22.13),
(69.08, -22.20),
(69.35, -22.69),
(69.26, -22.74),
(69.35, -22.91),
(69.26, -22.96),
(69.35, -23.13),
(69.19, -23.25),
(69.74, -24.22),
(69.61, -24.30),
(69.81, -24.62),
(69.77, -24.65),
(70.07, -25.19),
(69.95, -25.32),
(70.05, -25.51),
(70.80, -26.30),
(71.20, -26.20),
(72.80, -27.50),
(73.00, -27.40),
(74.20, -28.20),
(74.10, -28.40),
(75.50, -29.50),
(74.80, -30.20),
(78.10, -32.90),
(77.40, -33.70),
(79.10, -35.10),
(78.30, -35.80),
(79.00, -36.30),
(75.90, -39.10),
(79.60, -42.20),
(81.10, -41.20),
(83.50, -43.20),
(85.30, -41.80),
(87.20, -43.00),
(88.30, -42.00),
(95.50, -46.00),
(95.10, -46.30),
(99.70, -48.20),
(100.40, -47.60),
(114.30, -51.20),
(114.80, -50.40),
(115.90, -50.70),
(116.40, -49.80),
(118.00, -50.10),
(118.10, -49.80),
(118.60, -49.90),
(118.80, -49.70),
(121.70, -50.20),
(122.30, -49.20),
(122.90, -49.30),
(122.70, -49.80),
(123.70, -50.00),
(123.90, -49.60),
(124.50, -49.70),
(124.50, -49.40),
(124.80, -49.40),
(125.00, -49.10),
(125.40, -49.20),
(125.40, -49.30),
(125.80, -49.40),
(125.70, -49.60),
(126.60, -49.70),
(126.90, -48.90),
(127.70, -49.00),
(127.50, -49.90),
(130.80, -50.30),
(130.90, -50.10),
(132.30, -50.10),
(132.30, -50.30),
(134.20, -50.30),
(134.40, -50.40),
(136.00, -50.40),
(136.40, -50.80),
(137.70, -50.60),
(138.60, -52.00),
(139.60, -51.90),
(140.00, -52.80),
(140.80, -52.70),
(141.20, -54.20),
(143.60, -54.10),
(143.90, -54.40),
(144.50, -54.30),
(145.00, -54.70),
(146.10, -54.70),
(146.20, -55.70),
(147.20, -55.60),
(147.50, -57.60),
(148.80, -57.50),
(150.40, -60.50),
(153.80, -60.10),
(155.70, -62.90),
(155.90, -63.00),
(161.20, -61.80),
(160.90, -61.60),
(158.80, -59.70),
(158.80, -59.60),
(158.60, -59.50),
(158.50, -59.40),
(158.50, -59.30),
(158.40, -59.20),
(158.30, -59.10),
(158.20, -59.00),
(158.10, -58.90),
(158.00, -58.80),
(157.90, -58.80),
(157.80, -58.70),
(157.80, -58.60),
(157.70, -58.50),
(157.60, -58.40),
(157.50, -58.30),
(157.30, -58.10),
(157.30, -57.90),
(157.30, -57.80),
(157.40, -57.70),
(157.40, -57.50),
(157.50, -57.40),
(157.60, -57.30),
(157.70, -57.20),
(157.70, -57.10),
(157.70, -56.90),
(157.90, -56.80),
(158.00, -56.60),
(158.10, -56.50),
(158.30, -56.40),
(158.40, -56.10),
(158.60, -55.90),
(158.50, -55.80),
(158.60, -55.60),
(158.70, -55.40),
(158.70, -55.30),
(158.80, -55.10),
(158.90, -54.90),
(159.10, -54.70),
(159.20, -54.40),
(159.30, -54.20),
(159.40, -54.10),
(159.50, -53.90),
(159.70, -53.70),
(159.90, -53.50),
(160.60, -52.70),
(161.10, -52.10),
(162.40, -50.90),
(163.30, -50.30),
(164.10, -49.70),
(164.30, -49.10),
(164.70, -48.60),
(165.30, -47.90),
(165.90, -47.00),
(166.50, -46.00),
(167.30, -45.20),
(167.80, -44.70),
(169.00, -44.10),
(169.90, -43.70),
(171.00, -43.20),
(172.20, -42.60),
(173.30, -42.00),
(174.40, -41.70),
(175.30, -41.60),
(176.40, -41.10),
(176.90, -40.70),
(178.20, -39.40),
(178.80, -38.70),
(179.60, -37.40),
(180.80, -35.80),
(181.50, -34.40),
(182.00, -33.30),
(182.90, -31.70),
(183.10, -31.10),
(183.80, -29.80),
(184.30, -28.60),
(184.90, -27.20),
(185.50, -25.40),
(186.20, -23.60),
(186.50, -22.60),
(187.10, -21.40),
(187.90, -19.70),
(188.60, -18.10),
(188.90, -16.80),
(188.90, -15.40),
(188.40, -14.50),
(188.40, -14.50),
(187.20, -14.50),
(186.10, -14.50),
(185.10, -14.50),
(183.80, -14.60),
(182.30, -14.70),
(181.10, -15.10),
(180.70, -15.20),
(179.70, -15.50),
(178.30, -16.10),
(177.20, -17.20),
(176.20, -18.30),
(175.60, -19.30),
(174.30, -21.10),
(173.50, -22.00),
(172.50, -22.90),
(171.50, -23.70),
(170.60, -23.70),
(169.90, -23.10),
(169.10, -22.10),
(168.40, -21.00),
(168.00, -20.00),
(167.40, -19.00),
(166.90, -17.80),
(166.40, -16.80),
(165.80, -15.00),
(165.40, -13.60),
(164.80, -12.20),
(163.80, -11.80),
(162.90, -11.70),
(161.70, -11.60),
(160.50, -11.00),
(159.50, -10.40),
(158.50, -10.00),
(157.70, -9.60),
(156.60, -8.90),
(155.30, -8.00),
(154.20, -7.20),
(153.20, -6.70),
(152.40, -6.70),
(151.30, -6.90),
(150.50, -7.10),
(149.70, -7.30),
(148.60, -7.50),
(147.50, -7.30),
(147.00, -6.70),
(146.60, -5.90),
(146.10, -5.20),
(145.50, -4.40),
(144.60, -3.60),
(143.80, -3.00),
(142.70, -2.30),
(141.40, -1.90),
(140.10, -1.70),
(139.10, -1.60),
(137.80, -1.40),
(136.80, -1.40),
(136.50, -1.20),
(136.20, -1.00),
(135.90, -0.70),
(135.70, -0.50),
(135.40, -0.20),
(135.10, 0.00),
(134.30, 0.20),
(133.40, 0.50),
(132.60, 0.70),
(131.80, 1.00),
(130.90, 1.10),
(130.70, -0.30),
(130.60, -1.80),
(130.70, -3.40),
(131.10, -4.60),
(131.30, -6.10),
(130.00, -7.20),
(127.90, -7.40),
(125.80, -7.50),
(124.50, -7.90),
(123.30, -9.30),
(122.40, -10.30),
(119.90, -10.30),
(118.10, -10.20),
(116.40, -9.50),
(114.90, -9.40),
(114.40, -9.30),
(113.50, -9.20),
(113.20, -9.30),
(112.60, -9.40),
(111.60, -9.30),
(110.90, -9.00),
(110.30, -9.00),
(109.30, -8.80),
(108.50, -8.50),
(107.80, -8.30),
(107.00, -8.00),
(106.40, -7.80),
(106.10, -7.50),
(105.70, -7.60),
(105.00, -7.40),
(104.40, -7.10),
(104.10, -7.30),
(103.40, -7.00),
(102.80, -6.40),
(102.30, -6.30),
(101.40, -5.10),
(100.80, -4.60),
(100.20, -4.00),
(99.70, -3.20),
(99.50, -2.80),
(99.10, -2.80),
(98.60, -2.00),
(97.90, -1.30),
(97.40, -0.30),
(96.80, 0.80),
(96.20, 1.50),
(95.40, 2.10),
(94.90, 2.30),
(94.50, 2.90),
(93.60, 3.80),
(93.10, 4.20),
(92.90, 5.30),
(93.00, 5.90),
(93.00, 6.80),
(92.40, 7.80),
(92.00, 8.80),
(91.80, 9.30),
])
AUST_FALSE_EASTING = 0.0
EURA = Polygon([
(144.80, 41.00),
(143.00, 42.00),
(142.20, 43.00),
(142.00, 44.00),
(142.00, 46.00),
(142.20, 48.00),
(142.50, 50.00),
(142.50, 52.50),
(142.50, 55.00),
(147.00, 61.90),
(146.20, 63.30),
(146.10, 63.90),
(142.10, 66.20),
(140.00, 67.70),
(126.20, 70.20),
(122.80, 75.50),
(126.70, 78.20),
(122.00, 80.70),
(98.50, 85.00),
(43.00, 86.50),
(7.50, 84.90),
(0.00, 84.10),
(355.50, 83.40),
(354.00, 82.10),
(356.50, 80.90),
(358.00, 80.38),
(4.25, 79.60),
(3.00, 79.04),
(7.00, 78.45),
(7.60, 77.90),
(7.40, 76.75),
(7.20, 76.55),
(7.30, 75.60),
(8.40, 74.80),
(8.40, 74.60),
(8.70, 74.35),
(8.80, 73.95),
(8.25, 73.55),
(7.80, 73.40),
(6.80, 73.25),
(4.40, 72.80),
(1.10, 72.20),
(355.30, 71.40),
(353.50, 70.92),
(348.00, 71.70),
(346.80, 70.92),
(346.20, 70.97),
(345.30, 70.55),
(344.60, 70.00),
(343.50, 68.90),
(342.70, 68.98),
(341.90, 68.40),
(341.50, 67.70),
(340.50, 66.70),
(343.50, 66.40),
(343.00, 66.00),
(343.00, 65.00),
(341.00, 63.70),
(337.50, 64.10),
(335.40, 63.00),
(333.00, 61.60),
(330.50, 60.00),
(326.00, 57.00),
(324.70, 55.20),
(324.80, 53.00),
(325.00, 52.70),
(328.20, 52.60),
(328.20, 52.20),
(330.00, 52.10),
(330.00, 51.20),
(331.00, 49.80),
(332.50, 47.80),
(332.60, 46.50),
(332.00, 45.00),
(331.80, 44.50),
(331.50, 43.80),
(331.00, 43.30),
(330.70, 42.90),
(330.70, 42.70),
(330.70, 42.30),
(330.70, 41.70),
(330.30, 40.00),
(330.25, 39.45),
(330.90, 39.30),
(331.90, 39.00),
(332.60, 38.80),
(333.20, 38.40),
(333.80, 38.10),
(334.60, 37.70),
(335.30, 37.30),
(335.90, 36.82),
(336.80, 36.97),
(338.50, 37.07),
(338.70, 37.10),
(339.10, 37.14),
(339.50, 37.13),
(339.80, 37.12),
(342.00, 37.80),
(344.00, 37.80),
(346.00, 37.00),
(350.00, 36.00),
(354.00, 36.00),
(1.40, 36.20),
(6.80, 36.40),
(14.20, 38.50),
(15.10, 38.50),
(16.60, 38.30),
(17.30, 38.90),
(18.20, 39.70),
(18.90, 40.20),
(19.40, 39.90),
(19.70, 39.10),
(20.00, 38.20),
(20.50, 37.30),
(20.90, 36.50),
(21.60, 35.80),
(22.20, 35.20),
(23.00, 34.70),
(23.70, 34.40),
(24.60, 34.20),
(25.70, 34.30),
(26.70, 34.40),
(27.40, 34.50),
(28.20, 34.80),
(29.20, 35.20),
(29.80, 35.70),
(30.30, 35.80),
(30.90, 35.40),
(31.40, 34.90),
(32.30, 34.30),
(32.90, 34.20),
(34.00, 34.60),
(34.50, 35.00),
(35.20, 35.60),
(35.60, 35.90),
(35.90, 36.40),
(36.30, 36.70),
(36.80, 37.20),
(37.40, 37.50),
(37.90, 37.90),
(38.50, 38.20),
(39.00, 38.40),
(39.50, 38.70),
(40.10, 39.00),
(40.70, 39.20),
(41.60, 39.20),
(42.30, 38.90),
(43.00, 38.30),
(43.60, 38.00),
(43.60, 38.00),
(44.00, 37.60),
(44.30, 37.20),
(44.90, 36.40),
(45.40, 36.00),
(45.90, 35.50),
(46.40, 35.00),
(47.10, 34.10),
(47.70, 33.50),
(48.10, 32.80),
(48.70, 32.10),
(49.30, 31.30),
(49.80, 30.40),
(50.40, 29.70),
(51.20, 28.70),
(51.80, 28.00),
(52.40, 27.30),
(53.30, 26.50),
(54.30, 26.30),
(55.10, 26.20),
(56.00, 26.00),
(57.00, 25.80),
(58.10, 25.60),
(58.70, 25.40),
(59.00, 25.40),
(59.80, 25.20),
(60.00, 25.20),
(61.00, 25.00),
(62.00, 24.90),
(63.00, 25.00),
(64.00, 25.20),
(65.00, 25.20),
(65.80, 25.20),
(66.10, 26.00),
(66.00, 27.00),
(65.90, 28.00),
(65.90, 29.00),
(66.10, 30.00),
(66.50, 31.00),
(67.20, 32.00),
(68.00, 33.00),
(68.80, 34.00),
(69.20, 34.40),
(70.00, 34.00),
(71.00, 33.90),
(72.00, 33.60),
(73.00, 33.60),
(73.70, 34.00),
(74.00, 33.70),
(75.00, 33.10),
(76.00, 32.30),
(77.00, 31.00),
(78.00, 30.40),
(79.00, 29.70),
(80.00, 29.20),
(81.00, 29.00),
(82.00, 28.30),
(83.00, 27.90),
(84.00, 27.80),
(85.00, 27.50),
(86.00, 27.30),
(87.00, 26.90),
(88.00, 26.80),
(89.00, 26.90),
(90.00, 26.70),
(91.00, 26.80),
(92.00, 26.90),
(93.00, 27.20),
(93.30, 27.10),
(93.60, 27.10),
(94.00, 27.10),
(94.20, 27.10),
(94.40, 27.10),
(94.60, 27.10),
(94.80, 27.10),
(95.00, 27.10),
(95.30, 27.20),
(95.50, 27.20),
(95.70, 27.20),
(95.70, 26.80),
(95.60, 26.50),
(95.40, 26.30),
(95.30, 26.10),
(95.20, 25.90),
(95.10, 25.80),
(95.00, 25.70),
(94.80, 25.50),
(94.70, 25.30),
(94.50, 24.90),
(94.50, 24.70),
(94.40, 24.40),
(94.30, 23.90),
(94.20, 23.50),
(94.20, 23.40),
(94.20, 23.10),
(94.10, 22.70),
(94.10, 22.60),
(94.00, 22.40),
(94.00, 21.80),
(94.00, 21.80),
(93.90, 21.10),
(93.90, 21.00),
(93.90, 20.90),
(93.90, 20.60),
(93.90, 20.60),
(93.80, 20.30),
(93.80, 20.20),
(93.80, 20.10),
(93.80, 20.00),
(93.90, 19.60),
(93.90, 19.10),
(93.90, 18.70),
(94.00, 18.30),
(94.00, 17.90),
(94.10, 17.40),
(94.10, 17.00),
(94.10, 16.80),
(93.80, 16.60),
(93.70, 16.00),
(93.50, 15.00),
(93.20, 14.40),
(92.80, 13.80),
(92.30, 13.10),
(92.00, 12.50),
(91.80, 11.70),
(91.80, 11.10),
(91.90, 10.30),
(91.80, 9.30),
(92.00, 8.80),
(92.40, 7.80),
(93.00, 6.80),
(93.00, 5.90),
(92.90, 5.30),
(93.10, 4.20),
(93.60, 3.80),
(94.50, 2.90),
(94.90, 2.30),
(95.40, 2.10),
(96.20, 1.50),
(96.80, 0.80),
(97.40, -0.30),
(97.90, -1.30),
(98.60, -2.00),
(99.10, -2.80),
(99.50, -2.80),
(99.70, -3.20),
(100.20, -4.00),
(100.80, -4.60),
(101.40, -5.10),
(102.30, -6.30),
(102.80, -6.40),
(103.40, -7.00),
(104.10, -7.30),
(104.40, -7.10),
(105.00, -7.40),
(105.70, -7.60),
(106.10, -7.50),
(106.40, -7.80),
(107.00, -8.00),
(107.80, -8.30),
(108.50, -8.50),
(109.30, -8.80),
(110.30, -9.00),
(110.90, -9.00),
(111.60, -9.30),
(112.60, -9.40),
(113.20, -9.30),
(113.50, -9.20),
(114.40, -9.30),
(114.90, -9.40),
(116.40, -9.50),
(118.10, -10.20),
(119.90, -10.30),
(122.40, -10.30),
(123.30, -9.30),
(124.50, -7.90),
(125.80, -7.50),
(127.90, -7.40),
(130.00, -7.20),
(131.30, -6.10),
(131.10, -4.60),
(130.70, -3.40),
(130.60, -1.80),
(130.70, -0.30),
(130.90, 1.10),
(130.50, 1.90),
(130.00, 2.70),
(128.70, 4.00),
(128.10, 4.90),
(126.90, 6.10),
(126.70, 7.60),
(126.40, 8.90),
(125.90, 10.60),
(125.10, 12.20),
(124.30, 13.80),
(123.60, 14.80),
(122.50, 16.00),
(122.50, 17.80),
(122.40, 18.90),
(122.20, 20.10),
(121.80, 21.40),
(121.60, 22.30),
(121.90, 22.90),
(123.20, 23.20),
(124.80, 23.60),
(125.90, 24.00),
(127.20, 24.80),
(128.10, 25.90),
(129.00, 27.10),
(129.90, 28.20),
(130.50, 29.20),
(131.00, 30.40),
(132.40, 31.70),
(133.70, 32.60),
(135.30, 33.60),
(136.50, 34.10),
(138.30, 34.50),
(142.00, 35.00),
(142.80, 36.00),
(143.50, 37.00),
(144.00, 38.00),
(144.20, 39.00),
(144.50, 40.00),
(144.80, 41.00),
])
EURA = transform(partial(_shift_large_longitudes, 270.0), EURA)
EURA_FALSE_EASTING = abs(min(EURA.exterior.xy[0]))
EURA = translate(EURA, xoff=EURA_FALSE_EASTING)
INDI = Polygon([
(91.80, 9.30),
(91.90, 10.30),
(91.80, 11.10),
(91.80, 11.70),
(92.00, 12.50),
(92.30, 13.10),
(92.80, 13.80),
(93.20, 14.40),
(93.50, 15.00),
(93.70, 16.00),
(93.80, 16.60),
(94.10, 16.80),
(94.10, 17.00),
(94.10, 17.40),
(94.00, 17.90),
(94.00, 18.30),
(93.90, 18.70),
(93.90, 19.10),
(93.90, 19.60),
(93.80, 20.00),
(93.80, 20.10),
(93.80, 20.20),
(93.80, 20.30),
(93.90, 20.60),
(93.90, 20.60),
(93.90, 20.90),
(93.90, 21.00),
(93.90, 21.10),
(94.00, 21.80),
(94.00, 21.80),
(94.00, 22.40),
(94.10, 22.60),
(94.10, 22.70),
(94.20, 23.10),
(94.20, 23.40),
(94.20, 23.50),
(94.30, 23.90),
(94.40, 24.40),
(94.50, 24.70),
(94.50, 24.90),
(94.70, 25.30),
(94.80, 25.50),
(95.00, 25.70),
(95.10, 25.80),
(95.20, 25.90),
(95.30, 26.10),
(95.40, 26.30),
(95.60, 26.50),
(95.70, 26.80),
(95.70, 27.20),
(95.50, 27.20),
(95.30, 27.20),
(95.00, 27.10),
(94.80, 27.10),
(94.60, 27.10),
(94.40, 27.10),
(94.20, 27.10),
(94.00, 27.10),
(93.60, 27.10),
(93.30, 27.10),
(93.00, 27.20),
(92.00, 26.90),
(91.00, 26.80),
(90.00, 26.70),
(89.00, 26.90),
(88.00, 26.80),
(87.00, 26.90),
(86.00, 27.30),
(85.00, 27.50),
(84.00, 27.80),
(83.00, 27.90),
(82.00, 28.30),
(81.00, 29.00),
(80.00, 29.20),
(79.00, 29.70),
(78.00, 30.40),
(77.00, 31.00),
(76.00, 32.30),
(75.00, 33.10),
(74.00, 33.70),
(73.70, 34.00),
(73.00, 33.60),
(72.00, 33.60),
(71.00, 33.90),
(70.00, 34.00),
(69.20, 34.40),
(68.80, 34.00),
(68.00, 33.00),
(67.20, 32.00),
(66.50, 31.00),
(66.10, 30.00),
(65.90, 29.00),
(65.90, 28.00),
(66.00, 27.00),
(66.10, 26.00),
(65.80, 25.20),
(65.70, 25.00),
(65.20, 24.00),
(64.80, 23.30),
(63.80, 23.20),
(63.50, 23.00),
(63.00, 22.50),
(62.50, 22.00),
(62.25, 21.50),
(62.00, 21.00),
(61.60, 20.50),
(61.20, 20.00),
(60.80, 19.00),
(60.45, 18.50),
(60.30, 18.00),
(60.20, 17.50),
(60.10, 17.00),
(60.00, 16.50),
(60.00, 16.00),
(59.90, 15.50),
(59.80, 15.00),
(59.50, 14.50),
(59.10, 14.00),
(58.90, 13.50),
(58.60, 13.00),
(58.30, 12.70),
(57.90, 12.00),
(57.40, 11.00),
(56.75, 10.25),
(57.22, 9.90),
(57.50, 10.12),
(58.15, 9.68),
(58.06, 9.24),
(58.44, 9.11),
(58.28, 8.48),
(59.04, 8.00),
(59.24, 8.00),
(59.80, 7.72),
(59.56, 7.18),
(60.00, 7.00),
(60.16, 6.68),
(60.32, 6.60),
(60.40, 6.38),
(60.76, 6.20),
(61.60, 5.56),
(61.54, 5.44),
(62.20, 4.98),
(62.06, 4.80),
(62.56, 4.48),
(62.52, 4.32),
(63.08, 3.96),
(63.32, 3.92),
(63.52, 3.76),
(64.14, 3.66),
(65.12, 2.96),
(65.88, 3.00),
(66.76, 2.30),
(66.66, 1.60),
(67.04, 1.32),
(67.25, 0.88),
(66.80, 0.48),
(67.02, 0.16),
(67.02, 0.00),
(67.22, -0.18),
(67.00, -0.46),
(67.34, -0.66),
(67.34, -0.80),
(67.58, -0.96),
(67.34, -1.36),
(68.04, -1.84),
(67.92, -2.06),
(68.19, -2.21),
(67.88, -2.72),
(68.21, -2.92),
(67.98, -3.28),
(68.61, -3.69),
(68.28, -4.16),
(68.73, -4.51),
(68.73, -4.51),
(80.00, -5.00),
(89.00, -5.00),
(89.50, 0.00),
(90.00, 5.00),
(91.80, 9.30),
])
INDI_FALSE_EASTING = 0.0
NAZC = Polygon([
(257.40, 2.30),
(257.40, -0.50),
(257.20, -2.90),
(257.20, -4.10),
(255.70, -4.30),
(254.30, -4.70),
(253.70, -4.90),
(253.00, -6.40),
(252.40, -8.10),
(252.20, -9.00),
(250.80, -9.30),
(250.10, -9.40),
(249.40, -11.00),
(248.80, -12.60),
(248.60, -13.60),
(247.80, -13.70),
(247.40, -15.70),
(246.90, -17.80),
(246.50, -19.40),
(246.30, -20.00),
(246.10, -20.70),
(245.80, -20.70),
(245.50, -22.70),
(244.80, -22.80),
(244.90, -24.10),
(245.10, -26.30),
(245.60, -26.80),
(246.10, -26.70),
(246.60, -27.20),
(247.90, -29.50),
(247.90, -31.10),
(247.90, -32.00),
(248.00, -33.80),
(248.00, -34.90),
(249.10, -35.10),
(249.80, -35.20),
(251.10, -35.20),
(252.30, -35.30),
(253.40, -35.50),
(254.70, -35.70),
(256.30, -35.80),
(258.20, -35.90),
(259.70, -36.10),
(261.60, -36.30),
(263.00, -36.40),
(263.70, -36.50),
(263.70, -37.10),
(265.40, -37.20),
(266.40, -37.40),
(266.30, -38.40),
(267.50, -38.80),
(268.20, -39.10),
(268.30, -40.30),
(268.90, -41.20),
(271.30, -41.30),
(273.60, -41.50),
(275.30, -41.70),
(276.10, -41.80),
(276.90, -41.90),
(277.10, -43.30),
(277.30, -44.30),
(277.70, -44.80),
(279.40, -44.90),
(280.40, -45.00),
(281.50, -45.20),
(282.70, -45.60),
(283.40, -45.60),
(283.80, -45.30),
(283.80, -44.80),
(283.80, -43.90),
(284.10, -43.00),
(284.30, -41.80),
(284.40, -40.50),
(284.90, -38.90),
(285.70, -37.60),
(286.50, -36.40),
(286.90, -35.10),
(287.30, -33.70),
(287.40, -32.00),
(287.90, -30.20),
(288.40, -28.50),
(288.80, -26.60),
(289.20, -24.90),
(289.40, -23.40),
(289.20, -22.20),
(288.80, -21.20),
(288.40, -20.40),
(287.80, -19.50),
(286.90, -18.10),
(286.00, -17.40),
(285.00, -16.60),
(284.20, -15.90),
(283.20, -15.10),
(282.10, -13.90),
(281.30, -12.80),
(280.50, -11.70),
(279.90, -10.50),
(279.40, -9.40),
(279.00, -7.80),
(278.70, -6.50),
(278.70, -5.40),
(278.70, -4.10),
(279.00, -2.50),
(279.10, -1.20),
(279.70, 0.30),
(280.20, 1.00),
(280.90, 1.90),
(281.20, 2.20),
(281.70, 2.60),
(281.90, 3.60),
(282.10, 4.30),
(282.20, 4.90),
(282.20, 5.40),
(282.00, 6.00),
(281.90, 6.50),
(281.60, 7.10),
(281.30, 7.40),
(280.90, 7.50),
(280.50, 7.50),
(280.10, 7.20),
(279.70, 7.00),
(279.20, 6.90),
(278.70, 7.00),
(278.30, 7.10),
(278.00, 7.20),
(277.60, 7.20),
(277.50, 7.00),
(277.50, 6.90),
(277.50, 6.50),
(277.50, 5.90),
(277.50, 5.20),
(277.60, 4.60),
(277.50, 4.00),
(277.60, 3.50),
(277.00, 3.50),
(276.30, 3.50),
(275.50, 3.40),
(275.50, 2.50),
(275.50, 1.80),
(274.80, 1.80),
(274.80, 1.40),
(274.80, 0.90),
(274.10, 1.00),
(272.60, 1.10),
(271.60, 1.10),
(270.40, 1.10),
(269.40, 1.10),
(269.40, 1.60),
(269.00, 1.90),
(267.90, 2.00),
(266.90, 2.00),
(265.80, 2.10),
(265.00, 2.10),
(264.20, 2.10),
(263.30, 2.10),
(262.40, 2.10),
(261.40, 2.10),
(260.30, 2.10),
(259.50, 2.10),
(258.70, 2.20),
(257.80, 2.20),
(257.40, 2.30),
])
NAZC_FALSE_EASTING = 0.0
NOAM = MultiPolygon([
Polygon([
(0.00, 84.10),
(7.50, 84.90),
(43.00, 86.50),
(98.50, 85.00),
(122.00, 80.70),
(126.70, 78.20),
(122.80, 75.50),
(126.20, 70.20),
(140.00, 67.70),
(142.10, 66.20),
(146.10, 63.90),
(146.20, 63.30),
(147.00, 61.90),
(142.50, 55.00),
(142.50, 52.50),
(142.50, 50.00),
(142.20, 48.00),
(142.00, 46.00),
(142.00, 44.00),
(142.20, 43.00),
(143.00, 42.00),
(144.80, 41.00),
(147.00, 42.00),
(148.50, 43.00),
(150.00, 44.00),
(152.00, 45.00),
(153.80, 46.00),
(155.00, 47.00),
(156.20, 48.00),
(157.80, 49.00),
(159.50, 50.00),
(160.50, 51.00),
(161.00, 52.00),
(162.20, 53.00),
(163.00, 54.00),
(164.00, 55.50),
(166.00, 54.30),
(168.00, 53.60),
(170.00, 52.60),
(172.00, 51.90),
(174.00, 51.30),
(176.00, 50.80),
(178.00, 50.50),
(180.00, 50.50),
(182.00, 50.40),
(184.00, 50.50),
(186.00, 50.80),
(188.00, 51.00),
(190.00, 51.30),
(192.00, 51.70),
(194.00, 52.20),
(196.00, 52.80),
(198.00, 53.20),
(200.00, 53.70),
(202.00, 54.00),
(204.00, 54.70),
(206.00, 55.20),
(208.00, 56.00),
(210.00, 56.80),
(212.00, 57.80),
(213.00, 58.30),
(214.00, 59.00),
(215.00, 59.20),
(216.00, 59.30),
(217.00, 59.40),
(218.00, 59.80),
(219.00, 60.10),
(220.00, 59.90),
(221.00, 59.50),
(222.00, 59.00),
(223.00, 58.50),
(223.50, 58.00),
(223.90, 57.00),
(224.50, 56.00),
(225.50, 55.00),
(226.10, 54.00),
(227.20, 53.00),
(228.70, 52.00),
(229.30, 51.50),
(230.10, 51.00),
(230.80, 50.50),
(231.80, 50.00),
(233.00, 49.00),
(233.90, 48.00),
(234.50, 47.00),
(234.90, 46.00),
(235.00, 45.00),
(235.00, 44.00),
(235.00, 43.00),
(235.10, 42.00),
(235.30, 41.00),
(235.60, 40.20),
(236.00, 40.00),
(236.10, 39.50),
(236.30, 39.00),
(236.80, 38.50),
(237.25, 38.00),
(237.70, 37.50),
(238.30, 37.00),
(238.90, 36.50),
(239.45, 36.00),
(239.95, 35.50),
(240.65, 34.90),
(241.50, 34.70),
(242.70, 34.15),
(243.45, 34.00),
(244.40, 33.30),
(244.50, 32.90),
(244.80, 32.50),
(244.90, 32.30),
(245.10, 32.10),
(245.30, 31.90),
(245.30, 31.80),
(245.50, 31.60),
(245.60, 31.30),
(245.70, 31.00),
(245.80, 30.80),
(246.10, 30.50),
(246.40, 30.10),
(246.50, 29.90),
(246.70, 29.70),
(246.90, 29.50),
(247.30, 29.10),
(247.50, 28.80),
(247.70, 28.50),
(247.90, 28.30),
(248.10, 28.00),
(248.20, 27.90),
(248.40, 27.70),
(248.50, 27.50),
(248.70, 27.30),
(248.90, 27.10),
(249.10, 26.80),
(249.30, 26.60),
(249.50, 26.40),
(249.60, 26.20),
(249.70, 26.10),
(249.70, 26.00),
(249.70, 26.00),
(249.90, 25.80),
(250.00, 25.60),
(250.10, 25.50),
(250.20, 25.30),
(250.30, 25.10),
(250.80, 24.90),
(250.90, 24.70),
(250.90, 24.60),
(251.00, 24.50),
(251.30, 24.10),
(251.70, 23.50),
(252.00, 23.00),
(252.30, 22.90),
(252.40, 22.60),
(252.70, 22.40),
(253.20, 22.10),
(253.80, 21.90),
(254.10, 21.60),
(254.40, 21.20),
(254.30, 20.60),
(254.30, 20.20),
(254.40, 19.60),
(254.80, 19.20),
(255.20, 18.90),
(255.70, 18.40),
(256.40, 18.00),
(257.10, 17.60),
(257.90, 17.20),
(258.60, 16.90),
(259.30, 16.60),
(260.10, 16.30),
(260.60, 16.10),
(261.20, 15.80),
(261.70, 15.60),
(262.40, 15.30),
(263.00, 15.20),
(263.60, 15.10),
(264.20, 15.00),
(270.70, 15.30),
(273.00, 16.40),
(275.00, 16.90),
(277.00, 17.50),
(278.50, 17.80),
(278.50, 18.80),
(280.00, 19.20),
(283.00, 19.70),
(285.00, 19.70),
(286.40, 19.90),
(287.20, 19.90),
(288.10, 20.10),
(289.20, 20.10),
(290.30, 20.10),
(291.20, 20.10),
(292.10, 20.10),
(292.90, 20.00),
(294.00, 19.80),
(294.00, 19.80),
(295.00, 19.70),
(295.90, 19.60),
(296.60, 19.40),
(297.50, 19.00),
(298.20, 18.60),
(299.00, 18.00),
(314.30, 20.30),
(314.40, 21.30),
(314.50, 22.00),
(315.00, 22.80),
(315.00, 23.00),
(315.10, 23.70),
(313.70, 23.90),
(313.70, 23.90),
(313.70, 24.20),
(313.90, 24.50),
(314.60, 25.20),
(315.00, 25.70),
(315.20, 26.20),
(315.50, 26.90),
(315.80, 27.50),
(316.25, 28.75),
(316.85, 28.75),
(317.30, 30.10),
(318.00, 30.00),
(318.10, 30.50),
(318.30, 30.90),
(319.50, 31.90),
(320.70, 33.80),
(322.20, 33.50),
(323.60, 35.30),
(325.00, 35.00),
(325.90, 36.00),
(326.30, 36.50),
(326.80, 36.80),
(328.00, 37.50),
(328.85, 37.90),
(329.20, 38.00),
(329.35, 38.30),
(329.70, 38.40),
(330.05, 39.45),
(330.25, 39.45),
(330.30, 40.00),
(330.70, 41.70),
(330.70, 42.30),
(330.70, 42.70),
(330.70, 42.90),
(331.00, 43.30),
(331.50, 43.80),
(331.80, 44.50),
(332.00, 45.00),
(332.60, 46.50),
(332.50, 47.80),
(331.00, 49.80),
(330.00, 51.20),
(330.00, 52.10),
(328.20, 52.20),
(328.20, 52.60),
(325.00, 52.70),
(324.80, 53.00),
(324.70, 55.20),
(326.00, 57.00),
(330.50, 60.00),
(333.00, 61.60),
(335.40, 63.00),
(337.50, 64.10),
(341.00, 63.70),
(343.00, 65.00),
(343.00, 66.00),
(343.50, 66.40),
(340.50, 66.70),
(341.50, 67.70),
(341.90, 68.40),
(342.70, 68.98),
(343.50, 68.90),
(344.60, 70.00),
(345.30, 70.55),
(346.20, 70.97),
(346.80, 70.92),
(348.00, 71.70),
(353.50, 70.92),
(355.30, 71.40),
(360.00, 72.05), # Synthetic
(360.00, 80.13), # Synthetic
(358.00, 80.38),
(356.50, 80.90),
(354.00, 82.10),
(355.50, 83.40),
(360.00, 84.10), # Synthetic
(360.00, 90.00), # Synthetic
(0.00, 90.00), # Synthetic
(0.00, 84.10), # Synthetic
]),
Polygon([
(0.00, 72.05), # Synthetic
(1.10, 72.20),
(4.40, 72.80),
(6.80, 73.25),
(7.80, 73.40),
(8.25, 73.55),
(8.80, 73.95),
(8.70, 74.35),
(8.40, 74.60),
(8.40, 74.80),
(7.30, 75.60),
(7.20, 76.55),
(7.40, 76.75),
(7.60, 77.90),
(7.00, 78.45),
(3.00, 79.04),
(4.25, 79.60),
(0.00, 80.13), # Synthetic
(0.00, 72.05), # Synthetic
])
])
NOAM_FALSE_EASTING = 0.0
PCFC = Polygon([
(144.80, 41.00),
(144.50, 40.00),
(144.20, 39.00),
(144.00, 38.00),
(143.50, 37.00),
(142.80, 36.00),
(142.00, 35.00),
(142.00, 34.00),
(142.00, 33.00),
(142.20, 31.00),
(142.50, 30.00),
(142.80, 29.00),
(143.20, 28.00),
(143.20, 27.00),
(143.00, 26.00),
(143.00, 25.00),
(144.00, 24.00),
(145.00, 23.00),
(146.20, 22.00),
(147.00, 21.00),
(147.30, 20.00),
(147.30, 18.80),
(147.30, 17.50),
(147.30, 15.60),
(146.60, 13.90),
(144.80, 12.30),
(142.30, 11.20),
(140.60, 10.70),
(138.60, 10.10),
(137.80, 8.80),
(136.70, 8.10),
(135.40, 7.80),
(134.30, 5.90),
(133.40, 4.50),
(132.10, 3.10),
(131.00, 1.20),
(130.90, 1.10),
(131.80, 1.00),
(132.60, 0.70),
(133.40, 0.50),
(134.30, 0.20),
(135.10, 0.00),
(135.40, -0.20),
(135.70, -0.50),
(135.90, -0.70),
(136.20, -1.00),
(136.50, -1.20),
(136.80, -1.40),
(137.80, -1.40),
(139.10, -1.60),
(140.10, -1.70),
(141.40, -1.90),
(142.70, -2.30),
(143.80, -3.00),
(144.60, -3.60),
(145.50, -4.40),
(146.10, -5.20),
(146.60, -5.90),
(147.00, -6.70),
(147.50, -7.30),
(148.60, -7.50),
(149.70, -7.30),
(150.50, -7.10),
(151.30, -6.90),
(152.40, -6.70),
(153.20, -6.70),
(154.20, -7.20),
(155.30, -8.00),
(156.60, -8.90),
(157.70, -9.60),
(158.50, -10.00),
(159.50, -10.40),
(160.50, -11.00),
(161.70, -11.60),
(162.90, -11.70),
(163.80, -11.80),
(164.80, -12.20),
(165.40, -13.60),
(165.80, -15.00),
(166.40, -16.80),
(166.90, -17.80),
(167.40, -19.00),
(168.00, -20.00),
(168.40, -21.00),
(169.10, -22.10),
(169.90, -23.10),
(170.60, -23.70),
(171.50, -23.70),
(172.50, -22.90),
(173.50, -22.00),
(174.30, -21.10),
(175.60, -19.30),
(176.20, -18.30),
(177.20, -17.20),
(178.30, -16.10),
(179.70, -15.50),
(180.70, -15.20),
(181.10, -15.10),
(182.30, -14.70),
(183.80, -14.60),
(185.10, -14.50),
(186.10, -14.50),
(187.20, -14.50),
(188.40, -14.50),
(188.40, -14.50),
(188.90, -15.40),
(188.90, -16.80),
(188.60, -18.10),
(187.90, -19.70),
(187.10, -21.40),
(186.50, -22.60),
(186.20, -23.60),
(185.50, -25.40),
(184.90, -27.20),
(184.30, -28.60),
(183.80, -29.80),
(183.10, -31.10),
(182.90, -31.70),
(182.00, -33.30),
(181.50, -34.40),
(180.80, -35.80),
(179.60, -37.40),
(178.80, -38.70),
(178.20, -39.40),
(176.90, -40.70),
(176.40, -41.10),
(175.30, -41.60),
(174.40, -41.70),
(173.30, -42.00),
(172.20, -42.60),
(171.00, -43.20),
(169.90, -43.70),
(169.00, -44.10),
(167.80, -44.70),
(167.30, -45.20),
(166.50, -46.00),
(165.90, -47.00),
(165.30, -47.90),
(164.70, -48.60),
(164.30, -49.10),
(164.10, -49.70),
(163.30, -50.30),
(162.40, -50.90),
(161.10, -52.10),
(160.60, -52.70),
(159.90, -53.50),
(159.70, -53.70),
(159.50, -53.90),
(159.40, -54.10),
(159.30, -54.20),
(159.20, -54.40),
(159.10, -54.70),
(158.90, -54.90),
(158.80, -55.10),
(158.70, -55.30),
(158.70, -55.40),
(158.60, -55.60),
(158.50, -55.80),
(158.60, -55.90),
(158.40, -56.10),
(158.30, -56.40),
(158.10, -56.50),
(158.00, -56.60),
(157.90, -56.80),
(157.70, -56.90),
(157.70, -57.10),
(157.70, -57.20),
(157.60, -57.30),
(157.50, -57.40),
(157.40, -57.50),
(157.40, -57.70),
(157.30, -57.80),
(157.30, -57.90),
(157.30, -58.10),
(157.50, -58.30),
(157.60, -58.40),
(157.70, -58.50),
(157.80, -58.60),
(157.80, -58.70),
(157.90, -58.80),
(158.00, -58.80),
(158.10, -58.90),
(158.20, -59.00),
(158.30, -59.10),
(158.40, -59.20),
(158.50, -59.30),
(158.50, -59.40),
(158.60, -59.50),
(158.80, -59.60),
(158.80, -59.70),
(160.90, -61.60),
(161.20, -61.80),
(163.20, -61.80),
(163.80, -62.30),
(165.00, -62.00),
(166.40, -62.90),
(167.40, -62.60),
(168.40, -63.00),
(170.50, -62.50),
(173.40, -64.10),
(174.80, -63.70),
(182.30, -66.70),
(188.10, -64.70),
(189.20, -65.10),
(194.10, -62.80),
(195.60, -63.30),
(198.70, -61.70),
(202.50, -63.10),
(207.90, -59.60),
(209.20, -60.00),
(210.90, -58.80),
(210.70, -58.70),
(212.90, -57.10),
(213.40, -57.30),
(215.30, -55.70),
(219.20, -56.80),
(220.10, -56.00),
(220.80, -56.20),
(222.10, -54.90),
(222.40, -55.00),
(223.10, -54.00),
(227.00, -54.90),
(227.60, -54.10),
(231.30, -54.90),
(233.00, -55.30),
(233.60, -54.70),
(237.70, -55.80),
(239.50, -54.30),
(241.00, -54.50),
(242.00, -53.30),
(241.60, -53.20),
(243.00, -50.80),
(243.60, -49.60),
(245.00, -50.00),
(245.90, -48.30),
(246.70, -45.20),
(247.30, -42.70),
(247.80, -40.70),
(248.30, -38.40),
(248.00, -34.90),
(248.00, -33.80),
(247.90, -32.00),
(247.90, -31.10),
(247.90, -29.50),
(246.60, -27.20),
(246.10, -26.70),
(245.60, -26.80),
(245.10, -26.30),
(244.90, -24.10),
(244.80, -22.80),
(245.50, -22.70),
(245.80, -20.70),
(246.10, -20.70),
(246.30, -20.00),
(246.50, -19.40),
(246.90, -17.80),
(247.40, -15.70),
(247.80, -13.70),
(248.60, -13.60),
(248.80, -12.60),
(249.40, -11.00),
(250.10, -9.40),
(250.80, -9.30),
(252.20, -9.00),
(252.40, -8.10),
(253.00, -6.40),
(253.70, -4.90),
(254.30, -4.70),
(255.70, -4.30),
(257.20, -4.10),
(257.20, -2.90),
(257.40, -0.50),
(257.40, 2.30),
(257.40, 2.70),
(257.40, 3.50),
(257.40, 4.30),
(257.40, 4.90),
(257.40, 5.50),
(257.40, 6.20),
(257.40, 7.00),
(257.40, 7.90),
(257.40, 8.40),
(256.90, 8.50),
(256.40, 8.50),
(256.40, 8.90),
(256.30, 9.50),
(256.30, 10.10),
(256.00, 10.20),
(255.70, 10.40),
(255.60, 11.00),
(255.60, 11.90),
(255.60, 13.00),
(255.60, 14.30),
(255.60, 15.20),
(255.00, 15.20),
(254.60, 15.20),
(254.60, 16.50),
(254.60, 17.30),
(254.70, 18.10),
(254.40, 18.20),
(253.70, 18.50),
(252.90, 18.90),
(252.10, 19.20),
(251.40, 19.40),
(250.80, 19.70),
(250.60, 19.80),
(250.80, 20.20),
(251.20, 20.90),
(251.60, 21.70),
(251.90, 22.30),
(252.10, 22.70),
(252.30, 22.90),
(252.00, 23.00),
(251.70, 23.50),
(251.30, 24.10),
(251.00, 24.50),
(250.90, 24.60),
(250.90, 24.70),
(250.80, 24.90),
(250.30, 25.10),
(250.20, 25.30),
(250.10, 25.50),
(250.00, 25.60),
(249.90, 25.80),
(249.70, 26.00),
(249.70, 26.00),
(249.70, 26.10),
(249.60, 26.20),
(249.50, 26.40),
(249.30, 26.60),
(249.10, 26.80),
(248.90, 27.10),
(248.70, 27.30),
(248.50, 27.50),
(248.40, 27.70),
(248.20, 27.90),
(248.10, 28.00),
(247.90, 28.30),
(247.70, 28.50),
(247.50, 28.80),
(247.30, 29.10),
(246.90, 29.50),
(246.70, 29.70),
(246.50, 29.90),
(246.40, 30.10),
(246.10, 30.50),
(245.80, 30.80),
(245.70, 31.00),
(245.60, 31.30),
(245.50, 31.60),
(245.30, 31.80),
(245.30, 31.90),
(245.10, 32.10),
(244.90, 32.30),
(244.80, 32.50),
(244.50, 32.90),
(244.40, 33.30),
(243.45, 34.00),
(242.70, 34.15),
(241.50, 34.70),
(240.65, 34.90),
(239.95, 35.50),
(239.45, 36.00),
(238.90, 36.50),
(238.30, 37.00),
(237.70, 37.50),
(237.25, 38.00),
(236.80, 38.50),
(236.30, 39.00),
(236.10, 39.50),
(236.00, 40.00),
(235.60, 40.20),
(235.00, 40.40),
(232.50, 40.40),
(232.60, 41.60),
(232.80, 41.60),
(233.10, 42.30),
(233.50, 43.00),
(232.20, 43.50),
(230.80, 44.00),
(229.50, 44.50),
(229.90, 45.50),
(230.40, 46.50),
(230.80, 47.50),
(231.20, 48.20),
(231.00, 48.50),
(229.50, 49.20),
(229.60, 49.50),
(230.30, 50.10),
(230.80, 50.50),
(230.10, 51.00),
(229.30, 51.50),
(228.70, 52.00),
(227.20, 53.00),
(226.10, 54.00),
(225.50, 55.00),
(224.50, 56.00),
(223.90, 57.00),
(223.50, 58.00),
(223.00, 58.50),
(222.00, 59.00),
(221.00, 59.50),
(220.00, 59.90),
(219.00, 60.10),
(218.00, 59.80),
(217.00, 59.40),
(216.00, 59.30),
(215.00, 59.20),
(214.00, 59.00),
(213.00, 58.30),
(212.00, 57.80),
(210.00, 56.80),
(208.00, 56.00),
(206.00, 55.20),
(204.00, 54.70),
(202.00, 54.00),
(200.00, 53.70),
(198.00, 53.20),
(196.00, 52.80),
(194.00, 52.20),
(192.00, 51.70),
(190.00, 51.30),
(188.00, 51.00),
(186.00, 50.80),
(184.00, 50.50),
(182.00, 50.40),
(180.00, 50.50),
(178.00, 50.50),
(176.00, 50.80),
(174.00, 51.30),
(172.00, 51.90),
(170.00, 52.60),
(168.00, 53.60),
(166.00, 54.30),
(164.00, 55.50),
(163.00, 54.00),
(162.20, 53.00),
(161.00, 52.00),
(160.50, 51.00),
(159.50, 50.00),
(157.80, 49.00),
(156.20, 48.00),
(155.00, 47.00),
(153.80, 46.00),
(152.00, 45.00),
(150.00, 44.00),
(148.50, 43.00),
(147.00, 42.00),
(144.80, 41.00),
])
PCFC_FALSE_EASTING = 0.0
SOAM = Polygon([
(359.30, -54.80),
(359.00, -54.60),
(358.50, -54.00),
(357.60, -54.30),
(357.00, -53.50),
(355.20, -52.20),
(353.00, -50.10),
(352.00, -49.30),
(350.20, -48.20),
(349.30, -46.90),
(346.70, -47.40),
(346.20, -46.20),
(344.80, -45.20),
(344.00, -44.10),
(343.50, -41.70),
(343.20, -40.30),
(344.10, -40.10),
(344.00, -39.10),
(342.50, -37.30),
(342.20, -35.50),
(344.70, -35.30),
(344.80, -34.30),
(345.40, -33.90),
(345.50, -33.00),
(345.50, -32.50),
(346.70, -32.30),
(346.60, -31.70),
(346.60, -31.10),
(346.30, -29.20),
(347.10, -29.00),
(346.80, -27.30),
(346.20, -26.90),
(346.30, -25.10),
(346.60, -24.70),
(346.50, -23.10),
(347.50, -22.60),
(348.40, -21.10),
(348.00, -19.20),
(347.00, -17.80),
(345.90, -17.90),
(346.00, -17.00),
(345.70, -16.20),
(346.80, -16.10),
(346.50, -15.00),
(346.40, -14.00),
(345.70, -14.10),
(345.50, -13.50),
(345.10, -11.90),
(347.10, -11.50),
(347.00, -10.50),
(346.50, -8.00),
(346.60, -7.20),
(348.50, -6.80),
(347.20, -0.90),
(344.20, -1.40),
(343.70, 0.10),
(335.40, -1.20),
(335.00, 0.50),
(333.80, 0.60),
(333.50, 0.90),
(329.60, 0.90),
(328.60, 3.90),
(327.40, 4.00),
(327.40, 5.20),
(326.00, 7.20),
(322.60, 7.60),
(322.20, 8.10),
(320.80, 8.10),
(320.60, 8.70),
(319.80, 8.80),
(319.30, 9.50),
(319.10, 10.70),
(316.30, 10.80),
(316.30, 12.10),
(315.90, 12.10),
(315.90, 12.60),
(315.20, 12.60),
(315.20, 13.50),
(315.00, 13.70),
(315.00, 15.30),
(313.30, 15.40),
(313.40, 16.80),
(313.60, 18.50),
(313.90, 19.00),
(314.20, 19.80),
(314.30, 20.30),
(314.30, 20.30),
(299.00, 18.00),
(299.70, 17.40),
(300.20, 16.90),
(300.60, 16.30),
(300.70, 15.60),
(300.70, 14.90),
(300.60, 14.50),
(300.40, 14.10),
(300.30, 13.60),
(300.10, 13.10),
(298.30, 10.40),
(297.40, 10.40),
(296.00, 10.40),
(294.80, 10.40),
(293.40, 10.50),
(291.90, 10.40),
(290.70, 10.30),
(289.90, 9.90),
(289.30, 9.20),
(288.60, 8.40),
(288.00, 7.70),
(287.30, 7.00),
(286.50, 6.20),
(285.60, 5.50),
(284.60, 4.90),
(283.60, 4.30),
(282.50, 3.80),
(281.90, 3.60),
(281.70, 2.60),
(281.20, 2.20),
(280.90, 1.90),
(280.20, 1.00),
(279.70, 0.30),
(279.10, -1.20),
(279.00, -2.50),
(278.70, -4.10),
(278.70, -5.40),
(278.70, -6.50),
(279.00, -7.80),
(279.40, -9.40),
(279.90, -10.50),
(280.50, -11.70),
(281.30, -12.80),
(282.10, -13.90),
(283.20, -15.10),
(284.20, -15.90),
(285.00, -16.60),
(286.00, -17.40),
(286.90, -18.10),
(287.80, -19.50),
(288.40, -20.40),
(288.80, -21.20),
(289.20, -22.20),
(289.40, -23.40),
(289.20, -24.90),
(288.80, -26.60),
(288.40, -28.50),
(287.90, -30.20),
(287.40, -32.00),
(287.30, -33.70),
(286.90, -35.10),
(286.50, -36.40),
(285.70, -37.60),
(284.90, -38.90),
(284.40, -40.50),
(284.30, -41.80),
(284.10, -43.00),
(283.80, -43.90),
(283.80, -44.80),
(283.80, -45.30),
(283.80, -45.80),
(284.00, -46.90),
(284.10, -47.70),
(284.30, -48.80),
(284.60, -49.60),
(284.60, -50.70),
(284.70, -51.90),
(284.80, -53.00),
(285.70, -53.60),
(286.90, -54.40),
(288.00, -54.90),
(289.20, -55.40),
(291.00, -55.60),
(293.10, -55.60),
(294.30, -55.50),
(295.20, -55.60),
(296.60, -55.70),
(297.70, -55.80),
(299.90, -56.00),
(300.00, -56.00),
(302.50, -55.90),
(305.00, -55.70),
(307.50, -55.60),
(310.00, -55.50),
(311.80, -55.40),
(313.50, -55.20),
(315.30, -55.10),
(317.00, -55.00),
(317.80, -55.00),
(318.50, -54.90),
(319.30, -54.80),
(320.00, -54.80),
(322.50, -54.80),
(325.00, -54.80),
(327.50, -54.80),
(330.00, -54.80),
(330.70, -54.80),
(331.50, -54.90),
(333.00, -55.00),
(333.50, -55.20),
(334.00, -55.40),
(334.50, -55.50),
(335.00, -55.70),
(335.20, -55.80),
(335.50, -55.90),
(335.80, -56.00),
(336.00, -56.10),
(336.30, -56.60),
(336.60, -57.00),
(336.90, -57.50),
(337.20, -58.00),
(336.90, -58.40),
(336.60, -58.80),
(336.30, -59.20),
(336.00, -59.60),
(335.10, -60.70),
(334.40, -60.70),
(335.10, -60.80),
(335.60, -60.90),
(336.10, -61.00),
(336.70, -61.00),
(337.40, -61.00),
(338.10, -61.00),
(338.80, -61.00),
(339.50, -60.90),
(340.10, -60.90),
(340.60, -60.80),
(340.70, -60.50),
(341.00, -60.50),
(341.10, -60.20),
(341.50, -60.20),
(341.50, -59.60),
(342.00, -59.60),
(342.00, -59.10),
(343.80, -59.00),
(343.80, -58.30),
(353.00, -57.80),
(355.30, -55.80),
(358.40, -55.60),
(358.40, -55.30),
(358.60, -55.10),
(358.90, -54.80),
(359.30, -54.80),
])
SOAM_FALSE_EASTING = 0.0
def shift_lon(x, y):
if x < 0.0:
return (360.0 + x, y)
else:
return (x, y)
Plate = namedtuple('Plate', 'polygon, false_easting name')
PLATES = [
Plate(NOAM, NOAM_FALSE_EASTING, 'NOAM'),
Plate(EURA, EURA_FALSE_EASTING, 'EURA'),
Plate(ANTA, ANTA_FALSE_EASTING, 'ANTA'),
Plate(SOAM, SOAM_FALSE_EASTING, 'SOAM'),
Plate(PCFC, PCFC_FALSE_EASTING, 'PCFC'),
Plate(ARAB, ARAB_FALSE_EASTING, 'ARAB'),
Plate(AUST, AUST_FALSE_EASTING, 'AUST'),
Plate(INDI, INDI_FALSE_EASTING, 'INDI'),
Plate(NAZC, NAZC_FALSE_EASTING, 'NAZC'),
]
def plate_name(point):
"""Determine the Tectonic plate name based on the lon/lat of the given
point. The point's longitude (x) should be in the range [-180, 180],
and latitude (y) in the range [-90, 90].
"""
x, y = point.coords.xy
for polygon, fe, name in PLATES:
p = Point(*shift_lon(x[0] + fe, y[0]))
if polygon.intersects(p):
return name
import collections
import datetime as dt
import logging
import os
import time
import arrow
import pandas as pd
from pyproj import Transformer
from shapely.geometry.point import Point
from valkyrie.itrf.plate_boundaries import plate_name
DF_CHUNKSIZE = 250000
GranuleItrfRange = collections.namedtuple('GranuleItrfRange', 'start end itrf')
ATM1B_GRANULE_ITRFS = [
GranuleItrfRange(arrow.Arrow(1993, 6, 23), arrow.Arrow(1996, 6, 5), "ITRF93"),
GranuleItrfRange(arrow.Arrow(1997, 4, 25), arrow.Arrow(1997, 5, 28), "ITRF94"),
GranuleItrfRange(arrow.Arrow(1998, 6, 27), arrow.Arrow(1999, 5, 25), "ITRF96"),
GranuleItrfRange(arrow.Arrow(2000, 5, 12), arrow.Arrow(2001, 5, 27), "ITRF97"),
GranuleItrfRange(arrow.Arrow(2001, 12, 18), arrow.Arrow(2002, 11, 21), "ITRF2000"),
GranuleItrfRange(arrow.Arrow(2002, 11, 22), arrow.Arrow(2002, 11, 22), "ITRF97"),
GranuleItrfRange(arrow.Arrow(2002, 11, 23), arrow.Arrow(2002, 12, 13), "ITRF2000"),
GranuleItrfRange(arrow.Arrow(2002, 12, 14), arrow.Arrow(2002, 12, 14), "ITRF97"),
GranuleItrfRange(arrow.Arrow(2002, 12, 15), arrow.Arrow(2007, 5, 11), "ITRF2000"),
GranuleItrfRange(arrow.Arrow(2007, 9, 10), arrow.Arrow(2011, 5, 16), "ITRF2005"),
GranuleItrfRange(arrow.Arrow(2011, 10, 12), arrow.Arrow(2018, 5, 1), "ITRF2008"),
]
def convert_itrf(order_id, dataset_name, csv_filename, target_itrf=None, target_epoch=None):
target_csv_filename = csv_filename
root, ext = os.path.splitext(csv_filename)
src_csv_filename = f"{root}.src{ext}"
os.rename(csv_filename, src_csv_filename)
df_reader = _df_reader_from_csv(src_csv_filename, DF_CHUNKSIZE)
for chunk in df_reader:
chunk = _rename_columns(chunk)
if target_epoch is not None:
groups = _itrf_plate_groups(chunk)
else:
groups = _itrf_groups(chunk)
logging.info(f"Number of groups: {len(groups)}")
for grouping, part in groups:
if target_epoch is not None:
source_itrf, plate = grouping
logging.info(f"Converting part of size {len(part)} "
f"from {source_itrf} to {target_itrf} "
f"with plate name {plate} "
f"and epoch {target_epoch}")
lons, lats, elevs, _ = _convert_df(part, source_itrf, target_itrf, plate, target_epoch)
else:
source_itrf = grouping
logging.info(f"Converting part of size {len(part)} "
f"from {source_itrf} to {target_itrf}")
lons, lats, elevs, _ = _convert_df(part, source_itrf, target_itrf)
new_part = part.copy()
new_part["latitude"] = lats
new_part["longitude"] = lons
new_part["elevation"] = elevs
del new_part["itrf"]
if "plate" in new_part.columns:
del new_part["plate"]
new_part.to_csv(csv_filename, mode="a", header=False, index=False)
# Cleanup
# os.remove(src_csv_filename)
return target_csv_filename
def _df_reader_from_csv(csv_filepath, df_chunksize):
"""Copies data from the database to file, and returns a reader to a pandas
dataframe of the data.
"""
return pd.read_csv(
csv_filepath,
parse_dates=[0],
header=None,
chunksize=df_chunksize,
)
def _rename_columns(df):
"""Renames the first four columns to useful names since we only use
these and don't need the others to be named. This also allows us to
work with any of the data products since all have the same first four
columns."""
return df.rename(columns={
0: 'utc_datetime',
1: 'longitude',
2: 'latitude',
3: 'elevation'
})
def _itrf_plate_groups(chunk):
logging.info("Adding source ITRF")
chunk['itrf'] = chunk['utc_datetime'].apply(_granule_itrf)
logging.info("Adding source plate name")
chunk['plate'] = chunk[['longitude', 'latitude']].apply(lambda lonlat: plate_name(Point(*lonlat)), axis=1)
logging.info("Grouping by source ITRF and plate")
return chunk.groupby(['itrf', 'plate'], sort=False)
def _itrf_groups(chunk):
logging.info("Adding source ITRF")
chunk['itrf'] = chunk['utc_datetime'].apply(_granule_itrf)
logging.info("Grouping by source ITRF")
return chunk.groupby('itrf', sort=False)
def _granule_itrf(granule_datetime):
def _find(gdt, i, lower, upper):
# Binary search for the correct ITRF to make this fast. If we
# do a naive linear search, it can run up to 10x longer.
g = ATM1B_GRANULE_ITRFS[i]
if gdt < g.start:
if i > lower:
return _find(gdt, (i - lower) // 2, lower, i)
else:
return None
elif gdt <= g.end:
return g.itrf
else:
if i < (upper - 1):
return _find(gdt, (upper + i) // 2, i, upper)
else:
return None
gdt = arrow.get(granule_datetime)
lower, upper = (0, len(ATM1B_GRANULE_ITRFS))
i = (upper - lower) // 2
return _find(gdt, i, lower, upper)
def _convert_df(chunk, source_itrf, target_itrf, plate=None, target_epoch=None):
"""Converts a chunk of a dataframe from a source ITRF to a target ITRF"""
decimalyears = chunk.utc_datetime.apply(_datetime_to_decimal_year).to_numpy()
# TODO: Should we create a new decimalyears when doing an epoch
# propagation since PROJ doesn't do this?
return _transformer(source_itrf, target_itrf, plate, target_epoch).transform(
chunk.longitude.to_numpy(),
chunk.latitude.to_numpy(),
chunk.elevation.to_numpy(),
decimalyears,
)
def _datetime_to_decimal_year(date):
"""Stolen from
https://stackoverflow.com/questions/6451655/python-how-to-convert-datetime-dates-to-decimal-years
"""
def sinceEpoch(date):
# returns seconds since epoch
return time.mktime(date.timetuple())
s = sinceEpoch
year = date.year
startOfThisYear = dt.datetime(year=year, month=1, day=1)
startOfNextYear = dt.datetime(year=year + 1, month=1, day=1)
yearElapsed = s(date) - s(startOfThisYear)
yearDuration = s(startOfNextYear) - s(startOfThisYear)
fraction = yearElapsed / yearDuration
return date.year + fraction
def _transformer(source_itrf, target_itrf, plate=None, target_epoch=None):
"""Pipeline string for proj to transform from the source to the target
ITRF frame and, optionally, epoch.
"""
plate_model_step = ""
if plate and target_epoch:
plate_model_step = (
f"+step +inv +init={target_itrf}:{plate} +t_epoch={target_epoch} "
)
pipeline = (
f"+proj=pipeline +ellps=WGS84 "
f"+step +proj=unitconvert +xy_in=deg +xy_out=rad "
f"+step +proj=latlon "
f"+step +proj=cart "
f"+step +inv +init={target_itrf}:{source_itrf} "
f"{plate_model_step}"
f"+step +inv +proj=cart "
f"+step +proj=unitconvert +xy_in=rad +xy_out=deg"
)
return Transformer.from_pipeline(pipeline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment