项目作者: nc5ng

项目描述 :
Docker Image of Generic Mapping Tools
高级语言: Jupyter Notebook
项目地址: git://github.com/nc5ng/gmt-docker.git
创建时间: 2018-02-10T06:40:39Z
项目社区:https://github.com/nc5ng/gmt-docker

开源协议:MIT License

下载


gmt-docker

Homepage

Docker Hub Link

Docker Image of Generic Mapping Tools GMT HomePage, as well as GMT/Python

Instructions Adapted from GMT Wiki

Host Requirements

  • docker
  • docker-compose (0ptional)

Tags

Docker Container Images are available https://hub.docker.com/r/nc5ng/gmt

The following tags are provided.

  • latest Latest gmt upstream trunk code. Currently following 6.0.0 Development. Updated regularly, but not on every commit
  • python , GMT/Python pre-installed. Updated every time latest is updated
  • jupyter enhanced python image with jupyter online notebook, same version of gmt as latest and updated at the same time.
  • 6, 6-python, 6-jupyter more stable images featuring 6.0 builds that are verified to work. Updated occasionally
  • 6.0.0_r20469, 6.0.0_r20469-python, 6.0.0_r20469-jupyter, … Fixed tags for specific commits and build numbers (Never Updated)

Usage

Docker

Print Help:

  1. $ docker run -it --rm nc5ng/gmt --help

Start a local Shell:

  1. $ docker run -it --rm --entrypoint /bin/bash nc5ng/gmt

Using Docker with local files:

By default, image operates in directory “/workspace”

  1. # All paths in current dir are valid
  2. $ docker run -it --rm -v "$PWD:/workspace" nc5ng/gmt surface

Run a gmt command and save output locally:

  1. $ docker run --rm nc5ng/gmt pscoast -JM10.0i -R235.0/294.0/24.0/50.0 -C blue -N2 > conus.ps

Starting a GMT/Python session in ipython:

  1. $ docker run -it --rm nc5ng/gmt:python

**Starting a jupyter notebook session

  1. $ docker run -p "8888:8888" -it --rm -v "$PWD:/workspace" nc5ng/gmt:jupyter

Then, connect to the device using the IP of the host computer (or local host) and the secure token printed on the command line.

Command Line Wrapper

Download the command line wrapper from the git repository

  1. # Get Code
  2. $ git clone https://github.com/nc5ng/gmt-docker
  3. # Alternate
  4. $ wget https://raw.github.com/nc5ng/gmt-docker/master/gmt.sh
  5. # /home/user/bin is usually on path
  6. # alternatives : /usr/local/bin
  7. $ mkdir -p ~/bin
  8. $ cp gmt-docker/gmt.sh ~/bin/gmt
  9. $ chmod +x ~/bin/gmt
  10. $ gmt --version
  11. 6.0.0_r19736
  12. # plot something
  13. $ gmt pscoast -JM10.0i -R235.0/294.0/24.0/50.0 -Cblue -N2 > conus.ps

The wrapper script is a simplistic shortcut, feel free to use the same approach
to define an alias or your own ~/bin/gmt convenience script. The docker tag can be specified with environment variable $DOCKER_GMT_VERSION.

NOTE: Docker is a container environment similar to a Virtual Machine, scripts that rely on absolute paths when using GMT tools should extend the container to package the data. When run in convenience script, only the local directory (and subdirectories) are hosted in the docker environment

Advanced Docker Usage

Extending Container:

Complex data processing pipelines are well served by docker images. They can be shared by multiple people easily, with all dependencies and data in place.

The easiest way to integrate your complex data set with the docker image is to extend the image

  1. # Extend Python Image
  2. FROM nc5ng/gmt:python
  3. # Add local directory data
  4. ADD ./ /workspace
  5. # Install custom requirements
  6. RUN pip install -r /workspace/requirements.txt
  7. # Use your command as entrypoint for container
  8. ENTRYPOINT /workspace/my_processing_script.sh

Usage: docker-compose

docker-compose can be used to orchestrate conversions

  1. version: '2'
  2. services:
  3. step-1:
  4. image: nc5ng/gmt
  5. volumes:
  6. - "/path/to/dataroot:/workspace:rw"
  7. command: surface test.xyz
  8. step-2:
  9. image: nc5ng/gmt
  10. volumes:
  11. - "/path/to/dataroot:/workspace:rw"
  12. command: -JM10.0i -R235.0/294.0/24.0/50.0 -Cblue -N2 > conus.ps
  1. $ docker-compose run step-1
  2. $ docker-compose run step-2