ARC2 download example

In this demo we show how to download ARC2 data


In [1]:
%matplotlib notebook
import dh_py_access.lib.datahub as datahub
import dh_py_access.package_api as package_api

Please put your datahub API key into a file called APIKEY and place it to the notebook folder or assign your API key directly to the variable API_key!


In [2]:
server = 'api.planetos.com'
API_key = open('APIKEY').readlines()[0].strip() #'<YOUR API KEY HERE>'
version = 'v1'

At first, we need to define the dataset names and temporal ranges. Please note that the datasets have different time ranges. So we will download the data from 1981, when CHRIPS starts (ARC2 is from 1983).


In [3]:
dh=datahub.datahub(server,version,API_key)
dataset1='noaa_arc2_africa_01'
variable_name1 = 'pr'
time_start = '1983-01-01T00:00:00'
time_end = '2018-01-01T00:00:00'

Then we define spatial range. In this case we define all Africa. Keep in mind that it's a huge area and downloading all the data from Africa for 35 years is a lot and can take even several hours.


In [4]:
area_name = 'Africa'
latitude_north = 42.24; longitude_west = -24.64
latitude_south = -45.76; longitude_east = 60.28

Download the data with package API

  1. Create package objects
  2. Send commands for the package creation
  3. Download the package files

In [5]:
package_arc2_africa_01 = package_api.package_api(dh,dataset1,variable_name1,longitude_west,longitude_east,latitude_south,latitude_north,time_start,time_end,area_name=area_name)

In [6]:
package_arc2_africa_01.make_package()


Package exists

In [7]:
package_arc2_africa_01.download_package()


File already downloaded

In [ ]: