Skip to content

Commit

Permalink
Merge pull request #65 from ocefpaf/AWC
Browse files Browse the repository at this point in the history
Fixes #63
  • Loading branch information
lukecampbell authored Aug 26, 2016
2 parents b7bb378 + a73eda5 commit f960594
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions pyoos/collectors/awc/awc_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
class AwcRest(Collector):
def __init__(self, **kwargs):
super(AwcRest, self).__init__()
self.stations_url = 'http://weather.noaa.gov/data/nsd_cccc.txt'
self.stations_url = 'https://www.aviationweather.gov/docs/metar/stations.txt'
self.data_url = 'http://www.aviationweather.gov/adds/dataserver_current/httpparam'

def get_stations(self):
if self._features is None:
r = requests.get(self.stations_url)
self._stations = [line.split(';')[0] for line in r.text.split('\n')]
if self._stations[-1] == '':
self._stations.pop()
# Arghhhh Fortran-like fixed format!!!
_stations = [line[20:24] for line in r.text.split('\n')
if len(line) == 83 and not line.startswith('!')]
self._stations = sorted(filter(lambda code: code.strip(), _stations))
self._features = self._stations
return self._features

Expand Down
6 changes: 2 additions & 4 deletions tests/collectors/test_awc_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ class AwcRestTest(unittest.TestCase):
def setUp(self):
self.c = AwcRest()

@pytest.mark.xfail
def test_nwc_stations(self):
# See https://github.com/ioos/pyoos/issues/63
stations = self.c.stations
assert stations[0] == 'AGGH'
assert stations[-1] == 'ZYTX'
assert stations[0] == 'AAAD'
assert stations[-1] == 'ZYYY'

def test_bbox_filter_raw(self):
self.c.filter(bbox=(-80, 30, -60, 50))
Expand Down

0 comments on commit f960594

Please sign in to comment.