source: TOOLS/PACK_IPSL/diff.bash @ 1854

Last change on this file since 1854 was 1849, checked in by acosce, 12 years ago

Add parallel version - global double check - minor bug

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