예제 #1
0
    def validate_config(self, configpath, specspath):
        config = ConfigUtil.load_config(configpath)
        specs = ConfigUtil.load_specs(specspath)
        config = ConfigUtil.verify_config(specs, config)

        steps = config['select']['steps']
        if 86400 % steps:
            raise ValueError(
                'Parameter "run.steps" must divide 86400 but '
                f'found {steps} (86400 % {steps} = {86400 % steps}).')

        if len(config['run']['tmin']) != len(config['run']['tmax']):
            raise RuntimeError(
                'The number of "tmin" and "tmax" files must match.')

        files = zip(config['run']['tmax'], config['run']['tmin'])
        for tmax_file, tmin_file in files:
            tmaxnc = Dataset(tmax_file, 'r')
            tminnc = Dataset(tmin_file, 'r')
            if tmaxnc.variables['tmax'].shape != tminnc.variables['tmin'].shape:
                raise RuntimeError(
                    f'Tmax file "{tmax_file}" dimension does not '
                    f'match with that of tmin file "{tmin_file}".')

        return config
예제 #2
0
    def validate_config(self, configpath, specspath):
        config = ConfigUtil.load_config(configpath)
        specs = ConfigUtil.load_specs(specspath)
        config = ConfigUtil.verify_config(specs, config)

        return config