resqpy.time_series.GeologicTimeSeries

class resqpy.time_series.GeologicTimeSeries(parent_model, uuid=None, title=None, originator=None, extra_metadata=None)

Bases: AnyTimeSeries

Class for RESQML Time Series using only year offsets (for geological time frames).

Public Data Attributes:

Inherited from AnyTimeSeries

resqml_type

Inherited from BaseResqpy

resqml_type

part

Standard part name corresponding to self.uuid.

root

XML node corresponding to self.uuid.

citation_title

Citation block title equivalent to self.title.

Commonly Used Methods:

__init__(parent_model[, uuid, title, ...])

Create a GeologicTimeSeries object, either from a time series node in parent model, or empty.

from_year_list(parent_model, year_list[, ...])

Creates a new GeologicTimeSeries from a list of large integers representing years before present.

Inherited from AnyTimeSeries

number_of_timestamps()

Returns the number of timestamps in the series.

timestamp(index[, as_string])

Returns an individual timestamp, indexed by its position in the series.

iter_timestamps([as_string])

Iterator over timestamps.

last_timestamp([as_string])

Returns the last timestamp in the series.

index_for_timestamp(timestamp)

Returns the index for a given timestamp.

create_xml([add_as_part, title, originator, ...])

Create a RESQML time series xml node from a TimeSeries or GeologicTimeSeries object, optionally add as part.

Methods:

is_equivalent(other_ts)

Returns True if the this geologic time series is essentially identical to the other; otherwise False.

Inherited from AnyTimeSeries

is_equivalent(other_ts)

Returns True if the this geologic time series is essentially identical to the other; otherwise False.

set_model(parent_model)

Associate the time series with a resqml model (does not create xml or write hdf5 data).

create_time_index(time_index[, root, ...])

Create a time index node, including time series reference, optionally add to root.

Inherited from BaseResqpy

__init__(parent_model[, uuid, title, ...])

Create a GeologicTimeSeries object, either from a time series node in parent model, or empty.

try_reuse()

Look for an equivalent existing RESQML object and modify the uuid of this object if found.

create_xml([add_as_part, title, originator, ...])

Create a RESQML time series xml node from a TimeSeries or GeologicTimeSeries object, optionally add as part.

append_extra_metadata(meta_dict)

Append a given dictionary of metadata to the existing metadata.

__eq__(other)

Implements equals operator; uses is_equivalent() otherwise compares class type and uuid.

__ne__(other)

Implements not equal operator.

__repr__()

String representation.


__init__(parent_model, uuid=None, title=None, originator=None, extra_metadata=None)[source]

Create a GeologicTimeSeries object, either from a time series node in parent model, or empty.

Parameters
  • parent_model (model.Model) – the resqpy model to which the time series will belong

  • uuid (uuid.UUID, optional) – the uuid of a TimeSeries object to be loaded from xml

  • title (str, optional) – the citation title to use for a new time series; ignored if uuid is not None

  • originator (str, optional) – the name of the person creating the time series, defaults to login id; ignored if uuid is not None

  • extra_metadata (dict, optional) – string key, value pairs to add as extra metadata for the time series; ignored if uuid is not None

Returns

newly instantiated GeologicTimeSeries object

Note

if instantiating from an existing RESQML time series, its Time entries must all have YearOffset data which should be large negative integers

append_extra_metadata(meta_dict)

Append a given dictionary of metadata to the existing metadata.

property citation_title

Citation block title equivalent to self.title.

create_time_index(time_index, root=None, check_valid_index=True)

Create a time index node, including time series reference, optionally add to root.

Parameters
  • time_index (int) – non-negative integer index into the time series, identifying the datetime being referenced by the new node

  • root (optional) – if present, the newly created time index xml node is added as a child to this node

  • check_valid_index (boolean, default True) – if True, an assertion error is raised if the time index is out of range for this time series

Returns

the newly created time index xml node

Note

a time index node is typically part of a recurrent property object; it identifies the datetime relevant to the property array (or other data) by indexing into a time series object

create_xml(add_as_part=True, title=None, originator=None, reuse=True)

Create a RESQML time series xml node from a TimeSeries or GeologicTimeSeries object, optionally add as part.

Parameters
  • add_as_part (boolean, default True) – if True, the newly created xml node is added as a part in the model

  • title (string) – used as the citation Title text for the new time series node

  • originator (string, optional) – the name of the human being who created the time series object; default is to use the login name

Returns

the newly created time series xml node

classmethod from_year_list(parent_model, year_list, title=None, originator=None, extra_metadata={})[source]

Creates a new GeologicTimeSeries from a list of large integers representing years before present.

Note

the years will be converted to negative numbers if positive, and sorted from oldest (most negative) to youngest (least negative)

index_for_timestamp(timestamp)

Returns the index for a given timestamp.

Note

this method uses a simplistic string or int comparison; if the timestamp is not found, None is returned

is_equivalent(other_ts)[source]

Returns True if the this geologic time series is essentially identical to the other; otherwise False.

iter_timestamps(as_string=True)

Iterator over timestamps.

last_timestamp(as_string=True)

Returns the last timestamp in the series.

number_of_timestamps()

Returns the number of timestamps in the series.

property part

Standard part name corresponding to self.uuid.

property root

XML node corresponding to self.uuid.

set_model(parent_model)

Associate the time series with a resqml model (does not create xml or write hdf5 data).

timestamp(index, as_string=True)

Returns an individual timestamp, indexed by its position in the series.

Parameters
  • index (int) – the time index for which the timestamp is required

  • as_string (boolean, default True) – if True and this is series is on a geologic timeframe, the return value is a string, otherwise an int; for human timeframe series, this argument has no effect

Returns

string or int being the selected timestamp

Notes

index may be negative in which case it is taken to be relative to the end of the series with the last timestamp being referenced by an index of -1; the string form of a geologic timestamp is a positive number in millions of years, with the suffix Ma

try_reuse()

Look for an equivalent existing RESQML object and modify the uuid of this object if found.

Returns

boolean – True if an equivalent object was found, False if not

Note

by design this method may change this object’s uuid as a side effect

title

Citation title

originator

Creator of object. By default, user id.

uuid

Unique identifier