Skip to content

Commit

Permalink
Merge branch 'master' into psconvert-no-file-dup
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim committed Jan 4, 2025
2 parents ed88283 + 350051e commit 2520d94
Show file tree
Hide file tree
Showing 77 changed files with 516 additions and 262 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#
# Build GMT source codes on different Linux distros using dockers.
#
# This workflow is triggered by push or pull request events.
#
name: Docker

on:
Expand Down Expand Up @@ -53,17 +55,11 @@ jobs:
fail-fast: false
matrix:
image:
# Test the oldest and latest Ubuntu LTS releases and also unstable Debian/Fedora
# Ubuntu: https://en.wikipedia.org/wiki/Ubuntu_version_history#Table_of_versions
- ubuntu:20.04 # CMake 3.16.3 + GNU 9.3.0; EOL: 2025-05-29
- ubuntu:22.04 # CMake 3.22.1 + GNU 11.2.0; EOL: 2027-06-01
- ubuntu:24.04 # CMake 3.28.3 + GNU 13.2.0; EOL: 2029-05-31
# Debian: https://en.wikipedia.org/wiki/Debian_version_history#Release_table
- debian:11 # CMake 3.18.4 + GNU 10.2.1; EOL: 2026-06-01
- debian:12 # CMake 3.25.1 + GNU 12.2.0; EOL: 2028-06-01
- debian:sid # rolling release with latest versions
# Fedora: https://en.wikipedia.org/wiki/Fedora_Linux_release_history
- fedora:39 # CMake 3.27.7 + GNU 13.2.1; EOL: 2024-11-12
- fedora:40 # CMake 3.28.2 + GNU 14.0.1; EOL: 2025-05-13
- fedora:rawhide # rolling release with latest versions

steps:
Expand Down
64 changes: 34 additions & 30 deletions admin/build-scientific-colors-cpt.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash
#
# This script takes the downloaded zip content from
# Crameri, Fabio. (2023, June 14). Scientific colour maps
# (Version 8.0.0). Zenodo. https://doi.org/10.5281/zenodo.1243862
# Crameri, Fabio. (2023, Oct 5). Scientific colour maps
# (Version 8.0.1). Zenodo. https://doi.org/10.5281/zenodo.1243862
# and converts the *.cpt files into proper GMT master
# CPT files with correct attribution and hinge info
# Run from the ScientificColourMapsV directory (V is version) after the
# zip has downloaded and been expanded. But first you need to manually
# update the /tmp/cpt.info entries below with one line per CPT subdir in the
# update the $TMP/cpt.info entries below with one line per CPT subdir in the
# downloaded directory. It will create a gmt subdirectory with all the CPTs.
# You also need to edit gmt_cpt_masters.h after adding the CPTs to share/cpt
#
# Last setup and run for ScientificColourMaps8 on June 26, 2023 for GMT 6.5 (master)
# Gave 55 CPTS: The same as release 7 with new entries glasgow, lipari, navia, managua.
# Last setup and run for ScientificColourMaps8 (release 8.0.1) on Jan 2, 2025 for GMT 6.6 (master)
# Gave 56 CPTs: The same as release 8.0.0 from GMT 6.5 with new entry naviaW.
#

if [ $# -eq 0 ]; then
Expand All @@ -23,20 +23,23 @@ if [ $# -eq 0 ]; then
Give the full path to the expanded zip file top directory, such as
~/Download/ScientificColourMaps8.
Before running you must update this script with:
1. Any new CPT entries since the last release to /tmp/cpt.info
1. Any new CPT entries since the last release to \$TMP/cpt.info
2. Flag those with a soft hinge as S and a hard hinge as H
3. Manually set the current version number/doi (see the zip PDF docs)
Afterwards you must:
1. Update src/gmt_cpt_masters.h with any new entries (copy lines from /tmp/cpt_strings.txt)
1. Update src/gmt_cpt_masters.h with any new entries (copy lines from \$DIR/cpt_strings.txt)
2. Adding the CPTs to share/cpt/SCM (overwriting the previous versions)
3. Probably mess with doc/scripts/GMT_App_M*.sh for new layouts
EOF
exit 1
fi

DIR=$1
VERSION=8.0.0
cat << EOF > /tmp/cpt.info
VERSION=8.0.1
DOI=10.5281/zenodo.1243862

TMP=$(mktemp -d)
cat << EOF > $TMP/cpt.info
acton|Perceptually uniform sequential colormap, by Fabio Crameri [C=RGB]
actonS|Perceptually uniform sequential categorical colormap, by Fabio Crameri [C=RGB]
bam|Perceptually uniform bimodal colormap, light, by Fabio Crameri [C=RGB]
Expand Down Expand Up @@ -77,6 +80,7 @@ lisbon|Perceptually uniform bimodal colormap, dark, by Fabio Crameri [S,C=RGB]
lipari|Perceptually uniform sequential colormap by Fabio Crameri [C=RGB]
managua|Perceptually uniform diverging colormap, by Fabio Crameri [S,C=RGB]
navia|Perceptually uniform sequential colormap by Fabio Crameri [C=RGB]
naviaW|Perceptually uniform sequential colormap with white ending by Fabio Crameri [C=RGB]
nuuk|Perceptually uniform, low-lightness gradient colormap, by Fabio Crameri [C=RGB]
nuukS|Perceptually uniform, low-lightness gradient categorical colormap, by Fabio Crameri [C=RGB]
oleron|Perceptually uniform topography colormap, by Fabio Crameri [H,C=RGB]
Expand All @@ -93,17 +97,16 @@ vanimo|Perceptually uniform bimodal colormap, dark, by Fabio Crameri [C=RGB]
vik|Perceptually uniform bimodal colormap, light, by Fabio Crameri [S,C=RGB]
vikO|Perceptually uniform bimodal cyclic colormap, light, by Fabio Crameri [C=RGB]
EOF
here=$(pwd)
cd $DIR
# Make formatted list of lines suitable for copying into gmt_cpt_masters.h
awk -F'|' '{printf "\"SCM/%-10s : %s\",\n", $1, $2}' /tmp/cpt.info > /tmp/cpt_strings.txt
awk -F'|' '{printf "\"SCM/%-14s : %s\",\n", $1, $2}' $TMP/cpt.info > $TMP/cpt_strings.txt
# Make list of CPTs with a hinge of some soft since these need to insert a true z = 0 slice
grep "\[H," /tmp/cpt.info | awk -F'|' '{print $1}' > /tmp/hinge.lis
grep "\[S," /tmp/cpt.info | awk -F'|' '{print $1}' >> /tmp/hinge.lis
grep "\[H," $TMP/cpt.info | awk -F'|' '{print $1}' > $TMP/hinge.lis
grep "\[S," $TMP/cpt.info | awk -F'|' '{print $1}' >> $TMP/hinge.lis

rm -rf gmt_cpts
mkdir gmt_cpts
cat <<- EOF > /tmp/front
cat <<- EOF > $TMP/front
#
#----------------------------------------------------------
# COLOR_MODEL = RGB
Expand All @@ -127,7 +130,7 @@ while read line; do
#
# License: MIT License
# Copyright (c) 2023, Fabio Crameri.
# Crameri, F., (2023). Scientific colour maps. Zenodo. https://doi.org/10.5281/zenodo.1243862
# Crameri, F., (2023). Scientific colour maps. Zenodo. https://doi.org/$DOI
# This is Scientific Colour Maps version $VERSION
# Note: Original file converted to GMT version >= 5 CPT format.
EOF
Expand All @@ -138,38 +141,39 @@ while read line; do
*) hinge="" ;;
esac
if [ "X${last_char}" = "XS" ]; then
cat /tmp/front >> gmt_cpts/$cpt.cpt
cat $TMP/front >> gmt_cpts/$cpt.cpt
echo "#----------------------------------------------------------" >> gmt_cpts/$cpt.cpt
egrep -v '^#|^F|^B|^N' $cptdir/$cpt.cpt | awk '{if (NR == 1) { printf "%d\t%s/%s/%s\n%d\t%s/%s/%s\n", 0, $2, $3, $4, 1, $6, $7, $8} else {printf "%d\t%s/%s/%s\n", NR, $6, $7, $8}}' > /tmp/tmp.cpt
egrep -v '^#|^F|^B|^N' $cptdir/$cpt.cpt | awk '{if (NR == 1) { printf "%d\t%s/%s/%s\n%d\t%s/%s/%s\n", 0, $2, $3, $4, 1, $6, $7, $8} else {printf "%d\t%s/%s/%s\n", NR, $6, $7, $8}}' > $TMP/tmp.cpt
elif [ "X$hinge" = "X" ]; then
cat /tmp/front >> gmt_cpts/$cpt.cpt
cat $TMP/front >> gmt_cpts/$cpt.cpt
if [ "X${last_char}" = "XO" ]; then
echo "# CYCLIC" >> gmt_cpts/$cpt.cpt
fi
echo "#----------------------------------------------------------" >> gmt_cpts/$cpt.cpt
egrep -v '^#|^F|^B|^N' $cptdir/$cpt.cpt | awk '{printf "%.6f\t%s/%s/%s\t%.6f\t%s/%s/%s\n", $1, $2, $3, $4, $5, $6, $7, $8}' > /tmp/tmp.cpt
egrep -v '^#|^F|^B|^N' $cptdir/$cpt.cpt | awk '{printf "%.6f\t%s/%s/%s\t%.6f\t%s/%s/%s\n", $1, $2, $3, $4, $5, $6, $7, $8}' > $TMP/tmp.cpt
else
echo "# Note: Range changed from 0-1 to -1/+1 to place hinge at zero." >> gmt_cpts/$cpt.cpt
cat /tmp/front >> gmt_cpts/$cpt.cpt
cat $TMP/front >> gmt_cpts/$cpt.cpt
echo "# $hinge" >> gmt_cpts/$cpt.cpt
echo "#----------------------------------------------------------" >> gmt_cpts/$cpt.cpt
# Convert to -1/1 range
egrep -v '^#|^F|^B|^N' $cptdir/$cpt.cpt | awk '{printf "%.6f\t%s/%s/%s\t%.6f\t%s/%s/%s\n", 2*($1-0.5), $2, $3, $4, 2*($5-0.5), $6, $7, $8}' > /tmp/tmp.cpt
egrep -v '^#|^F|^B|^N' $cptdir/$cpt.cpt | awk '{printf "%.6f\t%s/%s/%s\t%.6f\t%s/%s/%s\n", 2*($1-0.5), $2, $3, $4, 2*($5-0.5), $6, $7, $8}' > $TMP/tmp.cpt
fi
cat /tmp/tmp.cpt >> gmt_cpts/$cpt.cpt
cat $TMP/tmp.cpt >> gmt_cpts/$cpt.cpt
if [ "X${last_char}" = "XS" ] || [ "X${last_char}" = "XO" ]; then # Categorical or cyclical CPTS have no F or B, only NaN
egrep '^N' $cptdir/$cpt.cpt | awk '{printf "%s\t%s/%s/%s\n", $1, $2, $3, $4}' >> gmt_cpts/$cpt.cpt
else
egrep '^F|^B|^N' $cptdir/$cpt.cpt | awk '{printf "%s\t%s/%s/%s\n", $1, $2, $3, $4}' >> gmt_cpts/$cpt.cpt
fi
done < /tmp/cpt.info
done < $TMP/cpt.info
# Fix the zero hinges
while read cpt; do
grep '^#' gmt_cpts/${cpt}.cpt > /tmp/${cpt}.cpt
egrep -v '^#|B|N|F' gmt_cpts/${cpt}.cpt | awk '{if (NR == 127) {printf "%s\t%s\t0.0\t\t\t%s\n", $1, $2, $4} else if (NR == 129) {printf "0.0\t\t\t%s\t%s\t%s\n", $2, $3, $4} else if (NR != 128) { print $0}}' >> /tmp/${cpt}.cpt
egrep '^B|^N|^F' gmt_cpts/${cpt}.cpt >> /tmp/${cpt}.cpt
mv -f /tmp/${cpt}.cpt gmt_cpts
done < /tmp/hinge.lis
rm -f tmp
cd $here
grep '^#' gmt_cpts/${cpt}.cpt > $TMP/${cpt}.cpt
egrep -v '^#|B|N|F' gmt_cpts/${cpt}.cpt | awk '{if (NR == 127) {printf "%s\t%s\t0.0\t\t\t%s\n", $1, $2, $4} else if (NR == 129) {printf "0.0\t\t\t%s\t%s\t%s\n", $2, $3, $4} else if (NR != 128) { print $0}}' >> $TMP/${cpt}.cpt
egrep '^B|^N|^F' gmt_cpts/${cpt}.cpt >> $TMP/${cpt}.cpt
mv -f $TMP/${cpt}.cpt gmt_cpts
done < $TMP/hinge.lis
mv -f $TMP/cpt_strings.txt .
rm -rf $TMP
echo "Folder with new cpts is $DIR/gmt_cpts"
echo "The strings for src/gmt_cpt_masters.h can be found at $DIR/cpt_strings.txt"
10 changes: 5 additions & 5 deletions doc/rst/source/reference/cpts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ Color maps can be selected in various of the GMT tools using **-C**\ [*section*/
:width: 500 px
:align: center

The standard 46 CPTs supported by GMT.
The standard CPTs supported by GMT.

.. _CPT_files_b:

.. figure:: /_images/GMT_App_M_1b.*
:width: 500 px
:align: center

The 30 scientific color maps by Fabio Crameri supported by GMT.
The color maps (v8.0.1) by Fabio Crameri supported by GMT. Only the non-cyclic and non-categorical variants are shown here.

.. _CPT_files_c:

.. figure:: /_images/GMT_App_M_1c.*
:width: 500 px
:align: center

The 7 cyclic color maps (those ending in "O" are the cyclic
scientific color maps by Fabio Crameri) supported by GMT.
The categorical (top row) and cyclic color maps supported by GMT. Those starting with "SCM" are the cyclic
scientific color maps by Fabio Crameri; those stating with "cmocean" are cyclic color maps by Kristen M. Thyng.
**Note**: Any GMT colormap can be made cyclic by running :doc:`/makecpt`
with the **-Ww** option (wrapped = cyclic).

Expand All @@ -69,7 +69,7 @@ Color maps can be selected in various of the GMT tools using **-C**\ [*section*/
:width: 500 px
:align: center

The 22 color maps from cmocean by Kristen M. Thyng supported by GMT.
The color maps from cmocean by Kristen M. Thyng supported by GMT.

For additional color tables, visit
`cpt-city <http://www.seaviewsensing.com/pub/cpt-city/>`_ and
Expand Down
71 changes: 25 additions & 46 deletions doc/scripts/GMT_App_M_1a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,53 @@
#
# We have five sets of CPT figures to make:
# 1a) Our regular, traditional GMT CPTs [46]
# 1b) The regular Scientific Color Maps* [55]
# 1b) The regular Scientific Color Maps* [56]
# 1c) Cyclic CPTs [7]
# 1d) Colormaps from cmocean [22]
#
# *from Fabio [www.fabiocrameri.ch/visualisation]

plot () {
gmt makecpt -H -C$1 -T-1/1 > tt.1.cpt
gmt makecpt -H -C$1 -T-1/1/0.25 > tt.2.cpt
gmt colorbar -Dx${2}i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.1.cpt -B0
gmt colorbar -Dx${2}i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.2.cpt -Bf0.25
echo $2 $y $1 | gmt text -D0/0.05i -F+f9p,Helvetica-Bold+jBC
if [ $(grep -c RANGE ${GMT_SHAREDIR}/cpt/$1.cpt) -eq 1 ]; then # Plot default range for left CPT
grep RANGE ${GMT_SHAREDIR}/cpt/$1.cpt | awk '{printf "2.9 %g %s\n", "'$y'", $4}' | gmt text -F+f6p,Helvetica+jRB -D0/0.025i -N
fi
if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/$1.cpt) -eq 1 ]; then # Plot hard hinge symbol for left CPT
echo $2 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/$1.cpt) -eq 1 ]; then # Plot soft hinge symbol for left CPT
echo $2 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
fi
}

GMT_SHAREDIR=$(gmt --show-sharedir)

# Here we list all cpt, except cyclic, categorical, cmocean, SCM, srtm
sed -e 's/"//g' "${GMT_SOURCE_DIR}"/src/gmt_cpt_masters.h | egrep -v "cyclic|ategorical|cmocean|SCM|srtm" | awk '{print $1}' | sort -r > tt.lis
cat <<- EOF >> tt.lis
gmt/categorical
gmt/paired
EOF
sed -e 's/"//g' "${GMT_SOURCE_DIR}"/src/gmt_cpt_masters.h | egrep -vi "cyclic|categorical|cmocean|SCM|srtm" | awk '{print $1}' | sort > tt.lis

n=$(cat tt.lis | wc -l)
let n2=n/2
# dy is line spacing and y0 is total box height
dy=0.6
y0=$(gmt math -Q $n2 $dy MUL 0.1 ADD =)
y0=$(gmt math -Q $n $dy MUL 0.5 MUL 0.25 ADD =)

gmt begin GMT_App_M_1a
gmt set MAP_FRAME_PEN thinner FONT_ANNOT_PRIMARY 8p MAP_TICK_LENGTH_PRIMARY 0.1i MAP_ANNOT_OFFSET_PRIMARY 0.04i
gmt basemap -R0/6.1/0/$y0 -Jx1i -B0

let i=1
i=1
y=0.375
y2=0.25
while [ $i -le $n ]
do
j=$(expr $i + 1)
left=$(sed -n ${j}p tt.lis)
right=$(sed -n ${i}p tt.lis)
echo "Doing ${left} and ${right}"
if [ ${left} = "gmt/paired" ]; then
gmt makecpt -H -C${left} -T1/13/1 > tt.left.cpt
gmt makecpt -H -C${right} -T1/13/1 > tt.right.cpt
gmt colorbar -Dx1.55i/${y}i+w2.70i/0.125i+h+jTC -Ctt.left.cpt -B0
gmt colorbar -Dx4.50i/${y}i+w2.70i/0.125i+h+jTC -Ctt.right.cpt -B0
if [ $i -eq $n ]; then
plot $(sed -n 1p tt.lis) 3.05
else
gmt makecpt -H -C$left -T-1/1 > tt.left.cpt
gmt makecpt -H -C$left -T-1/1/0.25 > tt.left2.cpt
gmt makecpt -H -C$right -T-1/1 > tt.right.cpt
gmt makecpt -H -C$right -T-1/1/0.25 > tt.right2.cpt
gmt colorbar -Dx1.55i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.left.cpt -B0
gmt colorbar -Dx4.50i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.right.cpt -B0
gmt colorbar -Dx1.55i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.left2.cpt -Bf0.25
gmt colorbar -Dx4.50i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.right2.cpt -Bf0.25
if [ $(grep -c RANGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot default range for left CPT
grep RANGE ${GMT_SHAREDIR}/cpt/${left}.cpt | awk '{printf "2.9 %g %s\n", "'$y'", $4}' | gmt text -F+f6p,Helvetica+jRB -D0/0.025i -N
fi
if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot hard hinge symbol for left CPT
echo 1.55 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot soft hinge symbol for left CPT
echo 1.55 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
fi
if [ $(grep -c RANGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot default range for left CPT
grep RANGE ${GMT_SHAREDIR}/cpt/${right}.cpt | awk '{printf "5.85 %g %s\n", "'$y'", $4}' | gmt text -F+f6p,Helvetica+jRB -D0/0.025i -N
fi
if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot hard hinge symbol for right CPT
echo 4.50 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot soft hinge symbol for right CPT
echo 4.50 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
fi
plot $(sed -n $(expr $n - $i )p tt.lis) 1.55
plot $(sed -n $(expr $n - $i + 1)p tt.lis) 4.50
fi
gmt text -D0/0.05i -F+f9p,Helvetica-Bold+jBC <<- END
1.55 $y ${left}
4.50 $y ${right}
END
i=$(expr $i + 2)
y=$(gmt math -Q $y $dy ADD =)
y2=$(gmt math -Q $y2 $dy ADD =)
Expand Down
58 changes: 26 additions & 32 deletions doc/scripts/GMT_App_M_1b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,37 @@
#
# We have five sets of CPT figures to make:
# 1a) Our regular, traditional GMT CPTs [46]
# 1b) The regular Scientific Color Maps* [55]
# 1b) The regular Scientific Color Maps* [56]
# 1c) Cyclic CPTs [7]
# 1d) Colormaps from cmocean [22]
#
# *from Fabio [www.fabiocrameri.ch/visualisation]

plot () {
gmt makecpt -H -C$1 -T-1/1 > tt.1.cpt
gmt makecpt -H -C$1 -T-1/1/0.25 > tt.2.cpt
gmt colorbar -Dx${2}i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.1.cpt -B0
gmt colorbar -Dx${2}i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.2.cpt -Bf0.25
echo $2 $y $1 | gmt text -D0/0.05i -F+f9p,Helvetica-Bold+jBC
if [ $(grep -c RANGE ${GMT_SHAREDIR}/cpt/$1.cpt) -eq 1 ]; then # Plot default range for left CPT
grep RANGE ${GMT_SHAREDIR}/cpt/$1.cpt | awk '{printf "2.9 %g %s\n", "'$y'", $4}' | gmt text -F+f6p,Helvetica+jRB -D0/0.025i -N
fi
if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/$1.cpt) -eq 1 ]; then # Plot hard hinge symbol for left CPT
echo $2 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/$1.cpt) -eq 1 ]; then # Plot soft hinge symbol for left CPT
echo $2 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
fi
}

GMT_SHAREDIR=$(gmt --show-sharedir)

# Here we list all the non-categorical/cyclic cpts from the SCM:
sed -e 's/"//g' "${GMT_SOURCE_DIR}"/src/gmt_cpt_masters.h | egrep SCM | egrep -v "categorical|cyclic" | awk '{print $1}' | sort -r > tt.lis
# Here we list all the non-categorical/non-cyclic cpts from the SCM:
sed -e 's/"//g' "${GMT_SOURCE_DIR}"/src/gmt_cpt_masters.h | egrep SCM | egrep -v "categorical|cyclic" | awk '{print $1}' | sort > tt.lis

n=$(cat tt.lis | wc -l)
let n2=n/2
let n2=n
# dy is line spacing and y0 is total box height
dy=0.6
y0=$(gmt math -Q $n2 $dy MUL 0.5 MUL 0.1 ADD =)
y0=$(gmt math -Q $n $dy MUL 0.5 MUL 0.25 ADD =)

gmt begin GMT_App_M_1b
gmt set MAP_FRAME_PEN thinner FONT_ANNOT_PRIMARY 8p MAP_TICK_LENGTH_PRIMARY 0.1i MAP_ANNOT_OFFSET_PRIMARY 0.04i
Expand All @@ -30,33 +44,13 @@ gmt basemap -R0/6.1/0/$y0 -Jx1i -B0
i=1
y=0.375
y2=0.25
while [ $i -le $n2 ]
while [ $i -le $n ]
do
j1=$(expr $n2 - $i)
j2=$(expr $n2 - $i + 1)
left=$(sed -n ${j1}p tt.lis)
right=$(sed -n ${j2}p tt.lis)
gmt makecpt -H -C$left -T-1/1 > tt.left.cpt
gmt makecpt -H -C$left -T-1/1/0.25 > tt.left2.cpt
gmt makecpt -H -C$right -T-1/1 > tt.right.cpt
gmt makecpt -H -C$right -T-1/1/0.25 > tt.right2.cpt
gmt colorbar -Dx1.55i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.left.cpt -B0
gmt colorbar -Dx4.50i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.right.cpt -B0
gmt colorbar -Dx1.55i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.left2.cpt -Bf0.25
gmt colorbar -Dx4.50i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.right2.cpt -Bf0.25
gmt text -D0/0.05i -F+f9p,Helvetica-Bold+jBC <<- END
1.55 $y ${left}
4.50 $y ${right}
END
if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot hard hinge symbol for left CPT
echo 1.55 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot soft hinge symbol for left CPT
echo 1.55 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
fi
if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot hard hinge symbol for right CPT
echo 4.50 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot soft hinge symbol for right CPT
echo 4.50 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
if [ $i -eq $n ]; then
plot $(sed -n 1p tt.lis) 3.05
else
plot $(sed -n $(expr $n - $i )p tt.lis) 1.55
plot $(sed -n $(expr $n - $i + 1)p tt.lis) 4.50
fi
i=$(expr $i + 2)
y=$(gmt math -Q $y $dy ADD =)
Expand Down
Loading

0 comments on commit 2520d94

Please sign in to comment.