How to use CLIK API


The CLimate Information toolKit (CLIK) Open Application Program Interface(API) is a service providing programmatic access to data.
In this page you will find explanations and examples showing how to use the CLIK API.

Please process as follows:

  1. Set the API key
  2. Install the API client
  3. Use the API client

Set the API key
  1. If you don't have an account, please self register at the Registration.
  2. If you are not logged, please login and get your key at Member Info.
  3. Copy the code displayed below, in the file $HOME/apccapi.properties.

key=810050f2-727e-5ed3-a871-b7a881a04d34
request_url=https://request.apcc21.org/apccdata
status_url=https://request.apcc21.org/status
Install the API client
Please download the Python API via this link.
You can install API client by running below at your working directory.

$ tar xvf apccapi.tar.gz
Use the API client

Once the API client is installed, it can be used to request data from the datasets.
You can download using the below sample python code.

Dataset:


#!/usr/bin/env python
import apccapi

c = apccapi.Client()
c.retrieve(
	{
		'jobtype': 'MME',
		'dataset': 'MME_3MONTH',
		'type': 'FORECAST',
		'method': 'SCM',
		'variable': ['prec', 't2m'],
		'period': ['Monthly mean'],
		'yearmonth': ['201909']
	},
	'mme3.zip'
)
										
#!/usr/bin/env python
import apccapi

c = apccapi.Client()
c.retrieve(
	{
		'jobtype': 'MME',
		'dataset': 'MME_6MONTH',
		'type': 'FORECAST',
		'method': 'GAUS',
		'variable': ['prec', 't2m'],
		'period': ['Monthly mean', 'Seasonal mean'],
		'yearmonth': ['201909']
	},
	'mme6.zip'
)
										
#!/usr/bin/env python
import apccapi

c = apccapi.Client()
c.retrieve(
	{
		'jobtype': 'MODEL',
		'dataset': 'MODEL',
		'type': 'FORECAST',
		'institute': 'APCC',
		'model': 'SCOPS',
		'variable': ['prec', 't2m'],
		'yearmonth': ['201909']
	},
	'model.zip'
)
										
#!/usr/bin/env python
import apccapi

c = apccapi.Client()
c.retrieve(
	{
		'jobtype': 'CMIP5',
		'dataset': 'CMIP5',
		'code': 'AD',
	},
	'cmip5.zip'
)
										

The CLimate Information toolKit (CLIK) Open Application Program Interface(API) is a service providing programmatic access to data.
In this page you will find explanations and examples showing how to use the CLIK API.

Please process as follows:

  1. Set the API key
  2. Install the API client
  3. Use the API client

Set the API key
  1. If you don't have an account, please self register at the Registration.
  2. If you are not logged, please login and get your key at Member Info.
  3. Copy the code displayed below, in the file $HOME/apccapi.properties.

key=810050f2-727e-5ed3-a871-b7a881a04d34
request_url=https://request.apcc21.org/apccdata
status_url=https://request.apcc21.org/status
Install the API client
Please download the Java API via this link.
You can use API client library by importing at your working space.

Use the API client

Once the API client is imported, it can be used to request data from the datasets.
You can download using the below sample java code.

Dataset:


package my.package;

import org.apcc.api.client.APIClient;
import org.apcc.api.jobdetails.Dataset;
import org.apcc.api.jobdetails.JobDetailsMME;

public class ClientTest 
{
	public static void main(String[] args) 
	{
		try
		{
			APIClient client = new APIClient();
			JobDetailsMME mme = new JobDetailsMME();
			
			mme.setDataset(Dataset.DATASET_MME_3MON.datasetName);	
			mme.setType("FORECAST");
			mme.setMethod("GAUS");
			mme.addPeriod("Monthly mean");
			mme.addYearmonth("201909");
			mme.addVariable("prec");
			mme.addVariable("t2m");
			client.run(mme, "mme3.zip");
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

}
										
package my.package;

import org.apcc.api.client.APIClient;
import org.apcc.api.jobdetails.Dataset;
import org.apcc.api.jobdetails.JobDetailsMME;

public class ClientTest 
{
	public static void main(String[] args) 
	{
		try
		{
			APIClient client = new APIClient();
			JobDetailsMME mme = new JobDetailsMME();
			
			mme.setDataset(Dataset.DATASET_MME_6MON.datasetName);	
			mme.setType("FORECAST");
			mme.setMethod("GAUS");
			mme.addPeriod("Monthly mean");
			mme.addYearmonth("201909");
			mme.addVariable("prec");
			mme.addVariable("t2m");
			client.run(mme, "mme6-1.zip");
			
			// json type
			String details =  "{\"jobtype\":\"MME\",\"dataset\":\"MME_6MONTH\",\"type\":\"FORECAST\",\"method\":\"SCM\",\"variable\":[\"prec\",\"t2m\"],\"period\":[\"Monthly mean\"],\"yearmonth\":[\"201909\"]}";
			client.run(details, "mme6-2.zip");
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

}
										
package my.package;

import org.apcc.api.client.APIClient;
import org.apcc.api.jobdetails.Dataset;
import org.apcc.api.jobdetails.JobDetailsModel;

public class ClientTest 
{
	public static void main(String[] args) 
	{
		try
		{
			APIClient client = new APIClient();
			
			JobDetailsModel model = new JobDetailsModel();
			model.setDataset(Dataset.DATASET_MODEL.datasetName);
			model.setType("FORECAST");
			model.setInstitute("APCC");
			model.setModel("SCOPS");
			model.addYearmonth("202002");
			model.addYearmonth("202003");
			model.addVariable("prec");
			model.addVariable("t2m");
			client.run(model, "model.zip");
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

}
										
package my.package;

import org.apcc.api.client.APIClient;
import org.apcc.api.jobdetails.Dataset;
import org.apcc.api.jobdetails.JobDetailsCMIP5;

public class ClientTest 
{
	public static void main(String[] args) 
	{
		try
		{
			APIClient client = new APIClient();
			JobDetailsCMIP5 cmip5 = new JobDetailsCMIP5();
			cmip5.setDataset(Dataset.DATASET_CMIP5.datasetName);
			cmip5.setCode("AD");
			client.run(cmip5, "cmip5.zip");
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

}
											

The CLimate Information toolKit (CLIK) Open Application Program Interface(API) is a service providing programmatic access to data.
In this page you will find explanations and examples showing how to use the CLIK Clipping API.

Please process as follows:

  1. Install the API client
  2. Use the API client

Install the clipping API client
Please download the Python Clipping API via this link.
You can install API client by running below at your working directory.

$ tar xvf clippingapi.tar.gz
Use the API client

Once the API client is imported, it can be used to request data from the datasets.
You can download using the below sample Python code.

Clipping Open API currently provides only MME Models.

Dataset:


import clippingapi
import json
import requests

c = clippingapi.Client()

request = {
		'lead_month': '3-MON',      # 3-MON, 6-MON
		'variable': 'prec',         # prec, slp, sst, t2m, t850, z500
		'method': 'SCM',            # SCM, GAUS
		'period': 'Monthly mean',   # Monthly mean, #Seasonal mean
		'iyear': '2021',            # Issued Year
		'imonth': '2',              # Issued Month
		'cowest': '188',            # coordinate of west
		'coeast': '191',
		'conorth': '-11',
		'cosouth': '-15',
		'return_type': 'png'        # Clipping API only provides either .nc or .png files.
	}

c.clip(request)
										
import clippingapi
import json
import requests

c = clippingapi.Client()

request = {
		'lead_month': '6-MON',      # 3-MON, 6-MON
		'variable': 'prec',         # prec, slp, sst, t2m, t850, z500
		'method': 'SCM',            # SCM, GAUS
		'period': 'Monthly mean',   # Monthly mean, #Seasonal mean
		'iyear': '2021',            # Issued Year
		'imonth': '2',              # Issued Month
		'cowest': '188',
		'coeast': '191',
		'conorth': '-11',
		'cosouth': '-15',
		'return_type': 'nc'        # Clipping API only provides either .nc or .png files.
	}

c.clip(request)