Working with Series¶
A Raster Series List is a collection of Raster Series Instance and is represented by the endpoint:
http://api.cal-adapt.org/api/series/<slug>/
Slug¶
A slug is a URL friendly name of a resource in the API. Each climate dataset or resource has it’s own unique slug. A resource slug is generally composed of {variable}_{period}_{model}_{scenario}
.
http://api.cal-adapt.org/api/series/tasmax_year_CNRM-CM5_rcp45/
Filtering Series¶
The series endpoint supports searching by name
.
http://api.cal-adapt.org/api/series/?name=yearly+average+maximum+temperature
Or by slug
.
http://api.cal-adapt.org/api/series/?slug=tasmax_year_CCSM4
Get Time Slices¶
The complete timeseries can be retrieved by adding rasters/
to the URL.
http://api.cal-adapt.org/api/series/tasmax_year_CNRM-CM5_rcp45/rasters/
A time slice can be retrieved by adding start and end dates to the URL.
http://api.cal-adapt.org/api/series/tasmax_year_CNRM-CM5_rcp45/2030-01-01/2040-01-01/
Get Data for a Location¶
The following example shows an example of requesting timeseries data for a location. The response consists of count
(number of records), next
(link to next page, see Pagination), results
(array of JSON objects for each timestep). Among other fields each timestep contains fields image
(data value), event
(date), and units
(units of data value).
-
GET
http://api.cal-adapt.org/api/series/tasmax_year_CNRM-CM5_rcp45/rasters/?g=POINT(-121.46+38.58)
¶ Data for annual averages of Maximum Temperature projections at location (longitude -121.46, latitude 38.58) for CNRM-CM5 model and RCP 4.5 scenario.
Example request:
GET /api/tasmax_year_CNRM-CM5_rcp45/ Host: api.cal-adapt.org Accept: application/json
Example response:
HTTP 200 OK Allow: GET, POST, OPTIONS Content-Type: application/json Vary: Accept { "count": 95, "next": "http://api.cal-adapt.org/api/series/tasmax_year_CNRM-CM5_rcp45/rasters/?g=POINT%28-121.46+38.58%29&page=2", "previous": null, "results": [ { "id": 10521, "tileurl": "http://api.cal-adapt.org/tiles/tasmax_year_CNRM-CM5_rcp45_2006/{z}/{x}/{y}.png", "url": "http://api.cal-adapt.org/api/rstores/tasmax_year_CNRM-CM5_rcp45_2006/", "image": 297.9866027832031, "width": 179, "height": 195, "geom": "POLYGON ((-124.5625 31.5625, -113.375 31.5625, -113.375 43.75, -124.5625 43.75, -124.5625 31.5625))", "event": "2006-01-01", "srs": "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]", "minval": 279.1251220703125, "maxval": 307.180908203125, "nodata": 1.0000000150474662e+30, "xpixsize": 0.0625, "ypixsize": -0.0625, "name": "yearly average maximum temperature CNRM-CM5 RCP 4.5", "slug": "tasmax_year_CNRM-CM5_rcp45_2006", "units": "K" }, { "id": 10522, "tileurl": "http://api.cal-adapt.org/tiles/tasmax_year_CNRM-CM5_rcp45_2007/{z}/{x}/{y}.png", "url": "http://api.cal-adapt.org/api/rstores/tasmax_year_CNRM-CM5_rcp45_2007/", "image": 297.7721862792969, "width": 179, "height": 195, "geom": "POLYGON ((-124.5625 31.5625, -113.375 31.5625, -113.375 43.75, -124.5625 43.75, -124.5625 31.5625))", "event": "2007-01-01", "srs": "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]", "minval": 278.38330078125, "maxval": 307.52490234375, "nodata": 1.0000000150474662e+30, "xpixsize": 0.0625, "ypixsize": -0.0625, "name": "yearly average maximum temperature CNRM-CM5 RCP 4.5", "slug": "tasmax_year_CNRM-CM5_rcp45_2007", "units": "K" }, ... ] }
Query Parameters: - g – a geometry (point, line, polygon) as GeoJSON or WKT
- pagesize – number of records, default is 10
- format – one of
json
,csv
,tif.zip
,img.zip
- stat – one of
mean
,max
,min
,count
,median
,std
,var
for spatial aggregation by polygon/line geometry. - periods – number of periods to resample to, i.e. from annual to decadal
Request Headers: - Accept – the response content type depends on Accept header
Response Headers: - Content-Type – this depends on Accept header of request
Status Codes: - 200 OK – no error
- 400 Bad Request – something is askew with the request, check the error message
- 404 Not Found – the slug may be incorrect
- 500 Internal Server Error – something’s wrong on our end