Beispiel #1
0
def test_path_config():
    dataset = ('GLDAS21', 'core')
    conf = PathConfig(dataset, path_settings[dataset])
    assert conf.os in ['win', 'lin']
    # this should fall back to testdata if not on GEO:
    path = conf.load_path(ignore_path_groups=None)
    assert os.path.exists(path)
Beispiel #2
0
    def __init__(self, dataset_or_path, exact_index=False,
                 force_path_group=None, **kwargs):

        # TODO:
            # freqband 0=invalid, 16=C_band_1, 32=C_band_2, 32=C_band_
        """
        Parameters
        ----------
        dataset_or_path : tuple or str
            e.g. ('C3S', 'v201812', 'COMBINED', 'TCDR')
        force_path_group : str, optional (default: None)
            Select a specific path group from the path config to read.
        kwargs :
            kwargs that are passed to load_path and to initialise the reader.
        """
        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        if 'parameters' in kwargs.keys():
            self.parameters = kwargs.pop('parameters')
        else:
            self.parameters = None

        self.dataset = dataset_or_path
        path_config = path_settings[self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoCCIDsAmsr2Ts, self).__init__(ts_path, custom_dtype=None, **kwargs)

        self.exact_index = exact_index
        if self.exact_index and (self.parameters is not None):
            self.parameters.append(self._t0)
Beispiel #3
0
    def __init__(self,
                 dataset_or_path,
                 network=None,
                 force_path_group=None,
                 scale_factors=None):
        """
        Initialize the reader for ISMN data

        Parameters
        ----------
        dataset_or_path : tuple or str
            Dataset that is implemented in a path config. Or a path directly,
            where the data is stored.
        network : string or list, optional
            Provide name of network to only load the given network
        force_path_group : str, optional (default: None)
            For a certain path group to load the data from.
        scale_factors : dict, optional (default:None)
            Apply the passed multiplicative scales to the selected columns
        """
        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path
        self.network = network
        path_config = path_settings[
            self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)

        self.scale_factors = scale_factors
        super(GeoISMNTs, self).__init__(ts_path, network=self.network)

        self.metapath = os.path.join(self.root.root_dir, 'python_metadata')
Beispiel #4
0
    def __init__(self, dataset_or_path, force_path_group=None, **kwargs):

        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path

        path_config = path_settings[
            self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)
        super(GeoSMOSICTs, self).__init__(ts_path, **kwargs)
Beispiel #5
0
    def __init__(self, dataset_or_path, force_path_group=None):

        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path
        path_config = path_settings[self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoScatSarSWIDrypanAbsReader, self).__init__(
            path=path, smart_filename_class=SCATSARSWIDrypanAbsFilename)
    def __init__(self,
                 dataset_or_path,
                 force_path_group=None,
                 grid_sampling=500,
                 tval=5):

        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path
        path_config = path_settings[
            self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoScatSarCglsSwiReader,
              self).__init__(path, grid_sampling=grid_sampling, tval=tval)
Beispiel #7
0
    def __init__(self,
                 dataset_or_path,
                 force_path_group=None,
                 grid_sampling=500):

        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path
        path_config = path_settings[
            self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoCSarSsmTiffReader, self).__init__(path,
                                                   grid_sampling=grid_sampling,
                                                   param_rename='ssm')
Beispiel #8
0
    def __init__(self, dataset_or_path, force_path_group=None, **kwargs):
        """
        Parameters
        ----------
        dataset : tuple or string
            e.g. ('C3S', 'v201812', 'COMBINED', 'TCDR')
        force_path_group : str, optional (default: None)
            Select a specific path group from the path config to read.
        kwargs :
            kwargs that are passed to load_path and to initialise the reader.
        """
        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path
        path_config = path_settings[self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoC3Sv201912Ts, self).__init__(ts_path, **kwargs)
Beispiel #9
0
    def __init__(self,
                 dataset_or_path,
                 exact_index=False,
                 force_path_group=None,
                 **kwargs):

        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path

        path_config = path_settings[
            self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoCCISMv6Ts, self).__init__(ts_path, **kwargs)

        self.exact_index = exact_index
        if exact_index and (self.parameters is not None):
            self.parameters.append(self._t0)
Beispiel #10
0
    def __init__(self, dataset_or_path, force_path_group=None, **kwargs):
        """
        Parameters
        ----------
        dataset_or_path : tuple or str
            e.g. ('HSAF_ASCAT', 'SSM', 'H115+H116')
        force_path_group : str, optional (default: None)
            Select a specific path group from the path config to read.
        kwargs :
            kwargs that are passed to load_path and to initialise the reader.
        """
        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path
        path_config = path_settings[
            self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoHsafAscatSMDASTs, self).__init__(ts_path, **kwargs)
    def __init__(self, dataset_or_path, exact_index=False, force_path_group=None,
                 parameters=None, **kwargs):

        if exact_index:
            raise NotImplementedError

        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        if isinstance(parameters, str):
            parameters = [parameters]

        self.parameters = parameters
        self.dataset = dataset_or_path

        path_config = path_settings[self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoCCISMv6GenioTs, self).__init__(ts_path, **kwargs)

        self.exact_index = exact_index
Beispiel #12
0
    def __init__(self, dataset_or_path, exact_index=False, force_path_group=None,
                 **kwargs):
        """
        Parameters
        ----------
        dataset : tuple or str
            e.g. ('C3S', 'v201706', 'COMBINED', 'TCDR') or path as string
        kwargs
        """
        if isinstance(dataset_or_path, list):
            dataset_or_path = tuple(dataset_or_path)

        self.dataset = dataset_or_path
        path_config = path_settings[self.dataset] if self.dataset in path_settings.keys() else None
        self.path_config = PathConfig(self.dataset, path_config)
        ts_path = self.path_config.load_path(force_path_group=force_path_group)

        super(GeoC3Sv201706Ts, self).__init__(ts_path, **kwargs)

        self.exact_index = exact_index
        if exact_index and (self.parameters is not None):
            self.parameters.append(self._t0_ref[0])