Skip to content

Commit 6eb84d2

Browse files
committed
Improve used sources listing
1 parent 7921337 commit 6eb84d2

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

opendrift_leeway_webgui/simulation.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def main():
8686
action="store_true",
8787
default=False,
8888
)
89+
8990
args = parser.parse_args()
9091

9192
simulation = Leeway(loglevel=50)
@@ -95,8 +96,9 @@ def main():
9596
for data_file in os.listdir(INPUTDIR)
9697
if data_file.endswith(".nc")
9798
]
99+
sources = []
98100
if local_sources:
99-
sources = local_sources
101+
sources += local_sources
100102
elif not args.no_web:
101103
if os.environ.get("COPERNICUSMARINE_SERVICE_USERNAME") not in (
102104
None,
@@ -109,7 +111,9 @@ def main():
109111
"cmems_mod_glo_phy_anfc_merged-uv_PT1H-i",
110112
"cmems_obs-wind_glo_phy_nrt_l4_0.125deg_PT1H",
111113
]
112-
print("Using sources:\n - {}".format("\n - ".join(cmems_dataset_ids)))
114+
print(
115+
"Using CMEMS datasets:\n - {}".format("\n - ".join(cmems_dataset_ids))
116+
)
113117
readers = []
114118
for dataset_id in cmems_dataset_ids:
115119
try:
@@ -123,18 +127,16 @@ def main():
123127
raise
124128
readers.append(Reader(ds, name=dataset_id))
125129
simulation.add_reader(readers)
126-
sources = [
130+
sources += [
127131
"https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd"
128132
]
129-
simulation.add_readers_from_list(sources, lazy=False)
130-
131-
else:
132-
sources = [
133-
"https://tds.hycom.org/thredds/dodsC/GLBy0.08/latest",
134-
"https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd",
135-
]
136-
print("Using sources:\n - {}".format("\n - ".join(sources)))
137-
simulation.add_readers_from_list(sources, lazy=False)
133+
else:
134+
sources += [
135+
"https://tds.hycom.org/thredds/dodsC/GLBy0.08/latest",
136+
"https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd",
137+
]
138+
print("Using sources:\n - {}".format("\n - ".join(sources)))
139+
simulation.add_readers_from_list(sources, lazy=False)
138140

139141
reader_landmask = reader_global_landmask.Reader()
140142
simulation.add_reader([reader_landmask])

0 commit comments

Comments
 (0)