compare#

geobricks.compare(data1, data2, *, mode='absolute difference', reprojection='finest', crs1=None, crs2=None)[source]#

Compare two spatio-temporal maps by returning a spatio-temporal map of the difference (absolute or relative, via mode argument). The 2 input maps can be heterogeneous (different space and time extents and resolutions, different variable names).

If the 2 input maps have different resolutions (and CRS), the finest, coarsest, last or first resolution will be used, depending on reprojection argument.

If both data have a time axis, the time intersection is kept. If one data is not tepmporal, its values are broadcasted against the time axis of the other data.

Parameters#

data1path (str or pathlib.Path), or variable (xarray.Dataset or xarray.DataArray)

First dataset, that will be the reference to which data2 will be compared.

data2path (str or pathlib.Path), or variable (xarray.Dataset, xarray.DataArray)

Second dataset, that will be compared to data1.

mode{‘difference’ (or ‘absolute difference’ or ‘absdif’), ‘relative difference’ (or ‘reldif’) or ‘ratio’}, default ‘difference’

Method of comparison:

  • ‘absolute difference’: data2 - data1

  • ‘relative difference’: (data2 - data1) / data1

reprojection{‘finest’ (or ‘downscale’), ‘coarsest’ (or ‘upscale’), ‘last’, or ‘first’}, default ‘finest’

If the two datasets have different resolutions, reprojection defines how they will be reprojected.

crs1int or str or rasterio.crs.CRS, optional

Coordinate reference system of the first dataset (data1), that will be embedded in the data1. When passed as an integer, crs1 refers to the EPSG code. When passed as a string, crs1 can be OGC WKT string or Proj.4 string.

crs2int or str or rasterio.crs.CRS, optional

Coordinate reference system of the second dataset (data2), that will be embedded in the data2. When passed as an integer, crs2 refers to the EPSG code. When passed as a string, crs2 can be OGC WKT string or Proj.4 string.

Returns#

xarray.Dataset