Skip to content

Commit

Permalink
Raise NotImplemented exception if SWAN test file with ITER keyword is…
Browse files Browse the repository at this point in the history
… read
  • Loading branch information
Bas Hoonhout committed Feb 7, 2018
1 parent 0243dbc commit c58009c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Improvements
conversion is disabled if `pyproj` is not installed. Instead a
warning is given in that situation.

* Raise NotImplemented exception if SWAN test file with ITER keyword
is read.

New functions/methods
^^^^^^^^^^^^^^^^^^^^^

Expand Down
10 changes: 10 additions & 0 deletions oceanwaves/swan.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ def readfile(self, fpath):
self.parse_comments()
elif line.startswith('SWAN'):
self.parse_version()
elif line.startswith('ITER'):
self.parse_iter()
elif line.startswith('TIME'):
self.parse_time()
elif line.startswith('LOCATIONS'):
Expand Down Expand Up @@ -417,6 +419,14 @@ def parse_version(self):
self.version = version


def parse_iter(self):
raise NotImplementedError(
'Reading of SWAN test files containing the ITER keyword are not yet '
'supported. Please contribute to the oceanwaves toolbox by providing an '
'exhaustive data format description or working implementation.'
)


def parse_time(self):
m = re.match('\s*([^\s]+)', self.lines[1])
if m:
Expand Down

0 comments on commit c58009c

Please sign in to comment.