Climate Weekly
Climate Weekly time series¶
Precipitation data: known miscalculation in legacy ETL
All precipitation variables (precip_min, precip_med, precip_max, precip_tot) used by this endpoint are affected by an ETL bug — the same described in the Climate endpoint. This directly impacts the precip_tot_sum field in the weekly output.
What was the problem?
The data source is the ERA5-Land reanalysis dataset, whose accumulation convention differs fundamentally from the standard ERA5 convention. In ERA5-Land, accumulations in short forecasts (steps 01 to 24) are accumulated from the beginning of the forecast to the end of the forecast step — i.e., from day=D, time=00:00 up to the step's valid time. At step 24, the timestamp day=D+1, 00:00 represents the total accumulation over the full 24 hours of day D. This means the time-stamped data at 00:00 actually represents the previous day's accumulation. The legacy ingestion pipeline incorrectly aggregated these accumulated variables using the ERA5 convention (where hourly steps represent the hour ending at the timestamp), producing shifted and incorrect daily precipitation totals that propagate into the weekly aggregation. See the ECMWF documentation for technical details.
What was fixed?
As of the latest update, the precipitation values have been recalculated using the correct ERA5-Land accumulation convention.
How to use the corrected data:
The precip_fixed query parameter defaults to true and controls all precip_* fields. When precip_fixed=true (default), the aggregation uses the corrected values. Set precip_fixed=false to retrieve the legacy (miscalculated) values for backward compatibility.
After 2026-08-01, the ingestion pipeline has been fixed. From that date onward, precip_fixed=true and precip_fixed=false return the same correct values — the toggle only affects historical data before the cutoff.
This endpoint is an aggregation of the Climate endpoint by Epiweek.
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 300) |
| start | yes | int (YYYYWW) | Start epiweek |
| end | yes | int (YYYYWW) | End epiweek |
| geocode | no* | int | IBGE's municipality code |
| uf | no* | str (UF) | Two letters brazilian's state abbreviation. E.g: SP |
| macro_health_code | no* | int | 5 digit brazilian's MacroHealth region geocode. |
| precip_fixed | no | bool | Use corrected precipitation values (default: true). See warning above. |
Output (items)¶
| Parameter name | Type | Description |
|---|---|---|
| epiweek | int (YYYYWW) | Epidemiological Week |
| geocodigo | int | IBGE's municipality code |
| temp_min_avg | float (°C) | Average minimum daily temperature |
| temp_med_avg | float (°C) | Average median daily temperature |
| temp_max_avg | float (°C) | Average maximum daily temperature |
| temp_amplit_avg | float (°C) | Average daily amplitude temperature |
| precip_tot_sum | float (mm) | Sum of total daily precipitation |
| umid_min | float (%) | Average minimum daily relative humidity |
| umid_med | float (%) | Average median daily relative humidity |
| umid_max | float (%) | Average maximum daily relative humidity |
Details¶
One of the parameters is required: geocode, uf or macro_health_code
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¶
library(httr)
library(jsonlite)
climate_weekly_api <- "https://api.mosqlimate.org/api/datastore/climate/weekly/"
params <- list(
page = 1,
per_page = 300,
start = YYYYWW,
end = YYYYWW,
geocode = MUNICIPALITY_GEOCODE,
uf = UF,
macro_health_code = MACROHEALTH_CODE
)
headers <- add_headers(
`X-UID-Key` = API_KEY
)
resp <- GET(climate_weekly_api, query = params, headers)
items <- fromJSON(content(resp, "text", encoding = "UTF-8"))
curl -X 'GET' \
'https://api.mosqlimate.org/api/datastore/climate/weekly/?start=YYYYWW&end=YYYYWW&page=1&per_page=300' \
-H 'accept: application/json' \
-H 'X-UID-Key: See X-UID-Key documentation'
# Or you can add a geocode and other filters
curl -X 'GET' \
'https://api.mosqlimate.org/api/datastore/climate/weekly/?start=YYYYWW&end=YYYYWW&geocode=MUNICIPALITY_GEOCODE&uf=UF¯o_health_code=MACROHEALTH_CODE&page=1&per_page=300' \
-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