コード例 #1
0
    def openData(self, path, concat=False):
        """
        It opens the netcdf of the path.

        Parameters
        ----------
            path: str or WaterFrame
                Path where the file is or WaterFrame object.
            concat: bool, optional (concat = False)
                It adds the new dataframe to the current dataframe.

        Returns
        -------
            True/False: bool
                It indicates if the operation is ok.
        """
        self.msg2Statusbar.emit("Opening data")
        if isinstance(path, str):
            # Obtain type of file
            extension = path.split(".")[-1]
            # Init ok
            ok = False
            wf_new = WaterFrame()
            if extension == "nc":
                ok = wf_new.from_netcdf(path)
            elif extension == "pkl":
                ok = wf_new.from_pickle(path)
            elif extension == "csv":
                try:
                    wf_new = EGIM.from_raw_csv("EMSO-Azores", path)
                    ok = True
                except:
                    ok = False
            if ok:
                # Check if we want actual data
                if not concat:
                    self.newWaterFrame()
                self.wf.concat(wf_new)

                self.msg2TextArea.emit("Working with file {}".format(path))
                # Add metadata information into metadataList
                self.addMetadata(self.wf.metadata)
                # Add other information
                self.otherInfoPlainText.setPlainText(repr(self.wf))
                # Add data information into dataList
                self.addData(self.wf.data)
                # Plot QC
                self.addQCBarPlot()
                self.msg2Statusbar.emit("Ready")
                return True
            else:
                self.msg2Statusbar.emit("Error opening data")
                return False
        else:
            # Path is a WaterFrame

            # Check if there is no data in the waterframe
            if path.data.empty:
                return False

            # Check if it is a dataframe of an acoustic data.
            # In this case, we are going to delete the previous dataframe.
            if "Sequence" in self.wf.data.keys():
                self.wf.clear()
            self.wf.concat(path)

            # Add data information into dataList
            self.addData(self.wf.data)
            self.addMetadata(self.wf.metadata)
            # Plot QC
            self.addQCBarPlot()
            return True
コード例 #2
0
    def open_data(self, path, concat=False):
        """
        It opens the netcdf of the path.

        Parameters
        ----------
            path: str or WaterFrame
                Path where the file is or WaterFrame object.
            concat: bool, optional (concat = False)
                It adds the new dataframe to the current dataframe.

        Returns
        -------
            True/False: bool
                It indicates if the operation is ok.
        """
        debug = True  # Variable for debug reasons

        if debug:
            print("In PlotSplitter.open_data():")
            print("  - Emit msg2statusbar: Opening data")

        self.msg2statusbar.emit("Opening data")
        if isinstance(path, str):
            if debug:
                print("  - path is a string:", path)
            # Obtain type of file
            extension = path.split(".")[-1]
            # Init ok
            ok = False  # pylint: disable=C0103
            wf_new = WaterFrame()
            if extension == "nc":
                ok = wf_new.from_netcdf(path)  # pylint: disable=C0103
            elif extension == "pkl":
                ok = wf_new.from_pickle(path)  # pylint: disable=C0103
            if ok:
                # Check if we want actual data
                if not concat:
                    self.new_waterframe()
                self.wf.concat(wf_new)

                self.msg2TextArea.emit("Working with file {}".format(path))
                # Add metadata information into metadataList
                self.add_metadata(self.wf.metadata)
                # Add other information
                self.other_info_plain_text.setPlainText(repr(self.wf))
                # Add data information into data_list
                self.add_data(self.wf.data)
                # Plot QC
                self.add_qc_bar_plot()
                self.msg2statusbar.emit("Ready")
                if debug:
                    print("  - Emit msg2statusbar: Ready")
                    print("  - Exit from PlotSplitter.open_data()")
                return True
            else:
                self.msg2statusbar.emit("Error opening data")
                if debug:
                    print("  - Emit msg2statusbar: Error opening data")
                    print("  - Exit from PlotSplitter.open_data()")
                return False
        else:
            # Path is a WaterFrame
            if debug:
                print("  - path is a WaterFrame")
                print(path)
            # Check if there is no data in the waterframe
            if path.data.empty:
                return False

            # Check if it is a dataframe of an acoustic data.
            # In this case, we are going to delete the previous dataframe.
            if "Sequence" in self.wf.data.keys():
                self.wf.clear()
            self.wf.concat(path)

            # Add data information into data_list
            self.add_data(self.wf.data)
            self.add_metadata(self.wf.metadata)
            # Add other information
            self.other_info_plain_text.setPlainText(repr(self.wf))
            # Plot QC
            self.add_qc_bar_plot()
            return True
コード例 #3
0
from mooda import WaterFrame
import matplotlib.pyplot as plt
import matplotlib.style as style

style.use('ggplot')

path = r"./docs/example_data/bad_temp.pkl"

wf = WaterFrame()
wf.from_pickle(path)

print(wf.parameters())

wf.reset_flag(key='TEMP')
wf.qcplot('TEMP')
plt.show()

wf.spike_test(key='TEMP', flag=4)
wf.range_test(key='TEMP', flag=2)
wf.flat_test(key='TEMP', flag=3)
wf.flag2flag(key="TEMP")

wf.qcplot('TEMP')
plt.show()

wf.qcbarplot('TEMP')
plt.show()