Created
June 4, 2013 06:42
-
-
Save TakashiUNUMA/5704025 to your computer and use it in GitHub Desktop.
Template for GMT plotting.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# GMTPLOT | |
# original script coded by Takashi Unuma, Kyoto Univ. | |
# Last modified: 2013:06/04 | |
# | |
infile=Z__C_RJTD_composit_RDR_JMAGPV.out | |
# setting | |
RANGE="118.0000/149.9875/20.00000/47.98047" | |
INT="0.0125/0.00833" | |
# xyz2grd | |
#xyz2grd ${infile} -G${infile%.out}.grd -R${RANGE} -I${INT} -ZBLf | |
namelist=${HOME}/work/program/stat_anl/detection/namelist.org_for_all | |
# Get the values from namelist.org | |
#SLON=$(awk '$1=="slon" {print $3}' ${namelist}) | |
#DLON=$(awk '$1=="dlon" {print $3}' ${namelist}) | |
#IMAX=$(awk '$1=="imax" {print $3-1}' ${namelist}) | |
#ELON=$(echo ${SLON} ${DLON} ${IMAX} | awk '{printf ("%10.6f\n", ($1+$2*$3) )}') | |
#SLAT=$(awk '$1=="slat" {print $3}' ${namelist}) | |
#DLAT=$(awk '$1=="dlat" {print $3}' ${namelist}) | |
#JMAX=$(awk '$1=="jmax" {print $3-1}' ${namelist}) | |
#ELAT=$(echo ${SLAT} ${DLAT} ${JMAX} | awk '{printf ("%9.6f\n", ($1+$2*$3) )}') | |
# calc. statistics | |
#DMIN=$(awk '{print $3}' ${infile%.out}.xyz | awk -f MIN.awk) | |
#DMAX=$(awk '{print $3}' ${infile%.out}.xyz | awk -f MAX.awk) | |
#DAVE=$(awk '{print $3}' ${infile%.out}.xyz | awk -f MEAN.awk) | |
#DMED=$(awk '{print $3}' ${infile%.out}.xyz | awk -f MEDIAN.awk) | |
#DSTD=$(awk '{print $3}' ${infile%.out}.xyz | awk -f STDEV.awk) | |
#------------------------------------------ | |
# GMT setting | |
gmtdefaults -D > .gmtdefaults4 | |
gmtset HEADER_FONT_SIZE 12p | |
gmtset HEADER_OFFSET -0.1c | |
gmtset LABEL_FONT_SIZE 12p | |
gmtset ANOT_FONT_SIZE 8p | |
gmtset ANNOT_OFFSET_PRIMARY 0.10c | |
gmtset PLOT_DEGREE_FORMAT ddd:mm:ssF | |
gmtset BASEMAP_TYPE plain | |
gmtset TICK_LENGTH -0.15c | |
gmtset FRAME_PEN 0.50p | |
gmtset GRID_PEN 0.20p | |
gmtset TICK_PEN 0.50p | |
gmtset MEASURE_UNIT cm | |
gmtset PAPER_MEDIA a4 | |
# Useful option | |
gmtsta='-P -K' | |
gmtcon='-P -K -O' | |
gmtend='-P -O' | |
# Specify output file | |
psfile=composit_radar.ps | |
#XYINT="a1g5" | |
XYINT="a10" | |
#projection="2.88" | |
projection="1:41500000" | |
location="${xloc}/${yloc1}/${yloc2}/50+lkm" | |
hcbar="8.3/2.5/5.0/0.225" | |
RANGE="${SLON}/${ELON}/${SLAT}/${ELAT}" | |
PRJ="m${projection}" | |
# psxy | |
#unucpt density 0 1 0.01 | |
grdimage ${infile%.out}.grd -J${PRJ} -R${RANGE} -Ccpalet_density.cpt -X1.2 -Y1.2 ${gmtsta} > ${psfile} | |
# psscale | |
gmtset ANOT_FONT_SIZE 8p | |
psscale -D1.5/-0.4/3.0/0.15h -Ba0.5f0.1/:"[mm/h]": -Ccpalet_density.cpt -N ${gmtcon} >> ${psfile} | |
# topography data | |
#unucpt hgt 500 2000 500 | |
#grdcontour japan_limited.grd -W1 -A- -J${PRJ} -R${RANGE} -Ccpalet_hgt.cpt ${gmtcon} >> ${psfile} | |
# pscoast | |
pscoast -J -R -W2 -A100 -Dh ${gmtcon} >> ${psfile} | |
# psbasemap | |
psbasemap -J -R -B${XYINT}:"Longitude":/${XYINT}:"Latitude":SWne:."": ${gmtcon} >> ${psfile} | |
# labels (pstext) | |
# x y size angle font place comment | |
cat << EOF | pstext -R1/10/1/10 -Jx1.0 -N ${gmtend} >> ${psfile} | |
# 9.8 5.0 8 90.0 0 ML PREC=${PREC} | |
# 9.8 3.2 8 90.0 0 ML INTERP=${INTERP} | |
# 9.8 1.0 8 90.0 0 ML MAXAREA=${MAXAREA} | |
9.8 1.0 6 90.0 0 ML MIN=${DMIN}; MAX=${DMAX}; AVE=${DAVE}; MED=${DMED}; STD=${DSTD} | |
# 0.5 8.15 12 0.0 0 ML (b) | |
0.0 0.0 1 0.0 0 ML . | |
0.0 11.0 1 0.0 0 ML . | |
10.5 0.0 1 0.0 0 ML . | |
10.5 11.0 1 0.0 0 ML . | |
EOF | |
# convert from ps to png | |
ps2raster -Tg -A ${psfile} | |
# convert from ps to pdf | |
ps2raster -Tf -A ${psfile} | |
rm -f .gmt* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment