diff --git a/src/profiles/generate_queries.py b/src/profiles/generate_queries.py index 841c2444..5b88264d 100644 --- a/src/profiles/generate_queries.py +++ b/src/profiles/generate_queries.py @@ -31,6 +31,7 @@ def list_downloaded_data( ) -> dict[ProfilesQueryLocation, set[datetime.date]]: assert config.profiles is not None + assert config.profiles.scope is not None downloaded_data: dict[ProfilesQueryLocation, set[datetime.date]] = {} r = re.compile(r"^\d{8,10}_\d{2}(N|S)\d{3}(E|W)\.(map|mod|vmr)$") @@ -91,6 +92,7 @@ def list_requested_data( ) -> dict[ProfilesQueryLocation, set[datetime.date]]: assert config.profiles is not None + assert config.profiles.scope is not None requested_data: dict[ProfilesQueryLocation, set[datetime.date]] = {} for sensor in em27_metadata_interface.sensors.root: diff --git a/src/profiles/main.py b/src/profiles/main.py index 52e8cbd4..49a69073 100644 --- a/src/profiles/main.py +++ b/src/profiles/main.py @@ -24,6 +24,10 @@ def run() -> None: else: print("No standard site data to download") + if config.profiles.scope is None: + print("No scope defined, skipping on-demand data download") + return + for version in config.profiles.scope.models: print(f"Downloading on-demand {version} data") diff --git a/tests/profiles/test_list_downloaded_data.py b/tests/profiles/test_list_downloaded_data.py index ed267860..f400b7a9 100644 --- a/tests/profiles/test_list_downloaded_data.py +++ b/tests/profiles/test_list_downloaded_data.py @@ -21,6 +21,7 @@ def test_list_downloaded_data( } config = provide_config_template.model_copy(deep=True) assert config.profiles is not None + assert config.profiles.scope is not None config.profiles.scope.from_date = min(random_dates) config.profiles.scope.to_date = max(random_dates) for _ in range(5): diff --git a/tests/profiles/test_list_requested_data.py b/tests/profiles/test_list_requested_data.py index fdbde8bd..125ab01b 100644 --- a/tests/profiles/test_list_requested_data.py +++ b/tests/profiles/test_list_requested_data.py @@ -91,6 +91,7 @@ def test_list_requested_data(provide_config_template: src.types.Config) -> None: } config = provide_config_template.model_copy(deep=True) assert config.profiles is not None + assert config.profiles.scope is not None config.profiles.scope.from_date = datetime.date(2000, 1, 1) config.profiles.scope.to_date = datetime.date(2000, 5, 8)