Skip to content

Climate

Climate time series

Through this API endpoint, you can fetch several climate variables that have been extracted for all brazilian municipalities from the satellite-based reanalysis data provided by Copernicus ERA5. These series are on a daily timescale.

Parameters Table

Input

Parameter name Required Type Description
*page yes int Page to be displayed
*per_page yes int How many items will be displayed per page (up to 100)
start yes str (YYYY-mm-dd) Start date
end yes str (YYYY-mm-dd) End date
geocode no int IBGE's municipality code
uf no str (UF) Two letters brazilian's state abbreviation. E.g: SP

Output (items)

Parameter name Type Description
date date (YYYY-mm-dd) Day of the year
geocodigo int IBGE's municipality code
temp_min float (°C) Minimum daily temperature
temp_med float (°C) Average daily temperature
temp_max float (°C) Maximum daily temperature
precip_min float (mm) Minimum daily precipitation
precip_med float (mm) Average daily precipitation
precip_max float (mm) Maximum daily precipitation
precip_tot float (mm) Total daily precipitation
pressao_min float (atm) Minimum daily sea level pressure
pressao_med float (atm) Average daily sea level pressure
pressao_max float (atm) Maximum daily sea level pressure
umid_min float (%) Minimum daily relative humidity
umid_med float (%) Average daily relative humidity
umid_max float (%) Maximum daily relative humidity

Details

page consists in the total amount of Items returned by the request divided by per_page. The pagination information is returned alongside with the returned request. E.g.:

'pagination': {
    'items': 10,                      # Amout of Items being displayed 
    'total_items': 10,          # Total amount of Items returned in the request
    'page': 1,                         # *request parameter
    'total_pages': 1,            # Total amount of pages returned in the request
    'per_page': 100             # *request parameter
},

Usage examples

import mosqlient

mosqlient.get_climate(
    api_key = api_key,
    start_date = "2022-01-01",
    end_date = "2023-01-01",
    # uf = "RJ",
    geocode = 3304557,
)
library(httr)
library(jsonlite)

climate_api <- "https://api.mosqlimate.org/api/datastore/climate/"
page <- "1"
pagination <- paste0("?page=", page, "&per_page=100&")
filters <- paste0("start=2022-12-30&end=2023-12-30")

headers <- add_headers(
  `X-UID-Key` = API_KEY
)

url <- paste0(climate_api, pagination, filters)
resp <- GET(url, headers=headers)
content <- content(resp, "text")
json_content <- fromJSON(content)

items <- json_content$items
pagination_data <- json_content$pagination
curl -X 'GET' \
  'https://api.mosqlimate.org/api/datastore/climate/?start=2022-12-30&end=2023-12-30&page=1&per_page=100' \
  -H 'accept: application/json' \
  -H 'X-UID-Key: See X-UID-Key documentation'

# Or you can add a geocode to the filters
curl -X 'GET' \
  'https://api.mosqlimate.org/api/datastore/climate/?start=2022-12-30&end=2023-12-30&geocode=3304557&page=1&per_page=100' \
  -H 'accept: application/json' \
  -H 'X-UID-Key: See X-UID-Key documentation'

*The response's pagination contain information about the amount of items returned by the API call. These information can be used to navigate between the queried data by changing the page parameter on the URL. See details