kappa_sdk.Data#
- class kappa_sdk.Data(field_id, well_id, data_id, vector_id, automation_id, name, kind, data_type, is_by_step, is_reference, is_high_frequency, labels, filters, raw_data, measure_depth, true_vertical_depth, true_vertical_depth_subsea, cluster_apis, data_dto_converter)[source]#
Data object.
Presents a KAPPA Automate data object that is used to read and write the vector values.
Note
Should not be instantiated directly.
Attributes
Gets the automation_id of the
Data.Gets the internal id of the
Data's XY vector.Gets the alias of the associated data-type for this
Data.Gets a list of filters of this
Data.Gets a reference date, or the first X (date) in the
Data's vector if a reference date is not defined.Gets the id of the
Dataobject.Gets a value indicating whether this
Datais defined as steps or points.Gets a value indicating whether this
Datahas high frequency data.Gets a value indicating whether this
Datais a reference data of its data-type in the well.Gets the kind of the
Data(gauge or basic data).Gets a list of labels associated with this
Data.Gets the last X (date) in the
Data's vector.Get the measure depth property value of the
Data.Get the associated metadata of this data object :returns:
MetadataGets the name of the
Data.Gets the associated raw data (raw filter, raw shut-in, etc.)
Gets the size of the
Data(the number of points).Get the True vertical depth property value of the
Data.Get the True vertical depth sub sea property value of the
Data.Gets the internal id of the
Data's XY vector.Methods
Data.add_labels(labels)Adds a list of user-defined labels to the current object.
Data.append(vector[, unit])Appends given values to the data.
Removes all values of the data.
Get automation status
Get the shut in data dto of the object
Data.get_time_on_production(shut_in)Calculate production time by removing shut-in periods.
Data.overwrite(vector)Overwrites the content of the data with given values.
Data.read([from_time, to_time, count, last, ...])Reads the data values as
Vector.Data.read_by_chunks(chunk_size[, from_time, ...])Reads the data values by chunks of a given size.
Data.read_cumulative([from_time, to_time, ...])Reads the cumulative values associated to this data object as
Vector.Data.read_cumulative_by_chunks(chunk_size[, ...])Reads the cumulative values associated to this data by chunks of a given size.
Refresh cache to be able to grab the updated metadata
Data.update_first_x(first_x)Updates a value of the first X (reference date).
- Parameters:
field_id (str)
well_id (str)
data_id (str)
vector_id (str)
automation_id (Optional[str])
name (str)
kind (DataKindEnum)
data_type (str)
is_by_step (bool)
is_reference (bool)
is_high_frequency (bool)
labels (List[str])
filters (List[Data])
raw_data (Optional[Data])
measure_depth (Optional[float])
true_vertical_depth (Optional[float])
true_vertical_depth_subsea (Optional[float])
cluster_apis (ClusterAPIS)
data_dto_converter (DataDtoConverter)
- __init__(field_id, well_id, data_id, vector_id, automation_id, name, kind, data_type, is_by_step, is_reference, is_high_frequency, labels, filters, raw_data, measure_depth, true_vertical_depth, true_vertical_depth_subsea, cluster_apis, data_dto_converter)[source]#
- Parameters:
field_id (str)
well_id (str)
data_id (str)
vector_id (str)
automation_id (str | None)
name (str)
kind (DataKindEnum)
data_type (str)
is_by_step (bool)
is_reference (bool)
is_high_frequency (bool)
labels (List[str])
filters (List[Data])
raw_data (Data | None)
measure_depth (float | None)
true_vertical_depth (float | None)
true_vertical_depth_subsea (float | None)
cluster_apis (ClusterAPIS)
data_dto_converter (DataDtoConverter)
- property automation_id: str | None#
Gets the automation_id of the
Data. If theDatais not linked to an Automation job, it will be None. If theDatais a filter, it will be the filterId. If theDatais a shut-in, it will be the usertaskId. If theDatais a function, it will be the functionId. If theDatais a gauge, it will be the mirrorId.
- property kind: DataKindEnum#
Gets the kind of the
Data(gauge or basic data).
- property data_type: str#
Gets the alias of the associated data-type for this
Data.This is the alias of one of the data-types defined on the
Data Typestab in theAutomationpage that were present there before creating the field.
- property is_reference: bool#
Gets a value indicating whether this
Datais a reference data of its data-type in the well.
- property is_high_frequency: bool#
Gets a value indicating whether this
Datahas high frequency data.
- property first_x: datetime | None#
Gets a reference date, or the first X (date) in the
Data’s vector if a reference date is not defined.
- property datasource_name: str | None#
- update_first_x(first_x)[source]#
Updates a value of the first X (reference date).
- Parameters:
first_x (datetime) – New value of the first X (reference date).
- Return type:
None
- read(from_time=None, to_time=None, count=-1, last=False, unit=None)[source]#
Reads the data values as
Vector.All parameters are optional, if none are given it will read all values. A warning will be issued if trying to read more than 500000 points at once.
- Parameters:
from_time (datetime | None) – Date to start reading from.
to_time (datetime | None) – Date to read the data up to.
count (int) – Maximum count of points to return, regardless of from/to settings.
last (bool) – Will return last (count) of points if set to True.
unit (UnitEnum | None) – Convert values from internal units to a specific unit.
- Returns:
Vector– Vector that contains the requested data values.- Return type:
- read_cumulative(from_time=None, to_time=None, count=-1, last=False, unit=None)[source]#
Reads the cumulative values associated to this data object as
Vector.All parameters are optional, if none are given it will read all values. A warning will be issued if trying to read more than 500000 points at once.
- Parameters:
from_time (datetime | None) – Date to start reading from.
to_time (datetime | None) – Date to read the data up to.
count (int) – Maximum count of points to return, regardless of from/to settings.
last (bool) – Will return last (count) of points if set to True.
unit (UnitEnum | None) – Convert values from internal units to a specific unit.
- Returns:
Vector– Vector that contains the requested data values.- Return type:
- read_by_chunks(chunk_size, from_time=None, to_time=None, count=-1, unit=None)[source]#
Reads the data values by chunks of a given size.
This is the preferable way to read and process large sets of data.
- Parameters:
chunk_size (int) – Number of points to return in each chunk (100000 points max).
from_time (datetime | None) – Date to start reading from.
to_time (datetime | None) – Date to read the data up to.
count (int) – Maximum count of points to return, regardless of from/to settings.
unit (UnitEnum | None) – Convert values from internal units to a specific unit.
- Returns:
Iterator[Vector]– Iterator that gives access to the requested data values that are split into chunks (each presented asVector) of a given size.- Return type:
Iterator[Vector]
- read_cumulative_by_chunks(chunk_size, from_time=None, to_time=None, count=-1, unit=None)[source]#
Reads the cumulative values associated to this data by chunks of a given size.
This is the preferable way to read and process large sets of data.
- Parameters:
chunk_size (int) – Number of points to return in each chunk (100000 points max).
from_time (datetime | None) – Date to start reading from.
to_time (datetime | None) – Date to read the data up to.
count (int) – Maximum count of points to return, regardless of from/to settings.
unit (UnitEnum | None) – Convert values from internal units to a specific unit.
- Returns:
Iterator[Vector]– Iterator that gives access to the requested data values that are split into chunks (each presented asVector) of a given size.- Return type:
Iterator[Vector]
- overwrite(vector)[source]#
Overwrites the content of the data with given values.
- Parameters:
vector (Vector) – Vector with new data points that will completely overwrite existing ones.
- Return type:
None
- add_labels(labels)[source]#
Adds a list of user-defined labels to the current object.
This method checks the validity of the instance before adding user-defined labels. The validity is determined by whether the instance has an ID assigned. Depending on the kind of data (filter or regular data), it dynamically fetches the appropriate service name. The labels are added via the cluster API and appended to the instance’s internal labels list.
- Parameters:
labels (
List[str]) – A list of user-defined labels to be added to the current object. Each label is expected to be a string.- Return type:
None
- get_automation_status()[source]#
Get automation status
- Return type:
AutomationStatus | None