compare#
- geobricks.compare(data1, data2, *, mode='absolute difference', reprojection='finest', force_time=False, crs1=None, crs2=None)[source]#
Compare two spatio-temporal maps by returning a spatio-temporal map of the difference data2 - data1 (absolute or relative, via
modeargument). 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
reprojectionargument.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 compared to
data2.- data2path (str or pathlib.Path), or variable (xarray.Dataset, xarray.DataArray)
Second dataset, that will be the reference to which
data1will be compared.- 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,
reprojectiondefines how they will be reprojected.- force_timebool, optional, default False
If True, the two datasets will be compared even if the dates do not match (the first time of
data1will be compared to the first time ofdata1and so on).- crs1int or str or rasterio.crs.CRS, optional
Coordinate reference system of the first dataset (
data1), that will be embedded in thedata1. When passed as an integer,crs1refers to the EPSG code. When passed as a string,crs1can 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 thedata2. When passed as an integer,crs2refers to the EPSG code. When passed as a string,crs2can be OGC WKT string or Proj.4 string.
Returns#
xarray.Dataset