Skip to content

Commit

Permalink
Merge pull request #31 from GEOS-ESM/feature/GEOSadas-5_25_2.updates
Browse files Browse the repository at this point in the history
Updates from CVS GEOSadas-5_25_2 tag
  • Loading branch information
gmao-jstassi authored Aug 28, 2019
2 parents 4b1ec76 + 63128a3 commit 038215c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion GMAO_etc/PUBLICTAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GEOS-5.25.0
GEOS-5.25.2
40 changes: 37 additions & 3 deletions GMAO_etc/cmpdir.pl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# global variables
#-----------------
my ($bindiff, $bwiFLG, $debug, $delim, $diffFLGs, $dir1, $dir2);
my ($bindiff, $bwiFLG, $debug, $cdoX, $delim, $diffFLGs, $dir1, $dir2);
my ($dirA, $dirB, $dirL1, $dirL2, $dmgetX, $filemode, $first, $follow);
my ($ignoreFLG, $ignoreFile, $list, $listx, $quiet, $recurse, $sortFLG);
my ($subdir, $tmpdir, $verbose);
Expand Down Expand Up @@ -148,10 +148,12 @@ sub init {
#-----------------------------------
if (-x "/home/jstassi/bin/cdo") {
$bindiff = "/home/jstassi/bin/cdo diffn";
$cdoX = "/home/jstassi/bin/cdo";
}
else {
chomp($bindiff = `which h5diff`);
$bindiff = "" unless -x $bindiff;
$cdoX = 0;
}

# look for dmget command
Expand Down Expand Up @@ -332,7 +334,12 @@ sub cmp_files {
$filesize{$file1} = -s abs_path($file1);
$filesize{$file2} = -s abs_path($file2);

$status = system_("diff $diffFLGs $file1 $file2 >& /dev/null");
if ($cdoX and ($file1 =~ /\.hdf/ or $file2 =~ /\.nc4/)) {
$status = cdo_diff($file1, $file2);
}
else {
$status = system_("diff $diffFLGs $file1 $file2 >& /dev/null");
}
unless ($status) {
$identical{$file1} = $file2;
next;
Expand All @@ -356,6 +363,33 @@ sub cmp_files {
@unmatched2 = sort @unmatched2;
}

#=======================================================================
# name - cdo_diff
# purpose - use cdo utility to test equivalence of two files
#
# input parameters
# => file1: first file to compare
# => file2: second file to compare
#
# notes
# 1. check for line from cdo telling how many records differ
# 2. if cdo reports that zero records differ, then files are assumed equivalent
# 3. otherwise, this sub will report that the files differ
#=======================================================================
sub cdo_diff {
my ($file1, $file2) = @_;
my ($diffFLG, $line);

$diffFLG = 1;
foreach $line (`$cdoX -s diffn $file1 $file2`) {
if ($line =~ m/0(\s+)of(\s+)(\d+) records differ/) {
$diffFLG = 0;
last;
}
}
return $diffFLG;
}

#=======================================================================
# name - get_filelist
# purpose - get a list of files from a directory
Expand Down Expand Up @@ -654,7 +688,7 @@ sub show_binary_diffs {
unless ( $diffs{$dflt} ) { $dflt = 0; last }
last if $diffs{$dflt} =~ /\.tar$/;

if ($bindiff =~ m/cdo/) {
if ($cdoX) {
last if $diffs{$dflt} =~ /\.hdf$/
or $diffs{$dflt} =~ /\.nc4$/
or $diffs{$dflt} =~ /\.ods$/;
Expand Down
4 changes: 3 additions & 1 deletion GMAO_etc/g5_modules_perl_wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ sub g5_mpw_get_expected_values {
chomp( @usemods = (`$g5_modules usemodules`) );
chomp( $modinit = `$g5_modules modinit` );

@usemods = () if scalar(@usemods) == 1 and $usemods[0] eq "0";

# convert modinit script to perl
#-------------------------------
@fields = split "/", $modinit;
Expand Down Expand Up @@ -136,7 +138,7 @@ sub g5_mpw_set_env_variables {
module ("purge");

if ($loadmodules) { module ("load modules") };
if (@usemods) foreach ( @usemods ) { module ("use -a $_") };
if (@usemods) { foreach ( @usemods ) { module ("use -a $_") } }
foreach ( @libmods ) { module ("load $_") };
print " for $node\n";
}
Expand Down

0 comments on commit 038215c

Please sign in to comment.