Esempio n. 1
0
                        raise Exception( "Input ID '%s' syntax error: %s" % ( inputID, str(err) ) )
                elif inputID == "*":
                    for input_dset in request.data.values:
                        input_dataset.append( input_dset )
                else:
                    input_dataset.append( request.data.getValue( inputID ) )
        else:
            input_dataset = request.data.values

        for data in input_dataset:
            if data is not None:
                region_id = data['domain']
                region = regions.getValue( region_id, True )
                if cache_type == CachedVariable.CACHE_OP:
                    dslice = operation.get('slice',None)
                    if dslice: region = Region( region, slice=dslice )
                variable, data_spec, cached_region = self.dataManager.loadVariable( data, region, cache_type )
                if (region is not None) and (cached_region <> region):
                    subset_args = region.toCDMS(variable)
                    variable = numpy.ma.fix_invalid( variable( **subset_args ) )
        #            wpsLog.debug( " $$$ Subsetting variable: args = %s\n >> in = %s\n >> out = %s " % ( str(subset_args), str(variable.squeeze().tolist()), str(subset_var.squeeze().tolist()) ))
        #        data_spec['data.region'] = region
                data_spec['embedded'] = embedded
                if result_names is not None: data_spec['result_name'] = result_names[ op_index ]
                variables.append( variable )
                data_specs.append( data_spec )
            else:
                raise Exception( "Can't find data matching operation input '%s'", inputID)
        read_end_time = time.time()
        wpsLog.debug( " $$$ DATA READ Complete: %.2f, data_specs: %s " % ( (read_end_time-read_start_time), str(data_specs) ) )
        return variables, data_specs
Esempio n. 2
0
                        raise Exception( "Input ID '%s' syntax error: %s" % ( inputID, str(err) ) )
                elif inputID == "*":
                    for input_dset in request.data.values:
                        input_dataset.append( input_dset )
                else:
                    input_dataset.append( request.data.getValue( inputID ) )
        else:
            input_dataset = request.data.values

        for data in input_dataset:
            if data is not None:
                region_id = data['domain']
                region = regions.getValue( region_id, True )
                if cache_type == CachedVariable.CACHE_OP:
                    dslice = operation.get('slice',None)
                    if dslice: region = Region( region, slice=dslice )
                variable, data_spec, cached_region = self.dataManager.loadVariable( data, region, cache_type )
                if (region is not None) and (cached_region <> region):
                    subset_args = region.toCDMS()
                    variable = numpy.ma.fix_invalid( variable( **subset_args ) )
        #            wpsLog.debug( " $$$ Subsetting variable: args = %s\n >> in = %s\n >> out = %s " % ( str(subset_args), str(variable.squeeze().tolist()), str(subset_var.squeeze().tolist()) ))
        #        data_spec['data.region'] = region
                data_spec['embedded'] = embedded
                if result_names is not None: data_spec['result_name'] = result_names[ op_index ]
                variables.append( variable )
                data_specs.append( data_spec )
            else:
                raise Exception( "Can't find data matching operation input '%s'", inputID)
        read_end_time = time.time()
        wpsLog.debug( " $$$ DATA READ Complete: %.2f, data_specs: %s " % ( (read_end_time-read_start_time), str(data_specs) ) )
        return variables, data_specs