Skip to content

Instantly share code, notes, and snippets.

@trondkr
Last active July 8, 2019 17:42
Show Gist options
  • Save trondkr/1a6223f94f1ec67760fd87f1c1389cf1 to your computer and use it in GitHub Desktop.
Save trondkr/1a6223f94f1ec67760fd87f1c1389cf1 to your computer and use it in GitHub Desktop.
Adds empty ice variables to existing BRY file so that we can run ICE model but with lacking boundary ice forcing
directions=(north south east west)
scp hunnbunn50_bry_v3.nc ${FINAL}
export FINAL=hunnbunn50_bry_v4.nc
export TMPFILE=tmp.nc
echo "Final output file will be named: " ${FINAL}
for dir in "${directions[@]}"
do
echo "Running SOUTH"
ncap2 -s 'ageice_${dir}=(temp_${dir}*0.0)' ${FINAL} ${TMPFILE}
ncap2 -s 'aice_${dir}=(temp_${dir}*0.0)' ${TMPFILE} ${FINAL}
ncap2 -s 'hice_${dir}=(temp_${dir}*0.0)' ${FINAL} ${TMPFILE}
ncap2 -s 'snow_thick_${dir}=(temp_${dir}*0.0)' ${TMPFILE} ${FINAL}
ncap2 -s 'ti_${dir}=(temp_${dir}*0.0)' ${FINAL} ${TMPFILE}
ncap2 -s 'sfwat_${dir}=(temp_${dir}0.0)' ${TMPFILE} ${FINAL}
ncap2 -s 'sig11_${dir}=(temp_${dir}*0.0)' ${FINAL} ${TMPFILE}
ncap2 -s 'sig12_${dir}=(temp_${dir}*0.0)' ${TMPFILE} ${FINAL}
ncap2 -s 'sig22_${dir}=(temp_${dir}*0.0)' ${FINAL} ${TMPFILE}
ncap2 -s 'tisrf_${dir}=(temp_${dir}*0.0)' ${TMPFILE} ${FINAL}
ncap2 -s 'uice_${dir}=(u_${dir}*0.0)' ${FINAL} ${TMPFILE}
ncap2 -s 'vice_${dir}=(v_${dir}*0.0)' ${TMPFILE} ${FINAL}
done
rm ${TMPFILE}
echo "Program finished:" ${FINAL}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment