From 1d8c62dc3baf75355d3f7973189ee88fe7daf0b2 Mon Sep 17 00:00:00 2001 From: Lachlan Grose Date: Thu, 30 Mar 2023 16:09:12 +1100 Subject: [PATCH 1/5] ci: try building cython before pip install --- .github/workflows/release-please.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 9c2bab617..b9599ff1e 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -29,6 +29,7 @@ jobs: - name: Building and install shell: bash -l {0} run: | + python setup.py install build_ext --inplace pip install . - name: pytest shell: bash -l {0} From e8775c23dd8d3bd6d1faf5278e0520766d77c915 Mon Sep 17 00:00:00 2001 From: Roy Thomson Date: Wed, 31 May 2023 14:14:52 +1000 Subject: [PATCH 2/5] Move console printing into info logging --- LoopStructural/interpolators/_discrete_interpolator.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LoopStructural/interpolators/_discrete_interpolator.py b/LoopStructural/interpolators/_discrete_interpolator.py index 23576fb47..fab4c65dd 100644 --- a/LoopStructural/interpolators/_discrete_interpolator.py +++ b/LoopStructural/interpolators/_discrete_interpolator.py @@ -125,10 +125,9 @@ def set_region(self, region=None): """ # evaluate the region function on the support to determine # which nodes are inside update region map and degrees of freedom - print("Cannot use region") # self.region_function = region logger.info( - "Interpolation now uses region and has {} degrees of freedom".format( + "Cannot use region at the moment. Interpolation now uses region and has {} degrees of freedom".format( self.nx ) ) From ed6124380bc95ba91f55c88916c40e2a29463747 Mon Sep 17 00:00:00 2001 From: Roy Thomson Date: Wed, 31 May 2023 14:16:04 +1000 Subject: [PATCH 3/5] fix: Ensure modifications to data frame are on a copy of that frame --- LoopStructural/modelling/core/geological_model.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/LoopStructural/modelling/core/geological_model.py b/LoopStructural/modelling/core/geological_model.py index 8af0889b8..6c5b98f24 100644 --- a/LoopStructural/modelling/core/geological_model.py +++ b/LoopStructural/modelling/core/geological_model.py @@ -1455,9 +1455,8 @@ def create_and_add_domain_fault(self, fault_surface_data, **kwargs): self._add_domain_fault_below(domain_fault) domain_fault_uc = UnconformityFeature(domain_fault, 0) - # iterate over existing features and add the unconformity as a - # region so the feature is only - # evaluated where the unconformity is positive + # iterate over existing features and add the unconformity as a region + # so the feature is only evaluated where the unconformity is positive return domain_fault_uc def create_and_add_fault( @@ -1551,7 +1550,7 @@ def create_and_add_fault( # add data fault_frame_data = self.data.loc[ self.data["feature_name"] == fault_surface_data - ] + ].copy() trace_mask = np.logical_and( fault_frame_data["coord"] == 0, fault_frame_data["val"] == 0 ) From 7bf34fc3e841e243b1a34dbaf36294b5ce17306f Mon Sep 17 00:00:00 2001 From: Roy Thomson Date: Wed, 31 May 2023 14:17:30 +1000 Subject: [PATCH 4/5] fix: Use fault names if present before labelling fault Fault_XXX --- LoopStructural/modelling/input/project_file.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/LoopStructural/modelling/input/project_file.py b/LoopStructural/modelling/input/project_file.py index 660caafaf..779254348 100644 --- a/LoopStructural/modelling/input/project_file.py +++ b/LoopStructural/modelling/input/project_file.py @@ -29,12 +29,12 @@ def __init__(self, projectfile, use_thickness=None): contacts.rename(columns=column_map, inplace=True) fault_locations.rename(columns=column_map, inplace=True) fault_orientations.rename(columns=column_map, inplace=True) - fault_locations["fault_name"] = [ - f"Fault_{eventid}" for eventid in fault_locations["eventId"] - ] - fault_orientations["fault_name"] = [ - f"Fault_{eventid}" for eventid in fault_orientations["eventId"] - ] + # fault_locations["fault_name"] = [ + # f"Fault_{eventid}" for eventid in fault_locations["eventId"] + # ] + # fault_orientations["fault_name"] = [ + # f"Fault_{eventid}" for eventid in fault_orientations["eventId"] + # ] thicknesses = dict( zip( projectfile["stratigraphicLog"].name, @@ -52,6 +52,10 @@ def __init__(self, projectfile, use_thickness=None): }, inplace=True, ) + fault_locations = fault_properties.reset_index()[["name", "eventId"]].merge(fault_locations, on="eventId") + fault_locations["fault_name"] = fault_locations["name"] + fault_orientations = fault_properties.reset_index()[["name", "eventId"]].merge(fault_orientations, on="eventId") + fault_orientations["fault_name"] = fault_orientations["name"] colours = dict( zip( self.projectfile.stratigraphicLog.name, From 083a195004f45cc52086b503441f93f97cb3f21d Mon Sep 17 00:00:00 2001 From: Roy Thomson Date: Wed, 31 May 2023 14:18:16 +1000 Subject: [PATCH 5/5] fix: Check for empty features and escape early --- LoopStructural/visualisation/model_plotter.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/LoopStructural/visualisation/model_plotter.py b/LoopStructural/visualisation/model_plotter.py index b1575b76e..3ac5d016f 100644 --- a/LoopStructural/visualisation/model_plotter.py +++ b/LoopStructural/visualisation/model_plotter.py @@ -303,6 +303,14 @@ def add_isosurface( xx, yy, zz = np.meshgrid(x, y, z, indexing="ij") points = np.array([xx.flatten(), yy.flatten(), zz.flatten()]).T val = geological_feature.evaluate_value(points) + + # Check if there is sufficient values to anchor the feature in the model + # if not skip this feature + if len(np.unique(val)) == 1: + logger.warning( + f"No value information for {geological_feature.name}, skipping" + ) + return return_container mean_val = np.nanmean(val) # geological_feature.mean() max_val = np.nanmax(val) # geological_feature.max() min_val = np.nanmin(val) # geological_feature.min()