diff --git a/CMakeLists.txt b/CMakeLists.txt index bcba19b..4f91fda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") # add_executable(jbdiagnose.x src/jbdiagnose.F90) +add_executable(cv_header_list.x src/cv_header_list.F90) add_executable(dfscomp.x src/dfscomp.F90) add_executable(prepdiacov.x src/prepdiacov.F90) @@ -32,6 +33,10 @@ install (TARGETS jbdiagnose.x PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ DESTINATION libexec) +install (TARGETS cv_header_list.x + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ + DESTINATION libexec) + install (TARGETS dfscomp.x PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ DESTINATION libexec) diff --git a/README.md b/README.md index fdf5078..b645cc2 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ rundiacov -h Example: ``` -rundiacov -i dataTest -c METCOOP25D_65_2021100300-2021111006_412.cv -t METCOOP25D_65_2021100300-2021111006_412.cvt -l 65 -g 2.5 -m 539 -n 1080 -d DIACOV +rundiacov -i dataTest -c METCOOP25D_65_2021100300-2021111006_412 -l 65 -g 2.5 -m 539 -n 1080 -d DIACOV ``` #### Produce diagonal stats diff --git a/doc/src/cvheaderlist.md b/doc/src/cvheaderlist.md new file mode 100644 index 0000000..0ddd899 --- /dev/null +++ b/doc/src/cvheaderlist.md @@ -0,0 +1,49 @@ +# cv headaer list + +A simple tool that reads a binary _cv_ file and lists relevant header data. + +## Usage +```shell +user@localhost:~$ cv_header_list -h + +NAME + cv_header_list - list cv header + +USAGE + cv_header_list -i + [ -h ] + +DESCRIPTION + Script to start new LBC processing suite + +OPTIONS + + -i cv-file + cv file + + -h Help! Print usage information. + +user@localhost:~$ + +``` + +## Example +```shell +user@localhost:~$ cv_header_list -i /home/ewhelan/stab_40h1_IRELAND25_064_480.cv + + JPDAYS :: 480 + SW(lon-lat) :: -19.520623099467286 42.575525141583732 + NE(lon-lat) :: 4.3664253929474990 63.303769438767112 + REF(lon-lat) :: 5.0000001489527870 53.500001593794821 + NDGL :: 800 + NDLON :: 800 + NDGUX :: 789 + NDLUX :: 789 + NSMAX :: 399 + NMSMAX :: 399 + NFLEVG :: 65 + +user@localhost:~$ +``` + + diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index cfab18d..6752a66 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -9,6 +9,7 @@ function (install_scripts) endfunction() install_scripts (jbdiagnose.sh plotjbbal.py plotjbdiag.py) +install_scripts (cv_header_list.sh) install_scripts (varbcdiagnose.sh plotvarbcpred.py) install_scripts (rundiacov.sh diag_diacov.sh plotdiacov.py) install_scripts (dfscomp.sh plotdfs.py) diff --git a/scripts/cv_header_list.sh b/scripts/cv_header_list.sh new file mode 100755 index 0000000..cf76fa3 --- /dev/null +++ b/scripts/cv_header_list.sh @@ -0,0 +1,90 @@ +#!/usr/bin/env bash + +# This script will write stats from Jb files in ASCII +# suitable for plotting ... + +bold=$(tput bold) +normal=$(tput sgr0) +unline=$(tput smul) + +PROGNAME=`basename $0` + +# Define a usage function +usage() { + +cat << USAGE + +${bold}NAME${normal} + ${PROGNAME} - list cv header + +${bold}USAGE${normal} + ${PROGNAME} -i + [ -h ] + +${bold}DESCRIPTION${normal} + Script to start new LBC processing suite + +${bold}OPTIONS${normal} + + -i ${unline}cv-file${normal} + cv file + + -h Help! Print usage information. + +USAGE +} + +CVFILE=DUMMY +# +# Where am I? +# +this_script_loc="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +appdir=$(dirname ${this_script_loc}) +bindir=${appdir}/bin +libdir=${appdir}/lib +exedir=${appdir}/libexec +levdir=${appdir}/share/levdef + +if [ ${#} -eq 0 ]; then + echo "No command line arguments provided" + echo "Try '${PROGNAME} -h' for more information" + exit 1 +fi + +while getopts i:h option +do + case $option in + i) + CVFILE=$OPTARG + ;; + h) + usage + exit 0 + ;; + *) + echo + echo "Try '${PROGNAME} -h' for more information" + ;; + esac +done + +if [ ${CVFILE} == "DUMMY" ]; then + echo "Please define cv-file using -i" + echo "Try '${PROGNAME} -h' for more information" + exit 1 +fi + +if [ ! -s ${CVFILE} ]; then + echo "cv-file, ${CVFILE}, not found" + echo "Try '${PROGNAME} -h' for more information" + exit 1 +fi + +# +# Create soft links for cv_header_list.x +# +ln -sf ${CVFILE} stabal96.cv + +${exedir}/cv_header_list.x + +exit 0 diff --git a/scripts/plotdiacov.py b/scripts/plotdiacov.py index c6de2b2..2a40c7f 100644 --- a/scripts/plotdiacov.py +++ b/scripts/plotdiacov.py @@ -6,6 +6,7 @@ import sys import glob import matplotlib as mpl +from matplotlib.colors import TwoSlopeNorm mpl.use('Agg') # Authors Magnus Lindskog and Ulf Andrae, Dec 2021 @@ -32,8 +33,8 @@ def plotme(idata, oplot) : cc=plt.contour(xx,colors='black') plt.clabel(cc, inline=True, fontsize=12) - - plt.contourf(xx, cmap='RdBu_r', alpha=0.5) + limit=np.max(np.abs(xx)) + plt.contourf(xx, cmap='RdBu_r', alpha=0.5, norm=TwoSlopeNorm(vmin=-limit, vcenter=0, vmax=limit)) plt.colorbar(orientation='vertical'); if dim1==dim2: @@ -51,7 +52,7 @@ def plotme(idata, oplot) : def main(argv) : parser = argparse.ArgumentParser(description='Plotting DIACOV diagnostics') - parser.add_argument('-d',dest="indir",help='Plot all input data files in this directory',default=False,required=False) + parser.add_argument('-d',dest="indir",help='Plot all the input data files in this directory',default=False,required=False) parser.add_argument('-i',dest="idata",help='Input data files',default=False,required=False) parser.add_argument('-o',dest="oplot",help='Output plot file names',default='output.png',required=False) diff --git a/scripts/rundiacov.sh b/scripts/rundiacov.sh index 63df9e6..763d273 100755 --- a/scripts/rundiacov.sh +++ b/scripts/rundiacov.sh @@ -16,8 +16,7 @@ ${bold}NAME${normal} ${bold}USAGE${normal} ${PROGNAME} -i - -c - -t + -c -l -g -m @@ -32,11 +31,8 @@ ${bold}OPTIONS${normal} -i ${unline}data-dir${normal} Input data directory (full path) - -c ${unline}cv-file${normal} - .cv file - - -t ${unline}cvt-file${normal} - .cvt file + -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 @@ -51,7 +47,7 @@ ${bold}OPTIONS${normal} NDGL parameter specified in domain properties -d ${unline}diacov-binary${normal} - PATH to DIACOV executable compiled by makeup/GMKPACK. + PATH to DIACOV binary. -h Help! Print usage information. @@ -59,8 +55,7 @@ USAGE } DATADIR=DUMMY -CVFILE=DUMMY -CVTFILE=DUMMY +JBFILE=DUMMY LEVELNUM=DUMMY GRIDSIZE=DUMMY NSMAX=DUMMY @@ -79,17 +74,14 @@ if [ ${#} -eq 0 ]; then exit 1 fi -while getopts i:c:t:l:g:m:n:d:h option +while getopts i:c:l:g:m:n:d:h option do case $option in i) DATADIR=$OPTARG ;; c) - CVFILE=$OPTARG - ;; - t) - CVTFILE=$OPTARG + JBFILE=$OPTARG ;; l) LEVELNUM=$OPTARG @@ -123,14 +115,8 @@ if [ ${DATADIR} == "DUMMY" ]; then exit 1 fi -if [ ${CVFILE} == "DUMMY" ]; then - echo "Please define cv-file using -c" - echo "Try '${PROGNAME} -h' for more information" - exit 1 -fi - -if [ ${CVTFILE} == "DUMMY" ]; then - echo "Please define cvt-file using -t" +if [ ${JBFILE} == "DUMMY" ]; then + echo "Please define jb-file-name using -c" echo "Try '${PROGNAME} -h' for more information" exit 1 fi @@ -190,14 +176,14 @@ cat > nam_diag2 <