From 724c9a27498efdc29770f44333112ced0c974161 Mon Sep 17 00:00:00 2001 From: jacquelynsmale Date: Fri, 10 Jan 2025 14:09:52 -0900 Subject: [PATCH] switch order of logic --- tools/RAiDER/cli/raider.py | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/RAiDER/cli/raider.py b/tools/RAiDER/cli/raider.py index 5b6b02c3..18f5d647 100644 --- a/tools/RAiDER/cli/raider.py +++ b/tools/RAiDER/cli/raider.py @@ -602,27 +602,6 @@ def calcDelaysGUNW(iargs: Optional[list[str]] = None) -> Optional[xr.Dataset]: if args.input_bucket_prefix is None: args.input_bucket_prefix = args.bucket_prefix - if args.weather_model == 'AUTO': - args.weather_model = determine_weather_model(args.file) - print(f'Selected weather model {args.weather_model} for scene') - - if args.weather_model == 'None': - # NOTE: HyP3's current step function implementation does not have a good way of conditionally - # running processing steps. This allows HyP3 to always run this step but exit immediately - # and do nothing if tropospheric correction via RAiDER is not selected. This should not cause - # any appreciable cost increase to GUNW product generation. - print('Nothing to do!') - return - - if ( - args.file is not None and - args.weather_model == 'HRRR' and - args.interpolate_time == 'azimuth_time_grid' - ): - gunw_id = args.file.name.replace('.nc', '') - if not RAiDER.aria.prepFromGUNW.check_hrrr_dataset_availablity_for_s1_azimuth_time_interpolation(gunw_id): - raise NoWeatherModelData('The required HRRR data for time-grid interpolation is not available') - if args.file is None: if args.bucket is None or args.bucket_prefix is None: raise ValueError('Either argument --file or --bucket must be provided') @@ -645,6 +624,27 @@ def calcDelaysGUNW(iargs: Optional[list[str]] = None) -> Optional[xr.Dataset]: ) return + if args.weather_model == 'AUTO': + args.weather_model = determine_weather_model(args.file) + print(f'Selected weather model {args.weather_model} for scene') + + if args.weather_model == 'None': + # NOTE: HyP3's current step function implementation does not have a good way of conditionally + # running processing steps. This allows HyP3 to always run this step but exit immediately + # and do nothing if tropospheric correction via RAiDER is not selected. This should not cause + # any appreciable cost increase to GUNW product generation. + print('Nothing to do!') + return + + if ( + args.file is not None and + args.weather_model == 'HRRR' and + args.interpolate_time == 'azimuth_time_grid' + ): + gunw_id = args.file.name.replace('.nc', '') + if not RAiDER.aria.prepFromGUNW.check_hrrr_dataset_availablity_for_s1_azimuth_time_interpolation(gunw_id): + raise NoWeatherModelData('The required HRRR data for time-grid interpolation is not available') + # Download file to obtain metadata if not RAiDER.aria.prepFromGUNW.check_weather_model_availability(args.file, args.weather_model): # NOTE: We want to submit jobs that are outside of acceptable weather model range