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

zero-diff bug fixes in make_bcs package #601

Merged
merged 21 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e55e401
pass range to LRRasterize to avoid undifined pixel
weiyuan-jiang Jun 24, 2022
b1421ad
remove unnecessary check
weiyuan-jiang Jun 24, 2022
9d87896
add more protection to avoid crash
weiyuan-jiang Jun 28, 2022
472aa5e
Merge branch 'bugfix/wjiang/pass_range_to_easev2' of github.com:GEOS-…
weiyuan-jiang Jun 28, 2022
77e8358
1) add shared_map 2) more cycle
weiyuan-jiang Jun 29, 2022
0660206
restore mkCatchParam.F9
weiyuan-jiang Jun 29, 2022
cbae185
more bug fix ( out of bound fix)
weiyuan-jiang Jul 1, 2022
d74aba2
more clean up
weiyuan-jiang Jul 6, 2022
6cbfe4c
due to non zero diff merge bcs versioning has to change
biljanaorescanin Jul 15, 2022
fab08fa
typo
biljanaorescanin Jul 15, 2022
e20c222
Merge branch 'develop' into bugfix/wjiang/pass_range_to_easev2
biljanaorescanin Jul 15, 2022
53fe75b
less invasive solution to communicating make_bcs reproducibility issues
gmao-rreichle Jul 17, 2022
2c77bed
fix for user defined dir
biljanaorescanin Jul 19, 2022
6ed8907
some cleanup of environment variables (make_bcs)
gmao-rreichle Jul 19, 2022
c68adbf
Merge branch 'develop' into bugfix/wjiang/pass_range_to_easev2
gmao-rreichle Jul 21, 2022
e91a8ad
setenv to set for NCPUS
biljanaorescanin Jul 21, 2022
50c53a0
Merge branch 'develop' into bugfix/wjiang/pass_range_to_easev2
biljanaorescanin Aug 3, 2022
9a0f9ad
removing ease m09 and m36 special handling for bcs
biljanaorescanin Aug 31, 2022
0db200e
Change fortran extensions iargc, getarg, getenv and system
biljanaorescanin Sep 1, 2022
1893e2d
Merge branch 'develop' into bugfix/wjiang/pass_range_to_easev2
gmao-rreichle Sep 1, 2022
625b9a8
Merge branch 'develop' into bugfix/wjiang/pass_range_to_easev2
sdrabenh Sep 8, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ program mkOverlaySimple

REAL_, parameter :: PI = RASTER_PI

integer :: IARGC
integer :: command_argument_count
integer :: nxt, argl, fill
integer :: i, j, k, l, ip
integer :: STATUS, i1, i2, nvars, rvars
Expand Down Expand Up @@ -75,15 +75,15 @@ program mkOverlaySimple
rstdir='rst/' ! Write in current dir
maxtiles=4000000

I = iargc()
I = command_argument_count()

if(I < 2 .or. I > 11) then
print *, trim(Usage)
call exit(1)
end if

nxt = 1
call getarg(nxt,arg)
call get_command_argument(nxt,arg)

do while(arg(1:1)=='-')
opt=arg(2:2)
Expand All @@ -92,7 +92,7 @@ program mkOverlaySimple
if(argl==2) then
if(scan(opt,'zvh')==0) then
nxt = nxt + 1
call getarg(nxt,arg)
call get_command_argument(nxt,arg)
end if
else
arg = arg(3:)
Expand All @@ -118,13 +118,13 @@ program mkOverlaySimple
end select

nxt = nxt + 1
call getarg(nxt,arg)
call get_command_argument(nxt,arg)
end do

Grid1 = ARG

nxt = nxt + 1
call getarg(nxt,arg)
call get_command_argument(nxt,arg)

Grid2 = ARG

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
allocate(albo(nx,ny))
allocate(alb_out(nx,ny))

call getarg(1,ifile)
call get_command_argument(1,ifile)

ofile = "data/Attic/foo"!trim(ifile)//'int1'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ program FillMomGrid

REAL(KIND=REAL64), parameter :: PI = MAPL_PI

integer :: IARGC
integer :: command_argument_count
integer :: nxt, argl, fill
integer :: i, j, k, l, ip
integer :: STATUS, i1, i2, nvars, rvars
Expand Down Expand Up @@ -94,7 +94,6 @@ program FillMomGrid
end if

nxt = 1
!call getarg(nxt,arg)
call get_command_argument(nxt,arg)

do while(arg(1:1)=='-')
Expand All @@ -104,7 +103,6 @@ program FillMomGrid
if(argl==2) then
if(scan(opt,'zvh')==0) then
nxt = nxt + 1
!call getarg(nxt,arg)
call get_command_argument(nxt,arg)
end if
else
Expand Down Expand Up @@ -133,20 +131,17 @@ program FillMomGrid
end select

nxt = nxt + 1
!call getarg(nxt,arg)
call get_command_argument(nxt,arg)
end do

Grid1 = ARG

nxt = nxt + 1
!call getarg(nxt,arg)
call get_command_argument(nxt,arg)

Grid2 = ARG

nxt = nxt + 1
!call getarg(nxt,arg)
call get_command_argument(nxt,arg)

GridFile = arg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ PROGRAM chk_clsm_params
character*300 :: input_data

read_file = .true.
call system ('mkdir -p idl_out')
call system ('cd bin/ ; /bin/cp ../src/plot_curves.csh . ; cd .. ; /bin/cp bin/plot_curves.csh idl_out/. ; chmod 755 idl_out/plot_curves.csh')
call execute_command_line ('mkdir -p idl_out')
call execute_command_line ('cd bin/ ; /bin/cp ../src/plot_curves.csh . ; cd .. ; /bin/cp bin/plot_curves.csh idl_out/. ; chmod 755 idl_out/plot_curves.csh')


n = iargc()
n = command_argument_count()

if(n < 3) then
print *, "Usage : chk_clsm_params -s Y(N) -m MaskFile"
Expand All @@ -56,13 +56,13 @@ PROGRAM chk_clsm_params
end if

n = 1
call getarg(n,arg)
call get_command_argument(n,arg)
do while(arg(1:1)=='-')
opt=arg(2:2)
if(len(trim(arg))==2) then
if(scan(opt,'zvh')==0) then
n = n + 1
call getarg(n,arg)
call get_command_argument(n,arg)
endif
else
arg = arg(3:)
Expand All @@ -74,7 +74,7 @@ PROGRAM chk_clsm_params
MaskFile = trim(arg)
end select
n = n + 1
call getarg(n,arg)
call get_command_argument(n,arg)
end do

if((single_tile == 'Y').or.(single_tile == 'y')) read_file = .false.
Expand Down Expand Up @@ -195,6 +195,6 @@ PROGRAM chk_clsm_params
close (10,status = 'keep')
close (11,status = 'keep')

call system ('cd idl_out/ ; ./plot_curves.csh ; cd ..')
call execute_command_line ('cd idl_out/ ; ./plot_curves.csh ; cd ..')

END PROGRAM chk_clsm_params
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PROGRAM create_vegdyn_ndvi

implicit none

integer :: NTILES, N, I, k, iargc, JPLH
integer :: NTILES, N, I, k, command_argument_count, JPLH
integer, parameter :: nx = 8640, ny = 4320

character*400 :: BCSDIR, OUTDIR, GFILE, IMxJM, arg(5)
Expand All @@ -30,18 +30,18 @@ PROGRAM create_vegdyn_ndvi
real, pointer, dimension (:) :: z2, z0, ityp
include 'netcdf.inc'

I = iargc()
I = command_argument_count()
IMxJM =''
GFILE =''

if(iargc() /= 5) then
print *, "Wrong Number of arguments: ", iargc()
if(command_argument_count() /= 5) then
print *, "Wrong Number of arguments: ", command_argument_count()
print *, "Usage : ./create_vegdyn_ndvi BCSDIR GFILE, IMxJM JPLH OUTDIR"
stop
endif

do n=1,5
call getarg(n,arg(n))
call get_command_argument(n,arg(n))
enddo

read(arg(1),'(a)') BCSDIR
Expand All @@ -53,8 +53,8 @@ PROGRAM create_vegdyn_ndvi
! create dirs/links
! -----------------

call system('mkdir -p data ; cd data/ ; ln -s /discover/nobackup/projects/gmao/ssd/land/l_data/LandBCs_files_for_mkCatchParam/V001/ CATCH')
call system('mkdir -p '//trim(OUTDIR))
call execute_command_line('mkdir -p data ; cd data/ ; ln -s /discover/nobackup/projects/gmao/ssd/land/l_data/LandBCs_files_for_mkCatchParam/V001/ CATCH')
call execute_command_line('mkdir -p '//trim(OUTDIR))

open (10,file = trim(BCSDIR)//'/clsm/catchment.def', &
form= 'formatted', action = 'read', status = 'old')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ PROGRAM loss_during_day
mult_jobs = .false.
jseg = ntyps
job=1
I = iargc()
I = command_argument_count()

if(I < 1 ) then
print *, "Job Segment is not specified: ", i
Expand All @@ -99,9 +99,9 @@ PROGRAM loss_during_day
end if

if (i>0) then
call getarg(1,arg)
call get_command_argument(1,arg)
if ( trim(arg) == '-js' ) then
call getarg(2,arg)
call get_command_argument(2,arg)
read(arg,'(i2)') job
mult_jobs = .true.
jseg =32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ if ( "$1" == "-noland" ) set SKIPLAND = YES

if ( $HELPMODE != YES ) then

setenv NCPUS `/usr/bin/lscpu | grep '^CPU(s)' | cut -d ':' -f2 | head -1 `
@ NCPUS = $NCPUS / 4
@ NCPUS = $NCPUS * 3
#setenv NCPUS `/usr/bin/lscpu | grep '^CPU(s)' | cut -d ':' -f2 | head -1 `
#@ NCPUS = $NCPUS / 4
#@ NCPUS = $NCPUS * 3
set NCPUS = 20
setenv OMP_NUM_THREADS 1
setenv OMP_NUM_THREADS 1

endif

Expand Down Expand Up @@ -93,29 +93,33 @@ set lbcsv = NL3

if ( $HELPMODE != YES ) then
echo "${CR}"
echo "Boundary Conditions (BCs) Package:"
echo "----------------------------------------------------------------------------------------------"
echo " Boundary Conditions (BCs) Package:"
echo "----------------------------------------------------------------------------------------------"
echo " "
echo "Enter 3-character alphanumeric code for land BCs version:"
echo "(Select only one.)"
echo " "
echo "Enter 3-character alphanumeric code for land BCs version (select only one):"
else
echo "Options for land BCs version:"
endif
echo " ${C2}F25 : Fortuna-2_5"
echo " ${C2}GM4 : Ganymed-4_0 (/discover/nobackup/ltakacs/bcs/Ganymed-4_0/)"
echo " ${C2}ICA : Icarus (/discover/nobackup/ltakacs/bcs/Icarus/)"
echo " ${C2}NL3 : Icarus-NLv3 (/discover/nobackup/ltakacs/bcs/Icarus-NLv3/)"
echo " ${C2}NL4 : NLv4 [SMAP] (/discover/nobackup/projects/gmao/smap/bcs_NLv4/NLv4/)"
echo " ${C2}NL5 : NLv5 [SMAP]"
echo " ${C2}F25 : Fortuna-2_5 (archived${CR}${C1}*${CR}${C2}: n/a)${CR}"
echo " ${C2}GM4 : Ganymed-4_0 (archived${CR}${C1}*${CR}${C2}: /discover/nobackup/ltakacs/bcs/Ganymed-4_0/)${CR}"
echo " ${C2}ICA : Icarus (archived${CR}${C1}*${CR}${C2}: /discover/nobackup/ltakacs/bcs/Icarus/)${CR}"
echo " ${C2}NL3 : Icarus-NLv3 (archived${CR}${C1}*${CR}${C2}: /discover/nobackup/ltakacs/bcs/Icarus-NLv3/)${CR}"
echo " ${C2}NL4 : NLv4 [SMAPL4] (archived${CR}${C1}*${CR}${C2}: /discover/nobackup/projects/gmao/smap/bcs_NLv4/NLv4/)${CR}"
echo " ${C2}NL5 : NLv5 [SMAPL4] (archived${CR}${C1}*${CR}${C2}: /discover/nobackup/projects/gmao/smap/SMAP_L4/L4_SM/bcs/CLSM_params/Icarus-NLv5_EASE/)${CR}"
echo " ${C2}DEV : Development version${CR}"
echo " "
if ( $HELPMODE != YES ) then
echo " NOTE: Due to compiler differences, code improvements and bug fixes that"
echo " have taken place since the above archived BCs were created, some parameter"
echo " files produced by current source code may differ from those in the archived BCs."
echo " Nevertheless, the impact of these differences on science is insignificant and"
echo " the parameter files produced by current source code is considered to be"
echo " scientifically equivalent to the corresponding archived BCs"
echo " "
echo " OR press ENTER to select $lbcsv (current default).${CR}"
echo " "
if ( $HELPMODE != YES ) then
echo " ${C1} *BCs produced by this code will differ from BCs in archived directories\!\!\! ${CR}"
echo " These differences are caused by compiler changes, code improvements and bug"
echo " fixes that were implemented since the archived BCs in the above-mentioned"
echo " directories were originally created. The impact of these differences on"
echo " science is insignificant, and the parameter files produced by current"
echo " code are scientifically equivalent to the corresponding archived BCs."
echo " "
echo " OR press ENTER to select $lbcsv (current default).${CR}"
echo " "
endif

Expand All @@ -133,14 +137,15 @@ if ( $HELPMODE != YES ) then
$dummy == 'NL4' | \
$dummy == 'NL5' | \
$dummy == 'DEV') then
set lbcsv = $dummy
set lbcsv = $dummy
else if ( $dummy == '' ) then
echo $lbcsv
else
echo " "
echo " ${C1} Invalid choice, try again:${CR}"
goto LBCSV
endif

endif

#######################################################################
Expand Down Expand Up @@ -312,17 +317,34 @@ endif
# Experiment directory (for BCS output)

# define default
setenv EXPDIR /discover/nobackup/$USER/BCS_PACKAGE/$lbcsv/
set EXPDIR = /discover/nobackup/$USER/BCS_PACKAGE/$lbcsv

# append minor version string to default bcs output dir name if output from current code differs from archived bcs

if( $lbcsv == 'F25' | \
$lbcsv == 'GM4' | \
$lbcsv == 'ICA' | \
$lbcsv == 'NL3' | \
$lbcsv == 'NL4' | \
$lbcsv == 'NL5') then
set EXPDIR = $EXPDIR'_2/'
echo "----------------------------------------------------------------------------------------------"
echo " "
echo " ${C1} NOTE: $lbcsv BCs produced by this code will differ from BCs in archived directories\!\!\! ${CR}"
echo " ${C1} For clarity, '_[v]' was appended to the default output directory shown below.${CR}"
else
# just append trailing slash
set EXPDIR = $EXPDIR'/'
endif

if ( $HELPMODE != YES ) then

echo " "
echo "Enter desired BCS output directory (incl. full path)"
echo " or press ENTER to use the default:"
echo "Enter desired BCS output directory (incl. full path) or press ENTER to use the default:"
echo " [${C2}${EXPDIR}${CR}]"
set NEWEXPDIR = $<

if( $NEWEXPDIR != '' ) setenv EXPDIR $NEWEXPDIR
if( $NEWEXPDIR != '' ) set EXPDIR = $NEWEXPDIR

mkdir -p $EXPDIR
if ($status>0) then
Expand All @@ -338,7 +360,7 @@ echo ""
echo "${C1} Land BCs version:${CR} ${C2}$lbcsv${CR}"
echo "${C1} Atmospheric resolution:${CR} ${C2}$HRCODES${CR}"
echo "${C1} Ocean resolution:${CR} ${C2}$orslvs${CR}"
echo "${C1} Experiment directory:${CR} ${C2}$EXPDIR${CR}"
echo "${C1} Output directory:${CR} ${C2}$EXPDIR${CR}"

#######################################################################
#######################################################################
Expand Down Expand Up @@ -1290,13 +1312,14 @@ cd ../
limit stacksize unlimited
if ( $EVERSION == EASEv2 ) then
setenv MASKFILE ${MASKFILE}
if(${MGRID} == M09 | ${MGRID} == M36) then
bin/mkLandRaster.x -x ${NX} -y ${NY} -v -t ${NT}
bin/mkSMAPTilesPara_v2.x -smap_grid ${MGRID} -pfaf_til T
bin/CombineRasters.x -f 0 -t 232000000 ${THISGRID} Pfafstetter > /dev/null
bin/CombineRasters.x -t 232000000 ${THISGRID} ${THISGRID}-Pfafstetter
/bin/mv til/${THISGRID}_${THISGRID}-Pfafstetter.til til/${THISGRID}_${THISGRID}-Pfafstetter.ind
endif
## This section was used to make Irrigated Tiles
##if(${MGRID} == M09 | ${MGRID} == M36) then
## bin/mkLandRaster.x -x ${NX} -y ${NY} -v -t ${NT}
## bin/mkSMAPTilesPara_v2.x -smap_grid ${MGRID} -pfaf_til T
## bin/CombineRasters.x -f 0 -t 232000000 ${THISGRID} Pfafstetter > /dev/null
## bin/CombineRasters.x -t 232000000 ${THISGRID} ${THISGRID}-Pfafstetter
## /bin/mv til/${THISGRID}_${THISGRID}-Pfafstetter.til til/${THISGRID}_${THISGRID}-Pfafstetter.ind
##endif
setenv OMP_NUM_THREADS 1
bin/mkSMAPTilesPara_v2.x -smap_grid ${MGRID} -v $lbcsv
setenv OMP_NUM_THREADS ${NCPUS}
Expand Down
Loading