Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/adrianaarang/climapp/llms.txt

Use this file to discover all available pages before exploring further.

The comparison tool at /comparar lets you validate the accuracy of your manual observations by placing them side-by-side with official AEMET data for the same station. ClimApp fetches live measurements, calculates absolute differences across all weather parameters, and automatically flags the result if any value strays beyond acceptable bounds.

How it works

1

Navigate to /comparar

Open the comparison form using the Comparar link in the navigation bar, or go directly to /comparar.
2

Enter municipality name and date

Type the municipality name exactly as it was used when you logged the manual entry, and select the observation date. The form sends the date in YYYY-MM-DD format; the controller normalises it to DD/MM/YYYY before querying stored records.
3

ClimApp finds your manual record

The backend calls filter_records(municipio=municipio.title(), fecha=fecha_target) and looks for an entry where fuente == "manual". If no match is found, the comparison cannot proceed and an error message is returned.
4

ClimApp fetches live AEMET data

Using the estacion_id from your manual record, ClimApp queries the AEMET observations endpoint via WeatherAPIService._obtener_datos_crudos() and locates the entry whose idema matches the station ID.
5

Differences are calculated and displayed

Each weather parameter is compared using calculate_difference(), which returns the absolute difference rounded to two decimal places. The results are displayed in a summary table alongside a hay_discrepancia flag.

Discrepancy thresholds

A comparison is marked as discrepant (hay_discrepancia: true) if any of the following absolute differences are exceeded:
ParameterThreshold
Temperature> 3 °C
Humidity> 10%
Wind speed> 10 km/h
Rainfall> 5 mm
These thresholds are defined in compare_controller.py’s has_discrepancy() function:
def has_discrepancy(differences: dict) -> bool:
    return (
        differences["temperatura"] > 3 or
        differences["humedad"] > 10 or
        differences["viento"] > 10 or
        differences["lluvia"] > 5
    )

What the result shows

A successful comparison returns a structured result rendered on the page:
FieldDescription
municipioMunicipality name (title-cased)
fechaObservation date in DD/MM/YYYY format
manualThe full manual record retrieved from local JSON storage
apiThe normalised AEMET record for the same station
diferenciasAbsolute differences for temperatura, humedad, viento, and lluvia
hay_discrepanciatrue if any threshold is exceeded; false otherwise
Raw AEMET data is passed through normalizar_datos_aemet() before the comparison is performed. This normalisation step maps AEMET field names and units to ClimApp’s internal schema, ensuring that both records use the same keys and the same units before differences are calculated.
The comparison only succeeds when both of the following conditions are met:
  1. A manual record exists for the specified municipality and date in data/registros_climaticos.json (tagged fuente: "manual").
  2. AEMET has live observation data available today for the station ID stored in that manual record.
If either condition is not met, a descriptive error message is returned and no comparison table is shown. AEMET live data reflects current-day observations only — you cannot use this tool to compare against historical AEMET readings.

Build docs developers (and LLMs) love