Skip to content

Commit

Permalink
STOFS-3D-Atl scripts: minor updates for v7.
Browse files Browse the repository at this point in the history
  • Loading branch information
feiye-vims committed Aug 6, 2024
1 parent db4efa8 commit d04e0f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
1) generate mask nc file using generate_adcirc.py
1) Use mask_boundary_elev.py to make lbnd_node_mask.nc

2) generate out2d_1.mask.nc using nco commands, as requested by NOAA
/sciclone/schism10/feiye/STOFS3D-v4/Shared_with_NOAA/Mask_lbnd/mask_lbn_nd.sh
2) Use mask_lbn_nd.sh to do the actual masking over out2d_*.nc
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import xarray
import numpy as np
from pylib import schism_grid, grd2sms
from pylib_essentials.schism_file import grd2sms
# from pylib import schism_grid
from spp_essentials.Hgrid_extended import read_schism_hgrid_cached as schism_grid
from schism_py_pre_post.Geometry.inpoly import find_node_in_shpfiles
import os
from netCDF4 import Dataset

def make_mask(hg: schism_grid, high_ground_thres=-19.0, additional_mask_file=None):

hg.compute_bnd()
hg.compute_node_ball()
# hg.save('/sciclone/schism10/feiye/STOFS3D-v4/Inputs/v4_20220715_update/hgrid.pkl')

# find nodes near lbnd
lbnd_nd_idx = np.hstack(hg.ilbn)
Expand Down Expand Up @@ -71,8 +72,9 @@ def diagnose_mask(imask: np.ndarray):


if __name__ == '__main__':
hg = schism_grid('/sciclone/schism10/feiye/STOFS3D-v4/Inputs/v4_20220715_update/hgrid.pkl')
hg = schism_grid('./hgrid.ll')

imask = make_mask(hg, high_ground_thres=-19.0, additional_mask_file='./Shapefiles/additional_masks.shp')
write_mask_nc(imask, outputfile='/sciclone/schism10/feiye/STOFS3D-v4/Shared_with_NOAA/Mask_lbnd/lbnd_node_mask1.nc')

write_mask_nc(imask, outputfile='./lbnd_node_mask.nc')
hg.save(value=imask, fname='./hgrid_masked.gr3') # diagnostic output

0 comments on commit d04e0f4

Please sign in to comment.