resqpy.surface.PointSet
- class resqpy.surface.PointSet(parent_model, uuid=None, load_hdf5=False, points_array=None, crs_uuid=None, polyset=None, polyline=None, random_point_count=None, charisma_file=None, irap_file=None, title=None, originator=None, extra_metadata=None, remove_trailing_999=True)
Bases:
BaseSurfaceClass for RESQML Point Set Representation within resqpy model object.
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, load_hdf5, ...])Creates an empty Point Set object and optionally populates from xml or other source.
Return a single numpy float array of shape (N, 3) containing all points from all patches.
write_hdf5([file_name, mode])Create or append to an hdf5 file, writing datasets for the point set patches after caching arrays.
create_xml([ext_uuid, add_as_part, ...])Creates a point set representation xml node from this point set object and optionally adds as part of model.
Methods:
from_charisma(charisma_file)Instantiate a pointset using points from an input charisma file
from_irap(irap_file[, remove_trailing_999])Instantiate a pointset using points from an input irap file.
from_polyline(polyline[, random_point_count])Instantiates a pointset using points from an input polyline (PolylineRepresentation) object
from_polyset(polyset)Instantiates a pointset using points from an input polylineset (PolylineSetRepresentation) object
check_crs_match(crs_uuid)Checks if the point set's crs_uuid matches a given crs_uuid.
set_represented_interpretation_root(interp_root)Makes a note of the xml root of the represented interpretation.
single_patch_array_ref(patch_index)Load numpy array for one patch of the point set from hdf5, cache and return it.
Load hdf5 data for all patches and cache as separate numpy arrays; not usually called directly.
change_crs(required_crs)Changes the crs of the point set, also sets a new uuid if crs changed.
trim_to_xyz_box(xyz_box)Converts point set to a single patch, holding only those points within the xyz box.
trim_to_xy_polygon(xy_polygon)Converts point set to a single patch, holding only those points within the polygon when projected in xy.
minimum_xy_area_rectangle([delta_theta])Returns the xy projection rectangle of minimum area that contains the points.
add_patch(points_array)Extend the current point set with a new patch of points.
extract_property_collection([refresh])Returns a property collection for the point set.
convert_to_charisma(file_name)Output to Charisma 3D interpretation format from a pointset.
convert_to_irap(file_name)Output to IRAP simple points format from a pointset.
Inherited from
BaseSurfacecreate_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, load_hdf5=False, points_array=None, crs_uuid=None, polyset=None, polyline=None, random_point_count=None, charisma_file=None, irap_file=None, title=None, originator=None, extra_metadata=None, remove_trailing_999=True)[source]
Creates an empty Point Set object and optionally populates from xml or other source.
- Parameters:
parent_model (
model.Model object) – the model to which the new point set belongsuuid (
uuid.UUID, optional) – if present, the object is populated from the RESQML PointSetRepresentation with this uuidload_hdf5 (
boolean, defaultFalse) – if True and uuid is present, the actual points are pre-loaded into a numpy array; otherwise the points will be loaded on demandpoints_array (
numpy float arrayofshape (...,2or3), optional) – if present, the xy(&z) data which will constitute the point set; missing z will be set to zero; ignored if uuid is not Nonecrs_uuid (
uuid.UUID, optional) – if present, identifies the coordinate reference system for the points; ignored if uuid is not None; if None, ‘imported’ points will be associated with the default crs of the parent modelpolyset (optional) – if present, creates a pointset from points in a polylineset
polyline (optional) – if present and random_point_count is None or zero, creates a pointset from points in a polyline; if present and random_point_count is set, creates random points within the (closed, convex) polyline
random_point_count (
int, optional) – if present and polyline is present then the number of random points to generate within the (closed) polyline in the xy plane, with z set to 0.0charisma_file (optional) – if present, creates a pointset from a charisma 3d interpretation file
irap_file (optional) – if present, creates a pointset from an IRAP classic points format file
title (
str, optional) – the citation title to use for a new point set; ignored if uuid is not Noneoriginator (
str, optional) – the name of the person creating the point 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 point set; ignored if uuid is not Noneremove_trailing_999 (
bool, defaultTrue) – if True, when loading from an irap_file, if the last point in the file is triple 999.0, then it is excluded from the point set
- Returns:
newly created PointSet object
- append_extra_metadata(meta_dict)
Append a given dictionary of metadata to the existing metadata.
- change_crs(required_crs)[source]
Changes the crs of the point set, also sets a new uuid if crs changed.
Notes
this method is usually used to change the coordinate system for a temporary resqpy object; to add as a new part, call write_hdf5() and create_xml() methods
- check_crs_match(crs_uuid)[source]
Checks if the point set’s crs_uuid matches a given crs_uuid.
Notes
if the current model crs_uuid is None, the new crs_uuid is used as the model crs_uuid; if a mismatch is found an assertion error is raised
- property citation_title
Citation block title equivalent to self.title.
- convert_to_charisma(file_name)[source]
Output to Charisma 3D interpretation format from a pointset.
If file_name exists, it will be overwritten.
- Parameters:
file_name – output file name to save to
- convert_to_irap(file_name)[source]
Output to IRAP simple points format from a pointset.
If file_name exists, it will be overwritten.
- Parameters:
file_name – output file name to save to
- 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)[source]
Creates a point set representation xml node from this point set object and optionally adds as part of model.
- Parameters:
ext_uuid (
uuid.UUID) – the uuid of the hdf5 external part holding the points array(s)add_as_part (
boolean, defaultTrue) – if True, the newly created xml node is added as a part in the modeladd_relationships (
boolean, defaultTrue) – if True, a relationship xml part is created relating the new point set part to the crs part (and optional interpretation part)title (
string) – used as the citation Title text; should be meaningful to a humanoriginator (
string, optional) – the name of the human being who created the point set representation part; default is to use the login name
- Returns:
the newly created point set representation xml node
- extract_property_collection(refresh=False)[source]
Returns a property collection for the point 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 point set, then the cached copy is used- Returns:
a PropertyCollection holding those properties in the model where this point set is the supporting representation
Note
point set properties have indexable element of ‘nodes’
- from_charisma(charisma_file)[source]
Instantiate a pointset using points from an input charisma file
- Parameters:
charisma_file – a charisma 3d interpretation file
- from_irap(irap_file, remove_trailing_999=True)[source]
Instantiate a pointset using points from an input irap file.
- Parameters:
irap_file (
str) – an existing IRAP classic points format fileremove_trailing_999 (
bool, defaultTrue) – if True, and the last point in the irap file is triple 999.0, then it is excluded
- from_polyline(polyline, random_point_count=None)[source]
Instantiates a pointset using points from an input polyline (PolylineRepresentation) object
- Parameters:
polyline – if random_point_count is None or zero, creates a pointset from points in a polyline; if present and random_point_count is set, creates random points within the (closed, convex) polyline
- from_polyset(polyset)[source]
Instantiates a pointset using points from an input polylineset (PolylineSetRepresentation) object
- Parameters:
polyset (
resqpy.lines.PolylineSet object) – a polylineset object to generate the pointset from
- full_array_ref()[source]
Return a single numpy float array of shape (N, 3) containing all points from all patches.
- load_all_patches()[source]
Load hdf5 data for all patches and cache as separate numpy arrays; not usually called directly.
- minimum_xy_area_rectangle(delta_theta=5.0)[source]
Returns the xy projection rectangle of minimum area that contains the points.
- Parameters:
delta_theta (
float, default5.0) – the incremental angle in degrees to test against- Returns:
(d1, d2, r) where d1 and d2 are lengths of sides of an xy plane rectangle that just contains the points, and d1 <= d2, and r is a bearing in degrees of a d2 (longer) side between 0.0 and 180.0
- property part
Standard part name corresponding to self.uuid.
- property root
XML node corresponding to self.uuid.
- set_represented_interpretation_root(interp_root)[source]
Makes a note of the xml root of the represented interpretation.
- single_patch_array_ref(patch_index)[source]
Load numpy array for one patch of the point set from hdf5, cache and return it.
- trim_to_xy_polygon(xy_polygon)[source]
Converts point set to a single patch, holding only those points within the polygon when projected in xy.
- Parameters:
xy_polygon (
closed convex resqpy.lines.Polyline) – the polygon outlining the area in xy within which points are kept
Notes
usually used to reduce the point set volume for a temprary object; a new uuid is assigned; to add as a new part, call write_hdf5() and create_xml() methods
- trim_to_xyz_box(xyz_box)[source]
Converts point set to a single patch, holding only those points within the xyz box.
- Parameters:
xyz_box (
numpy float arrayofshape (2,3)) – the minimum and maximum range to keep in x,y,z
Notes
usually used to reduce the point set volume for a temprary object; a new uuid is assigned; to add as a new part, call write_hdf5() and create_xml() methods
- 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')[source]
Create or append to an hdf5 file, writing datasets for the point set patches after caching arrays.
- title
Citation title
- originator
Creator of object. By default, user id.
- uuid
Unique identifier