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)
def map_and(process): """ """ param_dict = {'y': 'bool'} return map_default(process, 'and_', 'reduce', param_dict)
def map_exp(process): """ """ param_dict = {'p': 'float'} return map_default(process, 'exp', 'apply', param_dict)
def map_mod(process): """ """ param_dict = {'y': 'float'} return map_default(process, 'mod', 'apply', param_dict)
def map_not(process): """ """ param_dict = {'y': 'bool'} return map_default(process, 'not_', 'apply', param_dict)
def map_divide(process): """ """ param_dict = {'y': 'float'} return map_default(process, 'divide', 'reduce', param_dict)
def map_round(process): """ """ param_dict = {'p': 'int'} return map_default(process, 'round', 'apply', process_params)
def map_variance(process): """ """ param_dict = {'ignore_nodata': 'bool'} return map_default(process, 'variance', 'reduce', param_dict)
def map_subtract(process): """ """ param_dict = {'y': 'float'} return map_default(process, 'subtract', 'reduce', param_dict)
def map_power(process): """ """ param_dict = {'p': 'float'} return map_default(process, 'power', 'apply', param_dict)
def map_median(process): """ """ param_dict = {'ignore_nodata': 'bool'} return map_default(process, 'median', 'reduce', param_dict)
def map_gte(process): """ """ param_dict = {'y': 'float'} return map_default(process, 'gte', 'apply', param_dict)
def map_xor(process): """ """ param_dict = {'y': 'bool'} return map_default(process, 'xor_', 'reduce', param_dict)
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})
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)
def map_if(process): """ """ param_dict = get_process_params(process['arguments'], {'ignore_nodata': 'bool'}) return map_default(process, 'if_', 'reduce', param_dict)
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})
def map_mask(process): """ """ param_dict = { 'mask': 'int', 'replacement': 'float' } return map_default(process, 'mask', 'reduce', param_dict)
def map_quantiles(process): """ """ param_dict = { 'probabilities': 'list', # list of float 'q': 'int', 'ignore_nodata': 'bool' } return map_default(process, 'quantiles', 'apply', param_dict)
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)
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)
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)
def map_int(process): """ """ return map_default(process, 'int', 'apply')
def map_absolute(process): """ """ return map_default(process, 'absolute', 'apply')
def map_tanh(process): """ """ return map_default(process, 'tanh', 'apply')
def map_sinh(process): """ """ return map_default(process, 'sinh', 'apply')
def map_cosh(process): """ """ return map_default(process, 'cosh', 'apply')
def map_arctan2(process): """ """ return map_default(process, 'arctan2', 'apply')
def map_arcsin(process): """ """ return map_default(process, 'arcsin', 'apply')
def map_arccos(process): """ """ return map_default(process, 'arccos', 'apply')