-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweather_data_schemas.py
66 lines (56 loc) · 2.71 KB
/
weather_data_schemas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
""" Schemas, tables names and CSV to schema mapping for
downloaded DWD weather data.
"""
LAST_UPDATE_SCHEM = ('station_obs_id PRIMARY KEY STRING, '
'station_id STRING, '
'temp_c FLOAT, '
'last_update_utc TIMESTAMP')
METEO_TEMPS_SCHEMA = ('station_id STRING, '
'temp_c FLOAT, '
'pressure_hpa FLOAT, '
'relative_hum_pct FLOAT, '
'timestamp_utc FLOAT')
METEO_TEMPS_MAPPING = {'STATIONS_ID': 'station_id',
'MESS_DATUM': 'timestamp_utc',
'TT_10': 'temp_c', # At 2m high.
'PP_10': 'pressure_hpa',
'RF_10': 'relative_hum_pct'}
METEO_SOLAR_SCHEMA = ('station_id STRING, '
'global_rad_10min_jcm2 FLOAT, '
'diffuse_rad_10min_jcm2 FLOAT, '
'back_rad_10min_jcm2 FLOAT, '
'timestamp_utc FLOAT')
METEO_SOLAR_MAPPING = {'STATIONS_ID': 'station_id',
'MESS_DATUM': 'timestamp_utc',
'GS_10': 'global_rad_10min_jcm2',
'DS_10': 'diffuse_rad_10min_jcm2',
'LS_10': 'back_rad_10min_jcm2'}
METEO_WIND_SCHEMA = ('station_id STRING, '
'wind_speed_10min_ms FLOAT, '
'wind_dir_10min_deg FLOAT, '
'timestamp_utc FLOAT')
METEO_WIND_MAPPING = {'STATIONS_ID': 'station_id',
'MESS_DATUM': 'timestamp_utc',
'FF_10': 'wind_speed_10min_ms',
'DD_10': 'wind_dir_10min_deg'}
METEO_PRECIP_SCHEMA = ('station_id STRING, '
'precip_dur_10min_min FLOAT, '
'precip_height_10min_mm FLOAT, '
'timestamp_utc FLOAT')
METEO_PRECIP_MAPPING = {'STATIONS_ID': 'station_id',
'MESS_DATUM': 'timestamp_utc',
'RWS_DAU_10': 'precip_dur_10min_min',
'RWS_IND_10': 'precip_height_10min_mm'}
SCHEMAS = {'temps': {'table_name': 'meteoTemps',
'schema': METEO_TEMPS_SCHEMA,
'mapping': METEO_TEMPS_MAPPING},
'solar': {'table_name': 'meteoSolar',
'schema': METEO_SOLAR_SCHEMA,
'mapping': METEO_SOLAR_MAPPING},
'wind': {'table_name': 'meteoWind',
'schema': METEO_WIND_SCHEMA,
'mapping': METEO_WIND_MAPPING},
'precipitation': {'table_name': 'meteoPrecip',
'schema': METEO_PRECIP_SCHEMA,
'mapping': METEO_PRECIP_MAPPING}
}