Changeset 4727 for LMDZ6/branches/LMDZ_ECRad/tools
- Timestamp:
- Oct 19, 2023, 4:02:57 PM (14 months ago)
- Location:
- LMDZ6/branches/LMDZ_ECRad
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/LMDZ_ECRad
- Property svn:mergeinfo changed
-
LMDZ6/branches/LMDZ_ECRad/tools/compare_real.py
r2412 r4727 1 #!/usr/bin/env python3 2 1 3 """This script should be called by "diffdef.sh". It operates on 2 different lines with common variables. It requires version 2.7 or 3 higher of Python (it also works with Python 3). 4 different lines with common variables. 4 5 5 6 Author: Lionel GUEZ""" -
LMDZ6/branches/LMDZ_ECRad/tools/diffdef.sh
r2426 r4727 2 2 # Author: Lionel GUEZ 3 3 4 # This script compares files "*.def" other than " *traceur.def" and5 # " out.def" in two directories.4 # This script compares files "*.def" other than "traceur.def", 5 # "tracer.def", "isotopes_params.def" and "out.def" in two directories. 6 6 7 7 # This script uses GNU versions of the utilities cut, sort and uniq, … … 9 9 10 10 # See guide: 11 # http://lmdz.lmd.jussieu.fr/utilisateurs/ outils/utilisation-de-lmdz#section-511 # http://lmdz.lmd.jussieu.fr/utilisateurs/utilisation-de-lmdz#section-5 12 12 13 13 USAGE="usage: `basename $0` directory_1 directory_2" 14 14 15 15 if (($# != 2)) 16 16 then 17 17 echo "$USAGE" >&2 18 18 exit 1 … … 20 20 21 21 ##set -x 22 23 type python3 >/dev/null 2>&124 if (($? == 0))25 then26 my_python=python327 else28 my_python=python29 fi30 31 22 set -e 32 23 … … 40 31 41 32 for my_directory in $* 42 43 cd $my_directory44 rm -f all.def45 echo "def files in $my_directory:"46 ls !(*traceur|out).def33 do 34 cd $my_directory 35 rm -f all.def 36 echo "def files in $my_directory:" 37 ls !(traceur|tracer|out|isotopes_params).def 47 38 48 # Concatenate and format the def files:49 cat !(*traceur|out).def | tr '\r' '\n' | tr -d "" \50 51 52 39 # Concatenate and format the def files: 40 cat !(traceur|tracer|out|isotopes_params).def | tr -d " \t" \ 41 | grep -v -E '(^#|^!|INCLUDEDEF|^$)' \ 42 | tr '[:lower:]' '[:upper:]' | sed 's/=[NF]$/=FALSE/' \ 43 | sed 's/=[YT]$/=TRUE/' | sort >all.def 53 44 54 # Check that no variable is repeated: 55 cut --fields=1 --delimiter="=" all.def | uniq --repeated >plouf_$$ 56 if [[ -s plouf_$$ ]] 57 then 58 echo 59 echo "Error: a variable is repeated in directory \"$my_directory\"." 60 echo 61 echo "Here is the list of repeated variables in directory \"$my_directory\":" 62 echo 63 cat plouf_$$ 64 rm plouf_$$ 65 rm all.def 66 exit 1 67 fi 68 rm plouf_$$ 69 70 cd - >/dev/null 45 # Check that no variable is repeated: 46 47 cut --fields=1 --delimiter="=" all.def | uniq --repeated >plouf_$$ 48 49 if [[ -s plouf_$$ ]] 50 then 51 echo 52 echo "Error: a variable is repeated in directory \"$my_directory\"." 53 echo 54 echo "Here is the list of repeated variables in directory " \ 55 "\"$my_directory\":" 56 echo 57 cat plouf_$$ 58 rm plouf_$$ 59 rm all.def 60 exit 1 61 fi 62 63 rm plouf_$$ 64 cd - >/dev/null 71 65 done 72 73 66 74 67 sort $1/all.def $2/all.def | uniq --repeated >common_lines 75 68 76 69 for my_directory in $* 77 78 sort $my_directory/all.def common_lines | uniq --unique \79 70 do 71 sort $my_directory/all.def common_lines | uniq --unique \ 72 >$my_directory/uniq_lines 80 73 done 81 74 … … 86 79 87 80 for my_directory in $* 88 89 cd $my_directory90 echo "Created file \"$my_directory/uniq_var\"."91 sort uniq_lines uniq_var | uniq --unique >common_var92 rm uniq_lines93 cd - >/dev/null81 do 82 cd $my_directory 83 echo "Created file \"$my_directory/uniq_var\"." 84 sort uniq_lines uniq_var | uniq --unique >common_var 85 rm uniq_lines 86 cd - >/dev/null 94 87 done 95 88 96 $ my_python $script_dir/compare_real.py $*89 $script_dir/compare_real.py $* 97 90 sort common_lines --output=common_lines # was modified by the Python script 98 91 echo "Created files \"./common_lines\" and \"./uniq_val\"." … … 100 93 # Clean up: 101 94 for my_directory in $* 102 95 do 103 96 rm $my_directory/common_var $my_directory/all.def 104 97 done
Note: See TracChangeset
for help on using the changeset viewer.