Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cdm_reader_mapper/cdm_mapper/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ def _process_chunk(
logger=logger,
)

table_df.columns = pd.MultiIndex.from_product([[table], table_df.columns])

if is_reader:
table_df.to_csv(
cdm_tables[table]["buffer"],
Expand Down Expand Up @@ -433,6 +431,9 @@ def _finalize_output(cdm_tables, logger):
else:
df = meta.get("df", pd.DataFrame())

df = df.set_index("report_id", drop=False)
df.columns = pd.MultiIndex.from_product([[table], df.columns])

final_tables.append(df)

if not final_tables:
Expand Down
10 changes: 7 additions & 3 deletions cdm_reader_mapper/cdm_mapper/tables/marob/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@
},
"longitude": {
"elements": "GEOGR_LAENGE",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"latitude": {
"elements": "GEOGR_BREITE",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"location_quality": {
Expand All @@ -53,10 +55,14 @@
"station_speed": {
"elements": "FAHRTGESCHWINDIGKEIT",
"transform": "velocity_kn_in_ms",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 2
},
"station_course": {
"elements": "FAHRTRICHTUNG",
"transform": "convert_to_decimal",
"decimal_places": 0
},
"height_of_station_above_local_ground": {
Expand All @@ -65,6 +71,7 @@
},
"height_of_station_above_sea_level": {
"elements": "STATIONSHOEHE_MSL",
"transform": "convert_to_decimal",
"fill_value": 0,
"decimal_places": 1
},
Expand All @@ -82,9 +89,6 @@
"default": 1,
"decimal_places": 0
},
"report_time_quality": {
"default": 2
},
"report_quality": {
"default": 2
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"observation_height_above_station_surface": {
"elements": "SENSORHOEHE_WAS_TT",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"observed_variable": {
Expand All @@ -14,19 +15,20 @@
"observation_value": {
"elements": "LUFTTEMPERATUR",
"transform": "temperature_celsius_to_kelvin",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 2
},
"units": {
"default": 5
},
"quality_flag": {
"default": 2
},
"original_units": {
"default": 60
},
"original_value": {
"elements": "LUFTTEMPERATUR",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"conversion_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"observation_height_above_station_surface": {
"elements": "SENSORHOEHE_WAS_TT",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"observed_variable": {
Expand All @@ -14,19 +15,20 @@
"observation_value": {
"elements": "TAUPUNKTTEMPERATUR",
"transform": "temperature_celsius_to_kelvin",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 2
},
"units": {
"default": 5
},
"quality_flag": {
"default": 2
},
"original_units": {
"default": 60
},
"original_value": {
"elements": "TAUPUNKTTEMPERATUR",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"conversion_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"observation_height_above_station_surface": {
"elements": "BAROMETERHOEHE_MSL",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"observed_variable": {
Expand All @@ -14,19 +15,20 @@
"observation_value": {
"elements": "LUFTDRUCK_STATIONSHOEHE",
"transform": "pressue_hpa_in_pa",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 0
},
"units": {
"default": 32
},
"quality_flag": {
"default": 2
},
"original_units": {
"default": 530
},
"original_value": {
"elements": "LUFTDRUCK_STATIONSHOEHE",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"conversion_method": {
Expand Down
10 changes: 7 additions & 3 deletions cdm_reader_mapper/cdm_mapper/tables/marob/observations-sst.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"observation_height_above_station_surface": {
"elements": "MESSTIEFE",
"transform": "float_opposite",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 1
},
"observed_variable": {
Expand All @@ -15,19 +18,20 @@
"observation_value": {
"elements": "WASSERTEMPERATUR",
"transform": "temperature_celsius_to_kelvin",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 2
},
"units": {
"default": 5
},
"quality_flag": {
"default": 2
},
"original_units": {
"default": 60
},
"original_value": {
"elements": "WASSERTEMPERATUR",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"conversion_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"observation_height_above_station_surface": {
"elements": "SENSORHOEHE_WAS_TT",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"observed_variable": {
Expand All @@ -14,19 +15,20 @@
"observation_value": {
"elements": "FEUCHTTEMPERATUR",
"transform": "temperature_celsius_to_kelvin",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 2
},
"units": {
"default": 5
},
"quality_flag": {
"default": 2
},
"original_units": {
"default": 60
},
"original_value": {
"elements": "FEUCHTTEMPERATUR",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"conversion_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
},
"observation_height_above_station_surface": {
"elements": "SENSORHOEHE_WAS_FF",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"observed_variable": {
"default": 106
},
"observation_value": {
"elements": "WINDRICHTUNG",
"transform": "convert_to_decimal",
"decimal_places": 0
},
"units": {
"default": 320
},
"quality_flag": {
"default": 2
},
"original_units": {
"default": 320
},
"original_value": {
"elements": "WINDRICHTUNG",
"transform": "convert_to_decimal",
"decimal_places": 0
},
"conversion_flag": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"observation_height_above_station_surface": {
"elements": "SENSORHOEHE_WAS_FF",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"observed_variable": {
Expand All @@ -14,20 +15,21 @@
"observation_value": {
"elements": "WINDGESCHWINDIGKEIT",
"transform": "velocity_kmh_in_ms",
"kwargs": {
"convert_to_decimal_float": true
},
"decimal_places": 1
},
"units": {
"default": 731
},
"quality_flag": {
"default": 2
},
"original_precision": {},
"original_units": {
"default": 741
},
"original_value": {
"elements": "WINDGESCHWINDIGKEIT",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"conversion_flag": {
Expand Down
5 changes: 5 additions & 0 deletions cdm_reader_mapper/cdm_mapper/tables/marob/observations.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
},
"longitude": {
"elements": "GEOGR_LAENGE",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"latitude": {
"elements": "GEOGR_BREITE",
"transform": "convert_to_decimal",
"decimal_places": 1
},
"crs": {
Expand All @@ -51,6 +53,9 @@
"spatial_representativeness": {
"default": 3
},
"quality_flag": {
"default": 2
},
"numerical_precision": {},
"sensor_automation_status": {
"elements": "DATENQUELLE_ID",
Expand Down
Loading