Skip to content

Commit

Permalink
Changes to FVCOM pre-processing script (ufs-community#484)
Browse files Browse the repository at this point in the history
Co-authored-by: benjamin blake <benjamin.blake@dlogin03.dogwood.wcoss2.ncep.noaa.gov>
  • Loading branch information
BenjaminBlake-NOAA and benjamin blake authored Feb 15, 2023
1 parent 33fc1c7 commit 1e2d7e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/exregional_prep_fvcom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ ncatted -O -h -a description,glmask,o,c,'Great Lakes mask (1 if overwater 0 othe
# run interpolation script
echo 'now running the Python script for remapping ...'
echo $siglay0_tmp1 $siglay0_tmp2 $siglay0_tmp3 $siglay0_tmp4
python ${SCRIPTSDIR}/fvcom_remap.py $siglay0_tmp1 $siglay0_tmp2 $siglay0_tmp3 $siglay0_tmp4 > python.log
python ${SCRIPTSDIR}/fvcom_remap.py $siglay0_tmp1 $siglay0_tmp2 $siglay0_tmp3 $siglay0_tmp4 $PREDEF_GRID_NAME > python.log
cat python.log
if [ "`tail -1 python.log`" != "fvcom_remap.py completed successfully" ]
then
Expand Down
25 changes: 19 additions & 6 deletions scripts/fvcom_remap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
ncfile_fvcom_mhs = argvs[2]
ncfile_fvcom_sup = argvs[3]
ncfile_fvcom_ont = argvs[4]
predef_grid_name = argvs[5]

# Set dimensions for CONUS and NA 3-km grids
if predef_grid_name == 'RRFS_CONUS_3km':
x1 = 674
x2 = 955
y1 = 1039
y2 = 1490
elif predef_grid_name == 'RRFS_NA_3km':
x1 = 960
x2 = 1240
y1 = 2490
y2 = 2960

# read "containar" file
ncfile='./out_fv3grid.nc'
Expand Down Expand Up @@ -159,8 +172,8 @@

twsfc_fvcom = np.array(temp_fvcom[nn,0,:])
# RRFS grid GL subset
lon_wrfsubset = lon[674:955,1039:1490]
lat_wrfsubset = lat[674:955,1039:1490]
lon_wrfsubset = lon[x1:x2,y1:y2]
lat_wrfsubset = lat[x1:x2,y1:y2]
twsfc_wrf0 = np.array(0. * twsfc[nn,:,:]) # make it all zero. overwritten by interpolated values later.

tisfc_fvcom = np.array(tice_fvcom[nn,:])
Expand All @@ -183,10 +196,10 @@
aicec_wrf=interp.griddata((lon_fvcom,lat_fvcom),aicec_fvcom,(lon_wrfsubset,lat_wrfsubset),method='nearest')#'linear')
vicec_wrf=interp.griddata((lon_fvcom,lat_fvcom),vicec_fvcom,(lon_wrfsubset,lat_wrfsubset),method='nearest')#'linear')

twsfc_wrf0[674:955,1039:1490]=twsfc_wrf
tisfc_wrf0[674:955,1039:1490]=tisfc_wrf
aicec_wrf0[674:955,1039:1490]=aicec_wrf
vicec_wrf0[674:955,1039:1490]=vicec_wrf
twsfc_wrf0[x1:x2,y1:y2]=twsfc_wrf
tisfc_wrf0[x1:x2,y1:y2]=tisfc_wrf
aicec_wrf0[x1:x2,y1:y2]=aicec_wrf
vicec_wrf0[x1:x2,y1:y2]=vicec_wrf

twsfc_wrf0[lakemask==0.] = missing_value
tisfc_wrf0[lakemask==0.] = missing_value
Expand Down

0 comments on commit 1e2d7e3

Please sign in to comment.