simdb.imas.utils module

class simdb.imas.utils.DBEntry[source]

Bases: object

list_all_occurrences(ids: str) List[int][source]

List all occurrences of the given IDS in the IMAS data entry.

@param ids: the IDS name @param path: the path to the data @return: the list of occurrences

partial_get(ids: str, path: str, occurrence=0) Any[source]
exception simdb.imas.utils.ImasError[source]

Bases: Exception

simdb.imas.utils.check_time(entry: DBEntry, ids: str, occurrence) None[source]

Check the validity of the ids_properties/homogeneous_time field of the given IDS.

@param entry: the open IMAS data entry @param ids: the @return:

simdb.imas.utils.convert_uri(uri: URI, path: Path, config: Config) URI[source]

Converts a local IMAS URI to a remote access IMAS URI based on the server.imas_remote_host configuration option.

Translate locale IMAS URI (imas:<backend>?path=<path>) to remote access URI (imas://<imas_remote_host>:<imas_remote_port>/uda?path=<path>&backend=<backend>)

@param uri: The URI to convert @param config: Config to read the server.imas_remote_host and server.imas_remote_port options from

simdb.imas.utils.extract_ids_occurrence(ids: str) tuple[str, int][source]

Extract IDS name and occurrence number. Returns tuple of (ids_name, occurrence)

simdb.imas.utils.get_path_for_legacy_uri(uri: URI) Path[source]
simdb.imas.utils.imas_files(uri: URI) List[Path][source]

Return all the files associated with the given IMAS URI.

@param uri: a valid IMAS URI @return: a list of files which contains the IDS data for the backend specified in the URI

simdb.imas.utils.imas_timestamp(uri: URI) datetime[source]

Extract the timestamp from the IDS data for the given IMAS URI.

@param uri: the IMAS URI @return: the timestamp as a datetime object

simdb.imas.utils.is_missing(value: Any)[source]

Returns whether the given value is one of IMASs ‘missing’ values.

@param value: the value to check @return: whether this value is ‘missing’

simdb.imas.utils.list_idss(entry: DBEntry) List[str][source]

List all the IDSs found to be populated for the given IMAS data entry.

Each IDS is defined as being non-empty if the ids_properties/homogeneous_time field has been populated.

@param entry: the IMAS data entry @return: the list of found IDSs

simdb.imas.utils.open_imas(uri: URI) DBEntry[source]

Open an IMAS URI and return the IMAS entry object.

@param uri: the IMAS URI to open @return: the IMAS data entry object