Last change
on this file since 3565 was
1911,
checked in by aclsce, 12 years ago
|
- Modified to not create tmp files in current directory
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | #============================================== |
---|
3 | # |
---|
4 | # Usage: |
---|
5 | # ./diff.bash f1.nc f1.nc |
---|
6 | # ./diff.bash f1.nc f1_witherror.nc |
---|
7 | # |
---|
8 | # ./diff.bash fileA.nc fileB.nc 'var1,var2' |
---|
9 | # |
---|
10 | # ex: ./diff.bash file_ncrcat.nc file_cdocat.nc 'contfracATM' |
---|
11 | # |
---|
12 | #============================================== |
---|
13 | |
---|
14 | if [ $# -eq 3 ] ; then |
---|
15 | delname="-delname,$3" |
---|
16 | fi |
---|
17 | |
---|
18 | cdo -s $delname $1 ${JOB_DIR}/out_tmp1.nc |
---|
19 | cdo -s $delname $2 ${JOB_DIR}/out_tmp2.nc |
---|
20 | |
---|
21 | cdo -s diff ${JOB_DIR}/out_tmp1.nc ${JOB_DIR}/out_tmp2.nc > ${JOB_DIR}/diff_$$.tmp 2>&1 |
---|
22 | result2=`cat ${JOB_DIR}/diff_$$.tmp | grep -i "records differ" | tr -s " " | cut -f2 -d" "` |
---|
23 | |
---|
24 | if [ "$result2" = "0" ] ; then |
---|
25 | # EXIT_SUCCESS |
---|
26 | echo "Variables from netcdf files : " |
---|
27 | echo "$1" |
---|
28 | echo "$2" |
---|
29 | echo "are the same" |
---|
30 | rm -f ${JOB_DIR}/diff_$$.tmp ${JOB_DIR}/out_tmp1.nc ${JOB_DIR}/out_tmp2.nc |
---|
31 | exit 0 |
---|
32 | else |
---|
33 | # EXIT_FAILURE |
---|
34 | echo "Variables from netcdf files : " |
---|
35 | echo "$1" |
---|
36 | echo "$2" |
---|
37 | echo "differ" |
---|
38 | cat ${JOB_DIR}/diff_$$.tmp | grep -i "records differ" |
---|
39 | rm -f ${JOB_DIR}/diff_$$.tmp ${JOB_DIR}/out_tmp1.nc ${JOB_DIR}/out_tmp2.nc |
---|
40 | echo "==============> ERROR" |
---|
41 | exit 1 |
---|
42 | fi |
---|
43 | |
---|
Note: See
TracBrowser
for help on using the repository browser.