pystac.extensions.file#
Implements the File Info Extension.
- class pystac.extensions.file.ByteOrder(value)[source]#
List of allows values for the
"file:byte_order"
field defined by the File Info Extension.- BIG_ENDIAN = 'big-endian'#
- LITTLE_ENDIAN = 'little-endian'#
- class pystac.extensions.file.FileExtension(asset: Asset)[source]#
A class that can be used to extend the properties of an
Asset
with properties from the File Info Extension.To create an instance of
FileExtension
, use theFileExtension.ext()
method. For example:>>> asset: pystac.Asset = ... >>> file_ext = FileExtension.ext(asset)
- additional_read_properties: Iterable[Dict[str, Any]] | None = None#
If present, this will be a list containing 1 dictionary representing the properties of the owning
Item
.
- apply(byte_order: ByteOrder | None = None, checksum: str | None = None, header_size: int | None = None, size: int | None = None, values: List[MappingObject] | None = None) None [source]#
Applies file extension properties to the extended Item.
- Parameters:
byte_order – Optional byte order of integer values in the file. One of
"big-endian"
or"little-endian"
.checksum – Optional multihash for the corresponding file, encoded as hexadecimal (base 16) string with lowercase letters.
header_size – Optional header size of the file, in bytes.
size – Optional size of the file, in bytes.
values – Optional list of
MappingObject
instances that lists the values that are in the file and describe their meaning. See the Mapping Object docs for an example. If given, at least one array element is required.
- property byte_order: ByteOrder | None#
Gets or sets the byte order of integer values in the file. One of big-endian or little-endian.
- property checksum: str | None#
Get or sets the multihash for the corresponding file, encoded as hexadecimal (base 16) string with lowercase letters.
- classmethod ext(obj: Asset, add_if_missing: bool = False) FileExtension [source]#
Extends the given STAC Object with properties from the File Info Extension.
This extension can be applied to instances of
Asset
.
- property values: List[MappingObject] | None#
Get or sets the list of
MappingObject
instances that lists the values that are in the file and describe their meaning. See the Mapping Object docs for an example. If given, at least one array element is required.
- class pystac.extensions.file.FileExtensionHooks[source]#
- migrate(obj: Dict[str, Any], version: STACVersionID, info: STACJSONDescription) None [source]#
Migrate a STAC Object in dict format from a previous version. The base implementation will update the stac_extensions to the latest schema ID. This method will only be called for STAC objects that have been identified as a previous version of STAC. Implementations should directly manipulate the obj dict. Remember to call super() in order to change out the old ‘stac_extension’ entry with the latest schema URI.
- prev_extension_ids = {'file'}#
- stac_object_types = {STACObjectType.ITEM}#
- class pystac.extensions.file.MappingObject(properties: Dict[str, Any])[source]#
Represents a value map used by assets that are used as classification layers, and give details about the values in the asset and their meanings.
- apply(values: List[Any], summary: str) None [source]#
Sets the properties for this
MappingObject
instance.- Parameters:
values – The value(s) in the file. At least one array element is required.
summary – A short description of the value(s).
- classmethod create(values: List[Any], summary: str) MappingObject [source]#
Creates a new
MappingObject
instance.- Parameters:
values – The value(s) in the file. At least one array element is required.
summary – A short description of the value(s).