|
| 1 | +.. _environment_other_apis: |
| 2 | + |
1 | 3 | Connecting to other APIs |
2 | 4 | ======================== |
3 | 5 |
|
@@ -25,14 +27,19 @@ the following dimensions and variables: |
25 | 27 | - Latitude |
26 | 28 | - Longitude |
27 | 29 | - Pressure Levels |
| 30 | +- Temperature (as a function of Time, Pressure Levels, Latitude and Longitude) |
28 | 31 | - 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) |
29 | 33 | - Surface Geopotential Height (as a function of Time, Latitude and Longitude) |
| 34 | + (optional) |
30 | 35 | - Wind - U Component (as a function of Time, Pressure Levels, Latitude and Longitude) |
31 | 36 | - Wind - V Component (as a function of Time, Pressure Levels, Latitude and Longitude) |
32 | 37 |
|
| 38 | +Some projected grids also require a ``projection`` key in the mapping. |
| 39 | + |
33 | 40 |
|
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. |
36 | 43 |
|
37 | 44 |
|
38 | 45 | Looking through the variable list in the link above, we find the following correspondence: |
@@ -72,15 +79,52 @@ Therefore, we can create an environment like this: |
72 | 79 | dictionary=name_mapping, |
73 | 80 | ) |
74 | 81 |
|
| 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 | +For custom dictionaries, the canonical structure is: |
| 100 | + |
| 101 | +.. code-block:: python |
| 102 | +
|
| 103 | + mapping = { |
| 104 | + "time": "time", |
| 105 | + "latitude": "lat", |
| 106 | + "longitude": "lon", |
| 107 | + "level": "lev", |
| 108 | + "temperature": "tmpprs", |
| 109 | + "surface_geopotential_height": "hgtsfc", # optional |
| 110 | + "geopotential_height": "hgtprs", # or geopotential |
| 111 | + "geopotential": None, |
| 112 | + "u_wind": "ugrdprs", |
| 113 | + "v_wind": "vgrdprs", |
| 114 | + } |
| 115 | +
|
| 116 | +.. important:: |
| 117 | + |
| 118 | + Ensemble datasets require an additional key for member selection: |
| 119 | + ``"ensemble": "<your_member_dimension_name>"``. |
| 120 | + |
75 | 121 | .. caution:: |
76 | 122 |
|
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. |
| 123 | + The ``file`` argument was intentionally omitted in the example above. This is |
| 124 | + because the URL depends on the provider, dataset, and date you are running |
| 125 | + the simulation. Build the endpoint according to the provider specification |
| 126 | + and always validate that the target service is active before running your |
| 127 | + simulation workflow. |
84 | 128 |
|
85 | 129 |
|
86 | 130 | Without OPeNDAP protocol |
|
0 commit comments