Skip to content

Commit 82b7959

Browse files
committed
Add initial work for global_det atmos prep
Refs: NOAA-EMC#1
1 parent 5c69a13 commit 82b7959

File tree

19 files changed

+2705
-6
lines changed

19 files changed

+2705
-6
lines changed

ecf/global_det/prep/jevs_global_det_prep.ecf

100644100755
+92-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,92 @@
1-
sample
1+
#PBS -N jevs_global_det_prep_00
2+
#PBS -j oe
3+
#PBS -S /bin/sh
4+
#PBS -q dev
5+
#PBS -A VERF-DEV
6+
#PBS -l walltime=10:00:00
7+
#PBS -l select=1:ncpus=1:mem=1GB
8+
#PBS -l debug=true
9+
#PBS -V
10+
11+
set -x
12+
13+
export model=evs
14+
15+
##%include <head.h>
16+
##%include <envir-p1.h>
17+
18+
############################################################
19+
############################################################
20+
############################################################
21+
# In prod, /apps/ops/prod/nco/core/ecflow.v5.6.0.11/include/head.h?
22+
###### ECF_ environment variables set
23+
###### do module reset
24+
module reset
25+
###### set HOMEevs
26+
export HOMEevs=/lfs/h2/emc/vpppg/noscrub/Mallory.Row/verification/global/EVS
27+
###### read version file and set model_ver
28+
versionfile=$HOMEevs/versions/run.ver
29+
. $versionfile
30+
export evs_ver=$evs_ver
31+
##### set more variables
32+
#export envir=dev
33+
#export MACHINE_SITE=
34+
#export RUN_ENVIR=
35+
export SENDECF=
36+
export SENDCOM=
37+
#export PDY=
38+
#export PARATEST=
39+
#export COMPATH=
40+
#export MAILTO=
41+
#export DBNLOG=
42+
export KEEPDATA=YES
43+
export SENDDBN=
44+
export SENDDBN_NTC=
45+
##### load prod_util
46+
module load prod_envir/2.0.6
47+
###### sets: UTILROOT, MDATE, NDATE, NHOUR, FSYNC, COMDATEROOT, COMLISTROOT, COMLOGROOT
48+
###### preprends: PATH, PYTHONPATH
49+
module load prod_util/2.0.13
50+
###### sets:
51+
##### load prod_envir
52+
###### sets: OPSROOT, OPSROOTssd, COMROOT, DATAROOT, DCOOMROOT, PACKAGEROOT
53+
export DATAROOT=/lfs/h2/emc/stmp/Mallory.Row/evs_output/$envir/tmp
54+
module list
55+
###### define error handling
56+
# In prod, /apps/ops/prod/nco/core/ecflow.v5.6.0.11/include/envir-p1.h?
57+
export job=${PBS_JOBNAME:-jevs_global_det_prep}
58+
export jobid=$job.${PBS_JOBID:-$$}
59+
#export SENDCANNEDDBN=
60+
#export eval=
61+
#export SIPHONROOT=
62+
#export NODBNFCHK=
63+
#export DBNROOT=
64+
export envir=dev
65+
############################################################
66+
############################################################
67+
############################################################
68+
69+
############################################################
70+
# Load modules
71+
############################################################
72+
module load PrgEnv-intel/${PrgEnvintel_ver}
73+
module load intel/${intel_ver}
74+
module load libjpeg/${libjpeg_ver}
75+
module load grib_util/${grib_util_ver}
76+
module load wgrib2/${wgrib2_ver}
77+
module load python/${python_ver}
78+
module list
79+
80+
##export cyc=%CYC%
81+
export cyc=00
82+
83+
# CALL executable job script here
84+
$HOMEevs/jobs/global_det/prep/JEVS_GLOBAL_DET_PREP
85+
86+
##%include <tail.h>
87+
##%manual
88+
######################################################################
89+
# Purpose: This does the prep work for the global deterministic
90+
# component
91+
######################################################################
92+
#%end

jobs/global_det/prep/JEVS_GLOBAL_DET_PREP

100644100755
+78-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,78 @@
1-
sample
1+
#!/bin/sh
2+
3+
########################################
4+
# Preliminary data setup step
5+
########################################
6+
set -xa
7+
8+
####################################
9+
# SET SHELL PROCESSING VARIABLES
10+
####################################
11+
export PS4='$SECONDS + '
12+
date
13+
14+
###########################################################
15+
# obtain unique LSF id (jobid) and make temp directories
16+
###########################################################
17+
export pid=$$
18+
export DATA=${DATA:-${DATAROOT:?}/${jobid:?}}
19+
mkdir -p $DATA
20+
cd $DATA
21+
22+
####################################
23+
# Determine Job Output Name on System
24+
####################################
25+
export pgmout="OUTPUT.${pid}"
26+
27+
####################################
28+
# Set EVS directories
29+
####################################
30+
export HOMEevs=${HOMEevs:-${PACKAGEROOT}/evs.${model_ver}}
31+
export EXECevs=${EXECevs:-$HOMEevs/exec}
32+
export FIXvevs=${FIXevs:-$HOMEevs/fix}
33+
export PARMevs=${PARMevs:-$HOMEevs/parm}
34+
export USHevs=${USHevs:-$HOMEevs/ush}
35+
36+
####################################
37+
# Run setpdy and initialize PDY variables
38+
####################################
39+
export cycle=${cycle:-t${cyc}z}
40+
setpdy.sh
41+
. ./PDY
42+
export VDATE=$PDYm1
43+
44+
####################################
45+
# Define NET/RUN variables
46+
####################################
47+
export NET=${NET:-evs}
48+
export RUN=${RUN:-global_det}
49+
export STEP=${STEP:-prep}
50+
51+
####################################
52+
# Define COMIN/COMOUT variables
53+
####################################
54+
##export COMIN=${COMIN:-$(compath.py evs/${evs_ver})}
55+
export COMIN=/lfs/h2/emc/stmp/Mallory.Row/evs_output/$envir/com/$NET/$evs_ver/$STEP/$RUN
56+
#export COMINgfs=${COMN:-$(compath.py gfs/${gfs_ver})}
57+
##export COMOUT=${COMOUT:-$(compath.py -o evs/${evs_ver})}
58+
export COMOUT=/lfs/h2/emc/stmp/Mallory.Row/evs_output/$envir/com/$NET/$evs_ver/$STEP/$RUN
59+
mkdir -p $COMOUT
60+
61+
#######################################################################
62+
# Execute the script
63+
#######################################################################
64+
env
65+
$HOMEevs/scripts/global_det/prep/exevs_global_det_prep.sh
66+
export err=$?; err_chk
67+
68+
cat $pgmout
69+
70+
msg="JOB $job HAS COMPLETED NORMALLY."
71+
postmsg "$jlogfile" "$msg"
72+
73+
if [ "$KEEPDATA" != "YES" ] ; then
74+
cd $DATAROOT
75+
rm -rf $DATA
76+
fi
77+
78+
date

scripts/global_det/prep/exevs_global_det_prep.sh

100644100755
+19-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
sample
1+
#!/bin/sh
2+
###############################################################################
3+
# Name of Script: exevs_global_det_prep.sh
4+
# Purpose of Script: This script does prep for any global deterministic model
5+
# verification
6+
# Log history:
7+
###############################################################################
8+
9+
set -x
10+
11+
echo
12+
13+
############################################################
14+
## Global Deterministic Atmospheric Prep
15+
############################################################
16+
export COMPONENT=atmos
17+
python ${USHevs}/global_det/global_det_atmos_prep_prod_archive.py
18+
#if [ $SENDCOM = YES ]; then
19+
#fi

sorc/addpcp.fd/addpcp.f

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
program addpcp
2+
!
3+
! BASED ON DIFFPCP FROM VERF_PRECIP AND MODIFIED TO ADD
4+
!
5+
!$$$ MAIN PROGRAM DOCUMENTATION BLOCK
6+
! . . . .
7+
! MAIN PROGRAM: ADDPCP
8+
!
9+
! Programmer: Mallory Row
10+
!
11+
! ABSTRACT: program to read in two bucketed precip files, then adds the
12+
! togethers to create a continous bucket precipitation
13+
!
14+
! nam_2007060712_000_012 ! Input #1
15+
! nam_2007060712_012_024 ! Input #2
16+
! nam_2007060712_000_030 ! output file
17+
!
18+
! ATTRIBUTES:
19+
! LANGUAGE: Intel FORTRAN 90
20+
!
21+
!$$$
22+
integer jpds(200),jgds(200),kpds1(200),kpds2(200),kgds(200)
23+
integer kpdso(200),kgdso(200)
24+
parameter(ji=5000*2000)
25+
logical*1 bitdiff(ji),bit1(ji),bit2(ji)
26+
real add(ji),pcp1(ji), pcp2(ji)
27+
character*200 infile1,infile2,prefx,outfile
28+
character*18 datstr
29+
character*3 timeflag
30+
character*2 orflag
31+
INTEGER IDAT(8),JDAT(8)
32+
REAL RINC(5)
33+
34+
! Read agrument
35+
nargs = iargc() ! iargc() - number of arguments
36+
if (nargs.lt.3) then
37+
write(*,*)'usage : addpcp infile1 infile2 outfile'
38+
stop
39+
endif
40+
41+
call getarg(1,infile1)
42+
call getarg(2,infile2)
43+
call getarg(3,outfile)
44+
45+
46+
!
47+
! Get precip. ETA and most others have pds(5)=61, but AVN and MRF
48+
! have pds(5)=59 (precip rates), and in those cases we should
49+
! add up the files and then divde the result by the number of files
50+
! that contributed to the sum (i.e. calculate the average precip rate
51+
! during the entire period
52+
!
53+
54+
jpds=-1
55+
jgds=-1
56+
call baopenr(11,infile1,ierr)
57+
if (ierr .ne. 0) write(6,*)" failed to open ", infile1
58+
call getgb(11,0,ji,0,jpds,jgds,kf1,kr,kpds1,kgds,bit1,pcp1,iret1)
59+
write(6,*) 'getgb ', infile1, 'kf1= ',kf1, ' iret=', iret1
60+
call baopenr(12,infile2,ierr)
61+
call getgb(12,0,ji,0,jpds,jgds,kf2,kr,kpds2,kgds,bit2,pcp2,iret2)
62+
write(6,*) 'getgb ', infile2, 'kf2= ',kf2, ' iret=', iret2
63+
64+
!
65+
! Calculate the difference (subtract file1 from file2):
66+
!
67+
if (iret1.ne.0 .or. iret2.ne.0) &
68+
STOP 'iret1 and/or iret2 not zero!'
69+
70+
!
71+
! Check to see if the two files have the same length:
72+
if (kf1.ne.kf2) &
73+
STOP 'File lengths (kf1,kf2) differ! STOP.'
74+
75+
!
76+
! Check to see if the two time stamps are identical:
77+
if (kpds1(21).ne.kpds2(21) .or. kpds1( 8).ne.kpds2( 8) .or. &
78+
kpds1( 9).ne.kpds2( 9) .or. kpds1(10).ne.kpds2(10) .or. &
79+
kpds1(11).ne.kpds2(11) .or. kpds1(12).ne.kpds2(12) .or. &
80+
kpds1(13).ne.kpds2(13)) then
81+
write(6,30) &
82+
(kpds1(21)*100+kpds1(8))/100-1, mod(kpds1(8),100), &
83+
kpds1(9),kpds1(10),kpds1(11),kpds1(12),kpds1(13), &
84+
(kpds2(21)*100+kpds2(8))/100-1, mod(kpds2(8),100), &
85+
kpds2(9),kpds2(10),kpds2(11),kpds2(12),kpds2(13)
86+
30 format('Time stamps differ! Date1=',7i2.2,' Date2=',7i2.2, ' STOP')
87+
stop
88+
endif
89+
90+
write(6,*) 'Infile1 Time range 1 : kpds1(14)=', kpds1(14)
91+
write(6,*) 'Infile1 Time range 2 : kpds1(15)=', kpds1(15)
92+
write(6,*) 'Infile2 Time range 1 : kpds2(14)=', kpds2(14)
93+
write(6,*) 'Infile2 Time range 2 : kpds2(15)=', kpds2(15)
94+
95+
! Check that infile1 'time range 1' is 0
96+
if (kpds1(14).ne.0) then
97+
write(6,*) 'Infile1 Time range 1 not 0: kpds1(14)=', kpds1(14), &
98+
' STOP'
99+
stop
100+
endif
101+
102+
! Check that infile1 'time range 1' is equal to infile2 'time range 2'
103+
if (kpds1(15).ne.kpds2(14)) then
104+
write(6,*) 'Infile1 Time range 2 differ: kpds1(15)=', kpds1(15), &
105+
' Infile2 Time range 1 kpds2(14)=', kpds2(14),' STOP'
106+
stop
107+
endif
108+
109+
! Check 'time range 2' to make sure that kpds2(15) > kpds1(15):
110+
111+
if (kpds1(15).ge.kpds2(15)) then
112+
write(6,*) 'Time range 2 problem: kpds1(15)=', kpds1(15), &
113+
' kpds2(15)=', kpds2(15),' STOP'
114+
stop
115+
endif
116+
117+
kpdso=kpds1
118+
kgdso=kgds
119+
!
120+
kpdso(15) = kpds2(15)
121+
122+
do 40 N=1,kf1
123+
bitdiff(N)=bit2(N).and.bit1(N)
124+
if (bitdiff(N)) then
125+
add(N)=pcp2(N)+pcp1(N)
126+
write(54,54) n, add(n), pcp2(n), pcp1(n)
127+
54 format(i8,2x,3(3x,f8.3))
128+
else
129+
add(N)=0.
130+
endif
131+
40 continue
132+
!
133+
999 continue
134+
!
135+
! set unit decimal scale factor
136+
kpdso(22) = 1
137+
138+
! set output time stamp
139+
WRITE(DATSTR,50) (KPDSO(21)-1)*100+KPDSO(8),KPDSO(9), &
140+
KPDSO(10),KPDSO(11),KPDSO(14),KPDSO(15)
141+
50 FORMAT(I4.4,3I2.2,'_',I3.3,'_',I3.3)
142+
OUTFILE = outfile
143+
CALL BAOPEN(51,OUTFILE,ierr)
144+
call putgb(51,kf1,kpdso,kgdso,bitdiff,add,iret)
145+
if (iret.eq.0) then
146+
write(6,*) 'PUTGB successful, iret=', iret, 'for ', outfile
147+
else
148+
write(6,*) 'PUTGB failed! iret=', iret, 'for ', outfile
149+
endif
150+
CALL BACLOSE(51,ierr)
151+
CALL W3TAGE('ADDPCP ')
152+
!
153+
stop
154+
155+
end

sorc/addpcp.fd/makefile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
SHELL= /bin/sh
2+
3+
LIBS= ${W3NCO_LIB4} ${W3EMC_LIB4} ${BACIO_LIB4}
4+
FC= ifort
5+
FFLAGS= -FR -cpp
6+
7+
LDFLAGS=
8+
SRCS= addpcp.f
9+
CMD= addpcp
10+
11+
all: $(CMD)
12+
13+
$(CMD): $(SRCS)
14+
$(FC) $(FFLAGS) $(SRCS) $(LIBS) -o $(CMD)
15+
16+
clean:
17+
-rm -f *.o *.lst $(CMD)
18+
install:
19+
-mv $(CMD) ../../exec/.
20+
21+

0 commit comments

Comments
 (0)