def test_map_mask(eodatareaders_file, eodatareaders_params): """ """ S2_filepath, mask_filepath = create_mask(eodatareaders_file, eodatareaders_params, mask_val=1000) # Remove filter_bands and crop from params (done when creting mask) eodatareaders_params = [eodatareaders_params[0]] process = { "process_id": "mask", "arguments": { "data": { "from_node": "node_1" }, "mask": { "from_node": "node_2" }, "replacement": 0 } } process['wrapper_dimension'] = 'band' params = map_mask(process) eodatareaders_params.extend(params) eo = EODataProcessor([S2_filepath, mask_filepath], eodatareaders_params) assert eo.get_data(band='mask')[0, 0] == 0 assert eo.get_data(band='mask')[-1, -1] == 2567
def test_map_eq(eodatareaders_file, eodatareaders_params): process = [ { "process_id": "eq", "arguments": { "x": {"from_node": "node_1"}, "y": 576, } }, { "process_id": "eq", "arguments": { "x": {"from_node": "node_1"}, "y": 577, "delta": 1 } } ] for proc in process: eodatareaders_params2 = deepcopy(eodatareaders_params) params = map_eq(proc) eodatareaders_params2.extend(params) eo = EODataProcessor([eodatareaders_file], eodatareaders_params2) assert eo.get_data(band='B04')[0,0] == 576 and eo.get_data(band='eq')[0,0] == 1
def test_map_absolute(eodatareaders_file, eodatareaders_params): process = { "process_id": "absolute", "arguments": { "x": { "from_node": "dc" } } } params = map_absolute(process) eodatareaders_params.extend(params) eo = EODataProcessor([eodatareaders_file], eodatareaders_params) assert eo.get_data(band='absolute')[0, 0] == 576
def test_map_multiply(eodatareaders_file, eodatareaders_params): factor = 10 process = { "process_id": "multiply", "arguments": { "x": { "from_node": "dc" }, "y": factor } } params = map_multiply(process) eodatareaders_params.extend(params) eo = EODataProcessor([eodatareaders_file], eodatareaders_params) assert eo.get_data(band='multiply')[0, 0] == 576 * factor
def test_map_divide(eodatareaders_file, eodatareaders_params): factor = 10 process = { "process_id": "divide", "arguments": { "x": { "from_node": "dc" }, "y": factor } } process['wrapper_dimension'] = 'band' params = map_divide(process) eodatareaders_params.extend(params) eo = EODataProcessor([eodatareaders_file], eodatareaders_params) assert eo.get_data(band='divideB04')[0, 0] == np.float32(576 / factor)
def test_map_absolute(eodatareaders_file, eodatareaders_params): process = { "process_id": "clip", "arguments": { "x": { "from_node": "dc" }, "min": 600, "max": 900 } } params = map_clip(process) eodatareaders_params.extend(params) eo = EODataProcessor([eodatareaders_file], eodatareaders_params) assert np.min(eo.get_data(band='clip')) == 600 assert np.max(eo.get_data(band='clip')) == 900
def test_map_linear_scale_range(eodatareaders_file, eodatareaders_params): process = { "process_id": "linear_scale_range", "arguments": { "x": { "from_node": "dc" }, "inputMin": 0, "inputMax": 65535 } } params = map_linear_scale_range(process) eodatareaders_params.extend(params) eo = EODataProcessor([eodatareaders_file], eodatareaders_params) assert np.min( eo.get_data(band='linearscalerange')) == np.float32(0.004303044) assert np.max( eo.get_data(band='linearscalerange')) == np.float32(0.31313038)
def test_map_lt(eodatareaders_file, eodatareaders_params): process = { "process_id": "lt", "arguments": { "x": {"from_node": "node_1"}, "y": 567, } } params = map_lt(process) eodatareaders_params.extend(params) eo = EODataProcessor([eodatareaders_file], eodatareaders_params) assert eo.get_data(band='B04')[0,0] == 576 and eo.get_data(band='lt')[0,0] == 0 assert eo.get_data(band='B04')[-1,-1] == 2567 and eo.get_data(band='lt')[-1,-1] == 0
'out_dirpath': './basic_job/march_0/' }, { 'name': 'filter_bands', 'bands': ['VV'] }, { 'name': 'crop', 'extent': (16.06, 48.06, 16.65, 48.35), 'crs': 'EPSG:4326' }, { 'name': 'to_pickle', 'filepath': './basic_job/march_0/march_0.dc;str' }] # evaluate node march_0 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### mean_4 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/march_0/march_0.dc'] # node input parameters params = [{ 'name': 'set_output_folder', 'out_dirpath': './basic_job/mean_4/' }, { 'name': 'reduce', 'dimension': 'time',
'bands': [8] }, { 'name': 'crop', 'extent': (11.279182434082033, 46.464349400461145, 11.406898498535158, 46.522729291844286), 'crs': 'EPSG:4326' }, { 'name': 'to_pickle', 'filepath': './output_udf_r/dc_0/dc_0.dc;str' }] # evaluate node dc_0 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### udf_2 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./output_udf_r/dc_0/dc_0.dc'] # node input parameters params = { 'udf': 'data2 = data*(-1); data2', 'runtime': 'R', 'output_folder': './output_udf_r/udf_2' }
'out_dirpath': './basic_job/load_collection_0/' }, { 'name': 'filter_bands', 'bands': ['VV', 'VH'] }, { 'name': 'crop', 'extent': (16.06, 48.06, 16.65, 48.35), 'crs': 'EPSG:4326' }, { 'name': 'to_pickle', 'filepath': './basic_job/load_collection_0/load_collection_0.dc;str' }] # evaluate node load_collection_0 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### mean_2 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/load_collection_0/load_collection_0.dc'] # node input parameters params = [{ 'name': 'set_output_folder', 'out_dirpath': './basic_job/mean_2/' }, { 'name': 'reduce', 'dimension': 'time',
'bands': [8, 4, 2] }, { 'name': 'crop', 'extent': (11.279182434082033, 46.464349400461145, 11.406898498535158, 46.522729291844286), 'crs': 'EPSG:4326' }, { 'name': 'to_pickle', 'filepath': './basic_job/dc_0/dc_0.dc;str' }] # evaluate node dc_0 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### mult_2 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/dc_0/dc_0.dc'] # node input parameters params = [{ 'name': 'set_output_folder', 'out_dirpath': './basic_job/mult_2/' }, { 'name': 'apply', 'f_input': {
'bands': ['B08', 'B04', 'B02'] }, { 'name': 'crop', 'extent': (11.279182434082033, 46.464349400461145, 11.406898498535158, 46.522729291844286), 'crs': 'EPSG:4326' }, { 'name': 'to_pickle', 'filepath': './basic_job/dc_0/dc_0.dc;str' }] # evaluate node dc_0 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### blue_4 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/dc_0/dc_0.dc'] # node input parameters params = [{ 'name': 'set_output_folder', 'out_dirpath': './basic_job/blue_4/' }, { 'name': 'reduce', 'dimension': 'band',