Skip to main content
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: These thresholds are defined in compare_controller.py’s has_discrepancy() function:

What the result shows

A successful comparison returns a structured result rendered on the page:
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.