sertit.rasters_rio.get_dim_img_path

get_dim_img_path(dim_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], img_name: str = '*') Union[cloudpathlib.cloudpath.CloudPath, pathlib.Path][source]

Get the image path from a BEAM-DIMAP data.

A BEAM-DIMAP file cannot be opened by rasterio, although its .img file can.

>>> dim_path = "path\to\dimap.dim"  # BEAM-DIMAP image
>>> img_path = get_dim_img_path(dim_path)

>>> # Read raster
>>> raster, meta = read(img_path)
Parameters
  • dim_path (Union[str, CloudPath, Path]) – DIM path (.dim or .data)

  • img_name (str) – .img file name (or regex), in case there are multiple .img files (ie. for S3 data)

Returns

.img file

Return type

Union[CloudPath, Path]