From 51f7a2e16569168761604bc07c75cb135275ddee Mon Sep 17 00:00:00 2001 From: skperez Date: Mon, 4 Mar 2024 14:21:21 -0800 Subject: [PATCH 1/2] fix bug where the subset flag fails for subscriber --- CHANGELOG.md | 1 + subscriber/podaac_access.py | 7 ------- subscriber/podaac_data_downloader.py | 8 ++++++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8486031..7f00524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] ### Fixed +- Fixed bug where --subset in combination with the subscriber caused errors ### Added ## [1.15.0] diff --git a/subscriber/podaac_access.py b/subscriber/podaac_access.py index e69da75..48be4b3 100644 --- a/subscriber/podaac_access.py +++ b/subscriber/podaac_access.py @@ -221,13 +221,6 @@ def validate(args): 'Please specify exactly one flag ' 'from -dc, -dy, -dydoy, or -dymd') - if args.subset and args.search_cycles: - # Cycle+Subset are not supported, because Harmony does not - # currently accept Cycle. - raise ValueError( - 'Error: Incompatible Parameters. You\'ve provided both cycles and subset, which is ' - 'not allowed. Please provide either cycles or subset separately, but not both.') - if args.subset and args.bbox: bounds = list(map(float, args.bbox.split(','))) if bounds[0] > bounds[2]: diff --git a/subscriber/podaac_data_downloader.py b/subscriber/podaac_data_downloader.py index 08408ae..4db9522 100755 --- a/subscriber/podaac_data_downloader.py +++ b/subscriber/podaac_data_downloader.py @@ -203,6 +203,14 @@ def cmr_downloader(args, token, data_path): 'from -dc, -dy, -dydoy, or -dymd' ) + if args.subset and args.search_cycles: + # Cycle+Subset are not supported, because Harmony does not + # currently accept Cycle. + raise ValueError( + 'Error: Incompatible Parameters. You\'ve provided both cycles and subset, which is ' + 'not allowed. Please provide either cycles or subset separately, but not both.' + ) + if args.offset: ts_shift = timedelta(hours=int(args.offset)) From 6eaf0b42e0fb805941f952ece9257e0c7bcf1c83 Mon Sep 17 00:00:00 2001 From: skperez Date: Mon, 4 Mar 2024 14:32:00 -0800 Subject: [PATCH 2/2] move arg validation to correct spot --- subscriber/podaac_data_downloader.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/subscriber/podaac_data_downloader.py b/subscriber/podaac_data_downloader.py index 4db9522..aff5956 100755 --- a/subscriber/podaac_data_downloader.py +++ b/subscriber/podaac_data_downloader.py @@ -44,6 +44,13 @@ def validate(args): if None in [args.endDate, args.startDate] and args.search_cycles is None and args.granulename is None: raise ValueError( "Error parsing command line arguments: Both --start-date and --end-date must be specified") # noqa E50 + if args.subset and args.search_cycles: + # Cycle+Subset are not supported, because Harmony does not + # currently accept Cycle. + raise ValueError( + 'Error: Incompatible Parameters. You\'ve provided both cycles and subset, which is ' + 'not allowed. Please provide either cycles or subset separately, but not both.' + ) def create_parser(): @@ -203,14 +210,6 @@ def cmr_downloader(args, token, data_path): 'from -dc, -dy, -dydoy, or -dymd' ) - if args.subset and args.search_cycles: - # Cycle+Subset are not supported, because Harmony does not - # currently accept Cycle. - raise ValueError( - 'Error: Incompatible Parameters. You\'ve provided both cycles and subset, which is ' - 'not allowed. Please provide either cycles or subset separately, but not both.' - ) - if args.offset: ts_shift = timedelta(hours=int(args.offset))