@@ -80,11 +80,16 @@ def test_select_ranges_level_subset():
8080# ── URL construction ────────────────────────────────────────────────────────────
8181
8282def test_cycle_file_url ():
83- assert arch .cycle_file_url ("20220822" , 12 , 0 ) == (
83+ # cycle_file_url's res_token defaults to RES_TOKEN, which is frozen from
84+ # config at import time. Pass res_token explicitly so the test asserts the
85+ # URL format deterministically, independent of the res config declares.
86+ assert arch .cycle_file_url ("20220822" , 12 , 0 , res_token = "0p25" ) == (
8487 "https://noaa-gfs-bdp-pds.s3.amazonaws.com/"
8588 "gfs.20220822/12/atmos/gfs.t12z.pgrb2.0p25.f000"
8689 )
87- assert arch .cycle_file_url ("20220822" , 6 , 27 ).endswith ("gfs.t06z.pgrb2.0p25.f027" )
90+ assert arch .cycle_file_url (
91+ "20220822" , 6 , 27 , res_token = "0p25"
92+ ).endswith ("gfs.t06z.pgrb2.0p25.f027" )
8893
8994
9095# ── Output filename ───────────────────────────────────────────────────────────
@@ -212,6 +217,10 @@ def test_live_step_hours_controls_forecast_hours(monkeypatch):
212217 nc_start = base .replace (hour = (base .hour // 6 ) * 6 , minute = 0 , second = 0 , microsecond = 0 )
213218 monkeypatch .setitem (config_earth .netcdf_gfs , "nc_start" , nc_start )
214219 monkeypatch .setitem (config_earth .netcdf_gfs , "download_days" , 1 )
220+ # Pin res: hourly steps exist only on the 0.25° grid, so the test must not
221+ # inherit whatever res config currently declares (a 0.5°/1° default would
222+ # make step_hours=1 invalid and raise before the URL-building path runs).
223+ monkeypatch .setitem (config_earth .netcdf_gfs , "res" , 0.25 )
215224 monkeypatch .setitem (config_earth .netcdf_gfs , "step_hours" , 1 )
216225
217226 seen = []
0 commit comments