Пример #1
0
 def call(self, args):
     kwargs = {}
     if 'time' in args:
         kwargs['time'] = args['time'].split('/')
     if 'space' in args:
         kwargs['space'] = [
             float(item) for item in args['space'].split(',')
         ]
     if 'data_ref' in args:
         kwargs['data_refs'] = args['data_ref']
     kwargs.update(self.config)
     kwargs['output_dir'] = tempfile.mkdtemp(dir=self.config['output_dir'],
                                             prefix='subset_')
     result = daops.subset(**kwargs, )
     return result.file_paths
Пример #2
0
    def _handler(self, request, response):
        data_refs = [dref.data for dref in request.inputs['data_ref']]
        if request.inputs['pre_checked'][0].data and not daops.is_characterised(data_refs, require_all=True):
            raise ProcessError('Data has not been pre-checked')

        config_args = {
            'data_root_dir': configuration.get_config_value("data", "cmip5_archive_root"),
            'output_dir': self.workdir,
            # 'chunk_rules': dconfig.chunk_rules,
            # 'filenamer': dconfig.filenamer,
        }
        kwargs = translate_args(request)
        kwargs.update(config_args)

        result = daops.subset(data_refs, **kwargs)
        response.outputs['output'].file = result.file_paths[0]
        return response
Пример #3
0
def test_subset_t_with_invalid_date():
    result = daops.subset(CMIP5_IDS[1],
                          time=('2085-01-01', '2120-12-31'),
                          data_root_dir=CMIP5_ARCHIVE_BASE,
                          output_dir='outputs')
Пример #4
0
def test_subset_t_y_x():
    result = daops.subset(CMIP5_IDS[1],
                          time=('2085-01-01', '2120-12-30'),
                          space=('-20', '-10', '5', '15'),
                          data_root_dir=CMIP5_ARCHIVE_BASE,
                          output_dir='outputs')
Пример #5
0
def test_subset_t():
    result = daops.subset(CMIP5_IDS[1],
                          time=('2085-01-01', '2120-12-30'),
                          data_root_dir=CMIP5_ARCHIVE_BASE,
                          output_dir='outputs')
    assert result.file_paths == ['outputs/output.nc']