Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Direct Linking to COM from DATA for extractvars Job #3379

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bddc2c6
modified ush\wave_extractvars.sh
AntonMFernando-NOAA Feb 20, 2025
8e39933
modified ush\ocnice_extractvars.sh
AntonMFernando-NOAA Feb 20, 2025
4335d73
updated atmos and wave extractvars ush
AntonMFernando-NOAA Feb 20, 2025
d214243
Merge branch 'NOAA-EMC:develop' into bug/NCO-extractvars
AntonMFernando-NOAA Feb 20, 2025
fca50a1
Merge branch 'NOAA-EMC:develop' into bug/NCO-extractvars
AntonMFernando-NOAA Feb 21, 2025
fe38d9f
added elif-> then
AntonMFernando-NOAA Feb 24, 2025
f75e6bd
Merge branch 'bug/NCO-extractvars' of https://github.com/AntonMFernan…
AntonMFernando-NOAA Feb 24, 2025
1548657
modified ush\atmos_extractvars.sh
AntonMFernando-NOAA Feb 24, 2025
976ca51
Merge branch 'NOAA-EMC:develop' into bug/NCO-extractvars
AntonMFernando-NOAA Feb 25, 2025
02d9cdb
Merge branch 'NOAA-EMC:develop' into bug/NCO-extractvars
AntonMFernando-NOAA Feb 25, 2025
6fa38af
Merge branch 'develop' into bug/NCO-extractvars
AntonMFernando-NOAA Feb 26, 2025
eb84696
Merge branch 'NOAA-EMC:develop' into bug/NCO-extractvars
AntonMFernando-NOAA Feb 27, 2025
ca2fb16
modified ush\atmos_extractvars.sh
AntonMFernando-NOAA Feb 27, 2025
ea6cf86
Merge branch 'bug/NCO-extractvars' of https://github.com/AntonMFernan…
AntonMFernando-NOAA Feb 27, 2025
80a5c25
typo
AntonMFernando-NOAA Feb 27, 2025
2fe63ae
modified ush\ocnice_extractvars.sh
AntonMFernando-NOAA Feb 27, 2025
27abc91
typo
AntonMFernando-NOAA Feb 27, 2025
efcbb85
modified ush\wave_extractvars.sh
AntonMFernando-NOAA Feb 27, 2025
cee64e4
removed else block
AntonMFernando-NOAA Feb 27, 2025
bb48ed9
modified files
AntonMFernando-NOAA Feb 27, 2025
20c1f8c
Merge branch 'develop' into bug/NCO-extractvars
AntonMFernando-NOAA Feb 28, 2025
0cfb50b
modified files
AntonMFernando-NOAA Feb 28, 2025
7830405
Merge branch 'bug/NCO-extractvars' of https://github.com/AntonMFernan…
AntonMFernando-NOAA Feb 28, 2025
53031aa
modifed if statements
AntonMFernando-NOAA Feb 28, 2025
5ff2309
removed extra cpfs
AntonMFernando-NOAA Feb 28, 2025
c4ce4a4
Merge branch 'develop' into bug/NCO-extractvars
AntonMFernando-NOAA Mar 3, 2025
73aa985
Apply suggestions from code review
aerorahul Mar 3, 2025
109cf03
Update ush/atmos_extractvars.sh
aerorahul Mar 3, 2025
a81f092
Merge branch 'NOAA-EMC:develop' into bug/NCO-extractvars
AntonMFernando-NOAA Mar 3, 2025
8e17d89
added exist 1
AntonMFernando-NOAA Mar 4, 2025
74ccb11
Merge branch 'develop' into bug/NCO-extractvars
AntonMFernando-NOAA Mar 4, 2025
baad82f
Merge branch 'develop' into bug/NCO-extractvars
AntonMFernando-NOAA Mar 5, 2025
3836228
Merge branch 'NOAA-EMC:develop' into bug/NCO-extractvars
AntonMFernando-NOAA Mar 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions ush/atmos_extractvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ for outtype in "f2d" "f3d"; do

for infile in "${infile1}" "${infile2}"; do
if [[ -f "${infile}" ]]; then # check if input file exists before extraction
new_infile="${outdirpre}/$(basename "${infile}")_ext"
if ! cpfs "${infile}" "${new_infile}"; then
echo "FATAL ERROR: Failed to copy ${infile} to ${new_infile}."
exit 1
fi
# shellcheck disable=SC2312
${WGRIB2} "${infile}" | grep -F -f "${varlist}" | ${WGRIB2} -i "${infile}" -append -grib "${outfile}"
${WGRIB2} "${new_infile}" | grep -F -f "${varlist}" | ${WGRIB2} -i "${new_infile}" -append -grib "${outfile}"
else
echo "WARNING: ${infile} does not exist."
echo "WARNING: ${infile} does not exist in ${com_dir}."
fi
done

Expand All @@ -91,10 +96,15 @@ for outtype in "f2d" "f3d"; do
outfile=${subdata}/vartmp_raw_vari_ldy${dcnt}.grib2
for infile in "${infile1}" "${infile2}"; do
if [[ -f "${infile}" ]]; then # check if input file exists before extraction
new_infile="${outdirpre}/$(basename "${infile}")_ext"
if ! cpfs "${infile}" "${new_infile}"; then
echo "FATAL ERROR: Failed to copy ${infile} to ${new_infile}."
exit 1
fi
# shellcheck disable=SC2312
${WGRIB2} "${infile}" | grep -F -f "${varlist_d}" | ${WGRIB2} -i "${infile}" -append -grib "${outfile}"
${WGRIB2} "${new_infile}" | grep -F -f "${varlist_d}" | ${WGRIB2} -i "${new_infile}" -append -grib "${outfile}"
else
echo "WARNING: ${infile} does not exist."
echo "WARNING: ${infile} does not exist in ${com_dir}."
fi
done
if [[ ${fcnt} -eq 4 ]]; then
Expand Down
34 changes: 23 additions & 11 deletions ush/ocnice_extractvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,61 @@ for (( nh = FHMIN_GFS + fhout_ocnice; nh <= FHMAX_GFS; nh = nh + fhout_ocnice ))

if [[ ${component_name} == "ocn" ]]; then
if [[ "${datares}" == "native" ]]; then
infile="${COMIN_OCEAN_HISTORY}/${RUN}.ocean.t${cyc}z.${fhout_ocnice}hr_avg.f${fnh}.nc"
com_dir=${COMIN_OCEAN_HISTORY}
infile="${com_dir}/${RUN}.ocean.t${cyc}z.${fhout_ocnice}hr_avg.f${fnh}.nc"
new_infile=${subdata}/${RUN}.ocean.t${cyc}z.${fhout_ocnice}hr_avg.f${fnh}_ext.nc
else
infile="${COMIN_OCEAN_NETCDF}/${datares}/${RUN}.ocean.t${cyc}z.${datares}.f${fnh}.nc"
com_dir=${COMIN_OCEAN_NETCDF}
infile="${com_dir}/${datares}/${RUN}.ocean.t${cyc}z.${datares}.f${fnh}.nc"
new_infile=${subdata}/${RUN}.ocean.t${cyc}z.${datares}.f${fnh}_ext.nc
fi
# For ocean products, add an argument to extract a subset of levels
otherargs=(-d "${depthvar_name},""${zmin},""${zmax}")
elif [[ ${component_name} == "ice" ]]; then
if [[ "${datares}" == "native" ]]; then
infile="${COMIN_ICE_HISTORY}/${RUN}.ice.t${cyc}z.${fhout_ocnice}hr_avg.f${fnh}.nc"
com_dir=${COMIN_ICE_HISTORY}
infile="${com_dir}/${RUN}.ice.t${cyc}z.${fhout_ocnice}hr_avg.f${fnh}.nc"
new_infile=${subdata}/${RUN}.ice.t${cyc}z.${fhout_ocnice}hr_avg.f${fnh}_ext.nc
else
infile="${COMIN_ICE_NETCDF}/${datares}/${RUN}.ice.t${cyc}z.${datares}.f${fnh}.nc"
com_dir=${COMIN_ICE_NETCDF}
infile="${com_dir}/${datares}/${RUN}.ice.t${cyc}z.${datares}.f${fnh}.nc"
new_infile=${subdata}/${RUN}.ice.t${cyc}z.${datares}.f${fnh}_ext.nc
fi
otherargs=()
fi
outfile=${subdata}/${RUN}.${component_name}.t${cyc}z.${datares}.f${fnh}.nc

if [[ -f "${infile}" ]]; then #check if input file exists before extraction
if ! cpfs "${infile}" "${new_infile}"; then
echo "FATAL ERROR: Failed to copy ${infile} to ${new_infile}."
exit 1
fi
varsrequested=$(paste -s "${varlist}")
varsinfile=$(cdo -showname "${infile}")
varsinfile=$(cdo -showname "${new_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.
if [[ ${varsinfile} == *"${i}"* ]]; then
varsavailable+="${i},"
else
echo "WARNING: ${i} is not available in ${infile}."
echo "WARNING: ${i} is not available in ${new_infile}."
fi
done
if [[ -z "${varsavailable}" ]]; then
echo "WARNING: No variables from parm file ${varlist} are available in netcdf file ${infile}."
echo "WARNING: No variables from parm file ${varlist} are available in netcdf file ${new_infile}."
else
ocnice_vars=${varsavailable::-1}
ncks -v "${ocnice_vars}" "${otherargs[@]}" "${infile}" "${outfile}"
ncks -v "${ocnice_vars}" "${otherargs[@]}" "${new_infile}" "${outfile}"
fi
if [[ ${datacompress} -eq 1 ]]; then
${COMPRSCMD} "${outfile}"
copy_to_comout "${outfile}.bz2" "${comout_rfcst_prod_ocnice}"
else
copy_to_comout "${outfile}" "${comout_rfcst_prod_ocnice}"
fi
fi
else
echo "WARNING: ${infile} does not exist."
echo "WARNING: ${infile} does not exist in ${com_dir}."
fi
done # nh

exit 0
exit 0
17 changes: 11 additions & 6 deletions ush/wave_extractvars.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env bash
#! /usr/bin/env bash

################################################################################
## UNIX Script Documentation Block
Expand Down Expand Up @@ -26,16 +26,21 @@ for (( nh = FHOUT_WAV_EXTRACT; nh <= FHMAX_WAV; nh = nh + FHOUT_WAV_EXTRACT ));
fnh=$(printf "%3.3d" "${nh}")

infile=${com_dir}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2
new_infile=${subdata}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}_ext.grib2
outfile=${subdata}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2
rm -f "${outfile}" # Remove outfile if it already 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}"
if ! cpfs "${infile}" "${new_infile}"; then
echo "FATAL ERROR: Failed to copy ${infile} to ${new_infile}."
exit 1
fi
# shellcheck disable=SC2312
${WGRIB2} "${new_infile}" | grep -F -f "${varlist_wav}" | ${WGRIB2} -i "${new_infile}" -append -grib "${outfile}"
else
echo "WARNING: ${infile} does not exist."
fi
echo "WARNING: ${infile} does not exist in ${com_dir}."
fi
copy_to_comout "${outfile}" "${ARC_RFCST_PROD_WAV}"
done # nh

exit 0
exit 0