Commit b9a6a95d authored by Paul Gierz's avatar Paul Gierz

index file is shipped with rest, and some fixes in Shans coupling routines

parent f8022dd8
......@@ -179,9 +179,9 @@ ic_atm2pism_regrid_dyn_downscale() {
ic_atm2pism_regrid_dyn_downscale_generate_elevation_difference
ic_atm2pism_regrid_dyn_downscale_temperature
ic_atm2pism_regrid_dyn_downscale_precipitation
#ic_atm2pism_regrid_dyn_downscale_shortwave_downward_radiation
#ic_atm2pism_regrid_dyn_downscale_longwave_downward_radiation
#ic_atm2pism_regrid_dyn_downscale_cloud_cover
ic_atm2pism_regrid_dyn_downscale_shortwave_downward_radiation
ic_atm2pism_regrid_dyn_downscale_longwave_downward_radiation
ic_atm2pism_regrid_dyn_downscale_cloud_cover
echo; echo -e "\t\t...done."; echo
}
......@@ -201,9 +201,9 @@ ic_atm2pism_regrid_downscale() {
ic_atm2pism_regrid_downscale_generate_elevation_difference
ic_atm2pism_regrid_downscale_temperature
ic_atm2pism_regrid_downscale_precipitation
#ic_atm2pism_regrid_downscale_shortwave_downward_radiation
#ic_atm2pism_regrid_downscale_longwave_downward_radiation
#ic_atm2pism_regrid_downscale_cloud_cover
ic_atm2pism_regrid_downscale_shortwave_downward_radiation
ic_atm2pism_regrid_downscale_longwave_downward_radiation
ic_atm2pism_regrid_downscale_cloud_cover
echo; echo -e "\t\t...done."; echo
}
......@@ -1125,7 +1125,9 @@ ic_debm2pism_ablation_debm_set_options_surface_given() {
:> $pism_conf_file
fi
done
echo "pism_set_coupler___surface=given" \
>> ${COUPLE_DIR}/pism_coupler_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat
echo "pism_set_forcing_file___surface_given=${COUPLE_DIR}/surface_given_file_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.nc" >> \
${COUPLE_DIR}/pism_forcing_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat
echo "pism_set_config_value_FORCE___surface_given_period=$(cdo -s nyear ${COUPLE_DIR}/surface_given_file_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.nc)" \
......@@ -1261,8 +1263,8 @@ ic_atm2debm_ablation_debm_run_execute_binary() {
ic_debm2pism_ablation_debm_make_surface_forcing_add_surface_temperature() {
echo -e "\t\t- Adding yearly-averaged atmospheric surface temperature to surface given file"
echo -e "\t\t NOTE: this serves as a first-order estimate for surface temperature below the firn layer"
echo -e "\t\t- Adding yearly-averaged atmospheric surface temperature (max allowed range 273.15K) to surface given file"
echo -e "\t\t NOTE: this serves as a first-order estimate for temperature below the firn layer"
debug_add_surface_temperature=${debug_add_surface_temperature:-0}
if [ "x${debug_add_surface_temperature}" == "x1" ]; then
......@@ -1271,25 +1273,10 @@ ic_debm2pism_ablation_debm_make_surface_forcing_add_surface_temperature() {
# select air_temperature
cdo -s \
-timmean \
-setrtoc,273.15,400,273.15 \
-selvar,air_temp \
${COUPLE_DIR}/input_file_for_debm_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.nc \
tmp0 2>> ${COUPLE_DIR}/cdo_stderr_atm2pism
if [ "x${debug_add_surface_temperature}" == "x1" ]; then
echo -e "\t\t@ DEBUG: Determining temperature scale Kelvin vs Celsius"
fi
cdo -s \
-setmisstoc,273.15
-ifthen \
-ltc,273.15 \
tmp0 \
tmp0 \
tmp 1>> ${COUPLE_DIR}/cdo_stderr_atm2pism 2>&1
cdo -s \
-setmisstoc,273.15 \
tmp \
tmp1 1>> ${COUPLE_DIR}/cdo_stderr_atm2pism 2>&1
tmp1 2>> ${COUPLE_DIR}/cdo_stderr_atm2pism
if [ "x${debug_add_surface_temperature}" == "x1" ]; then
echo -e "\t\t@ DEBUG: Duplicating array 12x"
......@@ -1298,11 +1285,8 @@ ic_debm2pism_ablation_debm_make_surface_forcing_add_surface_temperature() {
cdo -s \
cat \
tmp1 tmp1 tmp1 tmp1 tmp1 tmp1 \
tmp6 1>> ${COUPLE_DIR}/cdo_stderr_atm2pism 2>&1
cdo -s \
cat \
tmp6 tmp6 \
tmp12 2>> ${COUPLE_DIR}/cdo_stderr_atm2pism
tmp1 tmp1 tmp1 tmp1 tmp1 tmp1 \
tmp12 1>> ${COUPLE_DIR}/cdo_stderr_atm2pism 2>&1
if [ "x${debug_add_surface_temperature}" == "x1" ]; then
echo -e "\t\t@ DEBUG: Setting time axis"
......@@ -1311,7 +1295,12 @@ ic_debm2pism_ablation_debm_make_surface_forcing_add_surface_temperature() {
-settaxis,1000-01-16,12:00:00,1mon \
tmp12 \
air_temp_copy.nc 2>> ${COUPLE_DIR}/cdo_stderr_atm2pism
rm tmp0 tmp tmp1 tmp6 tmp12
for cleanup_file in tmp0 tmp tmp1 tmp6 tmp12; do
if [ -f $cleanup_file ]; then
rm $cleanup_file
fi
done
if [ "x${debug_add_surface_temperature}" == "x1" ]; then
echo -e "\t\t@ DEBUG: Multi-year monthly means"
......@@ -1319,6 +1308,7 @@ ic_debm2pism_ablation_debm_make_surface_forcing_add_surface_temperature() {
# merge air_temp with debm output files
# & set time axies
# PG: Why is this set to noon on the year 1000? Does that have any reason?
# TODO: (UKK): Figure out what the time axis is
cdo -s \
-ymonmean \
-settaxis,1000-01-16,12:00:00,1mon \
......
-120 1
-119 0.99
-118 0.98
-117 0.97
-116 0.96
-115 0.95
-114 0.94
-113 0.93
-112 0.92
-111 0.91
-110 0.9
-109 0.89
-108 0.88
-107 0.87
-106 0.86
-105 0.85
-104 0.84
-103 0.83
-102 0.82
-101 0.81
-100 0.8
-99 0.79
-98 0.78
-97 0.77
-96 0.76
-95 0.75
-94 0.74
-93 0.73
-92 0.72
-91 0.71
-90 0.7
-89 0.69
-88 0.68
-87 0.67
-86 0.66
-85 0.65
-84 0.64
-83 0.63
-82 0.62
-81 0.61
-80 0.6
-79 0.59
-78 0.58
-77 0.57
-76 0.56
-75 0.55
-74 0.54
-73 0.53
-72 0.52
-71 0.51
-70 0.5
-69 0.49
-68 0.48
-67 0.47
-66 0.46
-65 0.45
-64 0.44
-63 0.43
-62 0.42
-61 0.41
-60 0.4
-59 0.39
-58 0.38
-57 0.37
-56 0.36
-55 0.35
-54 0.34
-53 0.33
-52 0.32
-51 0.31
-50 0.3
-49 0.29
-48 0.28
-47 0.27
-46 0.26
-45 0.25
-44 0.24
-43 0.23
-42 0.22
-41 0.21
-40 0.2
-39 0.19
-38 0.18
-37 0.17
-36 0.16
-35 0.15
-34 0.14
-33 0.13
-32 0.12
-31 0.11
-30 0.1
-29 0.09
-28 0.08
-27 0.07
-26 0.06
-25 0.05
-24 0.04
-23 0.03
-22 0.02
-21 0.01
-20 0
......@@ -306,9 +306,9 @@ pism_prepare_config() {
if [[ "x$iterative_coupling" == "x1" ]] || [[ "x${offline_index}" == "x1" ]]; then
for couple_type in coupler config_value forcing; do
mecho "Looking for ${COUPLE_DIR}/pism_${couple_type}_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat"
echo "Looking for ${COUPLE_DIR}/pism_${couple_type}_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat"
if [ -f ${COUPLE_DIR}/pism_${couple_type}_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat ]; then
mecho "Found ${COUPLE_DIR}/pism_${couple_type}_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat"
echo "Found ${COUPLE_DIR}/pism_${couple_type}_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat"
source ${COUPLE_DIR}/pism_${couple_type}_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat
else
echo "Could not find ${COUPLE_DIR}/pism_${couple_type}_${CHUNK_START_DATE_pism}-${CHUNK_END_DATE_pism}.dat"
......@@ -413,7 +413,8 @@ pism_prepare_forcing() {
COUPLE_DIR=$(pwd)/fake_couple
cd $COUPLE_DIR
index_file=${index_file:-/home/ollie/ukrebska/python_scripts/index.dat}
index_file=${index_file:-${FUNCTION_PATH}/index.dat}
echo "Index File: $index_file"
echo "Index values at $RUN_NUMBER_pism"
index_values=$(sed "${RUN_NUMBER_pism}q;d" $index_file)
echo $index_values | read kyr index
......
......@@ -129,9 +129,8 @@ def index_forcing(kyr, index, infile1, infile2, outfile):
taoI * srad0dI
) # downward surf. radiation from taoI and TOA insolation from climlab
sradsuI = -albI * sradsdI # but we actually only need UPWARD surf. radiation
sradsI = (
1 - albI
) * sradsdI # and net surface radiation... I hope we can use albedo here...
# and net surface radiation... I hope we can use albedo here...
sradsI = ( 1 - albI) * sradsdI
out = xr.open_dataset(infile1)
out.temp2.values = T2I
......
Markdown is supported
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