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

Data.automation_id

Gets the automation_id of the Data.

Data.cumulative_vector_id

Gets the internal id of the Data's XY vector.

Data.data_type

Gets the alias of the associated data-type for this Data.

Data.datasource_name

Data.filters

Gets a list of filters of this Data.

Data.first_x

Gets a reference date, or the first X (date) in the Data's vector if a reference date is not defined.

Data.id

Gets the id of the Data object.

Data.is_by_step

Gets a value indicating whether this Data is defined as steps or points.

Data.is_high_frequency

Gets a value indicating whether this Data has high frequency data.

Data.is_reference

Gets a value indicating whether this Data is a reference data of its data-type in the well.

Data.kind

Gets the kind of the Data (gauge or basic data).

Data.labels

Gets a list of labels associated with this Data.

Data.last_x

Gets the last X (date) in the Data's vector.

Data.md

Get the measure depth property value of the Data.

Data.metadata

Get the associated metadata of this data object :returns: Metadata

Data.name

Gets the name of the Data.

Data.raw_data

Gets the associated raw data (raw filter, raw shut-in, etc.)

Data.size

Gets the size of the Data (the number of points).

Data.tvd

Get the True vertical depth property value of the Data.

Data.tvdss

Get the True vertical depth sub sea property value of the Data.

Data.vector_id

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.

Data.clean()

Removes all values of the data.

Data.get_automation_status()

Get automation status

Data.get_shutin_data_dto()

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.

Data.refresh_metadata()

Refresh cache to be able to grab the updated metadata

Data.reload_gauge_from_date(date)

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 md: float#

Get the measure depth property value of the Data.

property tvd: float#

Get the True vertical depth property value of the Data.

property tvdss: float#

Get the True vertical depth sub sea property value of the Data.

property id: str#

Gets the id of the Data object.

property name: str#

Gets the name of the Data.

property vector_id: str#

Gets the internal id of the Data’s XY vector.

property cumulative_vector_id: str | None#

Gets the internal id of the Data’s XY vector.

property automation_id: str | None#

Gets the automation_id of the Data. If the Data is not linked to an Automation job, it will be None. If the Data is a filter, it will be the filterId. If the Data is a shut-in, it will be the usertaskId. If the Data is a function, it will be the functionId. If the Data is 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 Types tab in the Automation page that were present there before creating the field.

property is_by_step: bool#

Gets a value indicating whether this Data is defined as steps or points.

property is_reference: bool#

Gets a value indicating whether this Data is a reference data of its data-type in the well.

property is_high_frequency: bool#

Gets a value indicating whether this Data has high frequency data.

property labels: List[str]#

Gets a list of labels associated with this Data.

property size: int#

Gets the size of the Data (the number of points).

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 last_x: datetime | None#

Gets the last X (date) in the Data’s vector.

property filters: List[Data]#

Gets a list of filters of this Data.

property raw_data: Data | None#

Gets the associated raw data (raw filter, raw shut-in, etc.)

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:

Vector

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:

Vector

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 as Vector) 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 as Vector) of a given size.

Return type:

Iterator[Vector]

get_time_on_production(shut_in)[source]#

Calculate production time by removing shut-in periods.

Parameters:

shut_in (Data) – The Data object containing shut-in information

Returns:

Vector – A new vector with adjusted elapsed times and filtered points

Return type:

Vector

append(vector, unit=None)[source]#

Appends given values to the data.

Parameters:
  • vector (Vector) – Vector that contains data points to append.

  • unit (UnitEnum | None) – Convert values to internal units from a specific unit.

Return type:

None

clean()[source]#

Removes all values of the data.

Return type:

None

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

reload_gauge_from_date(date)[source]#
Parameters:

date (datetime)

Return type:

None

property metadata: Metadata#

Get the associated metadata of this data object :returns: Metadata

refresh_metadata()[source]#

Refresh cache to be able to grab the updated metadata

Return type:

None

get_shutin_data_dto()[source]#

Get the shut in data dto of the object

Return type:

ShutInDataDto