Skip to content

Commit

Permalink
Upload
Browse files Browse the repository at this point in the history
Upload
  • Loading branch information
Lw46 committed Aug 17, 2022
1 parent b17e633 commit 610d9f1
Show file tree
Hide file tree
Showing 19 changed files with 3,438 additions and 530 deletions.
Binary file added .DS_Store
Binary file not shown.
183 changes: 183 additions & 0 deletions Download_Input/CAMS_downloader.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "fe891dd5",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-08-17 14:21:05,560 INFO Welcome to the CDS\n",
"2022-08-17 14:21:05,561 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:21:05,816 INFO Request is completed\n",
"2022-08-17 14:21:05,817 INFO Downloading https://download-0000-ads-clone.copernicus-climate.eu/cache-compute-0000/cache/data5/adaptor.mars.internal-1660710135.716744-19656-7-fcb4c5dd-08a4-4ee7-962d-f074cbbc172f.nc to /media/liwei/Data/CAMS/20150101.nc (5.3M)\n",
"2022-08-17 14:21:23,571 INFO Download rate 305.7K/s \n",
"2022-08-17 14:21:23,952 INFO Welcome to the CDS\n",
"2022-08-17 14:21:23,953 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:21:24,148 INFO Request is queued\n",
"2022-08-17 14:21:25,340 INFO Request is running\n",
"2022-08-17 14:21:27,032 INFO Request is completed\n",
"2022-08-17 14:21:27,033 INFO Downloading https://download-0004-ads-clone.copernicus-climate.eu/cache-compute-0004/cache/data4/adaptor.mars.internal-1660713685.0312276-2757-10-5e7fac74-69c9-40ec-914d-318e81bd58cb.nc to /media/liwei/Data/CAMS/20150102.nc (5.3M)\n",
"2022-08-17 14:21:44,793 INFO Download rate 305.6K/s \n",
"2022-08-17 14:21:45,176 INFO Welcome to the CDS\n",
"2022-08-17 14:21:45,176 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:21:45,371 INFO Request is queued\n",
"2022-08-17 14:21:46,563 INFO Request is running\n",
"2022-08-17 14:21:48,256 INFO Request is completed\n",
"2022-08-17 14:21:48,257 INFO Downloading https://download-0001-ads-clone.copernicus-climate.eu/cache-compute-0001/cache/data5/adaptor.mars.internal-1660713706.1643872-28859-8-897e5b3d-6ea1-41b5-b3a6-b232eb870be9.nc to /media/liwei/Data/CAMS/20150103.nc (5.3M)\n",
"2022-08-17 14:22:05,590 INFO Download rate 313.1K/s \n",
"2022-08-17 14:22:05,975 INFO Welcome to the CDS\n",
"2022-08-17 14:22:05,976 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:22:06,172 INFO Request is queued\n",
"2022-08-17 14:22:07,365 INFO Request is running\n",
"2022-08-17 14:22:09,058 INFO Request is completed\n",
"2022-08-17 14:22:09,058 INFO Downloading https://download-0002-ads-clone.copernicus-climate.eu/cache-compute-0002/cache/data1/adaptor.mars.internal-1660713727.0061803-9595-10-e9091a29-dea3-46cc-a943-11ab4db39c9c.nc to /media/liwei/Data/CAMS/20150104.nc (5.3M)\n",
"2022-08-17 14:22:26,130 INFO Download rate 317.9K/s \n",
"2022-08-17 14:22:26,514 INFO Welcome to the CDS\n",
"2022-08-17 14:22:26,515 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:22:26,713 INFO Request is queued\n",
"2022-08-17 14:22:27,906 INFO Request is running\n",
"2022-08-17 14:22:29,598 INFO Request is completed\n",
"2022-08-17 14:22:29,599 INFO Downloading https://download-0001-ads-clone.copernicus-climate.eu/cache-compute-0001/cache/data5/adaptor.mars.internal-1660713747.4900587-15483-10-cb9f8535-7ffa-4cea-b560-7d82225c016d.nc to /media/liwei/Data/CAMS/20150105.nc (5.3M)\n",
"2022-08-17 14:22:49,656 INFO Download rate 270.6K/s \n",
"2022-08-17 14:22:50,047 INFO Welcome to the CDS\n",
"2022-08-17 14:22:50,048 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:22:50,244 INFO Request is queued\n",
"2022-08-17 14:22:51,436 INFO Request is completed\n",
"2022-08-17 14:22:51,437 INFO Downloading https://download-0005-ads-clone.copernicus-climate.eu/cache-compute-0005/cache/data9/adaptor.mars.internal-1660713770.9386039-7827-7-8f35d165-2e10-4056-beeb-af067a5692e7.nc to /media/liwei/Data/CAMS/20150106.nc (5.3M)\n",
"2022-08-17 14:23:07,894 INFO Download rate 329.8K/s \n",
"2022-08-17 14:23:08,278 INFO Welcome to the CDS\n",
"2022-08-17 14:23:08,279 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:23:08,475 INFO Request is queued\n",
"2022-08-17 14:23:09,668 INFO Request is running\n",
"2022-08-17 14:23:11,361 INFO Request is completed\n",
"2022-08-17 14:23:11,362 INFO Downloading https://download-0000-ads-clone.copernicus-climate.eu/cache-compute-0000/cache/data0/adaptor.mars.internal-1660713789.3778217-30588-14-f512496d-e8eb-4558-841d-455b6484464a.nc to /media/liwei/Data/CAMS/20150107.nc (5.3M)\n",
"2022-08-17 14:23:28,364 INFO Download rate 319.2K/s \n",
"2022-08-17 14:23:28,746 INFO Welcome to the CDS\n",
"2022-08-17 14:23:28,747 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:23:28,943 INFO Request is queued\n",
"2022-08-17 14:23:30,136 INFO Request is running\n",
"2022-08-17 14:23:31,828 INFO Request is completed\n",
"2022-08-17 14:23:31,829 INFO Downloading https://download-0001-ads-clone.copernicus-climate.eu/cache-compute-0001/cache/data0/adaptor.mars.internal-1660713809.8865747-23691-12-db0b5af5-bee4-4b87-85a1-dad15a66ff69.nc to /media/liwei/Data/CAMS/20150108.nc (5.3M)\n",
"2022-08-17 14:23:51,953 INFO Download rate 269.7K/s \n",
"2022-08-17 14:23:52,337 INFO Welcome to the CDS\n",
"2022-08-17 14:23:52,338 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:23:52,759 INFO Request is queued\n",
"2022-08-17 14:23:53,952 INFO Request is running\n",
"2022-08-17 14:23:55,644 INFO Request is completed\n",
"2022-08-17 14:23:55,644 INFO Downloading https://download-0001-ads-clone.copernicus-climate.eu/cache-compute-0001/cache/data4/adaptor.mars.internal-1660713833.7656522-30394-9-196b7f26-7785-4f4e-8cdc-ab6e3ea4e1b6.nc to /media/liwei/Data/CAMS/20150109.nc (5.3M)\n",
"2022-08-17 14:24:12,085 INFO Download rate 330.1K/s \n",
"2022-08-17 14:24:12,469 INFO Welcome to the CDS\n",
"2022-08-17 14:24:12,470 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:24:12,666 INFO Request is queued\n",
"2022-08-17 14:24:13,860 INFO Request is running\n",
"2022-08-17 14:24:15,556 INFO Request is completed\n",
"2022-08-17 14:24:15,557 INFO Downloading https://download-0000-ads-clone.copernicus-climate.eu/cache-compute-0000/cache/data4/adaptor.mars.internal-1660713853.5019336-14656-9-f8a38b69-4a68-4647-848b-5772acec0533.nc to /media/liwei/Data/CAMS/20150110.nc (5.3M)\n",
"2022-08-17 14:24:31,988 INFO Download rate 330.3K/s \n",
"2022-08-17 14:24:32,372 INFO Welcome to the CDS\n",
"2022-08-17 14:24:32,373 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:24:32,573 INFO Request is queued\n",
"2022-08-17 14:24:33,766 INFO Request is running\n",
"2022-08-17 14:24:35,458 INFO Request is completed\n",
"2022-08-17 14:24:35,459 INFO Downloading https://download-0003-ads-clone.copernicus-climate.eu/cache-compute-0003/cache/data7/adaptor.mars.internal-1660713873.5340037-19340-16-ae533108-2edd-4424-b30b-f6ea08146cc1.nc to /media/liwei/Data/CAMS/20150111.nc (5.3M)\n",
"2022-08-17 14:24:53,356 INFO Download rate 303.2K/s \n",
"2022-08-17 14:24:53,738 INFO Welcome to the CDS\n",
"2022-08-17 14:24:53,739 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:24:53,934 INFO Request is queued\n",
"2022-08-17 14:24:55,126 INFO Request is running\n",
"2022-08-17 14:24:56,818 INFO Request is completed\n",
"2022-08-17 14:24:56,819 INFO Downloading https://download-0003-ads-clone.copernicus-climate.eu/cache-compute-0003/cache/data8/adaptor.mars.internal-1660713894.853265-26661-8-b9ffe5b4-fb4f-40c0-b202-3f3628d638ac.nc to /media/liwei/Data/CAMS/20150112.nc (5.3M)\n",
"2022-08-17 14:25:13,250 INFO Download rate 330.3K/s \n",
"2022-08-17 14:25:13,636 INFO Welcome to the CDS\n",
"2022-08-17 14:25:13,637 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:25:13,834 INFO Request is queued\n",
"2022-08-17 14:25:15,027 INFO Request is running\n",
"2022-08-17 14:25:16,720 INFO Request is completed\n",
"2022-08-17 14:25:16,721 INFO Downloading https://download-0002-ads-clone.copernicus-climate.eu/cache-compute-0002/cache/data8/adaptor.mars.internal-1660713914.5215836-23121-16-8aca0a69-0db9-4acc-8e44-f5c625a03cfb.nc to /media/liwei/Data/CAMS/20150113.nc (5.3M)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-08-17 14:25:33,326 INFO Download rate 326.8K/s \n",
"2022-08-17 14:25:33,708 INFO Welcome to the CDS\n",
"2022-08-17 14:25:33,709 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:25:33,904 INFO Request is queued\n",
"2022-08-17 14:25:35,096 INFO Request is running\n",
"2022-08-17 14:25:36,790 INFO Request is completed\n",
"2022-08-17 14:25:36,791 INFO Downloading https://download-0001-ads-clone.copernicus-climate.eu/cache-compute-0001/cache/data5/adaptor.mars.internal-1660713934.7015324-10204-14-4c70c060-c871-4076-8b97-fe1b3b5b60ba.nc to /media/liwei/Data/CAMS/20150114.nc (5.3M)\n",
"2022-08-17 14:25:54,310 INFO Download rate 309.8K/s \n",
"2022-08-17 14:25:54,699 INFO Welcome to the CDS\n",
"2022-08-17 14:25:54,700 INFO Sending request to https://ads.atmosphere.copernicus.eu/api/v2/resources/cams-global-reanalysis-eac4\n",
"2022-08-17 14:25:54,899 INFO Request is queued\n",
"2022-08-17 14:25:56,093 INFO Request is running\n",
"2022-08-17 14:25:57,786 INFO Request is completed\n",
"2022-08-17 14:25:57,787 INFO Downloading https://download-0003-ads-clone.copernicus-climate.eu/cache-compute-0003/cache/data8/adaptor.mars.internal-1660713955.7913332-27684-8-17741267-106d-46c1-bd8d-0bf6702d11bb.nc to /media/liwei/Data/CAMS/20150115.nc (5.3M)\n",
" 13%|█████▏ | 712k/5.30M [00:02<00:14, 340kB/s]"
]
}
],
"source": [
"import cdsapi\n",
"import os\n",
"from datetime import datetime, timedelta\n",
"DATA_TYPE = ['total_column_ozone', 'total_column_water_vapour','total_aerosol_optical_depth_550nm']\n",
"# DATE_TYPE = ['black_carbon_aerosol_optical_depth_550nm', 'dust_aerosol_optical_depth_550nm', 'organic_matter_aerosol_optical_depth_550nm',\n",
"# 'sea_salt_aerosol_optical_depth_550nm', 'sulphate_aerosol_optical_depth_550nm']\n",
"TIME_RANGE = ['00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00']\n",
"STORAGE_FOLDER = '/media/liwei/Data/CAMS'\n",
"def CAMS_download(v_type, d_range, t_range, nc_path):\n",
" try:\n",
" c = cdsapi.Client()\n",
" c.retrieve(\n",
" 'cams-global-reanalysis-eac4', {\n",
" 'variable': v_type,\n",
" 'date': d_range,\n",
" 'time': t_range,\n",
" 'format': 'netcdf',\n",
" }, nc_path)\n",
" except Exception as e:\n",
" print('Error: ' + nc_path)\n",
" print(e)\n",
"if __name__ == \"__main__\":\n",
" date_start = '2015-01-01'\n",
" date_end = '2021-12-31'\n",
" date_s = datetime.strptime(date_start, \"%Y-%m-%d\")\n",
" date_t = timedelta(days=1)\n",
" date_e = datetime.strptime(date_end, \"%Y-%m-%d\")\n",
" date_dl = date_s\n",
" while date_dl <= date_e:\n",
" date_dl_str = date_dl.strftime(\"%Y-%m-%d\")\n",
" data_range = date_dl_str + '/' + date_dl_str\n",
" file_path = date_dl.strftime(\"%Y%m%d\") + '.nc'\n",
" CAMS_download(DATA_TYPE, data_range, TIME_RANGE, os.path.join(STORAGE_FOLDER, file_path))\n",
" date_dl = date_dl + date_t"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"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.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 610d9f1

Please sign in to comment.