From c9702a0af37eaf5aa60b8b24dc02ccca13abecff Mon Sep 17 00:00:00 2001 From: "Kristi R. Arsenault" Date: Mon, 30 Sep 2024 09:49:47 -0400 Subject: [PATCH 01/11] First S2S updates for new NMME model additions New NMME models are being included in the latest 7.5 S2S code. The first updates have been made to suite of BCSD scripts and download scripts. Additional minor updates made to some plotting routines and the main 7.5 S2S readme file. --- lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 | 89 +++++---- lis/utils/usaf/s2s/s2s_app/check_nmme_bcsd.py | 6 +- .../s2s/s2s_app/download_nmme_hindcasts.sh | 58 ++++-- .../usaf/s2s/s2s_app/s2s_hcst_preprocess.sh | 180 ++++++++++++------ lis/utils/usaf/s2s/s2s_app/s2s_run.sh | 8 +- .../bias_correction_modulefast.py | 2 +- .../bias_correction_nmme_modulefast.py | 2 +- .../bcsd_fcst/bcsd_library/nmme_reorg_f.py | 29 ++- .../bcsd_fcst/bcsd_library/nmme_reorg_h.py | 47 ++++- .../check_preprocess_forecast_files.py | 6 + .../s2s_modules/bcsd_fcst/forecast_task_01.py | 4 +- .../s2s/s2s_modules/s2splots/plot_utils.py | 2 +- .../s2s_modules/s2splots/plot_weekly_anom.py | 23 ++- .../usaf/s2s/s2s_modules/shared/utils.py | 2 +- 14 files changed, 318 insertions(+), 140 deletions(-) diff --git a/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 b/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 index fc771e4cb..774ee955b 100755 --- a/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 +++ b/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 @@ -3,7 +3,7 @@ Subseasonal-to-Seasonal (S2S) End-to-End System (E2ES) Master Doc NASA/GSFC GHI-S2S Team - Last Modified 24 Aug 2023 + Last Modified 27 Sep 2024 TABLE OF CONTENTS _________________ @@ -56,26 +56,27 @@ Postprocessing of LIS-based NoahMP4.0.1 and HYMAP2 is supported in terms grib configuration settings), and netCDF4 with compression. * For running on Discover, you will load the following module: - LISF/env/discover/lisf_7.5_intel_2021.4.0_s2s + LISF/env/discover/lisf_7.5_intel_2023.2.1_s2s -* Python 3.9, with the following extra libraries installed: +* Python 3.11, with the following extra libraries installed: NCCS HPC - - xarray 2022.10.0 2022.11.0 - - dask 2022.10.0 2022.10.2 - - xesmf 0.6.3 0.6.3 - - cfgrib 0.9.10.2 0.9.10.2 - - dateutil 2.8.2 2.8.2 - - pandas 1.5.1 1.5.1 - - numpy 1.23.4 1.23.4 - - PyYAML 6.0 6.0 - - GDAL 3.5.2 3.5.2 - - OSGEO 3.5.2 3.5.2 - - NetCDF4 1.6.1 1.6.1 - - Cartopy 0.21.0 0.21.0 - - Matplotlib 3.6.1 3.6.2 - - ** Note: Future tests and any code updates will be - made when we upgrade to Python 3.10. + - xarray 2024.6.0 2024.6.0 + - dask 2024.7.0 2024.6.2 + - xesmf 0.8.6 0.8.5 + - cfgrib 0.9.13.0 0.9.14.0 + - dateutil 2.9.0 2.9.0 + - pandas 2.2.2 2.2.2 + - numpy 1.26.4 1.26.4 + - PyYAML 6.0.1 6.0.01 + - GDAL 3.8.4 3.8.1 + - OSGEO 3.8.4 3.8.1 + - NetCDF4 1.7.1 1.6.5 + - Cartopy 0.23.0 0.23.0 + - Matplotlib 3.9.1 3.8.4 + + ** Note: Updates to the above libraries and modules + could get updated as frequent as every 3- to + 6-months, depending on the system. 2.2 SETTING UP THE EXPERIMENT DIRECTORY @@ -110,7 +111,7 @@ Postprocessing of LIS-based NoahMP4.0.1 and HYMAP2 is supported in terms LISFDIR: [DIRECTORY_PATH_OF_YOUR_LISF_TOP-LEVEL-CODE_DIRECTORY] E2ESDIR: [YOUR_LOCAL_WORKING-RUN_DIRECTORY_PATH] METFORC: [MAIN_USAF_FORCING_AND_SATELLITE_DATA_DIRECTORY_PATH] - LISFMOD: lisf_7.5_intel_2021.4.0_s2s [OR LOCAL MACHINE LISF MODULE LIBRARY LIST] + LISFMOD: lisf_7.5_intel_2023.2.1_s2s [OR LOCAL MACHINE LISF MODULE LIBRARY LIST] SPCODE: s1189 [YOUR LOCAL MACHINE GROUPID CODE] DATATYPE: forecast [OPTIONS INCLUDE: "forecast" or "hindcast"] supplementarydir: [YOUR GHI_S2S/supplementary_files DIRECTORY PATH WITH RUNTIME INPUT FILES] @@ -193,7 +194,7 @@ Postprocessing of LIS-based NoahMP4.0.1 and HYMAP2 is supported in terms To run a single step, you will select the following options, for example the BCSD step: - sh s2s_app/s2s_run.sh -y 2022 -m 9 -c s2s_config_global_fcst -s BCSD -o Y + sh s2s_app/s2s_run.sh -y 2024 -m 9 -c s2s_config_global_fcst -s BCSD -o Y would run just the BCSD step and scripts. @@ -206,10 +207,10 @@ Postprocessing of LIS-based NoahMP4.0.1 and HYMAP2 is supported in terms The report option allows the user to check the order, processing SLURM job time, and final computational resource usage and time information. - An example of how to monitor an E2ES set of SLURM jobs, for an 09-2022 + An example of how to monitor an E2ES set of SLURM jobs, for an 09-2024 forecast: - sh s2s_app/s2s_run.sh -y 2022 -m 9 -c s2s_config_global_fcst -r Y + sh s2s_app/s2s_run.sh -y 2024 -m 9 -c s2s_config_global_fcst -r Y The "-r" flag option with "Y" set allows the user to see the following information, e.g.: @@ -220,24 +221,28 @@ Postprocessing of LIS-based NoahMP4.0.1 and HYMAP2 is supported in terms JOB FILE WALLTIME (HH:MM:SS) - 1/105 lisda_run.j 1h 12m 0s - 2/105 ldtics_run.j 0h 11m 4s - 3/105 bcsd01_run.j 5h 13m 34s - 4/105 bcsd03_CCM4_run.j 0h 1m 2s - 5/105 bcsd03_CCSM4_run.j 0h 1m 3s - 6/105 bcsd03_CFSv2_run.j 0h 1m 5s - 7/105 bcsd03_GEOSv2_run.j 0h 0m 54s - 8/105 bcsd03_GFDL_run.j 0h 1m 6s - 9/105 bcsd03_GNEMO5_run.j 0h 1m 0s + 1/36 lisda_run.j 3h 40m 57s + 2/36 ldtics_run.j 0h 7m 6s + 3/36 bcsd01_01_run.j 0h 50m 53s + 4/36 bcsd01_02_run.j 0h 50m 52s + 5/36 bcsd01_03_run.j 0h 50m 43s + 6/36 bcsd01_04_run.j 0h 51m 11s + 7/36 bcsd03_run.j 0h 1m 9s + 8/36 bcsd04_01_run.j 3h 11m 46s + 9/36 bcsd04_02_run.j 3h 11m 48s + 10/36 bcsd05_01_run.j 1h 35m 56s + 11/36 bcsd05_02_run.j 2h 9m 44s ... ... -101/105 s2spost_GNEMO5_202301_run.j 0h 29m 32s -102/105 s2spost_GNEMO5_202302_run.j 0h 27m 14s -103/105 s2spost_GNEMO5_202303_run.j 0h 29m 11s -104/105 s2spost_GNEMO5_202304_run.j 0h 29m 23s -105/105 s2spost_GNEMO5_202305_run.j 0h 29m 58s + 30/36 lis_fcst_GFDL_07_run.j 2h 45m 44s + 31/36 lis_fcst_GFDL_08_run.j 2h 51m 39s + 32/36 s2spost_01_run.j 1h 38m 44s + 33/36 s2spost_02_run.j 2h 15m 31s + 34/36 s2smetric_run.j 1h 16m 58s + 35/36 s2smetric_tiff_run.j 0h 49m 56s + 36/36 s2splots_run.j 1h 39m 15s - ELAPSED TIME : 1d 08h 14m 52s + ELAPSED TIME : 2d 7h 39m 13s ------------------------------- The above example report output will show all the E2ES @@ -367,7 +372,7 @@ Postprocessing of LIS-based NoahMP4.0.1 and HYMAP2 is supported in terms files are available yet, a message will be given be along with the following option, for example: - Precipitation forecasts are available for only 2 NMME models (GEOS5v2 CCM4). + Precipitation forecasts are available for only 2 NMME models (GEOS5v2 CESM1). Do you want to continue (Y/N)? We recommend the user to wait until all files are available on the IRI/Columbia @@ -466,7 +471,11 @@ Postprocessing of LIS-based NoahMP4.0.1 and HYMAP2 is supported in terms - Entries for the NMME and CFSv2 models are found in the main S2S configuration script (e.g., s2s_config_global_fcst): - CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO + == As of 01-Aug-2024 == + CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO5 + + == After 01-Aug-2024 == + CanESM5, CESM1, CFSv2, GEOSv2, GFDL, GNEMO52 4.7 S2S POST-PROCESSING s2spost: S2S forecast output post-process step diff --git a/lis/utils/usaf/s2s/s2s_app/check_nmme_bcsd.py b/lis/utils/usaf/s2s/s2s_app/check_nmme_bcsd.py index 885ed4ac3..e5a79654b 100644 --- a/lis/utils/usaf/s2s/s2s_app/check_nmme_bcsd.py +++ b/lis/utils/usaf/s2s/s2s_app/check_nmme_bcsd.py @@ -40,8 +40,10 @@ parser.add_argument('-l', '--lead_month', required=True, help='lead month 0-9') parser.add_argument('-y', '--year', required=True, help='forcing start year') parser.add_argument('-c', '--config_file', required=True, help='config file') +# parser.add_argument('-m', '--model', required=True, +# help='NMME model [CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO5]') parser.add_argument('-m', '--model', required=True, - help='NMME model [CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO5]') + help='NMME model [CanESM5, CESM1, CFSv2, GEOSv2, GFDL, GNEMO52]') args = parser.parse_args() ic_month = int(args.init_month) @@ -81,7 +83,7 @@ fm_label = str(year) + '-' + calendar.month_abbr[fcast_month] print (fm_label) - # python check_nmme_bcsd.py -m CCM4 -l 4 -y 2000 + # python check_nmme_bcsd.py -m CESM1 -l 4 -y 2000 # Jan 2001 # compute MODEL mean : 1) raw, 2) bcsd nmme_clim_file_raw = NMME_CLIM_TEMPLATE_RAW.format(NMME_PATH,mmm,model) diff --git a/lis/utils/usaf/s2s/s2s_app/download_nmme_hindcasts.sh b/lis/utils/usaf/s2s/s2s_app/download_nmme_hindcasts.sh index 0283c963e..1dd9daa30 100644 --- a/lis/utils/usaf/s2s/s2s_app/download_nmme_hindcasts.sh +++ b/lis/utils/usaf/s2s/s2s_app/download_nmme_hindcasts.sh @@ -1,14 +1,17 @@ #!/bin/bash # -# SCRIPT: download_nmme_hindcasts_sshukla.csh +# SCRIPT: download_nmme_hindcasts.sh # # PURPOSE: Download monthly hindcasts of the NMME (version-2) # ensemble of climate forecast models. # -# AUTHOR: Shrad Shukla, UCSB, MAY-2016 +# AUTHOR: Shrad Shukla, UCSB, MAY-2016; orig: download_nmme_hindcasts_sshukla.csh # Edited: Abheera Hazra, NASA, MAR-2019 # Edited: Ryan Zamora, NASA, MAR-2022 # Edited: KR Arsenault, NASA, FEB-2024; Added Jan-, Feb-2011 CFSv2 downloads +# Edited: Kristi Arsenault, NASA, Aug-2024; +# Updated data downloads to latest NMME models: +# CanSIPS-IC4(CanESM5,GEM5.2-NEMO), COLA-RSMAS-CESM1 # # SOURCE WEBSITE: https://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/ # @@ -18,29 +21,33 @@ # intraseasonal prediction. Bull. Amer. Meteor. Soc., 95, 585–601. # doi: http://dx.doi.org/10.1175/BAMS-D-12-00050.1 # -#__________________________________________________________________ +#_______________________________________________________________________________ # Specify start and end years to process: -# Default should be 1982 to 2021: - +# Previous default was 1982 to 2021 +# Latest default should be 1991 to 2020 +# (Note: Allowing up to 2021, where models have available data) month=$1 CFILE=$2 # Output target directory (where files are to be written): TARGETDIR=`grep nmme_download_dir $CFILE | cut -d':' -f2 | tr -d "[:space:]"` +echo " --- " +echo " --- Where NMME files will be written to: "${TARGETDIR} +echo " --- " # Variable is precipitation var='prec' -for model in 'NCEP-CFSv2' 'NASA-GEOSS2S' 'CanSIPS-IC3' 'COLA-RSMAS-CCSM4' 'GFDL-SPEAR' -#for model in 'NCEP-CFSv2' +# NMME model ensemble suite, valid upto Aug-2024: +#for model in 'NCEP-CFSv2' 'NASA-GEOSS2S' 'CanSIPS-IC3' 'COLA-RSMAS-CCSM4' 'GFDL-SPEAR' +# NMME model ensemble suite, valid starting Aug-2024: +for model in 'NCEP-CFSv2' 'GFDL-SPEAR' 'NASA-GEOSS2S' 'CanSIPS-IC4' 'COLA-RSMAS-CESM1' do OUTDIR=$TARGETDIR"/"$model mkdir -p $OUTDIR - # rm -rf $OUTDIR"/"$var"."$model".mon_"$month"_"$SYRA"_"$EYRA".nc" - # CFSv2 if [ $model == 'NCEP-CFSv2' ]; then SYRA=1982 @@ -98,7 +105,7 @@ do curl -v $strD fi - # CCM4 & GNEMO5 + # CanSIPS-IC3: CCM4 & GNEMO5 if [ $model == 'CanSIPS-IC3' ]; then SYRA=1991 EYRA=2020 @@ -114,7 +121,25 @@ do curl -v $strB fi - # CCSM4 + # CanSIPS-IC4: CanESM5 & GEM5.2-NEMO + if [ $model == 'CanSIPS-IC4' ]; then + SYRA=1991 + EYRA=2020 + + # CanESM5: + modelA="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.CanESM5/.HINDCAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYRA"-"$EYRA"%29VALUES/data.nc -o "$OUTDIR"/"$var".CanESM5.mon_"$month"_"$SYRA"_"$EYRA".nc" + + # GEM5.2-NEMO: + modelB="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.GEM5.2-NEMO/.HINDCAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYRA"-"$EYRA"%29VALUES/data.nc -o "$OUTDIR"/"$var".GEM5.2-NEMO.mon_"$month"_"$SYRA"_"$EYRA".nc" + + # Download CanSIPS-IC4 models: + echo $modelA + echo $modelB + curl -v $modelA + curl -v $modelB + fi + + # COLA-RSMAS/NCAR CCSM4 if [ $model == 'COLA-RSMAS-CCSM4' ]; then SYRA=1982 EYRA=2021 @@ -125,6 +150,17 @@ do curl -v $strA fi + # COLA-RSMAS/NCAR CESM1 + if [ $model == 'COLA-RSMAS-CESM1' ]; then + SYRA=1991 + EYRA=2021 + + strA="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYRA"-"$EYRA"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"_"$SYRA"_"$EYRA".nc" + + echo $strA + curl -v $strA + fi + # GFDL if [ $model == 'GFDL-SPEAR' ]; then SYRA=1991 diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh b/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh index 94c24d9d6..2d27a5f30 100644 --- a/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh +++ b/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh @@ -50,7 +50,8 @@ while getopts ":m:c:s:r:" opt; do echo " REPORT: Once the E2ES process has begun (jobs have been submitted), the REPORT flag can be used to check the progress of SLURM jobs (valid inputs: Y or N)" echo " STEP: The E2ES process includes three steps that are run sequentially DOWNLOAD (or DOWNLOADNMME), REORG, CLIM" echo " However, the STEP option allows the user to kick start the process from the last completed step." - echo " -s STEP directs s2s_run.sh to start from a specific STEP (valid inputs: DOWNLOAD, DOWNLOADNMME, REORG, CLIM)." + echo " -s STEP directs s2s_run.sh to start from a specific STEP." + echo " Valid inputs: DOWNLOAD, DOWNLOADNMME, REORG, CLIM, REORGNMME, REORGCFSV2, CLIMNMME, CLIMCFSV2, CLIMNAFPA" echo " " exit 1 ;; @@ -139,17 +140,20 @@ reorg_cfsv2(){ # Reorganize CFSv2 Data ####################################################################### - clim_mid=$((clim_syr+clim_eyr)) - clim_mid=$((clim_mid / 2)) + echo " ... Preprocessing (Reorg) CFSv2 files ... " cd ${SCRDIR}/reorg/ CWD=`pwd` /bin/ln -s ${E2ESDIR}/bcsd_fcst/ jobname=reorg_cfsv2 - python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_01.py -s $clim_syr -e $clim_mid -m $mmm -c $BWD/$CFILE -w ${CWD} -t 1 -H 9 -j ${jobname}_set1 - ((clim_mid++)) - python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_01.py -s $clim_mid -e $clim_eyr -m $mmm -c $BWD/$CFILE -w ${CWD} -t 1 -H 9 -j ${jobname}_set2 + iter=1 + for ((YEAR=$clim_syr; YEAR<=$clim_eyr; YEAR+=6)); do + syr=$YEAR + eyr=$((YEAR+5)) + python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_01.py -s $syr -e $eyr -m $mmm -c $BWD/$CFILE -w ${CWD} -t 1 -H 3 -j ${jobname}_set${iter} + ((iter++)) + done job_list="$jobname*.j" for jfile in $job_list @@ -170,29 +174,30 @@ reorg_nmme(){ # Reorganize NMME Data ####################################################################### + echo " ... Preprocessing (Reorg) NMME files ... " + cd ${SCRDIR}/reorg/ CWD=`pwd` /bin/ln -s ${E2ESDIR}/bcsd_fcst/ jobname=reorg_nmme + cmdfile=${jobname}.file nmme_output_dir=${E2ESDIR}/bcsd_fcst/NMME/raw/Monthly/ mkdir -p -m 775 $nmme_output_dir - - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} - this_model=0 - for nmme_model in $MODELS; do - COMMAND="python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_h.py $MM $nmme_output_dir $nmme_model $BWD/$CFILE" - if [ $this_model == 0 ]; then - sed -i "s|COMMAND|${COMMAND}|g" ${jobname}_run.j - else - LLINE=`grep -n nmme_reorg_h.py ${jobname}_run.j | tail -1 | cut -d':' -f1` - ((LLINE++)) - sed -i "${LLINE}i ${COMMAND}" ${jobname}_run.j - fi - ((this_model++)) + + for nmme_model in $MODELS; do + echo "python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_h.py $MM $nmme_output_dir $nmme_model $BWD/$CFILE" >> "$cmdfile" done; - reorg_nmme_ID=$(submit_job "" "${jobname}_run.j") + split -l 3 $cmdfile part_ + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_01_run.j -t 1 -H 2 -j ${jobname}_ -w ${CWD} -C "part_aa" + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_02_run.j -t 1 -H 2 -j ${jobname}_ -w ${CWD} -C "part_ab" + /bin/rm ${cmdfile} "part_aa" "part_ab" + + reorg_nmme_ID=$(submit_job "" "${jobname}_01_run.j") + thisID=$(submit_job "" "${jobname}_02_run.j") + reorg_nmme_ID=`echo $reorg_nmme_ID`' '$thisID + reorg_nmme_ID=`echo $reorg_nmme_ID | sed "s| |:|g"` cd ${BWD} } @@ -209,23 +214,17 @@ clim_nafpa(){ /bin/ln -s ${E2ESDIR}/bcsd_fcst/ jobname=clim_nafpa + cmdfile=${jobname}.file outdir=${E2ESDIR}/bcsd_fcst/USAF-LIS7.3rc8_25km/raw/Climatology/ mkdir -p -m 775 $outdir - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} - this_var=0 for var in LWdown_f_tavg Rainf_f_tavg Psurf_f_tavg Qair_f_tavg SWdown_f_tavg Tair_f_tavg Wind_f_tavg; do - COMMAND="python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/calc_and_write_observational_climatology.py $var $BWD/$CFILE $outdir" - if [ $this_var == 0 ]; then - sed -i "s|COMMAND|${COMMAND}|g" ${jobname}_run.j - else - LLINE=`grep -n calc_and_write_observational_climatology.py ${jobname}_run.j | tail -1 | cut -d':' -f1` - ((LLINE++)) - sed -i "${LLINE}i ${COMMAND}" ${jobname}_run.j - fi - ((this_var++)) + echo "python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/calc_and_write_observational_climatology.py $var $BWD/$CFILE $outdir" >> "$cmdfile" done; - + + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 2 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + /bin/rm ${cmdfile} + clim_nafpa_ID=$(submit_job "" "${jobname}_run.j") cd ${BWD} @@ -239,30 +238,30 @@ clim_cfsv2(){ # Create CFSv2 Climatologies ####################################################################### + echo " ... Creating CFSv2 climatology files ... " + cd ${SCRDIR}/clim/ CWD=`pwd` /bin/ln -s ${E2ESDIR}/bcsd_fcst/ jobname=clim_cfsv2 + cmdfile=${jobname}.file fcst_indir=${E2ESDIR}/bcsd_fcst/CFSv2_25km/raw/Monthly/ outdir=${E2ESDIR}/bcsd_fcst/CFSv2_25km/raw/Climatology/${mmm}01/ mkdir -p -m 775 ${outdir} - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 5 -j ${jobname}_ -w ${CWD} - this_var=0 for var in PRECTOT LWS PS Q2M SLRSF T2M WIND10M; do - COMMAND="python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/calc_and_write_forecast_climatology.py $var $MM $BWD/$CFILE $fcst_indir $outdir" - if [ $this_var == 0 ]; then - sed -i "s|COMMAND|${COMMAND}|g" ${jobname}_run.j - else - LLINE=`grep -n calc_and_write_forecast_climatology.py ${jobname}_run.j | tail -1 | cut -d':' -f1` - ((LLINE++)) - sed -i "${LLINE}i ${COMMAND}" ${jobname}_run.j - fi - ((this_var++)) + echo "python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/calc_and_write_forecast_climatology.py $var $MM $BWD/$CFILE $fcst_indir $outdir" >> "$cmdfile" done; - clim_cfsv2_ID=$(submit_job $reorg_cfsv2_ID "${jobname}_run.j") + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 2 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + /bin/rm ${cmdfile} + + if [ ${reorg_cfsv2_ID} == "" ]; then + clim_cfsv2_ID=$(submit_job "" "${jobname}_run.j") + else + clim_cfsv2_ID=$(submit_job $reorg_cfsv2_ID "${jobname}_run.j") + fi cd ${BWD} } @@ -274,38 +273,34 @@ clim_nmme(){ # Create NMME Climatologies ####################################################################### + echo " ... Creating NMME climatology files ... " + cd ${SCRDIR}/clim/ CWD=`pwd` /bin/ln -s ${E2ESDIR}/bcsd_fcst/ jobname=clim_nmme + cmdfile=${jobname}.file outdir=${E2ESDIR}/bcsd_fcst/NMME/raw/Climatology/${mmm}01/ mkdir -p -m 775 ${outdir} cd ${outdir} mkdir -p -m 775 $MODELS cd ${SCRDIR}/clim/ - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} - this_model=0 for model in $MODELS; do - +# echo " ... NMME model :: "${model} nmme_indir=${E2ESDIR}/bcsd_fcst/NMME/raw/Monthly/${mmm}01/${model}/ - outdir=${E2ESDIR}/bcsd_fcst/NMME/raw/Climatology/${mmm}01/${model}/ - - COMMAND="python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/calc_and_write_nmme_forecast_climatology.py 'PRECTOT' $MM ${model} $BWD/$CFILE $nmme_indir $outdir" - - if [ $this_model == 0 ]; then - sed -i "s|COMMAND|${COMMAND}|g" ${jobname}_run.j - else - LLINE=`grep -n calc_and_write_nmme_forecast_climatology.py ${jobname}_run.j | tail -1 | cut -d':' -f1` - ((LLINE++)) - sed -i "${LLINE}i ${COMMAND}" ${jobname}_run.j - fi - ((this_model++)) + outdir=${E2ESDIR}/bcsd_fcst/NMME/raw/Climatology/${mmm}01/${model}/ + echo "python $LISHDIR/s2s_modules/bcsd_fcst/bcsd_library/calc_and_write_nmme_forecast_climatology.py 'PRECTOT' $MM ${model} $BWD/$CFILE $nmme_indir $outdir" >> "$cmdfile" done; - clim_nmme_ID=$(submit_job $reorg_nmme_ID "${jobname}_run.j") - + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 2 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + /bin/rm ${cmdfile} + if [ ${reorg_nmme_ID} == "0" ]; then + clim_nmme_ID=$(submit_job "" "${jobname}_run.j") + else + clim_nmme_ID=$(submit_job $reorg_nmme_ID "${jobname}_run.j") + fi cd ${BWD} } @@ -338,7 +333,7 @@ python $LISHDIR/s2s_app/s2s_api.py -s $JOB_SCHEDULE -m "JOB ID" -f "JOB SCRIPT" ####################################################################### reorg_cfsv2_ID= -reorg_nmme_ID= +reorg_nmme_ID=0 clim_nafpa_ID= case $STEP in @@ -347,9 +342,15 @@ case $STEP in download_nmme ;; DOWNLOADNMME) + echo " " + echo "Download NMME forcings" + echo "----------------------" download_nmme ;; REORG) + echo " ============================= " + echo " Reorg of forcings step " + echo " ============================= " echo " " >> $JOB_SCHEDULE echo "(1) Reorganize forcings" >> $JOB_SCHEDULE echo "-----------------------" >> $JOB_SCHEDULE @@ -357,16 +358,69 @@ case $STEP in reorg_cfsv2 reorg_nmme ;; + REORGNMME) + echo " ============================= " + echo " Reorg of NMME forcings step " + echo " ============================= " + echo " " >> $JOB_SCHEDULE + echo "(1) Reorg NMME forcings" >> $JOB_SCHEDULE + echo "-----------------------" >> $JOB_SCHEDULE + echo " " >> $JOB_SCHEDULE + reorg_nmme + ;; + REORGCFSV2) + echo " ============================= " + echo " Reorg of CFSv2 forcings step " + echo " ============================= " + echo " " >> $JOB_SCHEDULE + echo "(1) Reorg CFSV2 forcings" >> $JOB_SCHEDULE + echo "------------------------" >> $JOB_SCHEDULE + echo " " >> $JOB_SCHEDULE + reorg_cfsv2 + ;; CLIM) + echo " ============================= " + echo " Generate all clim files " + echo " ============================= " echo " " >> $JOB_SCHEDULE - echo "(2) Write climgatological files" >> $JOB_SCHEDULE + echo "(2) Write climatological files" >> $JOB_SCHEDULE echo "------------------------------" >> $JOB_SCHEDULE echo " " >> $JOB_SCHEDULE clim_nafpa clim_cfsv2 clim_nmme ;; + CLIMNMME) + echo " ============================= " + echo " Generate NMME clim files " + echo " ============================= " + echo " " >> $JOB_SCHEDULE + echo "(2) Write NMME clim files" >> $JOB_SCHEDULE + echo "------------------------------" >> $JOB_SCHEDULE + echo " " >> $JOB_SCHEDULE + clim_nmme + ;; + CLIMCFSV2) + echo " ============================= " + echo " Generate CFSv2 clim files " + echo " ============================= " + echo " " >> $JOB_SCHEDULE + echo "(2) Write CFSV2 clim files" >> $JOB_SCHEDULE + echo "------------------------------" >> $JOB_SCHEDULE + echo " " >> $JOB_SCHEDULE + clim_cfsv2 + ;; + CLIMNAFPA) + echo " " >> $JOB_SCHEDULE + echo "(2) Write NAFPA clim files" >> $JOB_SCHEDULE + echo "------------------------------" >> $JOB_SCHEDULE + echo " " >> $JOB_SCHEDULE + clim_nafpa + ;; *) + echo " ============================== " + echo " Running all reorg+clim steps " + echo " ============================== " echo " " >> $JOB_SCHEDULE echo "(1) Reorganize forcings" >> $JOB_SCHEDULE echo "-----------------------" >> $JOB_SCHEDULE diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_run.sh b/lis/utils/usaf/s2s/s2s_app/s2s_run.sh index c592af411..c067ee7e0 100755 --- a/lis/utils/usaf/s2s/s2s_app/s2s_run.sh +++ b/lis/utils/usaf/s2s/s2s_app/s2s_run.sh @@ -395,7 +395,10 @@ download_forecasts(){ sed -i "${LINE2}s/.*/${new_line}/1" $CFILE - declare -A nmme_models=( ["CanSIPS-IC3"]="GNEMO5, CCM4" ["COLA-RSMAS-CCSM4"]="CCSM4" ["GFDL-SPEAR"]="GFDL" ["NASA-GEOSS2S"]="GEOSv2" ["NCEP-CFSv2"]="CFSv2" ) +# NMME models prior to Aug-2024: +# declare -A nmme_models=( ["CanSIPS-IC3"]="GNEMO5, CCM4" ["COLA-RSMAS-CCSM4"]="CCSM4" ["GFDL-SPEAR"]="GFDL" ["NASA-GEOSS2S"]="GEOSv2" ["NCEP-CFSv2"]="CFSv2" ) +# NMME models since Aug-2024: + declare -A nmme_models=( ["CanSIPS-IC4"]="GNEMO52, CanESM5" ["COLA-RSMAS-CESM1"]="CESM1" ["GFDL-SPEAR"]="GFDL" ["NASA-GEOSS2S"]="GEOSv2" ["NCEP-CFSv2"]="CFSv2" ) have_model="[" if [ `echo $prec_files | wc -w` -lt 5 ]; then @@ -404,7 +407,8 @@ download_forecasts(){ s2s_app/download_nmme_precip.sh ${YYYY} ${Mmm} ${CFILE} prec_files=`ls $NMME_RAWDIR/*/*${Mmm}.${YYYY}.nc` - for dir in CanSIPS-IC3 COLA-RSMAS-CCSM4 GFDL-SPEAR NASA-GEOSS2S NCEP-CFSv2 +# for dir in CanSIPS-IC3 COLA-RSMAS-CCSM4 GFDL-SPEAR NASA-GEOSS2S NCEP-CFSv2 + for dir in CanSIPS-IC4 COLA-RSMAS-CESM1 GFDL-SPEAR NASA-GEOSS2S NCEP-CFSv2 do fdown=$NMME_RAWDIR/$dir/prec.$dir.mon_${Mmm}.${YYYY}.nc if [ `file $fdown | rev | cut -d' ' -f1 | rev` == "data" ]; then diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_modulefast.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_modulefast.py index 567d721aa..2804a9f86 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_modulefast.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_modulefast.py @@ -68,7 +68,7 @@ OBS_CLIM_FILE_TEMPLATE = '{}/raw/Climatology/{}_obs_clim.nc' FCST_CLIM_FILE_TEMPLATE = '{}/raw/Climatology/{}/{}_fcst_clim.nc' MONTH_NAME_TEMPLATE = '{}01' -# GEOS5 filename template: +# CFSV2 monthly filename template: FCST_INFILE_TEMPLATE = '{}/raw/Monthly/{}/{:04d}/ens{:01d}/{}.cfsv2.{:04d}{:02d}.nc' CONFIG_FILE = str(sys.argv[14]) diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_nmme_modulefast.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_nmme_modulefast.py index ed3deb6cc..eaa831147 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_nmme_modulefast.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/bias_correction_nmme_modulefast.py @@ -97,7 +97,7 @@ def slice_latlon(lat, lon, lat_range: list, lon_range: list): OBS_CLIM_FILE_TEMPLATE = '{}/{}_obs_clim.nc' FCST_CLIM_FILE_TEMPLATE = '{}/{}/{}_fcst_clim.nc' MONTH_NAME_TEMPLATE = '{}01' -# GEOS5 filename TEMPLATE: +# NMME monthly filename TEMPLATE: FCST_INFILE_TEMPLATE = '{}/{}/{:04d}/ens{:01d}/{}.nmme.monthly.{:04d}{:02d}.nc' CONFIGFILE = str(sys.argv[16]) diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py index fd2b7bf08..214e29dd0 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py @@ -18,6 +18,9 @@ # Removed basemap call and added xarray and xesmf # module calls # Date: Nov 07, 2022 +# Updated: K.R. Arsenault +# Implemented latest NMME models (valid Aug-2024) +# Date: Sep 17, 2024 """ from datetime import datetime @@ -84,7 +87,8 @@ def write_3d_netcdf(infile, var, varname, description, source, \ config = yaml.safe_load(file) LEAD_MONS = config['EXP']['lead_months'] -MODEL = ['NCEP-CFSv2', 'NASA-GEOSS2S', 'CanSIPS-IC3', 'COLA-RSMAS-CCSM4', 'GFDL-SPEAR'] +#MODEL = ['NCEP-CFSv2', 'NASA-GEOSS2S', 'CanSIPS-IC3', 'COLA-RSMAS-CCSM4', 'GFDL-SPEAR'] +MODEL = ['NCEP-CFSv2', 'NASA-GEOSS2S', 'CanSIPS-IC4', 'COLA-RSMAS-CESM1', 'GFDL-SPEAR'] MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', \ 'Sep', 'Oct', 'Nov', 'Dec'] MONTH = ['jan01', 'feb01', 'mar01', 'apr01', 'may01', 'jun01', 'jul01', \ @@ -136,6 +140,7 @@ def write_3d_netcdf(infile, var, varname, description, source, \ INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], CYR) x = read_nc_files(INFILE, 'prec') XPREC = x[:, 0:LEAD_MONS, 0:ENS_NUM, :, :] +# Former ECCC models (upto Aug-2024): elif NMME_MODEL == 'CCM4': MODEL = 'CanSIPS-IC3' INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], CYR) @@ -148,11 +153,33 @@ def write_3d_netcdf(infile, var, varname, description, source, \ x = read_nc_files(INFILE, 'prec') x1 = np.moveaxis(x, 1, 2) XPREC = x1[:,0:LEAD_MONS,0:10,:,:] +# New ECCC models (as of Aug-2024): +elif NMME_MODEL == 'CanESM5': + MODEL = 'CanSIPS-IC4' + MODEL2 = 'CanESM5' + INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL2, MON[MM], CYR) + x = read_nc_files(INFILE, 'prec') + x1 = np.moveaxis(x, 1, 2) + XPREC = x1[:,0:LEAD_MONS,0:10,:,:] +elif NMME_MODEL == 'GNEMO52': + MODEL = 'CanSIPS-IC4' + MODEL2 = 'GEM5.2-NEMO' + INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL2, MON[MM], CYR) + x = read_nc_files(INFILE, 'prec') + x1 = np.moveaxis(x, 1, 2) + XPREC = x1[:,0:LEAD_MONS,0:10,:,:] +# Former COLA-RSMAS model (as of Aug-2024): elif NMME_MODEL == 'CCSM4': MODEL = 'COLA-RSMAS-CCSM4' INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], CYR) x = read_nc_files(INFILE, 'prec') XPREC = x[:, 0:LEAD_MONS, 0:ENS_NUM, :, :] +# New COLA-RSMAS model (as of Aug-2024): +elif NMME_MODEL == 'CESM1': + MODEL = 'COLA-RSMAS-CESM1' + INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], CYR) + x = read_nc_files(INFILE, 'prec') + XPREC = x[:, 0:LEAD_MONS, 0:ENS_NUM, :, :] elif NMME_MODEL == 'GFDL': MODEL = 'GFDL-SPEAR' INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], CYR) diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_h.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_h.py index 62b886727..e1400f379 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_h.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_h.py @@ -16,6 +16,7 @@ #NMME preciptation forecasts #Date: May 06, 2021 # Update: KR Arsenault; Feb-2024; CFSv2 Jan/Feb update +# Update: KR Arsenault; Sep-2024; Added new NMME models """ from datetime import datetime @@ -74,6 +75,7 @@ def write_3d_netcdf(infile, var, varname, description, source, \ NMME_OUTPUT_DIR = str(sys.argv[2]) NMME_MODEL = str(sys.argv[3]) CONFIGFILE = str(sys.argv[4]) + # Load config file with open(CONFIGFILE, 'r', encoding="utf-8") as file: config = yaml.safe_load(file) @@ -169,6 +171,7 @@ def write_3d_netcdf(infile, var, varname, description, source, \ EYR2 = 2021 INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], SYR2, EYR2) XPREC[35:40,:,:,:,:] = read_nc_files(INFILE, 'prec')[:, 0:LEAD_MON, 0:ENS_NUM, :, :] + elif NMME_MODEL == 'CCM4': MODEL = 'CanSIPS-IC3' SYR1 = 1991 @@ -178,12 +181,14 @@ def write_3d_netcdf(infile, var, varname, description, source, \ x1 = np.moveaxis(x, 1, 2) XPREC[9:39,:,:,:,:] = x1[:,0:LEAD_MON,10:20,:,:] - SYR2 = 2021 - EYR2 = 2021 + # IRI CCM4 hindcast period files stop in Nov-2021; forecast files start then: + #SYR2 = 2021 + #EYR2 = 2021 #INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], SYR2, EYR2) #x = read_nc_files(INFILE, 'prec') #x1 = np.moveaxis(x, 1, 2) #XPREC[39:40,:,:,:,:] = x1[:,0:LEAD_MON,10:20,:,:] + elif NMME_MODEL == 'GNEMO5': MODEL = 'CanSIPS-IC3' SYR1 = 1991 @@ -193,24 +198,56 @@ def write_3d_netcdf(infile, var, varname, description, source, \ x1 = np.moveaxis(x, 1, 2) XPREC[9:39,:,:,:,:] = x1[:,0:LEAD_MON,0:10,:,:] - SYR2 = 2021 - EYR2 = 2021 + # IRI GNEMO5 hindcast period files stop in Nov-2021; forecast files start then: + #SYR2 = 2021 + #EYR2 = 2021 #INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], SYR2, EYR2) #x = read_nc_files(INFILE, 'prec') #x1 = np.moveaxis(x, 1, 2) #XPREC[39:40,:,:,:,:] = x1[:,0:LEAD_MON,0:10,:,:] + +# New NMME CanSIPS model - GEMv5.2-NEMO -- using first 10 members: +elif NMME_MODEL == 'GNEMO52': + MODEL = 'CanSIPS-IC4' + MODEL2 = 'GEM5.2-NEMO' + SYR1 = 1991 + EYR1 = 2020 + INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL2, MON[MM], SYR1, EYR1) + x = read_nc_files(INFILE, 'prec') + x1 = np.moveaxis(x, 1, 2) + XPREC[9:39,:,:,:,:] = x1[:,0:LEAD_MON,0:10,:,:] + +# New NMME CanSIPS model - CanESM5 -- using first 10 members: +elif NMME_MODEL == 'CanESM5': + MODEL = 'CanSIPS-IC4' + MODEL2 = 'CanESM5' + SYR1 = 1991 + EYR1 = 2020 + INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL2, MON[MM], SYR1, EYR1) + x = read_nc_files(INFILE, 'prec') + x1 = np.moveaxis(x, 1, 2) + XPREC[9:39,:,:,:,:] = x1[:,0:LEAD_MON,0:10,:,:] + elif NMME_MODEL == 'CCSM4': MODEL = 'COLA-RSMAS-CCSM4' SYR1 = 1982 EYR1 = 2021 INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], SYR1, EYR1) XPREC = read_nc_files(INFILE, 'prec')[:, 0:LEAD_MON, 0:ENS_NUM, :, :] + +# New COLA-RSMAS CESM1 model (as of Aug-2024): +elif NMME_MODEL == 'CESM1': + MODEL = 'COLA-RSMAS-CESM1' + SYR1 = 1991 + EYR1 = 2021 + INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], SYR1, EYR1) + XPREC[9:40,:,:,:,:] = read_nc_files(INFILE, 'prec')[:, 0:LEAD_MON, 0:ENS_NUM, :, :] + elif NMME_MODEL == 'GFDL': MODEL = 'GFDL-SPEAR' SYR1 = 1991 EYR1 = 2020 INFILE = INFILE_TEMP.format(NMME_DOWNLOAD_DIR, MODEL, MODEL, MON[MM], SYR1, EYR1) - # IH = nc.Dataset(INFILE, mode='r') XPREC[9:39,:,:,:,:] = read_nc_files(INFILE, 'prec')[:, 0:LEAD_MON, 0:ENS_NUM, :, :] SYR2 = 2021 diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/check_preprocess_forecast_files.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/check_preprocess_forecast_files.py index 20a6c0b10..cc6bbeebd 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/check_preprocess_forecast_files.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/check_preprocess_forecast_files.py @@ -109,10 +109,16 @@ def gather_ensemble_info(nmme_model): ens_num=10 elif nmme_model == "CCM4": ens_num=10 + elif nmme_model == "CanESM5": + ens_num=20 elif nmme_model == "GNEMO5": ens_num=10 + elif nmme_model == "GNEMO52": + ens_num=20 elif nmme_model == "CCSM4": ens_num=10 + elif nmme_model == "CESM1": + ens_num=10 elif nmme_model == "GFDL": ens_num=30 else: diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/forecast_task_01.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/forecast_task_01.py index 4b31b8e29..d827ea7dd 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/forecast_task_01.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/forecast_task_01.py @@ -145,8 +145,8 @@ def _driver(): cmd_list.append(cmd) jobfile = job_name + '_' + str(ens_num).zfill(2) + '_run.j' jobname = job_name + '_' + str(ens_num).zfill(2) + '_' - utils.job_script(config_file, jobfile, jobname, ntasks, - hours, cwd, command_list=cmd_list) + utils.job_script(config_file, jobfile, jobname, len(cmd_list), + hours, cwd, group_jobs=cmd_list) else: cmd = "python" diff --git a/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_utils.py b/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_utils.py index 60387151e..82a1c9ed1 100644 --- a/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_utils.py +++ b/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_utils.py @@ -721,7 +721,7 @@ def contours (_x, _y, nrows, ncols, var, color_palette, titles, domain, figure, levels = np.linspace(min_val, max_val, len(style_color)) cmap.set_under(under_over[0]) cmap.set_over(under_over[1]) - + print(domain) nplots = len(titles) if projection is None: fig = plt.figure(figsize= figure_size(FIGWIDTH, domain, nrows, ncols)) diff --git a/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_weekly_anom.py b/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_weekly_anom.py index ab806d5b8..4715a5411 100644 --- a/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_weekly_anom.py +++ b/lis/utils/usaf/s2s/s2s_modules/s2splots/plot_weekly_anom.py @@ -42,27 +42,30 @@ nrows = 1 ncols = 1 -clabel = 'Anomaly (K)' +clabel = 'Anomaly (mm/d)' cartopy_dir = config['SETUP']['supplementarydir'] + '/s2splots/share/cartopy/' - +domain = [42., 55., 8.5, 29.5] #for var_name in config_["POST"]["metric_vars"]: -for var_name in ['AirT']: +for var_name in ['Precip']: infile = infile_template.format(data_dir, '*_' + var_name, fcst_mon, fcst_year) print("Reading infile {}".format(infile)) anom = xr.open_mfdataset(infile, concat_dim='ens', combine='nested') - median_anom = np.median(anom.anom.values, axis=0) + anom_crop = plot_utils.crop(domain, anom.latitude, anom.longitude, anom) + median_anom = np.median(anom_crop.anom.values, axis=0) BEGDATE = date(fcst_year, fcst_mon, 1) for lead in lead_week: ENDDATE = BEGDATE + relativedelta(days=6) titles = [var_name + ' '+ BEGDATE.strftime("%Y%m%d") + '-' + ENDDATE.strftime("%Y%m%d")] plot_arr = median_anom[lead, ] - print(np.nanmin(plot_arr), np.nanmax(plot_arr)) + + maxloc = np.unravel_index(np.nanargmax(plot_arr), plot_arr.shape) + print(np.nanmin(plot_arr), np.nanmax(plot_arr), anom_crop.latitude.values[maxloc[0]], anom_crop.longitude.values[maxloc[1]]) figure = figure_template.format(plotdir, var_name, BEGDATE.strftime("%Y%m%d"), ENDDATE.strftime("%Y%m%d")) print(BEGDATE.strftime("%Y%m%d"),' ' , ENDDATE.strftime("%Y%m%d")) - plot_utils.contours (anom.longitude.values, anom.latitude.values, nrows, - ncols, np.expand_dims(plot_arr, axis=0), 'clim_reanaly', titles, [-90, 90, -180., 180.], - figure, ["white", "white"], - fscale=0.8, clabel=clabel, levels=np.arange(-32,32+1,2), - cartopy_datadir=cartopy_dir, projection="mol") + plot_utils.contours (anom_crop.longitude.values, anom_crop.latitude.values, nrows, + ncols, np.expand_dims(plot_arr, axis=0), 'clim_reanaly', titles, domain, + figure, ['blueviolet','#8B4500'], + fscale=0.8, clabel=clabel, min_val =-6., max_val = 6., + cartopy_datadir=cartopy_dir) BEGDATE += relativedelta(days=7) diff --git a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py index 0cbcbb07a..f9bdd4494 100755 --- a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py +++ b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py @@ -71,7 +71,7 @@ def job_script(s2s_configfile, jobfile, job_name, ntasks, hours, cwd, in_command if 'mil' in cfg['SETUP']['CONSTRAINT']: _f.write('#SBATCH --partition=packable' + '\n') if group_jobs: - mpc = min(math.ceil(240 / ntasks), 80) + mpc = min(math.ceil(480 / ntasks), 100) _f.write('#SBATCH --mem-per-cpu=' + str(mpc) + 'GB' + '\n') else: _f.write('#SBATCH --mem-per-cpu=40GB' + '\n') From 96797b2a078d011f03125ac56d44b4d4553503c4 Mon Sep 17 00:00:00 2001 From: "Kristi R. Arsenault" Date: Mon, 30 Sep 2024 11:50:21 -0400 Subject: [PATCH 02/11] Updated S2S config and NMME download script Made updates to the sample S2S config files to reflect latest NMME models. Updates also made to the forecast NMME download script to account latest models (comments updated as well). --- .../usaf/s2s/s2s_app/download_nmme_precip.sh | 39 ++++++++++++++++--- .../usaf/s2s/s2s_app/s2s_config_global_fcast | 32 +++++++-------- .../usaf/s2s/s2s_app/s2s_config_global_hcast | 28 ++++++------- 3 files changed, 64 insertions(+), 35 deletions(-) diff --git a/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh b/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh index 39ac2e908..7d81bb32c 100755 --- a/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh +++ b/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh @@ -7,6 +7,9 @@ # # AUTHOR: Shrad Shukla, UCSB, MAY-2016 # Edited: Abheera Hazra, NASA, MAR-2019 +# Edited: Kristi Arsenault, NASA, Sep-2024; +# Updated data downloads to latest NMME models: +# CanSIPS-IC4(CanESM5,GEM5.2-NEMO), COLA-RSMAS-CESM1 # # SOURCE WEBSITE: https://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/ # @@ -19,8 +22,10 @@ #__________________________________________________________________ -# Specify start and end years to process: -# Default should be 2008 to 2020: +# Specify current year, mon (and in config file) to process: + + echo " == NMME precip (current) == " + echo " == Enter: yyyy Mon config_file " currentyear=$1 currentmon=$2 @@ -32,7 +37,10 @@ EYR=$currentyear # Output target directory (where files are to be written): TARGETDIR=`grep nmme_download_dir $CFILE | cut -d':' -f2 | tr -d "[:space:]"` -for model in 'NCEP-CFSv2' 'NASA-GEOSS2S' 'CanSIPS-IC3' 'COLA-RSMAS-CCSM4' 'GFDL-SPEAR' +# NMME model ensemble suite, valid upto Aug-2024: +#for model in 'NCEP-CFSv2' 'NASA-GEOSS2S' 'CanSIPS-IC3' 'COLA-RSMAS-CCSM4' 'GFDL-SPEAR' +# NMME model ensemble suite, valid starting Aug-2024: +for model in 'NCEP-CFSv2' 'GFDL-SPEAR' 'NASA-GEOSS2S' 'CanSIPS-IC4' 'COLA-RSMAS-CESM1' do OUTDIR=$TARGETDIR"/"$model mkdir -p $OUTDIR @@ -43,6 +51,7 @@ do zero=0 rm -rf $OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" + # Older ECCC models: if [ $model == 'CMC1-CanCM3' ] || [ $model == 'CMC2-CanCM4' ]; then str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.FORECAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" fi @@ -54,28 +63,48 @@ do if [ $model == 'CanSIPS-IC3' ]; then str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.FORECAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" fi - - if [ $model == 'COLA-RSMAS-CCSM3' ] || [ $model == 'COLA-RSMAS-CCSM4' ]; then + + # New ECCC CanSIPS-IC4 models: CanESM5 & GEM5.2-NEMO + if [ $model == 'CanSIPS-IC4' ]; then + + # CanESM5: + strA="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.CanESM5/.FORECAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var".CanESM5.mon_"$month"."$SYR".nc" + echo $strA + curl -v $strA + + # GEM5.2-NEMO: + str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.GEM5.2-NEMO/.FORECAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var".GEM5.2-NEMO.mon_"$month"."$SYR".nc" + fi + + # RSMAS-COLA NCAR-based models (latest==CESM1): + if [ $model == 'COLA-RSMAS-CCSM3' ] || [ $model == 'COLA-RSMAS-CCSM4' ] || [ $model == 'COLA-RSMAS-CESM1' ]; then str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" fi + # GFDL Models (latest==GFDL-SPEAR): if [ $model == 'GFDL-SPEAR' ] || [ $model == 'GFDL-CM2p5-FLOR-A06' ] || [ $model == 'GFDL-CM2p5-FLOR-B01' ] || [ $model == 'GFDL-CM2p1-aer04' ]; then str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.FORECAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" fi + # Older NASA Models: if [ $model == 'NASA-GMAO-062012' ] || [ $model == 'NASA-GEOSS2S' ]; then str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" fi + # Current NASA Model: if [ $model == 'NASA-GEOSS2S' ]; then str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.FORECAST/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" fi + # CFSv2 Model: if [ $model == 'NCEP-CFSv2' ]; then str="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/."$model"/.FORECAST/.EARLY_MONTH_SAMPLES/.MONTHLY/."$var"/S/%280000%201%20"$month"%20"$SYR"-"$EYR"%29VALUES/data.nc -o "$OUTDIR"/"$var"."$model".mon_"$month"."$SYR".nc" fi + + # Download the model files via curl: echo $str curl -v $str + done ## month done ## variable done diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast index 2c84085fc..e6b1f9f35 100755 --- a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast +++ b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast @@ -7,12 +7,12 @@ SETUP: E2ESDIR: /discover/nobackup/projects/ghilis/S2S/GLOBAL/E2ES_557ww-7.5/ LISFDIR: /discover/nobackup/projects/ghilis/S2S/LISF/ - LISFMOD: lisf_7.5_intel_2021.4.0_s2s + LISFMOD: lisf_7.5_intel_2023.2.1_s2s METFORC: /discover/nobackup/projects/usaf_lis/USAF_FORCING/ supplementarydir: /discover/nobackup/projects/usaf_lis/GHI_S2S/supplementary_files/ ldtinputfile: lis_input.s2s_global.noahmp401_hymap2.25km.nc SPCODE: s1189 - CONSTRAINT: cas|sky + CONSTRAINT: mil DATATYPE: forecast ####################################################################### @@ -26,19 +26,19 @@ EXP: routing_name: hymap2 pertmode: restart lead_months: 9 - NMME_ALL: [CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO5] - NMME_models: [CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO5] + NMME_ALL: [CanESM5, CESM1, CFSv2, GEOSv2, GFDL, GNEMO52] + NMME_models: [CanESM5, CESM1, CFSv2, GEOSv2, GFDL, GNEMO52] ensemble_sizes: - - CCM4: 10 - CCSM4: 10 - GNEMO5: 10 + - CanESM5: 10 + CESM1: 10 + GNEMO52: 10 GEOSv2: 4 CFSv2: 12 GFDL: 15 NMME_scalings: - - CCM4: downscale - CCSM4: downscale - GNEMO5: downscale + - CanESM5: downscale + CESM1: downscale + GNEMO52: downscale GEOSv2: downscale CFSv2: upscale GFDL: upscale @@ -65,12 +65,12 @@ FCST: numprocx: 4 numprocy: 72 JOB_SEGMENTS: - - CCM4: 3 - CCSM4: 3 - GNEMO5: 3 - GEOSv2: 2 - CFSv2: 5 - GFDL: 9 + - CanESM5: 3 + CESM1: 3 + GNEMO52: 3 + GEOSv2: 1 + CFSv2: 3 + GFDL: 9 ####################################################################### # Post-processor diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast index f5129f876..329773fd5 100755 --- a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast +++ b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast @@ -7,12 +7,12 @@ SETUP: E2ESDIR: /discover/nobackup/projects/ghilis/S2S/GLOBAL/E2ES_557ww-7.5/ LISFDIR: /discover/nobackup/projects/ghilis/S2S/LISF/ - LISFMOD: lisf_7.5_intel_2021.4.0_s2s + LISFMOD: lisf_7.5_intel_2023.2.1_s2s METFORC: /discover/nobackup/projects/usaf_lis/USAF_FORCING/ supplementarydir: /discover/nobackup/projects/usaf_lis/GHI_S2S/supplementary_files/ ldtinputfile: lis_input.s2s_global.noahmp401_hymap2.25km.nc SPCODE: s1189 - CONSTRAINT: cas|sky + CONSTRAINT: mil DATATYPE: hindcast AF10KM: /discover/nobackup/projects/ghilis/S2S/GLOBAL/Forcing_Merge/M2CH2BC_USAFNAFPAMod_S2S_Mon/SURFACEMODEL/ LISDADIR: /discover/nobackup/projects/ghilis/S2S/GLOBAL/DA_Run_Hist/output/ @@ -28,19 +28,19 @@ EXP: routing_name: hymap2 pertmode: restart lead_months: 9 - NMME_ALL: [CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO5] - NMME_models: [CCM4, CCSM4, CFSv2, GEOSv2, GFDL, GNEMO5] + NMME_ALL: [CanESM5, CESM1, CFSv2, GEOSv2, GFDL, GNEMO52] + NMME_models: [CanESM5, CESM1, CFSv2, GEOSv2, GFDL, GNEMO52] ensemble_sizes: - - CCM4: 10 - CCSM4: 10 - GNEMO5: 10 + - CanESM5: 10 + CESM1: 10 + GNEMO52: 10 GEOSv2: 4 CFSv2: 12 GFDL: 15 NMME_scalings: - - CCM4: downscale - CCSM4: downscale - GNEMO5: downscale + - CanESM5: downscale + CESM1: downscale + GNEMO52: downscale GEOSv2: downscale CFSv2: upscale GFDL: upscale @@ -67,12 +67,12 @@ FCST: numprocx: 4 numprocy: 72 JOB_SEGMENTS: - - CCM4: 3 - CCSM4: 3 - GNEMO5: 3 + - CanESM5: 3 + CESM1: 3 + GNEMO52: 3 GEOSv2: 1 CFSv2: 3 - GFDL: 9 + GFDL: 9 ####################################################################### # Post-processor From dd8a14b0c4038d2f59732164218b718ef15e3eda Mon Sep 17 00:00:00 2001 From: "Kristi R. Arsenault" Date: Wed, 2 Oct 2024 09:10:09 -0400 Subject: [PATCH 03/11] New TIF file convert script - New S2S TIF file format conversion script (author: S. Mahanama) This script allows conversion to other formats, like *png and *nc Also, minor comment added to the nmme_reorg_f.py script. --- lis/utils/usaf/s2s/s2s_app/convert_tiff.py | 53 +++++++++++++++++++ .../bcsd_fcst/bcsd_library/nmme_reorg_f.py | 3 ++ 2 files changed, 56 insertions(+) create mode 100644 lis/utils/usaf/s2s/s2s_app/convert_tiff.py diff --git a/lis/utils/usaf/s2s/s2s_app/convert_tiff.py b/lis/utils/usaf/s2s/s2s_app/convert_tiff.py new file mode 100644 index 000000000..7446956bb --- /dev/null +++ b/lis/utils/usaf/s2s/s2s_app/convert_tiff.py @@ -0,0 +1,53 @@ +import sys +import argparse +import xarray as xr +import numpy as np +import yaml + +def parse_list(arg): + try: + return [int(x) for x in arg.strip('[]').split(',')] + except ValueError: + raise argparse.ArgumentTypeError('List must be integers.') + +parser = argparse.ArgumentParser() +parser.add_argument('-c', '--config_file', required=True, help='config file') +parser.add_argument('-i', '--input_tiff', required=True, help='Input tiff filename with full path') +parser.add_argument('-o', '--output_nc4', required=False, help='Output nc4 filename with full path') +parser.add_argument('-p', '--output_png', required=False, help='[Optional] Output png filename with full path') +parser.add_argument('-r', '--range', required=False, type=parse_list, help='[Optional] Provide the colorbar range as a two-element list of integers in quotes, for e.g. -r "[-3, 3]"') + +args = parser.parse_args() +tif_file = args.input_tiff +nc4_file = args.output_nc4 + +with open(args.config_file, 'r', encoding="utf-8") as file: + cfg = yaml.safe_load(file) +sys.path.append(cfg['SETUP']['LISFDIR'] + '/lis/utils/usaf/s2s/') +from s2s_modules.shared import utils + +da = utils.tiff_to_da(tif_file) + +if args.output_nc4 is not None: + data_xr = xr.Dataset() + data_xr['data'] = (('y', 'x'), np.array(da.values)) + data_xr.coords['y'] = (('y'), da.y.data) + data_xr.coords['x'] = (('x'), da.x.data) + data_xr.to_netcdf(nc4_file, format="NETCDF4", + encoding = {'data': {"zlib":True, "complevel":6, "shuffle":True, "missing_value": -9999., "_FillValue": -9999.}}) + +if args.output_png is None: + sys.exit() + +# plot +from s2s_modules.s2splots import plot_utils +domain = [np.min(da.y.data), np.max(da.y.data), np.min(da.x.data), np.max(da.x.data)] + +if args.range is None: + plot_utils.contours(da.x.data, da.y.data, 1, 1, np.expand_dims(da.values, axis=0),'clim_reanaly',[' '], domain, args.output_png, ['white','white'], + fscale=0.75, cartopy_datadir = cfg['SETUP']['supplementarydir'] + '/s2splots/share/cartopy/') +else: + plot_utils.contours(da.x.data, da.y.data, 1, 1, np.expand_dims(da.values, axis=0),'clim_reanaly',[' '], domain, args.output_png, ['navy','black'], + fscale=0.75, cartopy_datadir = cfg['SETUP']['supplementarydir'] + '/s2splots/share/cartopy/', min_val = args.range[0], max_val = args.range[1]) + + diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py index 214e29dd0..593ec6533 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/nmme_reorg_f.py @@ -87,8 +87,11 @@ def write_3d_netcdf(infile, var, varname, description, source, \ config = yaml.safe_load(file) LEAD_MONS = config['EXP']['lead_months'] +# Note: These lines should become connected to the s2s_config file and not specified +# directly in this routine. #MODEL = ['NCEP-CFSv2', 'NASA-GEOSS2S', 'CanSIPS-IC3', 'COLA-RSMAS-CCSM4', 'GFDL-SPEAR'] MODEL = ['NCEP-CFSv2', 'NASA-GEOSS2S', 'CanSIPS-IC4', 'COLA-RSMAS-CESM1', 'GFDL-SPEAR'] +### MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', \ 'Sep', 'Oct', 'Nov', 'Dec'] MONTH = ['jan01', 'feb01', 'mar01', 'apr01', 'may01', 'jun01', 'jul01', \ From 7da2d24a4b8a65923fcb0f901cb1481312deddbc Mon Sep 17 00:00:00 2001 From: "Kristi R. Arsenault" Date: Thu, 10 Oct 2024 13:49:48 -0400 Subject: [PATCH 04/11] Updates to S2S automated scripts - Replacing some of the mpirun usage to srun, given some issues encountered on Discover-milan nodes for automated job submissions (e.g., via cron). - Minor fixes to the hindcast preprocessing script options - improved initialization of settings. - Minor increases in the number of hours applied for two BCSD steps in the automated slurm scripts. --- .../usaf/s2s/s2s_app/s2s_hcst_preprocess.sh | 8 +++-- lis/utils/usaf/s2s/s2s_app/s2s_run.sh | 8 +++-- lis/utils/usaf/s2s/s2s_app/submit_hcast.sh | 4 +-- .../generate_ldtconfig_files_ensrst_nrt.py | 3 +- .../generate_lis_config_scriptfiles_fcst.py | 5 +++ .../usaf/s2s/s2s_modules/shared/utils.py | 31 +++++++++++++++---- 6 files changed, 45 insertions(+), 14 deletions(-) mode change 100644 => 100755 lis/utils/usaf/s2s/s2s_app/submit_hcast.sh diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh b/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh index 2d27a5f30..d09b86ca3 100644 --- a/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh +++ b/lis/utils/usaf/s2s/s2s_app/s2s_hcst_preprocess.sh @@ -12,7 +12,7 @@ # source and load shared functions from s2s_run.sh source s2s_app/s2s_run.sh --source-only -# LIS-Hydro_S2S hindcast pre-processor +# LISF_S2S hindcast pre-processor ###################################################################### # PROCESS COMMAND LINE ARGUMENTS @@ -209,6 +209,8 @@ clim_nafpa(){ # Create NAFPA Climatologies ####################################################################### + echo " ... Creating NAFPA climatology files ... " + cd ${SCRDIR}/clim/ CWD=`pwd` /bin/ln -s ${E2ESDIR}/bcsd_fcst/ @@ -257,7 +259,7 @@ clim_cfsv2(){ python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 2 -j ${jobname}_ -w ${CWD} -C ${cmdfile} /bin/rm ${cmdfile} - if [ ${reorg_cfsv2_ID} == "" ]; then + if [ ${reorg_cfsv2_ID} == "0" ]; then clim_cfsv2_ID=$(submit_job "" "${jobname}_run.j") else clim_cfsv2_ID=$(submit_job $reorg_cfsv2_ID "${jobname}_run.j") @@ -386,6 +388,7 @@ case $STEP in echo "(2) Write climatological files" >> $JOB_SCHEDULE echo "------------------------------" >> $JOB_SCHEDULE echo " " >> $JOB_SCHEDULE + reorg_cfsv2_ID=0 clim_nafpa clim_cfsv2 clim_nmme @@ -408,6 +411,7 @@ case $STEP in echo "(2) Write CFSV2 clim files" >> $JOB_SCHEDULE echo "------------------------------" >> $JOB_SCHEDULE echo " " >> $JOB_SCHEDULE + reorg_cfsv2_ID=0 clim_cfsv2 ;; CLIMNAFPA) diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_run.sh b/lis/utils/usaf/s2s/s2s_app/s2s_run.sh index c067ee7e0..b4bd42b8d 100755 --- a/lis/utils/usaf/s2s/s2s_app/s2s_run.sh +++ b/lis/utils/usaf/s2s/s2s_app/s2s_run.sh @@ -863,7 +863,7 @@ bcsd_fcst(){ jobname=bcsd09-10 /bin/rm bcsd09*.j /bin/rm bcsd10*.j - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 5 -j ${jobname}_ -w ${CWD} -C ${cmdfile} /bin/rm ${cmdfile} bcsd09_ID=$(submit_job "$bcsd08_ID" "${jobname}_run.j") bcsd10_ID= @@ -900,7 +900,7 @@ bcsd_fcst(){ jobname=bcsd11-12 /bin/rm bcsd11*.j /bin/rm bcsd12*.j - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 5 -j ${jobname}_ -w ${CWD} -C ${cmdfile} /bin/rm ${cmdfile} bcsd11_ID=$(submit_job "$bcsd09_ID" "${jobname}_run.j") bcsd12_ID= @@ -1198,7 +1198,9 @@ fi # line, since it can slow down over time, given the number of # files in the E2ES directory. -setfacl -PRdm u::rwx,g::rwx,o::r ${E2ESDIR}/ +if [ ! -d "$SCRDIR" ]; then + setfacl -PRdm u::rwx,g::rwx,o::r ${E2ESDIR}/ +fi mkdir -p -m 775 ${SCRDIR}/ldt_ics mkdir -p -m 775 ${SCRDIR}/bcsd_fcst diff --git a/lis/utils/usaf/s2s/s2s_app/submit_hcast.sh b/lis/utils/usaf/s2s/s2s_app/submit_hcast.sh old mode 100644 new mode 100755 index 5076603d8..90c410f30 --- a/lis/utils/usaf/s2s/s2s_app/submit_hcast.sh +++ b/lis/utils/usaf/s2s/s2s_app/submit_hcast.sh @@ -57,9 +57,9 @@ if [ $NJOBS -le $NJMAX ] && [ $year -le $clim_eyr ]; then s2s_app/s2s_run.sh -y $year -m $MONTH -c $CFILE -s BCSD -o Y echo $year > $update_file else - #s2s_app/s2s_run.sh -y $year -m $MONTH -c $CFILE -s FCST + #s2s_app/s2s_run.sh -y $year -m $MONTH -c $CFILE -s FCST s2s_app/s2s_run.sh -y $year -m $MONTH -c $CFILE - echo $year > $update_file + echo $year > $update_file fi fi chmod 664 $update_file diff --git a/lis/utils/usaf/s2s/s2s_modules/ldt_ics/generate_ldtconfig_files_ensrst_nrt.py b/lis/utils/usaf/s2s/s2s_modules/ldt_ics/generate_ldtconfig_files_ensrst_nrt.py index b119275b4..fc1265b42 100644 --- a/lis/utils/usaf/s2s/s2s_modules/ldt_ics/generate_ldtconfig_files_ensrst_nrt.py +++ b/lis/utils/usaf/s2s/s2s_modules/ldt_ics/generate_ldtconfig_files_ensrst_nrt.py @@ -179,7 +179,8 @@ def _driver(): # Run LDT if 'discover' in platform.node() or 'borg' in platform.node(): - cmd = f"mpirun -np 1 {_LDT_EXEC} {ldtconfig_lsm_target}" +# cmd = f"mpirun -np 1 {_LDT_EXEC} {ldtconfig_lsm_target}" + cmd = f"srun {_LDT_EXEC} {ldtconfig_lsm_target}" else: cmd = f"srun {_LDT_EXEC} {ldtconfig_lsm_target}" print(f"[INFO] {cmd}") diff --git a/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py b/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py index c9555a052..cc5c27f89 100644 --- a/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py +++ b/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py @@ -267,6 +267,11 @@ def _driver(config): else: mpi_cmd = 'srun ./LIS' + ' -f ' + lisconfig_target + if 'mil' in config['SETUP']['CONSTRAINT']: + mpi_cmd = lisconfig_target + else: + utils.job_script_lis(CONFIGFILE, jobfile, jobname, WORKDIR, + in_command=mpi_cmd) utils.job_script_lis(CONFIGFILE, jobfile, jobname, WORKDIR, in_command=mpi_cmd) diff --git a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py index f9bdd4494..f11a5c151 100755 --- a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py +++ b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py @@ -81,12 +81,13 @@ def job_script(s2s_configfile, jobfile, job_name, ntasks, hours, cwd, in_command _f.write('#SBATCH --partition=batch' + '\n') _f.write('#SBATCH --exclusive' + '\n') _f.write('#SBATCH --mem=0' + '\n') + _f.write('#SBATCH --job-name=' + job_name + '\n') _f.write('#SBATCH --output ' + cwd + '/' + job_name + '%j.out' + '\n') _f.write('#SBATCH --error ' + cwd + '/' + job_name + '%j.err' + '\n') _f.write('\n') _f.write('#######################################################################' + '\n') - _f.write('# Run LIS-Hydro S2S ' + job_name + '\n') + _f.write('# Run LISF S2S ' + job_name + '\n') _f.write('#######################################################################' + '\n') _f.write('\n') if 'discover' in platform.node() or 'borg' in platform.node(): @@ -220,13 +221,17 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman if 'discover' in platform.node() or 'borg' in platform.node(): _f.write('#SBATCH --constraint=' + cfg['SETUP']['CONSTRAINT'] + '\n') else: -# _f.write('#SBATCH --cluster-constraint=green' + '\n') _f.write('#SBATCH --cluster-constraint=' + cfg['SETUP']['CONSTRAINT'] + '\n') _f.write('#SBATCH --partition=batch' + '\n') _f.write('#SBATCH --exclusive' + '\n') _f.write('#SBATCH --mem=0' + '\n') + + # Assign ntasks based on hindcast | forecast LISF step: if datatype == 'hindcast': - _f.write('#SBATCH --ntasks=' + ntasks + '\n') + if 'mil' in cfg['SETUP']['CONSTRAINT']: + _f.write('#SBATCH --ntasks=' + ntasks + ' --ntasks-per-socket=48 --ntasks-per-core=1' + '\n') + else: + _f.write('#SBATCH --ntasks=' + ntasks + '\n') else: if domain == 'GLOBAL': _f.write('#SBATCH -N 12' + '\n') @@ -240,14 +245,17 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman _f.write('#SBATCH --error ' + cwd + '/' + job_name + '%j.err' + '\n') _f.write('\n') _f.write('#######################################################################' + '\n') - _f.write('# Run LIS-Hydro S2S ' + job_name + '\n') + _f.write('# Run LISF S2S ' + job_name + '\n') _f.write('#######################################################################' + '\n') _f.write('\n') if 'discover' in platform.node() or 'borg' in platform.node(): _f.write('source /etc/profile.d/modules.sh' + '\n') _f.write('module purge' + '\n') if os.path.isfile(lisf + '/env/discover/' + lisf_module): - _f.write('module use -a ' + lisf + '/env/discover/' + '\n') +# KRA TESTING: +# _f.write('module use -a ' + lisf + '/env/discover/' + '\n') + _f.write('unset LD_LIBRARY_PATH' + '\n') + _f.write('module use --append ' + lisf + '/env/discover/' + '\n') _f.write('module --ignore-cache load ' + lisf_module + '\n') else: _f.write('module use -a ' + supd + '/env/' + '\n') @@ -255,7 +263,18 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman _f.write('ulimit -s unlimited' + '\n') _f.write('\n') _f.write('cd ' + cwd + '\n') - _f.write( this_command + ' || exit 1' + '\n') + + if 'mil' in cfg['SETUP']['CONSTRAINT']: + _f.write('export I_MPI_PMI_LIBRARY=/usr/slurm/lib64/libpmi2.so' + '\n') + _f.write('export I_MPI_PMI_VALUE_LENGTH_MAX=' + ntasks + '\n') + _f.write('srun --mpi=pmi2 --ntasks=$SLURM_NTASKS \\' + '\n') + _f.write(' --ntasks-per-socket=$SLURM_NTASKS_PER_SOCKET \\' + '\n') + _f.write(' --ntasks-per-core=$SLURM_NTASKS_PER_CORE \\' + '\n') + _f.write(' --cpu-bind="none" \\' + '\n') + _f.write(' ./LIS -f ' + this_command + ' || exit 1' + '\n') + else: + _f.write( this_command + ' || exit 1' + '\n') + _f.write('\n') _f.write('echo "[INFO] Completed ' + job_name + '!"' + '\n') _f.write('\n') From feb5583fc68f77279d3bc978fd6d106203814155 Mon Sep 17 00:00:00 2001 From: "James V. Geiger" Date: Thu, 17 Oct 2024 13:15:54 -0400 Subject: [PATCH 05/11] Revised alert filenames for USAFSI. (1) Character lengths are increased to support whole subroutine names, and to allow total file name to be up to 255 characters (avoid truncation). (2) Added valid date/time (YYYYMMDDHH) of the USAFSI analysis that was being produced when alert was issued. Not on only does this aid assessment of what is causing a problem when running USAFSI, but it also helps avoid the situation where alert numbers become too big to represent in the filename. That can trigger an infinite loop (which still needs to be fixed). This was manually applied from commit bcd3bd9e312b069399b594b28a0e4ba7712f6569 --- ldt/USAFSI/USAFSI_analysisMod.F90 | 79 +++++++++++++++++++++---------- ldt/USAFSI/USAFSI_espcdMod.F90 | 62 ++++++++++++++++-------- ldt/USAFSI/USAFSI_utilMod.F90 | 25 ++++++---- 3 files changed, 112 insertions(+), 54 deletions(-) diff --git a/ldt/USAFSI/USAFSI_analysisMod.F90 b/ldt/USAFSI/USAFSI_analysisMod.F90 index aa27d1ad7..e9b2fcd8b 100644 --- a/ldt/USAFSI/USAFSI_analysisMod.F90 +++ b/ldt/USAFSI/USAFSI_analysisMod.F90 @@ -21,6 +21,7 @@ ! run_seaice_analysis_navy to reflect use of ! ESPC-D or GOFS data. Also fixed uninitialized ! variable. +! 15 Oct 2024 Eric Kemp Updated error_message logic. ! ! DESCRIPTION: ! Source code for Air Force snow depth analysis. @@ -329,7 +330,8 @@ subroutine getfrac (date10, fracdir) character*255 :: file_path ! FULLY-QUALIFIED FILE NAME character*7 :: iofunc ! ACTION TO BE PERFORMED character*90 :: message (msglns) ! ERROR MESSAGE - character*12 :: routine_name ! NAME OF THIS SUBROUTINE + character*20 :: routine_name ! NAME OF THIS SUBROUTINE + character*10 :: yyyymmddhh integer :: fracnt ! NUMBER OF FRACTIONAL POINTS integer :: i ! SNODEP I-COORDINATE integer :: icount ! LOOP COUNTER @@ -350,6 +352,8 @@ subroutine getfrac (date10, fracdir) allocate(pntcnt( ldt_rc%lnc(1), ldt_rc%lnr(1))) allocate(snocum( ldt_rc%lnc(1), ldt_rc%lnr(1))) + yyyymmddhh = date10 + ! INITIALIZE VARIABLES. fracnt = 0 icount = 1 @@ -438,7 +442,8 @@ subroutine getfrac (date10, fracdir) usafsi_settings%usefrac = .false. message(1) = '[WARN] FRACTIONAL SNOW FILE NOT FOUND' message(2) = '[WARN] PATH = ' // trim(file_path) - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, yyyymmddhh, & + message) write (LDT_logunit, 6400) routine_name, file_path end if @@ -786,7 +791,9 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, & character*9 :: obssta ! RETURNED OBS STATION ID character*5, allocatable :: oldnet (:) ! ARRAY OF NETWORKS FOR OLDSTA character*9, allocatable :: oldsta (:) ! ARRAY OF PROCESSED STATIONS WITH SNOW DEPTHS - character*12 :: routine_name ! NAME OF THIS SUBROUTINE + + character*20 :: routine_name ! NAME OF THIS SUBROUTINE + character*10 :: yyyymmddhh integer :: ctrgrd ! TEMP HOLDER FOR GROUND OBS INFO integer :: ctrtmp ! TEMP HOLDER FOR TOO WARM TEMPERATURE OBS integer :: ctrtrs ! TEMP HOLDER FOR TEMP THRES OBS @@ -826,6 +833,8 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, & allocate (oldnet (usafsi_settings%maxsobs)) allocate (oldsta (usafsi_settings%maxsobs)) + yyyymmddhh = date10 + ! INITIALIZE VARIABLES. depth = missing istat = 0 @@ -1073,7 +1082,8 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, & message(1) = & '[WARN] NO SURFACE OBSERVATIONS READ FOR ' // date10 // & ' ' // chemicap(hemi) - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, & + yyyymmddhh, message) end if @@ -1082,7 +1092,8 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, & message(1) = & '[WARN] NO SURFACE OBSERVATIONS FILE FOR ' // date10 // & ' ' // chemicap(hemi) - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, & + yyyymmddhh, message) end if file_check @@ -1189,7 +1200,8 @@ subroutine getsfc ( date10, stmpdir, sfctmp_found, sfctmp_lis ) character*7 :: iofunc ! ACTION TO BE PERFORMED character*90 :: message (msglns) ! ERROR MESSAGE - character*12 :: routine_name ! NAME OF THIS ROUTINE + character*20 :: routine_name ! NAME OF THIS ROUTINE + character*10 :: yyyymmddhh integer :: icount ! LOOP COUNTER integer :: julhr ! AFWA JULIAN HOUR logical :: isfile ! FLAG FOR INPUT FILE FOUND @@ -1203,6 +1215,8 @@ subroutine getsfc ( date10, stmpdir, sfctmp_found, sfctmp_lis ) allocate(sfctmp_lis_0p25deg(igrid, jgrid_lis)) + yyyymmddhh = date10 + ! GET LATEST LIS SHELTER TEMPERATURES. dtglis = date10 icount = 1 @@ -1243,7 +1257,8 @@ subroutine getsfc ( date10, stmpdir, sfctmp_found, sfctmp_lis ) ! IF NOT FOUND FOR PAST 24 HOURS, SEND ERROR MESSAGE. if (.not. sfctmp_found) then message(1) = '[WARN] LIS DATA NOT FOUND FOR PAST 24 HOURS' - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, yyyymmddhh, & + message) write (ldt_logunit, 6400) routine_name end if @@ -1392,7 +1407,8 @@ subroutine getsmi (date10, ssmis) character*6 :: interval ! TIME INTERVAL FOR FILENAME character*90 :: message (msglns) ! ERROR MESSAGE character*4 :: msgval ! PLACEHOLDER FOR ERROR MESSAGE VALUES - character*12 :: routine_name ! NAME OF THIS SUBROUTINE + character*20 :: routine_name ! NAME OF THIS SUBROUTINE + character*10 :: yyyymmddhh integer :: edri16 ! EDR 16TH MESH I-COORDINATE integer :: edrj16 ! EDR 16TH MESH J-COORDINATE integer :: edrlat ! EDR LATITUDE (100THS OF DEGREES) @@ -1435,6 +1451,8 @@ subroutine getsmi (date10, ssmis) data lunsrc / 43, 44 / data routine_name / 'GETSMI '/ + yyyymmddhh = date10 + ! ALLOCATE ARRAYS. allocate (icecount_0p25deg (igrid , jgrid)) allocate (icetotal_0p25deg (igrid , jgrid)) @@ -1592,7 +1610,7 @@ subroutine getsmi (date10, ssmis) end if end do end do - + ! Interpolate the 0.25deg data to the LDT grid nr = LDT_rc%lnr(1) nc = LDT_rc%lnc(1) @@ -1636,7 +1654,8 @@ subroutine getsmi (date10, ssmis) if (msgline > 1) then - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, yyyymmddhh, & + message) end if @@ -2226,7 +2245,8 @@ subroutine getsst (date10, stmpdir, sstdir) character*7 :: iofunc ! ACTION TO BE PERFORMED !character*90 :: message (msglns) ! ERROR MESSAGE character*255 :: message (msglns) ! ERROR MESSAGE - character*12 :: routine_name ! NAME OF THIS SUBROUTINE + character*20 :: routine_name ! NAME OF THIS SUBROUTINE + character*10 :: yyyymmddhh integer :: runcycle ! CYCLE TIME integer :: hrdiff ! DIFFERENCE BETWEEN HOURS integer :: julsno ! JULIAN HOUR OF SNODEP CYCLE @@ -2246,6 +2266,8 @@ subroutine getsst (date10, stmpdir, sstdir) data routine_name / 'GETSST '/ + yyyymmddhh = date10 + ! FIND THE DATE/TIME GROUP OF THE PREVIOUS CYCLE. ! GET SEA SURFACE TEMPERATURE DATA. iofunc = 'READING' @@ -2321,14 +2343,16 @@ subroutine getsst (date10, stmpdir, sstdir) else message(1) = '[ERR] ERROR READING FILE' message(2) = '[ERR] PATH = ' // file_grib - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, & + yyyymmddhh, message) write(ldt_logunit, 6400) routine_name, iofunc, file_grib, & grstat end if else message(1) = '[ERR] ERROR OPENING FILE' message(2) = '[ERR] PATH = ' // file_grib - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, & + yyyymmddhh, message) write(ldt_logunit, 6400) routine_name, iofunc, file_grib, grstat end if end if @@ -2348,7 +2372,8 @@ subroutine getsst (date10, stmpdir, sstdir) message(1) = ' SST DATA IS MORE THAN 24 HOURS OLD' message(2) = ' USAFSI CYCLE = ' // date10 message(3) = ' SEA SFC TEMP = ' // date10_sst - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, & + yyyymmddhh, message) end if @@ -2357,7 +2382,8 @@ subroutine getsst (date10, stmpdir, sstdir) else message(1) = '[WARN] SEA SURFACE TEMPERATURE DATA NOT FOUND' - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, & + yyyymmddhh, message) write (ldt_logunit, 6600) routine_name end if @@ -2491,7 +2517,8 @@ subroutine getviirs (date10, viirsdir) character(255) :: snoage_path ! FULLY-QUALIFIED SNOAGE FILE NAME character(7) :: iofunc ! ACTION TO BE PERFORMED character(90) :: message (msglns) ! ERROR MESSAGE - character(12) :: routine_name ! NAME OF THIS SUBROUTINE + character(20) :: routine_name ! NAME OF THIS SUBROUTINE + character(10) :: yyyymmddhh integer :: i ! SNODEP I-COORDINATE integer :: icount ! LOOP COUNTER integer :: julhr ! AFWA JULIAN HOUR @@ -2517,12 +2544,14 @@ subroutine getviirs (date10, viirsdir) write(LDT_logunit,*)& '[ERR] Recompile with LIBGEOTIFF support and try again!' call LDT_endrun() - + #else external :: ztif_frac_slice ! EMK 20220113 data routine_name / 'GETVIIRS ' / + yyyymmddhh = date10 + ! ALLOCATE DATA ARRAYS. nc = LDT_rc%lnc(1) nr = LDT_rc%lnr(1) @@ -2545,7 +2574,7 @@ subroutine getviirs (date10, viirsdir) idim = igrid_viirs, & jdim = jgrid_viirs, & proj=viirs_0p005deg_proj) - + ! INITIALIZE VARIABLES. icount = 0 iofunc = 'READING' @@ -2628,7 +2657,7 @@ subroutine getviirs (date10, viirsdir) ! No error for this slice, so process do i_viirs = 1, igrid_viirs - + ! Find lat/lon of VIIRS pixel, and then determine which ! LDT grid box this falls in. ri_viirs = real(i_viirs) @@ -2654,13 +2683,13 @@ subroutine getviirs (date10, viirsdir) j = 1 else if (j > nr) then j = nr - end if + end if pixels(i,j) = pixels(i,j) + 1 ! Skip if the pixel age is too old. if (agebuf_slice(i_viirs) > & usafsi_settings%maxpixage) cycle - + ! Increment the appropriate snow/bare counter if (mapbuf_slice(i_viirs) .eq. 0) then bare(i,j) = bare(i,j) + 1 @@ -2688,7 +2717,7 @@ subroutine getviirs (date10, viirsdir) end do file_search - if (map_exists .and. age_exists .and. ierr .eq. 0) then + if (map_exists .and. age_exists .and. ierr .eq. 0) then ! From the geolocated data, create the final VIIRS snow cover map do j = 1, nr @@ -2714,7 +2743,8 @@ subroutine getviirs (date10, viirsdir) usafsi_settings%useviirs = .false. message(1) = '[WARN] VIIRS SNOW MAP FILE NOT FOUND' !message(2) = '[WARN] PATH = ' // trim(snomap_path) - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, & + yyyymmddhh, message) write (ldt_logunit, 6400) routine_name, snomap_path end if @@ -2722,7 +2752,8 @@ subroutine getviirs (date10, viirsdir) usafsi_settings%useviirs = .false. message(1) = '[WARN] VIIRS SNOW AGE FILE NOT FOUND' !message(2) = '[WARN] PATH = ' // trim(snoage_path) - call error_message (program_name, routine_name, message) + call error_message (program_name, routine_name, & + yyyymmddhh, message) write (ldt_logunit, 6400) routine_name, snoage_path end if diff --git a/ldt/USAFSI/USAFSI_espcdMod.F90 b/ldt/USAFSI/USAFSI_espcdMod.F90 index fc420a0a4..ef7670acd 100644 --- a/ldt/USAFSI/USAFSI_espcdMod.F90 +++ b/ldt/USAFSI/USAFSI_espcdMod.F90 @@ -66,7 +66,8 @@ subroutine find_espcd_cice_file(rootdir, region, & integer :: yyyy_local, mm_local, dd_local, hh_local integer :: fh_local character*255 :: message (msglns) - character*12 :: routine_name + character*20 :: routine_name + character*10 :: yyyymmddhh integer, parameter :: nlat_arc = 2501 integer, parameter :: nlat_ant = 1549 integer :: ncid, aice_varid @@ -85,6 +86,7 @@ subroutine find_espcd_cice_file(rootdir, region, & ! Build the file name. Note that all ESPC-D CICE runs start at 12Z. ! NOTE: CICE output is 12-hrly. call LDT_get_julhr(yyyy, mm, dd, hh, 0, 0, julhr) + write(yyyymmddhh,'(i4.4,i2.2,i2.2,i2.2)') yyyy, mm, dd, hh if (hh == 12) then fh_local = 0 else if (hh == 18) then @@ -135,7 +137,8 @@ subroutine find_espcd_cice_file(rootdir, region, & if (.not. file_exists) then message(1) = '[WARN] CANNOT FIND FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) cycle end if @@ -146,7 +149,8 @@ subroutine find_espcd_cice_file(rootdir, region, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT OPEN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) cycle end if @@ -155,7 +159,8 @@ subroutine find_espcd_cice_file(rootdir, region, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT FIND aice IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) ierr = nf90_close(ncid) cycle end if @@ -165,7 +170,8 @@ subroutine find_espcd_cice_file(rootdir, region, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT GET DIMENSIONS FOR aice IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) ierr = nf90_close(ncid) cycle end if @@ -174,7 +180,8 @@ subroutine find_espcd_cice_file(rootdir, region, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT GET DIMENSIONS FOR aice IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(dimids) ierr = nf90_close(ncid) cycle @@ -186,7 +193,8 @@ subroutine find_espcd_cice_file(rootdir, region, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT GET DIMENSIONS FOR aice IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(dimids) deallocate(lens) ierr = nf90_close(ncid) @@ -205,7 +213,8 @@ subroutine find_espcd_cice_file(rootdir, region, & lens(1) .ne. nlon) then message(1) = '[WARN] BAD DIMENSIONS FOR aice IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(lens) ierr = nf90_close(ncid) cycle @@ -218,7 +227,8 @@ subroutine find_espcd_cice_file(rootdir, region, & lens(1) .ne. nlon) then message(1) = '[WARN] BAD DIMENSIONS FOR aice IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(lens) ierr = nf90_close(ncid) cycle @@ -236,7 +246,8 @@ subroutine find_espcd_cice_file(rootdir, region, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT READ aice IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(aice) ierr = nf90_close(ncid) cycle @@ -344,7 +355,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & integer :: yyyy_local, mm_local, dd_local, hh_local, fh_local logical :: file_exists character*255 :: message (msglns) - character*12 :: routine_name + character*20 :: routine_name + character*10 :: yyyymmddhh integer :: ncid, water_temp_varid integer :: ndims integer, allocatable :: dimids(:), lens(:) @@ -362,6 +374,7 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & ! Build the file name. Note that all ESPC-D SST runs start at 12Z. call LDT_get_julhr(yyyy, mm, dd, hh, 0, 0, & julhr) + write(yyyymmddhh,'(i4.4,i2.2,i2.2,i2.2)') yyyy, mm, dd, hh if (hh == 12) then fh_local = 0 else if (hh == 18) then @@ -407,7 +420,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & if (.not. file_exists) then message(1) = '[WARN] CANNOT FIND FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) cycle end if @@ -418,7 +432,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT OPEN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) cycle end if @@ -428,7 +443,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & if (ierr .ne. nf90_noerr) then message(1) = '[WARN] CANNOT FIND water_temp IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) ierr = nf90_close(ncid) cycle end if @@ -439,7 +455,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & message(1) = & '[WARN] CANNOT GET DIMENSIONS FOR water_temp IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) ierr = nf90_close(ncid) cycle end if @@ -447,7 +464,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & message(1) = & '[WARN] BAD DIMENSIONS FOR water_temp IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) ierr = nf90_close(ncid) cycle end if @@ -457,7 +475,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & message(1) = & '[WARN] CANNOT GET DIMENSIONS FOR water_temp IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(dimids) ierr = nf90_close(ncid) cycle @@ -471,7 +490,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & message(1) = & '[WARN] CANNOT GET DIMENSIONS FOR water_temp IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(dimids) deallocate(lens) ierr = nf90_close(ncid) @@ -489,7 +509,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & message(1) = & '[WARN] CANNOT GET DIMENSIONS FOR water_temp IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(lens) ierr = nf90_close(ncid) cycle @@ -505,7 +526,8 @@ subroutine find_espcd_sst_file(rootdir, yyyy, mm, dd, hh, & message(1) = & '[WARN] CANNOT READ water_temp IN FILE' message(2) = '[WARN] PATH = ' // trim(filename) - call error_message(program_name, routine_name, message) + call error_message(program_name, routine_name, yyyymmddhh, & + message) deallocate(water_temp) ierr = nf90_close(ncid) cycle diff --git a/ldt/USAFSI/USAFSI_utilMod.F90 b/ldt/USAFSI/USAFSI_utilMod.F90 index 3d430ca3a..a150f2632 100644 --- a/ldt/USAFSI/USAFSI_utilMod.F90 +++ b/ldt/USAFSI/USAFSI_utilMod.F90 @@ -9,18 +9,19 @@ !-------------------------END NOTICE -- DO NOT EDIT----------------------- ! ! MODULE: USAFSI_utilMod -! +! ! REVISION HISTORY: ! 08 Feb 2019 Eric Kemp First ported to LDT. ! 09 May 2019 Eric Kemp Renamed LDTSI. ! 13 Dec 2019 Eric Kemp Renamed USAFSI. +! 14 Oct 2024 Eric Kemp Updates to error_message. ! ! DESCRIPTION: ! Source code for util library for Air Force snow depth analysis. !------------------------------------------------------------------------- #include "LDT_misc.h" - + module USAFSI_utilMod !Defaults @@ -64,7 +65,6 @@ subroutine abort_message (program_name, routine_name, message) !** ======= !** 11 MAY 11 INITIAL VERSION (FROM ERROR_MESSAGE)...MR LEWISTON/16WS/WXE !** 22 Mar 19 Ported to LDT...Eric Kemp, NASA GSFC/SSAI - !** !************************************************************************* !************************************************************************* ! Imports @@ -84,7 +84,7 @@ subroutine abort_message (program_name, routine_name, message) ! Local variables character*7 :: access_type ! FILE ACCESS TYPE character*100 :: errmsg (msglns) ! ERROR MESSAGE TO OUTPUT - character*40 :: message_file ! MESSAGE FILE NAME + character*255 :: message_file ! MESSAGE FILE NAME integer :: i ! DO LOOP COUNTER integer :: istat ! I/O STATUS integer :: nlines ! NUMBER OF LINES IN MESSAGE @@ -127,7 +127,7 @@ subroutine abort_message (program_name, routine_name, message) close (99) !call abort call LDT_endrun() - + ! ERROR-HANDLING SECTION. 5000 write (ldt_logunit, 8000) routine_name, access_type, istat !call abort @@ -342,7 +342,8 @@ subroutine date10_julhr(date10, julhr, program_name, routine_name) end subroutine date10_julhr - subroutine error_message (program_name, routine_name, message) + subroutine error_message (program_name, routine_name, yyyymmddhh, & + message) !************************************************************************* !************************************************************************* @@ -371,6 +372,8 @@ subroutine error_message (program_name, routine_name, message) !** 22 Mar 19 Ported to LDT...Eric Kemp, NASA GSFC/SSAI !** 09 May 19 Renamed LDTSI...Eric Kemp, NASA GSFC/SSAI !** 13 Dec 19 Renamed USAFSI...Eric Kemp, NASA GSFC/SSAI + !** 15 Oct 24 Extended character lengths, and added valid date/time + !** of USAFSI analysis. !** !************************************************************************* !************************************************************************* @@ -385,14 +388,16 @@ subroutine error_message (program_name, routine_name, message) ! Arguments character*12, intent(in) :: program_name ! NAME OF CALLING ROUTINE - character*12, intent(in) :: routine_name ! NAME OF CALLING ROUTINE + character*20, intent(in) :: routine_name ! NAME OF CALLING ROUTINE + character*10, intent(in) :: yyyymmddhh + character(len=*), intent(in) :: message (msglns) ! ERROR MESSAGE FROM CALLER ! Local variables character*7 :: access_type ! FILE ACCESS TYPE character*2 :: calert_number ! ALERT NUMBER FOR FILE NAME !character*100 :: errmsg (msglns) ! ERROR MESSAGE TO OUTPUT character*255 :: errmsg (msglns) ! ERROR MESSAGE TO OUTPUT - character*40 :: message_file ! MESSAGE FILE NAME + character*255 :: message_file ! MESSAGE FILE NAME integer :: alert_number ! ALERT NUMBER integer :: i ! DO LOOP COUNTER integer :: istat ! I/O STATUS @@ -426,7 +431,7 @@ subroutine error_message (program_name, routine_name, message) do while (isfile) write (calert_number, '(i2.2)', iostat = istat) alert_number message_file = 'alert.' // trim(routine_name) // '.' // & - calert_number + yyyymmddhh // '.' // calert_number inquire (file=message_file, exist=isfile) alert_number = alert_number + 1 end do @@ -529,7 +534,7 @@ subroutine julhr_date10( julhr, date10, program_name, routine_call ) message = ' ' call tmjul4( hh, dd, mm, yyyy, julhr ) - + ! Check for valid hour, day, month, and year if( ( hh .lt. 0 .or. hh .gt. 23) .or. & ( dd .lt. 1 .or. dd .gt. 31) .or. & From 1cb3de0d54536b9048d8165d719cd0fe57e160b1 Mon Sep 17 00:00:00 2001 From: Eric Kemp Date: Wed, 16 Oct 2024 10:52:50 -0400 Subject: [PATCH 06/11] More revisions for error_message and abort_message. (1) Modified abort_message to accept larger character length for routine name. (2) Modified several subroutines to remain compatible with abort_message argument list. (3) Modified several calls to abort_message to pass along routine name as second argument. (4) Modified error_message to abort if the alert_number exceeds 99 (avoids infinite loop). (cherry picked from commit 63b768d7ee2b6273b9e65cd4616353beda8c435b) --- ldt/USAFSI/USAFSI_amsr2Mod.F90 | 2 +- ldt/USAFSI/USAFSI_analysisMod.F90 | 10 ++++----- ldt/USAFSI/USAFSI_run.F90 | 4 ++-- ldt/USAFSI/USAFSI_ssmisMod.F90 | 2 +- ldt/USAFSI/USAFSI_utilMod.F90 | 34 ++++++++++++++++++++++++------- ldt/USAFSI/USAFSI_xcalgmiMod.F90 | 2 +- 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/ldt/USAFSI/USAFSI_amsr2Mod.F90 b/ldt/USAFSI/USAFSI_amsr2Mod.F90 index 85c29ffa5..1de67e108 100755 --- a/ldt/USAFSI/USAFSI_amsr2Mod.F90 +++ b/ldt/USAFSI/USAFSI_amsr2Mod.F90 @@ -1400,7 +1400,7 @@ subroutine search_files(date10, amsr2_in) ! EMK character*12 :: program_name ! NAME OF CALLING PROGRAM - character*12 :: routine_name ! NAME OF THIS ROUTINE + character*20 :: routine_name ! NAME OF THIS ROUTINE ! define data values data routine_name / 'search_files' / diff --git a/ldt/USAFSI/USAFSI_analysisMod.F90 b/ldt/USAFSI/USAFSI_analysisMod.F90 index e9b2fcd8b..ad83cb3c7 100644 --- a/ldt/USAFSI/USAFSI_analysisMod.F90 +++ b/ldt/USAFSI/USAFSI_analysisMod.F90 @@ -551,7 +551,7 @@ subroutine getgeo (month, static, nc, nr, elevations) character*4 :: file_ext ! LAST PORTION OF FILE NAME character*255 :: file_path ! FULLY-QUALIFIED FILE NAME character*90 :: message (msglns) ! ERROR MESSAGE - character*12 :: routine_name ! NAME OF THIS SUBROUTINE + character*20 :: routine_name ! NAME OF THIS SUBROUTINE real, allocatable :: climo_0p25deg(:,:) integer*1, allocatable :: snow_poss_0p25deg(:,:) type(proj_info) :: snodep_0p25deg_proj @@ -1765,7 +1765,7 @@ subroutine getsno (date10, modif, unmod, nc, nr, landice, julhr_beg, & character*10 :: date10_prev ! PREVIOUS CYCLE DATE-TIME GROUP character*255 :: file_path ! INPUT FILE PATH AND NAME character*90 :: message (msglns) ! ERROR MESSAGE - character*12 :: routine_name ! NAME OF THIS SUBROUTINE + character*20 :: routine_name ! NAME OF THIS SUBROUTINE character*255 :: prevdir ! PATH TO PREVIOUS CYCLE'S DATA integer :: runcycle ! CYCLE HOUR integer :: julhr ! AFWA JULIAN HOUR @@ -2064,7 +2064,7 @@ subroutine getsno (date10, modif, unmod, nc, nr, landice, julhr_beg, & 4200 continue message(1) = '[ERR] ERROR CONVERTING DATA FROM CHARACTER TO INTEGER' message(2) = '[ERR] DATE10 = ' // date10 - call abort_message (program_name, program_name, message) + call abort_message (program_name, routine_name, message) call LDT_endrun() ! FORMAT STATEMENTS. @@ -2098,7 +2098,7 @@ subroutine getsno_nc(date10, julhr_beg, ierr) integer :: limit, tries integer :: runcycle integer :: julhr - character*12 :: routine_name + character*20 :: routine_name character*10 :: date10_prev character*90 :: message(msglns) @@ -2167,7 +2167,7 @@ subroutine getsno_nc(date10, julhr_beg, ierr) 4200 continue message(1) = '[ERR] ERROR CONVERTING DATA FROM CHARACTER TO INTEGER' message(2) = '[ERR] DATE10 = ' // date10 - call abort_message (program_name, program_name, message) + call abort_message (program_name, routine_name, message) call LDT_endrun() ! Other format statements diff --git a/ldt/USAFSI/USAFSI_run.F90 b/ldt/USAFSI/USAFSI_run.F90 index 9040a101e..2f77909a2 100644 --- a/ldt/USAFSI/USAFSI_run.F90 +++ b/ldt/USAFSI/USAFSI_run.F90 @@ -131,7 +131,7 @@ subroutine USAFSI_run(n) logical :: sfctmp_found ! FLAG FOR SFC TEMP FILE FOUND real, allocatable :: sfctmp (:, :) ! GALWEM OR LIS SHELTER TEMPERATURE DATA real, allocatable :: stadep (:) ! OBSERVATION SNOW DEPTH (METERS) - character*12 :: routine_name + character*20 :: routine_name type(LDT_bratseth_t) :: bratseth character*10 :: network10, platform10 real :: rob, rlat, rlon, relev @@ -541,7 +541,7 @@ subroutine USAFSI_run(n) message(1) = ' [ERR] ERROR CONVERTING DATA FROM CHARACTER TO INTEGER' message(2) = ' [ERR] DATE10 = ' // date10 - call abort_message (program_name, program_name, message) + call abort_message (program_name, routine_name, message) call LDT_endrun() ! FORMAT STATEMENTS. diff --git a/ldt/USAFSI/USAFSI_ssmisMod.F90 b/ldt/USAFSI/USAFSI_ssmisMod.F90 index 1557f7475..9c674d8a0 100644 --- a/ldt/USAFSI/USAFSI_ssmisMod.F90 +++ b/ldt/USAFSI/USAFSI_ssmisMod.F90 @@ -1029,7 +1029,7 @@ subroutine search_files(date10, ssmis_in) ! EMK character*12 :: program_name ! NAME OF CALLING PROGRAM - character*12 :: routine_name ! NAME OF THIS ROUTINE + character*20 :: routine_name ! NAME OF THIS ROUTINE ! define data values data satid / '16', '17', '18' / diff --git a/ldt/USAFSI/USAFSI_utilMod.F90 b/ldt/USAFSI/USAFSI_utilMod.F90 index a150f2632..15b6f6cc6 100644 --- a/ldt/USAFSI/USAFSI_utilMod.F90 +++ b/ldt/USAFSI/USAFSI_utilMod.F90 @@ -78,7 +78,7 @@ subroutine abort_message (program_name, routine_name, message) ! Arguments character*12, intent(in) :: program_name ! NAME OF CALLING ROUTINE - character*12, intent(in) :: routine_name ! NAME OF CALLING ROUTINE + character*20, intent(in) :: routine_name ! NAME OF CALLING ROUTINE character*90, intent(in) :: message (msglns) ! ERROR MESSAGE FROM CALLER ! Local variables @@ -140,7 +140,7 @@ subroutine abort_message (program_name, routine_name, message) 6600 format (1X, 75('*')) 8000 format (/, 1X, 75('*'), & /, 1X, '[ERR] ABNORMAL ABORT FROM ABORT_MESSAGE ROUTINE', & - /, 1X, '[ERR] CALLED BY ', A12, & + /, 1X, '[ERR] CALLED BY ', A20, & /, 1X, '[ERR] ERROR WHILE ', A7, ' MESSAGE FILE', & /, 1X, '[ERR] ISTAT = ', I6, & /, 1X, 75('*')) @@ -213,7 +213,7 @@ subroutine date10_julhr(date10, julhr, program_name, routine_name) character*10, intent(in) :: date10 ! 10-DIGIT DATE-TIME GROUP integer, intent(out) :: julhr ! TOTAL JULIAN HOURS character*12, intent(in) :: program_name ! NAME OF CALLING PROGRAM - character*12, intent(in) :: routine_name ! NAME OF CALLING ROUTINE + character*20, intent(in) :: routine_name ! NAME OF CALLING ROUTINE ! Local variables character*90 :: message (20) ! ERROR MESSAGE ! EMK @@ -419,6 +419,7 @@ subroutine error_message (program_name, routine_name, yyyymmddhh, & errmsg(1) = '[WARN] PROGRAM: ' // trim (program_name) errmsg(2) = '[WARN] ROUTINE: ' // trim (routine_name) do i = 3, nlines + if (i > msglns) exit errmsg(i) = trim(message(i-2)) enddo @@ -434,6 +435,25 @@ subroutine error_message (program_name, routine_name, yyyymmddhh, & yyyymmddhh // '.' // calert_number inquire (file=message_file, exist=isfile) alert_number = alert_number + 1 + if (alert_number > 99) then + write(LDT_logunit,*) & + '[ERR] Too many alert files in work directory for ', & + 'alert.' // trim(routine_name) // '.' // yyyymmddhh + write(LDT_logunit,*) & + '[ERR] Please purge alert files and try again' + write(LDT_logunit,*) 'LDT will now abort' + + errmsg(1) = '[ERR] PROGRAM: ' // trim (program_name) + errmsg(2) = '[ERR] ROUTINE: ' // trim (routine_name) + errmsg(3) = & + '[ERR] TOO MANY ALERT FILES, SO REPORTING IN ABORT MESSAGE' + do i = 4, nlines + if (i > msglns) exit + errmsg(i) = trim(message(i-3)) + enddo + call abort_message(program_name, routine_name, errmsg) + + end if end do ! OPEN MESSAGE FILE. @@ -519,7 +539,7 @@ subroutine julhr_date10( julhr, date10, program_name, routine_call ) integer, intent(in) :: julhr ! AFWA JULIAN HOUR character*10, intent(out) :: date10 ! 10-DIGIT DATE-TIME GROUP character*12, intent(in) :: program_name ! NAME OF CALLING PROGRAM - character*12, intent(in) :: routine_call ! NAME OF CALLING ROUTINE + character*20, intent(in) :: routine_call ! NAME OF CALLING ROUTINE ! Local variables character*90 :: message (20) ! ERROR MESSAGE ! EMK @@ -648,7 +668,7 @@ subroutine putget_int1 ( buffer, iofunc, file_name, program_name, & character*1, intent(in) :: iofunc ! I/O FUNCTION ('r', 'w') character*255, intent(in) :: file_name ! FILE PATH AND NAME character*12, intent(in) :: program_name ! NAME OF CALLING PROGRAM - character*12, intent(in) :: routine_name ! NAME OF CALLING ROUTINE + character*20, intent(in) :: routine_name ! NAME OF CALLING ROUTINE integer, intent(in) :: igrid ! SIZE OF GRID IN I-DIRECTION integer, intent(in) :: jgrid ! SIZE OF GRID IN I-DIRECTION @@ -757,7 +777,7 @@ subroutine putget_int ( buffer, iofunc, file_name, program_name, & character*1, intent(in) :: iofunc ! I/O FUNCTION ('r', 'w') character*255, intent(in) :: file_name ! FILE PATH AND NAME character*12, intent(in) :: program_name ! NAME OF CALLING PROGRAM - character*12, intent(in) :: routine_name ! NAME OF CALLING ROUTINE + character*20, intent(in) :: routine_name ! NAME OF CALLING ROUTINE integer, intent(in) :: igrid ! SIZE OF GRID IN I-DIRECTION integer, intent(in) :: jgrid ! SIZE OF GRID IN I-DIRECTION @@ -866,7 +886,7 @@ subroutine putget_real ( buffer, iofunc, file_name, program_name, & character*1, intent(in) :: iofunc ! I/O FUNCTION ('r', 'w') character(len=*), intent(in) :: file_name ! FILE PATH AND NAME character*12, intent(in) :: program_name ! NAME OF CALLING PROGRAM - character*12, intent(in) :: routine_name ! NAME OF CALLING ROUTINE + character*20, intent(in) :: routine_name ! NAME OF CALLING ROUTINE integer, intent(in) :: igrid ! SIZE OF GRID IN I-DIRECTION integer, intent(in) :: jgrid ! SIZE OF GRID IN I-DIRECTION diff --git a/ldt/USAFSI/USAFSI_xcalgmiMod.F90 b/ldt/USAFSI/USAFSI_xcalgmiMod.F90 index e3e25ef47..7ba7c08ea 100755 --- a/ldt/USAFSI/USAFSI_xcalgmiMod.F90 +++ b/ldt/USAFSI/USAFSI_xcalgmiMod.F90 @@ -1290,7 +1290,7 @@ subroutine search_files(date10, gmi_in) ! EMK character*12 :: program_name ! NAME OF CALLING PROGRAM - character*12 :: routine_name ! NAME OF THIS ROUTINE + character*20 :: routine_name ! NAME OF THIS ROUTINE ! define data values data routine_name / 'search_files' / From 2ba298f6175179499b38db0aaa4264cce4d1c447 Mon Sep 17 00:00:00 2001 From: Eric Kemp Date: Wed, 16 Oct 2024 13:20:39 -0400 Subject: [PATCH 07/11] Further tweaks to abort_message. Added flexible character length for message argument, and increased the internal errmsg character length to 255 (consistent with error_message). This fixes strange formatting of messages written to abort file. (cherry picked from commit 62f4f6853d54111a79c8bcf1ac9d0d468b68a8f2) --- ldt/USAFSI/USAFSI_utilMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ldt/USAFSI/USAFSI_utilMod.F90 b/ldt/USAFSI/USAFSI_utilMod.F90 index 15b6f6cc6..8c1cd38ec 100644 --- a/ldt/USAFSI/USAFSI_utilMod.F90 +++ b/ldt/USAFSI/USAFSI_utilMod.F90 @@ -79,11 +79,11 @@ subroutine abort_message (program_name, routine_name, message) ! Arguments character*12, intent(in) :: program_name ! NAME OF CALLING ROUTINE character*20, intent(in) :: routine_name ! NAME OF CALLING ROUTINE - character*90, intent(in) :: message (msglns) ! ERROR MESSAGE FROM CALLER + character(len=*), intent(in) :: message (msglns) ! ERROR MESSAGE FROM CALLER ! Local variables character*7 :: access_type ! FILE ACCESS TYPE - character*100 :: errmsg (msglns) ! ERROR MESSAGE TO OUTPUT + character*255 :: errmsg (msglns) ! ERROR MESSAGE TO OUTPUT character*255 :: message_file ! MESSAGE FILE NAME integer :: i ! DO LOOP COUNTER integer :: istat ! I/O STATUS From b602fd794c32a707bad1fb6ac1ffbb57895c37bf Mon Sep 17 00:00:00 2001 From: "Kristi R. Arsenault" Date: Fri, 25 Oct 2024 09:38:24 -0400 Subject: [PATCH 08/11] Final Updates for new S2S NMME code - Updates made to the main S2S run script and other BCSD scripts to accommodate more logging of error messages for users when initial processing of forecast forcings are handled. - Increased some of the slurm runtimes for some E2ES steps so time-outs do not occur at times (e.g., when a server/node is slower due to number of jobs). - Updated the s2s_config, LDT and LIS config template files to include the new NMME models, and also reflect the final IMERG V07B and GALWEM radiation for the "global_usaf_forc" related steps. - Updated the S2S LIS 7.5 Readme file to reflect the latest changes and options in the code in relation to the new NMME models and Python module versions. --- lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 | 2 +- .../ldt.config_noahmp401_nmme_canesm5_202408 | 167 ++++++++++++ .../ldt.config_noahmp401_nmme_cesm1_202408 | 167 ++++++++++++ .../ldt.config_noahmp401_nmme_gnemo52_202408 | 167 ++++++++++++ ...hmp401.hymap2.da_ics_forecast_CESM1_202408 | 254 ++++++++++++++++++ ...p401.hymap2.da_ics_forecast_CanESM5_202408 | 254 ++++++++++++++++++ ...p401.hymap2.da_ics_forecast_GNEMO52_202408 | 254 ++++++++++++++++++ ...fig.s2sglobal.noahmp401_12mem.hymap2.DARun | 15 +- .../input/lis.config.template | 19 +- .../usaf/s2s/s2s_app/download_nmme_precip.sh | 4 +- .../usaf/s2s/s2s_app/s2s_config_global_fcast | 4 +- .../usaf/s2s/s2s_app/s2s_config_global_hcast | 4 +- lis/utils/usaf/s2s/s2s_app/s2s_run.sh | 63 +++-- .../convert_forecast_data_to_netcdf.py | 2 + .../bcsd_library/process_forecast_data.py | 20 +- .../template_files/lis.config_template.GLOBAL | 15 +- .../generate_lis_config_scriptfiles_fcst.py | 17 +- .../usaf/s2s/s2s_modules/shared/utils.py | 23 +- 18 files changed, 1386 insertions(+), 65 deletions(-) create mode 100755 lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_canesm5_202408 create mode 100755 lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_cesm1_202408 create mode 100755 lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_gnemo52_202408 create mode 100755 lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CESM1_202408 create mode 100755 lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CanESM5_202408 create mode 100755 lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_GNEMO52_202408 diff --git a/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 b/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 index 774ee955b..0ed84eaa0 100755 --- a/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 +++ b/lis/utils/usaf/s2s/README_GHI-S2S_LIS7.5 @@ -3,7 +3,7 @@ Subseasonal-to-Seasonal (S2S) End-to-End System (E2ES) Master Doc NASA/GSFC GHI-S2S Team - Last Modified 27 Sep 2024 + Last Modified 24 Oct 2024 TABLE OF CONTENTS _________________ diff --git a/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_canesm5_202408 b/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_canesm5_202408 new file mode 100755 index 000000000..6797df2a9 --- /dev/null +++ b/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_canesm5_202408 @@ -0,0 +1,167 @@ + +LDT running mode: "Ensemble restart processing" + +Processed LSM parameter filename: ../LDT_Params/lis_input.s2s_global.noahmp401_hymap2.25km.nc +LIS number of nests: 1 +Number of surface model types: 2 +Surface model types: "LSM" "Openwater" +Land surface model: "Noah-MP.4.0.1" +Routing model: none +Lake model: none +Water fraction cutoff value: 0.5 +Incorporate crop information: .false. +Number of met forcing sources: 0 +Met forcing sources: none +Undefined value: -9999.0 + +# -- New LDT restart generation sampling option + +LIS restart source: "LSM" +Ensemble restart generation mode: downscale +Ensemble restart generation sampling strategy: "random sampling" + +Input restart filename: ./output/SURFACEMODEL/202208/LIS_RST_NOAHMP401_202208312345.d01.nc +Output restart filename: ./CanESM5/LIS_RST_NOAHMP401_202208312345.ICS_Sep2022.ens10.nc +Number of ensembles per tile (input restart): 12 +#Number of ensembles per tile (input restart): 1 +Number of ensembles per tile (output restart): 10 + +Number of ensembles per tile: 12 +#Number of ensembles per tile: 1 + +Maximum number of surface type tiles per grid: 1 +Minimum cutoff percentage (surface type tiles): 0.05 +Maximum number of soil texture tiles per grid: 1 +Minimum cutoff percentage (soil texture tiles): 0.05 +Maximum number of soil fraction tiles per grid: 1 +Minimum cutoff percentage (soil fraction tiles): 0.05 +Maximum number of elevation bands per grid: 1 +Minimum cutoff percentage (elevation bands): 0.05 +Maximum number of slope bands per grid: 1 +Minimum cutoff percentage (slope bands): 0.05 +Maximum number of aspect bands per grid: 1 +Minimum cutoff percentage (aspect bands): 0.05 + +LDT diagnostic file: ./CanESM5/ldtlog_noahmp401_Sep2022 +Mask-parameter fill diagnostic file: ./CanESM5/MaskParamFill.log +LDT output directory: ./CanESM5/ + +#-- + +#AFRICOM 25KM domain: +Map projection of the LIS domain: latlon +Run domain lower left lat: -89.875 +Run domain upper right lat: 89.875 +Run domain lower left lon: -179.875 +Run domain upper right lon: 179.875 +Run domain resolution (dx): 0.25 +Run domain resolution (dy): 0.25 + +#Landcover parameter inputs +Landcover data source: "MODIS_Native" +Landcover classification: "IGBPNCEP" +Landcover file: ./input/LS_PARAMETERS/noah_2dparms/igbp.bin +Landcover spatial transform: tile +Landcover map projection: latlon +Landcover fill option: neighbor +Landcover fill radius: 5 +Landcover fill value: 10 + +#Landmask parameter inputs +Create or readin landmask: "readin" +Landmask data source: "UKMO_CAP_Netcdf" +Landmask file: ./input/data/cap2ldt_ps41.nc +Landmask spatial transform: mode # Go from ~10 KM to 25KM domain ... +Landmask map projection: latlon +Landmask lower left lat: -89.9531250 +Landmask lower left lon: -179.9296875 +Landmask upper right lat: 89.9531250 +Landmask upper right lon: 179.9296875 +Landmask resolution (dx): 0.1406250 +Landmask resolution (dy): 0.0937500 + +#Soil parameter inputs +Soil fraction data source: none +Soils spatial transform: none +Soils map projection: latlon +Soils fill option: none +Porosity data source: none +Porosity map: none + +#Soil texture map: +Soil texture data source: none +#Soil texture data source: "STATSGOFAO_Native" +Soil texture map: ./input/LS_PARAMETERS/noah_2dparms/topsoil30snew +Soil texture spatial transform: mode +Soil texture map projection: latlon +Soil texture fill option: neighbor +Soil texture fill radius: 5 +Soil texture fill value: 6 +Soil texture fill value for Antarctica: 16 +Soil texture force exclusion of water points during fill: true + +#Topography parameter inputs +Elevation data source: "none" +Elevation number of bands: 1 +Elevation map: none +Slope data source: "none" +Slope number of bands: 1 +Slope map: none +Aspect data source: "none" +Aspect number of bands: 1 +Aspect map: none +Topography spatial transform: average +Topography map projection: latlon + +#Albedo inputs +Albedo data source: "none" +Albedo map: ./input/LS_PARAMETERS/noah_2dparms/albedo +Albedo climatology interval: monthly +Albedo spatial transform: "budget-bilinear" +Albedo map projection: latlon +Albedo fill option: neighbor +Albedo fill radius: 5 +Albedo fill value: 0.15 + +#Maximum snow albedo inputs +Max snow albedo data source: "none" +Max snow albedo map: ./input/LS_PARAMETERS/noah_2dparms/maximum_snow_albedo.hdf +Max snow albedo spatial transform: average +Max snow albedo map projection: latlon +Max snow albedo fill option: neighbor +Max snow albedo fill radius: 5 +Max snow albedo fill value: 0.3 + +#Greenness inputs +Greenness data source: "none" +Greenness fraction map: ./input/LS_PARAMETERS/noah_2dparms/gfrac +Greenness climatology interval: monthly +Calculate min-max greenness fraction: .false. +Greenness maximum map: ./input/LS_PARAMETERS/noah_2dparms/gfrac_max.asc +Greenness minimum map: ./input/LS_PARAMETERS/noah_2dparms/gfrac_min.asc +Greenness spatial transform: "budget-bilinear" +Greenness map projection: latlon +Greenness fill option: neighbor +Greenness fill radius: 5 +Greenness fill value: 0.3 +Greenness maximum fill value: 1.0 +Greenness minimum fill value: 0.0 + +#Slope type inputs +Slope type data source: "none" + +#Bottom temperature inputs +Bottom temperature data source: "none" +Bottom temperature map: ./input/LS_PARAMETERS/noah_2dparms/SOILTEMP.60 +Bottom temperature spatial transform: "budget-bilinear" +Bottom temperature map projection: latlon +Bottom temperature fill option: average +Bottom temperature fill radius: 5 +Bottom temperature fill value: 287.0 +Bottom temperature topographic downscaling: "lapse-rate" + +#Noah-MP LSM inputs +Noah-MP PBL Height Value: 900. + +# ----- + diff --git a/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_cesm1_202408 b/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_cesm1_202408 new file mode 100755 index 000000000..901bab6e9 --- /dev/null +++ b/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_cesm1_202408 @@ -0,0 +1,167 @@ + +LDT running mode: "Ensemble restart processing" + +Processed LSM parameter filename: ../LDT_Params/lis_input.s2s_global.noahmp401_hymap2.25km.nc +LIS number of nests: 1 +Number of surface model types: 2 +Surface model types: "LSM" "Openwater" +Land surface model: "Noah-MP.4.0.1" +Routing model: none +Lake model: none +Water fraction cutoff value: 0.5 +Incorporate crop information: .false. +Number of met forcing sources: 0 +Met forcing sources: none +Undefined value: -9999.0 + +# -- New LDT restart generation sampling option + +LIS restart source: "LSM" +Ensemble restart generation mode: downscale +Ensemble restart generation sampling strategy: "random sampling" + +Input restart filename: ./output/SURFACEMODEL/202208/LIS_RST_NOAHMP401_202208312345.d01.nc +Output restart filename: ./CESM1/LIS_RST_NOAHMP401_202208312345.ICS_Sep2022.ens10.nc +Number of ensembles per tile (input restart): 12 +#Number of ensembles per tile (input restart): 1 +Number of ensembles per tile (output restart): 10 + +Number of ensembles per tile: 12 +#Number of ensembles per tile: 1 + +Maximum number of surface type tiles per grid: 1 +Minimum cutoff percentage (surface type tiles): 0.05 +Maximum number of soil texture tiles per grid: 1 +Minimum cutoff percentage (soil texture tiles): 0.05 +Maximum number of soil fraction tiles per grid: 1 +Minimum cutoff percentage (soil fraction tiles): 0.05 +Maximum number of elevation bands per grid: 1 +Minimum cutoff percentage (elevation bands): 0.05 +Maximum number of slope bands per grid: 1 +Minimum cutoff percentage (slope bands): 0.05 +Maximum number of aspect bands per grid: 1 +Minimum cutoff percentage (aspect bands): 0.05 + +LDT diagnostic file: ./CESM1/ldtlog_noahmp401_Sep2022 +Mask-parameter fill diagnostic file: ./CESM1/MaskParamFill.log +LDT output directory: ./CESM1/ + +#-- + +#AFRICOM 25KM domain: +Map projection of the LIS domain: latlon +Run domain lower left lat: -89.875 +Run domain upper right lat: 89.875 +Run domain lower left lon: -179.875 +Run domain upper right lon: 179.875 +Run domain resolution (dx): 0.25 +Run domain resolution (dy): 0.25 + +#Landcover parameter inputs +Landcover data source: "MODIS_Native" +Landcover classification: "IGBPNCEP" +Landcover file: ./input/LS_PARAMETERS/noah_2dparms/igbp.bin +Landcover spatial transform: tile +Landcover map projection: latlon +Landcover fill option: neighbor +Landcover fill radius: 5 +Landcover fill value: 10 + +#Landmask parameter inputs +Create or readin landmask: "readin" +Landmask data source: "UKMO_CAP_Netcdf" +Landmask file: ./input/data/cap2ldt_ps41.nc +Landmask spatial transform: mode # Go from ~10 KM to 25KM domain ... +Landmask map projection: latlon +Landmask lower left lat: -89.9531250 +Landmask lower left lon: -179.9296875 +Landmask upper right lat: 89.9531250 +Landmask upper right lon: 179.9296875 +Landmask resolution (dx): 0.1406250 +Landmask resolution (dy): 0.0937500 + +#Soil parameter inputs +Soil fraction data source: none +Soils spatial transform: none +Soils map projection: latlon +Soils fill option: none +Porosity data source: none +Porosity map: none + +#Soil texture map: +Soil texture data source: none +#Soil texture data source: "STATSGOFAO_Native" +Soil texture map: ./input/LS_PARAMETERS/noah_2dparms/topsoil30snew +Soil texture spatial transform: mode +Soil texture map projection: latlon +Soil texture fill option: neighbor +Soil texture fill radius: 5 +Soil texture fill value: 6 +Soil texture fill value for Antarctica: 16 +Soil texture force exclusion of water points during fill: true + +#Topography parameter inputs +Elevation data source: "none" +Elevation number of bands: 1 +Elevation map: none +Slope data source: "none" +Slope number of bands: 1 +Slope map: none +Aspect data source: "none" +Aspect number of bands: 1 +Aspect map: none +Topography spatial transform: average +Topography map projection: latlon + +#Albedo inputs +Albedo data source: "none" +Albedo map: ./input/LS_PARAMETERS/noah_2dparms/albedo +Albedo climatology interval: monthly +Albedo spatial transform: "budget-bilinear" +Albedo map projection: latlon +Albedo fill option: neighbor +Albedo fill radius: 5 +Albedo fill value: 0.15 + +#Maximum snow albedo inputs +Max snow albedo data source: "none" +Max snow albedo map: ./input/LS_PARAMETERS/noah_2dparms/maximum_snow_albedo.hdf +Max snow albedo spatial transform: average +Max snow albedo map projection: latlon +Max snow albedo fill option: neighbor +Max snow albedo fill radius: 5 +Max snow albedo fill value: 0.3 + +#Greenness inputs +Greenness data source: "none" +Greenness fraction map: ./input/LS_PARAMETERS/noah_2dparms/gfrac +Greenness climatology interval: monthly +Calculate min-max greenness fraction: .false. +Greenness maximum map: ./input/LS_PARAMETERS/noah_2dparms/gfrac_max.asc +Greenness minimum map: ./input/LS_PARAMETERS/noah_2dparms/gfrac_min.asc +Greenness spatial transform: "budget-bilinear" +Greenness map projection: latlon +Greenness fill option: neighbor +Greenness fill radius: 5 +Greenness fill value: 0.3 +Greenness maximum fill value: 1.0 +Greenness minimum fill value: 0.0 + +#Slope type inputs +Slope type data source: "none" + +#Bottom temperature inputs +Bottom temperature data source: "none" +Bottom temperature map: ./input/LS_PARAMETERS/noah_2dparms/SOILTEMP.60 +Bottom temperature spatial transform: "budget-bilinear" +Bottom temperature map projection: latlon +Bottom temperature fill option: average +Bottom temperature fill radius: 5 +Bottom temperature fill value: 287.0 +Bottom temperature topographic downscaling: "lapse-rate" + +#Noah-MP LSM inputs +Noah-MP PBL Height Value: 900. + +# ----- + diff --git a/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_gnemo52_202408 b/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_gnemo52_202408 new file mode 100755 index 000000000..7a8baffb5 --- /dev/null +++ b/lis/utils/usaf/s2s/for_discover/ldt/ldt.config_noahmp401_nmme_gnemo52_202408 @@ -0,0 +1,167 @@ + +LDT running mode: "Ensemble restart processing" + +Processed LSM parameter filename: ../LDT_Params/lis_input.s2s_global.noahmp401_hymap2.25km.nc +LIS number of nests: 1 +Number of surface model types: 2 +Surface model types: "LSM" "Openwater" +Land surface model: "Noah-MP.4.0.1" +Routing model: none +Lake model: none +Water fraction cutoff value: 0.5 +Incorporate crop information: .false. +Number of met forcing sources: 0 +Met forcing sources: none +Undefined value: -9999.0 + +# -- New LDT restart generation sampling option + +LIS restart source: "LSM" +Ensemble restart generation mode: downscale +Ensemble restart generation sampling strategy: "random sampling" + +Input restart filename: ./output/SURFACEMODEL/202208/LIS_RST_NOAHMP401_202208312345.d01.nc +Output restart filename: ./GNEMO52/LIS_RST_NOAHMP401_202208312345.ICS_Sep2022.ens10.nc +Number of ensembles per tile (input restart): 12 +#Number of ensembles per tile (input restart): 1 +Number of ensembles per tile (output restart): 10 + +Number of ensembles per tile: 12 +#Number of ensembles per tile: 1 + +Maximum number of surface type tiles per grid: 1 +Minimum cutoff percentage (surface type tiles): 0.05 +Maximum number of soil texture tiles per grid: 1 +Minimum cutoff percentage (soil texture tiles): 0.05 +Maximum number of soil fraction tiles per grid: 1 +Minimum cutoff percentage (soil fraction tiles): 0.05 +Maximum number of elevation bands per grid: 1 +Minimum cutoff percentage (elevation bands): 0.05 +Maximum number of slope bands per grid: 1 +Minimum cutoff percentage (slope bands): 0.05 +Maximum number of aspect bands per grid: 1 +Minimum cutoff percentage (aspect bands): 0.05 + +LDT diagnostic file: ./GNEMO52/ldtlog_noahmp401_Sep2022 +Mask-parameter fill diagnostic file: ./GNEMO52/MaskParamFill.log +LDT output directory: ./GNEMO52/ + +#-- + +#AFRICOM 25KM domain: +Map projection of the LIS domain: latlon +Run domain lower left lat: -89.875 +Run domain upper right lat: 89.875 +Run domain lower left lon: -179.875 +Run domain upper right lon: 179.875 +Run domain resolution (dx): 0.25 +Run domain resolution (dy): 0.25 + +#Landcover parameter inputs +Landcover data source: "MODIS_Native" +Landcover classification: "IGBPNCEP" +Landcover file: ./input/LS_PARAMETERS/noah_2dparms/igbp.bin +Landcover spatial transform: tile +Landcover map projection: latlon +Landcover fill option: neighbor +Landcover fill radius: 5 +Landcover fill value: 10 + +#Landmask parameter inputs +Create or readin landmask: "readin" +Landmask data source: "UKMO_CAP_Netcdf" +Landmask file: ./input/data/cap2ldt_ps41.nc +Landmask spatial transform: mode # Go from ~10 KM to 25KM domain ... +Landmask map projection: latlon +Landmask lower left lat: -89.9531250 +Landmask lower left lon: -179.9296875 +Landmask upper right lat: 89.9531250 +Landmask upper right lon: 179.9296875 +Landmask resolution (dx): 0.1406250 +Landmask resolution (dy): 0.0937500 + +#Soil parameter inputs +Soil fraction data source: none +Soils spatial transform: none +Soils map projection: latlon +Soils fill option: none +Porosity data source: none +Porosity map: none + +#Soil texture map: +Soil texture data source: none +#Soil texture data source: "STATSGOFAO_Native" +Soil texture map: ./input/LS_PARAMETERS/noah_2dparms/topsoil30snew +Soil texture spatial transform: mode +Soil texture map projection: latlon +Soil texture fill option: neighbor +Soil texture fill radius: 5 +Soil texture fill value: 6 +Soil texture fill value for Antarctica: 16 +Soil texture force exclusion of water points during fill: true + +#Topography parameter inputs +Elevation data source: "none" +Elevation number of bands: 1 +Elevation map: none +Slope data source: "none" +Slope number of bands: 1 +Slope map: none +Aspect data source: "none" +Aspect number of bands: 1 +Aspect map: none +Topography spatial transform: average +Topography map projection: latlon + +#Albedo inputs +Albedo data source: "none" +Albedo map: ./input/LS_PARAMETERS/noah_2dparms/albedo +Albedo climatology interval: monthly +Albedo spatial transform: "budget-bilinear" +Albedo map projection: latlon +Albedo fill option: neighbor +Albedo fill radius: 5 +Albedo fill value: 0.15 + +#Maximum snow albedo inputs +Max snow albedo data source: "none" +Max snow albedo map: ./input/LS_PARAMETERS/noah_2dparms/maximum_snow_albedo.hdf +Max snow albedo spatial transform: average +Max snow albedo map projection: latlon +Max snow albedo fill option: neighbor +Max snow albedo fill radius: 5 +Max snow albedo fill value: 0.3 + +#Greenness inputs +Greenness data source: "none" +Greenness fraction map: ./input/LS_PARAMETERS/noah_2dparms/gfrac +Greenness climatology interval: monthly +Calculate min-max greenness fraction: .false. +Greenness maximum map: ./input/LS_PARAMETERS/noah_2dparms/gfrac_max.asc +Greenness minimum map: ./input/LS_PARAMETERS/noah_2dparms/gfrac_min.asc +Greenness spatial transform: "budget-bilinear" +Greenness map projection: latlon +Greenness fill option: neighbor +Greenness fill radius: 5 +Greenness fill value: 0.3 +Greenness maximum fill value: 1.0 +Greenness minimum fill value: 0.0 + +#Slope type inputs +Slope type data source: "none" + +#Bottom temperature inputs +Bottom temperature data source: "none" +Bottom temperature map: ./input/LS_PARAMETERS/noah_2dparms/SOILTEMP.60 +Bottom temperature spatial transform: "budget-bilinear" +Bottom temperature map projection: latlon +Bottom temperature fill option: average +Bottom temperature fill radius: 5 +Bottom temperature fill value: 287.0 +Bottom temperature topographic downscaling: "lapse-rate" + +#Noah-MP LSM inputs +Noah-MP PBL Height Value: 900. + +# ----- + diff --git a/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CESM1_202408 b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CESM1_202408 new file mode 100755 index 000000000..e955ce5e4 --- /dev/null +++ b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CESM1_202408 @@ -0,0 +1,254 @@ +#Overall driver options +Running mode: "retrospective" +Map projection of the LIS domain: latlon +Number of nests: 1 +Number of surface model types: 2 +Surface model types: "LSM" "Openwater" +Land surface model: "Noah-MP.4.0.1" +Open water model: "template open water" +Surface model output interval: 1da + +Blending method for forcings: overlay +Number of met forcing sources: 2 +# Generic Ensemble Forecast readers: +Name of base forecast model: CFSv2 +Met forcing sources: "GenEnsFcst" "PPTEnsFcst" +Temporal interpolation method (met forcing): "linear" "linear" +# Double-check the interpolation options, based on input grid resolution: +Spatial interpolation method (met forcing): "neighbor" "neighbor" # 25KM_res grid +Spatial upscaling method (met forcing): "none" "none" +Enable spatial downscaling of precipitation: 0 0 +Topographic correction method (met forcing): "none" "none" + + +# Number of hindcast ensemble members: +Number of ensembles per tile: 10 + +# Initial Condition (IC) mode for the LSM: +Start mode: restart + +#Runtime options +Forcing variables list file: input/forcing_variables.txt +Output methodology: "2d ensemble gridspace" +Output model restart files: 1 +Output data format: netcdf +Output naming style: "3 level hierarchy" +Enable output statistics: .false. + +Starting year: 2022 +Starting month: 09 +Starting day: 1 +Starting hour: 0 +Starting minute: 0 +Starting second: 0 +Ending year: 2023 +Ending month: 06 # End of 9-month hindcast +Ending day: 1 +Ending hour: 0 +Ending minute: 0 +Ending second: 0 +Undefined value: -9999 +Output directory: 202209/CESM1 +Diagnostic output file: 202209/CESM1/logs/lislog + +#The following options are used for subgrid tiling based on vegetation +Maximum number of surface type tiles per grid: 1 +Minimum cutoff percentage (surface type tiles): 0.05 +Maximum number of soil texture tiles per grid: 1 +Minimum cutoff percentage (soil texture tiles): 0.05 +Maximum number of soil fraction tiles per grid: 1 +Minimum cutoff percentage (soil fraction tiles): 0.05 +Maximum number of elevation bands per grid: 1 +Minimum cutoff percentage (elevation bands): 0.05 +Maximum number of slope bands per grid: 1 +Minimum cutoff percentage (slope bands): 0.05 +Maximum number of aspect bands per grid: 1 +Minimum cutoff percentage (aspect bands): 0.05 + +#Processor layout +Number of processors along x: 4 +Number of processors along y: 72 +Halo size along x: 0 +Halo size along y: 0 + +#Sub-models +Radiative transfer model: none +Number of application models: 0 + +#---------------------DATA ASSIMILATION ---------------------------------- + +Number of data assimilation instances: 0 +Data assimilation algorithm: none +Data assimilation set: none +Data assimilation exclude analysis increments: 0 +Data assimilation output interval for diagnostics: 1da +Data assimilation number of observation types: 0 +Data assimilation output ensemble members: 0 +Data assimilation output processed observations: 0 +Data assimilation output innovations: 0 +Data assimilation use a trained forward model: 0 +Data assimilation trained forward model output file: none + +#Bias estimation options +Bias estimation algorithm: none +Bias estimation attributes file: none +Bias estimation restart output frequency: 1da +Bias estimation start mode: none +Bias estimation restart file: none + +#Perturbation options +Perturbations start mode: coldstart +Perturbations restart output interval: 1da +Perturbations restart filename: none +Forcing perturbation algorithm: none +Forcing perturbation frequency: 1hr +Forcing attributes file: none +Forcing perturbation attributes file: none +State perturbation algorithm: none +State perturbation frequency: 1hr +State attributes file: none +State perturbation attributes file: none +Observation perturbation algorithm: none +Observation perturbation frequency: 1hr +Observation attributes file: none +Observation perturbation attributes file: none + +#------------------------DOMAIN SPECIFICATION-------------------------- +#The following options list the choice of parameter maps to be used + +LIS domain and parameter data file: ./input/lis_input.s2s_global.noahmp401_hymap2.25km.nc + +Landmask data source: LDT +Landcover data source: LDT +Soil texture data source: LDT +Soil fraction data source: none +Soil color data source: none +Elevation data source: LDT +Slope data source: LDT +Aspect data source: LDT +Curvature data source: none +LAI data source: none +SAI data source: none +Albedo data source: LDT +Max snow albedo data source: LDT +Greenness data source: LDT +Roughness data source: none +Porosity data source: none +Ksat data source: none +B parameter data source: none +Quartz data source: none +Emissivity data source: none + +TBOT lag skin temperature update option: 0 +TBOT skin temperature lag days: 0 + +#--------------------------------FORCINGS---------------------------------- + +# Ensemble Forecast (user-generated): +# NOTE: Below directories paths are temporary placeholders: +Generic ensemble forecast directory: bcsd_fcst/NMME/final/6-Hourly/CESM1 +Generic ensemble forecast initial date: 20220901 +Generic ensemble forecast number of ensemble members: 10 + +Precipitation ensemble forecast directory: bcsd_fcst/NMME/final/6-Hourly/CESM1 +Precipitation ensemble forecast initial date: 20220901 +Precipitation ensemble forecast number of ensemble members: 10 + +# Example: +#Generic ensemble forecast directory: ./GEOS5/Shrad_BCSD/6-hourly/1982/may01/ens#/GEOS5.all_forc_198205.nc4 + +#-----------------------LAND SURFACE MODELS-------------------------- +# Noah-MP.4.0.1 LSM: +Noah-MP.4.0.1 model timestep: 15mn + +# Restart ICs for hindcast/forecast runs: +Noah-MP.4.0.1 restart file: ./input/LDT_ICs/CESM1/LIS_RST_NOAHMP401_202208312345.ICS_Sep2022.ens10.nc +# Note: Above 12-member restart file is a placeholder for now ... +Noah-MP.4.0.1 restart output interval: 1mo +Noah-MP.4.0.1 restart file format: netcdf + +Noah-MP.4.0.1 soil parameter table: ./input/noahmp401_parms/SOILPARM.TBL +Noah-MP.4.0.1 general parameter table: ./input/noahmp401_parms/GENPARM.TBL +Noah-MP.4.0.1 MP parameter table: ./input/noahmp401_parms/MPTABLE.TBL +Noah-MP.4.0.1 number of soil layers: 4 +Noah-MP.4.0.1 thickness of soil layers: 0.1 0.3 0.6 1.0 +Noah-MP.4.0.1 dynamic vegetation option: 4 # 9 options available +Noah-MP.4.0.1 canopy stomatal resistance option: 1 # 1=Ball-Berry; 2=Jarvis +Noah-MP.4.0.1 soil moisture factor for stomatal resistance: 1 # 1=Noah; 2=CLM; 3=SSiB +Noah-MP.4.0.1 runoff and groundwater option: 1 # 1=SIMGM; 2=SIMTOP; 3=Schaake96; 4=BATS +Noah-MP.4.0.1 surface layer drag coefficient option: 1 # 1=M-O; 2=Chen97 +Noah-MP.4.0.1 supercooled liquid water option: 1 # 1=NY06; 2=Koren99 +Noah-MP.4.0.1 frozen soil permeability option: 1 # 1=NY06; 2=Koren99 +Noah-MP.4.0.1 radiation transfer option: 3 # 1=gap=F(3D;cosz); 2=gap=0; 3=gap=1-Fveg +Noah-MP.4.0.1 snow surface albedo option: 2 # 1=BATS; 2=CLASS +Noah-MP.4.0.1 rainfall & snowfall option: 1 # 1=Jordan91; 2=BATS; 3=Noah +Noah-MP.4.0.1 lower boundary of soil temperature option: 2 # 1=zero-flux; 2=Noah +Noah-MP.4.0.1 snow&soil temperature time scheme option: 1 # 1=semi-implicit; 2=fully implicit +Noah-MP.4.0.1 glacier option: 1 # 1=include phase change; 2=slab ice (Noah) +Noah-MP.4.0.1 surface resistance option: 1 # 1=Sakaguchi and Zeng 2009; 2=Sellers (1992); 3=adjusted Sellers; 4=option1 for non-snow and rsurf_snow for snow +Noah-MP.4.0.1 soil configuration option: 1 # 1=input dominant soil texture; 2=input soil texture varies that varies with depth; 3=soil composition and pedotransfer functions +Noah-MP.4.0.1 soil pedotransfer function option: 1 # 1=Saxton and Rawls (2006) (used when soil_opt=3) +Noah-MP.4.0.1 crop model option: 0 # 0=No crop model; 1=Liu et al. 2016; 2=Gecros +Noah-MP.4.0.1 urban physics option: 0 # 0=No; 1=Single-layer; 2=Multi-layer BEP scheme; 3=Multi-layer BEM scheme +Noah-MP.4.0.1 initial surface skin temperature: 288.0 +Noah-MP.4.0.1 initial soil temperatures: 288.0 288.0 288.0 288.0 +Noah-MP.4.0.1 initial total soil moistures: 0.20 0.20 0.20 0.20 +Noah-MP.4.0.1 initial snow water equivalent: 0.0 +Noah-MP.4.0.1 initial snow depth: 0.0 +Noah-MP.4.0.1 initial total canopy surface water: 0.0 +Noah-MP.4.0.1 initial leaf area index: 0.5 +Noah-MP.4.0.1 initial water table depth: 2.5 +Noah-MP.4.0.1 initial water in the aquifer: 4900.0 +Noah-MP.4.0.1 initial water in aquifer and saturated soil: 4900.0 +Noah-MP.4.0.1 reference height of temperature and humidity: 10.0 + +Template open water timestep: 15mn + + +#----------------------- ROUTING -------------------------- +# ROUTING MODEL: HYMAP +Routing model: "HYMAP2 router" + +# Restart ICs for hindcast/forecast runs: +HYMAP2 routing model start mode: restart +HYMAP2 routing model restart file: ./input/LDT_ICs/CESM1/LIS_RST_HYMAP2_router_202208312345.ICS_Sep2022.ens1.nc +# Note: Above 12-member restart file is a placeholder for now ... +HYMAP2 routing model restart interval: "1mo" + +HYMAP2 routing model time step: "15mn" +HYMAP2 routing model output interval: "1da" +HYMAP2 enable 2-way coupling: 0 +HYMAP2 run in ensemble mode: 0 # Run HYMAP in single member mode + +HYMAP2 routing method: "kinematic" #"local inertia" +HYMAP2 routing model time step method: "constant" # "adaptive" +HYMAP2 routing model adaptive time step alfa coefficient: 1.0 +HYMAP2 floodplain dynamics: 1 +HYMAP2 routing model dwi flag: 0 + +HYMAP2 routing model evaporation option: none # "penman" +HYMAP2 routing model linear reservoir flag: 0 +HYMAP2 reservoir operation option: 0 +HYMAP2 number of reservoirs: 1 +HYMAP2 reservoir operation input time series size: 2 +HYMAP2 reservoir operation input directory: ./ +HYMAP2 reservoir operation header filename: ./header_test.txt +HYMAP2 reservoir operation input data type: "water level" # "streamflow" # + +TEMPLATE model timestep: "15mn" + + +#---------------------------MODEL OUTPUT CONFIGURATION----------------------- +#Specify the list of ALMA variables that need to be featured in the +#LSM model output + +Model output attributes file: ./input/tables/MODEL_OUTPUT_LIST.TBL.noahmp401_hymap2_s2s_fcst + +# Start Date/Time when output is to be started: +Output start year: +Output start month: +Output start day: +Output start hour: +Output start minutes: +Output start seconds: + diff --git a/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CanESM5_202408 b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CanESM5_202408 new file mode 100755 index 000000000..cef1dd826 --- /dev/null +++ b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_CanESM5_202408 @@ -0,0 +1,254 @@ +#Overall driver options +Running mode: "retrospective" +Map projection of the LIS domain: latlon +Number of nests: 1 +Number of surface model types: 2 +Surface model types: "LSM" "Openwater" +Land surface model: "Noah-MP.4.0.1" +Open water model: "template open water" +Surface model output interval: 1da + +Blending method for forcings: overlay +Number of met forcing sources: 2 +# Generic Ensemble Forecast readers: +Name of base forecast model: CFSv2 +Met forcing sources: "GenEnsFcst" "PPTEnsFcst" +Temporal interpolation method (met forcing): "linear" "linear" +# Double-check the interpolation options, based on input grid resolution: +Spatial interpolation method (met forcing): "neighbor" "neighbor" # 25KM_res grid +Spatial upscaling method (met forcing): "none" "none" +Enable spatial downscaling of precipitation: 0 0 +Topographic correction method (met forcing): "none" "none" + + +# Number of hindcast ensemble members: +Number of ensembles per tile: 10 + +# Initial Condition (IC) mode for the LSM: +Start mode: restart + +#Runtime options +Forcing variables list file: input/forcing_variables.txt +Output methodology: "2d ensemble gridspace" +Output model restart files: 1 +Output data format: netcdf +Output naming style: "3 level hierarchy" +Enable output statistics: .false. + +Starting year: 2022 +Starting month: 09 +Starting day: 1 +Starting hour: 0 +Starting minute: 0 +Starting second: 0 +Ending year: 2023 +Ending month: 06 # End of 9-month hindcast +Ending day: 1 +Ending hour: 0 +Ending minute: 0 +Ending second: 0 +Undefined value: -9999 +Output directory: 202209/CanESM5 +Diagnostic output file: 202209/CanESM5/logs/lislog + +#The following options are used for subgrid tiling based on vegetation +Maximum number of surface type tiles per grid: 1 +Minimum cutoff percentage (surface type tiles): 0.05 +Maximum number of soil texture tiles per grid: 1 +Minimum cutoff percentage (soil texture tiles): 0.05 +Maximum number of soil fraction tiles per grid: 1 +Minimum cutoff percentage (soil fraction tiles): 0.05 +Maximum number of elevation bands per grid: 1 +Minimum cutoff percentage (elevation bands): 0.05 +Maximum number of slope bands per grid: 1 +Minimum cutoff percentage (slope bands): 0.05 +Maximum number of aspect bands per grid: 1 +Minimum cutoff percentage (aspect bands): 0.05 + +#Processor layout +Number of processors along x: 4 +Number of processors along y: 72 +Halo size along x: 0 +Halo size along y: 0 + +#Sub-models +Radiative transfer model: none +Number of application models: 0 + +#---------------------DATA ASSIMILATION ---------------------------------- + +Number of data assimilation instances: 0 +Data assimilation algorithm: none +Data assimilation set: none +Data assimilation exclude analysis increments: 0 +Data assimilation output interval for diagnostics: 1da +Data assimilation number of observation types: 0 +Data assimilation output ensemble members: 0 +Data assimilation output processed observations: 0 +Data assimilation output innovations: 0 +Data assimilation use a trained forward model: 0 +Data assimilation trained forward model output file: none + +#Bias estimation options +Bias estimation algorithm: none +Bias estimation attributes file: none +Bias estimation restart output frequency: 1da +Bias estimation start mode: none +Bias estimation restart file: none + +#Perturbation options +Perturbations start mode: coldstart +Perturbations restart output interval: 1da +Perturbations restart filename: none +Forcing perturbation algorithm: none +Forcing perturbation frequency: 1hr +Forcing attributes file: none +Forcing perturbation attributes file: none +State perturbation algorithm: none +State perturbation frequency: 1hr +State attributes file: none +State perturbation attributes file: none +Observation perturbation algorithm: none +Observation perturbation frequency: 1hr +Observation attributes file: none +Observation perturbation attributes file: none + +#------------------------DOMAIN SPECIFICATION-------------------------- +#The following options list the choice of parameter maps to be used + +LIS domain and parameter data file: ./input/lis_input.s2s_global.noahmp401_hymap2.25km.nc + +Landmask data source: LDT +Landcover data source: LDT +Soil texture data source: LDT +Soil fraction data source: none +Soil color data source: none +Elevation data source: LDT +Slope data source: LDT +Aspect data source: LDT +Curvature data source: none +LAI data source: none +SAI data source: none +Albedo data source: LDT +Max snow albedo data source: LDT +Greenness data source: LDT +Roughness data source: none +Porosity data source: none +Ksat data source: none +B parameter data source: none +Quartz data source: none +Emissivity data source: none + +TBOT lag skin temperature update option: 0 +TBOT skin temperature lag days: 0 + +#--------------------------------FORCINGS---------------------------------- + +# Ensemble Forecast (user-generated): +# NOTE: Below directories paths are temporary placeholders: +Generic ensemble forecast directory: bcsd_fcst/NMME/final/6-Hourly/CanESM5 +Generic ensemble forecast initial date: 20220901 +Generic ensemble forecast number of ensemble members: 10 + +Precipitation ensemble forecast directory: bcsd_fcst/NMME/final/6-Hourly/CanESM5 +Precipitation ensemble forecast initial date: 20220901 +Precipitation ensemble forecast number of ensemble members: 10 + +# Example: +#Generic ensemble forecast directory: ./GEOS5/Shrad_BCSD/6-hourly/1982/may01/ens#/GEOS5.all_forc_198205.nc4 + +#-----------------------LAND SURFACE MODELS-------------------------- +# Noah-MP.4.0.1 LSM: +Noah-MP.4.0.1 model timestep: 15mn + +# Restart ICs for hindcast/forecast runs: +Noah-MP.4.0.1 restart file: ./input/LDT_ICs/CanESM5/LIS_RST_NOAHMP401_202208312345.ICS_Sep2022.ens10.nc +# Note: Above 12-member restart file is a placeholder for now ... +Noah-MP.4.0.1 restart output interval: 1mo +Noah-MP.4.0.1 restart file format: netcdf + +Noah-MP.4.0.1 soil parameter table: ./input/noahmp401_parms/SOILPARM.TBL +Noah-MP.4.0.1 general parameter table: ./input/noahmp401_parms/GENPARM.TBL +Noah-MP.4.0.1 MP parameter table: ./input/noahmp401_parms/MPTABLE.TBL +Noah-MP.4.0.1 number of soil layers: 4 +Noah-MP.4.0.1 thickness of soil layers: 0.1 0.3 0.6 1.0 +Noah-MP.4.0.1 dynamic vegetation option: 4 # 9 options available +Noah-MP.4.0.1 canopy stomatal resistance option: 1 # 1=Ball-Berry; 2=Jarvis +Noah-MP.4.0.1 soil moisture factor for stomatal resistance: 1 # 1=Noah; 2=CLM; 3=SSiB +Noah-MP.4.0.1 runoff and groundwater option: 1 # 1=SIMGM; 2=SIMTOP; 3=Schaake96; 4=BATS +Noah-MP.4.0.1 surface layer drag coefficient option: 1 # 1=M-O; 2=Chen97 +Noah-MP.4.0.1 supercooled liquid water option: 1 # 1=NY06; 2=Koren99 +Noah-MP.4.0.1 frozen soil permeability option: 1 # 1=NY06; 2=Koren99 +Noah-MP.4.0.1 radiation transfer option: 3 # 1=gap=F(3D;cosz); 2=gap=0; 3=gap=1-Fveg +Noah-MP.4.0.1 snow surface albedo option: 2 # 1=BATS; 2=CLASS +Noah-MP.4.0.1 rainfall & snowfall option: 1 # 1=Jordan91; 2=BATS; 3=Noah +Noah-MP.4.0.1 lower boundary of soil temperature option: 2 # 1=zero-flux; 2=Noah +Noah-MP.4.0.1 snow&soil temperature time scheme option: 1 # 1=semi-implicit; 2=fully implicit +Noah-MP.4.0.1 glacier option: 1 # 1=include phase change; 2=slab ice (Noah) +Noah-MP.4.0.1 surface resistance option: 1 # 1=Sakaguchi and Zeng 2009; 2=Sellers (1992); 3=adjusted Sellers; 4=option1 for non-snow and rsurf_snow for snow +Noah-MP.4.0.1 soil configuration option: 1 # 1=input dominant soil texture; 2=input soil texture varies that varies with depth; 3=soil composition and pedotransfer functions +Noah-MP.4.0.1 soil pedotransfer function option: 1 # 1=Saxton and Rawls (2006) (used when soil_opt=3) +Noah-MP.4.0.1 crop model option: 0 # 0=No crop model; 1=Liu et al. 2016; 2=Gecros +Noah-MP.4.0.1 urban physics option: 0 # 0=No; 1=Single-layer; 2=Multi-layer BEP scheme; 3=Multi-layer BEM scheme +Noah-MP.4.0.1 initial surface skin temperature: 288.0 +Noah-MP.4.0.1 initial soil temperatures: 288.0 288.0 288.0 288.0 +Noah-MP.4.0.1 initial total soil moistures: 0.20 0.20 0.20 0.20 +Noah-MP.4.0.1 initial snow water equivalent: 0.0 +Noah-MP.4.0.1 initial snow depth: 0.0 +Noah-MP.4.0.1 initial total canopy surface water: 0.0 +Noah-MP.4.0.1 initial leaf area index: 0.5 +Noah-MP.4.0.1 initial water table depth: 2.5 +Noah-MP.4.0.1 initial water in the aquifer: 4900.0 +Noah-MP.4.0.1 initial water in aquifer and saturated soil: 4900.0 +Noah-MP.4.0.1 reference height of temperature and humidity: 10.0 + +Template open water timestep: 15mn + + +#----------------------- ROUTING -------------------------- +# ROUTING MODEL: HYMAP +Routing model: "HYMAP2 router" + +# Restart ICs for hindcast/forecast runs: +HYMAP2 routing model start mode: restart +HYMAP2 routing model restart file: ./input/LDT_ICs/CanESM5/LIS_RST_HYMAP2_router_202208312345.ICS_Sep2022.ens1.nc +# Note: Above 12-member restart file is a placeholder for now ... +HYMAP2 routing model restart interval: "1mo" + +HYMAP2 routing model time step: "15mn" +HYMAP2 routing model output interval: "1da" +HYMAP2 enable 2-way coupling: 0 +HYMAP2 run in ensemble mode: 0 # Run HYMAP in single member mode + +HYMAP2 routing method: "kinematic" #"local inertia" +HYMAP2 routing model time step method: "constant" # "adaptive" +HYMAP2 routing model adaptive time step alfa coefficient: 1.0 +HYMAP2 floodplain dynamics: 1 +HYMAP2 routing model dwi flag: 0 + +HYMAP2 routing model evaporation option: none # "penman" +HYMAP2 routing model linear reservoir flag: 0 +HYMAP2 reservoir operation option: 0 +HYMAP2 number of reservoirs: 1 +HYMAP2 reservoir operation input time series size: 2 +HYMAP2 reservoir operation input directory: ./ +HYMAP2 reservoir operation header filename: ./header_test.txt +HYMAP2 reservoir operation input data type: "water level" # "streamflow" # + +TEMPLATE model timestep: "15mn" + + +#---------------------------MODEL OUTPUT CONFIGURATION----------------------- +#Specify the list of ALMA variables that need to be featured in the +#LSM model output + +Model output attributes file: ./input/tables/MODEL_OUTPUT_LIST.TBL.noahmp401_hymap2_s2s_fcst + +# Start Date/Time when output is to be started: +Output start year: +Output start month: +Output start day: +Output start hour: +Output start minutes: +Output start seconds: + diff --git a/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_GNEMO52_202408 b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_GNEMO52_202408 new file mode 100755 index 000000000..b7c01e9a7 --- /dev/null +++ b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401.hymap2.da_ics_forecast_GNEMO52_202408 @@ -0,0 +1,254 @@ +#Overall driver options +Running mode: "retrospective" +Map projection of the LIS domain: latlon +Number of nests: 1 +Number of surface model types: 2 +Surface model types: "LSM" "Openwater" +Land surface model: "Noah-MP.4.0.1" +Open water model: "template open water" +Surface model output interval: 1da + +Blending method for forcings: overlay +Number of met forcing sources: 2 +# Generic Ensemble Forecast readers: +Name of base forecast model: CFSv2 +Met forcing sources: "GenEnsFcst" "PPTEnsFcst" +Temporal interpolation method (met forcing): "linear" "linear" +# Double-check the interpolation options, based on input grid resolution: +Spatial interpolation method (met forcing): "neighbor" "neighbor" # 25KM_res grid +Spatial upscaling method (met forcing): "none" "none" +Enable spatial downscaling of precipitation: 0 0 +Topographic correction method (met forcing): "none" "none" + + +# Number of hindcast ensemble members: +Number of ensembles per tile: 10 + +# Initial Condition (IC) mode for the LSM: +Start mode: restart + +#Runtime options +Forcing variables list file: input/forcing_variables.txt +Output methodology: "2d ensemble gridspace" +Output model restart files: 1 +Output data format: netcdf +Output naming style: "3 level hierarchy" +Enable output statistics: .false. + +Starting year: 2022 +Starting month: 09 +Starting day: 1 +Starting hour: 0 +Starting minute: 0 +Starting second: 0 +Ending year: 2023 +Ending month: 06 # End of 9-month hindcast +Ending day: 1 +Ending hour: 0 +Ending minute: 0 +Ending second: 0 +Undefined value: -9999 +Output directory: 202209/GNEMO52 +Diagnostic output file: 202209/GNEMO52/logs/lislog + +#The following options are used for subgrid tiling based on vegetation +Maximum number of surface type tiles per grid: 1 +Minimum cutoff percentage (surface type tiles): 0.05 +Maximum number of soil texture tiles per grid: 1 +Minimum cutoff percentage (soil texture tiles): 0.05 +Maximum number of soil fraction tiles per grid: 1 +Minimum cutoff percentage (soil fraction tiles): 0.05 +Maximum number of elevation bands per grid: 1 +Minimum cutoff percentage (elevation bands): 0.05 +Maximum number of slope bands per grid: 1 +Minimum cutoff percentage (slope bands): 0.05 +Maximum number of aspect bands per grid: 1 +Minimum cutoff percentage (aspect bands): 0.05 + +#Processor layout +Number of processors along x: 4 +Number of processors along y: 72 +Halo size along x: 0 +Halo size along y: 0 + +#Sub-models +Radiative transfer model: none +Number of application models: 0 + +#---------------------DATA ASSIMILATION ---------------------------------- + +Number of data assimilation instances: 0 +Data assimilation algorithm: none +Data assimilation set: none +Data assimilation exclude analysis increments: 0 +Data assimilation output interval for diagnostics: 1da +Data assimilation number of observation types: 0 +Data assimilation output ensemble members: 0 +Data assimilation output processed observations: 0 +Data assimilation output innovations: 0 +Data assimilation use a trained forward model: 0 +Data assimilation trained forward model output file: none + +#Bias estimation options +Bias estimation algorithm: none +Bias estimation attributes file: none +Bias estimation restart output frequency: 1da +Bias estimation start mode: none +Bias estimation restart file: none + +#Perturbation options +Perturbations start mode: coldstart +Perturbations restart output interval: 1da +Perturbations restart filename: none +Forcing perturbation algorithm: none +Forcing perturbation frequency: 1hr +Forcing attributes file: none +Forcing perturbation attributes file: none +State perturbation algorithm: none +State perturbation frequency: 1hr +State attributes file: none +State perturbation attributes file: none +Observation perturbation algorithm: none +Observation perturbation frequency: 1hr +Observation attributes file: none +Observation perturbation attributes file: none + +#------------------------DOMAIN SPECIFICATION-------------------------- +#The following options list the choice of parameter maps to be used + +LIS domain and parameter data file: ./input/lis_input.s2s_global.noahmp401_hymap2.25km.nc + +Landmask data source: LDT +Landcover data source: LDT +Soil texture data source: LDT +Soil fraction data source: none +Soil color data source: none +Elevation data source: LDT +Slope data source: LDT +Aspect data source: LDT +Curvature data source: none +LAI data source: none +SAI data source: none +Albedo data source: LDT +Max snow albedo data source: LDT +Greenness data source: LDT +Roughness data source: none +Porosity data source: none +Ksat data source: none +B parameter data source: none +Quartz data source: none +Emissivity data source: none + +TBOT lag skin temperature update option: 0 +TBOT skin temperature lag days: 0 + +#--------------------------------FORCINGS---------------------------------- + +# Ensemble Forecast (user-generated): +# NOTE: Below directories paths are temporary placeholders: +Generic ensemble forecast directory: bcsd_fcst/NMME/final/6-Hourly/GNEMO52 +Generic ensemble forecast initial date: 20220901 +Generic ensemble forecast number of ensemble members: 10 + +Precipitation ensemble forecast directory: bcsd_fcst/NMME/final/6-Hourly/GNEMO52 +Precipitation ensemble forecast initial date: 20220901 +Precipitation ensemble forecast number of ensemble members: 10 + +# Example: +#Generic ensemble forecast directory: ./GEOS5/Shrad_BCSD/6-hourly/1982/may01/ens#/GEOS5.all_forc_198205.nc4 + +#-----------------------LAND SURFACE MODELS-------------------------- +# Noah-MP.4.0.1 LSM: +Noah-MP.4.0.1 model timestep: 15mn + +# Restart ICs for hindcast/forecast runs: +Noah-MP.4.0.1 restart file: ./input/LDT_ICs/GNEMO52/LIS_RST_NOAHMP401_202208312345.ICS_Sep2022.ens10.nc +# Note: Above 12-member restart file is a placeholder for now ... +Noah-MP.4.0.1 restart output interval: 1mo +Noah-MP.4.0.1 restart file format: netcdf + +Noah-MP.4.0.1 soil parameter table: ./input/noahmp401_parms/SOILPARM.TBL +Noah-MP.4.0.1 general parameter table: ./input/noahmp401_parms/GENPARM.TBL +Noah-MP.4.0.1 MP parameter table: ./input/noahmp401_parms/MPTABLE.TBL +Noah-MP.4.0.1 number of soil layers: 4 +Noah-MP.4.0.1 thickness of soil layers: 0.1 0.3 0.6 1.0 +Noah-MP.4.0.1 dynamic vegetation option: 4 # 9 options available +Noah-MP.4.0.1 canopy stomatal resistance option: 1 # 1=Ball-Berry; 2=Jarvis +Noah-MP.4.0.1 soil moisture factor for stomatal resistance: 1 # 1=Noah; 2=CLM; 3=SSiB +Noah-MP.4.0.1 runoff and groundwater option: 1 # 1=SIMGM; 2=SIMTOP; 3=Schaake96; 4=BATS +Noah-MP.4.0.1 surface layer drag coefficient option: 1 # 1=M-O; 2=Chen97 +Noah-MP.4.0.1 supercooled liquid water option: 1 # 1=NY06; 2=Koren99 +Noah-MP.4.0.1 frozen soil permeability option: 1 # 1=NY06; 2=Koren99 +Noah-MP.4.0.1 radiation transfer option: 3 # 1=gap=F(3D;cosz); 2=gap=0; 3=gap=1-Fveg +Noah-MP.4.0.1 snow surface albedo option: 2 # 1=BATS; 2=CLASS +Noah-MP.4.0.1 rainfall & snowfall option: 1 # 1=Jordan91; 2=BATS; 3=Noah +Noah-MP.4.0.1 lower boundary of soil temperature option: 2 # 1=zero-flux; 2=Noah +Noah-MP.4.0.1 snow&soil temperature time scheme option: 1 # 1=semi-implicit; 2=fully implicit +Noah-MP.4.0.1 glacier option: 1 # 1=include phase change; 2=slab ice (Noah) +Noah-MP.4.0.1 surface resistance option: 1 # 1=Sakaguchi and Zeng 2009; 2=Sellers (1992); 3=adjusted Sellers; 4=option1 for non-snow and rsurf_snow for snow +Noah-MP.4.0.1 soil configuration option: 1 # 1=input dominant soil texture; 2=input soil texture varies that varies with depth; 3=soil composition and pedotransfer functions +Noah-MP.4.0.1 soil pedotransfer function option: 1 # 1=Saxton and Rawls (2006) (used when soil_opt=3) +Noah-MP.4.0.1 crop model option: 0 # 0=No crop model; 1=Liu et al. 2016; 2=Gecros +Noah-MP.4.0.1 urban physics option: 0 # 0=No; 1=Single-layer; 2=Multi-layer BEP scheme; 3=Multi-layer BEM scheme +Noah-MP.4.0.1 initial surface skin temperature: 288.0 +Noah-MP.4.0.1 initial soil temperatures: 288.0 288.0 288.0 288.0 +Noah-MP.4.0.1 initial total soil moistures: 0.20 0.20 0.20 0.20 +Noah-MP.4.0.1 initial snow water equivalent: 0.0 +Noah-MP.4.0.1 initial snow depth: 0.0 +Noah-MP.4.0.1 initial total canopy surface water: 0.0 +Noah-MP.4.0.1 initial leaf area index: 0.5 +Noah-MP.4.0.1 initial water table depth: 2.5 +Noah-MP.4.0.1 initial water in the aquifer: 4900.0 +Noah-MP.4.0.1 initial water in aquifer and saturated soil: 4900.0 +Noah-MP.4.0.1 reference height of temperature and humidity: 10.0 + +Template open water timestep: 15mn + + +#----------------------- ROUTING -------------------------- +# ROUTING MODEL: HYMAP +Routing model: "HYMAP2 router" + +# Restart ICs for hindcast/forecast runs: +HYMAP2 routing model start mode: restart +HYMAP2 routing model restart file: ./input/LDT_ICs/GNEMO52/LIS_RST_HYMAP2_router_202208312345.ICS_Sep2022.ens1.nc +# Note: Above 12-member restart file is a placeholder for now ... +HYMAP2 routing model restart interval: "1mo" + +HYMAP2 routing model time step: "15mn" +HYMAP2 routing model output interval: "1da" +HYMAP2 enable 2-way coupling: 0 +HYMAP2 run in ensemble mode: 0 # Run HYMAP in single member mode + +HYMAP2 routing method: "kinematic" #"local inertia" +HYMAP2 routing model time step method: "constant" # "adaptive" +HYMAP2 routing model adaptive time step alfa coefficient: 1.0 +HYMAP2 floodplain dynamics: 1 +HYMAP2 routing model dwi flag: 0 + +HYMAP2 routing model evaporation option: none # "penman" +HYMAP2 routing model linear reservoir flag: 0 +HYMAP2 reservoir operation option: 0 +HYMAP2 number of reservoirs: 1 +HYMAP2 reservoir operation input time series size: 2 +HYMAP2 reservoir operation input directory: ./ +HYMAP2 reservoir operation header filename: ./header_test.txt +HYMAP2 reservoir operation input data type: "water level" # "streamflow" # + +TEMPLATE model timestep: "15mn" + + +#---------------------------MODEL OUTPUT CONFIGURATION----------------------- +#Specify the list of ALMA variables that need to be featured in the +#LSM model output + +Model output attributes file: ./input/tables/MODEL_OUTPUT_LIST.TBL.noahmp401_hymap2_s2s_fcst + +# Start Date/Time when output is to be started: +Output start year: +Output start month: +Output start day: +Output start hour: +Output start minutes: +Output start seconds: + diff --git a/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401_12mem.hymap2.DARun b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401_12mem.hymap2.DARun index 82bf188df..1d3b3780f 100755 --- a/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401_12mem.hymap2.DARun +++ b/lis/utils/usaf/s2s/for_discover/lis/lis.config.s2sglobal.noahmp401_12mem.hymap2.DARun @@ -249,9 +249,9 @@ AGRMET CMORPH minimum temperature threshold: 273 # Use IMERG rainfall data AGRMET use IMERG data: 1 # 1 = Use AGRMET IMERG temperature threshold: 278 -AGRMET IMERG data directory: ./IMERG/Early_V06B +AGRMET IMERG data directory: ./IMERG/Early_V07B AGRMET IMERG product: 3B-HHR-E # Early Run -AGRMET IMERG version: V06B # V06B released in 2019 +AGRMET IMERG version: V07B # V07B released Jun-1-2024 AGRMET IMERG Probability Liquid Precip Threshold: 100 # Bratseth runtime settings @@ -335,12 +335,17 @@ AGRMET GFS SPD10M station observation error variance: 2.48 # Radiation settings. Uses WWMCA cloud data. Use WWMCA_LE from # 20071101 to 2012032700, use NONE from 2012032700 to 2012040912, # use WWMCA beginning 2012040912. -AGRMET cloud data directory: WWMCA # WWMCA_LE, NONE, or WWMCA +#AGRMET cloud data directory: WWMCA # WWMCA_LE, NONE, or WWMCA # Use WWMCA GRIB1 files beginning 12Z 4 Jul 2020 AGRMET WWMCA GRIB1 read option: 1 AGRMET snow distribution shape parameter: 2.6 -AGRMET radiation derived from: "cloud types" -AGRMET GALWEM radiation data directory: WWMCA_GRIB +#AGRMET radiation derived from: "cloud types" +#AGRMET GALWEM radiation data directory: WWMCA_GRIB +## AS OF AUG-2024 and after S2S Forecast runs – use the following options: +# -- July 2, 2024, 00Z and onward: +AGRMET radiation derived from: "GALWEM_RAD" # GALWEM Radiation files +AGRMET cloud data directory: GALWEM # GALWEM forcing directory +AGRMET GALWEM radiation data directory: GALWEM # Legacy AGRMET settings. Eventually these will be removed, # but for now keep these settings. diff --git a/lis/utils/usaf/s2s/global_usaf_forc/input/lis.config.template b/lis/utils/usaf/s2s/global_usaf_forc/input/lis.config.template index 4a945aaf0..9b772fbc6 100755 --- a/lis/utils/usaf/s2s/global_usaf_forc/input/lis.config.template +++ b/lis/utils/usaf/s2s/global_usaf_forc/input/lis.config.template @@ -252,8 +252,6 @@ AGRMET use IMERG data: 1 # 1 = Use AGRMET IMERG temperature threshold: 278 AGRMET IMERG data directory: ./input/USAF_FORCING/IMERG AGRMET IMERG product: 3B-HHR-E # Early Run -## S2S June-2024 forecast – use the following option: -#AGRMET IMERG version: V06E # FOR MAY-2024 dates ## S2S July-2024 forecast and after – use the following option: AGRMET IMERG version: V07B # V07B started 1 June 2024 AGRMET IMERG Probability Liquid Precip Threshold: 100 @@ -339,26 +337,19 @@ AGRMET GFS SPD10M station observation error variance: 2.48 # Radiation settings. Uses WWMCA cloud data. Use WWMCA_LE from # 20071101 to 2012032700, use NONE from 2012032700 to 2012040912, # use WWMCA beginning 2012040912, use WWMCA_GRIB beginning 2020070412 -AGRMET cloud data directory: WWMCA_GRIB +#AGRMET cloud data directory: WWMCA_GRIB # Use WWMCA GRIB1 files beginning 12Z 4 Jul 2020 AGRMET WWMCA GRIB1 read option: 1 AGRMET snow distribution shape parameter: 2.6 # S2S AGRMET/Bratseth forcing generation step guidance: ## FOR JUNE-2024 S2S Forecast – use following options up to June 1, 2024, 00Z: -AGRMET radiation derived from: "cloud types" -AGRMET cloud data directory: WWMCA_GRIB # Original input WWMCA GRIB-1 files -# -## FOR JULY-2024 S2S Forecast – use following options up to June 24, 2024, 00Z: -#AGRMET radiation derived from: "cloud types" -#AGRMET cloud data directory: WWMCA_GRIB # Original input WWMCA GRIB-1 files -# -- June 24, 00Z to July 2, 2024, 00Z #AGRMET radiation derived from: "cloud types" -#AGRMET cloud data directory: WWMCA_GRIB_LOOKALIKE # WWMCA GRIB Look-alike files target directory +#AGRMET cloud data directory: WWMCA_GRIB # Original input WWMCA GRIB-1 files # -## FOR AUG-2024 and after S2S Forecast runs – use the following options: +## AS OF AUG-2024 and after S2S Forecast runs – use the following options: # -- July 2, 2024, 00Z and onward: -#AGRMET radiation derived from: "GALWEM_RAD" # GALWEM Radiation files -#AGRMET cloud data directory: GALWEM # GALWEM forcing directory +AGRMET radiation derived from: "GALWEM_RAD" # GALWEM Radiation files +AGRMET cloud data directory: GALWEM # GALWEM forcing directory AGRMET GALWEM radiation data directory: GALWEM # Legacy AGRMET settings. Eventually these will be removed, diff --git a/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh b/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh index 7d81bb32c..d06c2446b 100755 --- a/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh +++ b/lis/utils/usaf/s2s/s2s_app/download_nmme_precip.sh @@ -1,8 +1,8 @@ #!/bin/bash # -# SCRIPT: download_nmme_hindcasts_sshukla.csh +# SCRIPT: download_nmme_precip.sh # -# PURPOSE: Download monthly hindcasts of the NMME (version-2) +# PURPOSE: Download monthly NMME forecast data for the # ensemble of climate forecast models. # # AUTHOR: Shrad Shukla, UCSB, MAY-2016 diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast index e6b1f9f35..90b73e4a5 100755 --- a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast +++ b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_fcast @@ -68,8 +68,8 @@ FCST: - CanESM5: 3 CESM1: 3 GNEMO52: 3 - GEOSv2: 1 - CFSv2: 3 + GEOSv2: 2 + CFSv2: 5 GFDL: 9 ####################################################################### diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast index 329773fd5..2a4a9fbbb 100755 --- a/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast +++ b/lis/utils/usaf/s2s/s2s_app/s2s_config_global_hcast @@ -70,8 +70,8 @@ FCST: - CanESM5: 3 CESM1: 3 GNEMO52: 3 - GEOSv2: 1 - CFSv2: 3 + GEOSv2: 2 + CFSv2: 5 GFDL: 9 ####################################################################### diff --git a/lis/utils/usaf/s2s/s2s_app/s2s_run.sh b/lis/utils/usaf/s2s/s2s_app/s2s_run.sh index b4bd42b8d..bd3e0f8d3 100755 --- a/lis/utils/usaf/s2s/s2s_app/s2s_run.sh +++ b/lis/utils/usaf/s2s/s2s_app/s2s_run.sh @@ -12,7 +12,7 @@ # # Purpose: GHI-S2S End-to-End (E2E) subsystem runtime script # -# Date: 08-01-2023; Latest version +# Date: 10-24-2024; Latest version # ###################################################################### @@ -42,7 +42,7 @@ set_permission(){ line1= line2= else - line1="#SBATCH --cluster-constraint=green" + line1="#SBATCH --cluster-constraint=blue" line2="#SBATCH --partition=batch" fi @@ -274,6 +274,7 @@ export LISHDIR=${LISFDIR}/lis/utils/usaf/s2s/ export METFORC=`grep METFORC $CFILE | cut -d':' -f2 | tr -d "[:space:]"` export LISFMOD=`grep LISFMOD $CFILE | cut -d':' -f2 | tr -d "[:space:]"` export SPCODE=`grep SPCODE $CFILE | cut -d':' -f2 | tr -d "[:space:]"` +export CONSTRAINT=`grep CONSTRAINT $CFILE | cut -d':' -f2 | tr -d "[:space:]"` export DATATYPE=`grep DATATYPE $CFILE | cut -d':' -f2 | tr -d "[:space:]"` export E2ESROOT=`grep E2ESDIR $CFILE | cut -d':' -f2 | tr -d "[:space:]"` export DOMAIN=`grep DOMAIN $CFILE | cut -d':' -f2 | tr -d "[:space:]"` @@ -378,18 +379,23 @@ download_forecasts(){ # Download CFSv2 and NMME forecasts ####################################################################### - # CFSv2 forecast + # CFSv2 forecast files: sh s2s_app/wget_cfsv2_oper_ts_e2es.sh -y ${YYYY} -m ${MM} -c ${BWD}/${CFILE} -d N ret_code=$? if [ $ret_code -gt 0 ]; then exit fi - # NMME Precipitation + # NMME Precipitation forecast files: + echo "[INFO] Checking NMME Forecast Files " Mmm=`date -d "${YYYY}-${MM}-01" +%b` NMME_RAWDIR=`grep nmme_download_dir $CFILE | cut -d':' -f2 | tr -d "[:space:]"` prec_files=`ls $NMME_RAWDIR/*/*${Mmm}.${YYYY}.nc` + echo "[INFO] Current NMME files present: " + ls -1 $NMME_RAWDIR/*/*${Mmm}.${YYYY}.nc + all_models=`grep -n NMME_ALL: $CFILE | cut -d':' -f3` + echo "[INFO] All NMME models: "${all_models} LINE2=`grep -n NMME_models: $CFILE | cut -d':' -f1` new_line=" NMME_models: "`echo ${all_models}` @@ -400,15 +406,23 @@ download_forecasts(){ # NMME models since Aug-2024: declare -A nmme_models=( ["CanSIPS-IC4"]="GNEMO52, CanESM5" ["COLA-RSMAS-CESM1"]="CESM1" ["GFDL-SPEAR"]="GFDL" ["NASA-GEOSS2S"]="GEOSv2" ["NCEP-CFSv2"]="CFSv2" ) have_model="[" - + +# Check for the five NMME directories are present ... +# If 5 directories are present - skip any further downloads for current month ... +# -- Note: We will incorporate better file checks in the future. + if [ `echo $prec_files | wc -w` -lt 5 ]; then - + + echo "[WARN] -- Some NMME model data may be missing or not available ... " + # download NMME precip forecasts s2s_app/download_nmme_precip.sh ${YYYY} ${Mmm} ${CFILE} prec_files=`ls $NMME_RAWDIR/*/*${Mmm}.${YYYY}.nc` - -# for dir in CanSIPS-IC3 COLA-RSMAS-CCSM4 GFDL-SPEAR NASA-GEOSS2S NCEP-CFSv2 - for dir in CanSIPS-IC4 COLA-RSMAS-CESM1 GFDL-SPEAR NASA-GEOSS2S NCEP-CFSv2 + echo " ... New NMME files downloaded: " + ls -1 $NMME_RAWDIR/*/*${Mmm}.${YYYY}.nc + +# for dir in CanSIPS-IC3 COLA-RSMAS-CCSM4 GFDL-SPEAR NASA-GEOSS2S NCEP-CFSv2 + for dir in CanSIPS-IC4 COLA-RSMAS-CESM1 GFDL-SPEAR NASA-GEOSS2S NCEP-CFSv2 do fdown=$NMME_RAWDIR/$dir/prec.$dir.mon_${Mmm}.${YYYY}.nc if [ `file $fdown | rev | cut -d' ' -f1 | rev` == "data" ]; then @@ -482,9 +496,13 @@ lis_darun(){ # configure batch script # ---------------------- - python $LISHDIR/s2s_app/s2s_api.py -c ${BWD}/${CFILE} -f lisda_run.j -H 4 -j lisda_ -w ${CWD} -L Y + python $LISHDIR/s2s_app/s2s_api.py -c ${BWD}/${CFILE} -f lisda_run.j -H 5 -j lisda_ -w ${CWD} -L Y if [[ $NODE_NAME =~ discover* ]] || [[ $NODE_NAME =~ borg* ]]; then - COMMAND='mpirun -np $SLURM_NTASKS ./LIS' + if [[ $CONSTRAINT =~ "mil" ]]; then + COMMAND='./LIS ' + else + COMMAND='mpirun -np $SLURM_NTASKS ./LIS' + fi else COMMAND='srun ./LIS' fi @@ -618,6 +636,7 @@ bcsd_fcst(){ # -------------------------------------------------------------------------- cmdfile="bcsd01.file" jobname=bcsd01 + [ -e "${jobname}_01_run.j" ] && /bin/rm ${jobname}_*.j python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_01.py -s $YYYY -m $mmm -c $BWD/$CFILE -w ${CWD} -t 1 -H 2 -j $jobname job_list="$jobname*.j" bcsd01_ID= @@ -654,6 +673,7 @@ bcsd_fcst(){ # -------------------------------------------------------------- jobname=bcsd03 cmdfile="bcsd03.file" + [ -e "${jobname}_run.j" ] && /bin/rm ${jobname}_*.j python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_03.py -s $YYYY -m $MM -c $BWD/$CFILE -w ${CWD} -t 1 -H 2 -j $jobname unset job_list @@ -683,6 +703,7 @@ bcsd_fcst(){ # ------------------------------------------------------------------------------- jobname=bcsd04 cmdfile="bcsd04.file" + [ -e "${jobname}_01_run.j" ] && /bin/rm ${jobname}_*.j python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_04.py -s $YYYY -e $YYYY -m $mmm -n $MM -c $BWD/$CFILE -w ${CWD} -t 1 -H 3 -j $jobname unset job_list @@ -720,6 +741,7 @@ bcsd_fcst(){ # ------------------------------------------------------------------------------ jobname=bcsd05 cmdfile="bcsd05.file" + [ -e "${jobname}_01_run.j" ] && /bin/rm ${jobname}_*.j for model in $MODELS do python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_05.py -s $YYYY -e $YYYY -m $mmm -n $MM -c $BWD/$CFILE -w ${CWD} -t 1 -H 3 -M $model -j $jobname @@ -760,6 +782,7 @@ bcsd_fcst(){ # -------------------------------------------------------------------------- jobname=bcsd06 cmdfile="bcsd06.file" + [ -e "${jobname}_run.j" ] && /bin/rm ${jobname}_*.j python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_06.py -s $YYYY -e $YYYY -m $mmm -n $MM -c $BWD/$CFILE -w ${CWD} -p ${E2ESDIR} -t 1 -H 2 -j $jobname unset job_list @@ -778,7 +801,7 @@ bcsd_fcst(){ if [ $GROUP_JOBS == "Y" ]; then bcsd06_ID= /bin/rm bcsd06*.j - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 5 -j ${jobname}_ -w ${CWD} -C ${cmdfile} /bin/rm ${cmdfile} bcsd06_ID=$(submit_job "$bcsd04_ID:$bcsd05_ID" "${jobname}_run.j") fi @@ -795,6 +818,7 @@ bcsd_fcst(){ # ---------------------------------------------------------------------------- jobname=bcsd08 cmdfile="bcsd08.file" + [ -e "${jobname}_run.j" ] && /bin/rm ${jobname}_*.j for model in $MODELS do @@ -817,7 +841,7 @@ bcsd_fcst(){ bcsd08_ID=`echo $bcsd08_ID | sed "s| |:|g"` if [ $GROUP_JOBS == "Y" ]; then /bin/rm bcsd08*.j - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 5 -j ${jobname}_ -w ${CWD} -C ${cmdfile} /bin/rm ${cmdfile} bcsd08_ID=$(submit_job "$bcsd06_ID" "${jobname}_run.j") fi @@ -828,6 +852,7 @@ bcsd_fcst(){ jobname=bcsd09 cmdfile="bcsd09-10.file" + [ -e "${jobname}-10_run.j" ] && /bin/rm ${jobname}-10_*.j python $LISHDIR/s2s_modules/bcsd_fcst/forecast_task_09.py -s $YYYY -e $YYYY -m $mmm -n $MM -M CFSv2 -c $BWD/$CFILE -w ${CWD} -p ${E2ESDIR} -j $jobname -t 1 -H 4 if [ $GROUP_JOBS == "Y" ]; then @@ -863,7 +888,7 @@ bcsd_fcst(){ jobname=bcsd09-10 /bin/rm bcsd09*.j /bin/rm bcsd10*.j - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 5 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 6 -j ${jobname}_ -w ${CWD} -C ${cmdfile} /bin/rm ${cmdfile} bcsd09_ID=$(submit_job "$bcsd08_ID" "${jobname}_run.j") bcsd10_ID= @@ -900,7 +925,7 @@ bcsd_fcst(){ jobname=bcsd11-12 /bin/rm bcsd11*.j /bin/rm bcsd12*.j - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 5 -j ${jobname}_ -w ${CWD} -C ${cmdfile} + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 6 -j ${jobname}_ -w ${CWD} -C ${cmdfile} /bin/rm ${cmdfile} bcsd11_ID=$(submit_job "$bcsd09_ID" "${jobname}_run.j") bcsd12_ID= @@ -1020,6 +1045,7 @@ s2spost(){ done cd ${SCRDIR}/s2spost + [ -e "${jobname}_01_run.j" ] && /bin/rm ${jobname}_*.j /bin/ln -s ${E2ESDIR}/lis_fcst/${YYYY}${MM}/ lis_fcst /bin/ln -s ${E2ESDIR}/lis_fcst/input @@ -1085,11 +1111,12 @@ s2smetrics(){ cd ${SCRDIR}/s2smetric /bin/ln -s ${E2ESDIR}/s2spost /bin/ln -s ${E2ESDIR}/s2smetric + [ -e "${jobname}_run.j" ] && /bin/rm ${jobname}_*.j CWD=`pwd` for model in $MODELS do - python $LISHDIR/s2s_modules/s2smetric/postprocess_nmme_job.py -y ${YYYY} -m ${MM} -w ${CWD} -c $BWD/$CFILE -j $jobname -t 1 -H 3 -M $model + python $LISHDIR/s2s_modules/s2smetric/postprocess_nmme_job.py -y ${YYYY} -m ${MM} -w ${CWD} -c $BWD/$CFILE -j $jobname -t 1 -H 4 -M $model done job_list=`ls $jobname*anom_run.j` @@ -1107,13 +1134,13 @@ s2smetrics(){ s2smetric_ID=`echo $s2smetric_ID | sed "s| |:|g"` if [ $GROUP_JOBS == "Y" ]; then /bin/rm s2smetric_*.j - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 3 -j ${jobname}_ -w ${CWD} -C $cmdfile + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_run.j -t 1 -H 4 -j ${jobname}_ -w ${CWD} -C $cmdfile /bin/rm ${cmdfile} s2smetric_ID=$(submit_job "$s2spost_ID" "${jobname}_run.j") fi # write tiff file - python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_tiff_run.j -t 1 -H 2 -j ${jobname}_tiff_ -w ${CWD} + python $LISHDIR/s2s_app/s2s_api.py -c $BWD/$CFILE -f ${jobname}_tiff_run.j -t 1 -H 3 -j ${jobname}_tiff_ -w ${CWD} COMMAND="srun --exclusive --ntasks 1 python $LISHDIR/s2s_modules/s2smetric/postprocess_nmme_job.py -y ${YYYY} -m ${MM} -w ${CWD} -c $BWD/$CFILE" sed -i "s|COMMAND|${COMMAND}|g" ${jobname}_tiff_run.j diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/convert_forecast_data_to_netcdf.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/convert_forecast_data_to_netcdf.py index 4a5c9743e..3b2bf8af2 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/convert_forecast_data_to_netcdf.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/convert_forecast_data_to_netcdf.py @@ -123,6 +123,8 @@ def read_wgrib (argv1, argv2, argv3, argv4, argv5, argv6, argv7, argv8): f"{args['indir']}/" + \ f"{args['comparison_name']}" + # Run checks on the CFSv2 grib files here: + ds_ = None ds_ = _check_replace_missing (args) diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py index 0f535825b..f72fbe186 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py @@ -216,9 +216,9 @@ def _print_reftime(fcst_init, ens_num): reftime = \ f"{fcst_init['year']}-{fcst_init['month']}-{fcst_init['day']}" reftime += f",{fcst_init['hour']}:00:00,1hour" - txt = f"[INFO] ENS{ens_num}: " + \ + txt = f"[INFO] CFSv2 ENS-MEM #{ens_num}: " + \ f"{fcst_init['year']}-{fcst_init['monthday']}:" + \ - f"{fcst_init['hour']}" + f"{fcst_init['hour']} cycle" print(txt) def _driver(): @@ -232,7 +232,8 @@ def _driver(): year = int(args['syr']) ens_num = int(args['ens_num']) - print(f"[INFO] {fcst_init['monthday']} {year}") + print(f" --- ") + print(f"[INFO] Forecast Init Date: {fcst_init['monthday']} {year}") fcst_init["year"] = year if fcst_init['monthday'] == "jan01": @@ -260,23 +261,28 @@ def _driver(): wanted_months.append(i) wanted_months = wanted_months[1:10] + # Print Ensemble member and reference date+cycle time: _print_reftime(fcst_init, ens_num) + # 6-hourly output dir: outdirs['outdir_6hourly'] = \ f"{args['outdir']}/6-Hourly/" + \ f"{fcst_init['monthday']}/{year}/ens{ens_num}" if not os.path.exists(outdirs['outdir_6hourly']): os.makedirs(outdirs['outdir_6hourly']) + + # Monthly output dir: outdirs['outdir_monthly'] = \ f"{args['outdir']}/Monthly/" + \ f"{fcst_init['monthday']}/{year}/ens{ens_num}" if not os.path.exists(outdirs['outdir_monthly']): os.makedirs(outdirs['outdir_monthly']) + # Loop over CFSv2 variables: cfsv2 = [] for varname in ["prate", "pressfc", "tmp2m", "dlwsfc", "dswsfc", "q2m", "wnd10m"]: - print(f"[INFO] {varname}") + print(f"[INFO] CFSv2 variable: {varname}") subdir, file_pfx, file_sfx = \ _set_input_file_info(fcst_init['year_cfsv2'], fcst_init['month'], @@ -287,6 +293,12 @@ def _driver(): indir += f"{fcst_init['year_cfsv2']}/{fcst_init['date']}" + # Checking CFSv2 member-date subdir presence: + if not os.path.isdir(indir): + print(f"[ERR] CFSV2 directory, {indir}, does NOT exist.") + print(f"[ERR] Exiting from this one process_forecast_data.py job (others may continue to run in parallel) ...") + sys.exit(1) # Exit with an error code + # Convert GRIB file to netCDF and handle missing/corrupted data cfsv2.append(read_wgrib (indir, file_pfx, fcst_init['timestring'], file_sfx, outdirs['outdir_6hourly'], temp_name, varname, args['patchdir'])) diff --git a/lis/utils/usaf/s2s/s2s_modules/lis_darun/template_files/lis.config_template.GLOBAL b/lis/utils/usaf/s2s/s2s_modules/lis_darun/template_files/lis.config_template.GLOBAL index 31c6bb4c6..c0960a29c 100755 --- a/lis/utils/usaf/s2s/s2s_modules/lis_darun/template_files/lis.config_template.GLOBAL +++ b/lis/utils/usaf/s2s/s2s_modules/lis_darun/template_files/lis.config_template.GLOBAL @@ -245,9 +245,9 @@ AGRMET CMORPH minimum temperature threshold: 273 # Use IMERG rainfall data AGRMET use IMERG data: 1 # 1 = Use AGRMET IMERG temperature threshold: 278 -AGRMET IMERG data directory: ./IMERG/Early_V06B +AGRMET IMERG data directory: ./IMERG/Early_V07B AGRMET IMERG product: 3B-HHR-E # Early Run -AGRMET IMERG version: V06B # V06B released in 2019 +AGRMET IMERG version: V07B # V07B released Jun-1-2024 AGRMET IMERG Probability Liquid Precip Threshold: 100 # Bratseth runtime settings @@ -309,12 +309,17 @@ AGRMET GFS SPD10M station observation error variance: 2.48 # Radiation settings. Uses WWMCA cloud data. Use WWMCA_LE from # 20071101 to 2012032700, use NONE from 2012032700 to 2012040912, # use WWMCA beginning 2012040912. -AGRMET cloud data directory: WWMCA # WWMCA_LE, NONE, or WWMCA +#AGRMET cloud data directory: WWMCA # WWMCA_LE, NONE, or WWMCA # Use WWMCA GRIB1 files beginning 12Z 4 Jul 2020 AGRMET WWMCA GRIB1 read option: 1 AGRMET snow distribution shape parameter: 2.6 -AGRMET radiation derived from: "cloud types" -AGRMET GALWEM radiation data directory: WWMCA_GRIB +#AGRMET radiation derived from: "cloud types" +#AGRMET GALWEM radiation data directory: WWMCA_GRIB +## AS OF AUG-2024 and after S2S Forecast runs – use the following options: +# -- July 2, 2024, 00Z and onward: +AGRMET radiation derived from: "GALWEM_RAD" # GALWEM Radiation files +AGRMET cloud data directory: GALWEM # GALWEM forcing directory +AGRMET GALWEM radiation data directory: GALWEM # Legacy AGRMET settings. Eventually these will be removed, # but for now keep these settings. diff --git a/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py b/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py index cc5c27f89..05f88328d 100644 --- a/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py +++ b/lis/utils/usaf/s2s/s2s_modules/lis_fcst/generate_lis_config_scriptfiles_fcst.py @@ -89,6 +89,7 @@ def _handle_dates(year, month, input_numfcstmons): def _customize_lisconfig(lisconfig_target, config, dates, \ nmme_model, fcstdir, ic_date = None, jobid = None): """Create customized lis.config file""" + with open(lisconfig_target, "rt", encoding='ascii') as file_obj: data = file_obj.read() data = data.replace("NUMPROCX", f"{config['FCST']['numprocx']}") @@ -224,7 +225,10 @@ def _driver(config): jobname = JOB_NAME + '_' + nmme_model + '_' if 'discover' in platform.node() or 'borg' in platform.node(): - mpi_cmd = 'mpirun -np $SLURM_NTASKS ./LIS' + ' -f ' + lisconfig_target + if 'mil' in config['SETUP']['CONSTRAINT']: + mpi_cmd = lisconfig_target + else: + mpi_cmd = 'mpirun -np $SLURM_NTASKS ./LIS' + ' -f ' + lisconfig_target else: mpi_cmd = 'srun ./LIS' + ' -f ' + lisconfig_target @@ -263,15 +267,14 @@ def _driver(config): print(lisconfig_target) if 'discover' in platform.node() or 'borg' in platform.node(): - mpi_cmd = 'mpirun -np $SLURM_NTASKS ./LIS' + ' -f ' + lisconfig_target + if 'mil' in config['SETUP']['CONSTRAINT']: + mpi_cmd = lisconfig_target + else: + mpi_cmd = 'mpirun -np $SLURM_NTASKS ./LIS' + ' -f ' + lisconfig_target + else: mpi_cmd = 'srun ./LIS' + ' -f ' + lisconfig_target - if 'mil' in config['SETUP']['CONSTRAINT']: - mpi_cmd = lisconfig_target - else: - utils.job_script_lis(CONFIGFILE, jobfile, jobname, WORKDIR, - in_command=mpi_cmd) utils.job_script_lis(CONFIGFILE, jobfile, jobname, WORKDIR, in_command=mpi_cmd) diff --git a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py index f11a5c151..0e16f9175 100755 --- a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py +++ b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py @@ -18,7 +18,8 @@ # PURPOSE: writes batch job script # # REVISION HISTORY: -# 7 Mar 2022: Sarith Mahanama, first version +# 7 Mar 2022: Sarith Mahanama, first version +# 22 Oct 2024: K. Arsenault, updated to account for srun submissions on discover # #------------------------------------------------------------------------------ """ @@ -190,7 +191,8 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman this_command = in_command if hours is None: if 'discover' in platform.node() or 'borg' in platform.node(): - thours ='7:15:00' + thours ='7:00:00' +# thours ='8:15:00' else: thours ='6:00:00' else: @@ -218,6 +220,8 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman _f.write('\n') _f.write('#SBATCH --account=' + sponsor_code + '\n') _f.write('#SBATCH --time=' + thours + '\n') + + # Slurm constaint entry: if 'discover' in platform.node() or 'borg' in platform.node(): _f.write('#SBATCH --constraint=' + cfg['SETUP']['CONSTRAINT'] + '\n') else: @@ -232,10 +236,14 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman _f.write('#SBATCH --ntasks=' + ntasks + ' --ntasks-per-socket=48 --ntasks-per-core=1' + '\n') else: _f.write('#SBATCH --ntasks=' + ntasks + '\n') + # Forecast runmode (and LIS DA run setup): else: if domain == 'GLOBAL': - _f.write('#SBATCH -N 12' + '\n') - _f.write('#SBATCH --ntasks-per-node=24' + '\n') + if 'mil' in cfg['SETUP']['CONSTRAINT']: + _f.write('#SBATCH --ntasks=' + ntasks + ' --ntasks-per-socket=48 --ntasks-per-core=1' + '\n') + else: + _f.write('#SBATCH -N 12' + '\n') + _f.write('#SBATCH --ntasks-per-node=24' + '\n') else: _f.write('#SBATCH -N 1' + '\n') _f.write('#SBATCH --ntasks-per-node='+ ntasks + '\n') @@ -248,6 +256,7 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman _f.write('# Run LISF S2S ' + job_name + '\n') _f.write('#######################################################################' + '\n') _f.write('\n') + if 'discover' in platform.node() or 'borg' in platform.node(): _f.write('source /etc/profile.d/modules.sh' + '\n') _f.write('module purge' + '\n') @@ -271,7 +280,11 @@ def job_script_lis(s2s_configfile, jobfile, job_name, cwd, hours=None, in_comman _f.write(' --ntasks-per-socket=$SLURM_NTASKS_PER_SOCKET \\' + '\n') _f.write(' --ntasks-per-core=$SLURM_NTASKS_PER_CORE \\' + '\n') _f.write(' --cpu-bind="none" \\' + '\n') - _f.write(' ./LIS -f ' + this_command + ' || exit 1' + '\n') + # Separate out LIS DA run from LIS fcst run: + if job_name == "lisda_": + _f.write(' ' + this_command + ' || exit 1' + '\n') + else: + _f.write(' ./LIS -f ' + this_command + ' || exit 1' + '\n') else: _f.write( this_command + ' || exit 1' + '\n') From 590e013e7e1179aab3dc0aa7eefb0260abc1c839 Mon Sep 17 00:00:00 2001 From: "Kristi R. Arsenault" Date: Wed, 30 Oct 2024 10:20:46 -0400 Subject: [PATCH 09/11] S2S script -- pylint updates Minor updates to two S2S scripts, addressing some minor pylint fixes. --- .../bcsd_library/process_forecast_data.py | 19 +++++++++++-------- .../usaf/s2s/s2s_modules/shared/utils.py | 7 ++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py index f72fbe186..7c948d12e 100644 --- a/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py +++ b/lis/utils/usaf/s2s/s2s_modules/bcsd_fcst/bcsd_library/process_forecast_data.py @@ -174,8 +174,10 @@ def _migrate_to_monthly_files(cfsv2, outdirs, fcst_init, args, reg_precip): var_name = "WIND") for month in range(1,10): - file_6h = outdir_6hourly + '/' + final_name_pfx + '{:04d}{:02d}.nc'.format (dt1.year,dt1.month) - file_mon = outdir_monthly + '/' + final_name_pfx + '{:04d}{:02d}.nc'.format (dt1.year,dt1.month) + file_6h = outdir_6hourly + '/' + \ + final_name_pfx + '{:04d}{:02d}.nc'.format (dt1.year,dt1.month) + file_mon = outdir_monthly + '/' + \ + final_name_pfx + '{:04d}{:02d}.nc'.format (dt1.year,dt1.month) dt2 = dt1 + relativedelta(months=1) dt1s = np.datetime64(dt1.strftime('%Y-%m-%d')) dt2s = np.datetime64(dt2.strftime('%Y-%m-%d')) @@ -232,7 +234,7 @@ def _driver(): year = int(args['syr']) ens_num = int(args['ens_num']) - print(f" --- ") + print(" --- ") print(f"[INFO] Forecast Init Date: {fcst_init['monthday']} {year}") fcst_init["year"] = year @@ -279,7 +281,7 @@ def _driver(): os.makedirs(outdirs['outdir_monthly']) # Loop over CFSv2 variables: - cfsv2 = [] + cfsv2 = [] for varname in ["prate", "pressfc", "tmp2m", "dlwsfc", "dswsfc", "q2m", "wnd10m"]: print(f"[INFO] CFSv2 variable: {varname}") @@ -290,18 +292,19 @@ def _driver(): indir = f"{args['forcedir']}/{subdir}/" if subdir == "Oper_TS" and not os.path.exists(indir): indir = f"{args['forcedir']}/" - + indir += f"{fcst_init['year_cfsv2']}/{fcst_init['date']}" # Checking CFSv2 member-date subdir presence: if not os.path.isdir(indir): print(f"[ERR] CFSV2 directory, {indir}, does NOT exist.") - print(f"[ERR] Exiting from this one process_forecast_data.py job (others may continue to run in parallel) ...") + print("[ERR] Exiting from this one process_forecast_data.py job (others may continue to run in parallel) ...") sys.exit(1) # Exit with an error code # Convert GRIB file to netCDF and handle missing/corrupted data - cfsv2.append(read_wgrib (indir, file_pfx, fcst_init['timestring'], file_sfx, outdirs['outdir_6hourly'], temp_name, varname, args['patchdir'])) - + cfsv2.append(read_wgrib (indir, file_pfx, fcst_init['timestring'], \ + file_sfx, outdirs['outdir_6hourly'], temp_name, varname, args['patchdir'])) + cfsv2 = xr.merge (cfsv2, compat='override') reg_precip = _regrid_precip(cfsv2, args) _migrate_to_monthly_files(cfsv2.sel (step = (cfsv2['valid_time'] >= dt1) & diff --git a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py index 0e16f9175..279b30443 100755 --- a/lis/utils/usaf/s2s/s2s_modules/shared/utils.py +++ b/lis/utils/usaf/s2s/s2s_modules/shared/utils.py @@ -29,8 +29,8 @@ import platform import re import datetime -import numpy as np import math +import numpy as np from netCDF4 import Dataset as nc4 #pylint: disable=no-name-in-module import yaml #pylint: disable=consider-using-f-string, too-many-statements, too-many-locals, too-many-arguments @@ -115,7 +115,6 @@ def job_script(s2s_configfile, jobfile, job_name, ntasks, hours, cwd, in_command if command_list: for cmd in command_list: _f.write(f"{cmd}\n") - _f.write('\n') _f.write('echo "[INFO] Completed ' + job_name + '!"' + '\n') _f.write('\n') @@ -327,9 +326,7 @@ def tiff_to_da(file): crs = dataset.crs x_coords = dataset.bounds.left + transform[0] * np.arange(dataset.width) y_coords = dataset.bounds.top + transform[4] * np.arange(dataset.height) - + # Create an xarray DataArray da = xr.DataArray(data, dims=('y', 'x'), coords={'y': y_coords, 'x': x_coords}, attrs={'crs': crs}) - return da - From 4cacded565127278ea912f2f94776a26d6a6d533 Mon Sep 17 00:00:00 2001 From: "James V. Geiger" Date: Fri, 1 Nov 2024 10:13:34 -0400 Subject: [PATCH 10/11] Add consistent formatting --- ldt/configs/ldt.config.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ldt/configs/ldt.config.adoc b/ldt/configs/ldt.config.adoc index 47e7b8a60..73a382e2b 100644 --- a/ldt/configs/ldt.config.adoc +++ b/ldt/configs/ldt.config.adoc @@ -3302,8 +3302,8 @@ for ensemble restart generation. Options are: |Value |Description |none | Do not apply random sampling strategy -|random sampling | Use random sampling strategy -|unperturbed sampling | Only use the non-perturbed member +|"`random sampling`" | Use random sampling strategy +|"`unperturbed sampling`" | Only use the non-perturbed member |=== .Example _ldt.config_ entry From 1faffbd4ebdd4166b59846715e52a4b0262d5e90 Mon Sep 17 00:00:00 2001 From: "James V. Geiger" Date: Fri, 1 Nov 2024 10:19:13 -0400 Subject: [PATCH 11/11] Update revision history for LDT Users' Guide for LISF 557WW 7.5.19 release --- docs/LDT_users_guide/LDT_users_guide.adoc | 4 ++-- docs/LDT_users_guide/revision_table.adoc | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/LDT_users_guide/LDT_users_guide.adoc b/docs/LDT_users_guide/LDT_users_guide.adoc index 6acd26e44..66196adc5 100644 --- a/docs/LDT_users_guide/LDT_users_guide.adoc +++ b/docs/LDT_users_guide/LDT_users_guide.adoc @@ -1,6 +1,6 @@ = Land Data Toolkit (LDT): LDT {lisfrevision} Users`' Guide -:revnumber: 2.5 -:revdate: 27 Aug 2024 +:revnumber: 2.6 +:revdate: 1 Nov 2024 :doctype: book :sectnums: :toc: diff --git a/docs/LDT_users_guide/revision_table.adoc b/docs/LDT_users_guide/revision_table.adoc index fbc8744bd..803ec9269 100644 --- a/docs/LDT_users_guide/revision_table.adoc +++ b/docs/LDT_users_guide/revision_table.adoc @@ -2,6 +2,7 @@ |==== | Revision | Summary of Changes | Date +| 2.6 | LISF 557WW 7.5.19 release | Nov 1, 2024 | 2.5 | LISF 557WW 7.5.18 release | Aug 27, 2024 | 2.3 | LISF 557WW 7.5.9 release | Jul 05, 2023 | 2.2 | LISF 557WW 7.5.8 release | Jun 30, 2023