@@ -26,8 +26,6 @@ class GPS2JMParser7_5(GPSHarmonizationMixin, Parser):
2626 """
2727
2828 DATATYPE = "gps_2jm"
29- # TODO: define fields
30- FIELDS = [str (x ) for x in range (0 , 13 )]
3129 VERSION = "v7.5"
3230 SEPARATOR = " "
3331 ENDINGS = [
@@ -55,14 +53,14 @@ class GPS2JMParser7_5(GPSHarmonizationMixin, Parser):
5553 GPSHarmonizedColumn .TIMESTAMP : None ,
5654 GPSHarmonizedColumn .LATITUDE : None ,
5755 GPSHarmonizedColumn .LONGITUDE : None ,
58- GPSHarmonizedColumn .ALTITUDE : None ,
59- GPSHarmonizedColumn .SPEED_KM_H : None ,
56+ GPSHarmonizedColumn .ALTITUDE : "altitude" ,
57+ GPSHarmonizedColumn .SPEED_KM_H : "speed" ,
6058 GPSHarmonizedColumn .TYPE : None ,
61- GPSHarmonizedColumn .DISTANCE : None ,
59+ GPSHarmonizedColumn .DISTANCE : "distance" ,
6260 GPSHarmonizedColumn .COURSE : None ,
6361 GPSHarmonizedColumn .HDOP : None ,
6462 GPSHarmonizedColumn .PDOP : None ,
65- GPSHarmonizedColumn .SATELLITES_COUNT : None ,
63+ GPSHarmonizedColumn .SATELLITES_COUNT : "satellite" ,
6664 GPSHarmonizedColumn .TEMPERATURE : None ,
6765 GPSHarmonizedColumn .SOLAR_I_MA : None ,
6866 GPSHarmonizedColumn .BAT_SOC_PCT : None ,
@@ -71,56 +69,49 @@ class GPS2JMParser7_5(GPSHarmonizationMixin, Parser):
7169 }
7270
7371 def harmonize_data (self , data ):
74- # Combine start date with time from each row
75- # start_date is in format DD.MM.YYYY, time is HH:MM:SS
76- # Call parent harmonization first
77- data = super ().harmonize_data (data )
72+ # Call parent harmonization — applies MAPPINGS, enforces GPS schema,
73+ # creates geometry, and drops raw source columns
74+ result = super ().harmonize_data (data )
7875
7976 # Convert coordinates from degrees + decimal minutes to decimal degrees
77+ # before calling super(), so the harmonized lat/lon are in decimal degrees.
8078 # Latitude: degrees + (minutes / 60), with direction sign
8179 lat_decimal_degrees = (
82- data ["__original__latitude" ].astype (int )
83- + data ["__original__latitude_decimal" ].astype (float ) / 60
80+ data ["latitude" ].astype (int ) + data ["latitude_decimal" ].astype (float ) / 60
8481 )
85- data ["latitude" ] = [
82+ result ["latitude" ] = [
8683 signed (lat , direction )
87- for lat , direction in zip (
88- lat_decimal_degrees , data ["__original__n" ], strict = False
89- )
84+ for lat , direction in zip (lat_decimal_degrees , data ["n" ], strict = False )
9085 ]
9186
9287 # Longitude: degrees + (minutes / 60), with direction sign
9388 lon_decimal_degrees = (
94- data ["__original__longitude" ].astype (int )
95- + data ["__original__longitude_decimal" ].astype (float ) / 60
89+ data ["longitude" ].astype (int ) + data ["longitude_decimal" ].astype (float ) / 60
9690 )
97- data ["longitude" ] = [
91+ result ["longitude" ] = [
9892 signed (lon , direction )
99- for lon , direction in zip (
100- lon_decimal_degrees , data ["__original__e" ], strict = False
101- )
93+ for lon , direction in zip (lon_decimal_degrees , data ["e" ], strict = False )
10294 ]
10395
104- # Then create the timestamp column after original columns are prefixed
96+ # Build timestamp column before calling super()
10597 if hasattr (self , "start_date" ) and self .start_date :
106- # time column is now __original__time
107- data ["timestamp" ] = pd .to_datetime (
108- self .start_date + " " + data ["__original__time" ],
98+ result ["timestamp" ] = pd .to_datetime (
99+ self .start_date + " " + data ["time" ],
109100 format = "%d.%m.%Y %H:%M:%S" ,
110- errors = "raise " ,
101+ errors = "coerce " ,
111102 )
112103 else :
113104 # Fallback if start_date not available
114- data ["timestamp" ] = pd .to_datetime (
115- data ["__original__date " ].astype (str ) + " " + data ["__original__time " ],
105+ result ["timestamp" ] = pd .to_datetime (
106+ data ["date " ].astype (str ) + " " + data ["time " ],
116107 format = "%d %H:%M:%S" ,
117- errors = "raise " ,
108+ errors = "coerce " ,
118109 )
119110
120111 # Recreate geometry column now that lat/lon are finalized
121- data = self ._create_geometry_column (data )
112+ result = self ._create_geometry_column (result )
122113
123- return data
114+ return result
124115
125116 def _fix_content (self , data ):
126117 return data
@@ -284,17 +275,18 @@ class GPS2JMParser8Alternative(GPSHarmonizationMixin, Parser):
284275 }
285276
286277 def harmonize_data (self , data ):
287- # Combine UTC_date and UTC_time columns into timestamp
288- # Call parent harmonization first
289- data = super ().harmonize_data (data )
290278
291- # Then create timestamp from the prefixed original columns
292- data ["timestamp" ] = pd .to_datetime (
293- data ["__original__UTC_date" ] + " " + data ["__original__UTC_time" ],
279+ # Call parent harmonization — applies MAPPINGS, enforces GPS schema,
280+ # creates geometry, and drops raw source columns
281+ result = super ().harmonize_data (data )
282+
283+ # Build timestamp from raw UTC_date and UTC_time columns
284+ result ["timestamp" ] = pd .to_datetime (
285+ data ["UTC_date" ] + " " + data ["UTC_time" ],
294286 format = "%d.%m.%Y %H:%M:%S" ,
295287 errors = "raise" ,
296288 )
297- return data
289+ return result
298290
299291 def _fix_content (self , data : str ):
300292 """
0 commit comments