def _rotate_gradient(cls, vectors, coords): if cls.target_coordinate_system == GEOCENTRIC_SPHERICAL: return vectors elif cls.target_coordinate_system == GEOCENTRIC_CARTESIAN: latd = coords[..., 0] lond = coords[..., 1] return vrot_sph2cart(vectors, latd, lond) elif cls.target_coordinate_system == GEODETIC_ABOVE_WGS84: dlatd = convert(coords, GEOCENTRIC_SPHERICAL, cls.target_coordinate_system)[..., 0] - coords[..., 0] return vrot_sph2geod(vectors, dlatd)
def test_vrot_sanity_check(self): vectors = array([ (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0), ]) expected_result = array([ (0.0, 0.0, 1.0), (0.0, 1.0, 0.0), (-1.0, 0.0, 0.0), ]) assert_allclose(vrot_sph2geod(vectors, 90), expected_result, atol=1e-14)
def eval_vrot(cls, vectors, coords): dlat_g2s = cls.difflat_geodetic_to_spherical(coords[..., 0]) return vrot_sph2geod(vectors, dlat_g2s)