def test_equal_datasets(): ds0 = open_dataset(slc_files[0]) for f in slc_files[1:]: ds = open_dataset(f) assert_equal(ds0['x'].values, ds['x'].values, 'x coordinates are not equal') assert_equal(ds0['y'].values, ds['y'].values, 'y coordinates are not equal') assert_equal(get_transform(ds0), get_transform(ds), 'transforms are not equal') assert_equal_crs(get_crs(ds0), get_crs(ds), 'CRS are not equal') assert_equal(get_resolution(ds0), get_resolution(ds), 'resolutions are not equal') assert_equal(get_bounds(ds0), get_bounds(ds), 'bounds are not equal') assert_equal(get_extent(ds0), get_extent(ds), 'extents are not equal') ds.close() ds0.close()
def test_reprojection_failure(): ds = generate_test_dataset() transform = get_transform(ds) extent = get_extent(ds) with assert_raises_regex( ValueError, ".* must also specify the `width` and `height`.*"): proj = Reprojection(crs=epsg4326, transform=transform) with assert_raises_regex(ValueError, "Need to provide either `width` and `height` .*"): proj = Reprojection(crs=epsg4326, extent=extent)
def test_get_extent_dataarray(): extent = (-10.0, 50.0, 0.0, 60.0) da = generate_test_dataarray(extent=extent, crs=epsg4326) assert_equal(extent, get_extent(da))
def test_get_extent_dataset(): extent = (-10.0, 50.0, 0.0, 60.0) ds = generate_test_dataset(extent=extent, crs=epsg4326) assert_equal(extent, get_extent(ds))