Develop Your Own Interface for ClimateSERV API

You may also write your own interface to access the API directly in any language you choose. The following should help define everything you will need to do so.

API Methods

All API methods must be called using the following pattern:

{ base api url }/[MethodName]/?param1=value1&param2=value2&...paramN=valueN

Base API URL

The API allows access to the ClimateSERV processing engine and resulting data so that developers can implement their own UI or extract needed data directly from the back-end.

The base URL for all API access is: https://climateserv.servirglobal.net/api/

Call-back Support

All API functions support passing in the parameter:

?callback=callBackFunctionName

The return data/object resulting from the API function call will be wrapped into a JavaScript function as named. For instance, including ?callback=ProcessResults would require you to define a function ProcessResults(returnObject), where returnObject is the object passed back as output from the API.

API Examples

getParameterTypes

Purpose: Get a list of the current supported statistical operation types and their code values.

URL: https://climateserv.servirglobal.net/api/getParameterTypes/

Supported Methods: GET

Returns: Array of supported statistical operation types.


[
  [0, "max", "Max"],
  [1, "min", "Min"],
  [2, "median", "Median"],
  [3, "range", "Range"],
  [4, "sum", "Sum"],
  [5, "avg", "Average"]
]
            

getFeatureLayers

Purpose: Get a list of the current feature layers included in the map for processing.

URL: https://climateserv.servirglobal.net/api/getFeatureLayers/

Supported Methods: GET

Returns: Array of feature layer info, including visibility, display name, and ID.


[
  {"visible": "true", "displayName": "Countries", "id": "country"},
  {"visible": "false", "displayName": "Admin #1", "id": "admin_1_earth"},
  {"visible": "false", "displayName": "Admin #2", "id": "admin_2_af"}
]
            

getClimateScenarioInfo

Purpose: Get information about the data structure of currently supported climate scenario datatypes. At this time there are a total of 10 ‘Climate_Ensembles’. Each ‘Climate_Ensemble’ can have 1, 2, or n ‘Climate_Variables’. The combination of ‘Climate_Ensemble’ and ‘Climate_Variable’ is unique and matches up to an individual dataset. (so 1 list of images per ‘Climate_Ensemble’ + ‘Climate_Variable’ combination.)

URL: https://climateserv.servirglobal.net/api/getClimateScenarioInfo/

Supported Methods: GET

Returns: JSON object.


{
  "unique_id": "87264db4-7297-4b99-aa22-a87fbd0e8a84",
  "RequestName": "getClimateScenarioInfo",
  "climate_DatatypeMap": [
    {
      "climate_Ensemble": "cfsv2_ens18",
      "climate_DataTypes": [
        {
          "dataType_Number": 76,
          "climate_Variable": "air_temperature"
        },
        {
          "dataType_Number": 77,
          "climate_Variable": "precipitation"
        }
      ]
    },
    {
      "climate_Ensemble": "ccsm4_ens01",
      "climate_DataTypes": [
        {
          "dataType_Number": 6,
          "climate_Variable": "air_temperature"
        },
        {
          "dataType_Number": 7,
          "climate_Variable": "precipitation"
        }
      ]
    }
   // Additional climate ensembles and data types...
  ],
  "climate_DataTypeCapabilities": [
    {
      "current_Capabilities": {
        "startDateTime": "2024-08-01",
        "endDateTime": "2025-01-28"
      }
    }
  ],
  "isError": false
}
            

submitDataRequest

Purpose: Submit a new asynchronous processing request to the server.

URL: https://climateserv.servirglobal.net/api/submitDataRequest/

Supported Methods

  • GET
  • POST

Parameters (input)

Due to increased demand in ClimateSERV services, a limit of 20 years of data per request has been implemented.

  • datatype: (int), the unique datatype number for the dataset which this request operates on
  • begintime: (string), start date for processing interval, format ("MM/DD/YYYY")
  • endtime: (string), end date for processing interval, format ("MM/DD/YYYY")
  • intervaltype: (int), enumerated value that represents which type of time interval to process (daily, monthly, etc)
  • operationtype: (int), enumerated value representing the statistical operation to perform on the dataset
  • geometry: (optional, object), the geometry defined by the user on the current client
  • layerid: (optional), the layer ID selected by the user on the current client
  • featureids: (optional), the feature IDs selected by the user on the current client
  • isZip_CurrentDataType: (optional, string), blank defaults to 'False'. Sending anything through equates to 'True'. This lets the server know the job should zip up and return a full dataset.

Returns (output)

string: returns either the job ID (‘uniqueid’) as a UUID or an error message

Output Details

Submit the new data request and receive a job ID as a response. The returned job ID can then be used to retrieve results (see getDataFromRequest).

Warning: Ensure that the polygon and GeoJSON coordinates are in the EPSG:4326 projection.

Example Request

If you are interested in retrieving CHIRPS data for a polygon and a time period, use the following request:

https://climateserv.servirglobal.net/api/submitDataRequest/?datatype=0&begintime=04/01/2018&endtime=04/30/2018&intervaltype=0&operationtype=5&callback=successCallback&dateType_Category=default&isZip_CurrentDataType=false&geometry={"type":"Polygon","coordinates":[[[21.533203124999996,-3.1624555302378496],[21.533203124999996,-6.489983332670647],[26.279296874999986,-5.441022303717986],[26.10351562499999,-2.635788574166625],[21.533203124999996,-3.1624555302378496]]]}
Tip: The above request can be modified to include a GeoJSON with a multi-polygon. Replace the geometry parameter with the respective GeoJSON geometry.

Example Output

    ["7e917e63-600d-4a1e-a069-ab8f73c9fcaf"]
  

getDataRequestProgress

Purpose: Get the current progress the server has made on processing the given request job ID.

URL: https://climateserv.servirglobal.net/api/getDataRequestProgress/

Supported Methods

  • GET

Parameters (input)

  • id: (string/UUID), the unique job ID (UUID format) of the job to check

Returns (output)

Array containing single float: returns the progress value as a float between 0.0 and 100.0 encapsulated in an array. If there is an error, a value of [-1] is returned.

Output Details

Request the server for the progress on processing the current job ID. The server returns a number that can be used to update the client progress bar. Repeat the request periodically to get updated progress.

Example Output

    [27.0]
  

getDataFromRequest

Purpose: Get the data from a job that has completed its processing.

URL: https://climateserv.servirglobal.net/api/getDataFromRequest/

Supported Methods

  • GET

Parameters (input)

  • id: (string/UUID), the unique job ID of the completed job

Returns (output)

object{}: Returns the data generated from the request, typically a list of numbers and dates. See the example below.

Output Details

Ask the server for the data related to a completed job by passing the job ID (UUID string). The response contains a list of data granules, each associated with a date and value.

Example Output

retObj.data                     // (Array[]) list of data granules that the processing job output created.

granule = retObj.data[n]         // (object), single data granule

granule.date                    // (string), readable date for current data granule. Format "d/m/y" (not fixed length)
granule.workid                  // (string), unique ID for the process item (used internally by the server).
granule.epochTime               // (string), Epoch time format for the date.
granule.value                   // (object), the key matches the statistical operation performed, and the value is the result of the operation for that data granule.
  

Example

{
    "data": [
        {
            "date": "1/1/2015",
            "workid": "01f4839f-7b9c-447f-b50f-0ca257c0a339",
            "epochTime": "1420092000",
            "value": {"max": 0.3055223822593689}
        },
        {
            "date": "1/2/2015",
            "workid": "58b6f7ea-5490-4ccd-a715-5e028407ad16",
            "epochTime": "1420178400",
            "value": {"max": 0.15552784502506256}
        },
        {
            // Additional granules can be listed here
            ....,
            ....,
        },
        {
            "date": "1/31/2015",
            "workid": "e021a12c-7346-4b7b-a273-bd39c7fde99b",
            "epochTime": "1422684000",
            "value": {"max": 4.206714630126953}
        }
    ]
}
  

List of Datatypes

Regular Datasets

Dataset Name Datatype Number Availability
UCSB CHIRPS Rainfall 0 Daily 1981 - near present
USGS eMODIS NDVI West Africa 1 Dekadal 2002 - September, 2022
USGS eMODIS NDVI East Africa 2 Dekadal 2002 - September, 2022
USGS eMODIS NDVI Southern Africa 5 Dekadal 2002 - September, 2022
NASA-IMERG-V06-Late 1 Day 26 Daily 2000 - near present
USGS eMODIS NDVI Central Asia 28 Dekadal 2002 - September, 2022
SPoRT Evaporative Stress Index (ESI-4WEEK) 29 Weekly 2000 - Present
UCSB CHIRPS-GEFS 10-day forecast mean anomaly 31 Pentadal 1985 - near present
UCSB CHIRPS-GEFS 10-day forecast mean precip 32 Pentadal 1985 - near present
SPoRT Evaporative Stress Index (ESI-12WEEK) 33 Weekly 2000 - Present
Soil moisture profile - USDA SMAP 37 Every 3 days March 31, 2015 - August 03, 2022
Surface soil moisture - USDA SMAP 38 Every 3 days March 31, 2015 - August 03, 2022
Surface soil moisture anomaly - USDA SMAP 39 Every 3 days March 31, 2015 - August 03, 2022
Sub surface soil moisture - USDA SMAP 40 Every 3 days March 31, 2015 - August 03, 2022
Sub surface soil moisture anomaly - USDA SMAP 41 Every 3 days March 31, 2015 - August 03, 2022
UCSB CHIRP Rainfall 90 Daily 1981 - near present
NASA-IMERG-V06-Early 1 Day 91 Daily 2000 - near present
NASA-IMERG-V07-Late 1 Day 226 Daily 2000 - near present
NASA-IMERG-V07-Early 1 Day 227 Daily 2000 - near present
NSIDC SMAP/Sentinel 1Km 541 Daily 2015 - Near present
NSIDC SMAP/Sentinel 1Km 15 day 542 Twice monthly from Aug. 2032 to present
LIS-modeled Evapotranspiration 661 Daily 2000 - Near-Present
LIS-modeled Baseflow 662 Daily 2000 - Near-Present
LIS-Modeled Runoff 663 Daily 2000 - Near-Present
LIS-Modeled Soil Moisture 0-10cm 664 Daily 2000 - Near-Present
LIS-Modeled Soil Moisture 10-40cm 665 Daily 2000 - Near-Present
LIS-Modeled Soil Moisture 40-100cm 666 Daily 2000 - Near-Present
LIS-Modeled Soil Moisture 100-200cm 667 Daily 2000 - Near-Present

Seasonal Forecast Datasets

The seasonal forecasts are generated from a NMME model ensemble run.

Dataset Name Datatype Number
CCSM Ensemble 1, Temperature 6
CCSM Ensemble 1, Precipitation 7
CCSM Ensemble 2, Temperature 8
CCSM Ensemble 2, Precipitation 9
CCSM Ensemble 3, Temperature 10
CCSM Ensemble 3, Precipitation 11
CCSM Ensemble 4, Temperature 12
CCSM Ensemble 4, Precipitation 13
CCSM Ensemble 5, Temperature 14
CCSM Ensemble 5, Precipitation 15
CCSM Ensemble 6, Temperature 16
CCSM Ensemble 6, Precipitation 17
CCSM Ensemble 7, Temperature 18
CCSM Ensemble 7, Precipitation 19
CCSM Ensemble 8, Temperature 20
CCSM Ensemble 8, Precipitation 21
CCSM Ensemble 9, Temperature 22
CCSM Ensemble 9, Precipitation 23
CCSM Ensemble 10, Temperature 24
CCSM Ensemble 10, Precipitation 25
CFSv2 Ensemble 1, Temperature 42
CFSv2 Ensemble 1, Precipitation 43
CFSv2 Ensemble 2, Temperature 44
CFSv2 Ensemble 2, Precipitation 45
CFSv2 Ensemble 3, Temperature 46
CFSv2 Ensemble 3, Precipitation 47
CFSv2 Ensemble 4, Temperature 48
CFSv2 Ensemble 4, Precipitation 49
CFSv2 Ensemble 5, Temperature 50
CFSv2 Ensemble 5, Precipitation 51
CFSv2 Ensemble 6, Temperature 52
CFSv2 Ensemble 6, Precipitation 53
CFSv2 Ensemble 7, Temperature 54
CFSv2 Ensemble 7, Precipitation 55
CFSv2 Ensemble 8, Temperature 56
CFSv2 Ensemble 8, Precipitation 57
CFSv2 Ensemble 9, Temperature 58
CFSv2 Ensemble 9, Precipitation 59
CFSv2 Ensemble 10, Temperature 60
CFSv2 Ensemble 10, Precipitation 61
CFSv2 Ensemble 11, Temperature 62
CFSv2 Ensemble 11, Precipitation 63
CFSv2 Ensemble 12, Temperature 64
CFSv2 Ensemble 12, Precipitation 65
CFSv2 Ensemble 13, Temperature 66
CFSv2 Ensemble 13, Precipitation 67
CFSv2 Ensemble 14, Temperature 68
CFSv2 Ensemble 14, Precipitation 69
CFSv2 Ensemble 15, Temperature 70
CFSv2 Ensemble 15, Precipitation 71
CFSv2 Ensemble 16, Temperature 72
CFSv2 Ensemble 16, Precipitation 73
CFSv2 Ensemble 17, Temperature 74
CFSv2 Ensemble 17, Precipitation 75
CFSv2 Ensemble 18, Temperature 76
CFSv2 Ensemble 18, Precipitation 77
CFSv2 Ensemble 19, Temperature 78
CFSv2 Ensemble 19, Precipitation 79
CFSv2 Ensemble 20, Temperature 80
CFSv2 Ensemble 20, Precipitation 81
CFSv2 Ensemble 21, Temperature 82
CFSv2 Ensemble 21, Precipitation 83
CFSv2 Ensemble 22, Temperature 84
CFSv2 Ensemble 22, Precipitation 85
CFSv2 Ensemble 23, Temperature 86
CFSv2 Ensemble 23, Precipitation 87
CFSv2 Ensemble 24, Temperature 88
CFSv2 Ensemble 24, Precipitation 89