xarray.open_rasterio

xarray.open_rasterio(filename, chunks=None, cache=None, lock=None)

Open a file with rasterio (experimental).

This should work with any file that rasterio can open (most often: geoTIFF). The x and y coordinates are generated automatically from the file’s geoinformation, shifted to the center of each pixel (see “PixelIsArea” Raster Space for more information).

Parameters:

filename : str

Path to the file to open.

Returns:

data : DataArray

The newly created DataArray.

chunks : int, tuple or dict, optional

Chunk sizes along each dimension, e.g., 5, (5, 5) or {'x': 5, 'y': 5}. If chunks is provided, it used to load the new DataArray into a dask array.

cache : bool, optional

If True, cache data loaded from the underlying datastore in memory as NumPy arrays when accessed to avoid reading from the underlying data- store multiple times. Defaults to True unless you specify the chunks argument to use dask, in which case it defaults to False.

lock : False, True or threading.Lock, optional

If chunks is provided, this argument is passed on to dask.array.from_array(). By default, a global lock is used to avoid issues with concurrent access to the same file when using dask’s multithreaded backend.