Skip to content

Instantly share code, notes, and snippets.

@clemp
Last active January 13, 2023 21:41
Show Gist options
  • Save clemp/129ed9e2917dff6d4274b00a6a9f98fd to your computer and use it in GitHub Desktop.
Save clemp/129ed9e2917dff6d4274b00a6a9f98fd to your computer and use it in GitHub Desktop.
Example of using finalized or preliminary data for ERA5-Land data
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 130,
"id": "533b0a20",
"metadata": {},
"outputs": [],
"source": [
"import datetime, requests, json\n",
"import xarray as xr \n",
"import pandas as pd\n",
"\n",
"from dotenv import load_dotenv\n",
"import os\n",
"\n",
"load_dotenv();"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a91a8a8e",
"metadata": {},
"outputs": [],
"source": [
"token = os.environ['DCLIMATE_API_AUTH_TOKEN']\n",
"headers = {'Authorization': token}"
]
},
{
"cell_type": "markdown",
"id": "185fbb4b",
"metadata": {},
"source": [
"# API v3 Example"
]
},
{
"cell_type": "markdown",
"id": "e7589063",
"metadata": {},
"source": [
"## Request parameters"
]
},
{
"cell_type": "code",
"execution_count": 122,
"id": "f559b9f8",
"metadata": {},
"outputs": [],
"source": [
"url = 'https://api.dclimate.net' # prod\n",
"api_version = 'apiv3'\n",
"dataset = 'era5_land_precip-hourly'"
]
},
{
"cell_type": "markdown",
"id": "db006e60",
"metadata": {},
"source": [
"## Create request for finalized and preliminary data"
]
},
{
"cell_type": "code",
"execution_count": 125,
"id": "7deba1dd",
"metadata": {},
"outputs": [],
"source": [
"### Request finalized data only\n",
"#### A rectangle, circle, or polygon (shapefile) query could be used instead of a point query, but ERA5 data is too large to select the entire globe for most date ranges.\n",
"\n",
"# Santa Fe, NM\n",
"_lat = 35.6870\n",
"_lon = 105.9378\n",
"\n",
"\n",
"### Retrieve finalization date from STAC metadata and save as an ISO Formatted string for use in queries\n",
"stac_metadata = requests.get(\n",
" f'{url}/{api_version}/metadata/{dataset}?full_metadata=true', headers=headers).json()\n",
"fin_date = datetime.datetime.strptime(stac_metadata[\"final through\"], '%Y-%m-%dT%H:%M:%S').date().isoformat() # assumes filtering by day and not hour\n",
"\n",
"r = requests.get(\n",
" f\"{url}/{api_version}/grid-history/{dataset}/{_lat}_{_lon}?also_return_metadata=false&use_imperial_units=true&also_return_snapped_coordinates=true&convert_to_local_time=true\", # set output_format=array if you want a JSON array\n",
" headers=headers\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 168,
"id": "aa8b5722",
"metadata": {},
"outputs": [],
"source": [
"stac_metadata;"
]
},
{
"cell_type": "markdown",
"id": "c8351418",
"metadata": {},
"source": [
"## View finalized data"
]
},
{
"cell_type": "code",
"execution_count": 142,
"id": "09ef8291",
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame({\n",
" 'date': list(r.json()['data'].keys()),\n",
" 'value': list(r.json()['data'].values())}\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 166,
"id": "f9c4d68f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Date of last available record:\n",
" date value\n",
"367382 2022-11-29 23:00:00+08:00 0.0 inch\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>date</th>\n",
" <th>value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1981-01-01 09:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1981-01-01 10:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1981-01-01 11:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1981-01-01 12:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1981-01-01 13:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>367378</th>\n",
" <td>2022-11-29 19:00:00+08:00</td>\n",
" <td>7.87e-05 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>367379</th>\n",
" <td>2022-11-29 20:00:00+08:00</td>\n",
" <td>3.94e-05 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>367380</th>\n",
" <td>2022-11-29 21:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>367381</th>\n",
" <td>2022-11-29 22:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>367382</th>\n",
" <td>2022-11-29 23:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>367383 rows × 2 columns</p>\n",
"</div>"
],
"text/plain": [
" date value\n",
"0 1981-01-01 09:00:00+08:00 0.0 inch\n",
"1 1981-01-01 10:00:00+08:00 0.0 inch\n",
"2 1981-01-01 11:00:00+08:00 0.0 inch\n",
"3 1981-01-01 12:00:00+08:00 0.0 inch\n",
"4 1981-01-01 13:00:00+08:00 0.0 inch\n",
"... ... ...\n",
"367378 2022-11-29 19:00:00+08:00 7.87e-05 inch\n",
"367379 2022-11-29 20:00:00+08:00 3.94e-05 inch\n",
"367380 2022-11-29 21:00:00+08:00 0.0 inch\n",
"367381 2022-11-29 22:00:00+08:00 0.0 inch\n",
"367382 2022-11-29 23:00:00+08:00 0.0 inch\n",
"\n",
"[367383 rows x 2 columns]"
]
},
"execution_count": 166,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print(\"Date of last available record:\")\n",
"print(df[df['date'] <= fin_date].tail(1))\n",
"df[df['date'] <= fin_date]"
]
},
{
"cell_type": "markdown",
"id": "5abd1ba7",
"metadata": {},
"source": [
"## View finalized and preliminary data"
]
},
{
"cell_type": "code",
"execution_count": 167,
"id": "bf4deba9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Date of last available record:\n",
" date value\n",
"368326 2023-01-08 07:00:00+08:00 0.0 inch\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>date</th>\n",
" <th>value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1981-01-01 09:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1981-01-01 10:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1981-01-01 11:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1981-01-01 12:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1981-01-01 13:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>368322</th>\n",
" <td>2023-01-08 03:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>368323</th>\n",
" <td>2023-01-08 04:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>368324</th>\n",
" <td>2023-01-08 05:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>368325</th>\n",
" <td>2023-01-08 06:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" <tr>\n",
" <th>368326</th>\n",
" <td>2023-01-08 07:00:00+08:00</td>\n",
" <td>0.0 inch</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>368327 rows × 2 columns</p>\n",
"</div>"
],
"text/plain": [
" date value\n",
"0 1981-01-01 09:00:00+08:00 0.0 inch\n",
"1 1981-01-01 10:00:00+08:00 0.0 inch\n",
"2 1981-01-01 11:00:00+08:00 0.0 inch\n",
"3 1981-01-01 12:00:00+08:00 0.0 inch\n",
"4 1981-01-01 13:00:00+08:00 0.0 inch\n",
"... ... ...\n",
"368322 2023-01-08 03:00:00+08:00 0.0 inch\n",
"368323 2023-01-08 04:00:00+08:00 0.0 inch\n",
"368324 2023-01-08 05:00:00+08:00 0.0 inch\n",
"368325 2023-01-08 06:00:00+08:00 0.0 inch\n",
"368326 2023-01-08 07:00:00+08:00 0.0 inch\n",
"\n",
"[368327 rows x 2 columns]"
]
},
"execution_count": 167,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print(\"Date of last available record:\")\n",
"print(df.tail(1))\n",
"df"
]
},
{
"cell_type": "markdown",
"id": "3b9e3566",
"metadata": {},
"source": [
"# API v4 Example"
]
},
{
"cell_type": "markdown",
"id": "a78854e5",
"metadata": {},
"source": [
"## View list of datasets"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "08b50592",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of gridded, zarr datasets available: \t 25\n",
"IPNS names of available datasets \n",
"----------\n",
"agb-quarterly\n",
"chirps_final_05-daily\n",
"chirps_final_25-daily\n",
"chirps_prelim_05-daily\n",
"copernicus_ocean_sea_level-daily\n",
"copernicus_ocean_temp_1p5_meters-daily\n",
"copernicus_ocean_temp_6p5_meters-daily\n",
"cpc_precip_global-daily\n",
"cpc_precip_us-daily\n",
"cpc_temp_max-daily\n",
"cpc_temp_min-daily\n",
"deforestation-quarterly\n",
"era5_2m_temp-hourly\n",
"era5_land_precip-hourly\n",
"era5_land_surface_pressure-hourly\n",
"era5_precip-hourly\n",
"era5_surface_solar_radiation_downwards-hourly\n",
"era5_wind_100m_u-hourly\n",
"era5_wind_100m_v-hourly\n",
"era5_wind_10m_u-hourly\n",
"era5_wind_10m_v-hourly\n",
"prism-precip-daily\n",
"prism-tmax-daily\n",
"prism-tmin-daily\n",
"vhi-weekly\n"
]
}
],
"source": [
"# Zarrs\n",
"dataset_list_v4 = requests.get(\n",
" 'https://api.dclimate.net/apiv4/datasets', headers=headers).json()\n",
"\n",
"print(\"Number of gridded, zarr datasets available: \\t\", len(dataset_list_v4))\n",
"print(\"IPNS names of available datasets \\n----------\")\n",
"for ds in dataset_list_v4:\n",
" print(ds)"
]
},
{
"cell_type": "markdown",
"id": "46112b4a",
"metadata": {},
"source": [
"## Request parameters"
]
},
{
"cell_type": "code",
"execution_count": 96,
"id": "1c2660be",
"metadata": {},
"outputs": [],
"source": [
"url = 'https://api.dclimate.net' # prod\n",
"api_version = 'apiv4'\n",
"dataset = 'era5_land_precip-hourly'"
]
},
{
"cell_type": "code",
"execution_count": 97,
"id": "f13c8ac9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"era5_land_precip-hourly\n",
"Finalization date: 2022-11-30\n"
]
}
],
"source": [
"### Retrieve finalization date from STAC metadata and save as an ISO Formatted string for use in queries\n",
"stac_metadata = requests.get(\n",
" f'{url}/{api_version}/metadata/{dataset}', headers=headers).json()\n",
"fin_date = datetime.datetime.strptime(stac_metadata[\"properties\"][\"finalization date\"], '%Y%m%d%H').date().isoformat() # assumes filtering by day and not hour\n",
"print(dataset)\n",
"print(\"Finalization date:\", fin_date)"
]
},
{
"cell_type": "code",
"execution_count": 170,
"id": "f648ac2b",
"metadata": {},
"outputs": [],
"source": [
"stac_metadata;"
]
},
{
"cell_type": "markdown",
"id": "98c67b35",
"metadata": {},
"source": [
"## Create request for finalized data"
]
},
{
"cell_type": "code",
"execution_count": 87,
"id": "174530a4",
"metadata": {},
"outputs": [],
"source": [
"### Request finalized data only\n",
"#### A rectangle, circle, or polygon (shapefile) query could be used instead of a point query, but ERA5 data is too large to select the entire globe for most date ranges.\n",
"\n",
"# Santa Fe, NM\n",
"_lat = 35.6870\n",
"_lon = 105.9378\n",
"\n",
"r = requests.post(\n",
" f\"{url}/{api_version}/geo_temporal_query/{dataset}?output_format=netcdf\", # set output_format=array if you want a JSON array\n",
" json={\"point_params\" : {\"lat\" : _lat, \"lon\" : _long}, \"time_range\": ['2022-01-01',fin_date]}, # Insert your own lat/lon and start date here\n",
" headers=headers\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "2b6595a6",
"metadata": {},
"source": [
"## View requested finalized data"
]
},
{
"cell_type": "code",
"execution_count": 88,
"id": "5489a34e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block !important;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-index-preview {\n",
" grid-column: 2 / 5;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data,\n",
".xr-index-data-in:checked ~ .xr-index-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-index-name div,\n",
".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2,\n",
".xr-no-icon {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
"Dimensions: (time: 7993)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 2022-01-01 ... 2022-11-30\n",
" latitude float64 ...\n",
" longitude float64 ...\n",
"Data variables:\n",
" tp (time) float32 ...\n",
"Attributes: (12/22)\n",
" EPSG: Reduced Gaussian Grid\n",
" name: era5_land_precip\n",
" title: ECMWF ERA5-Land Reanalysis\n",
" created: 2022-11-19T18:35:47Z\n",
" license: Apache License 2.0\n",
" updated: 2023-01-03 19:12:29.438345\n",
" ... ...\n",
" spatial precision: 0.01\n",
" spatial resolution: 0.1\n",
" dataset description: ERA5-Land is a reanalysis dataset providing a cons...\n",
" temporal resolution: hourly\n",
" unit of measurement: m\n",
" provider description: ECMWF is the European Centre for Medium-Range Weat...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-b2097f04-ec01-4b9d-902b-42cf8313ddb2' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-b2097f04-ec01-4b9d-902b-42cf8313ddb2' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>time</span>: 7993</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-6aed7a5e-8f7c-4d8b-9022-13f4fdea01a1' class='xr-section-summary-in' type='checkbox' checked><label for='section-6aed7a5e-8f7c-4d8b-9022-13f4fdea01a1' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2022-01-01 ... 2022-11-30</div><input id='attrs-bebf81dd-60fd-4cc6-b6de-a06746f5f7ac' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-bebf81dd-60fd-4cc6-b6de-a06746f5f7ac' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0cad74de-24b4-467e-8a83-043063e449b5' class='xr-var-data-in' type='checkbox'><label for='data-0cad74de-24b4-467e-8a83-043063e449b5' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>T</dd><dt><span>standard_name :</span></dt><dd>time</dd></dl></div><div class='xr-var-data'><pre>array([&#x27;2022-01-01T00:00:00.000000000&#x27;, &#x27;2022-01-01T01:00:00.000000000&#x27;,\n",
" &#x27;2022-01-01T02:00:00.000000000&#x27;, ..., &#x27;2022-11-29T22:00:00.000000000&#x27;,\n",
" &#x27;2022-11-29T23:00:00.000000000&#x27;, &#x27;2022-11-30T00:00:00.000000000&#x27;],\n",
" dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-2f2adfa3-273b-417d-a305-030d5e417c51' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-2f2adfa3-273b-417d-a305-030d5e417c51' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-e6c72662-aca3-46fe-851d-00faf3de78dc' class='xr-var-data-in' type='checkbox'><label for='data-e6c72662-aca3-46fe-851d-00faf3de78dc' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>Y</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>standard_name :</span></dt><dd>latitude</dd></dl></div><div class='xr-var-data'><pre>[1 values with dtype=float64]</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-2b524de8-1d72-4625-a884-75740808f7be' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-2b524de8-1d72-4625-a884-75740808f7be' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ab900049-17f6-41e2-8bbd-bd9d02415e64' class='xr-var-data-in' type='checkbox'><label for='data-ab900049-17f6-41e2-8bbd-bd9d02415e64' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>[1 values with dtype=float64]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-8c58df42-5820-49af-9c36-ff18f71fb07f' class='xr-section-summary-in' type='checkbox' checked><label for='section-8c58df42-5820-49af-9c36-ff18f71fb07f' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>tp</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-ecf9f91f-d7dd-4e05-8f29-d4d6283b5a8a' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-ecf9f91f-d7dd-4e05-8f29-d4d6283b5a8a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9a9eae39-12b8-4835-982d-b39264d465c0' class='xr-var-data-in' type='checkbox'><label for='data-9a9eae39-12b8-4835-982d-b39264d465c0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>code :</span></dt><dd>228</dd><dt><span>table :</span></dt><dd>128</dd><dt><span>units :</span></dt><dd>m</dd></dl></div><div class='xr-var-data'><pre>[7993 values with dtype=float32]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-893e02e7-c30e-437a-a1f2-34cf659c7bdb' class='xr-section-summary-in' type='checkbox' ><label for='section-893e02e7-c30e-437a-a1f2-34cf659c7bdb' class='xr-section-summary' >Indexes: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>time</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-de30e806-ebe6-4e98-a94c-a4c61bfcb054' class='xr-index-data-in' type='checkbox'/><label for='index-de30e806-ebe6-4e98-a94c-a4c61bfcb054' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(DatetimeIndex([&#x27;2022-01-01 00:00:00&#x27;, &#x27;2022-01-01 01:00:00&#x27;,\n",
" &#x27;2022-01-01 02:00:00&#x27;, &#x27;2022-01-01 03:00:00&#x27;,\n",
" &#x27;2022-01-01 04:00:00&#x27;, &#x27;2022-01-01 05:00:00&#x27;,\n",
" &#x27;2022-01-01 06:00:00&#x27;, &#x27;2022-01-01 07:00:00&#x27;,\n",
" &#x27;2022-01-01 08:00:00&#x27;, &#x27;2022-01-01 09:00:00&#x27;,\n",
" ...\n",
" &#x27;2022-11-29 15:00:00&#x27;, &#x27;2022-11-29 16:00:00&#x27;,\n",
" &#x27;2022-11-29 17:00:00&#x27;, &#x27;2022-11-29 18:00:00&#x27;,\n",
" &#x27;2022-11-29 19:00:00&#x27;, &#x27;2022-11-29 20:00:00&#x27;,\n",
" &#x27;2022-11-29 21:00:00&#x27;, &#x27;2022-11-29 22:00:00&#x27;,\n",
" &#x27;2022-11-29 23:00:00&#x27;, &#x27;2022-11-30 00:00:00&#x27;],\n",
" dtype=&#x27;datetime64[ns]&#x27;, name=&#x27;time&#x27;, length=7993, freq=None))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1ec760f4-0852-47ca-aeac-00d4eb4c3039' class='xr-section-summary-in' type='checkbox' ><label for='section-1ec760f4-0852-47ca-aeac-00d4eb4c3039' class='xr-section-summary' >Attributes: <span>(22)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>EPSG :</span></dt><dd>Reduced Gaussian Grid</dd><dt><span>name :</span></dt><dd>era5_land_precip</dd><dt><span>title :</span></dt><dd>ECMWF ERA5-Land Reanalysis</dd><dt><span>created :</span></dt><dd>2022-11-19T18:35:47Z</dd><dt><span>license :</span></dt><dd>Apache License 2.0</dd><dt><span>updated :</span></dt><dd>2023-01-03 19:12:29.438345</dd><dt><span>publisher :</span></dt><dd>Copernicus Climate Change Service (C3S)</dd><dt><span>Conventions :</span></dt><dd>CF-1.6</dd><dt><span>institution :</span></dt><dd>European Centre for Medium-Range Weather Forecasts</dd><dt><span>provider url :</span></dt><dd>https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=overview</dd><dt><span>missing value :</span></dt><dd>-9999</dd><dt><span>update cadence :</span></dt><dd>monthly</dd><dt><span>climate variable :</span></dt><dd>total precipitation</dd><dt><span>terms of service :</span></dt><dd>https://www.ecmwf.int/en/terms-use</dd><dt><span>data download url :</span></dt><dd>https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=form</dd><dt><span>finalization date :</span></dt><dd>2022113000</dd><dt><span>spatial precision :</span></dt><dd>0.01</dd><dt><span>spatial resolution :</span></dt><dd>0.1</dd><dt><span>dataset description :</span></dt><dd>ERA5-Land is a reanalysis dataset providing a consistent view of the evolution of land variables over several decades at an enhanced resolution compared to ERA5. ERA5-Land has been produced by replaying the land component of the ECMWF ERA5 climate reanalysis. Reanalysis combines model data with observations from across the world into a globally complete and consistent dataset using the laws of physics. Reanalysis produces data that goes several decades back in time, providing an accurate description of the climate of the past.More information about this dataset at https://apps.ecmwf.int/codes/grib/param-db?id=228\n",
"</dd><dt><span>temporal resolution :</span></dt><dd>hourly</dd><dt><span>unit of measurement :</span></dt><dd>m</dd><dt><span>provider description :</span></dt><dd>ECMWF is the European Centre for Medium-Range Weather Forecasts. It is both a research institute and a 24/7 operational service, producing global numerical weather predictions and other data for its Member and Co-operating States and the broader community. The Centre has one of the largest supercomputer facilities and meteorological data archives in the world. Other strategic activities include delivering advanced training and assisting the WM in implementing its programmes.</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (time: 7993)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 2022-01-01 ... 2022-11-30\n",
" latitude float64 ...\n",
" longitude float64 ...\n",
"Data variables:\n",
" tp (time) float32 ...\n",
"Attributes: (12/22)\n",
" EPSG: Reduced Gaussian Grid\n",
" name: era5_land_precip\n",
" title: ECMWF ERA5-Land Reanalysis\n",
" created: 2022-11-19T18:35:47Z\n",
" license: Apache License 2.0\n",
" updated: 2023-01-03 19:12:29.438345\n",
" ... ...\n",
" spatial precision: 0.01\n",
" spatial resolution: 0.1\n",
" dataset description: ERA5-Land is a reanalysis dataset providing a cons...\n",
" temporal resolution: hourly\n",
" unit of measurement: m\n",
" provider description: ECMWF is the European Centre for Medium-Range Weat..."
]
},
"execution_count": 88,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds = xr.open_dataset(r.content)\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": 57,
"id": "c9d02736",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Date of last available record:\n"
]
},
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block !important;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-index-preview {\n",
" grid-column: 2 / 5;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data,\n",
".xr-index-data-in:checked ~ .xr-index-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-index-name div,\n",
".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2,\n",
".xr-no-icon {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;time&#x27; ()&gt;\n",
"array(&#x27;2022-11-30T00:00:00.000000000&#x27;, dtype=&#x27;datetime64[ns]&#x27;)\n",
"Coordinates:\n",
" time datetime64[ns] 2022-11-30\n",
" latitude float64 35.7\n",
" longitude float64 105.9\n",
"Attributes:\n",
" axis: T\n",
" standard_name: time</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'time'</div></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-f233faa1-a13b-4c9a-aade-5f970671a337' class='xr-array-in' type='checkbox' checked><label for='section-f233faa1-a13b-4c9a-aade-5f970671a337' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>2022-11-30</span></div><div class='xr-array-data'><pre>array(&#x27;2022-11-30T00:00:00.000000000&#x27;, dtype=&#x27;datetime64[ns]&#x27;)</pre></div></div></li><li class='xr-section-item'><input id='section-b5074db0-1a0b-4a9e-9b3e-a04c48cea576' class='xr-section-summary-in' type='checkbox' checked><label for='section-b5074db0-1a0b-4a9e-9b3e-a04c48cea576' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>time</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2022-11-30</div><input id='attrs-0f12de4a-d650-4a63-ba81-f6f68c77243a' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-0f12de4a-d650-4a63-ba81-f6f68c77243a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7268d70a-bc10-49f4-897b-cb9e5a1e0188' class='xr-var-data-in' type='checkbox'><label for='data-7268d70a-bc10-49f4-897b-cb9e5a1e0188' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>T</dd><dt><span>standard_name :</span></dt><dd>time</dd></dl></div><div class='xr-var-data'><pre>array(&#x27;2022-11-30T00:00:00.000000000&#x27;, dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>35.7</div><input id='attrs-955b0322-8612-43de-84dd-14493457a95f' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-955b0322-8612-43de-84dd-14493457a95f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1443bcd3-7226-4e33-8ad5-80bcc6d1beea' class='xr-var-data-in' type='checkbox'><label for='data-1443bcd3-7226-4e33-8ad5-80bcc6d1beea' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>Y</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>standard_name :</span></dt><dd>latitude</dd></dl></div><div class='xr-var-data'><pre>array(35.7)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>105.9</div><input id='attrs-defdc816-3595-4df9-bbba-8c7b0405e730' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-defdc816-3595-4df9-bbba-8c7b0405e730' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-497dfcec-1c92-4943-a823-a58f81c6824a' class='xr-var-data-in' type='checkbox'><label for='data-497dfcec-1c92-4943-a823-a58f81c6824a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(105.9)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-7319fb8e-e7b0-4a29-b0c7-69ece5718b60' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-7319fb8e-e7b0-4a29-b0c7-69ece5718b60' class='xr-section-summary' title='Expand/collapse section'>Indexes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'></ul></div></li><li class='xr-section-item'><input id='section-ffb83535-b503-4807-8624-b68428990d4d' class='xr-section-summary-in' type='checkbox' checked><label for='section-ffb83535-b503-4807-8624-b68428990d4d' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>T</dd><dt><span>standard_name :</span></dt><dd>time</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'time' ()>\n",
"array('2022-11-30T00:00:00.000000000', dtype='datetime64[ns]')\n",
"Coordinates:\n",
" time datetime64[ns] 2022-11-30\n",
" latitude float64 35.7\n",
" longitude float64 105.9\n",
"Attributes:\n",
" axis: T\n",
" standard_name: time"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print(\"Date of last available record:\")\n",
"ds[\"time\"][-1]"
]
},
{
"cell_type": "markdown",
"id": "660b99d1",
"metadata": {},
"source": [
"## Create request for finalized and preliminary data"
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "33f40027",
"metadata": {},
"outputs": [],
"source": [
"### Request final AND preliminary data\n",
"\n",
"r = requests.post(\n",
" f\"{url}/{api_version}/geo_temporal_query/{dataset}?output_format=netcdf\",\n",
" json={\"point_params\" : {\"lat\" : _lat, \"lon\" : _long}, \"time_range\": ['2022-01-01',datetime.datetime.today().date().isoformat()]}, # Insert your own lat/lon and start date here\n",
" headers=headers\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "b5e786de",
"metadata": {},
"source": [
"## View requested finalized and preliminary data"
]
},
{
"cell_type": "code",
"execution_count": 62,
"id": "209bd0b1",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block !important;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-index-preview {\n",
" grid-column: 2 / 5;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data,\n",
".xr-index-data-in:checked ~ .xr-index-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-index-name div,\n",
".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2,\n",
".xr-no-icon {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
"Dimensions: (time: 8904)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 2022-01-01 ... 2023-01-06T23:00:00\n",
" latitude float64 ...\n",
" longitude float64 ...\n",
"Data variables:\n",
" sp (time) float32 ...\n",
"Attributes: (12/22)\n",
" EPSG: Reduced Gaussian Grid\n",
" name: era5_land_surface_pressure\n",
" title: ECMWF ERA5-Land Reanalysis\n",
" created: 2022-12-01T19:08:44Z\n",
" license: Apache License 2.0\n",
" updated: 2023-01-12 01:49:32.938845\n",
" ... ...\n",
" spatial precision: 0.01\n",
" spatial resolution: 0.1\n",
" dataset description: ERA5-Land is a reanalysis dataset providing a cons...\n",
" temporal resolution: hourly\n",
" unit of measurement: Pa\n",
" provider description: ECMWF is the European Centre for Medium-Range Weat...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-ab7b34b8-9b2b-4fd0-be6e-f8d8c53c93f0' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-ab7b34b8-9b2b-4fd0-be6e-f8d8c53c93f0' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>time</span>: 8904</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-cd35b22d-5bcc-4606-a1cd-7765abe7cc3f' class='xr-section-summary-in' type='checkbox' checked><label for='section-cd35b22d-5bcc-4606-a1cd-7765abe7cc3f' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2022-01-01 ... 2023-01-06T23:00:00</div><input id='attrs-3f9f36d9-2494-4339-9255-66fdbc62f752' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-3f9f36d9-2494-4339-9255-66fdbc62f752' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9545baec-27ba-4911-a9f9-37a0599b34f7' class='xr-var-data-in' type='checkbox'><label for='data-9545baec-27ba-4911-a9f9-37a0599b34f7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>T</dd><dt><span>standard_name :</span></dt><dd>time</dd></dl></div><div class='xr-var-data'><pre>array([&#x27;2022-01-01T00:00:00.000000000&#x27;, &#x27;2022-01-01T01:00:00.000000000&#x27;,\n",
" &#x27;2022-01-01T02:00:00.000000000&#x27;, ..., &#x27;2023-01-06T21:00:00.000000000&#x27;,\n",
" &#x27;2023-01-06T22:00:00.000000000&#x27;, &#x27;2023-01-06T23:00:00.000000000&#x27;],\n",
" dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-d9a94fdf-154b-48e3-9293-51f03f817c03' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-d9a94fdf-154b-48e3-9293-51f03f817c03' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-25b70c07-ee16-40bf-924f-39fe34dde2b9' class='xr-var-data-in' type='checkbox'><label for='data-25b70c07-ee16-40bf-924f-39fe34dde2b9' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>Y</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>standard_name :</span></dt><dd>latitude</dd></dl></div><div class='xr-var-data'><pre>[1 values with dtype=float64]</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-8f054834-04bf-47a6-833d-20c4b26161e5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-8f054834-04bf-47a6-833d-20c4b26161e5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cab58846-a1c5-4a8f-8d1a-188d2600fb05' class='xr-var-data-in' type='checkbox'><label for='data-cab58846-a1c5-4a8f-8d1a-188d2600fb05' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>[1 values with dtype=float64]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-371222de-6cec-4df4-8e12-bc824c99a18b' class='xr-section-summary-in' type='checkbox' checked><label for='section-371222de-6cec-4df4-8e12-bc824c99a18b' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>sp</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-005ba5b6-68cb-470e-9747-87358d9f0cf2' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-005ba5b6-68cb-470e-9747-87358d9f0cf2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-afc45e4c-a28a-426b-8292-8d604c2e700f' class='xr-var-data-in' type='checkbox'><label for='data-afc45e4c-a28a-426b-8292-8d604c2e700f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>code :</span></dt><dd>134</dd><dt><span>table :</span></dt><dd>128</dd><dt><span>units :</span></dt><dd>Pa</dd><dt><span>standard_name :</span></dt><dd>surface_air_pressure</dd></dl></div><div class='xr-var-data'><pre>[8904 values with dtype=float32]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-56193428-bee4-44a6-aa54-79743f27771a' class='xr-section-summary-in' type='checkbox' ><label for='section-56193428-bee4-44a6-aa54-79743f27771a' class='xr-section-summary' >Indexes: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>time</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-f0c02508-9b3e-4324-b8b2-80a957540be7' class='xr-index-data-in' type='checkbox'/><label for='index-f0c02508-9b3e-4324-b8b2-80a957540be7' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(DatetimeIndex([&#x27;2022-01-01 00:00:00&#x27;, &#x27;2022-01-01 01:00:00&#x27;,\n",
" &#x27;2022-01-01 02:00:00&#x27;, &#x27;2022-01-01 03:00:00&#x27;,\n",
" &#x27;2022-01-01 04:00:00&#x27;, &#x27;2022-01-01 05:00:00&#x27;,\n",
" &#x27;2022-01-01 06:00:00&#x27;, &#x27;2022-01-01 07:00:00&#x27;,\n",
" &#x27;2022-01-01 08:00:00&#x27;, &#x27;2022-01-01 09:00:00&#x27;,\n",
" ...\n",
" &#x27;2023-01-06 14:00:00&#x27;, &#x27;2023-01-06 15:00:00&#x27;,\n",
" &#x27;2023-01-06 16:00:00&#x27;, &#x27;2023-01-06 17:00:00&#x27;,\n",
" &#x27;2023-01-06 18:00:00&#x27;, &#x27;2023-01-06 19:00:00&#x27;,\n",
" &#x27;2023-01-06 20:00:00&#x27;, &#x27;2023-01-06 21:00:00&#x27;,\n",
" &#x27;2023-01-06 22:00:00&#x27;, &#x27;2023-01-06 23:00:00&#x27;],\n",
" dtype=&#x27;datetime64[ns]&#x27;, name=&#x27;time&#x27;, length=8904, freq=None))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-346689ec-11d5-4372-af22-820bf90e30b3' class='xr-section-summary-in' type='checkbox' ><label for='section-346689ec-11d5-4372-af22-820bf90e30b3' class='xr-section-summary' >Attributes: <span>(22)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>EPSG :</span></dt><dd>Reduced Gaussian Grid</dd><dt><span>name :</span></dt><dd>era5_land_surface_pressure</dd><dt><span>title :</span></dt><dd>ECMWF ERA5-Land Reanalysis</dd><dt><span>created :</span></dt><dd>2022-12-01T19:08:44Z</dd><dt><span>license :</span></dt><dd>Apache License 2.0</dd><dt><span>updated :</span></dt><dd>2023-01-12 01:49:32.938845</dd><dt><span>publisher :</span></dt><dd>Copernicus Climate Change Service (C3S)</dd><dt><span>Conventions :</span></dt><dd>CF-1.6</dd><dt><span>institution :</span></dt><dd>European Centre for Medium-Range Weather Forecasts</dd><dt><span>provider url :</span></dt><dd>https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=overview</dd><dt><span>missing value :</span></dt><dd>-9999</dd><dt><span>update cadence :</span></dt><dd>monthly</dd><dt><span>climate variable :</span></dt><dd>surface pressure</dd><dt><span>terms of service :</span></dt><dd>https://www.ecmwf.int/en/terms-use</dd><dt><span>data download url :</span></dt><dd>https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=form</dd><dt><span>finalization date :</span></dt><dd>2022113000</dd><dt><span>spatial precision :</span></dt><dd>0.01</dd><dt><span>spatial resolution :</span></dt><dd>0.1</dd><dt><span>dataset description :</span></dt><dd>ERA5-Land is a reanalysis dataset providing a consistent view of the evolution of land variables over several decades at an enhanced resolution compared to ERA5. ERA5-Land has been produced by replaying the land component of the ECMWF ERA5 climate reanalysis. Reanalysis combines model data with observations from across the world into a globally complete and consistent dataset using the laws of physics. Reanalysis produces data that goes several decades back in time, providing an accurate description of the climate of the past.More information about this dataset at https://apps.ecmwf.int/codes/grib/param-db?id=134\n",
"</dd><dt><span>temporal resolution :</span></dt><dd>hourly</dd><dt><span>unit of measurement :</span></dt><dd>Pa</dd><dt><span>provider description :</span></dt><dd>ECMWF is the European Centre for Medium-Range Weather Forecasts. It is both a research institute and a 24/7 operational service, producing global numerical weather predictions and other data for its Member and Co-operating States and the broader community. The Centre has one of the largest supercomputer facilities and meteorological data archives in the world. Other strategic activities include delivering advanced training and assisting the WM in implementing its programmes.</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (time: 8904)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 2022-01-01 ... 2023-01-06T23:00:00\n",
" latitude float64 ...\n",
" longitude float64 ...\n",
"Data variables:\n",
" sp (time) float32 ...\n",
"Attributes: (12/22)\n",
" EPSG: Reduced Gaussian Grid\n",
" name: era5_land_surface_pressure\n",
" title: ECMWF ERA5-Land Reanalysis\n",
" created: 2022-12-01T19:08:44Z\n",
" license: Apache License 2.0\n",
" updated: 2023-01-12 01:49:32.938845\n",
" ... ...\n",
" spatial precision: 0.01\n",
" spatial resolution: 0.1\n",
" dataset description: ERA5-Land is a reanalysis dataset providing a cons...\n",
" temporal resolution: hourly\n",
" unit of measurement: Pa\n",
" provider description: ECMWF is the European Centre for Medium-Range Weat..."
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds = xr.open_dataset(r.content)\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": 64,
"id": "51c9e0b1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Date of last available record:\n"
]
},
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block !important;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-index-preview {\n",
" grid-column: 2 / 5;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data,\n",
".xr-index-data-in:checked ~ .xr-index-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-index-name div,\n",
".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2,\n",
".xr-no-icon {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;time&#x27; ()&gt;\n",
"array(&#x27;2023-01-06T23:00:00.000000000&#x27;, dtype=&#x27;datetime64[ns]&#x27;)\n",
"Coordinates:\n",
" time datetime64[ns] 2023-01-06T23:00:00\n",
" latitude float64 ...\n",
" longitude float64 ...\n",
"Attributes:\n",
" axis: T\n",
" standard_name: time</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'time'</div></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-7c9ecd38-5ad4-4c99-a740-2874957e6d18' class='xr-array-in' type='checkbox' checked><label for='section-7c9ecd38-5ad4-4c99-a740-2874957e6d18' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>2023-01-06T23:00:00</span></div><div class='xr-array-data'><pre>array(&#x27;2023-01-06T23:00:00.000000000&#x27;, dtype=&#x27;datetime64[ns]&#x27;)</pre></div></div></li><li class='xr-section-item'><input id='section-95c7a3f1-ab71-4887-870c-3ebe0c263b50' class='xr-section-summary-in' type='checkbox' checked><label for='section-95c7a3f1-ab71-4887-870c-3ebe0c263b50' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>time</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2023-01-06T23:00:00</div><input id='attrs-f0953874-e8ef-4f5d-bf07-9746e9e20616' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-f0953874-e8ef-4f5d-bf07-9746e9e20616' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-dd161492-034d-4463-9bd9-9b808271097d' class='xr-var-data-in' type='checkbox'><label for='data-dd161492-034d-4463-9bd9-9b808271097d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>T</dd><dt><span>standard_name :</span></dt><dd>time</dd></dl></div><div class='xr-var-data'><pre>array(&#x27;2023-01-06T23:00:00.000000000&#x27;, dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-fa606a90-96ee-4b19-912d-9230dcd290fe' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-fa606a90-96ee-4b19-912d-9230dcd290fe' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b81a9115-4bb7-490f-8a27-146bdfb10bb0' class='xr-var-data-in' type='checkbox'><label for='data-b81a9115-4bb7-490f-8a27-146bdfb10bb0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>Y</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>standard_name :</span></dt><dd>latitude</dd></dl></div><div class='xr-var-data'><pre>[1 values with dtype=float64]</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-5fd28f36-dc64-487f-85ad-078c99912399' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5fd28f36-dc64-487f-85ad-078c99912399' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4ae86432-47a0-4434-911f-54ecf5930f63' class='xr-var-data-in' type='checkbox'><label for='data-4ae86432-47a0-4434-911f-54ecf5930f63' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>[1 values with dtype=float64]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-673a245a-d45c-43a3-8e2e-03c27553ce47' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-673a245a-d45c-43a3-8e2e-03c27553ce47' class='xr-section-summary' title='Expand/collapse section'>Indexes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'></ul></div></li><li class='xr-section-item'><input id='section-4f28c42e-4811-4921-bc68-fa6063960f1e' class='xr-section-summary-in' type='checkbox' checked><label for='section-4f28c42e-4811-4921-bc68-fa6063960f1e' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>T</dd><dt><span>standard_name :</span></dt><dd>time</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'time' ()>\n",
"array('2023-01-06T23:00:00.000000000', dtype='datetime64[ns]')\n",
"Coordinates:\n",
" time datetime64[ns] 2023-01-06T23:00:00\n",
" latitude float64 ...\n",
" longitude float64 ...\n",
"Attributes:\n",
" axis: T\n",
" standard_name: time"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print(\"Date of last available record:\")\n",
"ds[\"time\"][-1]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "ds-base",
"language": "python",
"name": "ds-base"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment