From 31e5c11ed7415d44652bb1ef87ad595e8f6226d3 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sun, 29 Nov 2026 19:02:20 -0300 Subject: [PATCH 1/3] BUG: raise a clear error for the discontinued NAM forecast shortcut UCAR THREDDS stopped publishing NAM on 2026-11-03, so file="NAM" loaded a stale dataset and failed with "Chosen launch time is not available". It now raises a ValueError that points to HRRR, RAP or GFS, like HIRESW and GEFS. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XDW574tsj2yzaQ2JFZusEw --- rocketpy/environment/environment.py | 12 ++++++++--- .../environment/test_environment.py | 20 ++++++------------- tests/unit/environment/test_environment.py | 5 +++++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/rocketpy/environment/environment.py b/rocketpy/environment/environment.py index 2d1d2a9b2..b76700d2d 100644 --- a/rocketpy/environment/environment.py +++ b/rocketpy/environment/environment.py @@ -1483,8 +1483,7 @@ def set_atmospheric_model( # pylint: disable=too-many-statements documentation for the models available to your account. - ``"forecast"``: local path, OPeNDAP URL, open ``netCDF4.Dataset``, or one of ``"AIGFS"``, ``"GFS"``, - ``"NAM"``, ``"RAP"``, ``"HRRR"`` or ``"HIRESW"`` for the - latest available forecast. + ``"RAP"`` or ``"HRRR"`` for the latest available forecast. - ``"reanalysis"``: local path, OPeNDAP URL, or open ``netCDF4.Dataset``. - ``"ensemble"``: local path, OPeNDAP URL, open @@ -1579,7 +1578,7 @@ def set_atmospheric_model( # pylint: disable=too-many-statements the system (``~/.cache/rocketpy`` on Linux), and use it again in later Python sessions instead of downloading it again. Only used for the latest forecast shortcuts (``type="Forecast"`` with - ``file="GFS"``, ``"NAM"``, ``"RAP"``, ``"HRRR"`` or ``"AIGFS"``) and + ``file="GFS"``, ``"RAP"``, ``"HRRR"`` or ``"AIGFS"``) and for a reanalysis given by a web address. A saved forecast is used only while the server says its model run is still the latest one, or, with a warning, when the server cannot be reached. A saved @@ -1684,6 +1683,13 @@ def set_atmospheric_model( # pylint: disable=too-many-statements "Please use another forecast source or provide a " "compatible dataset path/URL explicitly." ) + if type == "forecast" and file_upper == "NAM": + raise ValueError( + "The NAM latest-model shortcut is no longer " + "available because UCAR THREDDS stopped publishing " + "NAM on 2026-11-03. Please use 'HRRR', 'RAP' or " + "'GFS', or provide a NAM dataset path/URL explicitly." + ) if type == "ensemble" and file_upper == "GEFS": raise ValueError( "The GEFS latest-model shortcut is currently " diff --git a/tests/integration/environment/test_environment.py b/tests/integration/environment/test_environment.py index 0584834f1..368d13fd2 100644 --- a/tests/integration/environment/test_environment.py +++ b/tests/integration/environment/test_environment.py @@ -329,20 +329,12 @@ def test_hrrr_atmosphere(mock_show, example_spaceport_env): # pylint: disable=u assert example_spaceport_env.all_info() is None -@pytest.mark.slow -@patch("matplotlib.pyplot.show") -def test_nam_atmosphere(mock_show, example_spaceport_env): # pylint: disable=unused-argument - """Tests the Forecast model with the NAM file. - - Parameters - ---------- - mock_show : mock - Mock object to replace matplotlib.pyplot.show() method. - example_spaceport_env : rocketpy.Environment - Example environment object to be tested. - """ - example_spaceport_env.set_atmospheric_model(type="Forecast", file="NAM") - assert example_spaceport_env.all_info() is None +def test_nam_atmosphere(example_spaceport_env): + """The NAM shortcut raises a clear error, since UCAR stopped publishing NAM.""" + with pytest.raises( + ValueError, match="NAM latest-model shortcut is no longer available" + ): + example_spaceport_env.set_atmospheric_model(type="Forecast", file="NAM") @pytest.mark.slow diff --git a/tests/unit/environment/test_environment.py b/tests/unit/environment/test_environment.py index 3b5e1a99a..9dcc8ae8c 100644 --- a/tests/unit/environment/test_environment.py +++ b/tests/unit/environment/test_environment.py @@ -1245,6 +1245,11 @@ def test_resolve_dictionary_returns_original_when_no_compatible_builtin( "hiresw", "HIRESW latest-model shortcut is currently unavailable", ), + ( + "Forecast", + "nam", + "NAM latest-model shortcut is no longer available", + ), ( "Ensemble", "gefs", From 6239696231030c61e0b98943ab2a28f7dcb861ff Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sun, 29 Nov 2026 19:02:21 -0300 Subject: [PATCH 2/3] DOC: stop executing the NAM forecast example The forecast page ran file="NAM" at build time, which has failed every Read the Docs build of develop since UCAR stopped publishing NAM. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XDW574tsj2yzaQ2JFZusEw --- .../environment/1-atm-models/forecast.rst | 44 +++++++------------ .../environment/1-atm-models/open_meteo.rst | 2 +- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/docs/user/environment/1-atm-models/forecast.rst b/docs/user/environment/1-atm-models/forecast.rst index b79a6d5b2..d48e1908f 100644 --- a/docs/user/environment/1-atm-models/forecast.rst +++ b/docs/user/environment/1-atm-models/forecast.rst @@ -6,7 +6,7 @@ Forecasts Weather forecasts can be used to set the atmospheric model in RocketPy. Here, we will showcase how to import global forecasts such as GFS, as well as -local forecasts like NAM, RAP and HRRR for North America, all available through +local forecasts like RAP and HRRR for North America, all available through OPeNDAP on the `UCAR THREDDS `_ server. Other generic forecasts can also be imported. @@ -26,7 +26,7 @@ Other generic forecasts can also be imported. .. note:: Within one Python session, RocketPy keeps in memory the forecasts it - downloaded with the shortcuts on this page (``file="GFS"``, ``"NAM"`` and + downloaded with the shortcuts on this page (``file="GFS"``, ``"RAP"`` and so on), so that asking again for the same forecast, as when a notebook cell is run again, takes a couple of seconds instead of a full download. When the same model, place and launch time are asked for again, it asks @@ -108,32 +108,17 @@ RocketPy supports the latest AIGFS global forecast through THREDDS. North American Mesoscale Forecast System (NAM) ---------------------------------------------- -NAM is a regional forecast model focused on North America. It is best suited -for launches inside its coverage area when you want finer regional detail than -global models typically provide. +NAM is a regional forecast model focused on North America. -You can also request the latest forecasts from NAM. -Since this is a regional model for North America, you need to specify latitude -and longitude points within North America. -We will use **SpacePort America** for this, represented by coordinates -32.988528, -106.975056 (32°59'18.7"N 106°58'30.2"W). - -.. jupyter-execute:: - - env_nam = Environment( - date=tomorrow, - latitude=32.988528, - longitude=-106.975056, - ) - env_nam.set_atmospheric_model(type="forecast", file="NAM") - env_nam.plots.atmospheric_model() +.. danger:: -.. note:: + **NAM shortcut unavailable**: UCAR THREDDS stopped publishing NAM on + 2026-11-03, so ``file="NAM"`` now raises a ``ValueError``. Use RAP or HRRR + for North America, or GFS anywhere. - The NAM model is updated every 6 hours, it has a resolution of 5 km (Regional CONUS Nest) \ - and can forecast up to 21 points spaced by 3 hours, which means it can predict \ - the weather for the next 63 hours (3 days). For more information, visit the \ - `NAM overview page `_. +If you have a NAM dataset from another provider (or a local copy), you can +still load it explicitly by passing the path/URL in ``file`` and ``"NAM"`` or +``"NAM_LEGACY"`` in ``dictionary``. Rapid Refresh (RAP) @@ -143,9 +128,10 @@ RAP is a short-range, high-frequency regional model for North America. It is especially useful for near-term operations, where fast update cycles are more important than long forecast horizon. -The Rapid Refresh (RAP) model is another regional model for North America. -It is similar to NAM, but with a higher resolution and a shorter forecast range. -The same coordinates for SpacePort America will be used. +Since this is a regional model for North America, you need to specify latitude +and longitude points within North America. +We will use **SpacePort America** for this, represented by coordinates +32.988528, -106.975056 (32°59'18.7"N 106°58'30.2"W). .. jupyter-execute:: @@ -205,7 +191,7 @@ hourly updates. It is generally best for day-of-launch weather assessment and rapidly changing local conditions. RocketPy supports HRRR through a dedicated THREDDS shortcut. -Like NAM and RAP, HRRR is a regional model over North America, so you need to +Like RAP, HRRR is a regional model over North America, so you need to specify latitude and longitude points within its coverage area. The same SpacePort America coordinates used above will be reused here. diff --git a/docs/user/environment/1-atm-models/open_meteo.rst b/docs/user/environment/1-atm-models/open_meteo.rst index 3064d842c..50d931c3f 100644 --- a/docs/user/environment/1-atm-models/open_meteo.rst +++ b/docs/user/environment/1-atm-models/open_meteo.rst @@ -213,6 +213,6 @@ be satisfied. .. seealso:: - - :ref:`forecast` for OPeNDAP-based forecasts (GFS, NAM, RAP, HRRR). + - :ref:`forecast` for OPeNDAP-based forecasts (GFS, RAP, HRRR). - :ref:`reanalysis` for ERA5 and MERRA-2 reanalysis files. - :ref:`ensemble_atmosphere` for the ensemble workflow in general. From 6c4b16a8e9ec16edbf18db97a7d9639efb1fc0a4 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sun, 29 Nov 2026 19:02:44 -0300 Subject: [PATCH 3/3] DOC: add the NAM shortcut change to the v1.14.0 changelog Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XDW574tsj2yzaQ2JFZusEw --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 438b48dd2..2217004a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,7 @@ Attention: The newest changes should be on top --> ### Fixed +- BUG: `set_atmospheric_model(type="Forecast", file="NAM")` raises a `ValueError` that points to HRRR, RAP or GFS. UCAR THREDDS stopped publishing NAM on 2026-11-03, and the shortcut failed with "Chosen launch time is not available". [#1246](https://github.com/RocketPy-Team/RocketPy/pull/1246) - BUG: Install `contextily` with the `monte-carlo` extra on Python 3.14 too, so the background map of the Monte Carlo plots is available there. [#1243](https://github.com/RocketPy-Team/RocketPy/pull/1243) - BUG: Keep the members of an `open_meteo_ensemble` on the same pressure levels. When members had data at different levels, some of them got a pressure profile shifted by one level. [#1242](https://github.com/RocketPy-Team/RocketPy/pull/1242) [#1209](https://github.com/RocketPy-Team/RocketPy/issues/1209) - BUG: Load a saved `PointMassMotor`, `PointMassRocket` or a flight of them. Loading raised a `TypeError`, and the propellant masses and `weathercock_coeff` were not saved. [#1234](https://github.com/RocketPy-Team/RocketPy/pull/1234)