Notes: 1) The position of the buoy was not correctly put into the code. This has been rectified 'TJS Update: Correct position of L4 buoy 'TJS This to Determine when buoy out of position Const lat_base = 50.25 Const lon_base = -4.217 2) The Met Station (which is also used for the GPS position) requires the string which is output from the GMX to be consistent: Line 164 - 195 Function wind_measurement SerialInRecord (COMU7,trame_vent,&H2,0,&H3,nbr_vent,00) SplitStr (trame_vent_split(),trame_vent,",",11,4) wind_speed_digital = trame_vent_split(2) wind_direction_digital = trame_vent_split(3) pressure_digital = trame_vent_split(5)'OU 5 humidity_digital = trame_vent_split(6)'OU 6 temperature_digital = trame_vent_split(7)'OU 7 dew_point = trame_vent_split(8)'OU 8 GPS_pos=trame_vent_split(9)'OU 9 SplitStr (GPS_split(),GPS_pos,":",2,5) Latitude_decimal=FormatFloat (GPS_split(1),"%9.6f") Longitude_decimal=FormatFloat (GPS_split(2),"%9.6f") WS_voltage=trame_vent_split(11)'OU 14 Units wind_speed_digital = m/s Units wind_direction_digital = ° Units pressure_digital = hPa Units humidity_digital = % Units temperature_digital = °c Units WS_voltage = V lat2 = Latitude_decimal * PI / 180 lon2 = Longitude_decimal * PI / 180 lat = lat_base * PI / 180 lon = lon_base * PI / 180 $dlo = (lon2 - lon) / 2 $dla = (lat2 - lat) / 2 tempo1 = (SIN($dla) * SIN($dla)) + COS(lat2) * COS(lat) * (SIN($dlo) * SIN($dlo)) distance = ((2 * ATN2(SQR(tempo1), SQR(1 - tempo1)))*6378)*1000 End Function Without sight of the GMX output string it is difficult to verify if either the string is being parsed correctly or there is a problem with the GMX500 3) The GMX500 is connected to COMU7 Line 1334 SerialOpen (COMU7,19200,0,0,100) 'GMX500 + GPS However there don't appear to be commands to either close or flush the serial ports - which may be good practice. 4) Lines 1299 - 1318 Possible issues with data averaging ingesting corrupted data over the whole 10 minute period Have therefore changed the data interval for Met and GPS to be the preceding 5 minutes DataTable (Meteo_avgd,True,-1 ) ' TJS change the data interval to be for preceding 5 minutes ' DataInterval (0,10,Min,10) DataInterval (5,10,Min,10) Average (1,temperature_digital,FP2,False) Average (1,pressure_digital,FP2,False) Average (1,humidity_digital,FP2,False) WindVector (1,wind_speed_digital,wind_direction_digital,FP2,False,0,0,1) FieldNames ("wind_speed_digital, wind_direction_digital") Average (1,WS_voltage,FP2,False) EndTable DataTable (Position,True,-1 ) ' TJS change the data interval to be for preceding 5 minutes ' DataInterval (0,10,Min,10) DataInterval (5,10,Min,10) Sample (1,Latitude_decimal,FP2) Sample (1,Longitude_decimal,FP2) Sample (1,distance,FP2) EndTable 5) Another option could be to remove data averaging altogether and use the following: DataTable (Meteo_avgd,True,-1 ) DataInterval (5,10,Min,10) Sample (1,temperature_digital,FP2) Sample (1,pressure_digital,FP2) Sample (1,humidity_digital,FP2) Sample (1,wind_speed_digital,FP2) Sample (1,wind_direction_digital,FP2) EndTable