|
41 | 41 | "source": [ |
42 | 42 | "This notebook provides a practical introduction on how to access, visualize and analyse [GTSMip tide and surge water level timeseries](https://cds.climate.copernicus.eu/datasets/sis-water-level-change-timeseries-cmip6?tab=overview) data available in the Climate Data Store (CDS) of the Copernicus Climate Change Service (C3S), developed by Deltares in order to accompany the dataset. This data is the output of the the global tide and surge model [GTSMv3.0](https://www.deltares.nl/en/expertise/projects/global-modelling-of-tides-and-storm-surges). \n", |
43 | 43 | "\n", |
44 | | - "The GTSMip dataset on CDS includes total water level, surge and tidal elevation timeseries, as well as annual mean sea level values (based on sea level rise projections). Next to the reanalysis data forced with ERA5, also model timeseries forced with several high-resolution climate models (HighResMIP) are available for the period of 1950 to 2050. The timeseries are available for a large number of offshore and coastal locations (over 43.000 locations globally). For more information on the full dataset, please refer to the [Product User Guide](https://cds.climate.copernicus.eu/datasets/sis-water-level-change-timeseries-cmip6?tab=documentation).\n", |
| 44 | + "The GTSMip dataset on CDS includes total water level, surge and tidal elevation timeseries, as well as annual mean sea level values (based on sea level rise projections). Next to the reanalysis data forced with [ERA5](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=overview), also model timeseries forced with several high-resolution climate models (HighResMIP) are available for the period of 1950 to 2050. The timeseries are available for a large number of offshore and coastal locations (over 43.000 locations globally). For more information on the full dataset, please refer to the [Product User Guide](https://cds.climate.copernicus.eu/datasets/sis-water-level-change-timeseries-cmip6?tab=documentation).\n", |
45 | 45 | "\n", |
46 | 46 | "In this notebook we use the data from the GTSM `reanalysis` experiment where the surges were generated using the ERA5 meteorological reanalysis. This data is available for the period from 1950 onwards. We use the reanalysis experiment data to explore historical storm events. Reanalysis experiment data is useful for analyzing the contribution of surge to high coastal water levels, and as input for hydrodynamic modelling on local scale, including scenario modelling." |
47 | 47 | ] |
|
282 | 282 | "- tidal elevation at 10 min temporal resolution for the specified period relevant to the selected storm - this data is used to visually inspect the contribution of tidal elevation to total water levels during the storm;\n", |
283 | 283 | "- Mean sea level for multiple years to better understand the vertical reference of the data and the contribution of sea level rise.\n", |
284 | 284 | "\n", |
285 | | - "At the moment it is not possible to download the data within a geografical bounding box, therefore we download the full dataset for the given year. " |
| 285 | + "At the moment it is not possible to download the data within a geografical bounding box, therefore we download the full dataset for the given year. In total, this notebook will download about 300 MB of data." |
286 | 286 | ] |
287 | 287 | }, |
288 | 288 | { |
|
312 | 312 | "name": "stderr", |
313 | 313 | "output_type": "stream", |
314 | 314 | "text": [ |
315 | | - "2025-06-18 14:33:03,525 INFO [2025-06-16T00:00:00] CC-BY licence to replace Licence to use Copernicus Products on 02 July 2025. More information available [here](https://forum.ecmwf.int/t/cc-by-licence-to-replace-licence-to-use-copernicus-products-on-02-july-2025/13464)\n", |
316 | | - "2025-06-18 14:33:03,527 INFO [2025-06-10T00:00:00] To improve our C3S service, we need to hear from you! Please complete this very short [survey](https://confluence.ecmwf.int/x/E7uBEQ/). Thank you.\n", |
317 | | - "2025-06-18 14:33:03,528 INFO [2024-09-26T00:00:00] Watch our [Forum](https://forum.ecmwf.int/) for Announcements, news and other discussed topics.\n" |
| 315 | + "2025-08-22 10:32:39,085 INFO [2024-09-26T00:00:00] Watch our [Forum](https://forum.ecmwf.int/) for Announcements, news and other discussed topics.\n" |
318 | 316 | ] |
319 | 317 | } |
320 | 318 | ], |
|
323 | 321 | "c = cdsapi.Client(url=URL, key=KEY)" |
324 | 322 | ] |
325 | 323 | }, |
| 324 | + { |
| 325 | + "cell_type": "markdown", |
| 326 | + "metadata": {}, |
| 327 | + "source": [ |
| 328 | + ":::{note}\n", |
| 329 | + "\n", |
| 330 | + "If the data request does not run successfully, please check the [CDS system status page](https://cds.climate.copernicus.eu/live). If the problem persists, consider reaching out to [CDS Support](https://cds.climate.copernicus.eu/help).\n", |
| 331 | + "\n", |
| 332 | + ":::" |
| 333 | + ] |
| 334 | + }, |
326 | 335 | { |
327 | 336 | "cell_type": "code", |
328 | | - "execution_count": 43, |
| 337 | + "execution_count": 11, |
329 | 338 | "metadata": {}, |
330 | 339 | "outputs": [ |
331 | 340 | { |
332 | 341 | "name": "stderr", |
333 | 342 | "output_type": "stream", |
334 | 343 | "text": [ |
335 | | - "2025-06-18 14:50:54,680 INFO Request ID is 9fd69b40-8093-45cc-abf9-83f17e0878b6\n", |
336 | | - "2025-06-18 14:50:54,811 INFO status has been updated to accepted\n", |
337 | | - "2025-06-18 14:51:27,862 INFO status has been updated to successful\n", |
| 344 | + "2025-08-22 10:41:51,350 INFO [2025-04-17T00:00:00] A new version has been added requiring a change to the download form. Users are advised that CDS API requests will need to be updated to accommodate this change. Please see the known issues under the Documentation tab for more information regarding the version update.\n", |
| 345 | + "2025-08-22 10:41:51,350 INFO Request ID is 53d90b3d-6474-4d7c-a24c-f334dc13f089\n", |
| 346 | + "2025-08-22 10:41:51,409 INFO status has been updated to accepted\n", |
| 347 | + "2025-08-22 10:42:05,162 INFO status has been updated to running\n", |
| 348 | + "2025-08-22 10:42:12,788 INFO status has been updated to successful\n", |
338 | 349 | " \r" |
339 | 350 | ] |
340 | 351 | }, |
|
344 | 355 | "'./data_dir/water_levels_2023.zip'" |
345 | 356 | ] |
346 | 357 | }, |
347 | | - "execution_count": 43, |
| 358 | + "execution_count": 11, |
348 | 359 | "metadata": {}, |
349 | 360 | "output_type": "execute_result" |
350 | 361 | } |
|
361 | 372 | " 'year': year,\n", |
362 | 373 | " 'month': [f'{mm:02}' for mm in range(datetime.strptime(starttime + f' {year}', '%d %B %Y').month,\n", |
363 | 374 | " datetime.strptime(endtime + f' {year}', '%d %B %Y').month+1)],\n", |
| 375 | + " 'version': [\"v3\"],\n", |
364 | 376 | " 'format': 'zip',\n", |
365 | 377 | " },\n", |
366 | 378 | " filename)" |
367 | 379 | ] |
368 | 380 | }, |
369 | 381 | { |
370 | 382 | "cell_type": "code", |
371 | | - "execution_count": 44, |
| 383 | + "execution_count": 12, |
372 | 384 | "metadata": {}, |
373 | 385 | "outputs": [ |
374 | 386 | { |
375 | 387 | "name": "stderr", |
376 | 388 | "output_type": "stream", |
377 | 389 | "text": [ |
378 | | - "2025-06-18 14:51:33,900 INFO Request ID is 4923d5e7-b23f-474c-abe5-1e45c0c39bbc\n", |
379 | | - "2025-06-18 14:51:33,988 INFO status has been updated to accepted\n", |
380 | | - "2025-06-18 14:51:47,588 INFO status has been updated to successful\n", |
381 | | - " \r" |
| 390 | + "2025-08-22 10:43:11,283 INFO [2025-04-17T00:00:00] A new version has been added requiring a change to the download form. Users are advised that CDS API requests will need to be updated to accommodate this change. Please see the known issues under the Documentation tab for more information regarding the version update.\n", |
| 391 | + "2025-08-22 10:43:11,283 INFO Request ID is e60cb44a-f9b0-4160-941a-fe94f14c9d6b\n", |
| 392 | + "2025-08-22 10:43:11,307 INFO status has been updated to accepted\n", |
| 393 | + "2025-08-22 10:43:24,870 INFO status has been updated to running\n", |
| 394 | + "2025-08-22 10:43:32,553 INFO status has been updated to successful\n", |
| 395 | + " \r" |
382 | 396 | ] |
383 | 397 | }, |
384 | 398 | { |
|
387 | 401 | "'./data_dir/tide_2023.zip'" |
388 | 402 | ] |
389 | 403 | }, |
390 | | - "execution_count": 44, |
| 404 | + "execution_count": 12, |
391 | 405 | "metadata": {}, |
392 | 406 | "output_type": "execute_result" |
393 | 407 | } |
|
404 | 418 | " 'year': year,\n", |
405 | 419 | " 'month': [f'{mm:02}' for mm in range(datetime.strptime(starttime + f' {year}', '%d %B %Y').month,\n", |
406 | 420 | " datetime.strptime(endtime + f' {year}', '%d %B %Y').month+1)],\n", |
| 421 | + " 'version': [\"v1\"],\n", |
407 | 422 | " 'format': 'zip',\n", |
408 | 423 | " },\n", |
409 | 424 | " filename)" |
410 | 425 | ] |
411 | 426 | }, |
412 | 427 | { |
413 | 428 | "cell_type": "code", |
414 | | - "execution_count": 10, |
| 429 | + "execution_count": 14, |
415 | 430 | "metadata": {}, |
416 | 431 | "outputs": [ |
417 | 432 | { |
418 | 433 | "name": "stderr", |
419 | 434 | "output_type": "stream", |
420 | 435 | "text": [ |
421 | | - "2025-06-18 14:36:53,613 INFO Request ID is 16b9a23b-ce39-4a2e-bbbd-e697d4d05307\n", |
422 | | - "2025-06-18 14:36:53,688 INFO status has been updated to accepted\n", |
423 | | - "2025-06-18 14:37:07,451 INFO status has been updated to successful\n", |
| 436 | + "2025-08-22 11:46:45,514 INFO [2025-04-17T00:00:00] A new version has been added requiring a change to the download form. Users are advised that CDS API requests will need to be updated to accommodate this change. Please see the known issues under the Documentation tab for more information regarding the version update.\n", |
| 437 | + "2025-08-22 11:46:45,514 INFO Request ID is 004ce407-2bd3-4caf-8491-f48d045a6da5\n", |
| 438 | + "2025-08-22 11:46:45,643 INFO status has been updated to accepted\n", |
| 439 | + "2025-08-22 11:47:18,132 INFO status has been updated to successful\n", |
424 | 440 | " \r" |
425 | 441 | ] |
426 | 442 | }, |
|
430 | 446 | "'./data_dir/MSL.zip'" |
431 | 447 | ] |
432 | 448 | }, |
433 | | - "execution_count": 10, |
| 449 | + "execution_count": 14, |
434 | 450 | "metadata": {}, |
435 | 451 | "output_type": "execute_result" |
436 | 452 | } |
|
445 | 461 | " 'experiment': ['historical', 'future'],\n", |
446 | 462 | " 'temporal_aggregation': ['annual'],\n", |
447 | 463 | " 'year': [str(x) for x in list(range(1985, year+1))],\n", |
| 464 | + " 'version': [\"v1\"],\n", |
448 | 465 | " 'format': 'zip',\n", |
449 | 466 | " },\n", |
450 | 467 | " filename)" |
|
461 | 478 | "cell_type": "markdown", |
462 | 479 | "metadata": {}, |
463 | 480 | "source": [ |
464 | | - "From the CDS, the GTSMip water level data are available as `NetCDF` files compressed into `zip` archives. For this reason, before we can load any data, we have to extract the files. We can use the functions from the `zipfile` Python package to extract their contents. For each zip file we first construct a `ZipFile()` object, then we apply the function `extractall()` to extract its content." |
| 481 | + "From the CDS, the GTSMip water level data are available as netCDF files compressed into `zip` archives. For this reason, before we can load any data, we have to extract the files. We can use the functions from the `zipfile` Python package to extract their contents. For each zip file we first construct a `ZipFile()` object, then we apply the function `extractall()` to extract its content." |
465 | 482 | ] |
466 | 483 | }, |
467 | 484 | { |
|
483 | 500 | "source": [ |
484 | 501 | "### Create a list of the retrieved data files\n", |
485 | 502 | "\n", |
486 | | - "The data was downloaded in separate files, each corresponding to a variable and a month of the year or full year (in the case of MSL). To facilitate data analysis later in the tutorial, we can create a list of the extracted NetCDF files for water level, surge and tide variables:" |
| 503 | + "The data was downloaded in separate files, each corresponding to a variable and a month of the year or full year (in the case of MSL). To facilitate data analysis later in the tutorial, we can create a list of the extracted netCDF files for water level, surge and tide variables:" |
487 | 504 | ] |
488 | 505 | }, |
489 | 506 | { |
|
505 | 522 | "cell_type": "markdown", |
506 | 523 | "metadata": {}, |
507 | 524 | "source": [ |
508 | | - "We can inspect these lists by printing their elements - filenames of the extracted NetCDF files:" |
| 525 | + "We can inspect these lists by printing their elements - filenames of the extracted netCDF files:" |
509 | 526 | ] |
510 | 527 | }, |
511 | 528 | { |
|
568 | 585 | "cell_type": "markdown", |
569 | 586 | "metadata": {}, |
570 | 587 | "source": [ |
571 | | - "We begin by opening the downloaded water level timeseries NetCDF files in our list. We can use the Python library [xarray](http://xarray.pydata.org/en/stable/) and its function `open_mfdataset` to read in multiple NetCDF files. \n", |
| 588 | + "We begin by opening the downloaded water level timeseries netCDF files in our list. We can use the Python library [xarray](http://xarray.pydata.org/en/stable/) and its function `open_mfdataset` to read in multiple netCDF files. \n", |
572 | 589 | "\n", |
573 | 590 | "The result is a `xarray.Dataset` object with two dimensions: `time` and `stations`. Each station correspond to coordinates `station_x_coordinate` and `station_y_coordinate`. By looking at the contents of the dataset we see that it contains 43119 stations. Please note, that after this step the dataset is opened, but not yet loaded into memory." |
574 | 591 | ] |
|
4826 | 4843 | "print(\"MSL in %i at the location of interest: %.2f m\" % (year, MSL_year))" |
4827 | 4844 | ] |
4828 | 4845 | }, |
| 4846 | + { |
| 4847 | + "cell_type": "markdown", |
| 4848 | + "metadata": {}, |
| 4849 | + "source": [ |
| 4850 | + "## Take home messages" |
| 4851 | + ] |
| 4852 | + }, |
4829 | 4853 | { |
4830 | 4854 | "cell_type": "markdown", |
4831 | 4855 | "metadata": {}, |
|
4844 | 4868 | ], |
4845 | 4869 | "metadata": { |
4846 | 4870 | "kernelspec": { |
4847 | | - "display_name": "cds_training_material", |
| 4871 | + "display_name": "default", |
4848 | 4872 | "language": "python", |
4849 | 4873 | "name": "python3" |
4850 | 4874 | }, |
|
4858 | 4882 | "name": "python", |
4859 | 4883 | "nbconvert_exporter": "python", |
4860 | 4884 | "pygments_lexer": "ipython3", |
4861 | | - "version": "3.13.0" |
| 4885 | + "version": "3.12.10" |
4862 | 4886 | } |
4863 | 4887 | }, |
4864 | 4888 | "nbformat": 4, |
|
0 commit comments