BaseWriter.can_write

BaseWriter.can_write#

BaseWriter.can_write(obj: Any) → WriteCapability[source]#

Report whether this writer can express obj.

The default accepts any Dataset or DataTree, which is correct for general-purpose formats: anything expressible in xarray is expressible in netCDF or Zarr. Format-specific writers should override this and explain what is missing - a Sentinel-2 SAFE writer needs an S2-shaped dataset, and saying so is more useful than emitting a broken product.

Parameters:

obj – Candidate object.

Returns:

Capability, with a reason when the answer is no.