Skip to content
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.10
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
3 changes: 2 additions & 1 deletion rioxarray/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from packaging import version
from rasterio.errors import NotGeoreferencedWarning
from rasterio.vrt import WarpedVRT
from xarray import Dataset, IndexVariable
from xarray import Coordinates, Dataset, IndexVariable
from xarray.backends.common import BackendArray
from xarray.backends.file_manager import CachingFileManager, FileManager
from xarray.backends.locks import SerializableLock
Expand Down Expand Up @@ -1212,6 +1212,7 @@ def open_rasterio(

# Get geospatial coordinates
if parse_coordinates:
coords = Coordinates(coords)
coords.update(
_generate_spatial_coords(
affine=riods.transform, width=riods.width, height=riods.height
Expand Down
10 changes: 10 additions & 0 deletions rioxarray/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@

EXPORT_GRID_MAPPING = "export_grid_mapping"
SKIP_MISSING_SPATIAL_DIMS = "skip_missing_spatial_dims"
USE_RASTER_INDEX = "use_raster_index"

OPTIONS = {
EXPORT_GRID_MAPPING: True,
SKIP_MISSING_SPATIAL_DIMS: False,
USE_RASTER_INDEX: False,
}
OPTION_NAMES = set(OPTIONS)

VALIDATORS = {
EXPORT_GRID_MAPPING: lambda choice: isinstance(choice, bool),
USE_RASTER_INDEX: lambda choice: isinstance(choice, bool),
}


Expand Down Expand Up @@ -60,6 +63,13 @@ class set_options: # pylint: disable=invalid-name
If True, it will not perform spatial operations on variables
within a :class:`xarray.Dataset` if the spatial dimensions
are not found.
use_raster_index: bool, default=False
If True, this option will generate (lazy) spatial coordinates wrapping the
affine :meth:`~rioxarray.rioxarray.XRasterBase.transform` and will associate
them with a custom ``RasterIndex`` Xarray index.
Otherwise this will generate spatial coordinates using explicit values
computed by forward transformation and will associate each of the 1-dimensional
spatial coordinates with a default (pandas) index.


Usage as a context manager::
Expand Down
Loading