diff --git a/examples/data/ecmwf/data_interim.nc b/examples/data/ecmwf/data_interim.nc new file mode 100644 index 0000000..3d8fd13 Binary files /dev/null and b/examples/data/ecmwf/data_interim.nc differ diff --git a/examples/download_satellite_data.ipynb b/examples/download_satellite_data.ipynb new file mode 100644 index 0000000..35ba245 --- /dev/null +++ b/examples/download_satellite_data.ipynb @@ -0,0 +1,504 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "48fff0da-2d7a-49ea-ba13-d4768a89bae0", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "# Download Satellite data" + ] + }, + { + "cell_type": "markdown", + "id": "2c773dd4-6dc6-4c86-aeed-ad82b6118ccb", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "## ECMWF" + ] + }, + { + "cell_type": "markdown", + "id": "7ac42c26-f454-40e5-8dc2-668efbc2d02b", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "### Installation of ECMWF API key" + ] + }, + { + "cell_type": "markdown", + "id": "ad7c9c5c-ed4c-41b7-afdb-40fb471e015b", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "1 - to be able to use Hapi to download ECMWF data you need to register and setup your account in the ECMWF website (https://apps.ecmwf.int/registration/)\n", + "\n", + "2 - Install ECMWF key (instruction are here https://confluence.ecmwf.int/display/WEBAPI/Access+ECMWF+Public+Datasets#AccessECMWFPublicDatasets-key)\n", + "(https://confluence.ecmwf.int/display/WEBAPI/Install+ECMWF+API+Key)\n", + " (to get youe API key https://api.ecmwf.int/v1/key/)\n", + " (key)[\\examples\\img\\key.png\n", + "\n", + "Copy/paste the key into a text file and save it to your $HOME directory as .ecmwfapirc (If you use\n", + "Windows, you have to put the file in C:\\Users\\\\.ecmwfapirc\n", + "\n", + "3- add environment variables\n", + "\n", + "in your command prompt type the following lines and press enter\n", + "\n", + "export ECMWF_API_URL=\"https://api.ecmwf.int/v1\"\n", + "export ECMWF_API_KEY=\"73978adaef38142a3669b68789b78098\"\n", + "export ECMWF_API_EMAIL=\"moah.farag@gmail.com\"\n" + ] + }, + { + "cell_type": "markdown", + "id": "f3d80671-55eb-4915-990b-78f1dcc4e0d1", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "### Using ResmoteSensing module from Hapi " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "9d733330-95bb-42b4-b6f5-895119345222", + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [], + "source": [ + "from earth2observe.ecmwf import ECMWF\n", + "from earth2observe.ecmwf import Variables\n", + "import os\n", + "#os.chdir(\"F:/01Algorithms/Hydrology/HAPI/Examples\")" + ] + }, + { + "cell_type": "markdown", + "id": "bc750181-4a25-48f1-b510-ee834484b7c9", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "For the information about the ECMWF data https://apps.ecmwf.int/codes/grib/param-db/\n", + "ECMWP data are represented as variables to know the name of the variable you want to download you can check the object `Variables`\n", + "\n", + "`Variables` contains the tame of the variable you need to give to the `ECMWF` object to get and the unit and description\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "35bb343d-4354-43e2-82ea-6ebf14aa3615", + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Variable name:\n", + "{'T': 't', '2T': 't2m', 'SRO': 'sro', 'SSRO': 'ssro', 'WIND': 'wind', '10SI': '10si', 'SP': 'sp', 'Q': 'q', 'SSR': 'ssr', 'R': 'r', 'E': 'e', 'SUND': 'sund', 'RO': 'ro', 'TP': 'tp', '10U': 'u10', '10V': 'v10', '2D': 'd2m', 'SR': 'sr', 'AL': 'al', 'HCC': 'hcc'}\n", + "Descriptions\n", + "{'T': 'Temperature [K]', '2T': '2 meter Temperature [K]', 'SRO': 'Surface Runoff [m]', 'SSRO': 'Sub-surface Runoff [m]', 'WIND': 'Wind speed [m s-1]', '10SI': '10 metre windspeed [m s-1]', 'SP': 'Surface Pressure [pa]', 'Q': 'Specific humidity [kg kg-1]', 'SSR': 'Surface solar radiation [W m-2 s]', 'R': 'Relative humidity [%]', 'E': 'Evaporation [m of water]', 'SUND': 'Sunshine duration [s]', 'RO': 'Runoff [m]', 'TP': 'Total Precipitation [m]', '10U': '10 metre U wind component [m s-1]', '10V': '10 metre V wind component [m s-1]', '2D': '2 metre dewpoint temperature [K]', 'SR': 'Surface roughness [m]', 'AL': 'Albedo []', 'HCC': 'High cloud cover []'}\n", + "Units : \n", + "{'T': 'C', '2T': 'C', 'SRO': 'mm', 'SSRO': 'mm', 'WIND': 'm_s-1', '10SI': 'm_s-1', 'SP': 'kpa', 'Q': 'kg_kg-1', 'SSR': 'W_m-2_s', 'R': 'percentage', 'E': 'mm', 'SUND': 's', 'RO': 'mm', 'TP': 'mm', '10U': 'm_s-1', '10V': 'm_s-1', '2D': 'C', 'SR': 'm', 'AL': '-', 'HCC': '-'}\n" + ] + } + ], + "source": [ + "Vars = Variables('daily')\n", + "Vars.__str__()" + ] + }, + { + "cell_type": "markdown", + "id": "0a2a6ca8-a09b-47b8-b97e-8d1c1e11c561", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "### Inputs" + ] + }, + { + "cell_type": "markdown", + "id": "be829713-e3bb-442e-a2b1-5dfffb46b028", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "- After selecting the variable, temperature and evapotranspiration ['E','T']\n", + "\n", + "- You need to provide the period you want to download the data for knowing that the beginning of the data is 1979.01.01 and the end is 2019.08.01\n", + " lets say we need the data between '2009-01-01' and '2009-02-01'\n", + "- then we need to provide the extent in the form of latitude and longitude\n", + " for out case stude `Coello` those are lat = [4.19,4.64] and lon = [-75.64,-74.72]" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "c73ad20b-e8cd-4a0e-9107-12a2cfbac207", + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [], + "source": [ + "StartDate = '2009-01-01'\n", + "EndDate = '2009-01-10'\n", + "Time = 'daily'\n", + "lat = [4.190755, 4.643963]\n", + "lon = [-75.649243, -74.727286]\n", + "Path = \"/data/satellite_data/\"\n", + "# Temperature, Evapotranspiration\n", + "variables = ['T', 'E']" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "405220ce-2d9b-4cee-9137-ee639153ef64", + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Download ECMWF T data for period 2009-01-01 00:00:00 till 2009-01-10 00:00:00\n", + "Use API ECMWF to collect the data, please wait\n", + "2021-04-14 09:13:24 ECMWF API python library 1.6.1\n", + "2021-04-14 09:13:24 ECMWF API at https://api.ecmwf.int/v1\n", + "2021-04-14 09:13:25 Welcome Mostafa Farrag\n", + "2021-04-14 09:13:25 In case of problems, please check https://confluence.ecmwf.int/display/WEBAPI/Web+API+FAQ or contact servicedesk@ecmwf.int\n", + "2021-04-14 09:13:26 Request submitted\n", + "2021-04-14 09:13:26 Request id: 607696162b84daac739e06f2\n", + "2021-04-14 09:13:26 Request is submitted\n", + "2021-04-14 09:13:27 Request is active\n", + "Calling 'nice mars /tmp/20210414-0710/b1/tmp-_marsl0iuOw.req'\n", + "mars - WARN -\n", + "mars - WARN - From 29 January 2019 10AM (UTC) MARS uses the interpolation\n", + "mars - WARN - provided by the MIR library. For more details, see\n", + "mars - WARN - https://confluence.ecmwf.int/display/UDOC/MARS+interpolation+with+MIR\n", + "mars - WARN -\n", + "MIR environment variables:\n", + "MIR_CACHE_PATH=/data/ec_coeff\n", + "mars - INFO - 20210414.071328 - Welcome to MARS\n", + "mars - INFO - 20210414.071328 - MARS Client bundle version: 6.28.6.1\n", + "mars - INFO - 20210414.071328 - MARS Client package version: 6.28.6\n", + "mars - INFO - 20210414.071328 - MARS Client build stamp: 20200717102127\n", + "mars - INFO - 20210414.071328 - MIR version: 1.4.7\n", + "mars - INFO - 20210414.071328 - Using ecCodes version 2.18.0\n", + "mars - INFO - 20210414.071328 - Using odb_api version: 0.15.11 (file format version: 0.5)\n", + "mars - INFO - 20210414.071328 - Using FDB5 version: 5.6.1\n", + "mars - INFO - 20210414.071328 - Maximum retrieval size is 50.00 G\n", + "retrieve,levelist=1000,stream=oper,area=4.75/-75.75/4.125/-74.625,levtype=pl,param=130.128,padding=0,step=0,grid=0.125/0.125,expver=0001,time=00:00:00/06:00:00/12:00:00/18:00:00,date=2009-01-01 00:00:00/to/2009-01-10 00:00:00,type=an,class=eimars - WARN - 20210414.071328 - For full resolution grid, it is recommended to use RESOL=AV to prevent any truncation before transformation\n", + "mars - INFO - 20210414.071328 - Automatic split by date is on\n", + "\n", + "mars - INFO - 20210414.071328 - Processing request 1\n", + "sh: /usr/bin/mailx: No such file or directory\n", + "\n", + "RETRIEVE,\n", + " CLASS = EI,\n", + " TYPE = AN,\n", + " STREAM = OPER,\n", + " EXPVER = 0001,\n", + " REPRES = SH,\n", + " LEVTYPE = PL,\n", + " LEVELIST = 1000,\n", + " PARAM = 130.128,\n", + " TIME = 0000/0600/1200/1800,\n", + " STEP = 0,\n", + " DOMAIN = G,\n", + " RESOL = AUTO,\n", + " AREA = 4.75/-75.75/4.125/-74.625,\n", + " GRID = 0.125/0.125,\n", + " PADDING = 0,\n", + " DATE = 20090101/20090102/20090103/20090104/20090105/20090106/20090107/20090108/20090109/20090110\n", + "\n", + "mars - INFO - 20210414.071328 - Web API request id: 607696162b84daac739e06f2\n", + "mars - INFO - 20210414.071328 - Requesting 40 fields\n", + "mars - INFO - 20210414.071328 - Calling mars on 'marser', local port is 58560\n", + "mars - INFO - 20210414.071328 - Server task is 704 [marser]\n", + "mars - INFO - 20210414.071328 - Request cost: 40 fields, 5.05913 Mbytes online, nodes: mvr02 [marser]\n", + "mars - INFO - 20210414.071328 - The efficiency of your requests in the last 12 hours is 100% [marser]\n", + "mars - INFO - 20210414.071328 - Transfering 5304880 bytes\n", + "mars - INFO - 20210414.071328 - ShToGridded: loading Legendre coefficients '/data/ec_coeff/mir/legendre/4/local-T255-GaussianN256-OPT4189816c2e.leg'\n", + "mars - INFO - 20210414.071340 - 40 fields retrieved from 'marser'\n", + "mars - INFO - 20210414.071340 - 40 fields have been interpolated\n", + "mars - INFO - 20210414.071432 - Request time: wall: 1 min 4 sec cpu: 1 sec\n", + "mars - INFO - 20210414.071432 - Read from network: 5.06 Mbyte(s) in < 1 sec [265.06 Mbyte/sec]\n", + "mars - INFO - 20210414.071432 - Visiting marser: wall: 12 sec\n", + "mars - INFO - 20210414.071432 - Post-processing: wall: 11 sec\n", + "mars - INFO - 20210414.071432 - Writing to target file: 8.91 Kbyte(s) in 52 sec [174.18 byte/sec]\n", + "mars - INFO - 20210414.071432 - Memory used: 44.30 Mbyte(s)\n", + "mars - INFO - 20210414.071432 - No errors reported\n", + "Process '['nice', 'mars', '/tmp/20210414-0710/b1/tmp-_marsl0iuOw.req']' finished\n", + "Calling 'nice grib_to_netcdf /data/scratch/20210414-0710/ef/_mars-webmars-public-svc-green-001-6fe5cac1a363ec1525f54343b6cc9fd8-06C7Rj.grib -o /data/scratch/20210414-0710/28/_grib2netcdf-webmars-public-svc-green-007-6fe5cac1a363ec1525f54343b6cc9fd8-tc_782.nc -utime'\n", + "grib_to_netcdf: Version 2.21.0\n", + "grib_to_netcdf: Processing input file '/data/scratch/20210414-0710/ef/_mars-webmars-public-svc-green-001-6fe5cac1a363ec1525f54343b6cc9fd8-06C7Rj.grib'.\n", + "grib_to_netcdf: Found 40 GRIB fields in 1 file.\n", + "grib_to_netcdf: Ignoring key(s): method, type, stream, refdate, hdate\n", + "grib_to_netcdf: Creating netCDF file '/data/scratch/20210414-0710/28/_grib2netcdf-webmars-public-svc-green-007-6fe5cac1a363ec1525f54343b6cc9fd8-tc_782.nc'\n", + "grib_to_netcdf: NetCDF library version: 4.3.3.1 of Dec 10 2015 16:44:18 $\n", + "grib_to_netcdf: Creating large (64 bit) file format.\n", + "grib_to_netcdf: Defining variable 't'.\n", + "grib_to_netcdf: Done.\n", + "Process '['nice', 'grib_to_netcdf', '/data/scratch/20210414-0710/ef/_mars-webmars-public-svc-green-001-6fe5cac1a363ec1525f54343b6cc9fd8-06C7Rj.grib', '-o', '/data/scratch/20210414-0710/28/_grib2netcdf-webmars-public-svc-green-007-6fe5cac1a363ec1525f54343b6cc9fd8-tc_782.nc', '-utime']' finished\n", + "2021-04-14 09:14:40 Request is complete\n", + "2021-04-14 09:14:40 Transfering 5.97656 Kbytes into data_interim.nc\n", + "2021-04-14 09:14:40 From https://stream.ecmwf.int/data/webmars-public-svc-green-007/data/scratch/20210414-0710/28/_grib2netcdf-webmars-public-svc-green-007-6fe5cac1a363ec1525f54343b6cc9fd8-tc_782.nc\n", + "2021-04-14 09:14:41 Transfer rate 22.9308 Kbytes/s\n", + "Progress: |██████████████████████████████████████████████████| 100.0% Complete\n", + "\n", + "Download ECMWF E data for period 2009-01-01 00:00:00 till 2009-01-10 00:00:00\n", + "Use API ECMWF to collect the data, please wait\n", + "2021-04-14 09:14:41 ECMWF API python library 1.6.1\n", + "2021-04-14 09:14:41 ECMWF API at https://api.ecmwf.int/v1\n", + "2021-04-14 09:14:41 Welcome Mostafa Farrag\n", + "2021-04-14 09:14:42 In case of problems, please check https://confluence.ecmwf.int/display/WEBAPI/Web+API+FAQ or contact servicedesk@ecmwf.int\n", + "2021-04-14 09:14:42 Request submitted\n", + "2021-04-14 09:14:42 Request id: 60769663d685a2045b9e06ec\n", + "2021-04-14 09:14:42 Request is submitted\n", + "2021-04-14 09:14:44 Request is active\n", + "Calling 'nice mars /tmp/20210414-0710/0b/tmp-_marsUrYh66.req'\n", + "mars - WARN -\n", + "mars - WARN - From 29 January 2019 10AM (UTC) MARS uses the interpolation\n", + "mars - WARN - provided by the MIR library. For more details, see\n", + "mars - WARN - https://confluence.ecmwf.int/display/UDOC/MARS+interpolation+with+MIR\n", + "mars - WARN -\n", + "MIR environment variables:\n", + "MIR_CACHE_PATH=/data/ec_coeff\n", + "mars - INFO - 20210414.071444 - Welcome to MARS\n", + "mars - INFO - 20210414.071444 - MARS Client bundle version: 6.28.6.1\n", + "mars - INFO - 20210414.071444 - MARS Client package version: 6.28.6\n", + "mars - INFO - 20210414.071444 - MARS Client build stamp: 20200717102127\n", + "mars - INFO - 20210414.071444 - MIR version: 1.4.7\n", + "mars - INFO - 20210414.071444 - Using ecCodes version 2.18.0\n", + "mars - INFO - 20210414.071444 - Using odb_api version: 0.15.11 (file format version: 0.5)\n", + "mars - INFO - 20210414.071444 - Using FDB5 version: 5.6.1\n", + "mars - INFO - 20210414.071444 - Maximum retrieval size is 50.00 G\n", + "retrieve,stream=oper,area=4.75/-75.75/4.125/-74.625,levtype=sfc,param=182.128,padding=0,step=12,grid=0.125/0.125,expver=0001,time=00:00:00/12:00:00,date=2009-01-01 00:00:00/to/2009-01-10 00:00:00,type=fc,class=eimars - WARN - 20210414.071444 - For full resolution grid, it is recommended to use RESOL=AV to prevent any truncation before transformation\n", + "mars - INFO - 20210414.071444 - Automatic split by date is on\n", + "\n", + "mars - INFO - 20210414.071444 - Processing request 1\n", + "sh: /usr/bin/mailx: No such file or directory\n", + "\n", + "RETRIEVE,\n", + " CLASS = EI,\n", + " TYPE = FC,\n", + " STREAM = OPER,\n", + " EXPVER = 0001,\n", + " REPRES = SH,\n", + " LEVTYPE = SFC,\n", + " PARAM = 182.128,\n", + " TIME = 0000/1200,\n", + " STEP = 12,\n", + " DOMAIN = G,\n", + " RESOL = AUTO,\n", + " AREA = 4.75/-75.75/4.125/-74.625,\n", + " GRID = 0.125/0.125,\n", + " PADDING = 0,\n", + " DATE = 20090101/20090102/20090103/20090104/20090105/20090106/20090107/20090108/20090109/20090110\n", + "\n", + "mars - INFO - 20210414.071444 - Web API request id: 60769663d685a2045b9e06ec\n", + "mars - INFO - 20210414.071444 - Requesting 20 fields\n", + "mars - INFO - 20210414.071444 - Calling mars on 'marser', local port is 59438\n", + "mars - INFO - 20210414.071444 - Server task is 286 [marser]\n", + "mars - INFO - 20210414.071444 - Request cost: 20 fields, 3.40073 Mbytes online, nodes: mvr02 [marser]\n", + "mars - INFO - 20210414.071444 - The efficiency of your requests in the last 12 hours is 100% [marser]\n", + "mars - INFO - 20210414.071444 - Transfering 3565920 bytes\n", + "mars - INFO - 20210414.071444 - 20 fields retrieved from 'marser'\n", + "mars - INFO - 20210414.071444 - 20 fields have been interpolated\n", + "mars - INFO - 20210414.071445 - Request time: wall: 1 sec\n", + "mars - INFO - 20210414.071445 - Read from network: 3.40 Mbyte(s) in < 1 sec [273.06 Mbyte/sec]\n", + "mars - INFO - 20210414.071445 - Writing to target file: 4.45 Kbyte(s) in < 1 sec [41.17 Kbyte/sec]\n", + "mars - INFO - 20210414.071445 - Memory used: 36.57 Mbyte(s)\n", + "mars - INFO - 20210414.071445 - No errors reported\n", + "Process '['nice', 'mars', '/tmp/20210414-0710/0b/tmp-_marsUrYh66.req']' finished\n", + "Calling 'nice grib_to_netcdf /data/scratch/20210414-0710/26/_mars-webmars-public-svc-green-003-6fe5cac1a363ec1525f54343b6cc9fd8-JfoG3r.grib -o /data/scratch/20210414-0710/7a/_grib2netcdf-webmars-public-svc-green-006-6fe5cac1a363ec1525f54343b6cc9fd8-hKn4GP.nc -utime'\n", + "grib_to_netcdf: Version 2.21.0\n", + "grib_to_netcdf: Processing input file '/data/scratch/20210414-0710/26/_mars-webmars-public-svc-green-003-6fe5cac1a363ec1525f54343b6cc9fd8-JfoG3r.grib'.\n", + "grib_to_netcdf: Found 20 GRIB fields in 1 file.\n", + "grib_to_netcdf: Ignoring key(s): method, type, stream, refdate, hdate\n", + "grib_to_netcdf: Creating netCDF file '/data/scratch/20210414-0710/7a/_grib2netcdf-webmars-public-svc-green-006-6fe5cac1a363ec1525f54343b6cc9fd8-hKn4GP.nc'\n", + "grib_to_netcdf: NetCDF library version: 4.3.3.1 of Dec 10 2015 16:44:18 $\n", + "grib_to_netcdf: Creating large (64 bit) file format.\n", + "grib_to_netcdf: Defining variable 'e'.\n", + "grib_to_netcdf: Done.\n", + "Process '['nice', 'grib_to_netcdf', '/data/scratch/20210414-0710/26/_mars-webmars-public-svc-green-003-6fe5cac1a363ec1525f54343b6cc9fd8-JfoG3r.grib', '-o', '/data/scratch/20210414-0710/7a/_grib2netcdf-webmars-public-svc-green-006-6fe5cac1a363ec1525f54343b6cc9fd8-hKn4GP.nc', '-utime']' finished\n", + "2021-04-14 09:14:49 Request is complete\n", + "2021-04-14 09:14:49 Transfering 3.60156 Kbytes into data_interim.nc\n", + "2021-04-14 09:14:49 From https://stream.ecmwf.int/data/webmars-public-svc-green-006/data/scratch/20210414-0710/7a/_grib2netcdf-webmars-public-svc-green-006-6fe5cac1a363ec1525f54343b6cc9fd8-hKn4GP.nc\n", + "2021-04-14 09:14:49 Transfer rate 16.9291 Kbytes/s\n", + "Progress: |██████████████████████████████████████████████████| 100.0% Complete\n" + ] + } + ], + "source": [ + "Coello = ECMWF(start=StartDate, end=EndDate, time=Time,\n", + " lat_lim=lat, lon_lim=lon, path=Path, variables=variables)\n", + "\n", + "Coello.download(Waitbar=1)" + ] + }, + { + "cell_type": "markdown", + "id": "195e57ae-6345-45a4-a461-865734bafd73", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "## CHIRPS" + ] + }, + { + "cell_type": "markdown", + "id": "358e0726-28fb-4200-9674-9d0754b308cd", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "Using the same inputs (period and extent) CHRIPS data does not deen any registration" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "bf101450-3e00-4572-a50c-673a267996c7", + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [], + "source": [ + "from earth2observe.chirps import CHIRPS" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "e9ab20a1-786f-4692-913e-94f2f85b0281", + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Progress: |██████████████████████████████████████████████████| 100.0% Complete\n" + ] + }, + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Coello = CHIRPS(start=StartDate, end=EndDate, time=Time,\n", + " lat_lim=lat, lon_lim=lon, path=Path)\n", + "Coello.Download()" + ] + }, + { + "cell_type": "markdown", + "id": "2a2dbda9-82f9-44c3-9d0f-c9b330ae880a", + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, + "source": [ + "### Parallel download\n", + "- As the CHRIPS data are downloaded directly from ftp server, so several downloads can be done at the same time\n", + "- to choose how many cores to be used in the parallelization, you have to provide the parameter `core`\n", + "- there is no indication bar in case of parallel downloads" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9d0cfa73-938e-4334-b8cf-9ebc50ddaa81", + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [], + "source": [ + "Coello.Download(cores=4)" + ] + } + ], + "metadata": { + "kernelspec": { + "name": "pycharm-e2d4c152", + "language": "python", + "display_name": "PyCharm (pythonProject)" + }, + "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.8" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples/ecmwf_data.py b/examples/ecmwf_data.py index 07078c9..ab23794 100644 --- a/examples/ecmwf_data.py +++ b/examples/ecmwf_data.py @@ -4,6 +4,7 @@ 2 - Install ECMWF key (instruction are here https://confluence.ecmwf.int/display/WEBAPI/Access+ECMWF+Public+Datasets#AccessECMWFPublicDatasets-key) """ +<<<<<<< HEAD:examples/ecmwf_data.py import os from earth2observe.ecmwf import ECMWF, Variables @@ -11,6 +12,24 @@ rpath = os.getcwd() path = rf"{rpath}\examples\data\ecmwf" +======= +from earth2observe.chirps import CHIRPS +from earth2observe.ecmwf import ECMWF, Variables + +#%% precipitation +start = "2009-01-01" +end = "2009-01-10" +time = "daily" +lat = [4.190755, 4.643963] +lon = [-75.649243, -74.727286] +path = "/data/satellite_data/" +# Temperature, Evapotranspiration +variables = ["T", "E"] +#%% +Vars = Variables("daily") +Vars.__str__() +#%% Temperature +>>>>>>> main:examples/download_satellite_data.py start = "2009-01-01" end = "2009-02-01" time = "daily"