def test_secant_latitudes(self): lat_1, lat_2 = 40, 41 lcc = LambertConformal(secant_latitudes=(lat_1, lat_2)) ccrs = lcc.as_cartopy_crs() self.assertEqual(lat_1, ccrs.proj4_params['lat_1']) self.assertEqual(lat_2, ccrs.proj4_params['lat_2'])
def test_fail_secant_latitudes_excessive(self): emsg = 'one or two secant latitudes required' with self.assertRaisesRegexp(ValueError, emsg): LambertConformal(secant_latitudes=(1, 2, 3))
def test_secant_latitudes_single_value(self): lat_1 = 40 lcc = LambertConformal(secant_latitudes=lat_1) ccrs = lcc.as_cartopy_crs() self.assertEqual(lat_1, ccrs.proj4_params['lat_1']) self.assertNotIn('lat_2', ccrs.proj4_params)
def test_fail_secant_latitudes_none(self): emsg = "one or two secant latitudes required" with self.assertRaisesRegex(ValueError, emsg): LambertConformal(secant_latitudes=())
def test_south_cutoff(self): lcc = LambertConformal(0, 0, secant_latitudes=(-30, -60)) ccrs = lcc.as_cartopy_crs() self.assertEqual(ccrs.cutoff, 30)
def _default_coord_system(self): return LambertConformal(central_lat=39.0, central_lon=-96.0, false_easting=0.0, false_northing=0.0, secant_latitudes=(33, 45), ellipsoid=self.default_ellipsoid)
def test_fail_secant_latitudes_excessive(self): emsg = "secant latitudes" with self.assertRaisesRegex(ValueError, emsg): LambertConformal(secant_latitudes=(1, 2, 3))
def test_no_optional_args(self): # Check expected defaults with no optional args. crs = LambertConformal() self._check_crs_defaults(crs)
def test_set_one_parallel(self): # Check that setting the optional (non-ellipse) args works. # (Except secant_latitudes, which are done separately). crs = LambertConformal(secant_latitudes=-44) self.assertEqual(len(crs.secant_latitudes), 1) self.assertEqualAndKind(crs.secant_latitudes[0], -44.0)