Skip to content

API Docs

2raymoori edited this page Dec 12, 2025 · 4 revisions

Welcome to the EKAPEx-Demo wiki!

Weather API Documentation

This document provides a detailed reference for the endpoints defined in app/api/routes.py.

TimeRange

Used for specifying a time range for data retrieval.

{
  "baseTime": 1609459200,
  "validTime": [1609459200, 1609462800]
}

Endpoints

1. Compare Temperature

GET /temp_compare/{city_name}/{base_time}

Compares temperature data between GraphCast, Cerrora (prediction), and Ground Truth for a specific city and base time.

Parameters

Name In Type Required Description
city_name Path string Yes Name of the city to compare.
base_time Path integer Yes Base timestamp (Unix epoch).

Responses

Code Description Media Type
200 Successful Response application/json
422 Validation Error application/json

Example Value

{
  "ground_truth": {
    "0": 285.15,
    "1": 286.20
  },
  "cerrora": {
    "0": 284.90,
    "1": 285.50
  },
  "graphcast": {
    "0": 285.00,
    "1": 286.00
  }
}

2. Get Coordinates

GET /get_cordinates/{city_name}

Retrieves coordinate details for a specific city.

Parameters

Name In Type Required Description
city_name Path string Yes Name of the city.

Responses

Code Description Media Type
200 Successful Response application/json
422 Validation Error application/json

Example Value

{
  "latitude": "48.86129",
  "longitude": "2.34049",
  "France": {
    "minlat": 47.2701114,
    "minlon": 5.8663153,
    "maxlat": 55.099161,
    "maxlon": 15.0419309
  }
}

7. Get Temperature & Wind Data

POST /data/temp_wind/{model_type}

Generates or retrieves temperature and wind visualization data.

Parameters

Name In Type Required Description
model_type Path string Yes Model type to use.

Request Body

Type Required Description
TimeRange Yes Time range for data retrieval.

Schema:

{
  "baseTime": 0,
  "validTime": [0]
}

Responses

Code Description Media Type
200 Successful Response application/json

Example Value

{
  "images": [
    {
      "timestamp": "1609459200_1609462800",
      "url": "http://api.url/path/to/image.webp"
    }
  ]
}

8. Get Geopotential Data

POST /data/geo/{model_type}

Generates or retrieves geopotential visualization data.

Parameters

Name In Type Required Description
model_type Path string Yes Model type to use.

Request Body

Type Required Description
TimeRange Yes Time range for data retrieval.

Responses

Code Description Media Type
200 Successful Response application/json

Example Value

{
  "images": [
    {
      "timestamp": "1609459200_1609462800",
      "url": "http://api.url/path/to/image.webp"
    }
  ]
}

9. Get Rain Data

POST /data/rain

Generates or retrieves precipitation (rain) visualization data using the active model.

Parameters

No path parameters

Request Body

Type Required Description
TimeRange Yes Time range for data retrieval.

Responses

Code Description Media Type
200 Successful Response application/json
500 Internal Server Error application/json

Example Value

{
  "images": [
    {
      "timestamp": "1609459200_1609462800",
      "url": "http://api.url/path/to/image.webp"
    }
  ]
}

10. Get Sea Level Pressure Data

POST /data/sea_level/{model_type}

Generates or retrieves mean sea level pressure visualization data.

Parameters

Name In Type Required Description
model_type Path string Yes Model type to use.

Request Body

Type Required Description
TimeRange Yes Time range for data retrieval.

Responses

Code Description Media Type
200 Successful Response application/json

Example Value

{
  "images": [
    {
      "timestamp": "1609459200_1609462800",
      "url": "http://api.url/path/to/image.webp"
    }
  ]
}

11. Get Base Times

GET /base-times/{model_type}

Retrieves available base times for a specific model and variable.

Parameters

Name In Type Required Description
model_type Path string Yes Model to query.
variableType Query string No Variable type (e.g., temp_wind).
queryTime Query string No Specific time to query.

Responses

Code Description Media Type
200 Successful Response application/json
400 Bad Request application/json
500 Internal Server Error application/json

Example Value

[
  {
    "label": "Fri 01 Jan 2021 00 UTC",
    "value": "1609459200"
  },
  {
    "label": "Fri 01 Jan 2021 12 UTC",
    "value": "1609502400"
  }
]

12. Get Valid Times

GET /valid-times/{model_type}

Retrieves available valid times for predictions.

Parameters

Name In Type Required Description
model_type Path string Yes Model to query.
variableType Query string No Variable type.
queryTime Query string No Specific time to query.

Responses

Code Description Media Type
200 Successful Response application/json

Example Value

[
  {
    "label": "Fri 01 Jan 2021 06 UTC",
    "value": "1609480800"
  }
]

Clone this wiki locally