revrt.utilities.base.load_data_using_layer_file_profile#

load_data_using_layer_file_profile(layer_fp, geotiff, tiff_chunks='file', layer_dirs=None, band_index=None, check_tiff=True, fillna=0)[source]#

Load GeoTIFF data, reprojecting to LayeredFile CRS if needed

Parameters:
  • layer_fp (path-like) – Path to layered file on disk. This file must already exist.

  • geotiff (path-like) – Path to GeoTIFF from which data should be read.

  • tiff_chunks (int or str, default "file") – Chunk size to use when reading the GeoTIFF file. This will be passed down as the chunks argument to rioxarray.open_rasterio(). By default, "file".

  • layer_dirs (Iterable of path-like, optional) – Directories to search for geotiff in, if not found in current directory. By default, None, which means only the current directory is searched.

  • check_tiff (bool, default True) – Whether to check that the GeoTIFF profile matches the template defined by the layered file. If True, the GeoTIFF profile is compared to the template, and if they don’t match, the GeoTIFF is re-projected to match the template. If False, no checks are performed and the GeoTIFF is loaded as-is. By default, True.

  • band_index (int, optional) – Optional index of band to load from the GeoTIFF. If provided, only that band will be returned. By default, None, which means all bands will be returned.

  • fillna (int or float, optional) – Value to fill NA cells with after loading the GeoTIFF. If None, NA cells will not be filled (and will typically be represented as np.nan in the output array). By default, 0.

Returns:

array-like – Raster data.

Raises:

revrtFileNotFoundError – If geotiff cannot be found in either the current directory or the layer_dir directory.