MirrorEarth SDK
Python SDK for accessing MirrorEarth Weather API data.
Installation
pip install .
Quick Start
from mirrorearth_sdk import get_meteo_data
import os
from uuid import uuid4
from mirrorearth_sdk import MirrorEarthClient
client = MirrorEarthClient(os.environ["MIRROR_EARTH_API_KEY"])
operation = str(uuid4()) # Persist before sending; reuse after any timeout or 402.
data = client.weather("gfs", latitude=39.9, longitude=116.4,
hourly="temperature_2m", forecast_days=1,
idempotency_key=operation)
print(client.last_receipt) # Exact point units, operation ID and replay marker.
res = get_meteo_data(118, 32, "2025-03-01", "2025-03-15",
hourly=["temperature_2m"], model="era5",
api_key=os.environ["MIRROR_EARTH_API_KEY"])
print("hourly_df: \n", res.hourly_df())
print("daily_df: \n", res.daily_df())
print("monthly_df: \n", res.monthly_df())
>>> output:
hourly_df:
temperature_2m_°C
2025-03-01 00:00:00 14.848
2025-03-01 01:00:00 14.498
2025-03-01 02:00:00 14.348
2025-03-01 03:00:00 13.798
2025-03-01 04:00:00 13.298
... ...
2025-03-15 19:00:00 9.648
2025-03-15 20:00:00 9.148
2025-03-15 21:00:00 8.398
2025-03-15 22:00:00 8.498
2025-03-15 23:00:00 8.398
[360 rows x 1 columns]
daily_df:
temperature_2m_°C
2025-03-01 25.098000
2025-03-02 26.348000
2025-03-03 7.248000
2025-03-04 6.848000
2025-03-05 9.548000
2025-03-06 12.948000
2025-03-07 11.098000
2025-03-08 14.698000
2025-03-09 15.198000
2025-03-10 17.247999
2025-03-11 20.997999
2025-03-12 17.648001
2025-03-13 14.798000
2025-03-14 11.748000
2025-03-15 10.798000
monthly_df:
temperature_2m_mean_°C
2025-03-01 10.287861
气象数据变量表
小时级数据变量
| 变量名 |
中文名称 |
| temperature_2m |
2米气温 |
| weather_code |
天气 |
| dew_point_2m |
2米露点 |
| pressure_msl |
海平面气压 |
| surface_pressure |
表面气压 |
| precipitation |
总降水量 |
| rain |
降雨 |
| showers |
阵雨 |
| snowfall |
降雪量 |
| relative_humidity_2m |
2米相对湿度 |
| apparent_temperature |
体感温度 |
| wind_gusts_10m |
10米阵风 |
| wind_direction_10m |
10米风向 |
| wind_speed_10m |
10米风速 |
| wind_speed_100m |
100米风速 |
| wind_direction_100m |
100米风向 |
| soil_temperature_0_to_7cm |
0至7厘米土壤温度 |
| soil_moisture_0_to_7cm |
0至7厘米土壤湿度 |
| soil_moisture_7_to_28cm |
7至28厘米土壤湿度 |
| soil_temperature_7_to_28cm |
7至28厘米土壤温度 |
| soil_temperature_28_to_100cm |
28至100厘米土壤温度 |
| soil_moisture_28_to_100cm |
28至100迷离土壤湿度 |
| soil_temperature_100_to_255cm |
100至255厘米土壤温度 |
| soil_moisture_100_to_255cm |
100至255厘米土壤湿度 |
| shortwave_radiation |
短波辐射 |
| direct_normal_irradiance |
法向辐射 |
| direct_normal_irradiance_instant |
瞬时法向辐射 |
| direct_radiation |
直接辐射 |
| direct_radiation_instant |
瞬时直接辐射 |
| shortwave_radiation_instant |
瞬时短波辐射 |
| diffuse_radiation |
散射辐射 |
| diffuse_radiation_instant |
瞬时散射辐射 |
| terrestrial_radiation_instant |
瞬时地表辐射 |
| terrestrial_radiation |
地表辐射 |
| global_tilted_irradiance_instant |
瞬时倾斜面辐射 |
| global_tilted_irradiance |
倾斜面辐射 |
| cloud_cover_low |
低层云量 |
| cloud_cover_mid |
中层云量 |
| cloud_cover_high |
高层云量 |
| et0_fao_evapotranspiration |
FAO参考蒸发量 |
| cloud_cover |
总云量 |
| sunshine_duration |
日照时数 |
| is_day |
是否白天 |
| vapour_pressure_deficit |
饱和水汽压 |
日级数据变量
| 变量名 |
中文名称 |
| weather_code |
天气 |
| temperature_2m_mean |
2米平均气温 |
| temperature_2m_min |
2米最低气温 |
| temperature_2m_max |
2米最高气温 |
| apparent_temperature_mean |
平均体感温度 |
| apparent_temperature_min |
体感温度最低值 |
| apparent_temperature_max |
体感温度最高值 |
| rain_sum |
降雨总量 |
| showers_sum |
阵雨总量 |
| precipitation_hours |
降水小时数 |
| snowfall_sum |
降雪总量 |
| precipitation_sum |
降水总量 |
| wind_speed_10m_max |
10米最大风速 |
| wind_speed_10m_mean |
10米平均风速 |
| wind_gusts_10m_max |
10米最大阵风 |
| wind_direction_10m_dominant |
10米主导风向 |
| sunshine_duration |
日照时数 |
| et0_fao_evapotranspiration |
FAO参考蒸发量 |
| daylight_duration |
白昼时长 |
| shortwave_radiation_sum |
短波辐射总量 |
| relative_humidity_2m_max |
2米最大相对湿度 |
| relative_humidity_2m_min |
2米最小相对湿度 |
| relative_humidity_2m_mean |
2米平均相对湿度 |
| pressure_msl_mean |
海平面气压平均值 |
| surface_pressure_mean |
表面气压平均值 |
| dew_point_2m_mean |
2米平均露点温度 |
| vapour_pressure_deficit_mean |
平均饱和水汽压差 |
月级数据变量
| 变量名 |
中文名称 |
| precipitation_sum |
降水总量 |
| precipitation_hours |
降水小时数 |
| sunshine_duration |
日照时数 |
| shortwave_radiation_sum |
短波辐射总量 |
| et0_fao_evapotranspiration |
FAO参考蒸发量 |
| temperature_2m_max |
2米最高气温 |
| temperature_2m_min |
2米最低气温 |
| temperature_2m_mean |
2米平均气温 |
| rain_sum |
降雨总量 |
| snowfall_sum |
降雪总量 |
Unified models and points
Current forecasts use hres, ifs, gfs, cma, icon, gem, ukmo, aifs, graphcast.
HRES is the 9 km reader; IFS is the 25 km reader. All current models except AIFS
belong to tier 199; AIFS belongs to tier 999. Archive tiers are separate in CATALOG.
MeteoFrance/JMA/KMA/BOM forecasts are retired. Existing reader aliases remain input
compatibility only. Site JWTs are not programmatic API credentials.
Queries consume points according to the requested locations, variables, models and time range (at least 1 point). Batch generation uses the server quote:
estimated_bytes / 104857600 points. Use estimate → create with the returned
estimate_id → poll → download. Repeated creation with the same estimate returns
the original task; repeated authorized downloads of the same result are free.
Errors retain idempotency_key and operation_id. After a 402, top up and resend
the original request with the same key. Never retry an unknown outcome with a new key.
Legacy allowance fallback requires explicit accept_points=True after confirmation.
Configure MIRROR_EARTH_API_BASE to use an isolated development gateway.