Exemplo n.º 1
0
    def plot(
        self,
        classification=None,
        water_level_NAP=None,
        water_level_wrt_depth=None,
        min_thickness=None,
        p_a=0.1,
        new=True,
        show=False,
        figsize=(11, 8),
        df_group=None,
        grid_step_x=None,
        dpi=100,
        colors=None,
        z_NAP=False,
    ):
        """
        Plot the cpt file and return matplotlib.pyplot.figure .

        Parameters
        ----------
        classification: str, only for cpt type
            If classification ("robertson", "been_jefferies") is specified a subplot is added with the classification
            for each cpt row.
        water_level_NAP: float, only for cpt type, necessary for the classification: give this or water_level_wrt_depth
            Water level with respect to NAP
        water_level_wrt_depth: float, only for cpt type, necessary for the classification: give this or water_level_NAP
            Water level with respect to the ground_level [0], it should be a negative value.
        min_thickness: float, only for cpt type, 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
        p_a: float, only for cpt type, optional for the classification
            Atmospheric pressure. Default: 0.1 MPa.
        new: bool, only for cpt type, optional for the classification default:True
            If True and the classification is robertson, the new(2016) implementation of robertson is used.
        show: bool
            If True the plot is showed, else the matplotlib.pytplot.figure is returned
        figsize: tuple
            Figsize of the plot, default (11, 8).
        df_group: polars.DataFrame, only for cpt type, optional for the classification
            Use this argument to plot a defined soil layering next to the other subplots.
            It should contain the columns:
                - layer
                    Name of layer, should be either BeenJefferies of Robertson soil type,
                    if it is different then also the argument colors should be passed.
                - z_centr_NAP
                    Z value of the middle of the layer
                - thickness
                    Thickness of the layer
        grid_step_x: float, only for cpt type, default: None
            Grid step for qc and Fr subplots.
        dpi: int
            Dpi figure
        colors: dict
            Dictionary containing the colors associated to each soil type, if specified
        z_NAP: bool
            If True the Z-axis is with respect to NAP.
        Returns
        -------
        matplotlib.pyplot.figure
        """
        # todo: refactor arguments, the arguments connected to each other should
        #  be given as a dict or tuple, check order
        if classification is None:
            df = self.df
        else:
            df = self.classify(
                classification=classification,
                water_level_NAP=water_level_NAP,
                water_level_wrt_depth=water_level_wrt_depth,
                p_a=p_a,
                new=new,
            )

        return plot.plot_cpt(
            df,
            df_group,
            classification,
            show=show,
            figsize=figsize,
            grid_step_x=grid_step_x,
            colors=colors,
            dpi=dpi,
            z_NAP=z_NAP,
        )
Exemplo n.º 2
0
    def plot(
        self,
        classification=None,
        water_level_NAP=None,
        water_level_wrt_depth=None,
        min_thickness=None,
        p_a=0.1,
        new=True,
        show=False,
        figsize=(11, 8),
        df_group=None,
        do_grouping=False,
        grid_step_x=None,
        dpi=100,
        colors=None,
        z_NAP=False,
    ):
        """
        Plot cpt and return matplotlib figure.

        :param classification: (str) Specify this to classify the cpt, possible choice : "robertson", "been_jefferies".
        :param water_level_NAP: (float)
        :param water_level_wrt_depth: (float)
        :param min_thickness: (float) Minimum accepted thickness for grouping.
        :param p_a: (float) Atmospheric pressure at ground level in MPa.
        :param new: (bool) Old(1990) or New(2016) implementation of Robertson.
        :param show: (bool) Set to True to show the plot.
        :param figsize: (tpl) Figure size (x, y).
        :param df_group: (DataFrame) Specify your own DataFrame if you don't agree with the automatic one.
        :param do_grouping: (bool) Plot the grouping if True.
        :param grid_step_x: (int) Grid step of x-axes qc.
        :param dpi: (int) Matplotlib dpi settings.
        :param colors: (dict) Dictionary with soil type and related color, use this to plot your own classification.
        :param z_NAP: (bool) True to plot the z-axis with respect to NAP. Default: False.
        :return: matplotlib Figure.
        """
        if self.type == "cpt":
            if classification is None:
                df = self.df
            else:
                df = self.classify(
                    classification=classification,
                    water_level_NAP=water_level_NAP,
                    water_level_wrt_depth=water_level_wrt_depth,
                    p_a=p_a,
                    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,
                classification,
                show=show,
                figsize=figsize,
                grid_step_x=grid_step_x,
                colors=colors,
                dpi=dpi,
                z_NAP=z_NAP,
            )

        elif self.type == "bore":
            return plot.plot_bore(self.df, figsize=figsize, show=show, dpi=dpi)

        else:
            raise ValueError(
                "The selected gef file is not a cpt nor a borehole. "
                "Check the REPORTCODE or the PROCEDURECODE.")