News:

:) We are a community of analysts, that cares about EPMA

Main Menu

GMT (Generic mapping tools)

Started by Ben Buse, October 17, 2019, 03:35:22 AM

Previous topic - Next topic

Ben Buse

Hi,

Has anyone used GMT generic mapping tools

http://gmt.soest.hawaii.edu/

With three lines of code I can create a ps or pdf file from a surfer grid file



The first line sets up the color scale, starting at 0 to 5000

gmt makecpt -T-0/5000 > compo.cpt

The second line plots the map [B5 sets tick marks on axis every five units, for above image I used B0.05]:

gmt grdimage 1-5_00006_COMPO.grd -JX6i+ -I -B5 -Ccompo.cpt -K > COMPO4.pdf

The third line plots the color intensity scale:

gmt psscale -Ccompo.cpt -Dx6.5i/15c+w12c/0.5c+jTC -Bx1000 -O >> COMPO4.pdf

Does anyone know if its possible to plot a distance scale bar, or is it not possible without geographic projection. Also I've yet to figure out how to label axes.

Thanks

Ben

Ben Buse

I've slightly progressed this. This time running on windows. A cmd batch which pass files to in command prompt window

In command prompt window
1. use cd to change to directory where want to save
2. drag batch file into window, type space, drag grd map files into window

:: change in cmd to directory wherewant to save
@echo off
setlocal enableDelayedExpansion
FOR %%q IN (%*) DO (
echo %%q
set locq=%%q
for %%F in (%%q) do echo %%~nxF
for %%F in (%%q) do set "testing4=%%~nF"
echo !testing4!
for %%F in (%%q) do echo %%~nxF
set play2=!testing4!
echo !play2!
:: set play2=!play2!.pdf%
:: echo !play2!
echo !locq!
gmt begin !play2!
::gmt grdimage !locq! -Jx1i/1i -I -B -pdf !play2!
gmt grdimage !locq! -Jx5i/5i -I -B
:: gmt psscale -Jx5i/5i -R!locq!
gmt psscale -Dx0c/-2c+w12c/0.5c+h
gmt end show
)
endlocal

The result isn't perfect as hard to set set of colorbar relative to the map. Here just batch script so can't adjust colours.

Outputs to pdf