Gdal Store for reading GeoTIFF files into an xarray.Dataset

This module contains the definition of the GdalStore class that can be used to read in a GeoTIFF file into an xarray.Dataset. It requires that you have the python gdal module installed.


to open a GeoTIFF file named 'my_tiff.tiff' you can do:

>>> from psyplot.gdal_store import GdalStore
>>> from xarray import open_dataset
>>> ds = open_dataset(GdalStore("my_tiff"))

Or you use the engine of the psyplot.open_dataset() function:

>>> ds = open_dataset("my_tiff.tiff", engine="gdal")



Datastore to read raster files suitable for the gdal package

class psyplot.gdal_store.GdalStore(filename_or_obj)[source]

Bases: AbstractDataStore

Datastore to read raster files suitable for the gdal package

We recommend to use the psyplot.open_dataset() function to open a geotiff file:

>>> ds = psyplot.open_dataset("my_geotiff.tiff", engine="gdal")


The GdalStore object is not as elaborate as, for example, the gdal_translate command. Many attributes, e.g. variable names or netCDF dimensions will not be interpreted. We only support two dimensional arrays and each band is saved into one variable named like 'Band1', 'Band2', .... If you want a more elaborate translation of your GDAL Raster, convert the file to a netCDF file using gdal_translate or the gdal.GetDriverByName('netCDF').CreateCopy method. However this class does not create an extra file on your hard disk as it is done by GDAL.


filename_or_obj (str) – The path to the GeoTIFF file or a gdal dataset