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'
)
										
#!/usr/bin/env python
import apccapi

c = apccapi.Client()
c.retrieve(
        {
                'jobtype': 'Prediction',
                'type': 'FORECAST',
                'method': 'SCM',
                'model': ['APCC_SCOPS', 'BOM_ACCESS-S1', 'KMA_GLOSEA5GC2'],
                'variable': ['prec', 'slp', 'sst', 't2m', 't850', 'z500'],
                'year': '2020',
                'month': '7'
        },
        'prediction.zip'
)
										
#!/usr/bin/env python
import apccapi

c = apccapi.Client()
c.retrieve(
        {
                'jobtype': 'Verification',
                'type': 'HINDCAST',
                'method': 'GAUS',
                'model': ['APCC_SCOPS', 'BOM_ACCESS-S1', 'CWB_GFST119', 'KMA_GLOSEA5GC2'],
                'variable': ['prec', 'slp', 'sst', 't2m', 't850', 'z500'],
                'verification': 'ROC_Curve',
                'year': '2020',
                'month': '9'
        },
        'verification.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();
		}
	}

}
											
package my.package;

import org.apcc.api.client.APIClient;
import org.apcc.api.jobdetails.JobDetailsPrediction;

public class ClientTest 
{
	public static void main(String[] args) 
	{
		try
		{
			APIClient client = new APIClient();
			JobDetailsPrediction prediction = new JobDetailsPrediction();
			prediction.setType("FORECAST");
			prediction.setMethod("SCM");
			prediction.addModel("APCC_SCOPS");
			prediction.addModel("BOM_ACCESS-S1");
			prediction.addModel("KMA_GLOSEA5GC2");
			prediction.addVariable("prec");
			prediction.addVariable("slp");
			prediction.addVariable("sst");
			prediction.addVariable("t2m");
			prediction.addVariable("t850");
			prediction.addVariable("z500");
			prediction.setYear("2020");
			prediction.setMonth("7");
			client.run(prediction, "prediction.zip");
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

}
											
package my.package;

import org.apcc.api.client.APIClient;
import org.apcc.api.jobdetails.JobDetailsVerification;

public class ClientTest 
{
	public static void main(String[] args) 
	{
		try
		{
			APIClient client = new APIClient();
			JobDetailsVerification verification = new JobDetailsVerification();
			verification.setType("HINDCAST");
			verification.setMethod("GAUS");
			verification.addModel("APCC_SCOPS");
			verification.addModel("BOM_ACCESS-S1");
			verification.addModel("CWB_GFST119");
			verification.addModel("KMA_GLOSEA5GC2");
			verification.addVariable("prec");
			verification.addVariable("slp");
			verification.addVariable("sst");
			verification.addVariable("t2m");
			verification.addVariable("t850");
			verification.addVariable("z500");
			verification.setVerification("ROC_Curve");
			verification.setYear("2020");
			verification.setMonth("9");
			client.run(verification, "verification.zip");
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

}