tutorials
This commit is contained in:
parent
b5298edd80
commit
e9d5320c1e
|
@ -14,6 +14,15 @@
|
|||
"### About"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"CDS_PROJECT = \"03x02_projections-cordex\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -107,16 +116,47 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Collecting git+https://code-repo.d4science.org/D4Science/d4science_copernicus_cds.git\n",
|
||||
" Cloning https://code-repo.d4science.org/D4Science/d4science_copernicus_cds.git to /private/var/folders/hc/hl1vgl493cqdfj_g7d8pggv40000gn/T/pip-req-build-fxhc4mqq\n",
|
||||
" Running command git clone --filter=blob:none --quiet https://code-repo.d4science.org/D4Science/d4science_copernicus_cds.git /private/var/folders/hc/hl1vgl493cqdfj_g7d8pggv40000gn/T/pip-req-build-fxhc4mqq\n",
|
||||
" warning: filtering not recognized by server, ignoring\n",
|
||||
" warning: filtering not recognized by server, ignoring\n",
|
||||
" Resolved https://code-repo.d4science.org/D4Science/d4science_copernicus_cds.git to commit 22ec9dd7e72830d0057adc7454aa7e864a86a23c\n",
|
||||
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
|
||||
"\u001b[?25hRequirement already satisfied: cdsapi>=0.7.2 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from d4science-copernicus-cds==1.0.0) (0.7.4)\n",
|
||||
"Requirement already satisfied: attrs in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from d4science-copernicus-cds==1.0.0) (24.2.0)\n",
|
||||
"Requirement already satisfied: typing_extensions in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from d4science-copernicus-cds==1.0.0) (4.12.2)\n",
|
||||
"Requirement already satisfied: cads-api-client>=1.4.7 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (1.5.2)\n",
|
||||
"Requirement already satisfied: requests>=2.5.0 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (2.32.3)\n",
|
||||
"Requirement already satisfied: tqdm in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (4.67.0)\n",
|
||||
"Requirement already satisfied: multiurl>=0.3.2 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cads-api-client>=1.4.7->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (0.3.2)\n",
|
||||
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (2.2.3)\n",
|
||||
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (3.4.0)\n",
|
||||
"Requirement already satisfied: idna<4,>=2.5 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (3.10)\n",
|
||||
"Requirement already satisfied: certifi>=2017.4.17 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (2024.8.30)\n",
|
||||
"Requirement already satisfied: python-dateutil in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from multiurl>=0.3.2->cads-api-client>=1.4.7->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (2.9.0.post0)\n",
|
||||
"Requirement already satisfied: pytz in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from multiurl>=0.3.2->cads-api-client>=1.4.7->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (2024.2)\n",
|
||||
"Requirement already satisfied: six>=1.5 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from python-dateutil->multiurl>=0.3.2->cads-api-client>=1.4.7->cdsapi>=0.7.2->d4science-copernicus-cds==1.0.0) (1.16.0)\n",
|
||||
"\n",
|
||||
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
|
||||
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!pip install git+https://code-repo.d4science.org/D4Science/d4science_copernicus_cds.git"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -125,9 +165,18 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"URL https://cds.climate.copernicus.eu/api\n",
|
||||
"KEY db1f2085-6b8b-42e6-b832-625dfaf831a4\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"URL, KEY = cds_get_credentials()\n",
|
||||
"print(\"URL\", URL)\n",
|
||||
|
@ -145,19 +194,19 @@
|
|||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"datadir: %s /Users/Alfredo/cds_dataDir/out_2024_11_08_16_32_34_projections-cordex/\n",
|
||||
"/Users/Alfredo/cds_dataDir/out_2024_11_08_16_32_34_projections-cordex/\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"\n",
|
||||
"CDS_PROJECT = \"projections-cordex\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"DATADIR = cds_datadir(CDS_PROJECT)\n",
|
||||
"print(DATADIR)"
|
||||
]
|
||||
|
@ -171,7 +220,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -202,9 +251,33 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Requirement already satisfied: cdsapi in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (0.7.4)\n",
|
||||
"Requirement already satisfied: tqdm in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cdsapi) (4.67.0)\n",
|
||||
"Requirement already satisfied: cads-api-client>=1.4.7 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cdsapi) (1.5.2)\n",
|
||||
"Requirement already satisfied: requests>=2.5.0 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cdsapi) (2.32.3)\n",
|
||||
"Requirement already satisfied: typing-extensions in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cads-api-client>=1.4.7->cdsapi) (4.12.2)\n",
|
||||
"Requirement already satisfied: attrs in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cads-api-client>=1.4.7->cdsapi) (24.2.0)\n",
|
||||
"Requirement already satisfied: multiurl>=0.3.2 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from cads-api-client>=1.4.7->cdsapi) (0.3.2)\n",
|
||||
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi) (3.4.0)\n",
|
||||
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi) (2.2.3)\n",
|
||||
"Requirement already satisfied: idna<4,>=2.5 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi) (3.10)\n",
|
||||
"Requirement already satisfied: certifi>=2017.4.17 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from requests>=2.5.0->cdsapi) (2024.8.30)\n",
|
||||
"Requirement already satisfied: python-dateutil in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from multiurl>=0.3.2->cads-api-client>=1.4.7->cdsapi) (2.9.0.post0)\n",
|
||||
"Requirement already satisfied: pytz in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from multiurl>=0.3.2->cads-api-client>=1.4.7->cdsapi) (2024.2)\n",
|
||||
"Requirement already satisfied: six>=1.5 in /Users/Alfredo/.pyenv/versions/3.10.12/lib/python3.10/site-packages (from python-dateutil->multiurl>=0.3.2->cads-api-client>=1.4.7->cdsapi) (1.16.0)\n",
|
||||
"\n",
|
||||
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
|
||||
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!pip install cdsapi"
|
||||
]
|
||||
|
@ -218,7 +291,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -297,18 +370,63 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2024-11-08 16:32:35,536 INFO [2024-09-28T00:00:00] **Welcome to the New Climate Data Store (CDS)!** This new system is in its early days of full operations and still undergoing enhancements and fine tuning. Some disruptions are to be expected. Your \n",
|
||||
"[feedback](https://jira.ecmwf.int/plugins/servlet/desk/portal/1/create/202) is key to improve the user experience on the new CDS for the benefit of everyone. Thank you.\n",
|
||||
"2024-11-08 16:32:35,537 WARNING [2024-09-26T00:00:00] Should you have not yet migrated from the old CDS system to the new CDS, please check our [informative page](https://confluence.ecmwf.int/x/uINmFw) for guidance.\n",
|
||||
"2024-11-08 16:32:35,537 INFO [2024-09-26T00:00:00] Watch our [Forum](https://forum.ecmwf.int/) for Announcements, news and other discussed topics.\n",
|
||||
"2024-11-08 16:32:35,537 INFO [2024-09-16T00:00:00] Remember that you need to have an ECMWF account to use the new CDS. **Your old CDS credentials will not work in new CDS!**\n",
|
||||
"2024-11-08 16:32:35,538 WARNING [2024-06-16T00:00:00] CDS API syntax is changed and some keys or parameter names may have also changed. To avoid requests failing, please use the \"Show API request code\" tool on the dataset Download Form to check you are using the correct syntax for your API request.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"c = cdsapi.Client()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Downloading ../data/projections-cordex/1971-2000_cordex_historical_africa.zip\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2024-11-08 16:32:40,312 INFO Request ID is 3636de2e-8ccb-4f8a-a09c-b331eb536911\n",
|
||||
"2024-11-08 16:32:40,958 INFO status has been updated to accepted\n",
|
||||
"2024-11-08 16:32:44,906 INFO status has been updated to running\n",
|
||||
"2024-11-08 16:32:47,222 INFO status has been updated to successful\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "09118f68c4864e688a354f1913744d26",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"4370e553fb6d0700264d5dc2075c0fbd.zip: 0%| | 0.00/908M [00:00<?, ?B/s]"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"filename_historical = os.path.join(CDS_DATA, '1971-2000_cordex_historical_africa.zip')\n",
|
||||
|
@ -340,7 +458,40 @@
|
|||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"downloading ../data/projections-cordex/2071-2100_cordex_rcp_4_5_africa.zip\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2024-11-08 16:35:40,398 INFO Request ID is ddb4760c-10bb-4883-ae82-1b41c053338a\n",
|
||||
"2024-11-08 16:35:40,442 INFO status has been updated to accepted\n",
|
||||
"2024-11-08 16:35:45,465 INFO status has been updated to running\n",
|
||||
"2024-11-08 16:35:48,901 INFO status has been updated to accepted\n",
|
||||
"2024-11-08 16:36:01,647 INFO status has been updated to successful\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "cf3014202d04447e903c93b1e7de934e",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"16922db45b157736efd0e3528b6f0922.zip: 0%| | 0.00/908M [00:00<?, ?B/s]"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"filename_future = os.path.join(CDS_DATA, '2071-2100_cordex_rcp_4_5_africa.zip')\n",
|
||||
"\n",
|
||||
|
@ -727,7 +878,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5"
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
Loading…
Reference in New Issue