Skip to content
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

-- Fix coastal lakes with revised code #856

Merged
merged 16 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions docs/source/ufs_utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,13 @@ Program inputs and outputs

* grid file - the "grid" file from the make_hgrid or regional_esg programs - CRES_grid.tile#.nc - (NetCDF)
* orography file - the orography file including the 'inland' flag record from the inland program - oro.CRES.tile#.nc (NetCDF)
* lake status code file - GlobalLakeStatus.dat (located in `./fix/fix_orog <https://noaa-ufs-srw-pds.s3.amazonaws.com/index.html#fix/fix_orog/>`_). See GlobalLakeStatus.txt for the defintion of each code.
* lake depth file - GlobalLakeDepth.dat (located in `./fix/fix_orog <https://noaa-ufs-srw-pds.s3.amazonaws.com/index.html#fix/fix_orog/>`_). See GlobalLakeDepth.txt for a description of this file.
* lake status code file - One of the following files. (located in `./fix/fix_orog <https://noaa-ufs-srw-pds.s3.amazonaws.com/index.html#fix/fix_orog/>`_). See GlobalLakeStatus.txt for a description of the file format.
* GlobalLakeStatus_MOSISp.dat
* GlobalLakeStatus_GLDBv3release.dat
* GlobalLakeStatus_VIIRS.dat
* lake depth file - One of the following files. (located in `./fix/fix_orog <https://noaa-ufs-srw-pds.s3.amazonaws.com/index.html#fix/fix_orog/>`_). See GlobalLakeDepth.txt for a description of this file.
* GlobalLakeDepth_GLDBv3release.dat
* GlobalLakeDepth_GLOBathy.dat

**Output data:**

Expand Down
9 changes: 7 additions & 2 deletions driver_scripts/driver_grid.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@ export soil_type_src="bnu.v3.30s" # Soil type data.
# For Beijing Norm. Univ. data
# 1) "bnu.v3.30s" for global 30s data.

# choose dataset sources for lakefrac & lakedepth so that lake_data_srce=LakeFrac_LakeDepth;
# available options are 'MODISP_GLDBV3', 'MODISP_GLOBATHY', 'VIIRS_GLDBV3', 'VIIRS_GLOBATHY' & 'GLDBV3'
export lake_data_srce=MODISP_GLDBV3

if [ $gtype = uniform ]; then
export res=96
export add_lake=false # Add lake frac and depth to orography data.
export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T
export add_lake=true # Add lake frac and depth to orography data.
export lake_cutoff=0.50 # return 0 if lake_frac < lake_cutoff & add_lake=T
export binary_lake=1 # return 1 if lake_frac >= lake_cutoff & add_lake=T
elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
9 changes: 7 additions & 2 deletions driver_scripts/driver_grid.jet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,15 @@ export soil_type_src="bnu.v3.30s" # Soil type data.
# 4) "statsgo.nh.30s" for NH 30s data
# 5) "statsgo.30s" for global 30s data

# choose dataset sources for lakefrac & lakedepth so that lake_data_srce=LakeFrac_LakeDepth;
# available options are 'MODISP_GLDBV3', 'MODISP_GLOBATHY', 'VIIRS_GLDBV3', 'VIIRS_GLOBATHY' & 'GLDBV3'
export lake_data_srce=MODISP_GLDBV3

if [ $gtype = uniform ]; then
export res=96
export add_lake=false # Add lake frac and depth to orography data.
export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T
export add_lake=true # Add lake frac and depth to orography data.
export lake_cutoff=0.50 # return 0 if lake_frac < lake_cutoff & add_lake=T
export binary_lake=1 # return 1 if lake_frac >= lake_cutoff & add_lake=T
elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
9 changes: 7 additions & 2 deletions driver_scripts/driver_grid.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ export soil_type_src="bnu.v3.30s" # Soil type data.
# 4) "statsgo.nh.30s" for NH 30s data
# 5) "statsgo.30s" for global 30s data

# choose dataset sources for lakefrac & lakedepth so that lake_data_srce=LakeFrac_LakeDepth;
# available options are 'MODISP_GLDBV3', 'MODISP_GLOBATHY', 'VIIRS_GLDBV3', 'VIIRS_GLOBATHY' & 'GLDBV3'
export lake_data_srce=MODISP_GLDBV3

if [ $gtype = uniform ]; then
export res=96
export add_lake=false # Add lake frac and depth to orography data.
export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T
export add_lake=true # Add lake frac and depth to orography data.
export lake_cutoff=0.50 # return 0 if lake_frac < lake_cutoff & add_lake=T
export binary_lake=1 # return 1 if lake_frac >= lake_cutoff & add_lake=T
elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
9 changes: 7 additions & 2 deletions driver_scripts/driver_grid.wcoss2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,15 @@ export soil_type_src="bnu.v3.30s" # Soil type data
# 4) "statsgo.nh.30s" for NH 30s data
# 5) "statsgo.30s" for global 30s data

# choose dataset sources for lakefrac & lakedepth so that lake_data_srce=LakeFrac_LakeDepth;
# available options are 'MODISP_GLDBV3', 'MODISP_GLOBATHY', 'VIIRS_GLDBV3', 'VIIRS_GLOBATHY' & 'GLDBV3'
export lake_data_srce=MODISP_GLDBV3

if [ $gtype = uniform ]; then
export res=96
export add_lake=false # Add lake frac and depth to orography data.
export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T
export add_lake=true # Add lake frac and depth to orography data.
export lake_cutoff=0.50 # return 0 if lake_frac < lake_cutoff & add_lake=T
export binary_lake=1 # return 1 if lake_frac >= lake_cutoff & add_lake=T
elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
10 changes: 7 additions & 3 deletions reg_tests/grid_gen/c96.uniform.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

#-----------------------------------------------------------------------
# Create a C96 global uniform grid. Compare output to a set
# of baseline files using the 'nccmp' utility. This script is
# run by the machine specific driver script.
# Create a C96 global uniform grid including inland lakes. Compare
# output to a set of baseline files using the 'nccmp' utility. This
# script is run by the machine specific driver script.
#-----------------------------------------------------------------------

set -x
Expand All @@ -13,6 +13,10 @@ export out_dir=${WORK_DIR}/c96.uniform

export res=96
export gtype=uniform
export add_lake=true
export lake_data_srce=MODISP_GLDBV3
GeorgeGayno-NOAA marked this conversation as resolved.
Show resolved Hide resolved
export lake_cutoff=0.50
export binary_lake=1

NCCMP=${NCCMP:-$(which nccmp)}

Expand Down
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/driver.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export OMP_NUM_THREADS=24
#-----------------------------------------------------------------------------

LOG_FILE1=${LOG_FILE}01
TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.uniform \
TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.uniform \
-o $LOG_FILE1 -e $LOG_FILE1 ./c96.uniform.sh)

#-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/driver.jet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export OMP_NUM_THREADS=24
#-----------------------------------------------------------------------------

LOG_FILE1=${LOG_FILE}01
TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.uniform \
TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:20:00 -A $PROJECT_CODE -q $QUEUE -J c96.uniform \
--partition=xjet -o $LOG_FILE1 -e $LOG_FILE1 ./c96.uniform.sh)

#-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/driver.wcoss2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ rm -fr $WORK_DIR
#-----------------------------------------------------------------------------

LOG_FILE1=${LOG_FILE}01
TEST1=$(qsub -V -o $LOG_FILE1 -e $LOG_FILE1 -q $QUEUE -A $PROJECT_CODE -l walltime=00:10:00 \
TEST1=$(qsub -V -o $LOG_FILE1 -e $LOG_FILE1 -q $QUEUE -A $PROJECT_CODE -l walltime=00:15:00 \
-N c96.uniform -l select=1:ncpus=30:mem=40GB $PWD/c96.uniform.sh)

#-----------------------------------------------------------------------------
Expand Down
38 changes: 34 additions & 4 deletions sorc/orog_mask_tools.fd/inland.fd/inland.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ PROGRAM inland_mask

REAL, ALLOCATABLE :: inland(:,:,:)
REAL, ALLOCATABLE :: land_frac(:,:,:)
INTEGER :: i_ctr, j_ctr, tile_beg, tile_end
INTEGER :: tile_beg, tile_end
INTEGER :: cs_res, x_res, y_res
CHARACTER(len=32) :: arg
INTEGER :: stat
INTEGER :: max_rd
REAL :: cutoff
CHARACTER(len=1) :: reg

LOGICAL, ALLOCATABLE :: done(:,:,:)
LOGICAL, ALLOCATABLE :: done(:,:,:)

CALL getarg(0, arg) ! get the program name
IF (iargc() /= 3 .AND. iargc() /= 4) THEN
Expand Down Expand Up @@ -78,14 +78,19 @@ PROGRAM inland_mask
!! @author Ning Wang
SUBROUTINE mark_global_inland(cs_res)
INTEGER, INTENT(IN) :: cs_res
INTEGER :: i_seed, j_seed

ALLOCATE(done(cs_res,cs_res,6))
ALLOCATE(inland(cs_res,cs_res,6))
done = .false.
inland = 1.0
i_ctr = cs_res/2; j_ctr = cs_res/2

CALL mark_global_inland_rec_d(i_ctr, j_ctr, 2, 0)
i_seed = cs_res/2; j_seed = cs_res/2
CALL mark_global_inland_rec_d(i_seed, j_seed, 2, 0)

! to make sure black sea is excluded
GeorgeGayno-NOAA marked this conversation as resolved.
Show resolved Hide resolved
i_seed = REAL(cs_res)/32.0*3; j_seed = i_seed
CALL mark_global_inland_rec_d(i_seed, j_seed, 3, 0)

DEALLOCATE(done)

Expand All @@ -99,6 +104,7 @@ END SUBROUTINE mark_global_inland
SUBROUTINE mark_inland_reg(cs_res)
INTEGER, INTENT(IN) :: cs_res
INTEGER :: i_seed, j_seed
INTEGER :: i

ALLOCATE(done(x_res,y_res,1))
ALLOCATE(inland(x_res,y_res,1))
Expand All @@ -116,6 +122,30 @@ SUBROUTINE mark_inland_reg(cs_res)
i_seed = x_res/3; j_seed = 1
CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0)

j_seed = 1
DO i = 1, x_res
CALL mark_regional_inland_rec_d(i, j_seed, 1, 0)
ENDDO

j_seed = y_res
DO i = x_res/2, x_res
CALL mark_regional_inland_rec_d(i, j_seed, 1, 0)
ENDDO

! set up additional 3 seeds for ESG CONUS grid
! i_seed = 1600; j_seed = 1040
! i_seed = x_res - 10; j_seed = y_res
! CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0)

! i_seed = x_res - 60; j_seed = y_res
! CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0)

! i_seed = x_res - 275; j_seed = y_res
! CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0)

! i_seed = 500; j_seed = 1
! CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0)

DEALLOCATE(done)

END SUBROUTINE mark_inland_reg
Expand Down
Loading