コード例 #1
0
def map_array_element(process):
    """
    
    """
    
    if 'label' in process['arguments'] and 'index' in process['arguments']:
        # TODO raise openEO error: ArrayElementParameterConflict
        msg = "Only one parameter between 'label' and 'index' may be specified. See https://processes.openeo.org/#array_element."
        raise(msg)
    if not 'label' in process['arguments'] and not 'index' in process['arguments']:
        # ODO raise openEO error: ArrayElementParameterMissing
        msg = "One parameter between 'label' and 'index' must be specified. See https://processes.openeo.org/#array_element."
        raise(msg)
    
    process_params = {}
    if 'index' in process['arguments']:
        process_params['index'] = 'int'
    elif 'label' in process['arguments']:
        if isinstance(process['arguments']['label'], int):
            process_params['label'] = 'int'
        elif isinstance(process['arguments']['label'], str):
            process_params['label'] = 'str'
    process_params['return_nodata'] = 'bool'

    return map_default(process, 'array_element', 'reduce', process_params)
コード例 #2
0
def map_and(process):
    """

    """

    param_dict = {'y': 'bool'}

    return map_default(process, 'and_', 'reduce', param_dict)
コード例 #3
0
def map_exp(process):
    """
    
    """
    
    param_dict = {'p': 'float'}
    
    return map_default(process, 'exp', 'apply', param_dict)
コード例 #4
0
def map_mod(process):
    """
    
    """
    
    param_dict = {'y': 'float'}
    
    return map_default(process, 'mod', 'apply', param_dict)
コード例 #5
0
def map_not(process):
    """

    """

    param_dict = {'y': 'bool'}

    return map_default(process, 'not_', 'apply', param_dict)
コード例 #6
0
def map_divide(process):
    """
    
    """
    
    param_dict = {'y': 'float'}
    
    return map_default(process, 'divide', 'reduce', param_dict)
コード例 #7
0
def map_round(process):
    """
    
    """
    
    param_dict = {'p': 'int'}
    
    return map_default(process, 'round', 'apply', process_params)
コード例 #8
0
def map_variance(process):
    """
    
    """
    
    param_dict = {'ignore_nodata': 'bool'}
    
    return map_default(process, 'variance', 'reduce', param_dict)
コード例 #9
0
def map_subtract(process):
    """
    
    """
    
    param_dict = {'y': 'float'}
    
    return map_default(process, 'subtract', 'reduce', param_dict)
コード例 #10
0
def map_power(process):
    """
    
    """
    
    param_dict = {'p': 'float'}
    
    return map_default(process, 'power', 'apply', param_dict)
コード例 #11
0
def map_median(process):
    """
    
    """
    
    param_dict = {'ignore_nodata': 'bool'}
    
    return map_default(process, 'median', 'reduce', param_dict)
コード例 #12
0
def map_gte(process):
    """

    """

    param_dict = {'y': 'float'}

    return map_default(process, 'gte', 'apply', param_dict)
コード例 #13
0
def map_xor(process):
    """

    """

    param_dict = {'y': 'bool'}

    return map_default(process, 'xor_', 'reduce', param_dict)
コード例 #14
0
def map_sum(process):
    """
    
    """
    
    process_params1 = set_extra_values(process['arguments'])
    process_params2 = get_process_params(process['arguments'], {'ignore_nodata': 'bool'})
        
    return map_default(process, 'sum', 'reduce', {**process_params1, **process_params2})    
コード例 #15
0
def map_linear_scale_range(process):
    """
    
    """
    
    param_dict = {'inputMin': ['input_min', 'float'], 'inputMax': ['input_max', 'float'],
                  'outputMin': ['output_min', 'float'], 'outputMax': ['output_max', 'float']}
    
    return map_default(process, 'linear_scale_range', 'apply', param_dict)
コード例 #16
0
def map_if(process):
    """

    """

    param_dict = get_process_params(process['arguments'],
                                    {'ignore_nodata': 'bool'})

    return map_default(process, 'if_', 'reduce', param_dict)
コード例 #17
0
def map_product(process):
    """
    openEO process "product" is an alias for "multiply".
    
    """

    process_params1 = set_extra_values(process['arguments'])
    process_params2 = get_process_params(process['arguments'], {'ignore_nodata': 'bool'})
    
    return map_default(process, 'product', 'reduce', {**process_params1, **process_params2})
コード例 #18
0
def map_mask(process):
    """

    """

    param_dict = {
        'mask': 'int',
        'replacement': 'float'
    }

    return map_default(process, 'mask', 'reduce', param_dict)
コード例 #19
0
def map_quantiles(process):
    """
    
    """
    
    param_dict = {
        'probabilities': 'list', # list of float
        'q': 'int',
        'ignore_nodata': 'bool'
        }
    
    return map_default(process, 'quantiles', 'apply', param_dict)
コード例 #20
0
def map_eq(process):
    """

    """

    param_dict = {'y': 'numpy.array'}
    # NOTE: how to map type dynamically to support strings?
    if 'delta' in process['arguments']:
        param_dict['delta'] = 'int'
    if 'case_sensitive' in process['arguments']:
        param_dict['case_sensitive'] = 'bool'

    return map_default(process, 'eq', 'apply', param_dict)
コード例 #21
0
def map_clip(process):
    """
    
    """
    
    param_dict = {'min': ['min_x', 'float'],
                  'max': ['max_x', 'float']}
    # NOTE some python processes have different param names compared to the openEO process
    # see e.g. "clip"
    # https://github.com/Open-EO/openeo-processes-python/blob/master/src/openeo_processes/math.py
    # https://processes.openeo.org/#clip
    
    return map_default(process, 'clip', 'apply', param_dict)
コード例 #22
0
def map_log(process):
    """
    
    """
    
    if 'base' in process['arguments'].keys():
        base = str(process['arguments']['ignore_nodata'])
    else:
        base = None
    
    process_params = {}
    process_params['base'] = ignore_nodata + ';float'
    
    return map_default(process, 'log', 'apply', process_params)
コード例 #23
0
def map_int(process):
    """
    
    """
    
    return map_default(process, 'int', 'apply')
コード例 #24
0
def map_absolute(process):
    """
    
    """
    
    return map_default(process, 'absolute', 'apply')
コード例 #25
0
def map_tanh(process):
    """
    
    """
    
    return map_default(process, 'tanh', 'apply')
コード例 #26
0
def map_sinh(process):
    """
    
    """
    
    return map_default(process, 'sinh', 'apply')
コード例 #27
0
def map_cosh(process):
    """
    
    """
    
    return map_default(process, 'cosh', 'apply')
コード例 #28
0
def map_arctan2(process):
    """
    
    """
        
    return map_default(process, 'arctan2', 'apply')
コード例 #29
0
def map_arcsin(process):
    """
    
    """
        
    return map_default(process, 'arcsin', 'apply')
コード例 #30
0
def map_arccos(process):
    """
    
    """
        
    return map_default(process, 'arccos', 'apply')