From d8386296d53f6f803b00387704bc24d596230e95 Mon Sep 17 00:00:00 2001 From: Zulema Garraffo Date: Thu, 15 Jan 2026 14:02:19 +0000 Subject: [PATCH 1/2] modifications for mom6 incremental update nc file --- parm/rtofs_glo_ncoda_inc2mom6nc_lyr.input | 6 ++- scripts/exrtofs_glo_ncoda_hycom_var.sh | 3 +- scripts/exrtofs_glo_ncoda_inc.sh | 44 ++++++++++--------- sorc/hycom_tools_for_mom6.fd/build_all.sh | 3 ++ .../ncodaz_inc2mom6nc_glb_lyr.f | 17 ++++--- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/parm/rtofs_glo_ncoda_inc2mom6nc_lyr.input b/parm/rtofs_glo_ncoda_inc2mom6nc_lyr.input index e7b01f33..ec171de3 100644 --- a/parm/rtofs_glo_ncoda_inc2mom6nc_lyr.input +++ b/parm/rtofs_glo_ncoda_inc2mom6nc_lyr.input @@ -4,9 +4,11 @@ MOM.res_3.nc MOM.res_4.nc &TShincname &UVincname -&IDM 'idm ' = longitudinal array size -&JDM 'jdm ' = latitudinal array size +&IDM 'ii ' = longitudinal array size +&JDM 'jj ' = latitudinal array size &KDM 'kk ' = number of layers restart +1324 'itest ' = longitudinal test point (optional, default 0) +1898 'jtest ' = latitudinal test point (optional, default 0) &KDM 'kncoda' = number of NCODA levels equal to kk for layer increments 0.50 'zl ' = nominal depth of layer 1 from MOM archive 1.90 'zl ' = nominal depth of layer 2 diff --git a/scripts/exrtofs_glo_ncoda_hycom_var.sh b/scripts/exrtofs_glo_ncoda_hycom_var.sh index 55a5a306..f2530ec2 100755 --- a/scripts/exrtofs_glo_ncoda_hycom_var.sh +++ b/scripts/exrtofs_glo_ncoda_hycom_var.sh @@ -92,7 +92,8 @@ cat << eof1 > odsetnl &end eof1 -# kkm, kko, m, and n can be pulled from parm blkdat.input +# for hycom kkm, kko, m, and n can be pulled from parm blkdat.input +#for MOM, IDM,JDM can be pulled from the depth*nc file. cat << eof2 > ogridnl &gridnl delx(1) = 8896.78809, diff --git a/scripts/exrtofs_glo_ncoda_inc.sh b/scripts/exrtofs_glo_ncoda_inc.sh index 2abe2240..8947594d 100755 --- a/scripts/exrtofs_glo_ncoda_inc.sh +++ b/scripts/exrtofs_glo_ncoda_inc.sh @@ -42,13 +42,13 @@ echo dtg12 $dtg $dtgm1 $dtgm2 mode=incup #inputgrid=0.08, change to 0p08 reg=GLB -DEPTH_FILE=${FIXrtofs}/depth_${reg}${inputgrid}_09m11ob2_mom6.nc +DEPTH_FILE=${FIXrtofs}/depth_${reg}.${inputgrid}_09m11ob2_mom6.nc IDM=$(ncdump -h ${DEPTH_FILE} | grep 'nx =' | cut -d' ' -f3) JDM=$(ncdump -h ${DEPTH_FILE} | grep 'ny =' | cut -d' ' -f3) KDM=41 # or get from restart file? SIZN="${IDM}x${JDM}" -ln -f -s ${FIXrtofs}/depth_${reg}.${inputgrid}_09m11ob2_mom6.nc . +ln -f -s ${FIXrtofs}/depth_${reg}.${inputgrid}_09m11ob2_mom6.nc depth_GLBb0.08_09m11ob2_mom6.nc ln -f -s ${FIXrtofs}/regional.mom6.nc . # 2. link to ncoda hycom var restart files @@ -66,8 +66,8 @@ export vvelinc=vvel_${dtg}_analinc export lyrthbg=lyrthk_${dtgm1}_fcstfld #names can be changed. Names in INPUT will be MOM.inc.TSzh.nc, MOM.inc.UV.nc -export TShar=MOM.res_Y${jday:0:4}_D${jday:4:3}_S00000_inc.TSzh.nc -export UVar=MOM.res_Y${jday:0:4}_D${jday:4:3}_S00000_inc.TSzh.nc +export TShinc=MOM.res_Y${jday:0:4}_D${jday:4:3}_S00000_inc.TSzh.nc +export UVinc=MOM.res_Y${jday:0:4}_D${jday:4:3}_S00000_inc.UV.nc # Check for the existence of analysis increment files # These are needed to create the HYCOM incremental update file @@ -108,36 +108,35 @@ else fi # Link the MOM6 template restart files -if [ -e $COMINm1/RESTART/${dtg:0:8}_000000.MOM.res.nc]; then - ln -sf $COMINm1/RESTART/${dtg:0:8}_000000.MOM.res.nc MOM.res.nc +if [ -e $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res.nc ]; then + ln -sf $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res.nc MOM.res.nc else - msg="$COMINm1/${dtg:0:8}_000000.MOM.res.nc is missing" + msg="$COMINm1/RESTART/${dtg:0:8}.000000.MOM.res.nc is missing" err_exit $msg fi -if [ -e $COMINm1/RESTART/${dtg:0:8}_000000.MOM.res_1.nc]; then - ln -sf $COMINm1/RESTART/${dtg:0:8}_000000.MOM_1.res.nc MOM.res.nc +if [ -e $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_1.nc ]; then + ln -sf $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_1.nc MOM.res_1.nc else - msg="$COMINm1/${dtg:0:8}_000000.MOM_1.res.nc is missing" + msg="$COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_1.nc is missing" err_exit $msg fi -if [ -e $COMINm1/RESTART/${dtg:0:8}_000000.MOM_3.res.nc]; then - ln -sf $COMINm1/RESTART/${dtg:0:8}_000000.MOM_3.res.nc MOM.res.nc +if [ -e $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_3.nc ]; then + ln -sf $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_3.nc MOM.res_3.nc else - msg="$COMINm1/${dtg:0:8}_000000.MOM_3.res.nc is missing" + msg="$COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_3.nc is missing" err_exit $msg fi -if [ -e $COMINm1/RESTART/${dtg:0:8}_000000.MOM_4.res.nc]; then - ln -sf $COMINm1/RESTART/${dtg:0:8}_000000.MOM_4.res.nc MOM.res.nc +if [ -e $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_4.nc ]; then + ln -sf $COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_4.nc MOM.res_4.nc else - msg="$COMINm1/${dtg:0:8}_000000.MOM_4.res.nc is missing" + msg="$COMINm1/RESTART/${dtg:0:8}.000000.MOM.res_4.nc is missing" err_exit $msg fi - # copy modify input file with local vars -cp ${PARMrtofs}/${RUN}_${modID}.ncoda_inc2mom6nc.input ./ncoda_inc2mom6nc.input -sed -i -e "s/&TShincname/$TShar/" \ - -e "s/&UVincname/$UVar/" \ +cp ${PARMrtofs}/${RUN}_${modID}_ncoda_inc2mom6nc_lyr.input ./ncoda_inc2mom6nc_lyr.input +sed -i -e "s/&TShincname/$TShinc/g" \ + -e "s/&UVincname/$UVinc/g" \ -e "s/&IDM/$IDM/g" \ -e "s/&JDM/$JDM/g" \ -e "s/&KDM/$KDM/g" \ @@ -145,11 +144,14 @@ sed -i -e "s/&TShincname/$TShar/" \ -e "s/&salintinc/${salininc}/g" \ -e "s/&uvelinc/${uvelinc}/g" \ -e "s/&vvelinc/${vvelinc}/g" \ - -e "s/&lyrthknam/${lyrthbg}" \ + -e "s/&lyrthkname/${lyrthbg}/g" ./ncoda_inc2mom6nc_lyr.input $EXECrtofs/rtofs_ncodaz_inc2mom6nc_glb_lyr.x < ncoda_inc2mom6nc_lyr.input >> $pgmout err=$?; export err ; err_chk echo " error from rtofs_ncodaz_inc2mom6nc_glb_lyr=",$err +cp $TShinc $COMOUT/rtofs_glo.$TShinc +cp $UVinc $COMOUT/rtofs_glo.$UVinc + msg="THE RTOFS_GLO_NCODA_INC JOB HAS ENDED NORMALLY on $(hostname) at $(date)" postmsg "$msg" diff --git a/sorc/hycom_tools_for_mom6.fd/build_all.sh b/sorc/hycom_tools_for_mom6.fd/build_all.sh index 9dbef1ef..8aeae001 100755 --- a/sorc/hycom_tools_for_mom6.fd/build_all.sh +++ b/sorc/hycom_tools_for_mom6.fd/build_all.sh @@ -12,6 +12,9 @@ source ${BASE}/load_modules.sh ${dir_mod0} make all # move executables +for f in `ls -1 *.x`; do +cp $f ../../exec/rtofs_$f +done mkdir -p ${BASE}/exec mv *.x ${BASE}/exec diff --git a/sorc/hycom_tools_for_mom6.fd/ncodaz_inc2mom6nc_glb_lyr.f b/sorc/hycom_tools_for_mom6.fd/ncodaz_inc2mom6nc_glb_lyr.f index 470f3cdd..54499066 100644 --- a/sorc/hycom_tools_for_mom6.fd/ncodaz_inc2mom6nc_glb_lyr.f +++ b/sorc/hycom_tools_for_mom6.fd/ncodaz_inc2mom6nc_glb_lyr.f @@ -174,10 +174,17 @@ program ncodaz_inc2mom6nc_glb c --- 'flnm_p' = name of ncoda density displacement file, or "NONE" c --- 'flnm_h' = name of the background field layer thick. as ncoda binary -c itest,jtest show be read with blkini2, now hard coded - itest=1324 - jtest=1898 - call blkini(kncoda,'kncoda') + call blkini2(i,j,'itest ','kncoda') + if (j.eq.1) then + itest = i + call blkini(jtest, 'jtest ') + call blkini(kncoda, 'kncoda') + else + itest = 0 + jtest = 0 + kncoda = i + endif + if (kncoda.ne.kk) then write(6,*)'error, kncoda has to be kk for lyr option' stop @@ -217,7 +224,7 @@ program ncodaz_inc2mom6nc_glb read (*,'(a)') flnm_p write (lp,'(2a)') 'Pncoda file: ',trim(flnm_p) read (*,'(a)') flnm_h - write (lp,'(2a)') 'h background file: ',trim(flnm_p) + write (lp,'(2a)') 'h background file: ',trim(flnm_h) C From 9518a495d01f80dfbbdd60e64ab3cb00a0603519 Mon Sep 17 00:00:00 2001 From: Zulema Garraffo Date: Thu, 15 Jan 2026 14:41:45 +0000 Subject: [PATCH 2/2] leave exrtofs_glo_ncoda_hycom_var.sh as in develop --- scripts/exrtofs_glo_ncoda_hycom_var.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/exrtofs_glo_ncoda_hycom_var.sh b/scripts/exrtofs_glo_ncoda_hycom_var.sh index f2530ec2..3d936298 100755 --- a/scripts/exrtofs_glo_ncoda_hycom_var.sh +++ b/scripts/exrtofs_glo_ncoda_hycom_var.sh @@ -92,8 +92,6 @@ cat << eof1 > odsetnl &end eof1 -# for hycom kkm, kko, m, and n can be pulled from parm blkdat.input -#for MOM, IDM,JDM can be pulled from the depth*nc file. cat << eof2 > ogridnl &gridnl delx(1) = 8896.78809,