def get_geod(self) -> Optional[Geod]: """ Returns ------- pyproj.geod.Geod: Geod object based on the ellipsoid. """ if self.ellipsoid is None: return None return Geod( a=self.ellipsoid.semi_major_metre, rf=self.ellipsoid.inverse_flattening, b=self.ellipsoid.semi_minor_metre, )
def get_geod(self): """ Returns ------- pyproj.geod.Geod: Geod object based on the ellipsoid. """ if self.ellipsoid is None: return None in_kwargs = { "a": self.ellipsoid.semi_major_metre, "rf": self.ellipsoid.inverse_flattening, "b": self.ellipsoid.semi_minor_metre, } return Geod(**in_kwargs)
def get_geod(self): """ Returns ------- pyproj.geod.Geod: Geod object based on the ellipsoid. """ if self.ellipsoid is None or not self.ellipsoid.ellipsoid_loaded: return None in_kwargs = { "a": self.ellipsoid.semi_major_metre, "rf": self.ellipsoid.inverse_flattening, } if self.ellipsoid.is_semi_minor_computed: in_kwargs["b"] = self.ellipsoid.semi_minor_metre return Geod(**in_kwargs)
def test_calc_heading_distance_accurate(): # just a thin wrapper around pyproj import dask.array.core import dask.array from fcitools.geo import calc_heading_distance_accurate from pyproj.geod import Geod import numpy as np lat1 = np.array([[1, 2], [3, 4]]) lon1 = np.array([[1, 2], [3, 4]]) dlat1 = dask.array.from_array(lat1) dlon1 = dask.array.from_array(lon1) lat2 = lat1 + 0.5 lon2 = lon1 + 0.5 dlat2 = dlat1 + 0.5 dlon2 = dlon1 + 0.5 (hr, _, dr) = Geod(ellps="WGS84").inv(lon1, lat1, lon2, lat2) (hhn, dhn) = calc_heading_distance_accurate(lon1, lat1, lon2, lat2) (hhd, dhd) = calc_heading_distance_accurate(dlon1, dlat1, dlon2, dlat2) assert isinstance(hhd, dask.array.core.Array) np.testing.assert_allclose(hhn, hr) np.testing.assert_allclose(dhn, dr) np.testing.assert_allclose(hhd, hr) np.testing.assert_allclose(dhd, dr)