def test_data(): data = DummyData() data.data["LATITUDE"] = 10 data.data["LONGITUDE"] = -30 flag = location_at_sea(data) assert flag == 1 data.data["LATITUDE"] = 10 data.data["LONGITUDE"] = 330 flag = location_at_sea(data) assert flag == 1
def notready_test_data(): data = DummyData() data.data['LATITUDE'] = 10 data.data['LONGITUDE'] = -30 flag = location_at_sea(data) assert flag == 1 data.data['LATITUDE'] = 10 data.data['LONGITUDE'] = 330 flag = location_at_sea(data) assert flag == 1
def test_nonelocation(): data = DummyData() coords = [[None, 1, 0], [1, None, 0]] for lat, lon, flag in coords: data.attrs["LATITUDE"] = lat data.attrs["LONGITUDE"] = lon assert location_at_sea(data) == flag del data.attrs["LATITUDE"] data.attrs["LONGITUDE"] = 1 assert location_at_sea(data) == 0 del data.attrs["LONGITUDE"] data.attrs["LATITUDE"] = 1 assert location_at_sea(data) == 0
def test_badlocation(): data = DummyData() coords = [[91, -30, 3], [-91, -30, 3], [10, -361, 3], [10, 1000, 3]] for lat, lon, flag in coords: data.attrs["LATITUDE"] = lat data.attrs["LONGITUDE"] = lon assert location_at_sea(data) == flag
def test_attribute_inland(): data = DummyData() coords = [[-10, -60, 3], [-10, 300, 3]] for lat, lon, flag in coords: data.attrs["LATITUDE"] = lat data.attrs["LONGITUDE"] = lon assert location_at_sea(data) == flag
def test_attribute(): data = DummyData() coords = [[10, -30, 1], [10, 330, 1]] for lat, lon, flag in coords: data.attrs["LATITUDE"] = lat data.attrs["LONGITUDE"] = lon assert location_at_sea(data) == flag