resqpy.lines.PolylineSet
- class resqpy.lines.PolylineSet(parent_model, uuid=None, polylines=None, irap_file=None, charisma_file=None, crs_uuid=None, title=None, originator=None, extra_metadata=None)
Bases:
_BasePolylineClass for RESQML polyline set representation.
Public Data Attributes:
resqml_typeInherited from
BaseResqpyDefinition of which RESQML object the class represents.
Standard part name corresponding to self.uuid.
XML node corresponding to self.uuid.
Citation block title equivalent to self.title.
Commonly Used Methods:
__init__(parent_model[, uuid, polylines, ...])Initialises a new PolylineSet object.
poly_index_containing_point_in_xy(p[, mode])Returns the index of the first (closed) polyline containing point p in the xy plane, or None.
create_xml([ext_uuid, add_as_part, ...])Create xml from polylineset.
write_hdf5([file_name, mode, save_polylines])Create or append the coordinates, counts and indices hdf5 arrays to hdf5 file.
convert_to_polylines([closed_array, ...])Returns a list of Polylines objects from a PolylineSet.
Methods:
get_bool_array(closed_node)Returns a boolean array using details in the xml node location.
combine_polylines(polylines)Combines the isclosed boolean array, coordinates and count data for a list of polyline objects.
Determines an appropriate output boolean array format depending on the closed_array bools.
set_interpretation_root(rep_int_root[, ...])Updates the rep_int_root for the polylineset.
convert_to_irap(file_name)Output an irap file from a polyline set.
convert_to_charisma(file_name)Output to Charisma fault sticks from a polyline set.
extract_property_collection([refresh])Returns a property collection for the polyline set.
Inherited from
_BasePolylinecreate_interpretation_and_feature([kind, ...])Creates xml and objects for a represented interpretaion and interpreted feature, if not already present.
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([title, originator, ...])Write citation block to XML.
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, polylines=None, irap_file=None, charisma_file=None, crs_uuid=None, title=None, originator=None, extra_metadata=None)[source]
Initialises a new PolylineSet object.
- Parameters:
parent_model (
model.Model object) – the model which the new PolylineSetRepresentation belongs touuid (
uuid.UUID, optional) – the uuid of an existing RESQML PolylineSetRepresentation object from which to initialise this resqpy PolylineSetpolylines (optional) – list of polyline objects from which to build the polylineset
irap_file (
str, optional) – the name of a file in irap format from which to import the polyline setcharisma_file (
str, optional) – the name of a file in charisma format from which to import the polyline setcrs_uuid (
uuid, optional) – required if loading from an IRAP or Charisma filetitle (
str, optional) – the citation title to use for a new polyline set; ignored if uuid is not Noneoriginator (
str, optional) – the name of the person creating the polyline set, defaults to login id; ignored if uuid is not Noneextra_metadata (
dict, optional) – string key, value pairs to add as extra metadata for the polyline set; ignored if uuid is not None
- Returns:
the newly instantiated PolylineSet object
Note
this initialiser does not perform any conversion between CRSes; if loading from a list of Polylines, they must all share a common CRS (which must also match crs_uuid if supplied)
- append_extra_metadata(meta_dict)
Append a given dictionary of metadata to the existing metadata.
- bool_array_format()[source]
Determines an appropriate output boolean array format depending on the closed_array bools.
self.boolnotconstant - set to True if all are not open or all closed self.boolvalue - value of isclosed for all polylines, or for the majority of polylines if mixed self.indices - array of indices where the values are not self.boolvalue, if the polylines are mixed
- property citation_title
Citation block title equivalent to self.title.
- combine_polylines(polylines)[source]
Combines the isclosed boolean array, coordinates and count data for a list of polyline objects.
- Parameters:
polylines – list of polyline objects
- convert_to_charisma(file_name)[source]
Output to Charisma fault sticks from a polyline set.
If file_name exists, it will be overwritten.
- Parameters:
file_name – output file name for polyline set representation
- convert_to_irap(file_name)[source]
Output an irap file from a polyline set.
If file_name exists, it will be overwritten.
- Parameters:
file_name – output file name for polyline set representation
- convert_to_polylines(closed_array=None, count_perpol=None, coordinates=None, crs_uuid=None, rep_int_root=None)[source]
Returns a list of Polylines objects from a PolylineSet.
Note
all arguments are optional and by default the data will be taken from self
- Parameters:
closed_array – array containing a bool for each polygon in if it is open (False) or closed (True)
count_perpol – array containing a list of polygon “lengths” for each polygon
coordinates – array containing coordinates for all the polygons
crs_uuid – crs_uuid for polylineset
rep_int_root – represented interpretation root (optional)
- Returns:
list of polyline objects
- create_interpretation_and_feature(kind='horizon', name=None, interp_title_suffix=None, is_normal=True)
Creates xml and objects for a represented interpretaion and interpreted feature, if not already present.
- create_xml(ext_uuid=None, add_as_part=True, add_relationships=True, title=None, originator=None, save_polylines=False)[source]
Create xml from polylineset.
- Parameters:
save_polylines – If true, polylines are also saved individually
- extract_property_collection(refresh=False)[source]
Returns a property collection for the polyline set.
- Parameters:
refresh (
bool, defaultFalse) – if True, the property collection is refreshed from the current state of the model; if False and the property collection has already been cached for the polyline set, then the cached copy is used- Returns:
a PropertyCollection holding those properties in the model where this polyline set is the supporting representation
Notes
polyline set properties may have indexable element of ‘nodes’ or ‘intervals’; for interval properties, the number of elements per polyline depends on whether the polyline is closed or not; it is currently left to calling code build the composite property array from data for individual polylines, or to find the subset of the combined property data that is applicable to an individual polyline
- get_bool_array(closed_node)[source]
Returns a boolean array using details in the xml node location.
- Parameters:
closed_node (
xml node) – the node under which the boolean array information sits- Returns:
1D numpy bool array set True for those pplylines within the set which are marked as closed
- property part
Standard part name corresponding to self.uuid.
- poly_index_containing_point_in_xy(p, mode='crossing')[source]
Returns the index of the first (closed) polyline containing point p in the xy plane, or None.
- property root
XML node corresponding to self.uuid.
- set_interpretation_root(rep_int_root, recursive=True)[source]
Updates the rep_int_root for the polylineset.
- Parameters:
rep_int_root – new rep_int_root
recursive – boolean, if true will update individual polys with same root
- 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
- write_hdf5(file_name=None, mode='a', save_polylines=False)[source]
Create or append the coordinates, counts and indices hdf5 arrays to hdf5 file.
- title
Citation title
- originator
Creator of object. By default, user id.
- uuid
Unique identifier