Skip to content

Commit

Permalink
Domain properties authomatic retrieval + try/except plotting correcti…
Browse files Browse the repository at this point in the history
…on (#39)

Co-authored-by: Alina Lerner <eela@ac6-100.bullx>
  • Loading branch information
alinalerner and Alina Lerner authored Mar 14, 2024
1 parent 1b73028 commit 2241a65
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 48 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ dfscomp -p CCMA_2022050112.dat -u CCMA_2022050112_unpert.dat -o dfs2022050112.da

### DIACOV
First, you should have Festat output and the DIACOV binary compiled by Harmonie stored somewhere.
Then, create the new directory, copy the DIACOV binary and Jb files there. Example:
Then, create the new directory, Jb files there. Example:
```
mkdir DiacovTest
cd DiacovTest
cp /path/to/DIACOV .
mkdir dataTest
cp /path/to/Jb/data dataTest/.
```
Expand All @@ -115,7 +114,7 @@ rundiacov -h

Example:
```
rundiacov -i dataTest -c METCOOP25D_65_2021100300-2021111006_412 -l 65 -g 2.5 -m 539 -n 1080 -d DIACOV
rundiacov -i dataTest -c METCOOP25D_65_2021100300-2021111006_412 -g 2.5 -d /path/to/DIACOV
```

#### Produce diagonal stats
Expand Down
12 changes: 10 additions & 2 deletions scripts/plotdiacov.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ def main(argv) :
args = parser.parse_args()

if args.idata != False and args.indir == False:
plotme(args.idata,args.oplot)
try:
plotme(args.idata,args.oplot)
except:
pass

elif args.indir != False and args.idata == False:
datlist=glob.glob(args.indir+'/*.dat')
for infile in datlist:
output=infile.replace('.dat','.png')
print (' ... plotting '+output)
plotme(infile,output)
try:
plotme(infile,output)
except:
print('Cannot produce the plot '+output+'!')
pass
else:
print ('Cannot do both!')
sys.exit(1)
Expand Down
48 changes: 5 additions & 43 deletions scripts/rundiacov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ ${bold}NAME${normal}
${bold}USAGE${normal}
${PROGNAME} -i <data-dir>
-c <jb-file-name>
-l <level-nr>
-g <grid-spacing>
-m <nsmax>
-n <ndgl>
-d <diacov-binary>
[ -h ]
Expand All @@ -34,18 +31,9 @@ ${bold}OPTIONS${normal}
-c ${unline}jb-file-name${normal}
Name of *.cv and *.cvt files (without extension)
-l ${unline}level-nr${normal}
Number of domain's vertical levels
-g ${unline}grid-spacing${normal}
Grid-spacing in kilometers
-m ${unline}nsmax${normal}
NSMAX parameter specified in domain properties
-n ${unline}ndgl${normal}
NDGL parameter specified in domain properties
-d ${unline}diacov-binary${normal}
PATH to DIACOV binary.
Expand All @@ -56,10 +44,7 @@ USAGE

DATADIR=DUMMY
JBFILE=DUMMY
LEVELNUM=DUMMY
GRIDSIZE=DUMMY
NSMAX=DUMMY
NDGL=DUMMY
BINPATH=DUMMY

#wrkdir=/home/eela/EoinDiacovTest/ #need to be changed to be more flexible
Expand All @@ -74,7 +59,7 @@ if [ ${#} -eq 0 ]; then
exit 1
fi

while getopts i:c:l:g:m:n:d:h option
while getopts i:c:g:d:h option
do
case $option in
i)
Expand All @@ -83,18 +68,9 @@ do
c)
JBFILE=$OPTARG
;;
l)
LEVELNUM=$OPTARG
;;
g)
GRIDSIZE=$OPTARG
;;
m)
NSMAX=$OPTARG
;;
n)
NDGL=$OPTARG
;;
d)
BINPATH=$OPTARG
;;
Expand All @@ -121,30 +97,12 @@ if [ ${JBFILE} == "DUMMY" ]; then
exit 1
fi

if [ ${LEVELNUM} == "DUMMY" ]; then
echo "Please define number of vertical levels using -l"
echo "Try '${PROGNAME} -h' for more information"
exit 1
fi

if [ ${GRIDSIZE} == "DUMMY" ]; then
echo "Please define grid-size using -g"
echo "Try '${PROGNAME} -h' for more information"
exit 1
fi

if [ ${NSMAX} == "DUMMY" ]; then
echo "Please define NSMAX using -m"
echo "Try '${PROGNAME} -h' for more information"
exit 1
fi

if [ ${NDGL} == "DUMMY" ]; then
echo "Please define NDGL using -n"
echo "Try '${PROGNAME} -h' for more information"
exit 1
fi

if [ ${BINPATH} == "DUMMY" ]; then
echo "Please define path to DIACOV using -d"
echo "Try '${PROGNAME} -h' for more information"
Expand All @@ -153,6 +111,10 @@ fi

cd $tmpdir

LEVELNUM=$(cv_header_list -i ../${DATADIR}/${JBFILE}.cv | grep "NFLEVG" | awk '{print $3}')
NSMAX=$(cv_header_list -i ../${DATADIR}/${JBFILE}.cv | grep "NSMAX" | awk '{print $3}')
NDGL=$(cv_header_list -i ../${DATADIR}/${JBFILE}.cv | grep "NDGL" | awk '{print $3}')

# prepare namelist for diacov - full variables
cat > nam_diag1 <<EOF
&NAMDIACOV
Expand Down

0 comments on commit 2241a65

Please sign in to comment.