Ejemplo n.º 1
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list
        self._read(data_path=data_path)

        _, file_ext = os.path.splitext(data_path)
        file_ext = file_ext.lower()

        if file_ext == ".cnv":
            self.format = self.formats["CNV"]

        elif file_ext == ".tsv":
            self.format = self.formats["NAUTILUS"]

        else:
            raise RuntimeError("unknown format: %s" % self.format)

        self._parse_header()
        self._parse_body()

        self.fix()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 2
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list
        self.ssp.append()  # append a new profile

        # initialize probe/sensor type
        self.ssp.cur.meta.sensor_type = Dicts.sensor_types['CTD']
        self.ssp.cur.meta.probe_type = Dicts.probe_types['SeaAndSun']

        self._read(
            data_path=data_path,
            encoding='latin')  # Idronaut seems to have a specific encoding
        self._parse_header()
        self._parse_body()

        self.fix()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 3
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list

        self._read(data_path=data_path)
        self._parse_header()
        self._parse_body()

        # initialize probe/sensor type
        self.ssp.cur.meta.sensor_type = Dicts.sensor_types['CTD']
        self.ssp.cur.meta.probe_type = Dicts.probe_types['Simrad']

        self.fix()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 4
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list
        self.ssp.append()  # append a new profile

        self._read(data_path=data_path)
        self._parse_header()
        self._parse_body()

        self.fix()

        if self.ssp.cur.meta.probe_type not \
                in [Dicts.probe_types['MIDAS SVX2 1000'], Dicts.probe_types['MIDAS SVX2 3000']]:
            self.ssp.cur.calc_salinity()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 5
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list
        self.ssp.append()  # append a new profile

        # initialize probe/sensor type
        self.ssp.cur.meta.sensor_type = Dicts.sensor_types['XBT']
        self.ssp.cur.meta.probe_type = Dicts.probe_types['XBT']

        self._read(data_path=data_path)
        self._parse_header()
        self._parse_body()

        self.fix()
        if self.ssp.cur.data.sal.mean() == 0:  # future use
            self.ssp.cur.calc_salinity()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 6
0
    def read(self,
             data_path: str,
             settings: 'Setup',
             callbacks: 'AbstractCallbacks' = CliCallbacks(),
             progress: Optional['AbstractProgress'] = None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list
        self.ssp.append()  # append a new profile

        # initialize probe/sensor type
        self.ssp.cur.meta.probe_type = Dicts.probe_types['AML']

        self._read(data_path=data_path)
        self._path_ext = os.path.splitext(self.fid.path)[-1]
        self._parse_header()
        self._parse_body()

        self.fix()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 7
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.is_var_alpha = False
        self.input_salinity = None

        self.init_data()  # create a new empty profile list
        self.ssp.append()  # append a new profile

        self._read(data_path=data_path)
        self._parse_header()
        self._parse_body()

        self.fix()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 8
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):  # UNUSED
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list
        self.ssp.append()  # append a new profile

        _, file_ext = os.path.splitext(data_path)
        file_ext = file_ext.lower()

        if file_ext == ".asvp":
            self.format = self.formats["ASVP"]

        elif file_ext == ".calc":
            self.format = self.formats["CALC"]

        elif file_ext == ".s12":
            self.format = self.formats["S12"]

        elif file_ext == ".m1":
            self.format = self.formats["M1"]

        elif file_ext == ".s05":
            self.format = self.formats["S05"]

        elif file_ext == ".s52":
            self.format = self.formats["S52"]

        elif file_ext == ".s10":
            self.format = self.formats["S10"]

        else:
            raise RuntimeError("unknown format: %s" % self.format)

        # initialize probe/sensor type
        if self.format in [
                self.formats["CALC"], self.formats["M1"], self.formats["S10"]
        ]:
            self.ssp.cur.meta.sensor_type = Dicts.sensor_types["SVP"]
        else:
            self.ssp.cur.meta.sensor_type = Dicts.sensor_types["MVP"]
        self.ssp.cur.meta.probe_type = Dicts.probe_types["MVP"]
        self.ssp.cur.meta.original_path = data_path

        self._read(data_path=data_path)
        self._parse_header()
        self._parse_body()

        self.fix()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 9
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        """Common read function signature

        The settings is a container with all the library settings.
        The callback is a class that collects callback functions.
        """
        pass
Ejemplo n.º 10
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list

        self._read(data_path=data_path)
        self._parse_header()
        self._parse_body()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Ejemplo n.º 11
0
    def read(self,
             data_path,
             settings,
             callbacks=CliCallbacks(),
             progress=None):
        logger.debug('*** %s ***: start' % self.driver)

        self.s = settings
        self.cb = callbacks

        self.init_data()  # create a new empty profile list

        self._read(data_path=data_path)
        self._parse_header()
        self._parse_body()

        # initialize probe/sensor type
        self.ssp.cur.meta.sensor_type = Dicts.sensor_types['CTD']
        self.ssp.cur.meta.probe_type = Dicts.probe_types['OceanScience']

        # fix issue with lat and lon not being well defined (after email exchange with Teledyn OceanScience)
        # logger.debug("initial lat: %s, lon: %s" % (self.ssp.cur.meta.latitude, self.ssp.cur.meta.longitude))
        self.ssp.cur.meta.latitude, self.ssp.cur.meta.longitude = self.cb.ask_location(
            default_lat=self.ssp.cur.meta.latitude,
            default_lon=self.ssp.cur.meta.longitude)
        if (self.ssp.cur.meta.latitude is None) or (self.ssp.cur.meta.longitude
                                                    is None):
            self.ssp.clear()
            raise RuntimeError(
                "missing geographic location required for database lookup")

        self.fix()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True