Skip to content

Commit

Permalink
Merge of Shingle 2.0 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcandy committed Apr 10, 2017
1 parent 60b0d6d commit 6d84af5
Show file tree
Hide file tree
Showing 286 changed files with 686,734 additions and 88 deletions.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
RTopo105b_50S.nc
libspud.so
*.pyc
*.pkl
*.shc
spud/
tool/spud-preprocess
lib
ref
bin
shingle.log
.DS_Store

dataset
test/Amundsen_Sea/Amundsen_Sea.geo
test/Antarctica_all/Antarctica_all.geo
test/Antarctica_main_landmass/Antarctica_main_landmass.geo
test/Antarctica_main_landicemass/Antarctica_main_landicemass.geo
test/Antarctica_main_landicemass_30s/Antarctica_main_landicemass_30s.geo
test/Filchner-Ronne/Filchner-Ronne.geo
test/Filchner-Ronne_back/Filchner-Ronne_back.geo

test/legacy/amundsen_sea/
test/legacy/antarctica_all/
test/legacy/filchner-ronne/
test/legacy/antarctica_main_landicemass/
test/legacy/antarctica_main_landicemass_30s/
test/legacy/filchner-ronne_back/

test/*/*.geo
test/*/*.msh
test/*/*.png
test/*/data/*.nc

test/Caribbean/data/Caribbean_valid.geo
test/Caribbean_main_coastline/data/Caribbean_main_coastline_valid.geo

shingle/unittest/output.brml
shingle/unittest/output.msh

44 changes: 40 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,45 @@
language: python
python:
- "2.7"
sudo: required
#install: "pip install -r requirements.txt"
#before_install:
# - sudo apt-get -qq update
# - sudo apt-get install -y -qq python-numpy python-scientific python-matplotlib
addons:
apt:
packages:
- python-numpy
- python-scientific
- python-matplotlib
- gcc
- g++
- gfortran
- tree
virtualenv:
system_site_packages: true
before_install:
- sudo apt-get install -qq python-numpy python-scientific python-matplotlib
#install:
script: make testwithdatadownload
install:
- pip install numpy matplotlib pyproj Pydap shapely Pillow
before_script:
- sudo apt-get install -qq python-numpy python-scientific python-matplotlib gmsh
- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/:$HOME/build/shingleproject/Shingle/lib/spud/:$HOME/build/shingleproject/Shingle/spud/.libs/:$HOME/build/lib.linux-x86_64-2.7/"
- export LIBRARY_PATH="$LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/:$HOME/build/shingleproject/Shingle/spud/:$HOME/build/shingleproject/Shingle/spud/.libs/:$HOME/build/lib.linux-x86_64-2.7/"
# - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/"
# - export LIBRARY_PATH="$LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/"
script:
- pip install numpy matplotlib pyproj Pydap shapely Pillow pytest
- python -c 'import Scientific.IO'
- ./configure
- make
- make installpackage
- make unittest
- make test
#before_script:
# - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/"
# - export LIBRARY_PATH="$LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/"
# - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/:$HOME/build/shingleproject/Shingle/lib/spud/:$HOME/build/shingleproject/Shingle/spud/.libs/:$HOME/build/lib.linux-x86_64-2.7/"
# - export LIBRARY_PATH="$LIBRARY_PATH:$HOME/build/shingleproject/Shingle/lib/:$HOME/build/shingleproject/Shingle/spud/:$HOME/build/shingleproject/Shingle/spud/.libs/:$HOME/build/lib.linux-x86_64-2.7/"
#script:
# - ./configure
# - make
# - find . -iname libspud* -print -exec nm -g {} \;
45 changes: 45 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Except as noted below, Shingle is copyright (C) 2011 - 2017
Adam S. Candy and others. For a full list of contributors see the
AUTHORS file.

Shingle is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

The complete text of the GNU Lesser General Public License can be
found in the file `LGPL-3.0'.

-----

Copyright and licence information for libspud is to be found in the
file spud/COPYING. Libspud makes use of Tinyxml and its notice is
provided below.

-----

Tinyxml is copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.

Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.

2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.
File renamed without changes.
13 changes: 13 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include MANIFEST MANIFEST.in README.md AUTHORS COPYING LGPL-3.0
include setup.py
include schema/shingle_options.rng
recursive-include shingle/ *.py
recursive-include shingle/ *.so

recursive-include spud/include/ *.h
include spud/include/*.h

prune dataset
recursive-exclude dataset/ *


25 changes: 20 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,28 @@ manual:
package:
@$(ECHO) 'PACKAGE shingle'
@python setup.py sdist bdist_wheel
@$(ECHO) 'PACKAGE diamond'
@cd spud/diamond; python setup.py sdist; cp -rp dist/* ../../dist/; cd ../..
@$(ECHO) 'PACKAGE dxdiff'
@cd spud/dxdiff; python setup.py sdist; cp -rp dist/* ../../dist/; cd ../..
#@$(ECHO) 'PACKAGE diamond'
#@cd spud/diamond; python setup.py sdist; cp -rp dist/* ../../dist/; cd ../..

packageupload:
@$(ECHO) 'PACKAGE UPLOAD shingle'
@python setup.py register -r $(PYPI)
@python setup.py sdist bdist_wheel upload -r $(PYPI)
@$(ECHO) 'PACKAGE UPLOAD dxdiff'
@cd spud/dxdiff; python setup.py register -r $(PYPI); python setup.py sdist upload -r $(PYPI); cp -rp dist/* ../../dist/; cd ../..
@$(ECHO) 'PACKAGE UPLOAD diamond'
@cd spud/diamond; python setup.py register -r $(PYPI); python setup.py sdist upload -r $(PYPI); cp -rp dist/* ../../dist/; cd ../..

installpackage: package
@$(ECHO) 'INSTALL shingle Python library'
@pip install ./dist/shingle-*.tar.gz
@$(ECHO) 'INSTALL dxdiff'
@pip install ./dist/dxdiff-*.tar.gz
#@$(ECHO) 'INSTALL diamond'
#@pip install ./dist/spud-diamond-*.tar.gz

test: bin/shingle datalocal
@./bin/shingle -t test

Expand Down Expand Up @@ -110,7 +122,7 @@ datalink:
testwithdatadownload:
@$(MAKE) -s -C test/legacy testwithdatadownload

.PHONY: test testlegacy data datalink testwithdatadownload schema doc datalocal
.PHONY: test testlegacy data datalink testwithdatadownload schema doc datalocal package

# ------------------------------------------------------------------------

Expand All @@ -120,8 +132,11 @@ libspud: lib/libspud.so
lib/libspud.so:
@mkdir -p lib
@$(MAKE) -C spud install-pyspud
@cp lib/python*/site-packages/libspud.so lib/
@cp lib/python*/site-packages/libspud.so shingle/
@cd lib; ln -sf libspud.so libspud.so.0; cd ..
@cd shingle; ln -sf libspud.so libspud.so.0; cd ..

#@cp lib/python*/site-packages/libspud.so lib/
#@cp lib/python*/site-packages/libspud.so shingle/

# ------------------------------------------------------------------------

Expand Down
95 changes: 27 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,50 @@
Shingle
=======

Generation of boundary representation from arbitrary geophysical fields.

For further information and updates, please contact the author Dr Adam S. Candy at [email protected].
Generalised self-consistent and automated domain discretisation for multi-scale geophysical models.

![Shingle](./data/shingle.png?raw=true "Shingle")

Outline web page: [http://adamcandy.github.io/Shingle](http://adamcandy.github.io/Shingle "Shingle")
LibShingle: Computational research software library providing a high-level abstraction to spatial discretisation, or mesh generation, for domains containing complex, fractal-like boundaries that characterise those in numerical simulations of geophysical dynamics. This is accompanied by a compact, shareable and necessarily complete description of the domain discretisation.

Geophysical model domains typically contain irregular, complex fractal-like boundaries and physical processes that act over a wide range of scales. Constructing geographically constrained boundary-conforming spatial discretisations of these domains with flexible use of anisotropic, fully unstructured meshes is a challenge. The problem contains a wide range of scales and a relatively large, heterogeneous constraint parameter space. Approaches are commonly ad hoc, model or application specific and insufficiently described. Development of new spatial domains is frequently time-consuming, hard to repeat, error prone and difficult to ensure consistent due to the significant human input required. As a consequence, it is difficult to reproduce simulations, ensure a provenance in model data handling and initialisation, and a challenge to conduct model intercomparisons rigorously. Moreover, for flexible unstructured meshes, there is additionally a greater potential for inconsistencies in model initialisation and forcing parameters. This library introduces a consistent approach to unstructured mesh generation for geophysical models, that is automated, quick-to-draft and repeat, and provides a rigorous and robust approach that is consistent to the source data throughout. The approach is enabling further new research in complex multi-scale domains, difficult or not possible to achieve with existing methods.

Outline web page: [http://shingleproject.org](http://shingleproject.org "Shingle")

Further details are provided in the library source and [Shingle project manual](http://homepage.tudelft.nl/w8w0h/4fcf65d8/shingle_manual.pdf "Shingle manual").

For further information and updates, please contact the lead author Dr Adam S. Candy at [email protected].

Build status
------------

[![Build Status](https://secure.travis-ci.org/adamcandy/Shingle.png)](http://travis-ci.org/adamcandy/Shingle)
[![Build Status](https://travis-ci.org/shingleproject/Shingle.svg?branch=master)](http://travis-ci.org/shingleproject/Shingle)

Example geophysical domains
---------------------------

A selection of geophysical domains where Shingle has been applied to generate the boundary representation.
This description is then meshed using [Gmsh](http://geuz.org/gmsh "Gmsh").
A selection of geophysical domains where Shingle has been applied to describe and generate geophysical domain spatial discretisation.

![Shingle examples](./data/shingleexamples.jpg?raw=true "Shingle examples")

Outline
-------

A new meshing approach for realistic domains.

This code generates boundary representations with elemernt identifications from arbitrary geophysical fields. It was originally used mask to generate a boundary along the coastlines and grounding line* (which is not positioned at a constant depth). The code is easily applied to boundaries along depth contours and to work with other NetCDF sources.

The new approach uses contouring routines (as opposed to the GSHHS Gmsh plugin, or a GMT approach). It would be useful to test this new code on a wide range of regions - particularly to check the contouring routines are behaving satisfactorily. It works very well in the Antarctic region (including the region inside ice shelf cavities).

The dependencies are all Python modules (e.g. GMT is not required).

* which involves a neat trick with modulo arithmetic to keep calculation time down significantly.

Supported features
------------------

- Generate boundary representation from raw raster input (e.g. a NetCDF data file),
- Regions defined by arbitrary functions of longitude and latitude (given on the command line),
- Simpler definition of regions by boxes (such as 'longmin:longmax,latmin:longmax'),
- Define included paths by Gmsh ID number (useful to include or exclude specific islands/land masses),
- Deals with multiple open boundaries,
- Islands and boundaries split by the global boundary are treated,
- Automatically closes boundaries with parallels and meridians (with a prescribed length step),
- Applies different boundary IDs on open and closed boundaries,
- Exclude smaller islands - restricted by a given minimum area,
- Option to extend domain in latitude on open boundaries (e.g. for sponge regions, or large open regions in the open ocean),
- Command line used is saved in the Gmsh .geo file for reference,
- Projection type (e.g. options to generate a mesh to UTM coordinates,
- Option to generate the ACC average track line (and then to refine the mesh to this).
- Ice shelf inclusion options

Development version
-------------------

A development version of the code also has:
- Caching of contours (which can save a lot of processing time)
- Graphical output of contouring stage, to aid in contour selection


Other updates
-------------

- Consistent use of dx_default,
- The Antarctica main example contour can now be meshed (uses dx=10 in the parallel creation now),
- Renamed the variables associated with the inclusion of the ice shelf ocean cavities to be more intuitive.

Test suite
Objectives
----------

Currently there are six tests in the test suite:
- amundsen_sea
- antarctica_all
- antarctica_main_landmass
- antarctica_main_landmass_30s
- filchner-ronne
- filchner-ronne_iceshelf
1. Introduce a consistent approach to the generation of boundary representation to arbitrary geoid bounds.
2. A user-friendly, accessible and extensible framework for model-independent geophysical domain mesh generation.
3. An intuitive, hierarchical formal grammar to fully describe and share the full heterogeneous set of constraints for the spatial discretisation of geophysical model domains.
4. Natural language basis for describing geophysical domain features.
5. Self-consistent, scalable, automated and efficient mesh prototyping.
6. Platform for iterative development that is repeatable, reproducible with a provenance history of generation.
7. Enabling rigorous unstructured mesh generation in general, for a wide range of geophysical applications, in a process that is automated, quick-to-draft and repeat, rigorous and robust, and consistent to the source data throughout.

Verification test engine
------------------------

Includes a selection of examples, from a relatively straight-forward high-level GUI-driven interaction accessible to modellers new to mesh generation, to complex low-level development communicating with the LibShingle library. Python interaction is used within the source, in generating documentation and in example Jupyter notebooks.

Datasets
--------
A verification test engine is continuously run in response to source code changes, some of which is tested under [http://travis-ci.org/shingleproject/Shingle](Travis "Travis").

The above tests use the RTopo dataset, described in detail at: [http://doi.pangaea.de/10.1594/PANGAEA.741917](http://doi.pangaea.de/10.1594/PANGAEA.741917 "RTopo").
An earlier version of the library Shingle 1.0 is available at: [https://github.com/shingleproject/Shingle1.0](https://github.com/shingleproject/Shingle1.0 "Shingle1.0"), with details on the [Shingle1.0 webpage](http://shingleproject.org/index_shingle1.0.html "Shingle1.0 webpage").

Timmermann, R et al. (2010): Antarctic ice sheet topography, cavity geometry, and global bathymetry (RTopo 1.0.5-beta). doi:10.1594/PANGAEA.741917,
Supplement to: Timmermann, Ralph; Le Brocq, Anne M; Deen, Tara J; Domack, Eugene W; Dutrieux, Pierre; Galton-Fenzi, Ben; Hellmer, Hartmut H; Humbert, Angelika; Jansen, Daniela; Jenkins, Adrian; Lambrecht, Astrid; Makinson, Keith; Niederjasper, Fred; Nitsche, Frank-Oliver; Nøst, Ole Anders; Smedsrud, Lars Henrik; Smith, Walter (2010): A consistent dataset of Antarctic ice sheet topography, cavity geometry, and global bathymetry. Earth System Science Data, 2(2), 261-273, doi:10.5194/essd-2-261-2010

[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/5494cf3263af78dea92487d951d530a8 "githalytics.com")](http://githalytics.com/adamcandy/Shingle)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/adamcandy/shingle/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/sh

cd spud
./configure --prefix=${PWD}/..
#./configure
cd ..

31 changes: 31 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

MAKE = make
ECHO = echo

default: shingle_manual


shingle_manual: verification_figures.tex
@echo BUILD shingle_manual
@$(MAKE) -s shingle_manual.pdf

verification_figures.tex:
@echo BUILD verification_figures
@./compile_verification_test_images.py

%.pdf: %.tex
pdflatex -shell-escape $^
if fgrep "Rerun to" $*.log; then $(MAKE) --assume-new $^ $@;fi
ifndef NOBIBTEX
if fgrep "There were undefined" $*.log;\
then bibtex $*; \
$(MAKE) NOBIBTEX=true --assume-new $^ $@;fi
endif

clean:
@rm -f *.{aux,log,bbl,blg,out,toc,pyg,thm}
@rm -f verification_figures.tex shingle_manual.pdf
@rm -rf _minted-shingle_manual

.PHONY: verification_figures shingle_manual

Loading

0 comments on commit 6d84af5

Please sign in to comment.