初期水位分布 プロット メモ

コード例

計算したディレクトリの直下で簡単にプロットするスクリプト.

## directory
figdir="_initl"
if [ ! -e $figdir ]; then
    mkdir $figdir
fi

## makecpt
cpt="tmpinitl.cpt"
gmt makecpt -Cpolar -T-1/1 -D > $cpt


## plot for each
for f in SD0[0-9].initl_disp*.grd
do

    ## filename
    outps=${f//\.grd/\.ps}

    ## plot
    proj="X"$(gmt grdinfo $f -Cn -o0,1,2,3  | awk '{print 10"/"10*($4-$3)/($2-$1)}')
    #echo $proj

    gmt grdimage $f -J$proj -Baf -BneSW+t$f -R$f -C$cpt -K > $outps
    gmt psscale -C$cpt -Bxa0.5f0.1 -By+lm -DJMR+w5.0/0.3+o1.0/0.0+e -J$proj -R$f -O >> $outps

    ## convert
    ps2pdf $outps ${outps//.ps/.pdf} && rm $outps # PDF
    pdfcrop --margins '5 5 5 5' ${outps//.ps/.pdf} | grep -iv pdf # PDF crop
    convert -density 300 ${outps//.ps/-crop.pdf} ${outps//.ps/.png} && rm ${outps//.ps/.pdf} # PDF to PNG

    ## move
    mv ${outps//.ps/-crop.pdf} ${outps//.ps/.png} $figdir/

done

rm $cpt

出力例

nankai03_SD01.initl_disp001.png nankai03_SD01.initl_disp003.png nankai03_SD01.initl_disp006.png


Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2021-05-12 (Wed) 16:42:05 (38d)