Exemplo n.º 1
0
def test_1d_non_unit_spacing():
    spacing = _get_raster_spacing((np.arange(5.) * 2, ))
    assert_equal(spacing, 2.)
Exemplo n.º 2
0
def test_2d_non_unit_spacing():
    """Test _get_raster_spacing with a 2D grid with non-unit spacing."""
    (x, y) = np.meshgrid(np.arange(5.) * 2, np.arange(4.) * 2)

    spacing = _get_raster_spacing((y, x))
    assert_equal(spacing, 2.)
Exemplo n.º 3
0
def test_1d_non_unit_spacing():
    """Test _get_raster_spacing with a 1D grid with non-unit spacing."""
    spacing = _get_raster_spacing((np.arange(5.) * 2, ))
    assert_equal(spacing, 2.)
Exemplo n.º 4
0
def test_2d_switched_coords():
    (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

    spacing = _get_raster_spacing((x, y))
    assert_equal(spacing, 0.)
Exemplo n.º 5
0
def test_2d_unit_spacing():
    """Test write_netcdf with a 2D grid with unit spacing."""
    (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

    spacing = _get_raster_spacing((y, x))
    assert_equal(spacing, 1.)
Exemplo n.º 6
0
def test_2d_switched_coords():
    """Test _get_raster_spacing with a 2D grid when the spacing is switched."""
    (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

    spacing = _get_raster_spacing((x, y))
    assert_equal(spacing, 0.)
Exemplo n.º 7
0
 def test_non_unit_spacing(self):
     spacing = _get_raster_spacing((np.arange(5.) * 2, ))
     self.assertEqual(spacing, 2.)
Exemplo n.º 8
0
def test_2d_uneven_spacing_axis_1():
    """Test _get_raster_spacing with a 2D grid with uneven spacing in x."""
    (x, y) = np.meshgrid(np.arange(4.), np.logspace(0., 2., num=5))

    with pytest.raises(NotRasterGridError):
        _get_raster_spacing((y, x))
Exemplo n.º 9
0
    def test_non_unit_spacing(self):
        (x, y) = np.meshgrid(np.arange(5.) * 2, np.arange(4.) * 2)

        spacing = _get_raster_spacing((y, x))
        self.assertEqual(spacing, 2.)
Exemplo n.º 10
0
    def test_switched_coords(self):
        (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

        spacing = _get_raster_spacing((x, y))
        self.assertEqual(spacing, 0.)
Exemplo n.º 11
0
    def test_switched_coords(self):
        (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

        spacing = _get_raster_spacing((x, y))
        self.assertEqual(spacing, 0.)
Exemplo n.º 12
0
    def test_uneven_spacing_axis_1(self):
        (x, y) = np.meshgrid(np.arange(4.), np.logspace(0., 2., num=5))

        with self.assertRaises(NotRasterGridError):
            spacing = _get_raster_spacing((y, x))
Exemplo n.º 13
0
    def test_non_unit_spacing(self):
        (x, y) = np.meshgrid(np.arange(5.) * 2, np.arange(4.) * 2)

        spacing = _get_raster_spacing((y, x))
        self.assertEqual(spacing, 2.)
Exemplo n.º 14
0
def test_1d_unit_spacing():
    """Test _get_raster_spacing with a 1D grid with unit spacing."""
    spacing = _get_raster_spacing((np.arange(5.), ))
    assert_equal(spacing, 1.)
Exemplo n.º 15
0
    def test_uneven_spacing(self):
        (x, y) = np.meshgrid(np.logspace(0., 2., num=5), np.arange(4.))

        with self.assertRaises(NotRasterGridError):
            spacing = _get_raster_spacing((np.logspace(0., 2., num=5), ))
Exemplo n.º 16
0
 def test_non_unit_spacing(self):
     spacing = _get_raster_spacing((np.arange(5.) * 2, ))
     self.assertEqual(spacing, 2.)
Exemplo n.º 17
0
def test_2d_unit_spacing():
    (x, y) = np.meshgrid(np.arange(5.0), np.arange(4.0))

    spacing = _get_raster_spacing((y, x))
    assert_equal(spacing, 1.0)
Exemplo n.º 18
0
def test_1d_uneven_spacing():
    """Test _get_raster_spacing with a 1D grid with uneven spacing in y."""
    with pytest.raises(NotRasterGridError):
        _get_raster_spacing((np.logspace(0., 2., num=5), ))
Exemplo n.º 19
0
def test_2d_uneven_spacing_axis_1():
    """Test _get_raster_spacing with a 2D grid with uneven spacing in x."""
    (x, y) = np.meshgrid(np.arange(4.), np.logspace(0., 2., num=5))

    with pytest.raises(NotRasterGridError):
        _get_raster_spacing((y, x))
Exemplo n.º 20
0
def test_2d_non_unit_spacing():
    """Test _get_raster_spacing with a 2D grid with non-unit spacing."""
    (x, y) = np.meshgrid(np.arange(5.) * 2, np.arange(4.) * 2)

    spacing = _get_raster_spacing((y, x))
    assert_equal(spacing, 2.)
Exemplo n.º 21
0
def test_1d_uneven_spacing():
    """Test _get_raster_spacing with a 1D grid with uneven spacing in y."""
    with pytest.raises(NotRasterGridError):
        _get_raster_spacing((np.logspace(0., 2., num=5),))
Exemplo n.º 22
0
def test_1d_unit_spacing():
    """Test _get_raster_spacing with a 1D grid with unit spacing."""
    spacing = _get_raster_spacing((np.arange(5.), ))
    assert_equal(spacing, 1.)
Exemplo n.º 23
0
def test_1d_unit_spacing():
    """Test _get_raster_spacing with a 1D grid with unit spacing."""
    spacing = _get_raster_spacing((np.arange(5.0), ))
    assert spacing == 1.0
Exemplo n.º 24
0
def test_2d_non_unit_spacing():
    (x, y) = np.meshgrid(np.arange(5.) * 2, np.arange(4.) * 2)

    spacing = _get_raster_spacing((y, x))
    assert_equal(spacing, 2.)
Exemplo n.º 25
0
def test_2d_non_unit_spacing():
    (x, y) = np.meshgrid(np.arange(5.) * 2, np.arange(4.) * 2)

    spacing = _get_raster_spacing((y, x))
    assert_equal(spacing, 2.)
Exemplo n.º 26
0
def test_1d__unit_spacing():
    spacing = _get_raster_spacing((np.arange(5.), ))
    assert_equal(spacing, 1.)
Exemplo n.º 27
0
def test_2d_switched_coords():
    (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

    spacing = _get_raster_spacing((x, y))
    assert_equal(spacing, 0.)
Exemplo n.º 28
0
def test_2d_unit_spacing():
    """Test write_netcdf with a 2D grid with unit spacing."""
    (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

    spacing = _get_raster_spacing((y, x))
    assert_equal(spacing, 1.)
Exemplo n.º 29
0
def test_1d__unit_spacing():
    spacing = _get_raster_spacing((np.arange(5.), ))
    assert_equal(spacing, 1.)
Exemplo n.º 30
0
def test_2d_switched_coords():
    """Test _get_raster_spacing with a 2D grid when the spacing is switched."""
    (x, y) = np.meshgrid(np.arange(5.), np.arange(4.))

    spacing = _get_raster_spacing((x, y))
    assert_equal(spacing, 0.)
Exemplo n.º 31
0
def test_1d_non_unit_spacing():
    spacing = _get_raster_spacing((np.arange(5.) * 2, ))
    assert_equal(spacing, 2.)
Exemplo n.º 32
0
def test_1d_non_unit_spacing():
    """Test _get_raster_spacing with a 1D grid with non-unit spacing."""
    spacing = _get_raster_spacing((np.arange(5.) * 2, ))
    assert_equal(spacing, 2.)
Exemplo n.º 33
0
def test_1d_unit_spacing():
    """Test _get_raster_spacing with a 1D grid with unit spacing."""
    spacing = _get_raster_spacing((np.arange(5.0),))
    assert spacing == 1.0