Skip to content

Commit

Permalink
Discard also records without lat or lon
Browse files Browse the repository at this point in the history
  • Loading branch information
rdgfuentes committed Aug 7, 2024
1 parent 4e46b72 commit c2313fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ def test_convert_speed_kph_to_kt(self):
"received_at": None,
"ssvid": "1",
},
{
"timestamp": datetime.strptime(
"2024-01-01T00:05:00", "%Y-%m-%dT%H:%M:%S"
),
"shipname": "SANTA MARIA",
"received_at": None,
"ssvid": "1",
},
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,13 @@ def expand(self, pcoll):
def discard_zero_lat_lon(self):
return Filter(
lambda x: not (
(
"lat" in x
and "lon" in x
and x.get("lat") == 0
and x.get("lon") == 0
or x.get("lat") is None
or x.get("lon") is None
)
or (
"LATITUDE" in x
and "LONGITUDE" in x
and x.get("LATITUDE") == 0
and x.get("LONGITUDE") == 0
or x.get("LATITUDE") is None
or x.get("LONGITUDE") is None
)
# exclude when lat, lon is 0, 0
x.get("lat") == 0
and x.get("lon") == 0
# exclude also if lat or lon is missing
or x.get("lat") is None
or x.get("lon") is None
)
# include only records that have lat and lon fields
and ("lat" in x and "lon" in x)
)

0 comments on commit c2313fd

Please sign in to comment.