https://github.com/cardiacmodelling/bennevis

"Where is Ben Nevis" presents the landscape of Great Britain as a testbed for optimisation and sampling methods.

https://github.com/cardiacmodelling/bennevis

Science Score: 39.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.2%) to scientific vocabulary

Keywords

numerical-optimization
Last synced: 5 months ago · JSON representation

Repository

"Where is Ben Nevis" presents the landscape of Great Britain as a testbed for optimisation and sampling methods.

Basic Info
  • Host: GitHub
  • Owner: CardiacModelling
  • License: other
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 16.5 MB
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 1
  • Open Issues: 5
  • Releases: 1
Topics
numerical-optimization
Created over 4 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License

README.md

Documentation Status

Where is Ben Nevis?

"Where is Ben Nevis" is a fun(?) project which presents the landscape of Great Britain (GB) as a testbed for numerical optimisation and sampling methods. Its main component is a Python module called nevis which can download height data from the Ordnance Survey, process it to make it more suitable for optimisation, and provide interpolating functions so that it can be treated as a continuous (but not smooth) real-valued function.

Installation

Python 3.6 or newer is required.

To install from the Python Package Index (PyPI), use: pip install nevis

Recommended: To install the optional convertbng module at the same time, use: pip install nevis[extras] This will make conversion from points in the data set to longitude and lattitude faster and more accurate.

Developers may wish to skip PyPI installation, clone the GitHub repository, and install from there instead. Instructions for this are provided in CONTRIBUTING.md.

After installing the module, the "OS Terrain 50" data set needs to be downloaded from from the Ordnance Survey website (see the "Data set" section below). This can be achieved using: import nevis nevis.download_os_terrain_50() By default, the heights data is installed into ~/nevis-data. For example /home/michael/nevis-data on a Linux system or C:\Users\michael\nevis-data on Windows. This installation path can be changed by specifying an alternative directory in the environment variable NEVIS_PATH before running download_os_terrain_50().

Note that OS Terrain 50 is not part of nevis or "Where is Ben Nevis" and comes with its own license. See LICENSE.md for details.

To check that the installation was succesfull, you can plot a height map of GB:

```

Import nevis

import nevis

Download the data (you can skip this step after the first run!)

nevis.downloadosterrain_50()

Create and store a figure

nevis.writetestfigure('gb-small.png') ```

This should create a file (in your working directory) called gb-small.png:

Downscaled map of GB

Usage

Detailed usage examples are provided in the examples directory.

For example, the below optimisation uses PINTS: ```

            |>          

Starting Ben | Nevis
/ \ Local /\/---\ 0.0.4 /--- \/\
/\/ /\ / \
/\/ \ / _/ \
/ \/ \
Minimising error measure Using Covariance Matrix Adaptation Evolution Strategy (CMA-ES) Running in sequential mode. Population size: 100 Iter. Eval. Best Current Time m:s 0 100 -424.4599 -424.4599 0:00.1 1 200 -609.9036 -609.9036 0:00.1 2 300 -609.9036 -555.6289 0:00.2 3 400 -759.5307 -759.5307 0:00.2 20 2100 -951.8221 -740.9721 0:00.4 40 4100 -1268.672 -1257.865 0:00.7 60 6100 -1308.976 -1308.976 0:01.0 80 8100 -1309.1 -1309.1 0:01.3 100 10100 -1309.1 -1309.1 0:01.6 120 12100 -1309.1 -1309.1 0:01.9 140 14100 -1309.1 -1309.1 0:02.1 160 16100 -1309.1 -1309.1 0:02.2 168 16800 -1309.1 -1309.1 0:02.3 Halting: No significant change for 100 iterations.

Saving figure to results/local-map-full.png. Saving figure to results/local-map-zoom.png. Saving figure to results/local-line-plot.png.

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 2nd highest in GB. http://hillsummits.org.uk/htm_summit/518.htm ```

API Documentation

Full API documentation is provided at https://nevis.readthedocs.io.

Data set

Height information is from the OS Terrain 50 data set made available by the UK's Ordnance Survey.

The data is divided into squares indicated with a two letter code, and several data files per square. Each data file, however, contains its absolute "eastings" and "northings" and so we can ignore the letter codes. Eastings and northings are defined by the "National Grid", or OSGB36. In easier terms, they are x and y coordinates, in meters, relative to the bottom-left point of the grid (which is the bottom left of the square "SV", which contains the Isles of Scilly).

As an example, the header from the NN17 file is:

ncols 200 nrows 200 xllcorner 210000 yllcorner 770000 cellsize 50

Here ncols and nrows indicate the number of grid points in the file, the Lower Left corner of the data in the file is given by xllcorner and yllcorner, and the distance between any two data points is given as cellsize. In the OS Terrain 50 data set, the cellsize is always 50 (giving it its name). There is a more accurate OS Terrain 5 set that costs money.

According to Wikipedia, the approximate coordinates for Ben Nevis are 216600, 771200 (which is in the NN17 square).

An easy way to find places on the grid is with https://britishnationalgrid.uk. Another nice map with BNG coordinates is https://explore.osmaps.com. A a great map without BNG coordinates can be found at https://opentopomap.org.

The sea

The sea is a bit messy in these files, as the values depend on mean sea level in each 10x10 km^2 area (OS Tile) relative to OS datum (0m) level which is mean sea level in Newlyn, Cornwall.

The "sea"

During preprocessing, the nevis module makes an attempt to classify points as "sea" or "not sea". This is done by assessing which below sea-level points can be accessed from the edge of the map, without ever going above sea-level. As a result, the mouths of small rivers, and large sections of wide rivers, are classified as "sea". All "sea" points are assigned height data to create a gentle slope pointing back towards the land.

Hill tops

Names of hill and mountain tops are taken from The Database of British and Irish Hills v17.2, which is made available under a CC-BY license. A greatly reduced list, based on this database, is included in nevis. Please see LICENSE.md for the licensing information.

Lattitude and longitude 🐇🕳️

What about longitude (east-west) and lattitude (north-south)? These are defined, it seems, by WGS 84, although there is a Europe-specific version called ETRS89 which "for most purposes ... can be considered equivalent to WGS84" ("Transformations and OSGM15 User Guide"). Transforming from national grid coordinates to longitude and lattitude is hard, and the Ordnance Survey have released a thing called OSTN15 to do this. Although this still seems to result in x, y coordinates, not degrees. Luckily, somebody's made a tool for it. Unfortunately, some people have issues installing this, so that we rely on a less accurate fallback for the time being. If you can, please manually install convertbng too (BenNevis will try using this first, before switching to bnglonglat).

Interpolation

To get heights for arbitrary points, we need to interpolate. By default, we use a linear interpolant. We also experimented with a scipy RectBiVariateSpline. This takes some time (~30 seconds on a fast machine) and uses considerable memory (~3GB). Most importantly, the spline shows some very serious (and unrealistic) artefacts near high gradients (e.g. at the sea side), so that the linear interpolation seems the way to go for now.

Citing

If you are using this project, please cite our pre-print:

Wei, Clerx, Mirams (2024) Where's Ben Nevis? A 2D optimisation benchmark with 957,174 local optima based on Great Britain terrain data. arXiv. doi: 10.48550/arXiv.2410.02422 | code

Owner

  • Name: Cardiac Modelling
  • Login: CardiacModelling
  • Kind: organization
  • Location: United Kingdom

Codes and Resources from the University of Nottingham's cardiac modelling team

GitHub Events

Total
  • Watch event: 2
  • Delete event: 1
  • Push event: 2
  • Pull request event: 2
  • Create event: 1
Last Year
  • Watch event: 2
  • Delete event: 1
  • Push event: 2
  • Pull request event: 2
  • Create event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 45
  • Total pull requests: 40
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 11 hours
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 1.18
  • Average comments per pull request: 1.05
  • Merged pull requests: 39
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: about 2 hours
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 1.4
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • MichaelClerx (44)
  • EricWay1024 (1)
Pull Request Authors
  • MichaelClerx (30)
  • EricWay1024 (12)
  • mirams (2)
Top Labels
Issue Labels
docs (4) long term (3) feature (3) bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 25 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
pypi.org: nevis

Presents the landscape of Great Britain as a testbed for optimisation and sampling methods.

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 25 Last month
Rankings
Dependent packages count: 6.6%
Forks count: 23.2%
Stargazers count: 28.2%
Average: 29.9%
Dependent repos count: 30.6%
Downloads: 61.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/docs-test.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/style-test.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
.requirements-docs.txt pypi
  • guzzle-sphinx-theme *
  • scipy *
  • sphinx >=1.5,
setup.py pypi
  • bnglonlat *
  • matplotlib >=1.5
  • numpy *
  • pykml *
  • scipy *
  • setuptools *
  • zipfile-deflate64 *