Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMT #279

Merged
merged 5 commits into from
Jul 11, 2017
Merged

GMT #279

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 83 additions & 8 deletions en/quickstart/gmt_quickstart.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:Author: Hamish Bowman
:Version: osgeo-live6.5
:Author: Hamish Bowman, Massimo Di Stefano
:Version: osgeo-live11.0
:License: Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
:Copyright: 2011 by The OSGeo Foundation
:Copyright: 2017 by The OSGeo Foundation

.. image:: /images/project_logos/logo-GMT.png
:scale: 100 %
Expand All @@ -18,22 +18,97 @@ Running


Local documentation can be found in
`/usr/share/doc/gmt/html/ <../../gmt/html/index.html>`_,
examples can be found in
`/usr/share/doc/gmt/examples <../../gmt/examples/>`_,
`/usr/share/doc/gmt/html/ <../../gmt/html/index.html>`_
Examples can be found in
`/usr/share/doc/gmt/examples <../../gmt/examples/>`_


.. packages:
gmt-doc (and -pdf)
gmt-coast-low
gmt-examples
gmt-examples
gmt-tutorial (and -pdf)


Quick tutorial
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In this quick GMT tutorial we will use a digital terrain model (DTM) to generate a shaded relief map.

As input dataset we will use a DTM from the GRASS GIS example dataset which is accessible by GDAL using the GDAL-GRASS diver.
This will help in reducing the size footprint of data on the OSGeo-Live and demonstrate data interoperability between several formats.

From a quick look at the DTM metadata using the GDAL command `gdalinfo`:

::

gdalinfo /home/user/grassdata/nc_basic_spm_grass7/PERMANENT/cellhd/elevation


we can see the DTM is in a projected coordinate system and the data range is between 50 and 160 meters.

We can convert the DTM in a GMT Compatible netCDF file format with `gdal_translate` as follow:

::

gdal_translate -of GMT /home/user/grassdata/nc_basic_spm_grass7/PERMANENT/cellhd/elevation elevation.gmt

For our GMT example we will first transform the dataset into geographic coordinates Longitude-Latitude (EPSG:4326) using the `gdalwarp` command:

::

gdalwarp elevation.gmt geo_elevation.gmt -t_srs EPSG:4326


To assign a color map to our grid we can make a GMT color palette tables
with the `makecpt` command. We will set the range and number of colors with the flag `-T`
and assign a colormap with the flag `-C`.

::

gmt makecpt -Chaxby -T50/160/10 -Z > elevation.cpt


You can experiment with other colortables, see `man gmt makecpt` for a complete list.

For our shaded relief example we need to specify how the color intensity is distributed along the grid.
To do so, we will compute the directional derivative, or gradient, from our grid using the `grdgradient` command.
In `grdgradient` we will use the `-Ne` flag to normalize the output using a cumulative Laplace distribution and the `-A` flag Azimuthal direction for a directional derivative.

::

gmt grdgradient geo_elevation.gmt -Ne0.8 -A100 -fg -Ggradient.nc

The output is a netCDF file which can then be used as color intesity by the `grdimage` command as follow:

::

gmt grdimage geo_elevation.gmt -Igradient.nc -JM6i -P -Ba -Celevation.cpt -K > GMT_tut_OSGeo-Live.ps


Finally we can add a colorbar with `psscale`:

::

gmt psscale -DjTC+w5i/0.25i+h+o0/-1i -Rgeo_elevation.gmt -J -Celevation.cpt -I0.4 -By+lm -O >> GMT_tut_OSGeo-Live.ps


Here the flag `-D` is used to select the colorbar position `TC: Top Center`, the size `5x0.25` expressed in inches `i` the orientation by `h: horizontal`
and the flag `-By` to set a label `m` on the `y axis`.

The output ps document should look like:

.. image:: /images/screenshots/800x600/GMT_tut_OSGeo-Live.png
:scale: 100 %
:alt: North Caroline - sample elevation data
:align: center


Examples
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are 30 example jobs built in:
To explore the GMT potential we strongly suggest to go trough the GMT tutorial and follow the several examples available in the src code.
There are 30 example jobs built in, to test:

Open a terminal, then

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.