|
| 1 | +.. _open_meteo: |
| 2 | + |
| 3 | +Open-Meteo |
| 4 | +========== |
| 5 | + |
| 6 | +`Open-Meteo <https://open-meteo.com/>`_ is a weather API that serves |
| 7 | +pressure-level forecasts, past forecasts and ensemble forecasts as plain JSON |
| 8 | +over HTTPS. |
| 9 | + |
| 10 | +It is often the most convenient weather source in RocketPy, because: |
| 11 | + |
| 12 | +- **No API key** is required for non-commercial use. |
| 13 | +- **No heavy dependencies**: unlike the :ref:`forecast` and :ref:`reanalysis` |
| 14 | + models, no ``netCDF4``/OPeNDAP download is involved, so requests are quick. |
| 15 | +- **No external files**: recent past launches can be reconstructed straight from |
| 16 | + the API, without downloading reanalysis files by hand. |
| 17 | +- **Many models in one place**: GFS, ECMWF, ICON, MET Norway, Météo-France, JMA, |
| 18 | + GEM and UKMO are all reachable through the same interface. |
| 19 | + |
| 20 | +.. note:: |
| 21 | + |
| 22 | + Open-Meteo is free for non-commercial use, with a limit on the number of |
| 23 | + daily requests. Please read |
| 24 | + `their terms <https://open-meteo.com/en/terms>`_ before using it, and |
| 25 | + consider their paid plans for heavier or commercial workloads. |
| 26 | + |
| 27 | + |
| 28 | +Forecasts |
| 29 | +--------- |
| 30 | + |
| 31 | +Set the atmospheric model to ``open_meteo``. The launch date must be set, |
| 32 | +because the vertical profile is taken at the hour closest to it. |
| 33 | + |
| 34 | +.. jupyter-execute:: |
| 35 | + |
| 36 | + from datetime import datetime, timedelta |
| 37 | + from rocketpy import Environment |
| 38 | + |
| 39 | + tomorrow = datetime.now() + timedelta(days=1) |
| 40 | + |
| 41 | + env = Environment( |
| 42 | + date=tomorrow, |
| 43 | + latitude=39.3897, |
| 44 | + longitude=-8.28896388889, |
| 45 | + ) |
| 46 | + |
| 47 | + env.set_atmospheric_model(type="open_meteo") |
| 48 | + |
| 49 | + env.plots.atmospheric_model() |
| 50 | + |
| 51 | +Note that ``elevation`` was never specified above: Open-Meteo reports the |
| 52 | +elevation of the grid cell it answered for, and RocketPy uses it to set the |
| 53 | +launch site elevation automatically. |
| 54 | + |
| 55 | + |
| 56 | +Selecting a weather model |
| 57 | +^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 58 | + |
| 59 | +By default RocketPy asks for ``"best_match"``, which lets Open-Meteo pick the |
| 60 | +highest-resolution model available for the requested location. A specific model |
| 61 | +can be requested through the ``file`` argument: |
| 62 | + |
| 63 | +.. jupyter-execute:: |
| 64 | + |
| 65 | + env_ecmwf = Environment( |
| 66 | + date=tomorrow, |
| 67 | + latitude=39.3897, |
| 68 | + longitude=-8.28896388889, |
| 69 | + ) |
| 70 | + env_ecmwf.set_atmospheric_model(type="open_meteo", file="ecmwf_ifs025") |
| 71 | + env_ecmwf.plots.atmospheric_model() |
| 72 | + |
| 73 | +Frequently useful models are: |
| 74 | + |
| 75 | +.. list-table:: |
| 76 | + :header-rows: 1 |
| 77 | + :widths: 30 70 |
| 78 | + |
| 79 | + * - Model |
| 80 | + - Description |
| 81 | + * - ``best_match`` |
| 82 | + - Open-Meteo picks the best available model for the location (default). |
| 83 | + * - ``gfs_seamless`` |
| 84 | + - NOAA GFS, global coverage. |
| 85 | + * - ``ecmwf_ifs025`` |
| 86 | + - ECMWF IFS at 0.25°, global coverage. |
| 87 | + * - ``icon_seamless`` |
| 88 | + - DWD ICON, global coverage with a higher-resolution European nest. |
| 89 | + * - ``meteofrance_seamless`` |
| 90 | + - Météo-France ARPEGE/AROME. |
| 91 | + * - ``gem_seamless`` |
| 92 | + - Environment Canada GEM. |
| 93 | + * - ``ukmo_seamless`` |
| 94 | + - UK Met Office. |
| 95 | + |
| 96 | +.. seealso:: |
| 97 | + |
| 98 | + The `Open-Meteo documentation <https://open-meteo.com/en/docs>`_ lists every |
| 99 | + model available, along with its resolution and update frequency. |
| 100 | + |
| 101 | +.. important:: |
| 102 | + |
| 103 | + Not every model resolves every pressure level, and coverage varies with |
| 104 | + location. RocketPy silently drops the levels a model does not provide, so |
| 105 | + the resulting profile may reach a lower altitude for some models (for |
| 106 | + instance, ``ecmwf_ifs025`` tops out at 50 hPa while ``gfs_seamless`` |
| 107 | + reaches 30 hPa). Check ``env.max_expected_height`` if the ceiling matters |
| 108 | + for your simulation. |
| 109 | + |
| 110 | + |
| 111 | +Past launches |
| 112 | +------------- |
| 113 | + |
| 114 | +When the launch date is in the past, ``open_meteo`` transparently queries |
| 115 | +Open-Meteo's historical-forecast archive instead of the live forecast. No extra |
| 116 | +argument is needed: |
| 117 | + |
| 118 | +.. jupyter-execute:: |
| 119 | + |
| 120 | + env_past = Environment( |
| 121 | + date=datetime(2024, 1, 10, 12), |
| 122 | + latitude=39.3897, |
| 123 | + longitude=-8.28896388889, |
| 124 | + ) |
| 125 | + env_past.set_atmospheric_model(type="open_meteo") |
| 126 | + env_past.plots.atmospheric_model() |
| 127 | + |
| 128 | +This is the quickest way to reconstruct the atmosphere of a past flight, since |
| 129 | +it needs neither an external file nor a sounding station nearby. For |
| 130 | +comparison, see :ref:`reanalysis` and :ref:`soundings`. |
| 131 | + |
| 132 | +.. important:: |
| 133 | + |
| 134 | + Open-Meteo's historical data is built from its own archived forecast runs |
| 135 | + and only covers pressure levels **from around March 2021 onwards**. Earlier |
| 136 | + dates return no data, and RocketPy warns you when it detects one; use |
| 137 | + :ref:`reanalysis` or :ref:`soundings` for those instead. |
| 138 | + |
| 139 | +.. note:: |
| 140 | + |
| 141 | + Open-Meteo also offers an ERA5 archive endpoint, but it serves surface |
| 142 | + variables only and provides no pressure-level data, so RocketPy does not |
| 143 | + use it: it cannot produce a vertical profile. |
| 144 | + |
| 145 | + |
| 146 | +Ensemble forecasts |
| 147 | +------------------ |
| 148 | + |
| 149 | +Open-Meteo also exposes ensemble forecasts, where each member represents a |
| 150 | +slightly different evolution of the atmosphere. They are used exactly like the |
| 151 | +other :ref:`ensemble_atmosphere` models: |
| 152 | + |
| 153 | +.. jupyter-execute:: |
| 154 | + |
| 155 | + env_ensemble = Environment( |
| 156 | + date=tomorrow, |
| 157 | + latitude=39.3897, |
| 158 | + longitude=-8.28896388889, |
| 159 | + ) |
| 160 | + env_ensemble.set_atmospheric_model(type="open_meteo_ensemble", file="gfs05") |
| 161 | + |
| 162 | + print(f"Number of members: {env_ensemble.num_ensemble_members}") |
| 163 | + |
| 164 | + env_ensemble.plots.ensemble_member_comparison() |
| 165 | + |
| 166 | +Individual members are activated with |
| 167 | +:meth:`rocketpy.Environment.select_ensemble_member`: |
| 168 | + |
| 169 | +.. jupyter-execute:: |
| 170 | + |
| 171 | + env_ensemble.select_ensemble_member(10) |
| 172 | + print(f"Wind speed at 1 km: {env_ensemble.wind_speed(1000):.2f} m/s") |
| 173 | + |
| 174 | +Member ``0`` is the unperturbed control run and is the one selected by default. |
| 175 | + |
| 176 | +Two ensemble models publish the complete set of pressure-level variables that |
| 177 | +RocketPy needs: |
| 178 | + |
| 179 | +.. list-table:: |
| 180 | + :header-rows: 1 |
| 181 | + :widths: 30 20 50 |
| 182 | + |
| 183 | + * - Model |
| 184 | + - Members |
| 185 | + - Description |
| 186 | + * - ``gfs05`` |
| 187 | + - 31 |
| 188 | + - NOAA GEFS at 0.5° (default). |
| 189 | + * - ``ecmwf_ifs025`` |
| 190 | + - 51 |
| 191 | + - ECMWF ensemble at 0.25°. |
| 192 | + |
| 193 | +The member counts above include the control run, which RocketPy exposes as |
| 194 | +member ``0``. |
| 195 | + |
| 196 | +.. important:: |
| 197 | + |
| 198 | + The remaining Open-Meteo ensemble models cannot be used to build a vertical |
| 199 | + profile, so RocketPy rejects them with an explanatory error rather than |
| 200 | + failing later on. ``gfs025``, ``icon_global`` and |
| 201 | + ``bom_access_global_ensemble`` answer successfully but return no |
| 202 | + pressure-level values at all, and ``gem_global`` provides temperature and |
| 203 | + geopotential height but no pressure-level winds. |
| 204 | + |
| 205 | + |
| 206 | +Further considerations |
| 207 | +---------------------- |
| 208 | + |
| 209 | +Requests may fail if the API is unreachable or if the daily free-tier limit is |
| 210 | +exceeded. RocketPy retries transient failures automatically and raises a |
| 211 | +``RuntimeError`` with the reason reported by Open-Meteo when the request cannot |
| 212 | +be satisfied. |
| 213 | + |
| 214 | +.. seealso:: |
| 215 | + |
| 216 | + - :ref:`forecast` for OPeNDAP-based forecasts (GFS, NAM, RAP, HRRR). |
| 217 | + - :ref:`reanalysis` for ERA5 and MERRA-2 reanalysis files. |
| 218 | + - :ref:`ensemble_atmosphere` for the ensemble workflow in general. |
0 commit comments