Esempio n. 1
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
Esempio 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.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
Esempio 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.ssp.append()  # append a new profile

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

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

        self.fix()
        # self.ssp.cur.calc_data_depth()
        self.finalize()

        logger.debug('*** %s ***: done' % self.driver)
        return True
Esempio 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._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
Esempio 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

        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
Esempio n. 6
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['Idronaut']

        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
Esempio 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.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
Esempio n. 8
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