Skip to content

Commit

Permalink
Merge pull request #1172 from esm-tools/fix/awiesm_pism_cpl
Browse files Browse the repository at this point in the history
Fix/awiesm pism cpl
  • Loading branch information
mandresm authored Apr 30, 2024
2 parents 1a5f08c + d253df4 commit 4849202
Show file tree
Hide file tree
Showing 23 changed files with 29 additions and 59 deletions.
1 change: 1 addition & 0 deletions configs/components/pism/pism.recipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ prepcompute_recipe:

- "assemble"
- "log_used_files"
- "wait_for_iterative_coupling"
- "_write_finalized_config"
#- "assemble_filelists"
#- "copy_tools_to_thisrun"
Expand Down
3 changes: 2 additions & 1 deletion couplings/fesom/coupling_fesom2ice.functions
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ function fesom_ice_concatenate_files {
echo ""; echo " * concatenating files"
# New cdo versions sometimes do not allow to overwrite files for
# "collective" commands. Hence delete existing old output file
[[ -f temp.tmp.nc ]] && rm temp.tmp.nc
[[ -f salt.tmp.nc ]] && rm salt.tmp.nc
[[ -f ocean_file_for_ice.nc ]] && rm ocean_file_for_ice.nc
${cdo} -s ensmean ${processed_fesom1x_file3D_T_list_for_ice} temp.tmp.nc
${cdo} -s ensmean ${processed_fesom1x_file3D_S_list_for_ice} salt.tmp.nc
Expand All @@ -573,7 +575,6 @@ function fesom_ice_concatenate_files {
# ${processed_fesom1x_file2D_list_for_ice} \
# ${processed_fesom1x_file2Dstatic_list_for_ice} \
# ocean_file_for_ice.nc

_flag_extract_depth=1
# Extract depth axis and Clean up temporary files
for file in \
Expand Down
38 changes: 3 additions & 35 deletions couplings/fesom/coupling_ice2fesom.functions
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ function ice2fesom {
. ${FUNCTION_PATH}/../pism/coupling_ocean2pism.functions

echo "ICE_TO_FESOM=${ICE_TO_FESOM:-0}"
if [[ "x$ICE_TO_FESOM" == "x0" ]]; then
if [[ "x$ICE_TO_FESOM"=="x0" ]]; then
echo " NOT generating ice forcing for ocean model"
echo " since ICE_TO_FESOM=${ICE_TO_FESOM}"
return
echo " since ICE_TO_FESOM=${ICE_TO_FESOM}"
return
else
echo " Only generating iceberg forcing so far ..."
iterative_coupling_pism_ocean_prepare_ocean_icebergmodel_forcing
Expand Down Expand Up @@ -230,41 +230,9 @@ function iterative_coupling_pism_ocean_prepare_ocean_icebergmodel_forcing {
cdo -s -timmean -selname,tendency_of_ice_amount_due_to_discharge \
-setgrid,${COUPLE_DIR}/ice.griddes ${pism_discharge_file} ${COUPLE_DIR}/latest_discharge.nc

#module unload python
#if [ "$MACHINE" == "ollie" ]; then
# module load python3/3.7.7_intel2020u2
#elif [ "$MACHINE" == "mistral" ]; then
# module load anaconda3/bleeding_edge
#fi
#if [ -f ${COUPLE_DIR}/num_non_melted_icb_file ]; then
# rm ${COUPLE_DIR}/num_non_melted_icb_file
#fi

#if [[ "xMESH_ROTATED_fesom"=="x1" ]]; then
# if [[ ! -f ${COUPLE_DIR}/nod2d.out.rot ]]; then
# python ${FUNCTION_PATH}/../utils/rotate_mesh.py ${MESH_DIR_fesom} ${COUPLE_DIR}
# cp ${MESH_DIR_fesom}/elem2d.out ${COUPLE_DIR}/elem2d.out
# fi
# python ${FUNCTION_PATH}/../utils/icb_apply_distribution.py ${COUPLE_DIR}/latest_discharge.nc ${COUPLE_DIR} ${COUPLE_DIR} ${BASIN_FILE}
#else
# python ${FUNCTION_PATH}/../utils/icb_apply_distribution.py ${COUPLE_DIR}/latest_discharge.nc ${MESH_DIR_fesom} ${COUPLE_DIR} ${BASIN_FILE}
#fi

#echo; echo " * Finished iceberg generation"
#if [ -f ${COUPLE_DIR}/../restart/fesom/iceberg.restart.ISM ]; then
# wc -l ${COUPLE_DIR}/../restart/fesom/iceberg.restart.ISM | awk '{ print $1 }' > ${COUPLE_DIR}/num_non_melted_icb_file
#fi
use_icesheet_coupling=1
}

#function get_ib_num_after_ice_sheet_coupling {
# _a="$( wc -l icb/LON.dat | awk '{ print $1 }' )"
# _b="$( cat ../icb/num_non_melted_icb_file )"
#
# ib_num=$(( $_a + $_b ))
# general_replace_namelist_value namelist.config icebergs ib_num $ib_num
# general_replace_namelist_value namelist.config icebergs use_icesheet_coupling ".true."
#}
############################################################################
############################################################################

Expand Down
2 changes: 1 addition & 1 deletion couplings/fesom/env_fesom.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def prepare_environment(config):
"EXP_ID": config["general"]["command_line_config"]["expid"],
"iter_coup_regrid_method_ice2oce": "INTERPOLATE",
"fesom_use_icebergs": config["fesom"].get("use_icebergs", ""),
"BASIN_FILE": config["fesom"].get("basin_file"),
#"BASIN_FILE": config["fesom"].get("basin_file"),
"MACHINE": config["computer"]["name"],
"ICEBERG_DIR": config["fesom"].get("iceberg_dir", ""),

Expand Down
2 changes: 1 addition & 1 deletion couplings/pism/coupling_atmosphere2pism.functions
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ ic_atm2debm_ablation_debm_run_modify_nml() {
TMP=$( grep cobld $( ls -t ${COUPLE_DIR}/../run_*/work/namelist.echam | head -1 ) | sed 's/^[ \t]*//' )
prefix="cobld = "
MY_OBLIQUITY=${TMP#"$prefix"}
obliquity_value=${MY_OBLIQUITY:-"23.17"}
obliquity_value=${MY_OBLIQUITY:-"23.441"}

echo -e "\t\t- Generating namelist for dEBM Mass Balance Model"
echo -e "\t\t- Obliquity = ${obliquity_value}"
Expand Down
4 changes: 2 additions & 2 deletions couplings/pism/coupling_pism2atmosphere.functions
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ function pism_atmosphere_get_newest_output {

# Define list of variables selected from PISM output depending on whether icebergs are used or not
if [ "x${fesom_use_iceberg}" == "x1" ]; then
echo "LA DEBUG: 1"
echo " * use iceberg coupling and exclude iceberg discharge from mass balance"
CDO_SELECT_VAR_LIST="thk,climatic_mass_balance,topg,${OROG_VARNAME_pism},${GLACIAL_MASK_VARNAME_pism},tendency_of_ice_amount,tendency_of_ice_amount_due_to_conservation_error,tendency_of_ice_amount_due_to_surface_mass_flux,tendency_of_ice_amount_due_to_basal_mass_flux,tendency_of_ice_amount_due_to_discharge,tendency_of_ice_amount_due_to_flow"
else
echo "LA DEBUG: 2"
echo " * no iceberg coupling"
CDO_SELECT_VAR_LIST="thk,climatic_mass_balance,topg,${OROG_VARNAME_pism},${GLACIAL_MASK_VARNAME_pism},tendency_of_ice_amount"
fi

Expand Down
6 changes: 3 additions & 3 deletions couplings/utils/fesom_scalar_array_to_LonLat.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def parse_arguments():
#
#print('* Read the data file args.FESOM_FILE=' + " ".join(args.FESOM_FILE))
#FID = MFDataset(args.FESOM_PATH + "".join("/temp.fesom.*.01.nc"))
FID = xr.open_dataset(str(args.FESOM_PATH[0]) + str(args.FESOM_VARIABLE[0]) + ".fesom." + str(args.FESOM_YEARS[0]) + ".nc")
FID = xr.open_dataset(str(args.FESOM_PATH[0]) + str(args.FESOM_VARIABLE[0]) + ".fesom." + str(args.FESOM_YEARS[0]) + ".nc", decode_times=False)

# ----------------------------------------------------------------
#
Expand Down Expand Up @@ -164,7 +164,7 @@ def parse_arguments():
#
# Prepare data for final netcdf output
#
#ilevel = ilevel + 1
ilevel = ilevel + 1

flag_verbose=False

Expand All @@ -173,7 +173,7 @@ def parse_arguments():
pf.get_data(args.FESOM_PATH[0], args.FESOM_VARIABLE[0], int(args.FESOM_YEARS[0]), mesh, depth=idepth, how="mean") #, flag_verbose)
else:
level_data = \
pf.get_data(args.FESOM_PATH[0], args.FESOM_VARIABLE[0], [int(args.FESOM_YEARS[0]), int(args.FESOM_YEARS[1])], mesh, depth=idepth, how="mean") #, flag_verbose)
pf.get_data(args.FESOM_PATH[0], args.FESOM_VARIABLE[0], [int(args.FESOM_YEARS[0]), int(args.FESOM_YEARS[1])], mesh, depth=idepth, how="mean", use_cftime=True) #, flag_verbose)
level_data[np.where(np.isnan(level_data))] = NAN_REPLACE
TempFields_out[itime, ilevel, :] = level_data

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 6.29.4
current_version = 6.29.5
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/esm-tools/esm_tools",
version="6.29.4",
version="6.29.5",
zip_safe=False,
)
2 changes: 1 addition & 1 deletion src/esm_archiving/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__author__ = """Paul Gierz"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .esm_archiving import (archive_mistral, check_tar_lists,
delete_original_data, determine_datestamp_location,
Expand Down
2 changes: 1 addition & 1 deletion src/esm_calendar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .esm_calendar import *
2 changes: 1 addition & 1 deletion src/esm_cleanup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"
2 changes: 1 addition & 1 deletion src/esm_database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"
2 changes: 1 addition & 1 deletion src/esm_environment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .esm_environment import *
2 changes: 1 addition & 1 deletion src/esm_master/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"


from . import database
2 changes: 1 addition & 1 deletion src/esm_motd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .esm_motd import *
2 changes: 1 addition & 1 deletion src/esm_parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"


from .esm_parser import *
Expand Down
2 changes: 1 addition & 1 deletion src/esm_plugin_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

__author__ = """Dirk Barbi, Paul Gierz, Sebastian Wahl"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .esm_plugin_manager import *
2 changes: 1 addition & 1 deletion src/esm_profile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .esm_profile import *
2 changes: 1 addition & 1 deletion src/esm_runscripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Dirk Barbi"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .batch_system import *
from .chunky_parts import *
Expand Down
2 changes: 1 addition & 1 deletion src/esm_tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Miguel Andres-Martinez"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .initialization import *
from .read_shipped_data import *
Expand Down
2 changes: 1 addition & 1 deletion src/esm_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

__author__ = """Dirk Barbi, Paul Gierz"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

import functools
import inspect
Expand Down
2 changes: 1 addition & 1 deletion src/esm_utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

__author__ = """Paul Gierz"""
__email__ = "[email protected]"
__version__ = "6.29.4"
__version__ = "6.29.5"

from .utils import *

0 comments on commit 4849202

Please sign in to comment.