diff --git a/jobs/JGLOBAL_EXTRACTVARS b/jobs/JGLOBAL_EXTRACTVARS index 137429a59e..3478ca3976 100755 --- a/jobs/JGLOBAL_EXTRACTVARS +++ b/jobs/JGLOBAL_EXTRACTVARS @@ -19,17 +19,17 @@ YMD="${PDY}" HH="${cyc}" declare_from_tmpl -rx \ "COMIN_ICE_NETCDF:COM_ICE_NETCDF_TMPL" \ "COMIN_WAVE_GRID:COM_WAVE_GRID_TMPL" -if [[ "${DO_ATM}" == "YES" ]];then +if [[ "${DO_ATM}" == "YES" ]]; then if [[ ! -d "${ARC_RFCST_PROD_ATMOS_F2D}" ]]; then mkdir -p "${ARC_RFCST_PROD_ATMOS_F2D}"; fi if [[ ! -d "${ARC_RFCST_PROD_ATMOS_F3D}" ]]; then mkdir -p "${ARC_RFCST_PROD_ATMOS_F3D}"; fi fi -if [[ "${DO_OCN}" == "YES" ]];then +if [[ "${DO_OCN}" == "YES" ]]; then if [[ ! -d "${ARC_RFCST_PROD_OCN}" ]]; then mkdir -p "${ARC_RFCST_PROD_OCN}"; fi fi -if [[ "${DO_ICE}" == "YES" ]];then +if [[ "${DO_ICE}" == "YES" ]]; then if [[ ! -d "${ARC_RFCST_PROD_ICE}" ]]; then mkdir -p "${ARC_RFCST_PROD_ICE}"; fi fi -if [[ "${DO_WAVE}" == "YES" ]];then +if [[ "${DO_WAVE}" == "YES" ]]; then if [[ ! -d "${ARC_RFCST_PROD_WAV}" ]]; then mkdir -p "${ARC_RFCST_PROD_WAV}"; fi fi diff --git a/parm/config/gefs/config.extractvars b/parm/config/gefs/config.extractvars index 8fce4a227f..706fe18450 100644 --- a/parm/config/gefs/config.extractvars +++ b/parm/config/gefs/config.extractvars @@ -9,26 +9,26 @@ echo "BEGIN: config.extractvars" export COMPRSCMD=${COMPRSCMD:-bzip2} -export compress_ocn=0 #1: compress extracted ocean product, 0: do not compress extracted ocean product -export compress_ice=0 #1: compress extracted ice product, 0: do not compress extracted ice product +export compress_ocn=0 #1: Compress extracted ocean product, 0: Do not compress extracted ocean product +export compress_ice=0 #1: Compress extracted ice product, 0: Do not compress extracted ice product -export ocnres="5p00" #Resolution of ocean products -export iceres="5p00" #Resolution of ice products -export wavres="5p00" #Resolution of wave products +export ocnres="5p00" # Resolution of ocean products +export iceres="5p00" # Resolution of ice products +export wavres="5p00" # Resolution of wave products -export depthvar_name="z_l" #name of depth variable in NetCDF ocean products -export zmin="0." #Minimum depth to extract from NetCDF ocean products -export zmax="300." #Maximum depth to extract from NetCDF ocean products +export depthvar_name="z_l" # Name of depth variable in NetCDF ocean products +export zmin="0." # Minimum depth to extract from NetCDF ocean products +export zmax="300." # Maximum depth to extract from NetCDF ocean products -export FHOUT_WAV_EXTRACT=6 #Frequency of wave output to be saved on disk +export FHOUT_WAV_EXTRACT=6 # Frequency of wave output to be saved on disk #Paramater Tables used -export varlist_2d="${PARMgfs}/product/gefs_shortparmlist_2d.parm" #Parameter table for surface variables -export varlist_3d="${PARMgfs}/product/gefs_shortparmlist_3d_h.parm" #Parameter table for upper air instantaneous variables -export varlist_3d_d="${PARMgfs}/product/gefs_shortparmlist_3d_d.parm" #Parameter table for upper air daily-averaged variables -export varlist_wav="${PARMgfs}/product/gefs_wav_shortparmlist.parm" #Parameter table for wave variables -export varlist_ocn_netcdf="${PARMgfs}/product/gefs_ocn_shortparmlist.parm" #Parameter table for ocean netcdf variables -export varlist_ice_netcdf="${PARMgfs}/product/gefs_ice_shortparmlist.parm" #Parameter table for ice netcdf variables +export varlist_2d="${PARMgfs}/product/gefs_shortparmlist_2d.parm" # Parameter table for surface variables +export varlist_3d="${PARMgfs}/product/gefs_shortparmlist_3d_h.parm" # Parameter table for upper air instantaneous variables +export varlist_3d_d="${PARMgfs}/product/gefs_shortparmlist_3d_d.parm" # Parameter table for upper air daily-averaged variables +export varlist_wav="${PARMgfs}/product/gefs_wav_shortparmlist.parm" # Parameter table for wave variables +export varlist_ocn_netcdf="${PARMgfs}/product/gefs_ocn_shortparmlist.parm" # Parameter table for ocean netcdf variables +export varlist_ice_netcdf="${PARMgfs}/product/gefs_ice_shortparmlist.parm" # Parameter table for ice netcdf variables #Directory to save extracted variables export ARC_RFCST_PROD="${ARCDIR}/rfcst/${PDY:0:4}/${PDY:0:6}/${PDY:0:8}/mem${ENSMEM}" diff --git a/scripts/exglobal_extractvars.sh b/scripts/exglobal_extractvars.sh index 77db8431de..a124667679 100755 --- a/scripts/exglobal_extractvars.sh +++ b/scripts/exglobal_extractvars.sh @@ -28,24 +28,24 @@ if (( FHOUT_WAV_EXTRACT % FHOUT_WAV != 0 )); then fi # Extract variables for atmosphere -if [[ "${DO_ATM}" == "YES" ]];then +if [[ "${DO_ATM}" == "YES" ]]; then ${EXTRCTVARA} "${DATA}/atmos" fi # Extract variables for ocean -if [[ "${DO_OCN}" == "YES" ]];then +if [[ "${DO_OCN}" == "YES" ]]; then export component_name="ocn" ${EXTRCTVARO} "${DATA}/ocn" "${varlist_ocn_netcdf}" "${ocnres}" "${compress_ocn}" "${FHOUT_OCN_GFS}" "${ARC_RFCST_PROD_OCN}" fi # Extract variables for ice -if [[ "${DO_ICE}" == "YES" ]];then +if [[ "${DO_ICE}" == "YES" ]]; then export component_name="ice" ${EXTRCTVARO} "${DATA}/ice" "${varlist_ice_netcdf}" "${iceres}" "${compress_ice}" "${FHOUT_ICE_GFS}" "${ARC_RFCST_PROD_ICE}" fi # Extract variables for wave -if [[ "${DO_WAVE}" == "YES" ]];then +if [[ "${DO_WAVE}" == "YES" ]]; then export component_name="wav" ${EXTRCTVARW} "${DATA}/wav" fi diff --git a/ush/atmos_extractvars.sh b/ush/atmos_extractvars.sh index afd3271d9f..c9d0a4e7af 100755 --- a/ush/atmos_extractvars.sh +++ b/ush/atmos_extractvars.sh @@ -69,7 +69,7 @@ for outtype in "f2d" "f3d"; do check_atmos "${infile1}" "${infile2}" "${varlist}" "${fnh}" copy_to_comout "${outfile}" "${ARC_RFCST_PROD_ATMOS}" - #Compute daily average for a subset of variables + # Compute daily average for a subset of variables if (( nh % 6 == 0 )) && (( nh != 0 )) && [[ "${outtype}" == "f3d" ]]; then outfile=${subdata}/vartmp_raw_vari_ldy${dcnt}.grib2 for infile in "${infile1}" "${infile2}"; do @@ -87,12 +87,12 @@ for outtype in "f2d" "f3d"; do dcnt=$(( dcnt + 1 )) else fcnt=$(( fcnt + 1 )) - fi #If at final lead hour of a given day - fi #if lead hour is divisible by 6 and outtype is f3d + fi # If at final lead hour of a given day + fi # if lead hour is divisible by 6 and outtype is f3d nh=$(( nh + outfreq )) - done #fhr + done # nh -done #f2d,f3d +done # f2d,f3d exit 0 diff --git a/ush/extractvars_tools.sh b/ush/extractvars_tools.sh index 6aecb9fa9e..daf61a3d2e 100644 --- a/ush/extractvars_tools.sh +++ b/ush/extractvars_tools.sh @@ -40,14 +40,14 @@ daily_avg_atmos() { ${WGRIB2} "${davgtmp}" | ${WGRIB2} -i "${davgtmp}" -append -grib "${davg_file}" rm -f "${davgtmp}" vcnt=$(( vcnt + 1 )) - done <"${varlist_d}" #variable + done <"${varlist_d}" # variable } copy_to_comout() { # Function to copy the output file with the extracted product variables to a user-defined destination directory - rundir_outfile=$1 #output data file generated in RUNDIR - comout_dir=$2 #destination directory to which to copy the data file - if [[ -f "${rundir_outfile}" ]];then + rundir_outfile=$1 # output data file generated in RUNDIR + comout_dir=$2 # destination directory to which to copy the data file + if [[ -f "${rundir_outfile}" ]]; then cpfs "${rundir_outfile}" "${comout_dir}" else echo "FATAL ERROR: Output file (${rundir_outfile}) does not exist." diff --git a/ush/ocnice_extractvars.sh b/ush/ocnice_extractvars.sh index e9cee0e6c5..f0660bb6ec 100755 --- a/ush/ocnice_extractvars.sh +++ b/ush/ocnice_extractvars.sh @@ -24,11 +24,11 @@ comout_rfcst_prod_ocnice=${6} for (( nh = FHMIN_GFS; nh <= FHMAX_GFS; nh = nh + fhout_ocnice )); do fnh=$(printf "%3.3d" "${nh}") - if [[ ${component_name} == "ocn" ]];then + if [[ ${component_name} == "ocn" ]]; then infile=${COMIN_OCEAN_NETCDF}/${RUN}.ocean.t${cyc}z.${datares}.f${fnh}.nc # For ocean products, add an argument to extract a subset of levels otherargs=(-d "${depthvar_name},""${zmin},""${zmax}") - elif [[ ${component_name} == "ice" ]];then + elif [[ ${component_name} == "ice" ]]; then infile=${COMIN_ICE_NETCDF}/${RUN}.ice.t${cyc}z.${datares}.f${fnh}.nc otherargs=() fi @@ -39,20 +39,20 @@ for (( nh = FHMIN_GFS; nh <= FHMAX_GFS; nh = nh + fhout_ocnice )); do varsinfile=$(cdo -showname "${infile}") varsavailable="" for i in ${varsrequested}; do - #check if variable from parm file is available in netcdf file. If variable is not in netcdf file, do not try to extract that variable. + # Check if variable from parm file is available in netcdf file. If variable is not in netcdf file, do not try to extract that variable. if [[ ${varsinfile} == *"${i}"* ]]; then varsavailable+="${i}," else echo "WARNING: ${i} is not available in ${infile}." fi done - if [[ -z "${varsavailable}" ]];then + if [[ -z "${varsavailable}" ]]; then echo "WARNING: No variables from parm file ${varlist} are available in netcdf file ${infile}." else ocnice_vars=${varsavailable::-1} ncks -v "${ocnice_vars}" "${otherargs[@]}" "${infile}" "${outfile}" fi - if [[ ${datacompress} -eq 1 ]];then + if [[ ${datacompress} -eq 1 ]]; then ${COMPRSCMD} "${outfile}" copy_to_comout "${outfile}.bz2" "${comout_rfcst_prod_ocnice}" else @@ -61,6 +61,6 @@ for (( nh = FHMIN_GFS; nh <= FHMAX_GFS; nh = nh + fhout_ocnice )); do else echo "WARNING: ${infile} does not exist." fi -done +done # nh exit 0 diff --git a/ush/wave_extractvars.sh b/ush/wave_extractvars.sh index 51020575c9..32ee44986b 100755 --- a/ush/wave_extractvars.sh +++ b/ush/wave_extractvars.sh @@ -20,15 +20,15 @@ for (( nh = FHOUT_WAV_EXTRACT; nh <= FHMAX_WAV; nh = nh + FHOUT_WAV_EXTRACT )); infile=${COMIN_WAVE_GRID}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2 outfile=${subdata}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2 - rm -f "${outfile}" #remove outfile if it already exists before extraction + rm -f "${outfile}" # Remove outfile if it already exists before extraction - if [[ -f "${infile}" ]]; then #check if input file exists before extraction + if [[ -f "${infile}" ]]; then # Check if input file exists before extraction # shellcheck disable=SC2312 ${WGRIB2} "${infile}" | grep -F -f "${varlist_wav}" | ${WGRIB2} -i "${infile}" -append -grib "${outfile}" else echo "WARNING: ${infile} does not exist." fi copy_to_comout "${outfile}" "${ARC_RFCST_PROD_WAV}" -done #fhr +done # nh exit 0