Skip to content

Add interpolation weight calc - #68

Open
kestonsmith-noaa wants to merge 41 commits into
NOAA-EMC:developfrom
kestonsmith-noaa:AddInterpolationWeightCalc_
Open

Add interpolation weight calc #68
kestonsmith-noaa wants to merge 41 commits into
NOAA-EMC:developfrom
kestonsmith-noaa:AddInterpolationWeightCalc_

Conversation

@kestonsmith-noaa

@kestonsmith-noaa kestonsmith-noaa commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

This branch contains routines for computing interpolation weights used for computing WW3 forcing in RWPS. To run
see file RWPS/dev/compute_interpolation_weights/README.txt. The routines for retrieving and carrying out pre-processing are not in this branch.

kestonsmith-noaa and others added 30 commits July 30, 2026 08:17
…ods), interpolating fields to RWPS mesh, interpolating to common time frame, and blending forcing in bayesian manner
…eight and distance files to cl inputs of ComputeGriddedToRWPSInterpWeights.py
…XXX.sh and GetXXX.sh. Moved working program to ush/PreProcess
…). fixed paths for some variables and simplified envvar names
…preprocessing on wcoss2. Added scripts to dev for computing interpolation weights
…les for preparing forcing and generating interpolation weights.
…outside of rtofs coverage. occurs only for coarse test meshes. cleaned up weight generation ecf file for clarity
…s now done in dev/compute_interpolation_weights
Added description of command line arguments
Co-authored-by: Jessica Meixner <jessica.meixner@noaa.gov>
remove unnecessary specific piped output files

Co-authored-by: Jessica Meixner <jessica.meixner@noaa.gov>
…bm.py. seperated prep tasks from ecf to ecf(load modules) and jobs/JRWPS_PREP_ to execute task
…process to dev/compute_interpolation_weights/ush. split dev/compute_interpolation_weights/ecf/compute_interpolation_weights.ecf into module loading portion and dev/compute_interpolation_weights/jobs/COMPUTE_INTERPOLATION_WEIGHTS

@JessicaMeixner-NOAA JessicaMeixner-NOAA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are any of the files outside of dev/compute_interpolation_weights needed for the interpolation weight calculation?

@kestonsmith-noaa

Copy link
Copy Markdown
Collaborator Author

Not the way I reconfigured this. The only external file needed here is the linked mesh file.

@JessicaMeixner-NOAA

Copy link
Copy Markdown
Collaborator

Okay - Can the extra files be removed from this PR that are not in the dev/ folder then?

@@ -0,0 +1,12 @@
#! /usr/bin/env bash

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where this file is currently being used in this PR:

> grep preproc -r * 
fix/waveprnc.gfs_rwps.tmpl:$ WAVEWATCH-III wind preprocessor input file
fix/waveprnc.ndfd_rwps.tmpl:$ WAVEWATCH-III wind preprocessor input file
fix/waveprep.ice.tmpl:$ WAVEWATCH-III wind preprocessor input file
fix/waveprnc.hrrr_rwps.tmpl:$ WAVEWATCH-III wind preprocessor input file
parm/ww3_prnc_wind.inp.tmpl:$ Template for WAVEWATCH III Grid preprocessor input file
parm/ww3_prnc_wind.inp.tmpl:$ WAVEWATCH III Field preprocessor input file                          $
parm/ww3_grid.inp.tmpl:$ Template for WAVEWATCH III Grid preprocessor input file
parm/ww3_grid.inp.tmpl:$ WAVEWATCH III Grid preprocessor input file                           $
scripts/exrwps_forecast.sh:#     Make sure nback is set identically in the preprocessor !!!   
scripts/exrwps_prep.sh:# This script is the preprocessor for the GRL multi-grid wave model that runs #
scripts/exrwps_prep.sh:# files to the work directory. After this the actual preprocessing is         #
scripts/exrwps_prep.sh:#   waveice_rwps.sh        :  preprocess ice fields                            #
scripts/exrwps_prep.sh:# 1.b Wind preprocessor template file
scripts/exrwps_prep.sh:# 1.c Ice preprocessor template file
scripts/exrwps_prep.sh:# 2.b Ice preprocessing 
scripts/exrwps_prep.sh:  echo "Ice preprocessing"
scripts/exrwps_prep.sh:  echo '   Running ice field through preprocessor.'
scripts/exrwps_prep.sh:  echo '                     *** End of GLWU preprocessor ***'
scripts/exrwps_prep.sh:# End of GLW preprocessor script -------- ----------------------------------- #
ush/wavendfd_rwps_inc.sh:#     the WW3 netcdf preprocessor only works with regular grids)
ush/wavendfd_rwps.sh:#     the WW3 netcdf preprocessor only works with regular grids)

Comment thread sorc/get_externals.sh
# --------------------------------------------------------------------------- #

echo 'Fetching externals...'
cp -p /lfs/h2/emc/couple/noscrub/keston.smith/meshes/RWPS.v0.msh ../fix/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_externals was not removed but I have moved grabbing fix files to: https://github.com/NOAA-EMC/RWPS/blob/develop/sorc/link_workflow.sh

is there something here that is not in https://github.com/NOAA-EMC/RWPS/blob/develop/sorc/link_workflow.sh that is needed?

When I grep in dev/compute_interpolation_weights I do not see get_externals.sh as being used? Is this file needed?

python compute_unstr_to_rwps_interp_weights.py $stofs_glo $mesh $Nprocs

# Now run the parallel job script
qsub -W block=true jobcardcompute_unstr_to_rwps_interp_weightsPBS

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, qsub from a JJOB is not something that we would do in operations. Since this is dev, we can leave it as is, but I'll be honest, it's not my favorite. It means this just is very hard to port to multiple machines, etc.

mv InterpWeights.$meshname.stofs.nc $out/InterpolationWeights.$meshname.stofs.nc
mv DistToBndy.$meshname.stofs.nc $out/DistToBndy.$meshname.stofs.nc

# clean up temporary directory and files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, creating a working directory for the temporary files would be ideal. I watched as the job went and we had tons of files in the package directory that were then deleted. For future dev jobs, please think about using a temporary working directory instead.

# by nearest node while currents are not extrapolated into coastal
# regions outside of rtofs marine domain.
#
# Files are created in local RWPS/fix directory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files are now in an output directory, correct?

mkdir -p $out

#machine dependend path to RWPS fix files
export RWPSfix=/lfs/h2/emc/couple/noscrub/keston.smith/RWPS

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RWPSfix should not have to be defined, since this only works on WCOSS2 and I am not seeing where this needs to be defined, it at minimum should be the official fix location.

export RWPSfix=/lfs/h2/emc/couple/noscrub/keston.smith/RWPS

# link mesh corresponding to meshID to local fix directory
$HOMErwps/sorc/link_workflow.sh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$HOMErwps/sorc/link_workflow.sh
${HOMErwps}/sorc/link_workflow.sh

export meshname="${meshname: 0: -4}"

#Retrieve current and process for forecast cycle
qsub -V $HOMErwps/dev/compute_interpolation_weights/ecf/compute_interpolation_weights.ecf

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
qsub -V $HOMErwps/dev/compute_interpolation_weights/ecf/compute_interpolation_weights.ecf
qsub -V ${HOMErwps}/dev/compute_interpolation_weights/ecf/compute_interpolation_weights.ecf

A = f.readline()
B=A.lstrip()
values = B.split(" ")
# print(values)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# print(values)

import compute_interpolation_weights_utilities as iutil
import scipy.sparse as sp

nargin = len(sys.argv) - 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a description of the expected input.

@JessicaMeixner-NOAA

Copy link
Copy Markdown
Collaborator

I was able to run the code and my spot check generated the same file you did except I had a full path of the mesh and yours was relative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants