Commit 5e251205 authored by Ralf Greve's avatar Ralf Greve
Browse files

Antarctica, Greenland: Shell scripts make_{climatology,H_ref}.sh

added for extracting the climatology and reference thickness
from time-slice output files.
parent 4f0db1bf
......@@ -21,8 +21,10 @@ my_*
!/src/subroutines/xyz/*/
/sico_in/ant/*
!/sico_in/ant/make_*
!/sico_in/ant/phys_para*
/sico_in/grl/*
!/sico_in/grl/make_*
!/sico_in/grl/phys_para*
/sico_in/asf/*
!/sico_in/asf/phys_para*
......
#!/bin/bash
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# make_H_ref.sh Date: 2022-06-05
#
# Description:
#
# Generate reference ice thickness for a given time from a
# SICOPOLIS output file.
#
# Example:
#
# ./make_H_ref.sh \
# -d /work/sicopolis/ant08_hist \
# -m ant08_hist -n 0001 -y 2015
#
# -> create reference ice thickness (ant08_hist0001_H_ref_2015.nc)
# from output file ant08_hist0001.nc
# in directory /work/sicopolis/ant08_hist
# for the year 2015.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# set -x
#-------- Flags --------
while getopts d:m:n:ty:z: flag
do
case ${flag} in
d) outdir=${OPTARG};;
m) runname=${OPTARG};;
n) ergnum=${OPTARG};;
t) two_d_file="TRUE";;
y) year=${OPTARG};;
esac
done
if [ $two_d_file ]; then
two_d="_2d_"
else
two_d=""
fi
#-------- Settings --------
dir1="${outdir}"
dir2="."
filename1="${runname}${two_d}${ergnum}.nc"
filename2="${runname}${two_d}${ergnum}_H_ref_${year}.nc"
filename3="${dir1}/${filename1}"
filename4="${dir2}/${filename2}"
#-------- Extracting ice thickness from SICOPOLIS output file --------
echo "Creating ${filename2}..." ;
# ncks -O -F -v crs,x,y,lon,lat,H ${filename3} ${filename4}
ncks -O -F -v mapping,x,y,lon,lat,H ${filename3} ${filename4}
#-------- End of script --------
echo "Done." ;
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#!/bin/bash
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# make_climatology.sh Date: 2022-06-05
#
# Description:
#
# Generate climatology (SMB, ST, reference elevation) for a given
# time interval from a SICOPOLIS output file.
#
# SICOPOLIS must have been run with the settings
# #define OUTPUT_FLUX_VARS 2
# #define CLIMATOLOGY_EXTRACTION_HACK
# in the run-specs header, and the output file must be valid for the
# desired time interval (this is not checked!).
#
# Examples:
#
# ./make_climatology.sh \
# -d /work/sicopolis/ant08_spinup_clim \
# -m ant08_spinup_clim -n 0003 -y 1960 -z 1989
#
# -> create climatology (ant08_spinup_clim_1960-1989.nc)
# from output file ant08_spinup_clim0003.nc
# in directory /work/sicopolis/ant08_spinup_clim
# for the period 1960-1989.
#
# ./make_climatology.sh \
# -d /work/sicopolis/ant08_hist_clim \
# -m ant08_hist_clim -n 0002 -t -y 1995 -z 2014
#
# -> create climatology (ant08_hist_clim_1995-2014.nc)
# from output file ant08_hist_clim_2d_0002.nc
# in directory /work/sicopolis/ant08_hist_clim
# for the period 1995-2014.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# set -x
#-------- Flags --------
while getopts d:m:n:ty:z: flag
do
case ${flag} in
d) outdir=${OPTARG};;
m) runname=${OPTARG};;
n) ergnum=${OPTARG};;
t) two_d_file="TRUE";;
y) year1=${OPTARG};;
z) year2=${OPTARG};;
esac
done
if [ $two_d_file ]; then
two_d="_2d_"
else
two_d=""
fi
#-------- Settings --------
dir1="${outdir}"
dir2="."
filename1="${runname}${two_d}${ergnum}.nc"
filename2="${runname}_${year1}-${year2}.nc"
filename3="${dir1}/${filename1}"
filename4="${dir2}/${filename2}"
#-------- Extracting climatology from SICOPOLIS output file --------
echo "Creating ${filename2}..." ;
# ncks -O -F -v crs,x,y,lon,lat,temp_maat,as_perp,zs ${filename3} ${filename4}
ncks -O -F -v mapping,x,y,lon,lat,temp_maat,as_perp,zs ${filename3} ${filename4}
ncrename -v temp_maat,ST_clim ${filename4}
ncrename -v as_perp,SMB_clim ${filename4}
ncrename -v zs,surf_elev_ref ${filename4}
#-------- End of script --------
echo "Done." ;
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#!/bin/bash
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# make_H_ref.sh Date: 2022-06-05
#
# Description:
#
# Generate reference ice thickness for a given time from a
# SICOPOLIS output file.
#
# Example:
#
# ./make_H_ref.sh \
# -d /work/sicopolis/grl05_hist \
# -m grl05_hist -n 0001 -y 2015
#
# -> create reference ice thickness (grl05_hist0001_H_ref_2015.nc)
# from output file grl05_hist0001.nc
# in directory /work/sicopolis/grl05_hist
# for the year 2015.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# set -x
#-------- Flags --------
while getopts d:m:n:ty:z: flag
do
case ${flag} in
d) outdir=${OPTARG};;
m) runname=${OPTARG};;
n) ergnum=${OPTARG};;
t) two_d_file="TRUE";;
y) year=${OPTARG};;
esac
done
if [ $two_d_file ]; then
two_d="_2d_"
else
two_d=""
fi
#-------- Settings --------
dir1="${outdir}"
dir2="."
filename1="${runname}${two_d}${ergnum}.nc"
filename2="${runname}${two_d}${ergnum}_H_ref_${year}.nc"
filename3="${dir1}/${filename1}"
filename4="${dir2}/${filename2}"
#-------- Extracting ice thickness from SICOPOLIS output file --------
echo "Creating ${filename2}..." ;
# ncks -O -F -v crs,x,y,lon,lat,H ${filename3} ${filename4}
ncks -O -F -v mapping,x,y,lon,lat,H ${filename3} ${filename4}
#-------- End of script --------
echo "Done." ;
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#!/bin/bash
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# make_climatology.sh Date: 2022-06-05
#
# Description:
#
# Generate climatology (SMB, ST, reference elevation) for a given
# time interval from a SICOPOLIS output file.
#
# SICOPOLIS must have been run with the settings
# #define OUTPUT_FLUX_VARS 2
# #define CLIMATOLOGY_EXTRACTION_HACK
# in the run-specs header, and the output file must be valid for the
# desired time interval (this is not checked!).
#
# Example:
#
# ./make_climatology.sh \
# -d /work/sicopolis/grl05_paleo_clim \
# -m grl05_paleo_clim -n 0004 -y 1960 -z 1989
#
# -> create climatology (grl05_paleo_clim_1960-1989.nc)
# from output file grl05_paleo_clim0004.nc
# in directory /work/sicopolis/grl05_paleo_clim
# for the period 1960-1989.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# set -x
#-------- Flags --------
while getopts d:m:n:ty:z: flag
do
case ${flag} in
d) outdir=${OPTARG};;
m) runname=${OPTARG};;
n) ergnum=${OPTARG};;
t) two_d_file="TRUE";;
y) year1=${OPTARG};;
z) year2=${OPTARG};;
esac
done
if [ $two_d_file ]; then
two_d="_2d_"
else
two_d=""
fi
#-------- Settings --------
dir1="${outdir}"
dir2="."
filename1="${runname}${two_d}${ergnum}.nc"
filename2="${runname}_${year1}-${year2}.nc"
filename3="${dir1}/${filename1}"
filename4="${dir2}/${filename2}"
#-------- Extracting climatology from SICOPOLIS output file --------
echo "Creating ${filename2}..." ;
# ncks -O -F -v crs,x,y,lon,lat,temp_maat,as_perp,zs ${filename3} ${filename4}
ncks -O -F -v mapping,x,y,lon,lat,temp_maat,as_perp,zs ${filename3} ${filename4}
ncrename -v temp_maat,ST_clim ${filename4}
ncrename -v as_perp,SMB_clim ${filename4}
ncrename -v zs,surf_elev_ref ${filename4}
#-------- End of script --------
echo "Done." ;
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment