feat: in OBSVER1, sanitize d1, d2, latitude and longitude values to null where appropriate

This commit is contained in:
Paul Bienkowski 2020-11-21 13:48:22 +01:00
parent 0c3cf9263d
commit 7aa6e0be84

View file

@ -153,6 +153,21 @@ function* parseObsver1(body) {
continue; continue;
} }
if (!record.latitude && !record.longitude) {
// invalid record, make sure lat/lng say `null` instead of `0`
record.latitude = null
record.longitude = null
}
// in old format, 255 or 999 means "no measurement"
if (record.d1 === 255 || record.d1 === 999) {
record.d1 = null
}
if (record.d2 === 255 || record.d2 === 999) {
record.d2 = null
}
yield record; yield record;
} }
} }