Hi there !
Module used :
mapproject
,grdproject
,math
,grdsample
makecpt
,colorbar
grdimage
,coast
(including clipping) ,basemap
clip
movie
Full script :
Animation : sea-ice cover in Arctic sea (2016).
Stereographic projection (-Js) with some regions leaking out of the frame
(based on IBCAO map)
DATASET :
topography and bathymetry
sea-ice
Include.sh
lon_ref=0 # map centered on Greenwich meridian
lat_ref=90 # map centered on North pole
lat_min=65 # map extend to 65th parallele
lat_out=55 # (extra) map extend to cover Greenland
lat_scl=77 # true scale at this parallele
scale=1:40000000 # map size (here ~ 14cm)
# Calculation used to properly place the plotted regions falling out of the frame
W1=$(gmt mapproject -R0/360/${lat_min}/90 -Js${lon_ref}/${lat_ref}/${lat_scl}/${scale} -Ww)
H1=$(gmt mapproject -R0/360/${lat_min}/90 -Js${lon_ref}/${lat_ref}/${lat_scl}/${scale} -Wh)
W2=$(gmt mapproject -R0/360/${lat_out}/90 -Js${lon_ref}/${lat_ref}/${lat_scl}/${scale} -Ww)
H2=$(gmt mapproject -R0/360/${lat_out}/90 -Js${lon_ref}/${lat_ref}/${lat_scl}/${scale} -Wh)
dx=$(gmt math -Q $W1 $W2 SUB 2 DIV =)
dy=$(gmt math -Q $H1 $H2 SUB 2 DIV =)
Pre.sh
gmt begin
gmt makecpt -Cbukavu -T-4500/1500 -H > relief.cpt # Colormap for topography
gmt makecpt -Cvik -G-0.5/0 -T0/101/1 -H -N > ice.cpt # Colormap for sea-ice
gmt math -o0 -fT -T2016-01-01/2016-12-31/1 T --TIME_UNIT=d --FORMAT_DATE_OUT=yyyymmdd = list.txt # List of file's extension used as movie-frame (yyyymmddTHH:MM:SS)
awk -F[T] '{print $1}' list.txt > list2.txt # Trim to yyymmdd
gmt grdimage -R0/360/${lat_min}/90 -Js${lon_ref}/${lat_ref}/${lat_scl}/${scale} @earth_relief_01m -Crelief.cpt -I+d -Y4c # DEM inner region with illumination, shifted up for colorbar
gmt coast -Dh -Wthinnest,black -Ir/faint,lightblue -Baf # corresponding coast lines (+rivers) with framebox
gmt coast -ECA.NU,GL,IS+c -R0/360/${lat_out}/90 -X${dx} -Y${dy} # Prepare outter region for clipping (shifted to match first layers)
gmt clip -N << END # ... but exclude this box
-80.75 ${lat_min}
-120 ${lat_min}
-120 ${lat_out}
-80.75 ${lat_out}
END
gmt grdimage @earth_relief_01m -Crelief.cpt -I+d # DEM outter region with illumination
gmt coast -Dh -Wthinnest,black -Ir/faint,lightblue # corresponding coast lines (+rivers)
gmt clip -C # close excluded box clipping
gmt coast -Q # close outter region clipping
gmt colorbar -Cice.cpt -DJMR+w${H1}c/0.5c+o-1.5c/0c -G0/100 -Np -Bxa10f1g10+l"Sea-ice concentration" -By+l"%" # Colorbar (right) for sea-ice
gmt colorbar -Crelief.cpt -DJBC+w${W1}c/0.5c+o0c/-1.5c+h+e -G-4000/1000 -Bafg+l"Topography" -By+l"m" -I # Colorbar (bottom) for relief
gmt end
Main.sh
gmt begin
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Operation on SEA-ICE coverage data : #
# 1. Reproject from (x,y) [km relative to the pole] to (lon,lat) [degree] #
# 2. Upsample using bilinear interpolation AND remove zeros (=NaNs) #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
gmt grdproject -R0/360/${lat_min}/90 -Js${lon_ref}/${lat_ref}/${lat_scl}/${scale} data/data_${MOVIE_COL0}.nc?"ice_conc" -Gdata_bis.nc -C -I -Fk
gmt grdsample data_bis.nc+n0 -nl -I1m -Gdata_ter.nc
gmt grdimage -R0/360/${lat_min}/90 -Js${lon_ref}/${lat_ref}/${lat_scl}/${scale} data_ter.nc -Cice.cpt -Q -Y4c # plot sea-ice (ignore NaN's), aligned with main frame
gmt basemap -B+t"$(gmt math -Q -o0 -fT ${MOVIE_COL0}T --FORMAT_DATE_IN=yyyymmdd --FORMAT_DATE_OUT=yyyy-o-dd = | awk -F[-] '{print $2,$1}')" # title ([abbr. month]<space>[year])
gmt end
# Movie command (with progress circle)
gmt movie main.sh -Iinclude.sh -Sbpre.sh -Narctic_mov -C20cx21.5cx120 -Tlist2.txt -D18 -Fmp4 -Pb+jTL+o1c/1.25c
(the glitch in March is due to a missing file. I should have check more carefully)