Skip to content

Commit

Permalink
add different output formats
Browse files Browse the repository at this point in the history
  • Loading branch information
demanast@triangle committed Oct 9, 2017
1 parent 192fd91 commit f6ce7f9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
56 changes: 44 additions & 12 deletions coulomb2gmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ function help {
echo " -leg [:=legend] insert legends"
echo " -jpg [:=convert] eps file to jpg"
echo " -h [:= help] help menu"
echo "/*** OUTPUT FORMATS ***********************************************************/"
echo " -outjpg : Adjust and convert to JPEG"
echo " -outpng : Adjust and convert to PNG (transparent where nothing is plotted)"
echo " -outeps : Adjust and convert to EPS"
echo " -outpdf : Adjust and convert to PDF"
echo ""
echo " Exit Status: 1 -> help message or error"
echo " Exit Status: >= 0 -> sucesseful exit"
Expand All @@ -91,8 +96,12 @@ dscale=100
TOPOGRAPHY=0
LABELS=0
OUTFILES=0
OUTJPG=0
LEGEND=0
OUTJPG=0
OUTPNG=0
OUTEPS=0
OUTPDF=0

RANGE=0
CSTRESS=0
SSTRESS=0
Expand Down Expand Up @@ -259,8 +268,7 @@ do
;;
-o)
OUTFILES=1
outfile=${4}.eps
out_jpg=${4}.jpg
outfile=${4}.ps
shift
shift
;;
Expand All @@ -272,11 +280,23 @@ do
LEGEND=1
shift
;;
-jpg)
-outjpg)
OUTJPG=1
shift
;;
-h)
-outpng)
OUTPNG=1
shift
;;
-outeps)
OUTEPS=1
shift
;;
-outpdf)
OUTPDF=1
shift
;;
-h)
help
;;
esac
Expand All @@ -290,8 +310,7 @@ fi
# Pre-defined parameters for GMT
if [ "$OUTFILES" -eq 0 ]
then
outfile=${inputdata}.eps
out_jpg=${inputdata}.jpg
outfile=${inputdata}.ps
fi

pth2inpfile=${pth2inpdir}/${inputfile}.inp
Expand All @@ -307,7 +326,7 @@ then
prjscale=1500000 ##DEF 1000000
fi

sclat=$(echo print $minlat + 0.08 | python)
sclat=$(echo print $minlat + 0.10 | python)
sclon=$(echo print $maxlon - 0.22 | python)
scale=-Lf${sclon}/${sclat}/36:24/20+l+jr
range=-R$minlon/$maxlon/$minlat/$maxlat
Expand Down Expand Up @@ -540,14 +559,27 @@ fi



#################--- Close eps output file ----##########################################
#################--- Close eps output file ----#################################
echo "909 909" | gmt psxy -Sc.1 -Jm -O -R -W1,red >> $outfile

#################--- Convert to jpg format ----##########################################
#################--- Convert to other format ----###############################
if [ "$OUTJPG" -eq 1 ]
then
gs -sDEVICE=jpeg -dJPEGQ=100 -dNOPAUSE -dBATCH -dSAFER -r300 -sOutputFile=$out_jpg $outfile
#gs -sDEVICE=jpeg -dJPEGQ=100 -dNOPAUSE -dBATCH -dSAFER -r300 -sOutputFile=$out_jpg $outfile
gmt psconvert $outfile -A0.2c -Tj
fi
if [ "$OUTPNG" -eq 1 ]
then
gmt psconvert $outfile -A0.2c -TG
fi
if [ "$OUTEPS" -eq 1 ]
then
gmt psconvert $outfile -A0.2c -Te
fi
if [ "$OUTPDF" -eq 1 ]
then
gmt psconvert $outfile -A0.2c -Tf
fi
################--- Convert to gif format ----##########################################
################--- Convert to gif format ----##################################
# ps2raster -E$dpi -Tt $map.ps
# convert -delay 180 -loop 0 *.tif IonMap$date.gif
2 changes: 1 addition & 1 deletion default-param
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pth2inpdir=../inp_historic/


#outfiles
outfile=output.eps
outfile=output.ps
out_jpg=output.jpg
#colormaps
landcpt=land_man.cpt
Expand Down

0 comments on commit f6ce7f9

Please sign in to comment.