The following Python script can be used to download the Salish Sea Model climate-change hydrodynamic (HYD) and water-quality (WQM) model solutions for YR2000 and YR2095.
import urllib.request
import os
base_url = "https://s3.kopah.uw.edu/ssm-climate-rcp85"
datasets = [
("hyd", "2000", "ssm_{:05d}.nc"),
("hyd", "2095", "ssm_{:05d}.nc"),
("wqm", "2000", "ssm_FVCOMICM_{:05d}.nc"),
("wqm", "2095", "ssm_FVCOMICM_{:05d}.nc"),
]
for model_type, year, pattern in datasets:
output_dir = os.path.join(model_type, year)
os.makedirs(output_dir, exist_ok=True)
for i in range(1, 2):
filename = pattern.format(i)
url = f"{base_url}/{model_type}/{year}/{filename}"
output_file = os.path.join(output_dir, filename)
if os.path.exists(output_file):
print(f"Skipping {output_file} - already exists")
continue
try:
print(f"Downloading {model_type}/{year}/{filename} ...")
urllib.request.urlretrieve(url, output_file)
except Exception as e:
print(f"Failed: {url}")
print(e)
print("Download complete.")
Downloaded files will be organized automatically into the following directories:
hyd/
+-- 2000/
+-- 2095/
wqm/
+-- 2000/
+-- 2095/
To download additional daily model outputs, modify the range in:
for i in range(1, 2):
For example, to download files 1 through 365:
for i in range(1, 366):