Skip to content

Commit

Permalink
Remove grouping mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
tversteeg committed Nov 29, 2021
1 parent b14e264 commit accb81a
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 312 deletions.
1 change: 0 additions & 1 deletion bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os

import numpy as np

from pygef import Cpt

cwd = os.path.dirname(__file__)
Expand Down
2 changes: 1 addition & 1 deletion pygef/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.3"
__version__ = "0.7.0"
1 change: 0 additions & 1 deletion pygef/been_jefferies/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import unittest

import polars as pl

import pygef.been_jefferies.util as util


Expand Down
3 changes: 1 addition & 2 deletions pygef/been_jefferies/util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import numpy as np
import polars as pl
from polars import col, lit

import pygef.utils as utils
from polars import col, lit
from pygef import geo


Expand Down
7 changes: 3 additions & 4 deletions pygef/broxml.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import os.path
from abc import ABC
from datetime import datetime

import xmlschema
import numpy as np
import os.path

from datetime import datetime
import polars as pl
import xmlschema


class _BroXml(ABC):
Expand Down
36 changes: 1 addition & 35 deletions pygef/cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from pygef.base import Base
from pygef.broxml import _BroXmlCpt
from pygef.gef import _GefCpt
from pygef.grouping import GroupClassification

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -171,8 +170,6 @@ def classify(
water_level_wrt_depth=None,
p_a=0.1,
new=True,
do_grouping=False,
min_thickness=None,
):
"""
Classify each row of the cpt type.
Expand All @@ -189,18 +186,11 @@ def classify(
Atmospheric pressure. Default: 0.1 MPa.
new: bool, default:True
If True and the classification is robertson, the new(2016) implementation of robertson is used.
do_grouping: bool, optional for the classification
If True a group classification is added to the plot.
min_thickness: float, optional for the classification [m]
If specified together with the do_grouping set to True, a group classification is added to the plot.
The grouping is a simple algorithm that merge all the layers < min_thickness with the last above one > min_thickness.
In order to not make a big error do not use a value bigger then 0.2 m
Returns
-------
df: polars.DataFrame
If do_grouping is True a polars.DataFrame with the grouped layer is returned otherwise a polars.DataFrame
with a classification for each row is returned.
A polars.DataFrame with a classification for each row is returned.
"""
# todo: refactor arguments, the arguments connected to each other
Expand All @@ -213,12 +203,6 @@ def classify(
f"You did not input the water level, a default value of -1 m respect to the ground is used."
f" Change it using the kwagr water_level_NAP or water_level_wrt_depth."
)
if min_thickness is None:
min_thickness = 0.2
logger.warning(
f"You did not input the accepted minimum thickness, a default value of 0.2 m is used."
f" Change it using th kwarg min_thickness"
)

if classification == "robertson":
df = robertson.classify(
Expand All @@ -230,8 +214,6 @@ def classify(
pre_excavated_depth=self.pre_excavated_depth,
p_a=p_a,
)
if do_grouping:
return GroupClassification(self.zid, df, min_thickness).df_group
return df

elif classification == "been_jefferies":
Expand All @@ -242,8 +224,6 @@ def classify(
area_quotient_cone_tip=self.net_surface_area_quotient_of_the_cone_tip,
pre_excavated_depth=self.pre_excavated_depth,
)
if do_grouping:
return GroupClassification(self.zid, df, min_thickness).df_group
return df
else:
raise ValueError(
Expand All @@ -261,7 +241,6 @@ def plot(
show=False,
figsize=(11, 8),
df_group=None,
do_grouping=False,
grid_step_x=None,
dpi=100,
colors=None,
Expand Down Expand Up @@ -302,8 +281,6 @@ def plot(
Z value of the middle of the layer
- thickness
Thickness of the layer
do_grouping: bool, only for cpt type, optional for the classification
If True a group classification is added to the plot.
grid_step_x: float, only for cpt type, default: None
Grid step for qc and Fr subplots.
dpi: int
Expand All @@ -329,17 +306,6 @@ def plot(
new=new,
)

if df_group is None and do_grouping is True:
df_group = self.classify(
classification=classification,
water_level_NAP=water_level_NAP,
water_level_wrt_depth=water_level_wrt_depth,
p_a=p_a,
new=new,
do_grouping=True,
min_thickness=min_thickness,
)

return plot.plot_cpt(
df,
df_group,
Expand Down
3 changes: 1 addition & 2 deletions pygef/gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import numpy as np
import polars as pl
from polars import col, lit, when

import pygef.utils as utils
from polars import col, lit, when

# Try to import the optimized Rust header parsing but if that doesn't succeed
# use the built-in python regex methods
Expand Down
123 changes: 0 additions & 123 deletions pygef/grouping.py

This file was deleted.

1 change: 0 additions & 1 deletion pygef/robertson/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import numpy as np
import polars as pl

import pygef.robertson.util as util


Expand Down
1 change: 0 additions & 1 deletion pygef/robertson/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import polars as pl

import pygef.utils as utils
from pygef import geo

Expand Down
Loading

0 comments on commit accb81a

Please sign in to comment.