Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
07d10ee
Added routines for retrieving forcing on WCOSS2 (recent forecast peri…
kestonsmith-noaa Jul 30, 2026
1fbf8e8
updated switch filename in sorc/build_ww3.sh to reflect name change i…
kestonsmith-noaa Jul 30, 2026
d6b7eaf
Added scripts for launching interpolation weights calulation. Added w…
kestonsmith-noaa Jul 31, 2026
5a5ed4a
Merge branch 'AddPreProcessRoutines' of github.com:/kestonsmith-noaa/…
kestonsmith-noaa Jul 31, 2026
d82dc06
Added scripts to support generating weights for STOFS and other unstr…
kestonsmith-noaa Aug 3, 2026
38580ec
changed path specification and removed command line args from Process…
kestonsmith-noaa Aug 6, 2026
5d69933
cleaned up files in ush/PreProcess and removed some other command lin…
kestonsmith-noaa Aug 11, 2026
4ba7b2d
seperated preprocessing jobs by field and moved to ecf(wcoss2 version…
kestonsmith-noaa Aug 13, 2026
531f59e
fixed other path errors
kestonsmith-noaa Aug 13, 2026
97af00d
move script file names to all lower case
kestonsmith-noaa Aug 19, 2026
a94b153
Merge remote-tracking branch 'upstream/develop' into AddPreProcessRou…
kestonsmith-noaa Aug 19, 2026
a805b29
brought up to date with develop
kestonsmith-noaa Aug 19, 2026
4aedb5a
fixed filename convention for get_rtofs.sh
kestonsmith-noaa Aug 19, 2026
5988ba9
fixed numerous path problems and added script for launching preproces…
kestonsmith-noaa Aug 21, 2026
a493c00
restored missing .tmpl files and other fix files
kestonsmith-noaa Aug 21, 2026
b9fd93f
removed redundant weight generation file for stofs v3
kestonsmith-noaa Aug 21, 2026
c7b20dc
fixed corrupted code in ush/preprocess/nbm/make_nbm_wind.sh
kestonsmith-noaa Aug 24, 2026
005a568
Removed module loading and added preprocessing script to version for …
kestonsmith-noaa Aug 25, 2026
6c1c479
removed esmpy log files in dev that were unintentionally incorporated
kestonsmith-noaa Aug 25, 2026
afbbd56
fixed filename in sorc/prepare_forcing.sh and added minimal readme fi…
kestonsmith-noaa Aug 25, 2026
5f0e7b6
removed redundant preprocessing library from dev
kestonsmith-noaa Aug 25, 2026
976fa89
resource allocation set to work for oc_500m_10km on wcoss2. Cleaned u…
kestonsmith-noaa Aug 26, 2026
8f21c8f
fixed a failure in dist2bnd calculation when no rwps mesh nodes fall …
kestonsmith-noaa Aug 26, 2026
4848eae
removed unused file jobs/GenerateInterpolationWeights.jobcard. This …
kestonsmith-noaa Aug 31, 2026
10e8b0c
Update spd_dir_to_uv_nbm.py
kestonsmith-noaa Sep 3, 2026
88effe3
Update ecf/jrwps_prep_current.ecf
kestonsmith-noaa Sep 3, 2026
76cfdd4
Update ecf/jrwps_prep_current.ecf
kestonsmith-noaa Sep 3, 2026
e24200e
switched to copying time attributes in ush/preprocess/spd_dir_to_uv_n…
kestonsmith-noaa Sep 3, 2026
80e42ee
moved python scripts for computing interpolation weights from ush/pre…
kestonsmith-noaa Sep 4, 2026
56a8ab9
removed unused file compute_unstr_to_rwps_interp_weights.sh
kestonsmith-noaa Sep 4, 2026
4aed3c2
Update README.txt
kestonsmith-noaa Sep 4, 2026
8b9f696
moved prepare_forcing.sh to ush/. Corrected header for ush/prepare_f…
kestonsmith-noaa Sep 4, 2026
5d95849
Update compute_interpolation_weights.sh
kestonsmith-noaa Sep 4, 2026
9363b14
Update README.txt
kestonsmith-noaa Sep 4, 2026
e63f791
moved dev/compute_interpolation_weights/sorc/compute_interpolation_we…
kestonsmith-noaa Sep 4, 2026
7842f94
made new scripts, jobs/JRWPS_PREP_* executeable
kestonsmith-noaa Sep 8, 2026
95a511f
added missing import statement in ush/preprocess/spd_dir_to_uv_nbm.p…
kestonsmith-noaa Sep 8, 2026
e57dafc
seperated out routines used for computing interpolation weights
kestonsmith-noaa Sep 9, 2026
bf468d5
fixed indexing issue in unstructure weight calculation as well as ext…
kestonsmith-noaa Sep 10, 2026
390b860
fixed problem with mesh nodes falling on boundary between regions in …
kestonsmith-noaa Sep 10, 2026
6ee7506
removed jobs/JRWPS_PREP_* no related to computing interpolation weights
kestonsmith-noaa Sep 10, 2026
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
23 changes: 23 additions & 0 deletions dev/compute_interpolation_weights/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Scripts to create interpolation weights and distance to boundary files for interpolating forcing to RWPS mesh.
To run:

$ cd RWPS/dev/compute_interpolation_weights/ush
$ sh compute_interpolation_weights.sh oc_1500m_30km

to generate interpolation files for mesh rwps.oc_1500m_30km.msh. Files will be writen to directory:
RWPS/interpolation_weights

Interpolation weights are created for:

nbm oc domain
rrfs hi domain (used for wind)
rrfs pr domain (used for wind)
rrfs ak domain (used for wind)
rrfs na domain (used for wind)
rrfs conus domain (used for wind)
nbm ak domain (used for ice concentration)
rtofs glo domain (used for current without extrapolation)
rtofs glo domain (used for ice with extrapolation)
stofs domain (used for waterlevel and current)

Currently only setup to work on wcoss2.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#PBS -N compute_interpolation_weights
#PBS -j oe
#PBS -S /bin/bash
#PBS -q dev
#PBS -A NWPS-DEV
#PBS -l walltime=04:00:00
#PBS -l select=1:ncpus=32:mem=500GB
#PBS -l place=excl
#PBS -l debug=true

module reset
module load PrgEnv-intel/8.5.0
module load intel/19.1.3.304
module load craype/2.7.17
module load cray-mpich/8.1.19
module load hdf5-C/1.14.0
module load netcdf-C/4.9.2
module load esmf-C/8.6.0
module load ve/hafs/2.1

pip list -v

$HOMErwps/dev/compute_interpolation_weights/jobs/COMPUTE_INTERPOLATION_WEIGHTS


135 changes: 135 additions & 0 deletions dev/compute_interpolation_weights/jobs/COMPUTE_INTERPOLATION_WEIGHTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash

######################################################################
# This job computes interpolation weights and distance to boundary for
# a RWPS mesh. Currently configured for:
# nbm oc domain (wind)
# nbm ak domain (ice)
# rrfs hi domain (wind)
# rrfs pr domain (wind)
# rrfs ak domain (wind)
# rrfs conus domain (wind)
# rrfs na domain (wind)
# rtofs glo domain (surface currents, ice)
# stofs v3 (waterlevel, currents)
#
# Different sets of interpolation weights are created for rtofs ice
# and surface currents so that ice concentration can be extrapolated
# 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?

######################################################################

cd $HOMErwps/dev/compute_interpolation_weights/ush

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.

This is where maybe instead in the future we could cd into a working directory?


# Sample input 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.

Can you make a note here about if this sample data didn't exist what this data is?

SID="/lfs/h2/emc/couple/noscrub/keston.smith/SampleInput"
date="20260730"
cycl="00"
Nprocs=32

######################################################################
# Compute rrfs interpolation weights for interpolating wind.
# no extrapolation for rrfs forecasts.
######################################################################
rrfs_hi=$SID/wind.$date.$cycl/rrfs.$date.$cycl.wind10m.hi.nc
rrfs_pr=$SID/wind.$date.$cycl/rrfs.$date.$cycl.wind10m.pr.nc
rrfs_ak=$SID/wind.$date.$cycl/rrfs.$date.$cycl.wind10m.ak.nc
rrfs_na=$SID/wind.$date.$cycl/rrfs.$date.$cycl.wind10m.na.nc
rrfs_conus=$SID/wind.$date.$cycl/rrfs.$date.$cycl.wind10m.conus.nc


rrfsIntrp="$out/InterpolationWeights.$meshname.rrfs"
rrfsDst="$out/DistToBndy.$meshname.rrfs"

rm -rf $rrfsIntrp.hi.nc $rrfsDst.hi.nc __pycache__
python ./compute_gridded_to_rwps_interp_weights.py $rrfs_hi $mesh $rrfsIntrp.hi.nc $rrfsDst.hi.nc -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.

Instead of ./compute_gridded_to_rwps_interp_weights.py if you're running from a working directory or if this was an ops not a dev job, this should instead be:

${USHrwps}/compute_gridded_to_rwps_interp_weights.py


rm -rf $rrfsIntrp.pr.nc $rrfsDst.pr.nc __pycache__
python ./compute_gridded_to_rwps_interp_weights.py $rrfs_pr $mesh $rrfsIntrp.pr.nc $rrfsDst.pr.nc -1

rm -rf $rrfsIntrp.ak.nc $rrfsDst.ak.nc __pycache__
python ./compute_gridded_to_rwps_interp_weights.py $rrfs_ak $mesh $rrfsIntrp.ak.nc $rrfsDst.ak.nc -1

rm -rf $rrfsIntrp.na.nc $rrfsDst.na.nc __pycache__
python ./compute_gridded_to_rwps_interp_weights.py $rrfs_na $mesh $rrfsIntrp.na.nc $rrfsDst.na.nc -1

rm -rf $rrfsIntrp.conus.nc $rrfsDst.conus.nc __pycache__
python ./compute_gridded_to_rwps_interp_weights.py $rrfs_conus $mesh $rrfsIntrp.conus.nc $rrfsDst.conus.nc -1

######################################################################
# Compute nbm interpolation weights on oc domain for interpolating wind.
# Extrapolate to cover minor edge differences on south and east boundaries.
######################################################################
nbm_oc=$SID/wind.$date.$cycl/nbm.$date.$cycl.wind10m.oc.nc
nbmIntrp="$out/InterpolationWeights.$meshname.nbm"
nbmDst="$out/DistToBndy.$meshname.nbm"

#extrapolate nbm oc wind to all points
rm $nbmIntrp.oc.nc $nbmDst.oc.nc
python ./compute_gridded_to_rwps_interp_weights.py $nbm_oc $mesh $nbmIntrp.oc.nc $nbmDst.oc.nc 1


######################################################################
# Compute nbm interpolation weights on ak domain for interpolating ice.
# No extrapolation outside the ak region
######################################################################
nbm_ak=$SID/ice.$date.$cycl/nbm.$date.$cycl.ice.ak.nc
#do not extrapolate for NBM .ak. domain
rm $nbmIntrp.ak.nc $nbmDst.ak.nc
python ./compute_gridded_to_rwps_interp_weights.py $nbm_ak $mesh $nbmIntrp.ak.nc $nbmDst.ak.nc -1

rtofs_ice=$SID/ice.$date.$cycl/rtofs.ice.$date.nc

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.

should these 3 lines about rtofs go after the comment block ?

rtofsIntrp="$out/InterpolationWeights.$meshname.rtofs"
rtofsDst="$out/DistToBndy.$meshname.rtofs"

######################################################################
# Compute rtofs interpolation weights for interpolating ice.
# Do extrapolate rtofs .glo. for full ice coverage in near shore.
######################################################################
rm $rtofsIntrp.ice.nc $rtofsDst.ice.nc
python ./compute_gridded_to_rwps_interp_weights.py $rtofs_ice $mesh $rtofsIntrp.ice.nc $rtofsDst.ice.nc 1


######################################################################
# Compute rtofs interpolation weights for interpolating currents.
# Do not extrapolate into coastal regions
######################################################################
rtofs_cur=$SID/rtofs.$date/currents.$date.rtofs.nc
#do not extrapolate rtofs .glo. currents
rm $rtofsIntrp.current.nc $rtofsDst.current.nc
python ./compute_gridded_to_rwps_interp_weights.py $rtofs_cur $mesh $rtofsIntrp.current.nc $rtofsDst.current.nc -1


######################################################################
# Compute stofs interpolation weights for stofs v3 output
# All dates after ~ August 18 2026
######################################################################
stofs_glo="$SID/stofs.v3/stofs.20260819.00/stofs_2d_glo.t00z.fields.cwl.nc"

mkdir -p STOFSInterpWeights.$meshname

# First construct parallel jobscript to compute weights using Nprocs division of destination domain(meshfile)
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.

wait

# combine text file output of parallel jobs
cat STOFSInterpWeights.$meshname/Part.IntrpWghts.*.txt > InterpWeights.$meshname.stofs.txt

# sort order of nodes and convert output weights to netcdf file
python convert_weights_to_netcdf.py $stofs_glo $mesh InterpWeights.$meshname.stofs.txt 1
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.

rm -rf STOFSInterpWeights.$meshname
rm InterpWeights.$meshname.stofs.txt
rm *.out
rm ESMPy*
rm jobcardcompute_unstr_to_rwps*
rm -rf __pycache__

Loading