Skip to content

Commit 32deb80

Browse files
authored
Examples of open-meteo added
1 parent 7722331 commit 32deb80

2 files changed

Lines changed: 448 additions & 70 deletions

File tree

openDataVisio/datadownload/data-download.ipynb

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"## The development environment setup\n",
2323
"The tutorials use the [Python](https://www.python.org/) programming language and its libraries:\n",
2424
"- [`earthkit`](https://earthkit.readthedocs.io/en/latest/) to speed up weather and climate science workflows\n",
25-
"- [`ecmwf-opendata`](https://github.com/ecmwf/ecmwf-opendata)to download the ECMWF open data\n",
25+
"- [`ecmwf-opendata`](https://github.com/ecmwf/ecmwf-opendata) to download the ECMWF open data\n",
2626
"- [`numpy`](https://pypi.org/project/numpy/c) for scientific computing of multi-dimensional arrays\n",
2727
"- [`cfgrib`](https://pypi.org/project/cfgrib/) to map GRIB files to the netCDF\n",
2828
"- [`requests`](https://pypi.org/project/requests/) (or urllib3, [`wget`](https://www.gnu.org/software/wget/manual/wget.html)) for sending HTTP requests\n",
@@ -1019,16 +1019,6 @@
10191019
"id": "14889769-196b-42cf-aeed-73de42bcef37",
10201020
"metadata": {},
10211021
"source": [
1022-
"When you need to download a single field from a GRIB file, inspect the corresponding index file and look for the parameter of your interest. For example, to download only the 2m temperature at step=0h from the 00 UTC HRES forecast on 08 June 2025\n",
1023-
"```\n",
1024-
"{\"domain\": \"g\", \"date\": \"20250608\", \"time\": \"0000\", \"expver\": \"0001\", \"class\": \"od\", \"type\": \"fc\", \"stream\": \"oper\", \"step\": \"0\", \"levtype\": \"sfc\", \"param\": \"2t\", \"_offset\": 62556419, \"_length\": 660091}\n",
1025-
"```\n",
1026-
"use the values of `_offset` and `_length` keys and calculate the `start_bytes` and `end_bytes` (the `_offset` and `_length` values of a specific field are different for each forecast run!)\n",
1027-
"```\n",
1028-
"start_bytes = _offset = 62556419\n",
1029-
"end_bytes = _offset + _length - 1 = 62556419 + 660091 - 1 = 63216509\n",
1030-
"```\n",
1031-
"\n",
10321022
"```\n",
10331023
"ROOT=\"https://data.ecmwf.int/forecasts\"\n",
10341024
"yyyymmdd=\"20250608\"\n",
@@ -1064,6 +1054,40 @@
10641054
"For more information, see [Access real-time open data with `wget`](https://confluence.ecmwf.int/display/DAC/ECMWF+open+data%3A+real-time+forecasts+from+IFS+and+AIFS#ECMWFopendata:realtimeforecastsfromIFSandAIFS-Locations).\n",
10651055
":::"
10661056
]
1057+
},
1058+
{
1059+
"cell_type": "markdown",
1060+
"id": "75f0f714-1d0c-4349-b7ca-caa0140e32c1",
1061+
"metadata": {},
1062+
"source": [
1063+
"### 4. The [`curl`](https://curl.se/) command-line tool\n",
1064+
"When you need to download a single field from a GRIB file, inspect the corresponding index file and look for the parameter of your interest. For example, to download only the 2m temperature at step=0h from the 00 UTC HRES forecast on 08 June 2025\n",
1065+
"```\n",
1066+
"{\"domain\": \"g\", \"date\": \"20250608\", \"time\": \"0000\", \"expver\": \"0001\", \"class\": \"od\", \"type\": \"fc\", \"stream\": \"oper\", \"step\": \"0\", \"levtype\": \"sfc\", \"param\": \"2t\", \"_offset\": 62556419, \"_length\": 660091}\n",
1067+
"```\n",
1068+
"use the values of `_offset` and `_length` keys and calculate the `start_bytes` and `end_bytes` (the `_offset` and `_length` values of a specific field are different for each forecast run!)\n",
1069+
"```\n",
1070+
"start_bytes = _offset = 62556419\n",
1071+
"end_bytes = _offset + _length - 1 = 62556419 + 660091 - 1 = 63216509\n",
1072+
"```\n",
1073+
"\n",
1074+
"```\n",
1075+
"ROOT=\"https://data.ecmwf.int/forecasts\"\n",
1076+
"yyyymmdd=\"20250608\"\n",
1077+
"HH=\"00\"\n",
1078+
"model=\"ifs\"\n",
1079+
"resol=\"0p25\"\n",
1080+
"stream=\"oper\"\n",
1081+
"step=\"0\"\n",
1082+
"U=\"h\"\n",
1083+
"type=\"fc\"\n",
1084+
"format=\"grib2\"\n",
1085+
"start_bytes=62556419\n",
1086+
"end_bytes=63216509\n",
1087+
"\n",
1088+
"curl --range \"$start_bytes-$end_bytes\" \"$ROOT/$yyyymmdd/$HH\"z\"/$model/$resol/$stream/$yyyymmdd$HH\"0000\"-$step$U-$stream-$type.$format\" --output 2t.grib2\n",
1089+
"```"
1090+
]
10671091
}
10681092
],
10691093
"metadata": {
@@ -1082,7 +1106,7 @@
10821106
"name": "python",
10831107
"nbconvert_exporter": "python",
10841108
"pygments_lexer": "ipython3",
1085-
"version": "3.10.17"
1109+
"version": "3.12.3"
10861110
},
10871111
"widgets": {
10881112
"application/vnd.jupyter.widget-state+json": {

0 commit comments

Comments
 (0)