{ "cells": [ { "cell_type": "markdown", "id": "af03aaf5-a602-4aea-bbd4-e21684c26ca3", "metadata": {}, "source": [ "## Accessing Deltares global water availability on Azure\n", "\n", "[Deltares](https://www.deltares.nl/en/) has produced a hydrological model approach to simulate historical daily reservoir variations for 3,236 locations across the globe for the period 1970-2020 using the distributed [wflow_sbm](https://deltares.github.io/Wflow.jl/stable/model_docs/model_configurations/) model. The model outputs long-term daily information on reservoir volume, inflow and outflow dynamics, as well as information on upstream hydrological forcing.\n", "\n", "They hydrological model was forced with 5 different precipitation products. Two products (ERA5 and CHIRPS) are available at the global scale, while for Europe, USA and Australia a regional product was use (i.e. EOBS, NLDAS and BOM, respectively). Using these different precipitation products, it becomes possible to assess the impact of uncertainty in the model forcing. A different number of basins upstream of reservoirs are simulated, given the spatial coverage of each precipitation product." ] }, { "cell_type": "markdown", "id": "438bfb53-5ba4-409f-bd35-df30fc0447aa", "metadata": {}, "source": [ "### Environment setup" ] }, { "cell_type": "code", "execution_count": 1, "id": "47daedc5-caf5-4760-bcec-4346551bba4d", "metadata": { "tags": [] }, "outputs": [], "source": [ "import warnings\n", "\n", "warnings.simplefilter(\"ignore\")\n", "\n", "import fsspec\n", "import xarray as xr\n", "import pystac_client\n", "import planetary_computer\n", "import requests\n", "import geopandas\n", "import contextily\n", "import dask.distributed" ] }, { "cell_type": "markdown", "id": "1c287e27-2523-44f4-9de9-c7356132c20d", "metadata": {}, "source": [ "### Create a local Dask cluster\n", "\n", "Enable parallel reads and processing of data using Dask and xarray." ] }, { "cell_type": "code", "execution_count": 2, "id": "876954dc-27e1-4e60-847f-68c00a251973", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/user/taugspurger@microsoft.com/proxy/8787/status\n" ] } ], "source": [ "client = dask.distributed.Client(processes=False)\n", "print(client.dashboard_link)" ] }, { "cell_type": "markdown", "id": "11f3a3ae-f511-4b95-835a-02a51634fab9", "metadata": {}, "source": [ "### Data access\n", "\n", "The collection is made up of five netCDF files, each corresponding to a different precipitation product for hydrological model forcing. Each variation covers a different spatial extent, with different number of reservoirs modeled. We'll choose one of the smaller files using a [BOM](http://www.bom.gov.au/) dataset covering Australia here. The `delatres:reservoir` key can be used to filter to a specific dataset.\n", "\n", "The other files available from the same root store are `CHIRPS`, `EOBS`, `ERA5`, and `NLDAS`.\n", "\n", "We'll open the dataset and look at the variables and dimensions it contains." ] }, { "cell_type": "code", "execution_count": 3, "id": "ef233efe-4f85-4989-b933-72c242b35c12", "metadata": { "tags": [] }, "outputs": [], "source": [ "catalog = pystac_client.Client.open(\n", " \"https://planetarycomputer.microsoft.com/api/stac/v1\",\n", " modifier=planetary_computer.sign_inplace,\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "15e0a8f2-ca63-4c16-8ff0-773392e17e22", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
id: BOM |
bbox: [115.95417023, -43.04583359, 153.3374939, -17.17083359] |
datetime: 1982-01-01T00:00:00Z |
end_datetime: 2020-12-31T00:00:00Z |
cube:variables: {'P': {'type': 'data', 'unit': 'mm per day', 'attrs': {'units': 'mm per day', 'description': 'Average precipitation upstream of reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Average precipitation upstream of reservoir'}, 'ETa': {'type': 'data', 'unit': 'mm per day', 'attrs': {'units': 'mm per day', 'description': 'Average simulated actual evapotransporation upstream of reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Average simulated actual evapotransporation upstream of reservoir'}, 'PET': {'type': 'data', 'unit': 'mm per day', 'attrs': {'units': 'mm per day', 'description': 'Average potential evapotranspiration upstream of reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Average potential evapotranspiration upstream of reservoir'}, 'Melt': {'type': 'data', 'unit': 'mm per day', 'attrs': {'units': 'mm per day', 'description': 'Average simulated snow melt upstream of reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Average simulated snow melt upstream of reservoir'}, 'Snow': {'type': 'data', 'unit': 'mm', 'attrs': {'units': 'mm', 'description': 'Average simulated snow depth upstream of reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Average simulated snow depth upstream of reservoir'}, 'Temp': {'type': 'data', 'unit': 'degrees C', 'attrs': {'units': 'degrees C', 'description': 'Average surface temperature upstream of reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Average surface temperature upstream of reservoir'}, 'P_res': {'type': 'data', 'unit': 'mm per day', 'attrs': {'units': 'mm per day', 'description': 'Precipitation reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Precipitation reservoir'}, 'S_res': {'type': 'data', 'unit': 'm3', 'attrs': {'units': 'm3', 'description': 'Simulated reservoir volume'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Simulated reservoir volume'}, 'Ea_res': {'type': 'data', 'unit': 'mm per day', 'attrs': {'units': 'mm per day', 'description': 'Simulated actual evaporation reservoir'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Simulated actual evaporation reservoir'}, 'Qin_res': {'type': 'data', 'unit': 'm3 per s', 'attrs': {'units': 'm3 per s', 'description': 'Simulated reservoir inflow (surface+subsurface)'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Simulated reservoir inflow (surface+subsurface)'}, 'FracFull': {'type': 'data', 'unit': 'm3', 'attrs': {'units': 'm3', 'description': 'Simulated reservoir volume'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Simulated reservoir volume'}, 'Qout_res': {'type': 'data', 'unit': 'm3 per s', 'attrs': {'units': 'm3 per s', 'description': 'Simulated reservoir outflow'}, 'shape': [14245, 116, 5], 'dimensions': ['time', 'GrandID', 'ksathorfrac'], 'description': 'Simulated reservoir outflow'}, 'latitude': {'type': 'data', 'unit': 'degrees', 'attrs': {'units': 'degrees', 'description': 'Latitude of reservoir'}, 'shape': [116], 'dimensions': ['GrandID'], 'description': 'Latitude of reservoir'}, 'longitude': {'type': 'data', 'unit': 'degrees', 'attrs': {'units': 'degrees', 'description': 'Longitude of reservoir'}, 'shape': [116], 'dimensions': ['GrandID'], 'description': 'Longitude of reservoir'}} |
start_datetime: 1982-01-01T00:00:00Z |
cube:dimensions: {'time': {'step': 'P1DT0H0M0S', 'type': 'temporal', 'extent': ['1982-01-01T00:00:00Z', '2020-12-31T00:00:00Z']}, 'GrandID': {'type': 'identifier', 'extent': [5822, 6752], 'description': 'GrandID number of the reservoir of interest'}, 'ksathorfrac': {'type': 'level', 'values': [5, 20, 50, 100, 250], 'description': 'Five different value lateral anisotropy values used'}} |
deltares:reservoir: BOM |
https://stac-extensions.github.io/datacube/v2.0.0/schema.json |
href: https://deltaresreservoirssa.blob.core.windows.net/reservoirs/v2021.12/reservoirs_BOM.nc?st=2023-10-10T11%3A43%3A01Z&se=2023-10-18T11%3A43%3A02Z&sp=rl&sv=2021-06-08&sr=c&skoid=c85c15d6-d1ae-42d4-af60-e2ca0f81359b&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2023-10-11T11%3A43%3A00Z&ske=2023-10-18T11%3A43%3A00Z&sks=b&skv=2021-06-08&sig=PLo049qGIsJeYKHbZfTY4Pi4%2BysZgKz7qIh0l0Dy9CE%3D |
type: application/x-netcdf |
title: Flood Map |
description: Inundation maps of flood depth using a model that takes into account water level attenuation and is forced by sea level. |
roles: ['data'] |
owner: BOM |
href: https://deltaresreservoirssa.blob.core.windows.net/references/reservoirs/BOM.json?st=2023-10-10T11%3A43%3A02Z&se=2023-10-18T11%3A43%3A02Z&sp=rl&sv=2021-06-08&sr=c&skoid=c85c15d6-d1ae-42d4-af60-e2ca0f81359b&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2023-10-11T11%3A43%3A01Z&ske=2023-10-18T11%3A43%3A01Z&sks=b&skv=2021-06-08&sig=Uo3bwXYV/PY1xAUKYZQBLmnGUzGjzTcO/olsV/aiSOU%3D |
type: application/json |
title: Index file |
description: Kerchunk index file. |
roles: ['index'] |
owner: BOM |
rel: self |
href: https://planetarycomputer.microsoft.com/api/stac/v1/collections/deltares-water-availability/items/BOM |
type: application/json |
rel: collection |
href: https://planetarycomputer.microsoft.com/api/stac/v1/collections/deltares-water-availability |
type: application/json |
rel: parent |
href: https://planetarycomputer.microsoft.com/api/stac/v1/collections/deltares-water-availability |
type: application/json |
rel: root |
href: https://planetarycomputer.microsoft.com/api/stac/v1/collections/deltares-water-availability |
type: application/json |
title: Deltares Global Water Availability |
<xarray.Dataset>\n", "Dimensions: (time: 14245, GrandID: 116, ksathorfrac: 5)\n", "Coordinates:\n", " * GrandID (GrandID) float64 6.675e+03 6.666e+03 ... 6.594e+03 6.706e+03\n", " * ksathorfrac (ksathorfrac) float64 5.0 20.0 50.0 100.0 250.0\n", " * time (time) datetime64[ns] 1982-01-01 1982-01-02 ... 2020-12-31\n", "Data variables: (12/14)\n", " ETa (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " Ea_res (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " FracFull (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " Melt (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " P (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " PET (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " ... ...\n", " Qout_res (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " S_res (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " Snow (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " Temp (time, GrandID, ksathorfrac) float32 dask.array<chunksize=(1, 116, 5), meta=np.ndarray>\n", " latitude (GrandID) float32 dask.array<chunksize=(116,), meta=np.ndarray>\n", " longitude (GrandID) float32 dask.array<chunksize=(116,), meta=np.ndarray>
<xarray.Dataset>\n", "Dimensions: (time: 14245)\n", "Coordinates:\n", " GrandID float64 6.675e+03\n", " ksathorfrac float64 50.0\n", " * time (time) datetime64[ns] 1982-01-01 1982-01-02 ... 2020-12-31\n", "Data variables: (12/14)\n", " ETa (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " Ea_res (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " FracFull (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " Melt (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " P (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " PET (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " ... ...\n", " Qout_res (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " S_res (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " Snow (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " Temp (time) float32 dask.array<chunksize=(1,), meta=np.ndarray>\n", " latitude float32 dask.array<chunksize=(), meta=np.ndarray>\n", " longitude float32 dask.array<chunksize=(), meta=np.ndarray>