assert_raster_almost_equal#
- assert_raster_almost_equal(path_1: str | CloudPath | Path, path_2: str | CloudPath | Path, decimal=7) None [source]#
Assert that two rasters are almost equal. (everything is equal except the transform and the arrays that are almost equal)
Accepts an offset of
1E{decimal}
on the array and a precision of 10^-{decimal} on the transformUseful for pytests.
- Parameters:
path_1 (AnyPathStrType) – Raster 1
path_2 (AnyPathStrType) – Raster 2
decimal (int) – Number of decimal
Example
>>> path = r"CI/DATA/rasters/raster.tif" >>> path2 = r"CI/DATA/rasters/raster_almost.tif" >>> assert_raster_almost_equal(path, path2) >>> # Raises AssertionError if sth goes wrong