def test_shape_respect(self): """Check that LambertProjection.project() respects navigation axes""" sx = 60 a = np.arange(1, sx**2 + 1).reshape((sx, sx)) v = Vector3d(np.dstack([a, a, a])) assert v.shape == (sx, sx) assert v.data.shape == (sx, sx, 3) # Forward xy_lambert = LambertProjection.vector2xy(v) assert xy_lambert.shape == (sx, sx, 2) # and back xyz_frm_lambert = LambertProjection.xy2vector(xy_lambert) assert xyz_frm_lambert.shape == v.shape assert xyz_frm_lambert.data.shape == v.data.shape
def test_xy2vector(self): """Conversion from Lambert to Cartesian coordinates works""" lambert_xy = np.array([0.81480, 0.81480]) v = LambertProjection.xy2vector(lambert_xy) assert np.allclose(v.data, 0.578, atol=1e-3)