Esempio n. 1
0
 def test_latlong_dateline1(self):
     from pyresample.ewa import _ll2cr
     lon_arr = create_test_longitude(165.0,
                                     -165.0, (50, 100),
                                     twist_factor=0.6,
                                     dtype=np.float64)
     lat_arr = create_test_latitude(15.0,
                                    30.0, (50, 100),
                                    twist_factor=-0.1,
                                    dtype=np.float64)
     grid_info = dynamic_wgs84.copy()
     fill_in = np.nan
     proj_str = grid_info["proj4_definition"]
     cw = grid_info["cell_width"]
     ch = grid_info["cell_height"]
     ox = grid_info["origin_x"]
     oy = grid_info["origin_y"]
     w = grid_info["width"]
     h = grid_info["height"]
     points_in_grid, lon_res, lat_res, ox, oy, w, h = _ll2cr.ll2cr_dynamic(
         lon_arr, lat_arr, fill_in, proj_str, cw, ch, w, h, ox, oy)
     self.assertEqual(points_in_grid, lon_arr.size,
                      "all points should be contained in a dynamic grid")
     self.assertIs(lon_arr, lon_res)
     self.assertIs(lat_arr, lat_res)
     self.assertEqual(
         lon_arr[0, 0], 0,
         "ll2cr returned the wrong result for a dynamic latlong grid")
     self.assertEqual(
         lat_arr[-1, 0], 0,
         "ll2cr returned the wrong result for a dynamic latlong grid")
     self.assertTrue(
         np.all(np.diff(lon_arr[0]) >= 0),
         "ll2cr didn't return monotonic columns over the dateline")
Esempio n. 2
0
 def test_latlong_basic1(self):
     from pyresample.ewa import _ll2cr
     lon_arr = create_test_longitude(-95.0,
                                     -75.0, (50, 100),
                                     dtype=np.float64)
     lat_arr = create_test_latitude(15.0, 30.0, (50, 100), dtype=np.float64)
     grid_info = dynamic_wgs84.copy()
     fill_in = np.nan
     proj_str = grid_info["proj4_definition"]
     cw = grid_info["cell_width"]
     ch = grid_info["cell_height"]
     ox = grid_info["origin_x"]
     oy = grid_info["origin_y"]
     w = grid_info["width"]
     h = grid_info["height"]
     points_in_grid, lon_res, lat_res, ox, oy, w, h = _ll2cr.ll2cr_dynamic(
         lon_arr, lat_arr, fill_in, proj_str, cw, ch, w, h, ox, oy)
     self.assertEqual(points_in_grid, lon_arr.size,
                      "all points should be contained in a dynamic grid")
     self.assertIs(lon_arr, lon_res)
     self.assertIs(lat_arr, lat_res)
     self.assertEqual(
         lon_arr[0, 0], 0,
         "ll2cr returned the wrong result for a dynamic latlong grid")
     self.assertEqual(
         lat_arr[-1, 0], 0,
         "ll2cr returned the wrong result for a dynamic latlong grid")
Esempio n. 3
0
 def test_latlong_basic2(self):
     from pyresample.ewa import _ll2cr
     lon_arr = create_test_longitude(-95.0, -75.0, (50, 100), twist_factor=0.6, dtype=np.float64)
     lat_arr = create_test_latitude(15.0, 30.0, (50, 100), twist_factor=-0.1, dtype=np.float64)
     grid_info = dynamic_wgs84.copy()
     fill_in = np.nan
     proj_str = grid_info["proj4_definition"]
     cw = grid_info["cell_width"]
     ch = grid_info["cell_height"]
     ox = grid_info["origin_x"]
     oy = grid_info["origin_y"]
     w = grid_info["width"]
     h = grid_info["height"]
     points_in_grid, lon_res, lat_res, ox, oy, w, h = _ll2cr.ll2cr_dynamic(lon_arr, lat_arr, fill_in, proj_str,
                                                                           cw, ch, w, h, ox, oy)
     self.assertEqual(points_in_grid, lon_arr.size, "all points should be contained in a dynamic grid")
     self.assertIs(lon_arr, lon_res)
     self.assertIs(lat_arr, lat_res)
     self.assertEqual(lon_arr[0, 0], 0, "ll2cr returned the wrong result for a dynamic latlong grid")
     self.assertEqual(lat_arr[-1, 0], 0, "ll2cr returned the wrong result for a dynamic latlong grid")