Skip to content

Commit

Permalink
Sea-ice analysis insertion (#2584)
Browse files Browse the repository at this point in the history
Allows cycling and restarting CICE with the sea-ice analysis if the
marine DA is switched on.

Resolves #2568 
Resolves NOAA-EMC/GDASApp#1103
  • Loading branch information
guillaumevernieres authored May 22, 2024
1 parent 5369a1f commit 7d2c539
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
3 changes: 2 additions & 1 deletion jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_POST
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ export CDATE=${CDATE:-${PDY}${cyc}}
export GDUMP=${GDUMP:-"gdas"}

# Generate COM variables from templates
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COM_OCEAN_ANALYSIS COM_ICE_RESTART
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COM_OCEAN_ANALYSIS COM_ICE_ANALYSIS COM_ICE_RESTART

mkdir -p "${COM_OCEAN_ANALYSIS}"
mkdir -p "${COM_ICE_ANALYSIS}"
mkdir -p "${COM_ICE_RESTART}"

##############################################
Expand Down
2 changes: 1 addition & 1 deletion jobs/JGLOBAL_FORECAST
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ declare -rx gcyc="${GDATE:8:2}"

# Construct COM variables from templates (see config.com)
YMD="${PDY}" HH="${cyc}" declare_from_tmpl -rx COM_ATMOS_RESTART COM_ATMOS_INPUT COM_ATMOS_ANALYSIS \
COM_ATMOS_HISTORY COM_ATMOS_MASTER COM_TOP COM_CONF
COM_ICE_ANALYSIS COM_ATMOS_HISTORY COM_ATMOS_MASTER COM_TOP COM_CONF

RUN="${rCDUMP}" YMD="${gPDY}" HH="${gcyc}" declare_from_tmpl -rx \
COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL
Expand Down
1 change: 1 addition & 0 deletions parm/config/gfs/config.com
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ declare -rx COM_OCEAN_NETCDF_TMPL=${COM_BASE}'/products/ocean/netcdf'
declare -rx COM_OCEAN_GRIB_TMPL=${COM_BASE}'/products/ocean/grib2'
declare -rx COM_OCEAN_GRIB_GRID_TMPL=${COM_OCEAN_GRIB_TMPL}'/${GRID}'

declare -rx COM_ICE_ANALYSIS_TMPL=${COM_BASE}'/analysis/ice'
declare -rx COM_ICE_INPUT_TMPL=${COM_BASE}'/model_data/ice/input'
declare -rx COM_ICE_HISTORY_TMPL=${COM_BASE}'/model_data/ice/history'
declare -rx COM_ICE_RESTART_TMPL=${COM_BASE}'/model_data/ice/restart'
Expand Down
15 changes: 9 additions & 6 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ FV3_out() {
# Copy the final restart files at the end of the forecast segment
# The final restart written at the end of the forecast does not include the valid date
# TODO: verify the above statement since RM found that it did!
# TODO: For other components, this is only for gfs/gefs - check to see if this should also have this
if [[ "${COPY_FINAL_RESTARTS}" == "YES" ]]; then
# TODO: For other components, this is only for gfs/gefs - check to see if this should also have this
if [[ "${COPY_FINAL_RESTARTS}" == "YES" ]]; then
echo "Copying FV3 restarts for 'RUN=${RUN}' at the end of the forecast segment: ${forecast_end_cycle}"
for fv3_restart_file in "${fv3_restart_files[@]}"; do
restart_file="${forecast_end_cycle:0:8}.${forecast_end_cycle:8:2}0000.${fv3_restart_file}"
${NCP} "${DATArestart}/FV3_RESTART/${restart_file}" \
"${COM_ATMOS_RESTART}/${restart_file}"
done
fi
fi
echo "SUB ${FUNCNAME[0]}: Output data for FV3 copied"
}

Expand Down Expand Up @@ -499,7 +499,7 @@ MOM6_out() {
${NCP} "${DATArestart}/MOM6_RESTART/${restart_file}" \
"${COM_OCEAN_RESTART}/${restart_file}"
done
fi
fi
fi

# Copy restarts for the next cycle for RUN=gdas|enkfgdas|enkfgfs
Expand Down Expand Up @@ -527,6 +527,9 @@ CICE_postdet() {
else # "${RERUN}" == "NO"
restart_date="${model_start_date_current_cycle}"
cice_restart_file="${COM_ICE_RESTART_PREV}/${restart_date:0:8}.${restart_date:8:2}0000.cice_model.res.nc"
if [[ "${DO_JEDIOCNVAR:-NO}" == "YES" ]]; then
cice_restart_file="${COM_ICE_ANALYSIS}/${restart_date:0:8}.${restart_date:8:2}0000.cice_model_anl.res.nc"
fi
fi

# Copy CICE ICs
Expand Down Expand Up @@ -592,7 +595,7 @@ CICE_out() {
target_file="${forecast_end_cycle:0:8}.${forecast_end_cycle:8:2}0000.cice_model.res.nc"
${NCP} "${DATArestart}/CICE_RESTART/${source_file}" \
"${COM_ICE_RESTART}/${target_file}"
fi
fi
fi

# Copy restarts for next cycle for RUN=gdas|enkfgdas|enkfgfs
Expand Down Expand Up @@ -728,7 +731,7 @@ CMEPS_out() {
else
echo "Mediator restart '${DATArestart}/CMEPS_RESTART/${source_file}' not found."
fi
fi
fi

# Copy restarts for the next cycle to COM for RUN=gdas|enkfgdas|enkfgfs
if [[ "${RUN}" =~ "gdas" || "${RUN}" == "enkfgfs" ]]; then
Expand Down
8 changes: 6 additions & 2 deletions workflow/setup_expt.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def fill_ROTDIR_cycled(host, inputs):
dst_ocn_rst_dir = os.path.join('model_data', 'ocean', 'restart')
dst_ocn_anl_dir = os.path.join('analysis', 'ocean')
dst_ice_rst_dir = os.path.join('model_data', 'ice', 'restart')
dst_ice_anl_dir = os.path.join('analysis', 'ice')
dst_atm_anl_dir = os.path.join('analysis', 'atmos')

if flat_structure:
Expand All @@ -111,13 +112,15 @@ def fill_ROTDIR_cycled(host, inputs):
src_ocn_rst_dir = os.path.join('ocean', 'RESTART')
src_ocn_anl_dir = 'ocean'
src_ice_rst_dir = os.path.join('ice', 'RESTART')
src_ice_anl_dir = dst_ice_anl_dir
src_atm_anl_dir = 'atmos'
else:
src_atm_dir = dst_atm_dir
src_med_dir = dst_med_dir
src_ocn_rst_dir = dst_ocn_rst_dir
src_ocn_anl_dir = dst_ocn_anl_dir
src_ice_rst_dir = dst_ice_rst_dir
src_ice_anl_dir = dst_ice_anl_dir
src_atm_anl_dir = dst_atm_anl_dir

def link_files_from_src_to_dst(src_dir, dst_dir):
Expand Down Expand Up @@ -203,8 +206,9 @@ def link_files_from_src_to_dst(src_dir, dst_dir):

# Link ice files
if do_ice:
dst_dir = os.path.join(rotdir, previous_cycle_dir, dst_ice_rst_dir)
src_dir = os.path.join(inputs.icsdir, previous_cycle_dir, src_ice_rst_dir)
# First 1/2 cycle needs a CICE6 analysis restart
src_dir = os.path.join(inputs.icsdir, current_cycle_dir, src_ice_anl_dir)
dst_dir = os.path.join(rotdir, current_cycle_dir, src_ice_anl_dir)
makedirs_if_missing(dst_dir)
link_files_from_src_to_dst(src_dir, dst_dir)

Expand Down

0 comments on commit 7d2c539

Please sign in to comment.