Skip to content

Commit

Permalink
outlet version definition was moved to rmTinyCatchParaMod.F90
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujin Zeng authored and Yujin Zeng committed Jul 2, 2024
1 parent ecda649 commit 303b84f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@
/bin/mv rst/Pfafstetter-M.rst rst/Pfafstetter.rst
bin/CombineRasters.x -f 0 -t {NT} {OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO} Pfafstetter >/dev/null
bin/CombineRasters.x -t {NT} CF{NC}x6C{SGNAME} {OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter
bin/mk_runofftbl.x -g CF{NC}x6C{SGNAME}_{OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter -v {lbcsv}
setenv OMP_NUM_THREADS 1
if ({SKIPLAND} != True) bin/mkCatchParam.x -x {NX} -y {NY} -g CF{NC}x6C{SGNAME}_{OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter -v {lbcsv}
if ({SKIPLAND} != True) then
bin/mkCatchParam.x -x {NX} -y {NY} -g CF{NC}x6C{SGNAME}_{OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter -v {lbcsv}
bin/mk_runofftbl.x -g CF{NC}x6C{SGNAME}_{OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter
endif
endif
if ( {STEP2} == True ) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
/bin/mv rst/Pfafstetter-M.rst rst/Pfafstetter.rst
bin/CombineRasters.x -f 0 -t {NT} {DATENAME}{IMO}x{POLENAME}{JMO} Pfafstetter >/dev/null
bin/CombineRasters.x -t {NT} DC{IM}xPC{JM} {DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter
bin/mk_runofftbl.x -g DC{IM}xPC{JM}_{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter -v {lbcsv}
setenv OMP_NUM_THREADS 1
if ( {SKIPLAND} != True ) bin/mkCatchParam.x -x {NX} -y {NY} -g DE{IMO}xPE{JMO}_DE{IMO}xPE{JMO}-Pfafstetter -v {lbcsv}
if ( {SKIPLAND} != True ) then
bin/mkCatchParam.x -x {NX} -y {NY} -g DE{IMO}xPE{JMO}_DE{IMO}xPE{JMO}-Pfafstetter -v {lbcsv}
bin/mk_runofftbl.x -g DC{IM}xPC{JM}_{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter
endif
setenv OMP_NUM_THREADS {NCPUS}
if ( {SKIPLAND} != True ) bin/mkCatchParam.x -x {NX} -y {NY} -g DE{IMO}xPE{JMO}_DE{IMO}xPE{JMO}-Pfafstetter -v {lbcsv}
chmod 755 bin/create_README.csh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ program mk_runofftbl
!
! !ARGUMENTS:
!
! Usage = "mk_runofftbl.x -g Gridname -v LBCSV"
! Usage = "mk_runofftbl.x -g Gridname"
!
! -g: Gridname: a string that describes the grids associated with the atmosphere and ocean model configuration
! eg, CF0180x6C_M6TP0072x0036-Pfafstetter
! -v: LBCSV : Land bcs version (F25, GM4, ICA, NL3, NL4, NL5, v06, v07, v08, v09, v10, v11, v12, ...)
!
! This program generates the runoff table *.trn and *.TRN files that are used in the Catchment model for
! directing runoff to its ocean sink. The inputs are (i) bcs geometry files associated with the Gridname
! and (ii) a binary file ("Outlet_latlon.43200x21600") that provides the land raster grid cells where the
! outlets are located. The latter file is either created by [..]/Raster/preproc/routing/run_routing_raster.py
! or from Randy's (Randal.d.koster@nasa.gov) old file under {MAKE_BCS_INPUT_DIR}/land/route/v1.
! The program first moves the outlet locations from the land raster grid cells to the nearest ocean pixels
! by calling outlets_to_ocean() (only with bcs version v11, v12 or later) and then generates the runoff table files.
! The program outlets_to_ocean() currently works only for the MOM5 and MOM6 tripolar ocean grids.
! by calling outlets_to_ocean() and then generates the runoff table files.
! The subroutine outlets_to_ocean() currently works only for the MOM5 and MOM6 tripolar ocean grids.
!
!Basically based on bcs version we would use have these 3 options:
!=======================================================
!bcs version --> Outlet lat/lon file version
!---------------------------------------------------
!v12 --> (new) v2 (produced with Yujin's pre-processing routines)
!v11 --> (old) v1 (produced with Randy's old file)
!otherwise --> n/a (produced with Randy's old file, but do not move outlet locations to ocean)
!otherwise --> N/A (do not run routing module of make_bcs)
!=========================================================
!
! Yujin Zeng - June 17, 2024
! Email: yujin.zeng@nasa.gov

use mapl_hashmod
use mapl_sortmod
use rmTinyCatchParaMod, only :: OUTLETV
use netcdf

implicit none
Expand All @@ -57,13 +57,18 @@ program mk_runofftbl
integer :: nxt, command_argument_count
character*(128) :: arg
character*(128) :: Usage = "mk_runofftbl.x -g CF0180x6C_M6TP0072x0036-Pfafstetter -v v12"
character*5 :: LBCSV = 'UNDEF'
character*5 :: OUTLETV = 'UNDEF'
character*1 :: opt

! ------------------------------------------------------------------

call get_environment_variable ("MAKE_BCS_INPUT_DIR",MAKE_BCS_INPUT_DIR)

if(trim(OUTLETV)=="v1".or.trim(OUTLETV)=="v2")then
fileLL=trim(MAKE_BCS_INPUT_DIR)//'/land/route/'//trim(OUTLETV)//'/Outlet_latlon.'
else
print *, "Routing files will not be produced with the selected land BCs version"
stop
endif

! Read inputs -----------------------------------------------------

Expand Down Expand Up @@ -91,8 +96,6 @@ program mk_runofftbl
select case (opt)
case ('g')
Gridname = trim(arg)
case ('v')
LBCSV = trim(arg)
case default
print *, "Wrong flag -", opt
print *, "Example usage with defaults: "
Expand All @@ -103,19 +106,8 @@ program mk_runofftbl
call get_command_argument(nxt,arg)
end do

if(trim(LBCSV)=="v11")then
OUTLETV="v1"
else if(trim(LBCSV)=="v12")then
OUTLETV="v2"
else
OUTLETV="others"
endif

if(trim(OUTLETV)=="v1".or.trim(OUTLETV)=="v2")then
fileLL=trim(MAKE_BCS_INPUT_DIR)//'/land/route/'//trim(OUTLETV)//'/Outlet_latlon.'
else
fileLL=trim(MAKE_BCS_INPUT_DIR)//'/land/route/v1/Outlet_latlon.'
endif
print *, " "
print*, "Working with input BCs grid: ", trim(Gridname)

! ------------------------------------------------------------------

Expand Down Expand Up @@ -158,9 +150,7 @@ program mk_runofftbl
print *, "- Output file: ", fileB
print *, " "

if(trim(OUTLETV)=="v1".or.trim(OUTLETV)=="v2")then
call outlets_to_ocean(Gridname,lons,lats,nx,ny)
endif
call outlets_to_ocean(Gridname,lons,lats,nx,ny)

open(10,file=fileT, form="formatted", status="old")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module rmTinyCatchParaMod
character*6, public, save :: SOILBCS = 'UNDEF'
character*6, public, save :: MODALB = 'UNDEF'
character*10, public, save :: SNOWALB = 'UNDEF'
character*5, public, save :: OUTLETV = 'UNDEF'
REAL, public, save :: GNU = MAPL_UNDEF

character*512 :: MAKE_BCS_INPUT_DIR
Expand Down Expand Up @@ -103,6 +104,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'NGDC'
MODALB = 'MODIS1'
SNOWALB = 'LUT'
OUTLETV = "N/A"
GNU = 2.17
use_PEATMAP = .false.
jpl_height = .false.
Expand All @@ -112,6 +114,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'NGDC'
MODALB = 'MODIS2'
SNOWALB = 'LUT'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .false.
jpl_height = .false.
Expand All @@ -121,6 +124,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'LUT'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .false.
jpl_height = .false.
Expand All @@ -130,6 +134,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'LUT'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .false.
jpl_height = .true.
Expand All @@ -139,6 +144,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'LUT'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .true.
Expand All @@ -148,6 +154,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'MODC061'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .true.
Expand All @@ -157,6 +164,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'LUT'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .false.
Expand All @@ -166,6 +174,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'MODC061'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .false.
jpl_height = .false.
Expand All @@ -175,6 +184,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'MODC061'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .false.
Expand All @@ -184,6 +194,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'MODC061v2'
OUTLETV = "N/A"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .false.
Expand All @@ -193,6 +204,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD'
MODALB = 'MODIS2'
SNOWALB = 'MODC061v2'
OUTLETV = "v1"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .true.
Expand All @@ -202,6 +214,7 @@ SUBROUTINE init_bcs_config (LBCSV)
SOILBCS = 'HWSD_b'
MODALB = 'MODIS2'
SNOWALB = 'MODC061v2'
OUTLETV = "v2"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .true.
Expand Down

0 comments on commit 303b84f

Please sign in to comment.