From dbd66d3312d2ed75a8af8f6d7b08e24f6425d4f3 Mon Sep 17 00:00:00 2001 From: Paul Madden Date: Fri, 24 Jan 2025 02:47:59 +0000 Subject: [PATCH 1/5] gfs_files -> gribfiles --- docs/shared/ungrib.yaml | 2 +- src/uwtools/drivers/ungrib.py | 16 ++++++++-------- .../resources/jsonschema/ungrib.jsonschema | 4 ++-- src/uwtools/tests/drivers/test_ungrib.py | 2 +- src/uwtools/tests/test_schemas.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/shared/ungrib.yaml b/docs/shared/ungrib.yaml index c7b8ed985..00771555e 100644 --- a/docs/shared/ungrib.yaml +++ b/docs/shared/ungrib.yaml @@ -4,7 +4,7 @@ ungrib: cores: 1 walltime: "00:01:00" executable: /path/to/ungrib.exe - gfs_files: + gribfiles: forecast_length: 24 interval_hours: 6 offset: 0 diff --git a/src/uwtools/drivers/ungrib.py b/src/uwtools/drivers/ungrib.py index 22715fd22..c6ebe0d09 100644 --- a/src/uwtools/drivers/ungrib.py +++ b/src/uwtools/drivers/ungrib.py @@ -27,15 +27,15 @@ def gribfiles(self): Symlinks to all the GRIB files. """ yield self.taskname("GRIB files") - gfs_files = self.config["gfs_files"] - offset = abs(gfs_files["offset"]) - endhour = gfs_files["forecast_length"] + offset - interval = gfs_files["interval_hours"] + gribfiles = self.config["gribfiles"] + offset = abs(gribfiles["offset"]) + endhour = gribfiles["forecast_length"] + offset + interval = gribfiles["interval_hours"] cycle_hour = int((self._cycle - timedelta(hours=offset)).strftime("%H")) links = [] for n, boundary_hour in enumerate(range(offset, endhour + 1, interval)): infile = Path( - gfs_files["path"].format(cycle_hour=cycle_hour, forecast_hour=boundary_hour) + gribfiles["path"].format(cycle_hour=cycle_hour, forecast_hour=boundary_hour) ) link_name = self.rundir / f"GRIBFILE.{_ext(n)}" links.append((infile, link_name)) @@ -47,10 +47,10 @@ def namelist_file(self): The namelist file. """ # Do not use offset here. It's relative to the MPAS fcst to run. - gfs_files = self.config["gfs_files"] - endhour = gfs_files["forecast_length"] + gribfiles = self.config["gribfiles"] + endhour = gribfiles["forecast_length"] end_date = self._cycle + timedelta(hours=endhour) - interval = int(gfs_files["interval_hours"]) * 3600 # hour to sec + interval = int(gribfiles["interval_hours"]) * 3600 # hour to sec d = { "update_values": { "share": { diff --git a/src/uwtools/resources/jsonschema/ungrib.jsonschema b/src/uwtools/resources/jsonschema/ungrib.jsonschema index 9ba6bc36c..c8f42fd94 100644 --- a/src/uwtools/resources/jsonschema/ungrib.jsonschema +++ b/src/uwtools/resources/jsonschema/ungrib.jsonschema @@ -6,7 +6,7 @@ "execution": { "$ref": "urn:uwtools:execution-parallel" }, - "gfs_files": { + "gribfiles": { "additionalProperties": false, "properties": { "forecast_length": { @@ -42,7 +42,7 @@ }, "required": [ "execution", - "gfs_files", + "gribfiles", "rundir", "vtable" ], diff --git a/src/uwtools/tests/drivers/test_ungrib.py b/src/uwtools/tests/drivers/test_ungrib.py index 0a12af8a0..d01a0d550 100644 --- a/src/uwtools/tests/drivers/test_ungrib.py +++ b/src/uwtools/tests/drivers/test_ungrib.py @@ -28,7 +28,7 @@ def config(tmp_path): }, "executable": str(tmp_path / "ungrib.exe"), }, - "gfs_files": { + "gribfiles": { "forecast_length": 12, "interval_hours": 6, "offset": 6, diff --git a/src/uwtools/tests/test_schemas.py b/src/uwtools/tests/test_schemas.py index 0dea9b146..4dce53854 100644 --- a/src/uwtools/tests/test_schemas.py +++ b/src/uwtools/tests/test_schemas.py @@ -1960,7 +1960,7 @@ def test_schema_shave_rundir(shave_prop): def test_schema_ungrib(): config = { "execution": {"executable": "/tmp/ungrib.exe"}, - "gfs_files": { + "gribfiles": { "forecast_length": 24, "interval_hours": 6, "offset": 0, @@ -1973,7 +1973,7 @@ def test_schema_ungrib(): # Basic correctness: assert not errors(config) # All top-level keys are required: - for key in ("execution", "gfs_files", "rundir", "vtable"): + for key in ("execution", "gribfiles", "rundir", "vtable"): assert f"'{key}' is a required property" in errors(with_del(config, key)) # Additional top-level keys are not allowed: assert "Additional properties are not allowed" in errors({**config, "foo": "bar"}) From 50f31bf2c7f694e1cf19ab0619c2672d05ec2c5f Mon Sep 17 00:00:00 2001 From: Paul Madden Date: Fri, 24 Jan 2025 02:53:52 +0000 Subject: [PATCH 2/5] Doc update --- docs/sections/user_guide/yaml/components/ungrib.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sections/user_guide/yaml/components/ungrib.rst b/docs/sections/user_guide/yaml/components/ungrib.rst index 9f1305bb9..2adfe3a3e 100644 --- a/docs/sections/user_guide/yaml/components/ungrib.rst +++ b/docs/sections/user_guide/yaml/components/ungrib.rst @@ -20,7 +20,7 @@ execution: See :ref:`this page ` for details. -gfs_files: +gribfiles: ^^^^^^^^^^ Describes the GRIB-formatted files to be processed by ``ungrib``. From 9020acaca57b407ad24c9f6cf5b4426e6a19407d Mon Sep 17 00:00:00 2001 From: Paul Madden Date: Fri, 24 Jan 2025 17:03:14 +0000 Subject: [PATCH 3/5] Set user-agent on linkchecker --- docs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Makefile b/docs/Makefile index a05140390..b71e5689c 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -13,7 +13,7 @@ clean: docs: $(MAKE) html - linkchecker --check-extern --no-warnings build/html/index.html + linkchecker --check-extern --no-warnings --user-agent Mozilla/5.0 build/html/index.html examples: COLUMNS=80 $(MAKE) -C sections From 8ff81c69e2c2776a59eed87e6c9b19d1dace75f7 Mon Sep 17 00:00:00 2001 From: Paul Madden Date: Tue, 28 Jan 2025 20:49:09 +0000 Subject: [PATCH 4/5] forecast_length -> max_leadtime --- docs/sections/user_guide/yaml/components/ungrib.rst | 10 +++++----- docs/shared/ungrib.yaml | 2 +- src/uwtools/drivers/ungrib.py | 4 ++-- src/uwtools/resources/jsonschema/ungrib.jsonschema | 6 +++--- src/uwtools/tests/drivers/test_ungrib.py | 2 +- src/uwtools/tests/test_schemas.py | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/sections/user_guide/yaml/components/ungrib.rst b/docs/sections/user_guide/yaml/components/ungrib.rst index 2adfe3a3e..6f4d38dca 100644 --- a/docs/sections/user_guide/yaml/components/ungrib.rst +++ b/docs/sections/user_guide/yaml/components/ungrib.rst @@ -25,7 +25,11 @@ gribfiles: Describes the GRIB-formatted files to be processed by ``ungrib``. - **forecast_length:** + **interval_hours:** + + Frequency interval of the given files, in integer hours. + + **max_leadtime:** The length of the forecast in integer hours. @@ -33,10 +37,6 @@ Describes the GRIB-formatted files to be processed by ``ungrib``. How many hours earlier the external model used for boundary conditions started compared to the desired forecast cycle, in integer hours. - **interval_hours:** - - Frequency interval of the given files, in integer hours. - **path:** An absolute-path template to the GRIB-formatted files to be processed by ``ungrib``. The Python ``int`` variables ``cycle_hour`` and ``forecast_hour`` will be interpolated into, e.g., ``/path/to/gfs.t{cycle_hour:02d}z.pgrb2.0p25.f{forecast_hour:03d}``. Note that this is a Python string template rather than a Jinja2 template. diff --git a/docs/shared/ungrib.yaml b/docs/shared/ungrib.yaml index 00771555e..974dbf65e 100644 --- a/docs/shared/ungrib.yaml +++ b/docs/shared/ungrib.yaml @@ -5,8 +5,8 @@ ungrib: walltime: "00:01:00" executable: /path/to/ungrib.exe gribfiles: - forecast_length: 24 interval_hours: 6 + max_leadtime: 24 offset: 0 path: /path/to/dir/gfs.t{cycle_hour:02d}z.pgrb2.0p25.f{forecast_hour:03d} rundir: /path/to/run/dir diff --git a/src/uwtools/drivers/ungrib.py b/src/uwtools/drivers/ungrib.py index c6ebe0d09..9029ea930 100644 --- a/src/uwtools/drivers/ungrib.py +++ b/src/uwtools/drivers/ungrib.py @@ -29,7 +29,7 @@ def gribfiles(self): yield self.taskname("GRIB files") gribfiles = self.config["gribfiles"] offset = abs(gribfiles["offset"]) - endhour = gribfiles["forecast_length"] + offset + endhour = gribfiles["max_leadtime"] + offset interval = gribfiles["interval_hours"] cycle_hour = int((self._cycle - timedelta(hours=offset)).strftime("%H")) links = [] @@ -48,7 +48,7 @@ def namelist_file(self): """ # Do not use offset here. It's relative to the MPAS fcst to run. gribfiles = self.config["gribfiles"] - endhour = gribfiles["forecast_length"] + endhour = gribfiles["max_leadtime"] end_date = self._cycle + timedelta(hours=endhour) interval = int(gribfiles["interval_hours"]) * 3600 # hour to sec d = { diff --git a/src/uwtools/resources/jsonschema/ungrib.jsonschema b/src/uwtools/resources/jsonschema/ungrib.jsonschema index c8f42fd94..fc3570ee2 100644 --- a/src/uwtools/resources/jsonschema/ungrib.jsonschema +++ b/src/uwtools/resources/jsonschema/ungrib.jsonschema @@ -9,11 +9,11 @@ "gribfiles": { "additionalProperties": false, "properties": { - "forecast_length": { + "interval_hours": { "minimum": 1, "type": "integer" }, - "interval_hours": { + "max_leadtime": { "minimum": 1, "type": "integer" }, @@ -26,8 +26,8 @@ } }, "required": [ - "forecast_length", "interval_hours", + "max_leadtime", "offset", "path" ], diff --git a/src/uwtools/tests/drivers/test_ungrib.py b/src/uwtools/tests/drivers/test_ungrib.py index d01a0d550..c60bb43a9 100644 --- a/src/uwtools/tests/drivers/test_ungrib.py +++ b/src/uwtools/tests/drivers/test_ungrib.py @@ -29,8 +29,8 @@ def config(tmp_path): "executable": str(tmp_path / "ungrib.exe"), }, "gribfiles": { - "forecast_length": 12, "interval_hours": 6, + "max_leadtime": 12, "offset": 6, "path": str(tmp_path / "gfs.t{cycle_hour:02d}z.pgrb2.0p25.f{forecast_hour:03d}"), }, diff --git a/src/uwtools/tests/test_schemas.py b/src/uwtools/tests/test_schemas.py index 4dce53854..8c0fefbf7 100644 --- a/src/uwtools/tests/test_schemas.py +++ b/src/uwtools/tests/test_schemas.py @@ -1961,8 +1961,8 @@ def test_schema_ungrib(): config = { "execution": {"executable": "/tmp/ungrib.exe"}, "gribfiles": { - "forecast_length": 24, "interval_hours": 6, + "max_leadtime": 24, "offset": 0, "path": "/tmp/gfs.t12z.pgrb2.0p25.f000", }, From 4094966fc07f30766fdfefffe88d97ac4fae6175 Mon Sep 17 00:00:00 2001 From: Paul Madden Date: Tue, 28 Jan 2025 20:58:43 +0000 Subject: [PATCH 5/5] Improve max_leadtime parameter description --- docs/sections/user_guide/yaml/components/ungrib.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sections/user_guide/yaml/components/ungrib.rst b/docs/sections/user_guide/yaml/components/ungrib.rst index 6f4d38dca..386f41d4a 100644 --- a/docs/sections/user_guide/yaml/components/ungrib.rst +++ b/docs/sections/user_guide/yaml/components/ungrib.rst @@ -31,7 +31,7 @@ Describes the GRIB-formatted files to be processed by ``ungrib``. **max_leadtime:** - The length of the forecast in integer hours. + The maximum forecast leadtime to process. This may be the same as the forecast length, or a lower leadtime. **offset:**