-
Notifications
You must be signed in to change notification settings - Fork 214
Remove Direct Linking to COM from DATA for extractvars Job
#3379
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
Changes from 11 commits
bddc2c6
8e39933
4335d73
d214243
fca50a1
fe38d9f
f75e6bd
1548657
976ca51
02d9cdb
6fa38af
eb84696
ca2fb16
ea6cf86
80a5c25
2fe63ae
27abc91
efcbb85
cee64e4
bb48ed9
20c1f8c
0cfb50b
7830405
53031aa
5ff2309
c4ce4a4
73aa985
109cf03
a81f092
8e17d89
74ccb11
baad82f
3836228
21bfc21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,10 +72,16 @@ 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" | ||||||||||
| cpfs "${infile}" "${new_infile}" | ||||||||||
| # shellcheck disable=SC2312 | ||||||||||
| ${WGRIB2} "${infile}" | grep -F -f "${varlist}" | ${WGRIB2} -i "${infile}" -append -grib "${outfile}" | ||||||||||
| else | ||||||||||
| echo "WARNING: ${infile} does not exist." | ||||||||||
| ${WGRIB2} "${new_infile}" | grep -F -f "${varlist}" | ${WGRIB2} -i "${new_infile}" -append -grib "${outfile}" | ||||||||||
| elif [[ -f "${infile}" ]]; then | ||||||||||
| echo "WARNING: ${infile} does not exist in ${com_dir}." | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||
| elif [[ -f "${new_infile}" ]]; then | ||||||||||
| echo "WARNING: ${new_infile} does not exist in ${subdata}. Copying skipped." | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||
| else | ||||||||||
| echo "WARNING: ${infile} and ${new_infile} do not exist." | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the existence of
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @EricSinsky-NOAA I’ve made the suggested changes. Please disregard my previous comments. I now understand what you meant. |
||||||||||
| fi | ||||||||||
| done | ||||||||||
|
|
||||||||||
|
|
@@ -87,10 +93,16 @@ 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" | ||||||||||
| cpfs "${infile}" "${new_infile}" | ||||||||||
|
AntonMFernando-NOAA marked this conversation as resolved.
Outdated
|
||||||||||
| # 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}" | ||||||||||
| elif [[ -f "${infile}" ]]; then | ||||||||||
| echo "WARNING: ${infile} does not exist in ${com_dir}." | ||||||||||
| elif [[ -f "${new_infile}" ]]; then | ||||||||||
| echo "WARNING: ${new_infile} does not exist in ${subdata}. Copying skipped." | ||||||||||
| else | ||||||||||
| echo "WARNING: ${infile} does not exist." | ||||||||||
| echo "WARNING: ${infile} and ${new_infile} do not exist." | ||||||||||
| fi | ||||||||||
|
Comment on lines
95
to
108
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see my earlier comments. I think the same logic applies here as well. |
||||||||||
| done | ||||||||||
| if [[ ${fcnt} -eq 4 ]]; then | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,49 +26,62 @@ 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 | ||
| cpfs "${infile}" "${new_infile}" #copy infile to the subdata directory | ||
|
AntonMFernando-NOAA marked this conversation as resolved.
Outdated
|
||
| 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 | ||
| elif [[ -f "${infile}" ]]; then | ||
| echo "WARNING: ${infile} does not exist in ${com_dir}." | ||
| elif [[ -f "${new_infile}" ]]; then | ||
| echo "WARNING: ${new_infile} does not exist in ${subdata}. Copying skipped." | ||
| else | ||
| echo "WARNING: ${infile} does not exist." | ||
| echo "WARNING: ${infile} and ${new_infile} do not exist." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see my earlier comments in |
||
| fi | ||
| done # nh | ||
|
|
||
| exit 0 | ||
| exit 0 | ||
| 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 | ||
|
|
@@ -24,16 +24,22 @@ 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}" | ||
| cpfs "${infile}" "${new_infile}" # Copy infile to the subdata directory | ||
|
AntonMFernando-NOAA marked this conversation as resolved.
Outdated
|
||
| # shellcheck disable=SC2312 | ||
| ${WGRIB2} "${new_infile}" | grep -F -f "${varlist_wav}" | ${WGRIB2} -i "${new_infile}" -append -grib "${outfile}" | ||
| elif [[ -f "${infile}" ]]; then | ||
| echo "WARNING: ${infile} does not exist in ${com_dir}." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| elif [[ -f "${new_infile}" ]]; then | ||
| echo "WARNING: ${new_infile} does not exist in ${subdata}. Copying skipped." | ||
| else | ||
| echo "WARNING: ${infile} does not exist." | ||
| fi | ||
| echo "WARNING: ${infile} and ${new_infile} do not exist." | ||
| fi | ||
| copy_to_comout "${outfile}" "${ARC_RFCST_PROD_WAV}" | ||
| done # nh | ||
|
|
||
| exit 0 | ||
| exit 0 | ||
Uh oh!
There was an error while loading. Please reload this page.