@@ -469,16 +469,33 @@ def evaluate(
469469 if do_dry_run :
470470 dry_run_tracer = do_dry_run if isinstance (do_dry_run , DryRunDataTracer ) else DryRunDataTracer ()
471471 _log .info ("Doing dry run" )
472- convert_node (top_level_node , env = env .push ({
473- ENV_DRY_RUN_TRACER : dry_run_tracer ,
474- ENV_SAVE_RESULT : [], # otherwise dry run and real run append to the same mutable result list
475- "node_caching" : False
476- }))
472+ dry_run_result = convert_node (
473+ top_level_node ,
474+ env = env .push (
475+ {
476+ ENV_DRY_RUN_TRACER : dry_run_tracer ,
477+ ENV_SAVE_RESULT : [], # otherwise dry run and real run append to the same mutable result list
478+ "node_caching" : False ,
479+ }
480+ ),
481+ )
477482 # TODO: work with a dedicated DryRunEvalEnv?
478483 source_constraints = dry_run_tracer .get_source_constraints ()
479484 _log .info ("Dry run extracted these source constraints: {s}" .format (s = source_constraints ))
485+
486+ # TODO: Given the post-dry-run hook concept: is it still necessary to push source_constraints into env?
480487 env = env .push ({ENV_SOURCE_CONSTRAINTS : source_constraints })
481488
489+ post_dry_run_data = env .backend_implementation .post_dry_run (
490+ dry_run_result = dry_run_result ,
491+ dry_run_tracer = dry_run_tracer ,
492+ source_constraints = source_constraints ,
493+ # TODO: use env before ENV_SOURCE_CONSTRAINTS have been pushed?
494+ env = env ,
495+ )
496+ if post_dry_run_data :
497+ env = env .push (post_dry_run_data )
498+
482499 result = convert_node (top_level_node , env = env )
483500 if len (env [ENV_SAVE_RESULT ]) > 0 :
484501 if len (env [ENV_SAVE_RESULT ]) == 1 :
@@ -763,17 +780,17 @@ def _extract_load_parameters(env: EvalEnv, source_id: tuple) -> LoadParameters:
763780
764781 if extent is not None :
765782 collection_crs = _collection_crs (collection_id = collection_id , env = env )
766- crs = constraint .get ("resample" , {}).get ("target_crs" , collection_crs ) or collection_crs
783+ target_crs = constraint .get ("resample" , {}).get ("target_crs" , collection_crs ) or collection_crs
767784 target_resolution = constraint .get ("resample" , {}).get ("resolution" , None ) or _collection_resolution (
768785 collection_id = collection_id , env = env
769786 )
770787
771788 if "pixel_buffer" in constraint :
772789 buffer = constraint ["pixel_buffer" ]["buffer_size" ]
773790
774- if (crs is not None ) and target_resolution :
791+ if (target_crs is not None ) and target_resolution :
775792 bbox = BoundingBox .from_dict (extent , default_crs = 4326 )
776- extent = bbox .reproject (crs ).as_dict ()
793+ extent = bbox .reproject (target_crs ).as_dict ()
777794
778795 extent = {
779796 "west" : extent ["west" ] - target_resolution [0 ] * math .ceil (buffer [0 ]),
@@ -785,11 +802,11 @@ def _extract_load_parameters(env: EvalEnv, source_id: tuple) -> LoadParameters:
785802 else :
786803 _log .warning ("Not applying buffer to extent because the target CRS is not known." )
787804
788- load_collection_in_native_grid = "resample" not in constraint or crs == collection_crs
805+ load_collection_in_native_grid = "resample" not in constraint or target_crs == collection_crs
789806 if (not load_collection_in_native_grid ) and collection_crs is not None and ("42001" in str (collection_crs )):
790807 #resampling auto utm to utm means we are loading in native grid
791808 try :
792- load_collection_in_native_grid = "UTM zone" in CRS .from_user_input (crs ).to_wkt ()
809+ load_collection_in_native_grid = "UTM zone" in CRS .from_user_input (target_crs ).to_wkt ()
793810 except CRSError as e :
794811 pass
795812
@@ -2608,7 +2625,7 @@ def load_stac(args: ProcessArgs, env: EvalEnv) -> DriverDataCube:
26082625
26092626 dry_run_tracer : DryRunDataTracer = env .get (ENV_DRY_RUN_TRACER )
26102627 if dry_run_tracer :
2611- return dry_run_tracer .load_stac (url , arguments , env )
2628+ return dry_run_tracer .load_stac (url = url , arguments = arguments , env = env )
26122629 else :
26132630 source_id = dry_run .DataSource .load_stac (
26142631 url , properties = arguments .get ("properties" , {}), bands = arguments .get ("bands" , []), env = env
0 commit comments