Ejemplo n.º 1
0
    # from the super().__post_init__() call, therefore, caused an error that 1
    # positional argument (self) was specified, but 2 were given during the self.atts definition
    # in data_manager.DataSourceBase.__init__()
    # I resolved the problem (I think) using the example here:
    # https://stackoverflow.com/questions/66995998/how-can-i-take-the-variable-from-the-parent-class-constructor-and-use-it-in-the
    # after another post stated that an error like this could be caused by class override issues.
    def __post_init__(self, *args, **kwargs):
        """Validate user input.
        """
        super(PPDataSourceAttributes, self).__post_init__(*args, **kwargs)
        config = core.ConfigManager()


gfdlppDataManager_any_components_col_spec = data_manager.DataframeQueryColumnSpec(
    # Catalog columns whose values must be the same for all variables.
    expt_cols=data_manager.DataFrameQueryColumnGroup([]),
    pod_expt_cols=data_manager.DataFrameQueryColumnGroup([]),
    var_expt_cols=data_manager.DataFrameQueryColumnGroup(
        ['chunk_freq', 'component']),
    daterange_col="date_range")

gfdlppDataManager_same_components_col_spec = data_manager.DataframeQueryColumnSpec(
    # Catalog columns whose values must be the same for all variables.
    expt_cols=data_manager.DataFrameQueryColumnGroup([]),
    pod_expt_cols=data_manager.DataFrameQueryColumnGroup(['component']),
    var_expt_cols=data_manager.DataFrameQueryColumnGroup(['chunk_freq']),
    daterange_col="date_range")


class GfdlppDataManager(GFDL_GCP_FileDataSourceBase):
    # extends GFDL_GCP_FileDataSourceBase
Ejemplo n.º 2
0
        if not self.sample_dataset and self.CASENAME:
            log.debug("'sample_dataset' not supplied, using CASENAME = '%s'.",
                      self.CASENAME)
            self.sample_dataset = self.CASENAME
        # verify chosen subdirectory exists
        if not os.path.isdir(
                os.path.join(self.CASE_ROOT_DIR, self.sample_dataset)):
            log.critical(
                "Sample dataset '%s' not found in CASE_ROOT_DIR = '%s'.",
                self.sample_dataset, self.CASE_ROOT_DIR)
            util.exit_handler(code=1)


sampleLocalFileDataSource_col_spec = dm.DataframeQueryColumnSpec(
    # Catalog columns whose values must be the same for all variables.
    expt_cols=dm.DataFrameQueryColumnGroup(["sample_dataset"]))


class SampleLocalFileDataSource(dm.SingleLocalFileDataSource):
    """DataSource for handling POD sample model data stored on a local filesystem.
    """
    _FileRegexClass = SampleDataFile
    _AttributesClass = SampleDataAttributes
    _DiagnosticClass = diagnostic.Diagnostic
    _PreprocessorClass = preprocessor.SampleDataPreprocessor
    col_spec = sampleLocalFileDataSource_col_spec

    # map "name" field in VarlistEntry's query_attrs() to "variable" field here
    _query_attrs_synonyms = {'name': 'variable'}

    @property