xrspatial.validate.validate#
- xrspatial.validate.validate(agg) ValidationReport[source]#
Check a DataArray against the xarray-spatial input contract.
- Parameters:
agg (xarray.DataArray) – Raster to check.
- Returns:
Lists every contract violation as an error (a spatial op will fail) or a warning (behavior degrades), each with a suggested fix. The report is truthy when there are no error-level issues.
- Return type:
ValidationReport
Examples
>>> import numpy as np, xarray as xr >>> import xrspatial # registers the .xrs accessor >>> bad = xr.DataArray( ... np.array([["a", "b"], ["c", "d"]]), dims=["y", "x"] ... ) >>> report = bad.xrs.validate() >>> bool(report) False