resqpy.time_series.AnyTimeSeries¶
- class resqpy.time_series.AnyTimeSeries(model, uuid=None, title=None, originator=None, extra_metadata=None)¶
Bases:
BaseResqpy
Abstract class for a RESQML Time Series; use resqpy TimeSeries or GeologicTimeSeries.
Notes
this class has no direct initialisation method; call the any_time_series() function to generate the appropriate derived class object for a given uuid; the resqpy code differentiates between time series on a human timeframe, where the timestamps are used without a year offset, and those on a geologic timeframe, where the timestamps are ignored and only the year offset is significant
Public Data Attributes:
resqml_type
Inherited from
BaseResqpy
resqml_type
Standard part name corresponding to self.uuid.
XML node corresponding to self.uuid.
Citation block title equivalent to self.title.
Commonly Used Methods:
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)Performs partial equivalence check on two time series (derived class methods finish the work).
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__
(model[, uuid, title, originator, ...])Load an existing resqml object, or create new.
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__(model, uuid=None, title=None, originator=None, extra_metadata=None)¶
Load an existing resqml object, or create new.
- Parameters
model (resqpy.model.Model) – Parent model
uuid (str, optional) – Load from existing uuid (if given), else create new.
title (str, optional) – Citation title
originator (str, optional) – Creator of object. By default, uses user id.
- 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)[source]¶
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)[source]¶
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
- index_for_timestamp(timestamp)[source]¶
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]¶
Performs partial equivalence check on two time series (derived class methods finish the work).
- property part¶
Standard part name corresponding to self.uuid.
- property root¶
XML node corresponding to self.uuid.
- set_model(parent_model)[source]¶
Associate the time series with a resqml model (does not create xml or write hdf5 data).
- timestamp(index, as_string=True)[source]¶
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