1+ .. _environment_other_apis :
2+
13Connecting to other APIs
24========================
35
@@ -25,14 +27,19 @@ the following dimensions and variables:
2527- Latitude
2628- Longitude
2729- Pressure Levels
30+ - Temperature (as a function of Time, Pressure Levels, Latitude and Longitude)
2831- Geopotential Height (as a function of Time, Pressure Levels, Latitude and Longitude)
32+ - or Geopotential (as a function of Time, Pressure Levels, Latitude and Longitude)
2933- Surface Geopotential Height (as a function of Time, Latitude and Longitude)
34+ (optional)
3035- Wind - U Component (as a function of Time, Pressure Levels, Latitude and Longitude)
3136- Wind - V Component (as a function of Time, Pressure Levels, Latitude and Longitude)
3237
38+ Some projected grids also require a ``projection `` key in the mapping.
39+
3340
34- For example, let's imagine we want to use the HIRESW model from this endpoint:
35- ` https://nomads.ncep.noaa.gov/dods/hiresw/ < https://nomads.ncep.noaa.gov/dods/hiresw/ >`_
41+ For example, let's imagine we want to use a forecast model available via an
42+ OPeNDAP endpoint.
3643
3744
3845Looking through the variable list in the link above, we find the following correspondence:
@@ -72,15 +79,85 @@ Therefore, we can create an environment like this:
7279 dictionary = name_mapping,
7380 )
7481
82+ Built-in mapping dictionaries
83+ -----------------------------
84+
85+ Instead of a custom dictionary, you can pass a built-in mapping name in the
86+ ``dictionary `` argument. Common options include:
87+
88+ - ``"ECMWF" ``
89+ - ``"ECMWF_v0" ``
90+ - ``"NOAA" ``
91+ - ``"GFS" ``
92+ - ``"NAM" ``
93+ - ``"RAP" ``
94+ - ``"HIRESW" `` (mapping available; latest-model shortcut currently disabled)
95+ - ``"GEFS" `` (mapping available; latest-model shortcut currently disabled)
96+ - ``"MERRA2" ``
97+ - ``"CMC" `` (for compatible datasets loaded explicitly)
98+
99+ What a mapping name means
100+ ^^^^^^^^^^^^^^^^^^^^^^^^^
101+
102+ - Base mapping names (for example ``"GFS" ``, ``"NAM" `` and ``"RAP" ``) map
103+ RocketPy weather keys to the current default variable naming used by the
104+ corresponding provider datasets.
105+ - These defaults are aligned with current shortcut workflows (for example,
106+ THREDDS-backed latest model sources) and may use projected coordinates
107+ (``x ``/``y `` plus ``projection ``) depending on the model.
108+
109+ Legacy mapping names
110+ ^^^^^^^^^^^^^^^^^^^^
111+
112+ If you are loading archived or older NOMADS-style datasets, use the explicit
113+ legacy aliases:
114+
115+ - ``"GFS_LEGACY" ``
116+ - ``"NAM_LEGACY" ``
117+ - ``"NOAA_LEGACY" ``
118+ - ``"RAP_LEGACY" ``
119+ - ``"CMC_LEGACY" ``
120+ - ``"GEFS_LEGACY" ``
121+ - ``"HIRESW_LEGACY" ``
122+ - ``"MERRA2_LEGACY" ``
123+
124+ Legacy aliases primarily cover older variable naming patterns such as
125+ ``lev ``, ``tmpprs ``, ``hgtprs ``, ``ugrdprs `` and ``vgrdprs ``.
126+
127+ .. note ::
128+
129+ Mapping names are case-insensitive. For example,
130+ ``"gfs_legacy" `` and ``"GFS_LEGACY" `` are equivalent.
131+
132+ For custom dictionaries, the canonical structure is:
133+
134+ .. code-block :: python
135+
136+ mapping = {
137+ " time" : " time" ,
138+ " latitude" : " lat" ,
139+ " longitude" : " lon" ,
140+ " level" : " lev" ,
141+ " temperature" : " tmpprs" ,
142+ " surface_geopotential_height" : " hgtsfc" , # optional
143+ " geopotential_height" : " hgtprs" , # or geopotential
144+ " geopotential" : None ,
145+ " u_wind" : " ugrdprs" ,
146+ " v_wind" : " vgrdprs" ,
147+ }
148+
149+ .. important ::
150+
151+ Ensemble datasets require an additional key for member selection:
152+ ``"ensemble": "<your_member_dimension_name>" ``.
153+
75154.. caution ::
76155
77- Notice the ``file `` argument were suppressed in the code above. This is because \
78- the URL depends on the date you are running the simulation. For example, as \
79- it for now, a possible link could be: https://nomads.ncep.noaa.gov/dods/hiresw/hiresw20240803/hiresw_conusfv3_12z \
80- (for the 3rd of August, 2024, at 12:00 UTC). \
81- You should replace the date in the URL with the date you are running the simulation. \
82- Different models may have different URL structures, so be sure to check the \
83- documentation of the model you are using.
156+ The ``file `` argument was intentionally omitted in the example above. This is
157+ because the URL depends on the provider, dataset, and date you are running
158+ the simulation. Build the endpoint according to the provider specification
159+ and always validate that the target service is active before running your
160+ simulation workflow.
84161
85162
86163Without OPeNDAP protocol
@@ -94,4 +171,3 @@ Environment class, for example:
94171
95172- `Meteomatics <https://www.meteomatics.com/en/weather-api/ >`_: `#545 <https://github.com/RocketPy-Team/RocketPy/issues/545 >`_
96173- `Open-Meteo <https://open-meteo.com/ >`_: `#520 <https://github.com/RocketPy-Team/RocketPy/issues/520 >`_
97-
0 commit comments