Skip to main content

DownloadedObject

GitHub source

DownloadedObject

evo.objects.client.object_client.DownloadedObject

A downloaded geoscience object.

schema property

schema: ObjectSchema

The schema of the object.

metadata property

metadata: ObjectMetadata

The metadata of the object.

__init__

__init__(
object_: GeoscienceObject,
metadata: ObjectMetadata,
urls_by_name: dict[str, str],
connector: APIConnector,
cache: ICache | None = None,
) -> None

Parameters:

NameTypeDescriptionDefault
object_GeoscienceObjectThe raw geoscience object model.required
metadataObjectMetadataThe parsed metadata for the object.required
urls_by_namedict[str, str]A mapping of data names to their initial download URLs.required
connectorAPIConnectorThe API connector to use for downloading data.required
cacheICache | NoneAn optional cache to use for data downloads.None

from_reference async staticmethod

from_reference(
connector: APIConnector,
reference: ObjectReference | str,
cache: ICache | None = None,
request_timeout: int | float | tuple[int | float, int | float] | None = None,
) -> DownloadedObject

Download a geoscience object from the service, given an object reference.

Parameters:

NameTypeDescriptionDefault
connectorAPIConnectorThe API connector to use for downloading data.required
referenceObjectReference | strThe reference to the object to download, or a URL as a string that can be parsed into a reference.required
cacheICache | NoneAn optional cache to use for data downloads.None
request_timeoutint | float | tuple[int | float, int | float] | NoneAn optional timeout to use for API requests. See evo.common.APIConnector for details.None

Raises:

TypeDescription
ValueErrorIf the reference is invalid, or if the connector base URL does not match the reference hub URL.

from_context async staticmethod

from_context(context: IContext, reference: ObjectReference | str) -> DownloadedObject

Download a geoscience object from the service using a context.

Parameters:

NameTypeDescriptionDefault
contextIContextThe context providing the connector and cache.required
referenceObjectReference | strThe reference to the object to download, or a URL as a string that can be parsed into a reference.required

Raises:

TypeDescription
ValueErrorIf the reference is invalid, or if the connector base URL does not match the reference hub URL.

as_dict

as_dict() -> dict

Get this object as a dictionary.

search(expression: str) -> Any

Search the object metadata using a JMESPath expression.

Parameters:

NameTypeDescriptionDefault
expressionstrThe JMESPath expression to use for the search.required

Returns:

TypeDescription
AnyThe result of the search.

prepare_data_download

prepare_data_download(data_identifiers: Sequence[str | UUID]) -> Iterator[ObjectDataDownload]

Prepare to download multiple data files from the geoscience object service, for this object.

Any data IDs that are not associated with the requested object will raise a DataNotFoundError.

Parameters:

NameTypeDescriptionDefault
data_identifiersSequence[str | UUID]A list of sha256 digests or UUIDs for the data to be downloaded.required

Returns:

TypeDescription
Iterator[ObjectDataDownload]An iterator of data download contexts that can be used to download the data.

Raises:

TypeDescription
DataNotFoundErrorIf any requested data ID is not associated with this object.

update async

update(
object_dict: dict,
check_for_conflict: bool = True,
request_timeout: int | float | tuple[int | float, int | float] | None = None,
) -> DownloadedObject

Update the geoscience object on the geoscience object service. Returning a new DownloadedObject representing the new version of the object.

This will create a new version of the object, that fully replaces the existing properties of the object with those provided in object_dict.

Note, this will not update the "DownloadedObject" instance in-place - it will still represent the original version of the object. You will need to download the updated version separately if you wish to work with it.

Parameters:

NameTypeDescriptionDefault
object_dictdictThe new properties of the object as a dictionary.required
check_for_conflictboolIf True, and if a newer version of the object exists on the geoscience object service, the update will fail with a ObjectModifiedError exception. If False, it will not check whether there is a newer version, so will perform the update regardless.True
request_timeoutint | float | tuple[int | float, int | float] | NoneAn optional timeout to use for API requests. See evo.common.APIConnector for details.None

Returns:

TypeDescription
DownloadedObjectThe new version of the object as a DownloadedObject.

download_table async

download_table(
table_info: TableInfo | str,
fb: IFeedback = NoFeedback,
*,
nan_values: list[int] | list[float] | str | None = None,
column_names: Sequence[str] | None = None,
) -> pa.Table

Download the data referenced by the given table info as a PyArrow Table.

Parameters:

NameTypeDescriptionDefault
table_infoTableInfo | strThe table info dict, ot JMESPath to table info within the object.required
fbIFeedbackAn optional feedback instance to report download progress to.NoFeedback
nan_valueslist[int] | list[float] | str | NoneAn optional list of values to treat as null. Can also be a JMESPath expression to the list of nan values, or the nan_description structure.None
column_namesSequence[str] | NoneAn optional list of column names for the table, instead of those in the Parquet file.None

Returns:

TypeDescription
TableA PyArrow Table containing the downloaded data.

download_category_table async

download_category_table(
category_info: CategoryInfo | str,
*,
nan_values: list[int] | list[float] | str | None = None,
column_names: Sequence[str] | None = None,
fb: IFeedback = NoFeedback,
) -> pa.Table

Download the data referenced by the given category info as a PyArrow Table.

The arrays into the table will be DictionaryArrays constructed from the values and lookup tables.

Parameters:

NameTypeDescriptionDefault
category_infoCategoryInfo | strThe category info dict, or JMESPath to the category info within the object.required
nan_valueslist[int] | list[float] | str | NoneAn optional list of values to treat as null. Can also be a JMESPath expression to nan_description structure.None
column_namesSequence[str] | NoneAn optional list of column names for the table, instead of those in the Parquet file.None
fbIFeedbackAn optional feedback instance to report download progress to.NoFeedback

Returns:

TypeDescription
TableA PyArrow Table containing the downloaded data.

download_attribute_table async

download_attribute_table(attribute: AttributeInfo | str, fb: IFeedback = NoFeedback) -> pa.Table

Download the data referenced by the given attribute as a PyArrow Table.

Parameters:

NameTypeDescriptionDefault
attributeAttributeInfo | strThe attribute info dict, or JMESPath to the attribute info within the object.required
fbIFeedbackAn optional feedback instance to report download progress to.NoFeedback

Returns:

TypeDescription
TableA PyArrow Table containing the downloaded data.

download_dataframe async

download_dataframe(
table_info: TableInfo | str,
fb: IFeedback = NoFeedback,
*,
nan_values: list[int] | list[float] | str | None = None,
column_names: Sequence[str] | None = None,
) -> pd.DataFrame

Download the data referenced by the given table info as a Pandas DataFrame.

Parameters:

NameTypeDescriptionDefault
table_infoTableInfo | strThe table info dict, JMESPath to table info within the object.required
fbIFeedbackAn optional feedback instance to report download progress to.NoFeedback
nan_valueslist[int] | list[float] | str | NoneAn optional list of values to treat as null. Can also be a JMESPath expression to nan_description structure.None
column_namesSequence[str] | NoneAn optional list of column names for the table, instead of those from the Parquet file.None

Returns:

TypeDescription
DataFrameA Pandas DataFrame containing the downloaded data.

download_category_dataframe async

download_category_dataframe(
category_info: CategoryInfo | str,
fb: IFeedback = NoFeedback,
*,
nan_values: list[int] | list[float] | str | None = None,
column_names: Sequence[str] | None = None,
) -> pd.DataFrame

Download the data referenced by the given category info as a Pandas DataFrame.

Parameters:

NameTypeDescriptionDefault
category_infoCategoryInfo | strThe category info dict, or JMESPath to the category info within the object.required
nan_valueslist[int] | list[float] | str | NoneAn optional list of values to treat as null. Can also be a JMESPath expression to nan_description structure.None
column_namesSequence[str] | NoneAn optional list of column names for the table, instead of those from the Parquet file.None
fbIFeedbackAn optional feedback instance to report download progress to.NoFeedback

Returns:

TypeDescription
DataFrameA Pandas DataFrame containing the downloaded data.

download_attribute_dataframe async

download_attribute_dataframe(attribute: AttributeInfo | str, fb: IFeedback = NoFeedback) -> pd.DataFrame

Download the data referenced by the given attribute as a Pandas DataFrame.

Parameters:

NameTypeDescriptionDefault
attributeAttributeInfo | strThe attribute info dict, or JMESPath to the attribute within the object.required
fbIFeedbackAn optional feedback instance to report download progress to.NoFeedback

Returns:

TypeDescription
DataFrameA Pandas DataFrame containing the downloaded data.

download_array async

download_array(table_info: TableInfo | str, fb: IFeedback = NoFeedback) -> np.ndarray

Download the data referenced by the given table info as a NumPy array.

Parameters:

NameTypeDescriptionDefault
table_infoTableInfo | strThe table info dict, JMESPath to table info within the object.required
fbIFeedbackAn optional feedback instance to report download progress to.NoFeedback

Returns:

TypeDescription
ndarrayA NumPy array containing the downloaded data.

What is the reason for your feedback?