@@ -2555,6 +2555,52 @@ def test_load_stac_from_job_empty_result(self, con120, requests_mock):
25552555 }
25562556 }
25572557
2558+ def test_load_stac_reduce_temporal (self , con120 , tmp_path ):
2559+ # TODO: reusable utility to create/generate a STAC resource for testing
2560+ # (a file, but preferably a URL, but that requires urllib mocking)
2561+ stac_path = tmp_path / "stac.json"
2562+ stac_data = {
2563+ "type" : "Collection" ,
2564+ "id" : "test-collection" ,
2565+ "stac_version" : "1.0.0" ,
2566+ "description" : "Test collection" ,
2567+ "links" : [],
2568+ "title" : "Test Collection" ,
2569+ "extent" : {
2570+ "spatial" : {"bbox" : [[- 180.0 , - 90.0 , 180.0 , 90.0 ]]},
2571+ "temporal" : {"interval" : [["2020-01-01T00:00:00Z" , "2020-01-10T00:00:00Z" ]]},
2572+ },
2573+ "license" : "proprietary" ,
2574+ "summaries" : {"eo:bands" : [{"name" : "B01" }, {"name" : "B02" }]},
2575+ }
2576+ stac_path .write_text (json .dumps (stac_data ))
2577+
2578+ cube = con120 .load_stac (str (stac_path ))
2579+ reduced = cube .reduce_temporal ("max" )
2580+ assert reduced .flat_graph () == {
2581+ "loadstac1" : {
2582+ "process_id" : "load_stac" ,
2583+ "arguments" : {"url" : str (stac_path )},
2584+ },
2585+ "reducedimension1" : {
2586+ "process_id" : "reduce_dimension" ,
2587+ "arguments" : {
2588+ "data" : {"from_node" : "loadstac1" },
2589+ "dimension" : "t" ,
2590+ "reducer" : {
2591+ "process_graph" : {
2592+ "max1" : {
2593+ "arguments" : {"data" : {"from_parameter" : "data" }},
2594+ "process_id" : "max" ,
2595+ "result" : True ,
2596+ }
2597+ }
2598+ },
2599+ },
2600+ "result" : True ,
2601+ },
2602+ }
2603+
25582604
25592605@pytest .mark .parametrize (
25602606 "data" ,
0 commit comments