Skip to content

Commit

Permalink
Automatically create directories for atmospheric profiles
Browse files Browse the repository at this point in the history
Until now, it raised an error  if they didn't exist yet

Credits to Catherine Fait (FMI) for the bug report
  • Loading branch information
dostuffthatmatters committed Aug 29, 2024
1 parent 436a3ca commit 2c155a8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/profiles/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import tum_esm_utils
import ftplib
Expand All @@ -10,6 +11,12 @@ def run() -> None:
config = types.Config.load()
assert config.profiles is not None, "No profiles config found"

for variant in ["GGG2014", "GGG2020"]:
os.makedirs(
os.path.join(config.general.data.atmospheric_profiles, variant),
exist_ok=True
)

try:
if len(config.profiles.GGG2020_standard_sites) > 0:
print("Downloading standard site data")
Expand All @@ -23,11 +30,11 @@ def run() -> None:
profiles.std_site_logic.download_data(config, ftp)
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")

Expand Down

0 comments on commit 2c155a8

Please sign in to comment.