Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 15 additions & 29 deletions docs/user/environment/1-atm-models/forecast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://thredds.ucar.edu/>`_ server.
Other generic forecasts can also be imported.

Expand All @@ -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
Expand Down Expand Up @@ -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 <https://www.emc.ncep.noaa.gov/emc/pages/numerical_forecast_systems/nam.php>`_.
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)
Expand All @@ -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::

Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/user/environment/1-atm-models/open_meteo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 9 additions & 3 deletions rocketpy/environment/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 "
Expand Down
20 changes: 6 additions & 14 deletions tests/integration/environment/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/environment/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading