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.
- sentinelhub.io_utils.read_jp2_image(filename)[source]
Read data from JPEG2000 file
- Parameters
filename (str) – name of JPEG2000 file to be read
- Returns
data stored in JPEG2000 file
- Return type
ndarray
- sentinelhub.io_utils.read_image(filename)[source]
Read data from PNG or JPG file
- Parameters
filename (str) – name of PNG or JPG file to be read
- Returns
data stored in JPG file
- Return type
ndarray
- sentinelhub.io_utils.read_xml(filename)[source]
Read data from XML or GML file
- Parameters
filename (str) – name of XML or GML file to be read
- Returns
data stored in XML file
- Return type
- sentinelhub.io_utils.read_numpy(filename)[source]
Read data from numpy file
- Parameters
filename (str) – name of numpy file to be read
- Returns
data stored in file as numpy array
- Return type
ndarray
- 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 (Optional[MimeType]) – format of output file. Default is None
compress (bool) – whether to compress data or not. Default is False
add (bool) – whether to append to existing text file or not. Default is False
- Raises
exception if numpy format is not supported or file cannot be written
- Return type
None
- sentinelhub.io_utils.write_tiff_image(filename, image, compress=False)[source]
Write image data to TIFF file
- sentinelhub.io_utils.write_jp2_image(filename, image)[source]
Write image data to JPEG2000 file
- Parameters
filename (str) – name of JPEG2000 file to write data to
image (ndarray) – image data to write to file
- Return type
None
- sentinelhub.io_utils.write_image(filename, image)[source]
Write image data to PNG, JPG file
- Parameters
filename (str) – name of PNG or JPG file to write data to
image (ndarray) – image data to write to file
- Return type
None
- sentinelhub.io_utils.write_xml(filename, element_tree)[source]
Write data to XML or GML file
- Parameters
filename (str) – name of XML or GML file to write data to
element_tree (ElementTree) – data as ElementTree object
- Return type
None