Skip to content

Commit

Permalink
Merge pull request #84 from CardiacModelling/tweaks_to_message
Browse files Browse the repository at this point in the history
Tweaks to message v2
  • Loading branch information
MichaelClerx authored Oct 9, 2024
2 parents be00788 + 2950e9d commit 7b511bb
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 112 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Congratulations!
You landed at an altitude of 1309m.
https://opentopomap.org/#marker=15/57.07019/-3.669487
You are 31m from the nearest named hill top, "Ben Macdui",
ranked the 2d heighest in GB.
ranked the 2nd highest in GB.
http://hillsummits.org.uk/htm_summit/518.htm
```

Expand Down
60 changes: 27 additions & 33 deletions examples/fitting-with-nlopt.ipynb

Large diffs are not rendered by default.

86 changes: 39 additions & 47 deletions examples/fitting-with-pints.ipynb

Large diffs are not rendered by default.

42 changes: 18 additions & 24 deletions examples/fitting-with-scipy.ipynb

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions nevis/_bng.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def by_name(name):
@staticmethod
def by_rank(rank):
"""
Return the hill with the given ``rank`` (rank 1 is heighest, then 2,
Return the hill with the given ``rank`` (rank 1 is highest, then 2,
etc.).
"""
if not Hill._hills:
Expand Down Expand Up @@ -428,11 +428,9 @@ def rank(self):

@property
def ranked(self):
s = str(self._rank)
if s[-1] in '123':
if not (self._rank > 10 and s[-2] == '1'):
return s + 'st' if s[-1] == '1' else s + 'd'
return s + 'th'
n = self._rank
return str(n) + {1: 'st', 2: 'nd', 3: 'rd'}.get(
4 if 10 <= n % 100 < 20 else n % 10, 'th')

@property
def summit(self):
Expand Down
2 changes: 1 addition & 1 deletion nevis/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def print_result(x, y, z):
else f'{round(distance / 1000, 1)}km'
)
print(f'You are {dm} from the nearest named hill top, "{hill.name}",')
print(f' ranked the {hill.ranked} heighest in GB.')
print(f' ranked the {hill.ranked} highest in GB.')
photo = hill.photo()
if photo:
print(' ' + photo)
Expand Down

0 comments on commit 7b511bb

Please sign in to comment.