예제 #1
0
from mooda import WaterFrame

# Path where CTD file is
path = r"C:\Users\rbard\Google Drive\Work\EmsoDev\server\ejemplos web\megakit - mio\data\obsea\OS_OBSEA_2016120120170426_R_4381-606.nc"

wf = WaterFrame()
wf.from_netcdf(path)

print(wf)

# Resample 2 hourly
# wf.resample('2H')

# Slice
# wf.slice_time("20170327000000", "20170423000000")

mean = wf.mean('DOX2')
index, max_waves = wf.max('DOX2')
index2, min_waves = wf.min('DOX2')

print(index)
print(index2)
# print(max_waves)
# print(min_waves)
# print("Marea:", (max_waves - min_waves)/2)
예제 #2
0
# Path of files
# Where the files are:
path_location = r"C:\Users\rbard\Desktop\Azores EGIM Data"
# Where to save the result:
save_location = r"C:\Users\rbard\Google Drive\Work\EmsoDev\server\www\html\graphs\azores"

path_files = glob.glob(path_location)

df = []
for path_file in path_files:

    # Load data into a WaterFrame
    print("Loading data")
    wf = WaterFrame()
    wf.from_netcdf(path_file)
    print("Done")
    print(wf)

    # Resample data hourly
    print("Resampling data")
    wf.resample("H")
    print("Done")

    # Obtain one of the parameters
    parameter = wf.parameters()[0]

    intervals = wf.datetime_intervals(parameter)

    if "R_4381-606" in path_file:
        instrument = "Turbidimeter"
예제 #3
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
예제 #4
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
예제 #5
0
# Path of files
# Where the files are:
path_location = r"C:\Users\rbard\Desktop\Azores EGIM Data"
path_data = path_location + r"\turbidity.csv"
path_data = r"C:\Users\rbard\Desktop\Azores EGIM Data\Oximeter.csv"
# Where to save the result:
save_location = r"C:\Users\rbard\Google Drive\Work\EmsoDev\server\www\html\graphs\azores"
save_start = r"\OXI-"
end_save = r"-AZORES.html"

# Load data into a WaterFrame
print("Loading data")
if path_data[-1] == 'c':
    wf = WaterFrame()
    wf.from_netcdf(path_data)
elif path_data[-1] == 'v':
    print(path_data)
    wf = EGIM.from_raw_csv(observatory="EMSO-Azores", path=path_data)
print("Done")
print(wf)

# Check parameters
parameters = wf.parameters()

# Resample data hourly
print("Resampling data")
wf.resample("H")
print("Done")

wf.slice_time(start="20170725000000", end="20180811000000")