sentinelhub.io_utils
Utility functions to read/write image data from/to file
- sentinelhub.io_utils.read_data(filename, data_format=None)[source]
Read image data from file
This function reads input data from file. The format of the file can be specified in
data_format
. If not specified, the format is guessed from the extension of the filename.- Parameters:
filename (str) – filename to read data from
data_format (MimeType | None) – format of filename. Default is None
- Returns:
data read from filename
- Raises:
exception if filename does not exist
- Return type:
Any
- sentinelhub.io_utils.write_data(filename, data, data_format=None, compress=False, add=False)[source]
Write image data to file
Function to write image data to specified file. If file format is not provided explicitly, it is guessed from the filename extension. If format is TIFF, geo information and compression can be optionally added.
- Parameters:
filename (str) – name of file to write data to
data (Any) – image data to write to file
data_format (MimeType | None) – format of output file. Default is None
compress (bool) – Compress data. Default is False
add (bool) – Append to existing file. Only supported for TXT. Default is False
- Raises:
exception if numpy format is not supported or file cannot be written
- Return type:
None