Skip to content

Commit 3340885

Browse files
committed
Improve used sources listing
1 parent 7921337 commit 3340885

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

opendrift_leeway_webgui/simulation.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,7 @@ def main():
8080
parser.add_argument(
8181
"--id", help="ID used for result image name.", default=str(uuid.uuid4())
8282
)
83-
parser.add_argument(
84-
"--no-web",
85-
help="Disable fetching simulation data from web.",
86-
action="store_true",
87-
default=False,
88-
)
83+
8984
args = parser.parse_args()
9085

9186
simulation = Leeway(loglevel=50)
@@ -95,8 +90,9 @@ def main():
9590
for data_file in os.listdir(INPUTDIR)
9691
if data_file.endswith(".nc")
9792
]
93+
sources = []
9894
if local_sources:
99-
sources = local_sources
95+
sources += local_sources
10096
elif not args.no_web:
10197
if os.environ.get("COPERNICUSMARINE_SERVICE_USERNAME") not in (
10298
None,
@@ -109,7 +105,9 @@ def main():
109105
"cmems_mod_glo_phy_anfc_merged-uv_PT1H-i",
110106
"cmems_obs-wind_glo_phy_nrt_l4_0.125deg_PT1H",
111107
]
112-
print("Using sources:\n - {}".format("\n - ".join(cmems_dataset_ids)))
108+
print(
109+
"Using CMEMS datasets:\n - {}".format("\n - ".join(cmems_dataset_ids))
110+
)
113111
readers = []
114112
for dataset_id in cmems_dataset_ids:
115113
try:
@@ -123,18 +121,16 @@ def main():
123121
raise
124122
readers.append(Reader(ds, name=dataset_id))
125123
simulation.add_reader(readers)
126-
sources = [
124+
sources += [
127125
"https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd"
128126
]
129-
simulation.add_readers_from_list(sources, lazy=False)
130-
131127
else:
132-
sources = [
128+
sources += [
133129
"https://tds.hycom.org/thredds/dodsC/GLBy0.08/latest",
134130
"https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd",
135131
]
136-
print("Using sources:\n - {}".format("\n - ".join(sources)))
137-
simulation.add_readers_from_list(sources, lazy=False)
132+
print("Using sources:\n - {}".format("\n - ".join(sources)))
133+
simulation.add_readers_from_list(sources, lazy=False)
138134

139135
reader_landmask = reader_global_landmask.Reader()
140136
simulation.add_reader([reader_landmask])

0 commit comments

Comments
 (0)