energy_data_retrieval.sources.aemet.client#
AEMET station, daily-climate and rolling recent-observation acquisition.
The authenticated API returns short-lived links to data and field metadata.
Both documents are preserved as canonical JSON. Climatological dates retain
their source meaning; only recent fint labels explicitly described as UTC
in the returned metadata become UTC timestamps.
- energy_data_retrieval.sources.aemet.client.daily_chunks(start, end, *, maximum_days=3660, chunk_days=31)[source]#
Yield bounded inclusive daily requests without collecting a whole history.
- Parameters:
start (date)
end (date)
maximum_days (int)
chunk_days (int)
- Return type:
Iterator[tuple[date, date]]
- energy_data_retrieval.sources.aemet.client.normalize_stations(payload, metadata, *, bbox=None, maximum_rows=100000)[source]#
Keep native catalogue fields and decode explicit DMS coordinate strings.
- Parameters:
payload (JSONValue)
metadata (dict[str, JSONValue])
bbox (BBox | None)
maximum_rows (int)
- Return type:
DataFrame
- energy_data_retrieval.sources.aemet.client.normalize_daily(payload, metadata, station, start, end, *, maximum_rows=100000)[source]#
Retain climatological date labels and per-variable period semantics.
- Parameters:
payload (JSONValue)
metadata (dict[str, JSONValue])
station (str)
start (date)
end (date)
maximum_rows (int)
- Return type:
DataFrame
- energy_data_retrieval.sources.aemet.client.normalize_recent(payload, metadata, station, *, maximum_rows=100000)[source]#
Keep the API’s rolling observations and original variable averaging periods.
- Parameters:
payload (JSONValue)
metadata (dict[str, JSONValue])
station (str)
maximum_rows (int)
- Return type:
DataFrame
- class energy_data_retrieval.sources.aemet.client.AEMETDataset(product: 'Product', station: 'str | None', start: 'date | None', end: 'date | None', bbox: 'BBox | None', maximum_rows: 'int', frame: 'pd.DataFrame', payload: 'JSONValue', metadata: 'dict[str, JSONValue]', envelope: 'dict[str, JSONValue]', requests: 'tuple[RequestRecord, ...]')[source]#
Bases:
object- Parameters:
product (Product)
station (str | None)
start (date | None)
end (date | None)
bbox (BBox | None)
maximum_rows (int)
frame (DataFrame)
payload (JSONValue)
metadata (dict[str, JSONValue])
envelope (dict[str, JSONValue])
requests (tuple[RequestRecord, ...])
- product: Product#
- station: str | None#
- start: date | None#
- end: date | None#
- bbox: BBox | None#
- maximum_rows: int#
- frame: DataFrame#
- payload: JSONValue#
- metadata: dict[str, JSONValue]#
- envelope: dict[str, JSONValue]#
- requests: tuple[RequestRecord, ...]#
- energy_data_retrieval.sources.aemet.client.save_dataset(result, output)[source]#
Publish a verified normalized frame and all three canonical source documents.
- Parameters:
result (AEMETDataset)
output (Path)
- Return type:
- class energy_data_retrieval.sources.aemet.client.AEMETClient(http, api_key=None, maximum_rows=100000, maximum_days=3660)[source]#
Bases:
objectBounded authenticated queries followed by public temporary JSON downloads.
- Parameters:
http (HTTPClient)
api_key (str | None)
maximum_rows (int)
maximum_days (int)
- http: HTTPClient#
- api_key: str | None#
- maximum_rows: int#
- maximum_days: int#
- classmethod from_environment(http, *, maximum_rows=100000, maximum_days=3660)[source]#
- Parameters:
http (HTTPClient)
maximum_rows (int)
maximum_days (int)
- Return type:
- retrieve_stations(output, *, bbox=None)[source]#
- Parameters:
output (Path)
bbox (BBox | None)
- Return type: