def test_attribute_inland(): data = DummyData() data.attributes['LATITUDE'] = -10 data.attributes['LONGITUDE'] = -60 flag = location_at_sea(data, {"file": "~/.cotederc/data/etopo5.cdf"}) assert flag == 4 data.attributes['LATITUDE'] = -10 data.attributes['LONGITUDE'] = 300 flag = location_at_sea(data, {"file": "~/.cotederc/data/etopo5.cdf"}) assert flag == 4
def test_attribute(): data = DummyData() data.attributes['LATITUDE'] = 10 data.attributes['LONGITUDE'] = -30 flag = location_at_sea(data) assert flag == 1 data.attributes['LATITUDE'] = 10 data.attributes['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 notready_test_data(): data = DummyData() data.data['LATITUDE'] = 10 data.data['LONGITUDE'] = -30 flag = location_at_sea(data, {"file": "~/.cotederc/data/etopo5.cdf"}) assert flag == 1 data.data['LATITUDE'] = 10 data.data['LONGITUDE'] = 330 flag = location_at_sea(data, {"file": "~/.cotederc/data/etopo5.cdf"}) assert flag == 1
def test_attribute_inland(): data = DummyData() data.attributes['LATITUDE'] = -10 data.attributes['LONGITUDE'] = -60 flag = location_at_sea(data) assert flag == 3 data.attributes['LATITUDE'] = -10 data.attributes['LONGITUDE'] = 300 flag = location_at_sea(data) assert flag == 3
def test_attribute(): data = DummyData() data.attributes['LATITUDE'] = 10 data.attributes['LONGITUDE'] = -30 flag = location_at_sea(data, {"file": "~/.cotederc/data/etopo5.cdf"}) assert flag == 1 data.attributes['LATITUDE'] = 10 data.attributes['LONGITUDE'] = 330 flag = location_at_sea(data, {"file": "~/.cotederc/data/etopo5.cdf"}) assert flag == 1
def test_nonelocation(): data = DummyData() coords = [[None, 1, 0], [1, None, 0]] for lat, lon, flag in coords: data.attributes['LATITUDE'] = lat data.attributes['LONGITUDE'] = lon assert location_at_sea(data) == flag del (data.attributes['LATITUDE']) data.attributes['LONGITUDE'] = 1 assert location_at_sea(data) == 0 del (data.attributes['LONGITUDE']) data.attributes['LATITUDE'] = 1 assert location_at_sea(data) == 0
def notreadytest_greenwich(): data = DummyData() data.attributes['LATITUDE'] = 0 data.attributes['LONGITUDE'] = 0 flag = location_at_sea(data, {"file": "~/.cotederc/data/etopo5.cdf"}) assert flag == 4
def notreadytest_greenwich(): data = DummyData() data.attributes['LATITUDE'] = 0 data.attributes['LONGITUDE'] = 0 flag = location_at_sea(data) assert flag == 3
def test_badlocation(): data = DummyData() coords = [[91, -30, 0], [-91, -30, 0], [10, -361, 0], [10, 1000, 0]] for lat, lon, flag in coords: data.attributes['LATITUDE'] = lat data.attributes['LONGITUDE'] = lon assert location_at_sea(data) == flag
def test_greenwich(): data = DummyData() coords = [[0, 0, 1], [6, 0, 3], [-10, 0, 1]] for lat, lon, flag in coords: data.attributes['LATITUDE'] = lat data.attributes['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.attributes['LATITUDE'] = lat data.attributes['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.attributes['LATITUDE'] = lat data.attributes['LONGITUDE'] = lon assert location_at_sea(data) == flag