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 11 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
8 changes: 6 additions & 2 deletions driver_scripts/driver_grid.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ 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 # lake frac < lake_cutoff ignored when add_lake=T
Copy link
Collaborator

Choose a reason for hiding this comment

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

add line after this:
export gridcell_lake = 1 # 1:only consider grid cell lakes; 0: consider fractional lakes

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea. Is "gridcell_lake" same as "binary_lake"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, maybe binary_lake is a better name.

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe the comment should say "# 1:only consider full grid cell lakes; 0: consider fractional lakes"

Copy link
Collaborator

Choose a reason for hiding this comment

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

or "# 1:only output full grid cell lakes; 0: output fractional lakes"

elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
8 changes: 6 additions & 2 deletions driver_scripts/driver_grid.jet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ 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 # lake frac < lake_cutoff ignored when add_lake=T
Copy link
Collaborator

Choose a reason for hiding this comment

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

add line after this:
export gridcell_lake = 1 # 1:only consider grid cell lakes; 0: consider fractional lakes

elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
8 changes: 6 additions & 2 deletions driver_scripts/driver_grid.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ 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 # lake frac < lake_cutoff ignored when add_lake=T
Copy link
Collaborator

Choose a reason for hiding this comment

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

add line after this:
export gridcell_lake = 1 # 1:only consider grid cell lakes; 0: consider fractional lakes

elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
8 changes: 6 additions & 2 deletions driver_scripts/driver_grid.wcoss2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ 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 # lake frac < lake_cutoff ignored when add_lake=T
Copy link
Collaborator

Choose a reason for hiding this comment

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

add line after this:
export gridcell_lake = 1 # 1:only consider grid cell lakes; 0: consider fractional lakes

elif [ $gtype = stretch ]; then
export res=96
export stretch_fac=1.5 # Stretching factor for the grid
Expand Down
8 changes: 5 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,8 @@ export out_dir=${WORK_DIR}/c96.uniform

export res=96
export gtype=uniform
export add_lake=true
export lake_data_srce=MODISP_GLDBV3

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
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