semantique.processor.arrays.Array.write_crs

semantique.processor.arrays.Array.write_crs#

Array.write_crs(crs, inplace=False)[source]#

Store the CRS of the array as non-dimension coordinate.

The coordinate reference system of the spatial coordinates is stored as attribute of a specific non-dimension coordinate named “spatial_ref”. Storing this inside a non-dimension coordinate rather than as direct attribute of the array guarantees that this information is preserved during any kind of operation. The coordinate itself serves merely as a placeholder.

Parameters:
  • crs – The spatial coordinate reference system to store. Can be given as any object understood by the initializer of pyproj.crs.CRS. This includes pyproj.crs.CRS objects themselves, as well as EPSG codes and WKT strings.

  • inplace (bool) – Should the array be modified inplace?

Returns:

xarray.DataArray – The input array with the CRS stored in a non-dimension coordinate.