[nco] 01/05: Imported Upstream version 4.5.1

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Jul 14 07:16:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository nco.

commit bf8136181fc51959717646ee65da9ea2cfef8f87
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Tue Jul 14 08:55:52 2015 +0200

    Imported Upstream version 4.5.1
---
 .travis.yml              |    8 +-
 Makefile.in              |   59 ++-
 aclocal.m4               |   71 +--
 bld/Makefile             |    8 +-
 bld/nco.spec             |   14 +-
 bld/nco_dst.pl           |   26 +-
 bm/NCO_bm.pm             |  115 +++--
 bm/NCO_rgr.pm            |  347 ++++++++++-----
 bm/nco_bm.pl             |  268 +++++------
 configure                |   78 ++--
 configure.ac             |   47 +-
 configure.eg             |   13 +-
 data/Makefile.in         |   24 +-
 data/in.cdl              |    2 +-
 data/in_grp_3.cdl        |    6 +-
 data/ncap2.in            |    5 +-
 debian/changelog         |   12 +
 doc/ANNOUNCE             |  121 ++---
 doc/ChangeLog            |  190 ++++++++
 doc/MANIFEST             |    1 +
 doc/Makefile.in          |   28 +-
 doc/TODO                 |    4 +-
 doc/VERSION              |    2 +-
 doc/debian.txt           |  166 ++++---
 doc/index.shtml          |  105 +++--
 doc/nco.texi             |  162 ++++---
 man/Makefile.in          |   24 +-
 man/ncatted.1            |   12 +-
 man/ncks.1               |    2 +-
 src/Makefile.in          |   24 +-
 src/nco++/Makefile.in    |   25 +-
 src/nco++/Makefile.old   |   11 +-
 src/nco++/fmc_all_cls.cc |   17 +-
 src/nco++/fmc_all_cls.hh |    2 +-
 src/nco++/ncap2.cc       |   79 ++--
 src/nco++/ncap2_utl.cc   |  864 +++++++++++++++--------------------
 src/nco++/prs_cls.cc     |   36 +-
 src/nco/Makefile.in      |   30 +-
 src/nco/ncatted.c        |   20 +-
 src/nco/ncecat.c         |    2 -
 src/nco/ncks.c           |   21 +-
 src/nco/nco.h            |   12 +-
 src/nco/nco_att_utl.c    |  347 ++++++++++++++-
 src/nco/nco_att_utl.h    |   40 +-
 src/nco/nco_cnk.c        |    1 +
 src/nco/nco_cnv_csm.c    |   58 ++-
 src/nco/nco_ctl.c        |   37 +-
 src/nco/nco_ctl.h        |    3 +
 src/nco/nco_grp_trv.c    |    4 +-
 src/nco/nco_grp_utl.c    |  686 ++++++----------------------
 src/nco/nco_grp_utl.h    |   40 --
 src/nco/nco_msa.c        |  135 +++---
 src/nco/nco_mss_val.c    |    7 +-
 src/nco/nco_netcdf.c     |    8 +-
 src/nco/nco_netcdf.h     |    4 +-
 src/nco/nco_omp.c        |   32 +-
 src/nco/nco_ppc.c        |    3 +-
 src/nco/nco_prn.c        |    6 -
 src/nco/nco_rgr.c        | 1111 ++++++++++++++++------------------------------
 src/nco/nco_rgr.h        |   71 +--
 src/nco/nco_sld.c        |  594 ++++++++++++++++++++++++-
 src/nco/nco_sld.h        |   49 ++
 src/nco/nco_typ.h        |    2 +-
 src/nco/nco_var_avg.c    |    7 +-
 src/nco/nco_var_utl.c    |    4 +-
 src/nco/ncra.c           |   85 ++--
 src/nco/ncwa.c           |    2 +-
 src/nco_c++/Makefile.in  |   32 +-
 68 files changed, 3501 insertions(+), 2930 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 57a4e47..70ee6aa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,17 @@
+# Syntax-check Travis YAML .travis.yml files at http://lint.travis-ci.org
+# Force Travis to rebuild by commiting an increment to this counter: 5
+
 language: c
 compiler:
   - gcc
   - clang
+  - g++
 
 before_install:
   - sudo apt-get update -qq
-  - sudo apt-get install -y -qq libnetcdf6 libnetcdf-dev netcdf-bin
+  - sudo apt-get install -y -qq antlr libantlr-dev libnetcdf6 libnetcdf-dev netcdf-bin udunits-bin libudunits2-0 libudunits2-dev
   - ./configure
-  export DATA=/home/travis
+  - export DATA='/home/travis'
 
 script:
   - make -j 4
diff --git a/Makefile.in b/Makefile.in
index e6bcb8f..6dea95d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
 
 # $Header$ -*-makefile-*-
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -81,17 +91,6 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = .
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/configure $(am__configure_deps) \
-	$(srcdir)/config.h.in $(top_srcdir)/autobld/mkinstalldirs \
-	AUTHORS COPYING INSTALL autobld/compile autobld/config.guess \
-	autobld/config.sub autobld/depcomp autobld/install-sh \
-	autobld/missing autobld/mkinstalldirs autobld/texinfo.tex \
-	autobld/ylwrap autobld/ltmain.sh $(top_srcdir)/autobld/compile \
-	$(top_srcdir)/autobld/config.guess \
-	$(top_srcdir)/autobld/config.sub \
-	$(top_srcdir)/autobld/install-sh \
-	$(top_srcdir)/autobld/ltmain.sh $(top_srcdir)/autobld/missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -99,6 +98,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+	$(am__configure_deps) $(am__DIST_COMMON)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
@@ -162,6 +163,17 @@ ETAGS = etags
 CTAGS = ctags
 CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+	$(top_srcdir)/autobld/compile \
+	$(top_srcdir)/autobld/config.guess \
+	$(top_srcdir)/autobld/config.sub \
+	$(top_srcdir)/autobld/install-sh \
+	$(top_srcdir)/autobld/ltmain.sh $(top_srcdir)/autobld/missing \
+	$(top_srcdir)/autobld/mkinstalldirs AUTHORS COPYING INSTALL \
+	autobld/compile autobld/config.guess autobld/config.sub \
+	autobld/depcomp autobld/install-sh autobld/ltmain.sh \
+	autobld/missing autobld/mkinstalldirs autobld/texinfo.tex \
+	autobld/ylwrap
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -379,7 +391,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -610,15 +621,15 @@ dist-xz: distdir
 	$(am__post_remove_distdir)
 
 dist-tarZ: distdir
-	@echo WARNING: "Support for shar distribution archives is" \
-	               "deprecated." >&2
+	@echo WARNING: "Support for distribution archives compressed with" \
+		       "legacy program 'compress' is deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__post_remove_distdir)
 
 dist-shar: distdir
-	@echo WARNING: "Support for distribution archives compressed with" \
-		       "legacy program 'compress' is deprecated." >&2
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
@@ -654,17 +665,17 @@ distcheck: dist
 	esac
 	chmod -R a-w $(distdir)
 	chmod u+w $(distdir)
-	mkdir $(distdir)/_build $(distdir)/_inst
+	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
 	chmod a-w $(distdir)
 	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 	  && am__cwd=`pwd` \
-	  && $(am__cd) $(distdir)/_build \
-	  && ../configure \
+	  && $(am__cd) $(distdir)/_build/sub \
+	  && ../../configure \
 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
-	    --srcdir=.. --prefix="$$dc_install_base" \
+	    --srcdir=../.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
@@ -841,6 +852,8 @@ uninstall-am:
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
 	uninstall-am
 
+.PRECIOUS: Makefile
+
 
 test:	tst
 tst:
diff --git a/aclocal.m4 b/aclocal.m4
index 3935bf3..39e162d 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.14'
+[am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.14.1], [],
+m4_if([$1], [1.15], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.14.1])dnl
+[AM_AUTOMAKE_VERSION([1.15])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -103,15 +103,14 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 # configured tree to be moved without reconfiguration.
 
 AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
 ])
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -142,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -333,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -409,7 +408,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -499,8 +498,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
@@ -573,7 +572,11 @@ to "yes", and re-run configure.
 END
     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
   fi
-fi])
+fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
+])
 
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
@@ -602,7 +605,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -613,7 +616,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
   case $am_aux_dir in
   *\ * | *\	*)
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -623,7 +626,7 @@ if test x"${install_sh}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -642,7 +645,7 @@ fi
 rmdir .tst 2>/dev/null
 AC_SUBST([am__leading_dot])])
 
-# Copyright (C) 1998-2013 Free Software Foundation, Inc.
+# Copyright (C) 1998-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -663,7 +666,7 @@ fi])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -698,7 +701,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -748,7 +751,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -789,7 +792,7 @@ fi
 # Obsolete and "removed" macros, that must however still report explicit
 # error messages when used, to smooth transition.
 #
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -816,7 +819,7 @@ AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -845,7 +848,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -892,7 +895,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -911,7 +914,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -992,7 +995,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1052,7 +1055,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1080,7 +1083,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1099,7 +1102,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+# Copyright (C) 2004-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/bld/Makefile b/bld/Makefile
index 7423247..054626f 100644
--- a/bld/Makefile
+++ b/bld/Makefile
@@ -115,7 +115,7 @@
 # cd ~/nco/bld;make NETCDF_ROOT='/glade/apps/opt/netcdf/4.3.0/intel/default' UDUNITS_INC='/glade/apps/opt/udunits/2.1.24/intel/12.1.4/include' UDUNITS_LIB='/glade/apps/opt/udunits/2.1.24/intel/12.1.4/lib' OPTS=D allinone;cd -
 # Cygwin on Windows Vista systems:
 # cd ~/nco/bld;ANTLR='antlr' make --jobs=1 GSL=Y OPTS=D NETCDF4=Y UDUNITS=Y allinone;cd -
-# cd ~/bin/WIN32;tar cvzf ~/nco-4.5.0.win32.cygwin.tar.gz nc* ; scp ~/nco-4.5.0.win32.cygwin.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
+# cd ~/bin/WIN32;tar cvzf ~/nco-4.5.2.win32.cygwin.tar.gz nc* ; scp ~/nco-4.5.2.win32.cygwin.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 # Data files to dust
 # cd ~/nco/data;scp cmip5.nc obs.nc mdl_1.nc mdl_2.nc in_grp*.nc in.nc in_4c.nc dust.ess.uci.edu:/var/www/html/nco
 
@@ -271,7 +271,9 @@ ifndef USR_TKN
  USR_TKN :=
 endif # endif USR_TKN
 ifndef VRS_SNG
- VRS_SNG := $(shell date +%Y%m%d)
+# VRS_SNG := $(shell date +%Y%m%d)
+# 20150622
+ VRS_SNG := $(shell git describe --abbrev=7 --dirty --always --tags)
 endif # endif VRS_SNG
 ifndef ${ZNETCDF} # znetcdf support
  ZNETCDF := N
@@ -1725,7 +1727,7 @@ libnco_c++_tst:   ${MY_BLD_DIR}/libnco_c++_tst
 ${MY_BLD_DIR}/libnco_c++_tst:	${MY_BLD_DIR}/libnco_c++_tst.o lib
 	${CXX} -o $@${BNR_SFX} $< ${LDFLAGS}
 	chmod 755 $@${BNR_SFX}
-rpm:	${MY_BLD_DIR}/nco.spec # Building rpm requires root priveleges, e.g., sudo make NCO_VRS=4.5.0 rpm
+rpm:	${MY_BLD_DIR}/nco.spec # Building rpm requires root priveleges, e.g., sudo make NCO_VRS=4.5.2 rpm
 # 	Building NCO RPM requires following packages
 #       rpm -q bison flex netcdf-devel libtool automake autoconf udunits udunits-devel curl-devel libxml2 libxml2-devel librx-devel 
 #       sudo yum install bison flex netcdf-devel libtool automake autoconf udunits udunits-devel curl-devel libxml2 libxml2-devel librx-devel
diff --git a/bld/nco.spec b/bld/nco.spec
index b1fc894..8274fe7 100644
--- a/bld/nco.spec
+++ b/bld/nco.spec
@@ -2,17 +2,17 @@ v# Fedora RPMs are up-to-date!
 # http://cvs.fedoraproject.org/viewvc/devel/nco/nco.spec?view=co
 
 Name:           nco
-Version:        4.5.0
+Version:        4.5.2
 Release:        1%{?dist}
 Summary:        Programs that manipulate netCDF files
 Group:          Applications/Engineering
 License:        GPL3
 URL:            http://nco.sf.net/
 
-# Obtain NCO version 4.5.0-1 tar.gz from Sourceforge using CVS:
+# Obtain NCO version 4.5.2-1 tar.gz from Sourceforge using CVS:
 # cvs -d:pserver:anonymous at nco.cvs.sf.net:/cvsroot/nco login
-# cvs -z3 -d:pserver:anonymous at nco.cvs.sf.net:/cvsroot/nco co -r nco-4.5.0-1 -d nco-%{version} nco
-# tar czf nco-%{version}.tar.gz --exclude='nco-4.5.0/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude='ncap_yacc.[ch]' ./nco-%{version}
+# cvs -z3 -d:pserver:anonymous at nco.cvs.sf.net:/cvsroot/nco co -r nco-4.5.2-1 -d nco-%{version} nco
+# tar czf nco-%{version}.tar.gz --exclude='nco-4.5.2/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude='ncap_yacc.[ch]' ./nco-%{version}
 Source0:        nco-%{version}.tar.gz
 #Patch0:		nco_install_C_headers.patch
 #Patch1:         nco_find_udunits-dat.patch
@@ -108,6 +108,12 @@ fi
 # %{_libdir}/libnco++.so
 
 %changelog
+* Fri Jul 24 2015 Charlie Zender <zender at uci.edu> - 4.5.1-1
+- new upstream 4.5.1
+
+* Fri Jul 10 2015 Charlie Zender <zender at uci.edu> - 4.5.1-1
+- new upstream 4.5.1
+
 * Thu Jun 11 2015 Charlie Zender <zender at uci.edu> - 4.5.0-1
 - new upstream 4.5.0
 
diff --git a/bld/nco_dst.pl b/bld/nco_dst.pl
index 93cf92f..daf5e3b 100755
--- a/bld/nco_dst.pl
+++ b/bld/nco_dst.pl
@@ -7,18 +7,18 @@
 # Export tagged, public versions
 # /usr/bin/scp ${DATA}/nco-4.4.4.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4_5_0 # Build, do not release on SF
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --sf nco-4_5_0 # Build, release on SF
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --nst_all nco-4_5_0 # Install, do not build
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --nst_all nco-4_5_0 # Build and install
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_cnt nco-4_5_0
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_prs nco-4_5_0
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cgd_cnt nco-4_5_0
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cray_prs nco-4_5_0
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --bbl_cnt nco-4_5_0
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --blk_cnt nco-4_5_0
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --dat_cnt nco-4_5_0
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --ute_prs nco-4_5_0
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4.5.2 # Build, do not release on SF
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --sf nco-4.5.2 # Build, release on SF
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --nst_all nco-4.5.2 # Install, do not build
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --nst_all nco-4.5.2 # Build and install
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_cnt nco-4.5.2
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_prs nco-4.5.2
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cgd_cnt nco-4.5.2
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cray_prs nco-4.5.2
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --bbl_cnt nco-4.5.2
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --blk_cnt nco-4.5.2
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --dat_cnt nco-4.5.2
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --ute_prs nco-4.5.2
 
 # Export daily snapshot
 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 
@@ -256,7 +256,7 @@ if($bld){
 # Set up FTP server
     chdir $dst_pth_pfx or die "$prg_nm: ERROR unable to chdir to $dst_pth_pfx: $!\n"; # $! is system error string
     cmd_prc("$cp_cmd $doc_fl ./$dst_vrs/doc"); # Copy derived documentation to source directory
-    cmd_prc("$tar_cmd cvzf $dst_fl --exclude='nco-4.5.0/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude=ncap_yacc.[ch] ./$dst_vrs"); # Create gzipped tarfile
+    cmd_prc("$tar_cmd cvzf $dst_fl --exclude='nco-4.5.2/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude=ncap_yacc.[ch] ./$dst_vrs"); # Create gzipped tarfile
     cmd_prc("$rsh_cmd $www_mch $rm_cmd $www_drc/src/$dst_fl"); # Remove any distribution with same name
     if($dly_snp){cmd_prc("$rsh_cmd $www_mch $rm_cmd -r $www_drc/src/nco-????????.tar.gz");} # Remove previous daily snapshots from WWW server
     cmd_prc("$rcp_cmd $dst_fl $www_mch:$www_drc/src"); # Copy local tarfile to WWW server
diff --git a/bm/NCO_bm.pm b/bm/NCO_bm.pm
index 1bb3c0d..3811ffb 100644
--- a/bm/NCO_bm.pm
+++ b/bm/NCO_bm.pm
@@ -155,9 +155,9 @@ sub bm_ntl($$){
     $opr_sng_mpi = "ncbo ncdiff ncecat ncflint nces ncpdq ncra ncwa "; # ncpdq ncra MPI, but fail bench
     $opr_rgr_mpi = "ncbo ncdiff ncecat ncflint nces ncpdq ncra ncwa ncrcat"; # need all of them for regression
     
-    if (scalar @ARGV > 0){@opr_lst=@ARGV;}else{@opr_lst=@opr_lst_all;}
-    if (defined $ENV{'MY_BIN_DIR'} && $ENV{'MY_BIN_DIR'} ne ""){$MY_BIN_DIR=$ENV{'MY_BIN_DIR'};}
-    else{
+    if(scalar @ARGV > 0){@opr_lst=@ARGV;}else{@opr_lst=@opr_lst_all;}
+    if(defined $ENV{'MY_BIN_DIR'} && $ENV{'MY_BIN_DIR'} ne ""){$MY_BIN_DIR=$ENV{'MY_BIN_DIR'};
+    }else{
 # Set and verify MY_BIN_DIR
 	$MY_BIN_DIR=abs_path("../src/nco");
 	dbg_msg(2, "ENV var 'MY_BIN_DIR' not specified, so using default [$MY_BIN_DIR].");
@@ -187,7 +187,7 @@ sub bm_ntl($$){
     $sym_link{ncdiff}=$dotlib . "ncbo";
     $sym_link{nces}=$dotlib . "ncra";
     $sym_link{ncrcat}=$dotlib . "ncra";
-    foreach(keys %sym_link) {
+    foreach(keys %sym_link){
 	system("cd $MY_BIN_DIR && ln -s -f $sym_link{$_} $_ || (/bin/rm -f $_ && ln -s -f $sym_link{$_} $_)");
     }
     
@@ -201,7 +201,7 @@ sub bm_ntl($$){
 	system("ncgen -o in.nc in.cdl") if (`which ncgen` and -e "in.cdl");
     } die "The netCDF file \"in.nc\" is necessary for testing NCO, however, it could not be found in \"$drc_in_nc\".  Also, it could not be generated because \"ncgen\" could not be found in your path and/or the file \"$drc_in_nc/in.cdl\" does not exist.\n stopped" unless (-e "in.nc");
 #create large files openMP testing
-    if( !(-e "lrg_bm.nc") && (-e "lrg_bm.in") && (-e "$MY_BIN_DIR/ncap2")   ){
+    if( !(-e "lrg_bm.nc") && (-e "lrg_bm.in") && (-e "$MY_BIN_DIR/ncap2") ){
 # make lrg_bm.nc
 	system("$MY_BIN_DIR/ncap2 -C -v -O -t1 -S lrg_bm.in in.nc lrg_bm.nc");
 # make lrg_bm1.nc
@@ -350,8 +350,8 @@ sub rsl_smr_fl_mk {
     } # and send it back separately
 } # end of rsl_smr_fl_mk
 
-# drc_dat_set() tries to answer the question of where to write data
-sub drc_dat_set {
+# drc_dat_set(): figures out where to write data
+sub drc_dat_set{
     $caseid = shift;
     my $tmp;
     my $umask = umask;
@@ -446,14 +446,14 @@ sub tst_run {
     *fl_out = *main::fl_out;
     *mpi_prc = *main::mpi_prc;
     
-    if ($dbg_lvl > 0) {
+    if($dbg_lvl > 0){
 	print "\n\n\n### New tst_run() cycle [$opr_nm: $dsc_sng] ###\n";
-	    if ($fl_nm_lcl{'%tmp_fl_00%'} eq "") {
-		print "fl_out undefined!\n";
-	    } # else {	print "\$fl_nm_lcl{'%tmp_fl_00%'} = [$fl_nm_lcl{'%tmp_fl_00%'}] \n";}
+	if($fl_nm_lcl{'%tmp_fl_00%'} eq ""){
+	    print "fl_out undefined!\n";
+	} # else {	print "\$fl_nm_lcl{'%tmp_fl_00%'} = [$fl_nm_lcl{'%tmp_fl_00%'}] \n";}
     }
 
-# tst_run() requires regression tests provide expected values
+# tst_run() requires that regression tests provide expected values
 # If last element is not SS_OK, tst_run() pops off expected value and 
 # processes commands same as it did previously
     my $arr_ref = shift; # Pass benchmark()'s @tst_cmd via reference to maintain coherence
@@ -473,11 +473,15 @@ sub tst_run {
     # on AIX, non-MPI ops compiled with MPI will atttempt to run MP_PROCS.  
     # To hold them to one process, must add explicit prefix ($aix_mpi_sgl_nvr), added below
     my $aix = 0; if ($os_nm =~ /AIX/) {$aix = 1;} # yafv for aix
-    if($aix){$pfx_mpi = " $aix_mpi_nvr_pfx $MY_BIN_DIR/mp";}
-    elsif($mpi_upx eq "") {# Assume Linux-like MPI
-        $pfx_mpi = " mpirun -np $mpi_prc $MY_BIN_DIR/mp";
-    } else { $pfx_mpi = " ". $mpi_upx . "  $MY_BIN_DIR/mp"; } # use user-supplied prefix
-    $pfxd = 1; $timed = 1;
+    if($aix){$pfx_mpi=" $aix_mpi_nvr_pfx $MY_BIN_DIR/mp";}
+    elsif($mpi_upx eq "") {
+	# Assume Linux-like MPI
+        $pfx_mpi = "mpirun -np $mpi_prc $MY_BIN_DIR/mp";
+    }else{
+	$pfx_mpi = " ". $mpi_upx . "  $MY_BIN_DIR/mp";
+    } # use user-supplied prefix
+    $pfxd = 1; 
+    $timed = 1;
     
     my $pwd=`pwd`; chomp $pwd;
     dbg_msg(1,"\$pwd=$pwd | \$pfx_cmd=$pfx_cmd | \$pfx_mpi=$pfx_mpi | \$pfx_fk=$pfx_fk");
@@ -488,16 +492,15 @@ sub tst_run {
 #	print "DEBUG[tst_run]:\$dodap = [$dodap], \$prsrv_fl = [$prsrv_fl]\n";
     if ($dodap ne "FALSE" && !$prsrv_fl) {
 	print "\nWARN: about to unlink everything in $drc_dat ! Continue? [Ny]\n";
-	my $wait = <STDIN>; if ($wait !~ /[Yy]/) { die "Make sure of the commandline options!\n";}
+	my $wait = <STDIN>; 
+	if ($wait !~ /[Yy]/){ die "Make sure of the commandline options!\n";}
 	my $unlink_cnt = unlink <$drc_dat/*>;
 	print "\nINFO: OK - unlinked $unlink_cnt files\n";
     }
 #	print "just past unlinking stage \n";  my $wait = <STDIN>;
     
-    if ($dbg_lvl > 0) {
-	for (my $cmd_idx=0; $cmd_idx <= $#cmd_lst; $cmd_idx++){
-	    print "### cmd_lst[$cmd_idx] = $cmd_lst[$cmd_idx] ###\n";
-	    }
+    if($dbg_lvl > 0){
+	for(my $cmd_idx=0; $cmd_idx <= $#cmd_lst; $cmd_idx++) {print "### cmd_lst[$cmd_idx] = $cmd_lst[$cmd_idx] ###\n";}
     }
     
 # Perform tests of requested operator; default is all
@@ -505,11 +508,11 @@ sub tst_run {
 	#print "DEBUG: \$tst_nbr{\$opr_nm} not defined - going to exit!\n";
 	@cmd_lst=();  # Clear test array
 	# and init the timing hashes
-	$real_tme{$opr_nm} = 0;
-	$usr_tme{$opr_nm}  = 0;
-	$sys_tme{$opr_nm}  = 0;
+	$real_tme{$opr_nm}=0;
+	$usr_tme{$opr_nm}=0;
+	$sys_tme{$opr_nm}=0;
 	return;
-    } else {
+    }else{
 	#print "\$tst_nbr{\$opr_nm} = $tst_nbr{$opr_nm}\n";
     }
 #	print "DEBUG: for $opr_nm, \$tst_nbr{\$opr_nm} = $tst_nbr{$opr_nm}\n";
@@ -563,9 +566,9 @@ sub tst_run {
         $nsr_xpc=$cmd_lst[$#cmd_lst]; # pop last value to provide exepected answer
 #		print "\n##DEBUG:\t$nsr_xpc (expt)\n\t\t$cmd_rsl (SS)\n";
     } else {
-	# delete the SS value to leave "expected value" as last
+	# delete SS value to leave "expected value" as last
 	delete $cmd_lst[$#cmd_lst];
-	#regardless, pop the next value off to provide the 'expected value'
+	# regardless, pop the next value off to provide the 'expected value'
 	$nsr_xpc = $cmd_lst[$#cmd_lst]; # pop the next value off \
 	delete $cmd_lst[$#cmd_lst]; # and now the $cmd_lst is the same as it ever was..
 	
@@ -617,8 +620,7 @@ sub tst_run {
 	    # NB: May require ONLY HiRes timing since SERVERSIDE will be hard to do otherwise
 	    # timing code using Time::HiRes
 	    my $t0;
-	    if ($hiresfound) {$t0 = [gettimeofday()];}
-	    else {$t0 = time;}
+	    if($hiresfound) {$t0 = [gettimeofday()];} else{$t0 = time;}
 	    
 	    # Execute command, split off stderr to file 'nco_bm.stderr'
 	    $cmd_rsl = `($_) 2> nco_bm.stderr`; # stderr contains timing info, if any
@@ -661,8 +663,8 @@ sub tst_run {
 		    $sys_tme{$opr_nm}  += $rev_sys_tim_arr[4] + 0;
 		}
 	    }
-	    if ($hiresfound) {$elapsed = tv_interval($t0, [gettimeofday()]);}
-	    else {$elapsed = time - $t0;}
+	    if($hiresfound) {$elapsed = tv_interval($t0, [gettimeofday()]);}
+	    else{$elapsed = time - $t0;}
 	    
 	    #print "inter benchmark for $opr_nm = $subbenchmarks{$opr_nm} \n";
 	    $subbenchmarks{$opr_nm} += $elapsed;
@@ -688,9 +690,9 @@ sub tst_run {
 		my $wait = <STDIN>;
 	    }
 	} # end loop: 	foreach (@cmd_lst)
-    }  # end of client side 'else'
+    } # end of client side 'else'
     
-    $dbg_sng .= "DEBUG: Total time for $opr_nm [$tst_nbr{$opr_nm}] = $subbenchmarks{$opr_nm} s\n";
+    $dbg_sng.="DEBUG: Total time for $opr_nm [$tst_nbr{$opr_nm}] = $subbenchmarks{$opr_nm} s\n";
     $totbenchmarks{$opr_nm}+=$subbenchmarks{$opr_nm};
     
     # Results comparison should not be necessary to validate whole file,
@@ -698,68 +700,67 @@ sub tst_run {
 #	chomp $cmd_rsl;  # Remove trailing newline for easier regex comparison
     
     # Still newlines in $cmd_rsl? -> a multiline result & only want the last one.
-    if ($cmd_rsl =~/\n/) {
+    if($cmd_rsl =~/\n/){
 	my @rsl_arr = split(/\n/, $cmd_rsl);
 	$cmd_rsl = $rsl_arr[$#rsl_arr]; # take the last line
-	if ($dbg_lvl >= 1) {print "\nprocessed multiline \$cmd_rsl = [$cmd_rsl]\n";}
+	if($dbg_lvl >= 1){print "\nprocessed multiline \$cmd_rsl = [$cmd_rsl]\n";}
     }
     # Is $cmd_rsl numeric or alpha?
-    if ($cmd_rsl =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ &&
+    if($cmd_rsl =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ &&
 	$cmd_rsl !~ /[a-df-zA-DF-Z ,]/) { $cmd_rsl_is_nbr = 1;}
-    else { #print "DEBUG: \$cmd_rsl is not numeric: $cmd_rsl \n";
+    else{ #print "DEBUG: \$cmd_rsl is not numeric: $cmd_rsl \n";
 	$cmd_rsl_is_nbr = 0;
     }
     # Is $nsr_xpc numeric or alpha?
-    if ($nsr_xpc =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ &&
+    if($nsr_xpc =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ &&
 	$nsr_xpc !~ /[a-df-zA-DF-Z ,]/) { $xpc_is_nbr = 1;}
-    else { #print "DEBUG: \$nsr_xpc is not numeric: $nsr_xpc \n";
+    else{ #print "DEBUG: \$nsr_xpc is not numeric: $nsr_xpc \n";
 	$xpc_is_nbr = 0;
     }
     
     # Compare numeric results
-    if ($cmd_rsl_is_nbr && $xpc_is_nbr) { # && it equals the expected value
+    if($cmd_rsl_is_nbr && $xpc_is_nbr){ # && it equals the expected value
 #print "\n \$nsr_xpc [$nsr_xpc] considered a number\n";
-	$dbg_sng .= "DEBUG: \$nsr_xpc assumed to be numeric: $nsr_xpc & actual  \$cmd_rsl = [$cmd_rsl]\n";
-	if ($nsr_xpc == $cmd_rsl) {
+	$dbg_sng.="DEBUG: \$nsr_xpc assumed to be numeric: $nsr_xpc & actual  \$cmd_rsl = [$cmd_rsl]\n";
+	if($nsr_xpc == $cmd_rsl){
 	    $success{$opr_nm}++;
 	    printf STDERR (" SVn ok\n");
 	    $dbg_sng .= "DEBUG: PASSED (Numeric output)\n";
-	} elsif (abs($cmd_rsl - $nsr_xpc) < 0.02) {
+	}elsif(abs($cmd_rsl - $nsr_xpc) < 0.02){
 	    $success{$opr_nm}++;
 	    printf STDERR (" SVn prov. ok\n");
 	    $dbg_sng .= "DEBUG: PASSED PROVISIONALLY (Numeric output):[$nsr_xpc vs $cmd_rsl]\n";
-	} else {
+	}else{
 	    printf STDERR (" FAILED!\n");
 	    &failed($nsr_xpc);
 	    my $diff = abs($nsr_xpc - $cmd_rsl);
 	    $dbg_sng .= "DEBUG: !!FAILED (Numeric output) [expected: $nsr_xpc vs result: $cmd_rsl].  Difference = $diff.\n";
 	}
-    }elsif(!$cmd_rsl_is_nbr && !$xpc_is_nbr)
-    {# Compare non-numeric tests
+    }elsif(!$cmd_rsl_is_nbr && !$xpc_is_nbr){# Compare non-numeric tests
 	 dbg_msg(2,"DEBUG: expected value assumed to be alphabetic: $nsr_xpc\n\$cmd_rsl = $cmd_rsl\n");
 #print "\n \$nsr_xpc [$nsr_xpc] considered a string\n";
 	 
 	 # Compare $cmd_rsl with $nsr_xpc
 #		if ($cmd_rsl =~ $nsr_xpc) {
-	 if (substr($cmd_rsl,0,length($nsr_xpc)) eq $nsr_xpc) {
+	 if(substr($cmd_rsl,0,length($nsr_xpc)) eq $nsr_xpc){
 	     $success{$opr_nm}++;
 	     printf STDERR (" SVa ok\n");
 	     $dbg_sng .= "DEBUG: PASSED Alphabetic output";
-	 } else {
+	 }else{
 	     &failed($nsr_xpc);
 	     $dbg_sng .= "DEBUG: !!FAILED Alphabetic output (expected: $nsr_xpc vs result: $cmd_rsl) ";
 	 }
-     }  else {  # No result at all?
+     }else{  # No result at all?
 	 print STDERR " !!FAILED\n  \$cmd_rsl_is_nbr = $cmd_rsl_is_nbr and \$xpc_is_nbr = $xpc_is_nbr\n";
 	 &failed();
 	 $dbg_sng .= "DEBUG: !!FAILED - No result from [$opr_nm]\n";
 						   }
     print $err_sng;
-    if ($dbg_lvl > 0) {print $dbg_sng;}
-    if ($wnt_log) {print LOG $dbg_sng;}
-    @cmd_lst =(); # Clear test
-    if (!$bm) { $prsrv_fl = 0; } # reset so files will be deleted unless doing benchmarks
-    if (-e $fl_nm_lcl{'%tmp_fl_00%'} && -w $fl_nm_lcl{'%tmp_fl_00%'}) { unlink $fl_nm_lcl{'%tmp_fl_00%'};	}
+    if($dbg_lvl > 0){print $dbg_sng;}
+    if($wnt_log){print LOG $dbg_sng;}
+    @cmd_lst=(); # Clear test
+    if(!$bm){$prsrv_fl = 0;} # reset so files will be deleted unless doing benchmarks
+    if(-e $fl_nm_lcl{'%tmp_fl_00%'} && -w $fl_nm_lcl{'%tmp_fl_00%'}){unlink $fl_nm_lcl{'%tmp_fl_00%'};}
 } # end tst_run()
 
 ####################
@@ -908,10 +909,6 @@ sub SS_prepare {
     SS_init() unless $SSD{"initialized"};
 }
 
-
-
-
-
 ####################
 sub failed {
     $failure{$opr_nm}++;
diff --git a/bm/NCO_rgr.pm b/bm/NCO_rgr.pm
index 2f70b9d..7b66025 100644
--- a/bm/NCO_rgr.pm
+++ b/bm/NCO_rgr.pm
@@ -26,7 +26,7 @@ our @EXPORT = qw (
 		  $foo_xy_fl $foo_xymyx_fl $pth_rmt_scp_tst $omp_flg $nco_D_flg %NCO_RC
 		  );
 use vars qw(
-	    $dodap $dbg_lvl $dsc_sng $dust_usr $fl_fmt $fl_pth $foo1_fl $foo2_fl $foo_avg_fl
+	    $dodap $dbg_lvl $drc_dat $dsc_sng $dust_usr $fl_fmt $fl_pth $foo1_fl $foo2_fl $foo_avg_fl
 	    $foo_fl $foo_tst $foo_x_fl $foo_xy_fl
 	    $foo_xymyx_fl $foo_y_fl $foo_yx_fl $mpi_prc $nco_D_flg $localhostname
 	    $nsr_xpc $omp_flg $opr_nm $opr_rgr_mpi $fl_out_rgn
@@ -34,15 +34,14 @@ use vars qw(
 	    );
 
 sub tst_rgr {
+# Tests are organized and laid-out as follows:
 # Tests are in alphabetical order by operator name
-    
-# The following tests are organized and laid out as follows:
-# - $tst_cmd[] holds command lines for each operator being tested
-#   the last 2 lines are the expected value and the serverside string, either:
-#       "NO_SS" - No Serverside allowed or (all regr are NO_SS still)
-#       "SS_OK" - OK to send it serverside. (has to be requested with '--serverside'
-# - $dsc_sng still holds test description line
-# - tst_run() is function which executes each test
+# $tst_cmd[] holds command lines for each operator being tested
+# Last two lines are the expected value and the serverside string, either:
+# "NO_SS" - No ServerSide allowed or (all regr are NO_SS still)
+# "SS_OK" - OK to send it ServerSide (request with '--serverside')
+# $dsc_sng still holds test description line
+# tst_run() is function which executes each test
     
     my $in_pth="../data";
     my $in_pth_arg="-p $in_pth";
@@ -67,7 +66,7 @@ sub tst_rgr {
     NCO_bm::dbg_msg(1,"in package NCO_rgr, \$omp_flg = $omp_flg");
 # csz--
     
-# in general, $fl_out    -> %tmp_fl_00%
+# in general, $fl_out     -> %tmp_fl_00%
 #             $foo_fl     -> %tmp_fl_01%
 #             $foo_tst    -> %tmp_fl_02%
 #             $foo_avg_fl -> %tmp_fl_03%
@@ -81,34 +80,38 @@ sub tst_rgr {
     }
     NCO_bm::dbg_msg(1,"-------------  REGRESSION TESTS STARTED from tst_rgr()  -------------");
     
-    if(0){} #################  SKIP THESE #####################
+    print "\n";
+    my $RUN_NETCDF4_TESTS=0;
+    my $RUN_NETCDF4_TESTS_VERSION_GE_431=0;
+    #my $lbr_rcd_cmd=${pfx_cmd}."ncks --lbr_rcd";
+    my $lbr_rcd_cmd="ncks --lbr_rcd";
+    system($lbr_rcd_cmd);
+    if($? == -1){
+	print "failed to execute: ncks --lbr_rcd: $!\n";
+    }else{
+    # system() runs a command and returns exit status information as a 16 bit value 
+    # Low 7 bits are signal process died from, if any, and high 8 bits are actual exit value
+    my $exit_value=$? >> 8;
     
-print "\n";
-
-my $RUN_NETCDF4_TESTS=0;
-my $RUN_NETCDF4_TESTS_VERSION_GE_431=0;
-
-system("ncks --get_prg_info");
-# system() runs a command and returns exit status information as a 16 bit value: 
-# Low 7 bits are signal process died from, if any, and high 8 bits are actual exit value
-if($? == -1){
-  print "failed to execute: ncks --get_prg_info: $!\n";
-}else{
-#  my $exit_value=$? >> 8;
-    my $exit_value=$?;
+    # 20150619: nco_exit_lbr_vrs() deducts offset of 300 so rcd < 255
+    # Verify exit status in shell with "echo $?"
+    # Library 4.3.3 should return $? = 133
+    $exit_value+=300;
 
-  # nco_get_prg_info() returns codes:
-  # 3 (for library 3.x)
-  # 410 (for library 4.1.x)
-  # 430 (for library 4.3.0)
-  # 433 (for library 4.3.3)
+    # nco_exit_lbr_rcd() returns codes:
+    # 360 (for library 3.x)
+    # 410 (for library 4.1.x)
+    # 430 (for library 4.3.0)
+    # 433 (for library 4.3.3)
 
-  if($exit_value >= 400){$RUN_NETCDF4_TESTS=1;}
-  if($exit_value >= 431){$RUN_NETCDF4_TESTS_VERSION_GE_431=1;}
   if($exit_value == 410){print "netCDF version 4.1.x detected\n";}
   if($exit_value == 431){print "netCDF version 4.3.1 detected\n";}
   if($exit_value == 432){print "netCDF version 4.3.2 detected\n";}
   if($exit_value == 433){print "netCDF version 4.3.3 detected\n";}
+  if($exit_value == 440){print "netCDF version 4.4.0 detected\n";}
+
+  if($exit_value >= 400){$RUN_NETCDF4_TESTS=1;}
+  if($exit_value >= 431){$RUN_NETCDF4_TESTS_VERSION_GE_431=1;}
 }
 print "\n";
 
@@ -121,16 +124,19 @@ print "\n";
 # This stanza will not map to the way the SS is done - needs a %stdouterr% added but all the rest of them
 # have an ncks which triggers this addition from the sub tst_run() -> gnarly_pything.
 # this stanza also requires a script on the SS.
+# 20150617: ncap2.in has failed for years because time1 attribute bounds is passed with att_item.val=NULL
+# This is fixable (at least by Henry). But for now, omit this known-to-fail test.
+    if(0){
+    $dsc_sng="running ncap2.in script in nco_bm.pl (failure expected)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S ncap2.in $in_pth_arg in.nc %tmp_fl_00% %stdouterr%";
-    $dsc_sng="running ncap2.in script in nco_bm.pl (failure expected on netCDF4 ncap81)";
     $tst_cmd[1]="ncks -C -H -v b2 --no_blank -s '%d' %tmp_fl_00%";
     $tst_cmd[2]="999";
-#	$tst_cmd[3]="NO_SS";
-    $tst_cmd[3]="SS_OK";
+    $tst_cmd[3]="NO_SS";
+#    $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
-    
 # printf("paused @ [%s:%d] - hit return to continue\n", __FILE__, __LINE__); my $wait = <STDIN>;
+    } # endif false
     
     $dsc_sng="Testing float modulo float";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'tpt_mod=tpt%273.0f' $in_pth_arg in.nc %tmp_fl_00%";
@@ -140,18 +146,14 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
-#printf("paused @ [%s:%d] - hit return to continue\n", __FILE__, __LINE__); my $wait = <STDIN>;
-
-    $dsc_sng="Testing foo=log(e_flt)^1 (fails on AIX TODO ncap57)";
+    $dsc_sng="Testing foo=log(e_flt)^1 (may fail on old AIX TODO ncap57)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=log(e_flt)^1' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -v foo -s '%.6f\\n' %tmp_fl_00%";
     $tst_cmd[2]="1.000000";
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
-#print "paused - hit return to continue"; my $wait = <STDIN>;
     
-# where did e_dbl tst_run??  it's in in.cdl but gets lost thru the rgrs...?
     $dsc_sng="Testing foo=log(e_dbl)^1";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=log(e_dbl)^1' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -s '%.12f\\n' %tmp_fl_00%";
@@ -168,16 +170,16 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
+    $dsc_sng="Testing foo=erf(1) (may fail on old AIX TODO ncap57)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=erf(1)' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -s '%.12f\\n' %tmp_fl_00%";
-    $dsc_sng="Testing foo=erf(1) (fails on AIX TODO ncap57)";
     $tst_cmd[2]="0.842701";
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
     #fails - wrong result ???
-    $dsc_sng="Testing foo=gamma(0.5) (fails on AIX TODO ncap57)";
+    $dsc_sng="Testing foo=gamma(0.5) (may fail on old AIX TODO ncap57)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=gamma(0.5)' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -s '%.12f\\n' %tmp_fl_00%";
     $tst_cmd[2]="1.772453851";
@@ -185,24 +187,23 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
+    $dsc_sng="Testing foo=sin(pi/2)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'pi=4*atan(1);foo=sin(pi/2)' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -v foo -s '%.12f\\n' %tmp_fl_00%";
-    $dsc_sng="Testing foo=sin(pi/2)";
     $tst_cmd[2]="1.000000000000";
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
+    $dsc_sng="Testing foo=cos(pi)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'pi=4*atan(1);foo=cos(pi)' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -v foo -s '%.12f\\n' %tmp_fl_00%";
-    $dsc_sng="Testing foo=cos(pi)";
     $tst_cmd[2]="-1.000000000000";
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array\
     
-    ##TODO ncap81
-    $dsc_sng="Casting variable with same name as dimension (failure expected on netCDF4 ncap81)";
+    $dsc_sng="Casting variable with same name as dimension (ncap81 failed with netCDF4 until netCDF 4.3.x)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'defdim(\"a\",3);defdim(\"b\",4); a[\$a,\$b]=10;c=a(1,1);' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -v c -s '%i' %tmp_fl_00%";
     $tst_cmd[2]="10";
@@ -210,8 +211,7 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
 
-    ##TODO ncap81
-    $dsc_sng="Casting variable with a single dim of sz=1";
+    $dsc_sng="Casting variable with a single dim of sz=1 (ncap81 failed with netCDF4 until netCDF 4.3.x)";
     $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'defdim(\"a\",1); b[\$a]=10;c=b(0:0);' $in_pth_arg in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncwa -h -O $fl_fmt $nco_D_flg -C -a a %tmp_fl_00% %tmp_fl_01%";
     $tst_cmd[2]="ncks -C -H -v b -s '%i' %tmp_fl_01%";
@@ -220,9 +220,94 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
 
-# printf("paused @ %s:%d - hit return to continue", __FILE__ , __LINE__); my $wait=<STDIN>;
+# ncap2 -O -v -s 'lat_min=min(lat)' ~/nco/data/in.nc ~/foo.nc
+# ncks -C -H -v lat_min -s '%g' ~/foo.nc
+    $dsc_sng="Verify non-averaging functions min/max on coordinate variables";
+    $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -s 'lat_min=min(lat)' $in_pth_arg in.nc %tmp_fl_00%";
+    $tst_cmd[1]="ncks -C -H -v lat_min -s '%g' %tmp_fl_00%";
+    $tst_cmd[2]="-90";
+    $tst_cmd[3]="SS_OK";
+    NCO_bm::tst_run(\@tst_cmd);
+    $#tst_cmd=0; # Reset array
+
+    $USER=$ENV{'USER'};
+    if($USER eq 'zender'){
+	# Regridding regression tests
+	# valgrind --leak-check=yes --show-reachable=yes --suppressions=${HOME}/nco/doc/valgrind.txt --tool=memcheck ncks -O -D 5 --map=${DATA}/maps/map_ne30np4_to_fv129x256_aave.150418.nc ${DATA}/ne30/rgr/ne30_tst.nc ~/foo.nc > ~/foo 2>&1
+	# ncks -O -D 5 --map=${DATA}/maps/map_ne30np4_to_fv129x256_aave.150418.nc ${DATA}/ne30/rgr/ne30_tst.nc ~/foo.nc
+	# ncwa -O -w area ~/foo.nc ~/foo2.nc
+	# ncks -H -u -C -v FSNT ~/foo2.nc
+	# ncwa -O -y ttl -v area ~/foo.nc ~/foo3.nc
+	# ncks -H -u -C -v area ~/foo3.nc
+	
+	$dsc_sng="Regridding FSNT 1D->2D to test conservation (uses SSH/scp to givre.ess.uci.edu)";
+	$tst_cmd[0]="scp givre.ess.uci.edu:/data/zender/maps/map_ne30np4_to_fv129x256_aave.150418.nc .";
+	$tst_cmd[1]="scp givre.ess.uci.edu:/data/zender/ne30/rgr/ne30_tst.nc .";
+	$tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_ne30np4_to_fv129x256_aave.150418.nc ne30_tst.nc %tmp_fl_00%";
+#	my $pwd=`pwd`; chomp $pwd; print $pwd;
+#	$dsc_sng="Regridding FSNT to regridding conservation (uses wget to glace.ess.uci.edu)";
+#	$tst_cmd[0]="wget -c -P $drc_dat http://glace.ess.uci.edu/maps/map_ne30np4_to_fv129x256_aave.150418.nc";
+#	$tst_cmd[1]="wget -c -P $drc_dat http://glace.ess.uci.edu/ne30/rgr/ne30_tst.nc";
+#	$tst_cmd[2]="ncks -h -O $fl_fmt $nco_D_flg --map=".$drc_dat."/map_ne30np4_to_fv129x256_aave.150418.nc ".$drc_dat."/ne30_tst.nc %tmp_fl_00%";
+	$tst_cmd[3]="/bin/cp -f %tmp_fl_00% ne30_2D.nc";
+	$tst_cmd[4]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%";
+	$tst_cmd[5]="ncks -O $fl_fmt $nco_D_flg -H -u -C -v FSNT %tmp_fl_01%";
+	$tst_cmd[6]="FSNT = 244.124 W/m2";
+	$tst_cmd[7]="SS_OK";
+	NCO_bm::tst_run(\@tst_cmd);
+	$#tst_cmd=0; # Reset array
+
+	$dsc_sng="Regridding AODVIS 1D->2D to test missing value treatment";
+	$tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg -H -u -C -v AODVIS %tmp_fl_01%";
+	$tst_cmd[1]="AODVIS = 0.151705";
+	$tst_cmd[2]="SS_OK";
+	NCO_bm::tst_run(\@tst_cmd);
+	$#tst_cmd=0; # Reset array
+
+	$dsc_sng="Regridding area 1D->2D to test grid normalization";
+	$tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg --map=${drc_dat}/map_ne30np4_to_fv129x256_aave.150418.nc $drc_dat/ne30_tst.nc %tmp_fl_00%";
+	$tst_cmd[1]="ncwa -O $fl_fmt $nco_D_flg -y ttl -v area %tmp_fl_00% %tmp_fl_02%";
+	$tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg -H -u -C -v area %tmp_fl_02%";
+	$tst_cmd[3]="area = 12.5663706144 steradian";
+	$tst_cmd[4]="SS_OK";
+	NCO_bm::tst_run(\@tst_cmd);
+	$#tst_cmd=0; # Reset array
+
+	$dsc_sng="Regridding FSNT 2D->1D to test conservation (uses SSH/scp to givre.ess.uci.edu)";
+	$tst_cmd[0]="scp givre.ess.uci.edu:/data/zender/maps/map_fv129x256_to_ne30np4_aave.20150602.nc .";
+	$tst_cmd[1]="scp givre.ess.uci.edu:/data/zender/ne30/rgr/ne30_tst.nc .";
+	$tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_fv129x256_to_ne30np4_aave.20150602.nc ne30_2D.nc %tmp_fl_00%";
+	$tst_cmd[3]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%";
+	$tst_cmd[4]="ncks -O $fl_fmt $nco_D_flg -H -u -C -v FSNT %tmp_fl_01%";
+	$tst_cmd[5]="FSNT = 244.124 W/m2";
+	$tst_cmd[6]="SS_OK";
+	NCO_bm::tst_run(\@tst_cmd);
+	$#tst_cmd=0; # Reset array
+
+	$dsc_sng="Regridding FSNT 2D->2D to test conservation (uses SSH/scp to givre.ess.uci.edu)";
+	$tst_cmd[0]="scp givre.ess.uci.edu:/data/zender/maps/map_fv129x256_to_fv257x512_aave.20150529.nc .";
+	$tst_cmd[1]="scp givre.ess.uci.edu:/data/zender/ne30/rgr/ne30_tst.nc .";
+	$tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_fv129x256_to_fv257x512_aave.20150529.nc ne30_2D.nc %tmp_fl_00%";
+	$tst_cmd[3]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%";
+	$tst_cmd[4]="ncks -O $fl_fmt $nco_D_flg -H -u -C -v FSNT %tmp_fl_01%";
+	$tst_cmd[5]="FSNT = 244.124 W/m2";
+	$tst_cmd[6]="SS_OK";
+	NCO_bm::tst_run(\@tst_cmd);
+	$#tst_cmd=0; # Reset array
+
+	$dsc_sng="Regridding FSNT 1D->1D to test conservation (uses SSH/scp to givre.ess.uci.edu)";
+	$tst_cmd[0]="scp givre.ess.uci.edu:/data/zender/maps/map_ne30np4_to_ne30np4_aave.20150603.nc .";
+	$tst_cmd[1]="scp givre.ess.uci.edu:/data/zender/ne30/rgr/ne30_tst.nc .";
+	$tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_ne30np4_to_ne30np4_aave.20150603.nc ne30_tst.nc %tmp_fl_00%";
+	$tst_cmd[3]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%";
+	$tst_cmd[4]="ncks -O $fl_fmt $nco_D_flg -H -u -C -v FSNT %tmp_fl_01%";
+	$tst_cmd[5]="FSNT = 244.124 W/m2";
+	$tst_cmd[6]="SS_OK";
+	NCO_bm::tst_run(\@tst_cmd);
+	$#tst_cmd=0; # Reset array
+    } # !CSZ
     
-    if($dodap eq "FALSE") {
+    if($dodap eq "FALSE"){
 ####################
 #### ncatted tests #
 ####################
@@ -230,9 +315,11 @@ print "\n";
 ####################
 
 #ncatted #1
+# ncatted -h -O $nco_D_flg -a units,,m,c,'meter second-1' ~/nco/data/in.nc ~/foo.nc
+# ncks -C -m -v lev ~/foo.nc | grep units | cut -d ' ' -f 11-12
+	$dsc_sng="Modify all existing units attributes to meter second-1";
 	$tst_cmd[0]="ncatted -h -O $nco_D_flg -a units,,m,c,'meter second-1' $in_pth_arg in.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -C -m -v lev %tmp_fl_00% | grep units | cut -d ' ' -f 11-12"; ## daniel:fixme cut/ncks but how to do grep?
-	$dsc_sng="Modify all existing units attributes to meter second-1";
 	$tst_cmd[2]="meter second-1";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
@@ -241,18 +328,18 @@ print "\n";
 #printf("paused @ %s:%d - hit return to continue", __FILE__ , __LINE__); my $wait = <STDIN>;
 
 #ncatted #2
+	$dsc_sng="Change _FillValue attribute from 1.0e36 to 0.0 in netCDF3 file";
 	$tst_cmd[0]="ncatted -h -O $nco_D_flg -a _FillValue,val_one_mss,m,f,0.0 $in_pth_arg in.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -C -H -s '%g' -d lat,1 -v val_one_mss %tmp_fl_00%";
-	$dsc_sng="Change _FillValue attribute from 1.0e36 to 0.0 in netCDF3 file";
 	$tst_cmd[2]="0";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array
 
 #ncatted #3
+	$dsc_sng="Create new _FillValue attribute";
 	$tst_cmd[0]="ncatted -h -O $nco_D_flg -a _FillValue,wgt_one,c,f,200.0 $in_pth_arg in.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -C -H -s '%g' -d lat,1 -v wgt_one %tmp_fl_00%";
-	$dsc_sng="Create new _FillValue attribute";
 	$tst_cmd[2]="1";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
@@ -260,20 +347,23 @@ print "\n";
 
 #ncatted #4
 # Fragile: Test fails when command length changes, e.g., on MACOSX
+	$dsc_sng="Pad header with 1000B extra for future metadata (failure OK/expected since test depends on command-line length)";
 	$tst_cmd[0]="ncatted -O --hdr_pad=1000 $nco_D_flg -a missing_value,val_one_mss,m,f,0.0 $in_pth_arg in.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -M %tmp_fl_00% | grep hdr_pad | wc > %tmp_fl_01%";
 	$tst_cmd[2]="cut -c 14-15 %tmp_fl_01%"; ## Daniel:fxm cut/ncks, but how to do grep and wc???
-	$dsc_sng="Pad header with 1000B extra for future metadata (failure OK/expected since test depends on command-line length)";
 	$tst_cmd[3]="27";
 	$tst_cmd[4]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array
 
 #ncatted #5
+# ncatted -O $nco_D_flg -a nw1,'^three*',c,i,999 ~/nco/data/in.nc ~/foo.nc
+# ncap2 -v -C -O -s 'n2=three_dmn_var_int at nw1;' ~/foo.nc ~/foo1.nc
+# ncks -O -C -H -s '%i' -v n2 ~/foo1.nc
+	$dsc_sng="Variable wildcarding (requires regex)";
 	$tst_cmd[0]="ncatted -O $nco_D_flg -a nw1,'^three*',c,i,999 $in_pth_arg in.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncap2 -v -C -O -s 'n2=three_dmn_var_int\@nw1;' %tmp_fl_00% %tmp_fl_01%";
 	$tst_cmd[2]="ncks -O -C -H -s '%i' -v n2 %tmp_fl_01%";
-	$dsc_sng="Variable wildcarding (requires regex)";
 	$tst_cmd[3]="999";
 	$tst_cmd[4]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
@@ -284,73 +374,87 @@ print "\n";
     #######################################
 
     if($RUN_NETCDF4_TESTS == 1){
-
 #4.3.8	
 #ncatted #6
 #ncatted -O -a purpose,rlev,m,c,new_value in_grp_3.nc ~/foo.nc
+	$dsc_sng="(Groups) Modify attribute for variable (input relative name)";
 	$tst_cmd[0]="ncatted -O $nco_D_flg -a purpose,rlev,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -m -g g3 -v rlev %tmp_fl_00%";
-	$dsc_sng="(Groups) Modify attribute for variable (input relative name)";
 	$tst_cmd[2]="rlev attribute 0: purpose, size = 9 NC_CHAR, value = new_value";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array	
 	
 #ncatted #7	
+	$dsc_sng="(Groups) Modify attribute for variable (input absolute name)";
 	$tst_cmd[0]="ncatted -O $nco_D_flg -a purpose,/g3/rlev,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -m -g g3 -v rlev %tmp_fl_00%";
-	$dsc_sng="(Groups) Modify attribute for variable (input absolute name)";
 	$tst_cmd[2]="rlev attribute 0: purpose, size = 9 NC_CHAR, value = new_value";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array	
 	
 #ncatted #8
+	$dsc_sng="(Groups) Modify attribute for group (input relative name)";
 	$tst_cmd[0]="ncatted -O $nco_D_flg -a g3_group_attribute,group,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -M %tmp_fl_00% | grep g3_group_attribute";
-	$dsc_sng="(Groups) Modify attribute for group (input relative name)";
 	$tst_cmd[2]="Group attribute 0: g3_group_attribute, size = 9 NC_CHAR, value = new_value";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array	
 
 #ncatted #9
+	$dsc_sng="(Groups) Variable wildcarding (requires regex)";
 	$tst_cmd[0]="ncatted -O $nco_D_flg -a nw1,'^three*',c,i,999 $in_pth_arg in_grp.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -m -C -g g10 -v three_dmn_rec_var %tmp_fl_00%";
-	$dsc_sng="(Groups) Variable wildcarding (requires regex)";
 	$tst_cmd[2]="three_dmn_rec_var attribute 1: nw1, size = 1 NC_INT, value = 999";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array	
 
 #ncatted #10
+	$dsc_sng="(Groups) Edit all variables";
 	$tst_cmd[0]="ncatted -O $nco_D_flg -a purpose,,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -m -g g3 -v rlev %tmp_fl_00%";
-	$dsc_sng="(Groups) Edit all variables";
 	$tst_cmd[2]="rlev attribute 0: purpose, size = 9 NC_CHAR, value = new_value";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array
 
 #ncatted #11
-	$tst_cmd[0]="ncatted -O $nco_D_flg -a Conventions,group,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%";
-	$tst_cmd[1]="ncks -M %tmp_fl_00% | grep Conventions";
+# ncatted -h -O -a Conventions,group,m,c,new_value ~/nco/data/in_grp_3.nc ~/foo.nc
+# ncks -M ~/foo.nc | grep Conventions
 	$dsc_sng="(Groups) Modify global attribute";
+	$tst_cmd[0]="ncatted -h -O $nco_D_flg -a Conventions,group,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%";
+	$tst_cmd[1]="ncks -M %tmp_fl_00% | grep Conventions";
 	$tst_cmd[2]="Group attribute 0: Conventions, size = 9 NC_CHAR, value = new_value";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array		
 	
 #ncatted #12
+# ncatted -h -O -a _FillValue,val_one_mss,m,f,0.0 ~/nco/data/in_grp.nc ~/foo.nc
+# ncks -C -H -s '%g' -d lat,1 -v val_one_mss ~/foo.nc
+	$dsc_sng="Change _FillValue attribute from 1.0e36 to 0.0 on netCDF4 file";
 	$tst_cmd[0]="ncatted -h -O $nco_D_flg -a _FillValue,val_one_mss,m,f,0.0 $in_pth_arg in_grp.nc %tmp_fl_00%";
 	$tst_cmd[1]="ncks -C -H -s '%g' -d lat,1 -v val_one_mss %tmp_fl_00%";
-	$dsc_sng="Change _FillValue attribute from 1.0e36 to 0.0 on netCDF4 file";
         ###TODO 665
 	$tst_cmd[2]="0";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array
 
+#ncatted #13
+# ncatted -O -a '.?_att$',att_var,o,i,999 ~/nco/data/in.nc ~/foo.nc
+# ncks -C -m -v att_var ~/foo.nc | grep float_att | cut -d ' ' -f 11
+	$dsc_sng="Attribute wildcarding (requires regex)";
+	$tst_cmd[0]="ncatted -O $nco_D_flg -a '.?_att$\',att_var,o,i,999 $in_pth_arg in.nc %tmp_fl_00%";
+	$tst_cmd[1]="ncks -C -m -v att_var %tmp_fl_00% | grep float_att | cut -d ' ' -f 11";
+	$tst_cmd[2]="999";
+	$tst_cmd[3]="SS_OK";
+	NCO_bm::tst_run(\@tst_cmd);
+	$#tst_cmd=0; # Reset array
+	
     } # $RUN_NETCDF4_TESTS	
 
     } #dodap
@@ -1303,8 +1407,6 @@ print "\n";
     $#tst_cmd=0; # Reset array 			   
 
     }  	#### Group tests
- 
-
     
 ####################
 #### ncks tests #### OK !
@@ -1860,8 +1962,8 @@ print "\n";
     } # endif false
     
 # NCO 4.2.6 tests
-# This version has a major change in the way dimensions are handled; the global array lmt_all was eliminated and replaced
-# with GTT (Group Traversal Table) structures that contain full dimension paths; it needs extensive testing, in special
+# This version has a major change in dimension handling---global array lmt_all was eliminated and replaced
+# with GTT (Group Traversal Table) structures with full dimension paths
 # 1) Limits
 # 2) MSA
 # 3) Chunking
@@ -2111,7 +2213,7 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
 	
-    if($RUN_NETCDF4_TESTS_VERSION_GE_431 == 1){
+if($RUN_NETCDF4_TESTS_VERSION_GE_431){
 
 #ncks #75
 # ncks -O -c ~/nco/data/in_grp.nc ~/foo.nc
@@ -2123,7 +2225,7 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
 
-	} #RUN_NETCDF4_TESTS_VERSION_GE_431
+} #RUN_NETCDF4_TESTS_VERSION_GE_431
 	
 #ncks #76
 # ncks -O ~/nco/data/in_grp.nc ~/foo.nc
@@ -2166,7 +2268,7 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array	
 	
-	if($RUN_NETCDF4_TESTS_VERSION_GE_431 == 1){	
+if($RUN_NETCDF4_TESTS_VERSION_GE_431){	
 	
 #ncks #80
 #ncks -O -4 -L 0 --cnk_min=1 --cnk_dmn lev,1 -v two_dmn_var ~/nco/data/in_grp_7.nc ~/foo.nc
@@ -2238,7 +2340,7 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array  
 
-	} # RUN_NETCDF4_TESTS_VERSION_GE_431
+} # RUN_NETCDF4_TESTS_VERSION_GE_431
 	
 #ncks #86
 #Imposing zero-deflation (-L 0) on contiguous variable uses netCDF-default (not user-specified) sizes.
@@ -2496,7 +2598,7 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
-    if($RUN_NETCDF4_TESTS_VERSION_GE_431 == 1){
+if($RUN_NETCDF4_TESTS_VERSION_GE_431){
 
 #ncks #93
 #ncks -O -D 5 -C -d lat,0 -v one,four --cnk_plc=xst --cnk_map=xst ~/nco/data/hdn.nc ~/foo.nc
@@ -2518,7 +2620,7 @@ print "\n";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
 
-    } # RUN_NETCDF4_TESTS_VERSION_GE_431
+} # RUN_NETCDF4_TESTS_VERSION_GE_431
 	
 #####################
 #### ncpdq tests #### -OK !
@@ -2908,7 +3010,7 @@ print "\n";
     #### Group tests (requires netCDF4) ###
     #######################################
 
-    if($RUN_NETCDF4_TESTS == 1){
+    if($RUN_NETCDF4_TESTS){
 
 #####################
 #### ncpdq GROUP tests 
@@ -3461,7 +3563,7 @@ print "\n";
     #### Group tests (requires netCDF4) ###
     #######################################
 
-    if($RUN_NETCDF4_TESTS == 1){
+    if($RUN_NETCDF4_TESTS){
 	
 #ncrcat #22	
 # same as ncrcat #02 with group
@@ -3544,7 +3646,7 @@ print "\n";
     #### Group tests (requires netCDF4) ###
     #######################################
 
-    if($RUN_NETCDF4_TESTS == 1){
+    if($RUN_NETCDF4_TESTS){
 
 #ncrcat #28
 #ncks -h -O -g g4 -v one_dmn_rec_var ~/nco/data/in_grp.nc in_grp1.nc
@@ -3810,7 +3912,7 @@ print "\n";
     #### Group tests (requires netCDF4) ###
     #######################################
 
-    if($RUN_NETCDF4_TESTS == 1){
+    if($RUN_NETCDF4_TESTS){
 	
 # ncra #23
 # same as ncra #02, for groups
@@ -3923,7 +4025,7 @@ print "\n";
     #### Group tests (requires netCDF4) ###
     #######################################
 
-    if($RUN_NETCDF4_TESTS == 1){
+    if($RUN_NETCDF4_TESTS){
 	
 #NEW 4.4.2	
 #ncra #32
@@ -3957,7 +4059,7 @@ if(0){
 # Test per-file weighting
 # ncra -O -D 6 -w 28,29,30 -n 3,4,1 -p ${HOME}/nco/data h0001.nc ~/foo.nc
 # ncks -C -H -s '%g, ' -v two_dmn_rec_var ~/foo.nc
-    $dsc_sng="Test per-file weighting with --wgt";
+    $dsc_sng="Test per-file weighting with --wgt 28,29,30";
     $tst_cmd[0]="ncra -h -O $fl_fmt $nco_D_flg -w 28,29,30 $in_pth_arg in.nc in.nc in.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -C -H -s '%g, ' -v two_dmn_rec_var %tmp_fl_00%";
     $tst_cmd[2]="1, 2.45, 3,";
@@ -3965,6 +4067,20 @@ if(0){
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array 	
 
+# ncra #35
+# Test per-record weighting
+# ncks -O -C -d time,,1 -v one_dmn_rec_wgt,one_dmn_rec_var_flt -p ${HOME}/nco/data h0001.nc ~/foo.nc
+# ncra -O -D 2 -w one_dmn_rec_wgt -v one_dmn_rec_var_flt ~/foo.nc ~/foo2.nc
+# ncks -C -H -s '%g, ' -v one_dmn_rec_var_flt ~/foo2.nc
+    $dsc_sng="Test per-record weighting with --wgt=one_dmn_rec_wgt";
+    $tst_cmd[0]="ncks -h -O $fl_fmt $nco_D_flg -C -d time,,1 -v one_dmn_rec_wgt,one_dmn_rec_var_flt $in_pth_arg in.nc %tmp_fl_00%";
+    $tst_cmd[1]="ncra -h -O $fl_fmt $nco_D_flg -w one_dmn_rec_wgt -v one_dmn_rec_var_flt %tmp_fl_00% %tmp_fl_01%";
+    $tst_cmd[2]="ncks -C -H -s '%g' -v one_dmn_rec_var_flt %tmp_fl_01%";
+    $tst_cmd[3]="1.33333";
+    $tst_cmd[4]="SS_OK";   
+    NCO_bm::tst_run(\@tst_cmd);
+    $#tst_cmd=0; # Reset array 	
+
 ####################
 #### ncwa tests #### OK!
 ####################
@@ -4312,10 +4428,10 @@ if(0){
     @tst_cmd=(); # Reset array
 
 #ncwa #34
-    $dsc_sng="rms with weights";
-    $tst_cmd[0]="ncwa $omp_flg -h -O $fl_fmt $nco_D_flg -y rms -w lat_wgt -v lat_cpy $in_pth_arg in.nc %tmp_fl_00% 2> %tmp_fl_02%";
+    $dsc_sng="Weights at root group level";
+    $tst_cmd[0]="ncwa $omp_flg -h -O $fl_fmt $nco_D_flg -w lat_wgt -v lat_cpy $in_pth_arg in.nc %tmp_fl_00% 2> %tmp_fl_02%";
     $tst_cmd[1]="ncks -C -H -s '%f' -v lat_cpy %tmp_fl_00%";;
-    $tst_cmd[2]="90";
+    $tst_cmd[2]="30";
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
@@ -4410,7 +4526,7 @@ if(0){
     #### Group tests (requires netCDF4) ###
     #######################################
 
-    if($RUN_NETCDF4_TESTS == 1){
+    if($RUN_NETCDF4_TESTS){
 	
 #ncwa #44
 #NEW NCO 4.3.3
@@ -4462,13 +4578,12 @@ if(0){
 
 #ncwa #47
 #NEW NCO 4.3.3
-#same as #ncwa #33
-# ncwa -h -O -y rms -w lat_wgt -g g20g1 -v lat_cpy ~/nco/data/in_grp_3.nc ~/foo.nc
+# ncwa -h -O -w lat_wgt -g g20g1 -C -v lat_cpy ~/nco/data/in_grp_3.nc ~/foo.nc
 # ncks -C -H -s '%f' -g g20g1 -v lat_cpy ~/foo.nc
-    $dsc_sng="(Groups) rms with weights";
-    $tst_cmd[0]="ncwa $omp_flg -h -O $fl_fmt $nco_D_flg -y rms -w lat_wgt -g g20g1 -v lat_cpy $in_pth_arg in_grp_3.nc %tmp_fl_00% 2> %tmp_fl_02%";
+    $dsc_sng="(Groups) Test weights in group";
+    $tst_cmd[0]="ncwa $omp_flg -h -O $fl_fmt $nco_D_flg -C -w lat_wgt -g g20g1 -v lat_cpy $in_pth_arg in_grp_3.nc %tmp_fl_00% 2> %tmp_fl_02%";
     $tst_cmd[1]="ncks -C -H -s '%f' -g g20g1 -v lat_cpy %tmp_fl_00%";;
-    $tst_cmd[2]="90";
+    $tst_cmd[2]="-90";
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
@@ -4658,7 +4773,7 @@ if(0){
     $#tst_cmd=0; # Reset array
 
 #### Group tests	
-    if($RUN_NETCDF4_TESTS == 1){	
+    if($RUN_NETCDF4_TESTS){	
 
 #NEW 4.4.3	
 #ncwa #63 
@@ -4697,6 +4812,17 @@ if(0){
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
+#ncwa #66
+# ncwa -h -O -C -w one_dmn_rec_wgt -v one_dmn_rec_var_flt ~/nco/data/in.nc ~/foo.nc
+# ncks -C -H -s '%f' -v one_dmn_rec_var_flt ~/foo.nc
+    $dsc_sng="Simple weights";
+    $tst_cmd[0]="ncwa $omp_flg -h -O $fl_fmt $nco_D_flg -C -w one_dmn_rec_wgt -v one_dmn_rec_var_flt $in_pth_arg in.nc %tmp_fl_00% 2> %tmp_fl_02%";
+    $tst_cmd[1]="ncks -C -H -s '%f' -v one_dmn_rec_var_flt %tmp_fl_00%";;
+    $tst_cmd[2]="1.333333";
+    $tst_cmd[3]="SS_OK";
+    NCO_bm::tst_run(\@tst_cmd);
+    $#tst_cmd=0; # Reset array
+
 ####################
 #### ncrename tests #### OK!
 ####################
@@ -4707,7 +4833,7 @@ if(0){
     #### Group tests (requires netCDF4) ###
     #######################################
 
-    if($RUN_NETCDF4_TESTS == 1){
+    if($RUN_NETCDF4_TESTS){
 
 #################### Attributes
 
@@ -4800,7 +4926,7 @@ if(0){
 	
 #################### Dimensions	
 
-   if($RUN_NETCDF4_TESTS_VERSION_GE_431 == 1){
+if($RUN_NETCDF4_TESTS_VERSION_GE_431){
 
 #ncrename #8	
 #ncrename -O -d lat,new_lat ~/nco/data/in_grp.nc ~/foo.nc
@@ -4850,7 +4976,7 @@ if(0){
     NCO_bm::tst_run(\@tst_cmd);
     @tst_cmd=(); # really reset array.	
 
-	} # RUN_NETCDF4_TESTS_VERSION_GE_431 
+} # RUN_NETCDF4_TESTS_VERSION_GE_431 
 
 #ncrename #12
 #ncrename -O -d ./lat_non_existing,new_lat ~/nco/data/in_grp.nc ~/foo.nc
@@ -4931,7 +5057,7 @@ if(0){
 #ncrename -O -g g1,new_g1 ~/nco/data/in_grp.nc ~/foo.nc 
 # relative rename g1 to new_g1
 
-   if($RUN_NETCDF4_TESTS_VERSION_GE_431 == 1){
+if($RUN_NETCDF4_TESTS_VERSION_GE_431){
 
     $dsc_sng="Groups: Relative rename 'g1' to 'new_g1' (expect failure with netCDF < 4.3.1)";
     $tst_cmd[0]="ncrename -O $fl_fmt $nco_D_flg -g g1,new_g1 $in_pth_arg in_grp.nc %tmp_fl_00%";
@@ -4965,7 +5091,7 @@ if(0){
     NCO_bm::tst_run(\@tst_cmd);
     @tst_cmd=(); # really reset array.	
 
-	} # RUN_NETCDF4_TESTS_VERSION_GE_431
+} # RUN_NETCDF4_TESTS_VERSION_GE_431
 
 #ncrename #21	
 #ncrename -O -g .gfoo,new_g1 ~/nco/data/in_grp.nc ~/foo.nc 
@@ -5154,7 +5280,6 @@ if(0){
 ##### net tests #### OK ! (ones that can be done by non-zender)
 ####################
     $opr_nm='net';
-####################
 if(0){ #################  SKIP THESE #####################
 # test 1
     $tst_cmd[0]="/bin/rm -f /tmp/in.nc";
@@ -5166,69 +5291,65 @@ if(0){ #################  SKIP THESE #####################
     $#tst_cmd=0; # Reset array
     
 # test 2
+    $dsc_sng="Secure FTP (SFTP) protocol (requires SFTP access to dust.ess.uci.edu)";
     my $sftp_url="sftp://dust.ess.uci.edu:/home/ftp/pub/zender/nco";
-    if($dust_usr ne ""){ # if we need to connect as another user (hmangalm at esmf -> hjm at dust))
-	$sftp_url =~ s/dust/$dust_usr\@dust/;
-    }
-#sftp://dust.ess.uci.edu:/home/ftp/pub/zender/nco
+    # if we need to connect as another user (hmangalm at esmf -> hjm at dust))
+    if($dust_usr ne ""){$sftp_url =~ s/dust/$dust_usr\@dust/;}
+    #sftp://dust.ess.uci.edu:/home/ftp/pub/zender/nco
     $tst_cmd[0]="/bin/rm -f /tmp/in.nc";
     $tst_cmd[1]="ncks -O $nco_D_flg -v one -p $sftp_url -l /tmp in.nc";
     $tst_cmd[2]="ncks -H $nco_D_flg -s '%e' -v one -l /tmp in.nc";
-    $dsc_sng="Secure FTP (SFTP) protocol (requires SFTP access to dust.ess.uci.edu)";
     $tst_cmd[3]="1.000000e+00";
     $tst_cmd[4]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
 # test 3
-    if($dust_usr ne ""){ # if we need to connect as another user (hmangalm at esmf -> hjm at dust))
-	$pth_rmt_scp_tst=$dust_usr . '@' . $pth_rmt_scp_tst;
-    }
+# if we need to connect as another user (hmangalm at esmf -> hjm at dust))
+    $dsc_sng="SSH protocol (requires authorized SSH/scp access to dust.ess.uci.edu)";
+    if($dust_usr ne ""){$pth_rmt_scp_tst=$dust_usr.'@'.$pth_rmt_scp_tst;}
     $tst_cmd[0]="/bin/rm -f /tmp/in.nc";
     $tst_cmd[1]="ncks -h -O $fl_fmt $nco_D_flg -s '%e' -v one -p $pth_rmt_scp_tst -l /tmp in.nc | tail -1";
-    $dsc_sng="SSH protocol (requires authorized SSH/scp access to dust.ess.uci.edu)";
     $tst_cmd[2]=1;
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
-    $tst_cmd[0]="ncks -C -O -d lon,0 -s '%e' -v lon -p http://www.cdc.noaa.gov/cgi-bin/nph-nc/Datasets/ncep.reanalysis.dailyavgs/surface air.sig995.1975.nc";
     $dsc_sng="OPeNDAP protocol (requires OPeNDAP/DODS-enabled NCO)";
+    $tst_cmd[0]="ncks -C -O -d lon,0 -s '%e' -v lon -p http://www.cdc.noaa.gov/cgi-bin/nph-nc/Datasets/ncep.reanalysis.dailyavgs/surface air.sig995.1975.nc";
     $tst_cmd[1]="0";
     $tst_cmd[2]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
     
     if($USER eq 'zender'){
+	$dsc_sng="Password-protected FTP protocol (requires .netrc-based FTP access to climate.llnl.gov)";
 	$tst_cmd[0]="/bin/rm -f /tmp/etr_A4.SRESA1B_9.CCSM.atmd.2000_cat_2099.nc";
 	$tst_cmd[1]="ncks -h -O $fl_fmt $nco_D_flg -s '%e' -d time,0 -v time -p ftp://climate.llnl.gov//sresa1b/atm/yr/etr/ncar_ccsm3_0/run9 -l /tmp etr_A4.SRESA1B_9.CCSM.atmd.2000_cat_2099.nc";
-	$dsc_sng="Password-protected FTP protocol (requires .netrc-based FTP access to climate.llnl.gov)";
 	$tst_cmd[2]="182.5";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array
 	
+	$dsc_sng="msrcp protocol (requires msrcp and authorized access to NCAR MSS)";
 	$tst_cmd[0]="/bin/rm -f /tmp/in.nc";
 	$tst_cmd[1]="ncks -h -O $fl_fmt $nco_D_flg -v one -p mss:/ZENDER/nc -l /tmp in.nc";
 	$tst_cmd[2]="ncks -C -H -s '%e' -v one %tmp_fl_00%";
-	$dsc_sng="msrcp protocol (requires msrcp and authorized access to NCAR MSS)";
 	$tst_cmd[3]="1";
 	$tst_cmd[4]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array
-	
-    } else { print "WARN: Skipping net tests of mss: and password protected FTP protocol retrieval---user not zender\n";}
+    }else{ print "WARN: Skipping net tests of mss: and password protected FTP protocol retrieval---user not zender\n";}
     
     if($USER eq 'zender' || $USER eq 'hjm'){
+	$dsc_sng="HTTP protocol (requires developers to implement wget in NCO nudge nudge wink wink)";
 	$tst_cmd[0]="/bin/rm -f /tmp/in.nc";
 	$tst_cmd[1]="ncks -h -O $fl_fmt $nco_D_flg -s '%e' -v one -p wget://dust.ess.uci.edu/nco -l /tmp in.nc";
-	$dsc_sng="HTTP protocol (requires developers to implement wget in NCO nudge nudge wink wink)";
  	$tst_cmd[2]="1";
 	$tst_cmd[3]="SS_OK";
 	NCO_bm::tst_run(\@tst_cmd);
 	$#tst_cmd=0; # Reset array
-	
-    } else { print "WARN: Skipping net test wget: protocol retrieval---not implemented yet\n";}
+    }else{ print "WARN: Skipping net test wget: protocol retrieval---not implemented yet\n";}
 } #################  SKIP THESE #####################
     
 } # end of perform_test()
diff --git a/bm/nco_bm.pl b/bm/nco_bm.pl
index 99f7a22..9d7183d 100755
--- a/bm/nco_bm.pl
+++ b/bm/nco_bm.pl
@@ -51,7 +51,7 @@ use vars qw(
 	    $spc_sng $srv_sd %subbenchmarks %success %sym_link @sys_tim_arr
 	    $sys_time %sys_tme $thr_nbr $timed $timestamp $tmp $tmr_app
 	    %totbenchmarks @tst_cmd $tst_fl_mk $tst_fmt $tst_id_sng $tst_idx
-	    %tst_nbr $tw_prt_bm  $udp_rpt $USER $usg %usr_tme %wc_tbl
+	    %tst_nbr $tw_prt_bm $udp_rpt $USER $usg %usr_tme %wc_tbl
 	    $wnt_log $xdat_pth $xpt_dsc
 	    $pfx_cmd $pfx_cmd_crr
 	    );
@@ -66,49 +66,49 @@ for (my $i=0; $i<$arg_nbr; $i++){ $cmd_ln .= "$ARGV[$i] ";}
 my $nvr_data=$ENV{'DATA'} ? $ENV{'DATA'} : '';
 my $nvr_home=$ENV{'HOME'} ? $ENV{'HOME'} : '';
 my $nvr_host=$ENV{'HOST'} ? $ENV{'HOST'} : '';
-$USER = $ENV{'USER'};
-$aix_mpi_nvr_pfx = '';
-$aix_mpi_sgl_nvr_pfx = '';
+$USER=$ENV{'USER'};
+$aix_mpi_nvr_pfx='';
+$aix_mpi_sgl_nvr_pfx='';
 $bch_flg=0; # [flg] Batch behavior
 $bm=0; # [flg] Perform benchmarks
 $rgr=0; # [flg] Perform regression tests
-$caseid = '';
-$dbg_lvl = 0; # [enm] Print tests during execution for debugging
-$dodap = 'FALSE'; # Unless redefined by the command line, it does not get reset
-$dust_usr = '';
-$fl_cnt = 32; # [nbr] Files to process (reduced to 4 if using remote/dap files)
-$fl_fmt = 'classic'; # file format for writing
-$fl_pth = '';
-$gnu_cut = 1;
-$md5 = 0;
-$mpi_fk = 0;
-$mpi_prc = 0; # [flg] Use MPI
-$mpi_upx = '';
-$pfx_mpi = '';
-$nco_D_flg='--mmr_drt'; # Require operators to clean memory before exiting
-$nco_vrs_sng = '';
-$os_sng = '';
+$caseid='';
+$dbg_lvl=0; # [enm] Print tests during execution for debugging
+$dodap='FALSE'; # Unless redefined by the command line, it does not get reset
+$dust_usr='';
+$fl_cnt=32; # [nbr] Files to process (reduced to 4 if using remote/dap files)
+$fl_fmt='classic'; # file format for writing
+$fl_pth='';
+$gnu_cut=1;
+$md5=0;
+$mpi_fk=0;
+$mpi_prc=0; # [flg] Use MPI
+$mpi_upx='';
+$pfx_mpi='';
+$nco_D_flg='--mmr_cln'; # Require operators to clean memory before exiting
+$nco_vrs_sng='';
+$os_sng='';
 $pfx_cmd ='';
 $pfx_cmd_crr='';
-$prsrv_fl = 1;
+$prsrv_fl=1;
 $pth_rmt_scp_tst='dust.ess.uci.edu:/var/www/html/dodsdata';
-$pwd = `pwd`; chomp $pwd;
-$que = 0;
-$srv_sd = "SSNOTSET";
-$thr_nbr = 0; # If not zero, pass explicit threading argument
-$timestamp = `date -u "+%x %R"`; chomp $timestamp;
-$tst_fl_mk = '0';
-$udp_rpt = 0;
-$usg = 0;
-$wnt_log = 0;
-$xdat_pth = ''; # explicit data path; more powerful than $drc_dat
+$pwd=`pwd`; chomp $pwd;
+$que=0;
+$srv_sd="SSNOTSET";
+$thr_nbr=0; # If not zero, pass explicit threading argument
+$timestamp=`date -u "+%x %R"`; chomp $timestamp;
+$tst_fl_mk='0';
+$udp_rpt=0;
+$usg=0;
+$wnt_log=0;
+$xdat_pth=''; # explicit data path; more powerful than $drc_dat
 
 # other inits
-$localhostname = `hostname`; chomp $localhostname;
-$notbodi = 0; # specific for hjm's puny laptop
-my $pfxd = 0;
-if ($localhostname !~ "bodi") {$notbodi = 1} # Spare the poor laptop
-$ARGV = @ARGV;
+$localhostname=`hostname`; chomp $localhostname;
+$notbodi=0; # specific for hjm's puny laptop
+my $pfxd=0;
+if ($localhostname !~ "bodi") {$notbodi=1} # Spare the poor laptop
+$ARGV=@ARGV;
 
 my $iosockfound;
 
@@ -117,8 +117,8 @@ BEGIN{
     unshift @INC,'.';
 } # end BEGIN
 
-BEGIN {eval "use IO::Socket"; $iosockfound = $@ ? 0 : 1}
-#$iosockfound = 0;  # uncomment to simulate not found
+BEGIN {eval "use IO::Socket"; $iosockfound=$@ ? 0 : 1}
+#$iosockfound=0;  # uncomment to simulate not found
 if ($iosockfound == 0) {
     print "\nOoops! IO::Socket module not found - continuing with no udp logging.\n\n";
 } else {
@@ -163,27 +163,27 @@ $rcd=Getopt::Long::Configure('no_ignore_case'); # Turn on case-sensitivity
 	    );
 
 # kill all md5 stuff asap
-# BEGIN {eval "use Digest::MD5"; $md5found = $@ ? 0 : 1}
-# # $md5found = 0;  # uncomment to simulate no MD5
+# BEGIN {eval "use Digest::MD5"; $md5found=$@ ? 0 : 1}
+# # $md5found=0;  # uncomment to simulate no MD5
 # if ($md5 == 1) {
 # 	if ($md5found == 0) {print "\nOoops! Digest::MD5 module not found - continuing with simpler error checking\n\n" ;	}
 # 	else                {print "\tDigest::MD5 ... found.\n";}
 # } else {	print "\tMD5 NOT requested; continuing with ncks checking of single values.\n";}
 
-$fl_nbr = 3; # Maximum number of files in file creation series
+$fl_nbr=3; # Maximum number of files in file creation series
 
-if ($srv_sd eq '') {$srv_sd = 1;}
+if ($srv_sd eq '') {$srv_sd=1;}
 
-my $lcl_vars =  "\n\t \$cmd_ln = $cmd_ln\n";
-$lcl_vars .=    "\t \$caseid = $caseid\n";
-$lcl_vars .=    "\t \$rgr = $rgr\n" ;
-$lcl_vars .=    "\t \$bm = $bm\n" ;
-$lcl_vars .=    "\t \$bch_flg = $bch_flg\n";
-$lcl_vars .=    "\t \$srv_sd = [$srv_sd]\n";
-$lcl_vars .=    "\t \$nvr_data = $nvr_data\n";
-$lcl_vars .=    "\t \$nvr_home = $nvr_home\n";
-$lcl_vars .=    "\t \$nvr_my_bin_dir = $nvr_my_bin_dir\n";
-$lcl_vars .=    "\t \@ENV = @ENV\n";
+my $lcl_vars= "\n\t \$cmd_ln=$cmd_ln\n";
+$lcl_vars .=    "\t \$caseid=$caseid\n";
+$lcl_vars .=    "\t \$rgr=$rgr\n" ;
+$lcl_vars .=    "\t \$bm=$bm\n" ;
+$lcl_vars .=    "\t \$bch_flg=$bch_flg\n";
+$lcl_vars .=    "\t \$srv_sd=[$srv_sd]\n";
+$lcl_vars .=    "\t \$nvr_data=$nvr_data\n";
+$lcl_vars .=    "\t \$nvr_home=$nvr_home\n";
+$lcl_vars .=    "\t \$nvr_my_bin_dir=$nvr_my_bin_dir\n";
+$lcl_vars .=    "\t \@ENV=@ENV\n";
 $lcl_vars .=    "\t \@INC:\n";
 foreach my $subpth (@INC) {$lcl_vars .= "\t   $subpth\n"}
 dbg_msg(1,$lcl_vars); # Print local variables
@@ -208,10 +208,10 @@ if (-e "$ENV{'HOME'}/.ncorc" && -r "$ENV{'HOME'}/.ncorc" && !-z "$ENV{'HOME'}/.n
     while (<RC>){
 	$ln_cnt++;
 	if ($_ !~ /^#/) { # Ignore comments
-	    my $N = my @L = split('=');
+	    my $N=my @L=split('=');
 	    chomp $L[1]; # Eliminate \n, if any
 	    if ($N != 2) {print "ERR: typo in ~/.ncorc file on line $ln_cnt.\nFormat is: 'Name=value'\nIgnoring error for now\n";}
-	    $NCO_RC{$L[0]} = $L[1];
+	    $NCO_RC{$L[0]}=$L[1];
 	}
     }
 }
@@ -228,27 +228,27 @@ if ($srv_sd ne "SSNOTSET" && $dodap ne 'FALSE') {
 if($dodap ne 'FALSE'){$caseid="DAP_DIR";print "\nDAP_DIR set as caseid.\n";}
 
 # Set up some host-specific IDs
-$os_sng = `uname`; chomp $os_sng;
+$os_sng=`uname`; chomp $os_sng;
 
 # Check for user trying to run benchmarks on UCI ESMF interactive node:
 if ($nvr_host =~ /esmf04m/ && $bm) {
     print "\n\nAre you sure you want to run the NCO benchmarks on the interactive node?\n";
     print "Enter 'y' to continue.  Anything else cancels. [Default No]: ";
-    my $tmp = <STDIN>; chomp $tmp;
+    my $tmp=<STDIN>; chomp $tmp;
     if ($tmp !~ /[yY]/) {
-	die "OK - Quitting now.  To run the benchmarks under AIX, modify <NCO_ROOT>/bm/nco_bm.sh (a POE script) \nand 'llsubmit' that script to the loadleveler.\n";
+	die "OK - Quitting now. To run the benchmarks under AIX, modify <NCO_ROOT>/bm/nco_bm.sh (a POE script) \nand 'llsubmit' that script to the loadleveler.\n";
     }
 }
 if ($os_sng =~ /AIX/ && $rgr && $mpi_prc > 0) {
     # set env vars for MPI to run on AIX (not just esmf)
-    $aix_mpi_nvr_pfx = "MP_PROCS=$mpi_prc MP_EUILIB='us' MP_NODES='1'  MP_TASKS_PER_NODE=$mpi_prc MP_RMPOOL='1' ";
-    $aix_mpi_sgl_nvr_pfx = " MP_PROCS=1  MP_RMPOOL=1 ";
+    $aix_mpi_nvr_pfx="MP_PROCS=$mpi_prc MP_EUILIB='us' MP_NODES='1'  MP_TASKS_PER_NODE=$mpi_prc MP_RMPOOL='1' ";
+    $aix_mpi_sgl_nvr_pfx=" MP_PROCS=1  MP_RMPOOL=1 ";
 }
 
 # Check for bad cut on MacOSX
 if ($os_sng =~ /Darwin/){
     print "\nTesting for GNU cut on Darwin..\n";
-    $tmp = `cut --version 2>&1 | grep 'Free Software Foundation'`;
+    $tmp=`cut --version 2>&1 | grep 'Free Software Foundation'`;
     if ($tmp !~ /Free/) {
 	print << 'BADCUT';
 	
@@ -260,8 +260,8 @@ if ($os_sng =~ /Darwin/){
 	  
 	  Hit <Enter> to acknowledge your miserable state of cut kharma.
 BADCUT
-        $tmp = <STDIN>;
-	$gnu_cut = 0;
+        $tmp=<STDIN>;
+	$gnu_cut=0;
     }
 }
 
@@ -274,147 +274,147 @@ if ($mpi_prc > 0 && $mpi_fk) {
 # FXM - hjm still need to figure this out for AIX.
 
 if ($mpi_prc > 0 && $os_sng =~ /inux/) {
-    my $lam_ok = 0;
-    my $mpich_ok = 0;
-    my $myhostname_ip = '';
-    my $myif_ip = '';
+    my $lam_ok=0;
+    my $mpich_ok=0;
+    my $myhostname_ip='';
+    my $myif_ip='';
     # have to check that hostname matches IP number in /etc/hosts for mpd to allow connections correctly;
     # maybe for LAM as well
     dbg_msg(2,"Determining IP and hostname info.\nMay timeout if /etc/hosts, ifconfig, and hostname disagree.");
-    $myhostname_ip = `ping -c1 \`hostname\` |grep PING |cut -d' ' -f 3|cut -d'(' -f2 |cut -d')' -f1`; chomp $myhostname_ip;
-    $myif_ip = `/sbin/ifconfig |grep 'inet addr' |cut -d':' -f2 |cut -d' ' -f1 |grep -v '127.0.0.1' `; chomp $myif_ip;
-    dbg_msg(1,"\$localhostname = $localhostname\n\t     \$myhostname_ip = $myhostname_ip\n\t           \$myif_ip = $myif_ip ");
+    $myhostname_ip=`ping -c1 \`hostname\` |grep PING |cut -d' ' -f 3|cut -d'(' -f2 |cut -d')' -f1`; chomp $myhostname_ip;
+    $myif_ip=`/sbin/ifconfig |grep 'inet addr' |cut -d':' -f2 |cut -d' ' -f1 |grep -v '127.0.0.1' `; chomp $myif_ip;
+    dbg_msg(1,"\$localhostname=$localhostname\n\t     \$myhostname_ip=$myhostname_ip\n\t           \$myif_ip=$myif_ip ");
     if ($myif_ip ne $myhostname_ip) {
 	print "WARN: Your interface IP # ($myif_ip) is different than your \nhostname IP number ($myhostname_ip) that is set in /etc/hosts.\nThe mpd (and maybe lamd) may timeout and fail unless they agree.\n"
 	} else {dbg_msg(1,"Good!  Your interface IP # ($myif_ip) equals your \nhostname IP number ($myhostname_ip). mpd will be happy!")}
 	
 	if (-e '/etc/lam/conf.lamd' && -r '/etc/lam/conf.lamd') {# if you've got a conf.lamd, maybe you're runnning LAM?
-								     my $lamd_usr = `ps aux |grep lamd | grep -v grep | cut -d' ' -f1`;  chomp $lamd_usr; $lamd_usr =~ s/\n/ /g;
-								     dbg_msg(2,"Testing for a running lamd:USER = [$ENV{'USER'}] and \$lamd_usr = [$lamd_usr]");
+								     my $lamd_usr=`ps aux |grep lamd | grep -v grep | cut -d' ' -f1`;  chomp $lamd_usr; $lamd_usr =~ s/\n/ /g;
+								     dbg_msg(2,"Testing for a running lamd:USER=[$ENV{'USER'}] and \$lamd_usr=[$lamd_usr]");
 								     if ( $lamd_usr !~ /$ENV{'USER'}/ )  {
 									 print "\nWARN: You might be trying to run LAM_MPI without a running lamd.\nIf the run fails, try running 'lamboot'\n\n";
 								     } else {
 									 dbg_msg(1,"OK! You seem to be using LAM_MPI and at least one lamd seems to be owned by you");
-									 $lam_ok = 1;
+									 $lam_ok=1;
 								     }
 								 }
-    my $mpd_usr = `ps aux |grep mpd | grep -v grep | cut -d' ' -f1`;
+    my $mpd_usr=`ps aux |grep mpd | grep -v grep | cut -d' ' -f1`;
     $mpd_usr =~ s/\n/ /;
     if ($mpd_usr ne '') { # you might be using the mpich MPI system
-#		my $mpd_usr = `ps aux |grep mpd | grep -v grep | cut -d' ' -f1`;
+#		my $mpd_usr=`ps aux |grep mpd | grep -v grep | cut -d' ' -f1`;
 #		$mpd_usr =~ s/\n/ /;
 #		print "\n\n__ $mpd_usr __\n\n";
-	dbg_msg(2,"Testing for a correctly owned running mpd: USER = [$ENV{'USER'}] and \$mpd_usr = [$mpd_usr]");
-	if ( $mpd_usr !~ /$ENV{'USER'}/ )  {
+	dbg_msg(2,"Testing for a correctly owned running mpd: USER=[$ENV{'USER'}] and \$mpd_usr=[$mpd_usr]");
+	if($mpd_usr !~ /$ENV{'USER'}/){
 	    print "\nWARN: You might be trying to run MPICH without a running mpd.\nIf the run fails, and I can't start an mpd for you, try running 'mpd &' manually\n\n";
 	    # try to start it automatically?
 	} else {
 	    dbg_msg(1,"OK! You seem to be using MPICH and at least one mpd seems to be owned by you.");
-	    $mpich_ok = 1;
+	    $mpich_ok=1;
 	}
     }
     
     if (!$lam_ok && !$mpich_ok) {
 	print "\nWARN: you asked for an MPI run (--mpi_prc=$mpi_prc) but you don't seem to be running either LAM-MPI or MPICH (no running lamd or mpd).\nIf the run fails, you might try running one of those 2 MPI systems.\n";
     }
-    if($mpi_upx ne "") { $mpich_ok = 1; } # force mpi if user supplies prefix
+    if($mpi_upx ne "") { $mpich_ok=1; } # force mpi if user supplies prefix
 }
 
 # Any irrationally exuberant values?
-if ($mpi_prc > 16) {die "\nThe '--mpi_prc' value was set to an irrationally exuberant [$mpi_prc].  Try a lower value\n ";}
-if ($thr_nbr > 16) {die "\nThe '--thr_nbr' value was set to an irrationally exuberant [$thr_nbr].  Try a lower value\n ";}
-if (length($caseid) > 80) {die "\nThe caseid string is > 80 characters - please reduce it to less than 80 chars.\nIt's used to create file and directory names, so it has to be relatively short\n";}
+if($mpi_prc > 16){die "\nThe '--mpi_prc' value was set to an irrationally exuberant [$mpi_prc]. Try a lower value\n";}
+if($thr_nbr > 16){die "\nThe '--thr_nbr' value was set to an irrationally exuberant [$thr_nbr]. Try a lower value\n";}
+if(length($caseid) > 80) {die "\nThe caseid string is > 80 characters - please reduce it to less than 80 chars.\nIt's used to create file and directory names, so it has to be relatively short\n";}
 
 # Slurp in data for checksum hashes
-if ($md5 == 1) {	do "nco_bm_md5wc_tbl.pl" or die "Can't find the validation data (nco_bm_md5wc_tbl.pl).\n";}
+if($md5 == 1){do "nco_bm_md5wc_tbl.pl" or die "Can't find the validation data (nco_bm_md5wc_tbl.pl).\n";}
 
 $nco_D_flg.=" -D $dbg_lvl";
-dbg_msg(1,"WARN: Setting --debug to > 0 sets the NCO\n command-line -D flag to the same value.\n  This causes some tests to fail.\n  It is currently set to \$nco_D_flg = $nco_D_flg");
+dbg_msg(1,"WARN: Setting --debug to > 0 sets the NCO\n command-line -D flag to the same value.\n  This causes some tests to fail.\n  It is currently set to \$nco_D_flg=$nco_D_flg");
 
 # Determine where $DATA should be, prompt user if necessary
-if ($xdat_pth eq '') {
-    dbg_msg(2, "$prg_nm: Calling drc_dat_set()");
+if($xdat_pth eq ''){
+    dbg_msg(2,"$prg_nm: Calling drc_dat_set()");
     drc_dat_set($caseid); # Set $drc_dat
 }else{ # Validate $xdat_pth
-    if (-e $xdat_pth && -w $xdat_pth){
+    if(-e $xdat_pth && -w $xdat_pth){
 	dbg_msg(1,"User-specified DATA path ($xdat_pth) exists and is writable");
-	$drc_dat = $xdat_pth; # and assign it to previously coded variable
+	$drc_dat=$xdat_pth; # and assign it to previously coded variable
     }else{
 	die "FATAL(bm): The directory you specified on the commandline ($xdat_pth) does not exist or is not writable by you.\n";
     }
 }
 
 # Set $fl_pth to reasonable defalt
-$fl_pth = "$drc_dat";
+$fl_pth="$drc_dat";
 
 # Initialize & set up some variables
-dbg_msg(3, "Calling bm_ntl().");
+dbg_msg(3,"Calling bm_ntl()");
 bm_ntl($bch_flg,$dbg_lvl);
 
 # Use variables for file names in regressions; some of these could be collapsed into
 # fewer ones, no doubt, but keep them separate until whole shebang starts working correctly
-# $fl_out        = "$drc_dat/foo.nc"; # replaces fl_out in tests, typically 'foo.nc'
-# $fl_out_rgn    = "$drc_dat/foo.nc";
-# $foo_fl        = "$drc_dat/foo";
-# $foo_avg_fl    = "$drc_dat/foo_avg.nc";
-# $foo_tst       = "$drc_dat/foo.tst";
-# $foo1_fl       = "$drc_dat/foo1.nc";
-# $foo2_fl       = "$drc_dat/foo2.nc";
-# $foo_x_fl      = "$drc_dat/foo_x.nc";
-# $foo_y_fl      = "$drc_dat/foo_y.nc";
-# $foo_xy_fl     = "$drc_dat/foo_xy.nc";
-# $foo_yx_fl     = "$drc_dat/foo_yx.nc";
-# $foo_xymyx_fl  = "$drc_dat/foo_xymyx.nc";
-# $foo_T42_fl    = "$drc_dat/foo_T42.nc";
+# $fl_out       ="$drc_dat/foo.nc"; # replaces fl_out in tests, typically 'foo.nc'
+# $fl_out_rgn   ="$drc_dat/foo.nc";
+# $foo_fl       ="$drc_dat/foo";
+# $foo_avg_fl   ="$drc_dat/foo_avg.nc";
+# $foo_tst      ="$drc_dat/foo.tst";
+# $foo1_fl      ="$drc_dat/foo1.nc";
+# $foo2_fl      ="$drc_dat/foo2.nc";
+# $foo_x_fl     ="$drc_dat/foo_x.nc";
+# $foo_y_fl     ="$drc_dat/foo_y.nc";
+# $foo_xy_fl    ="$drc_dat/foo_xy.nc";
+# $foo_yx_fl    ="$drc_dat/foo_yx.nc";
+# $foo_xymyx_fl ="$drc_dat/foo_xymyx.nc";
+# $foo_T42_fl   ="$drc_dat/foo_T42.nc";
 
 # NCO_bm defined here to allow above variables to be defined for later use
 use NCO_bm; # Benchmarking functions
 
 # UDP server
-$server_name = "sand.ess.uci.edu";  #change this to dust.ess.uci.edu?
-$server_ip = "128.200.14.132";
-$server_port = 29659;
+$server_name="sand.ess.uci.edu";  #change this to dust.ess.uci.edu?
+$server_ip="128.200.14.132";
+$server_port=29659;
 
 if($usg){bm_usg()};
 if(0){tst_tm_hrz();} # Test hires timer - needs explicit code mod to do this
 
 if($iosockfound){
-    $sock = IO::Socket::INET->new (
+    $sock=IO::Socket::INET->new(
 				   Proto    => 'udp',
 				   PeerAddr => $server_ip,
 				   PeerPort => $server_port
 				   ) or print "\nCannot get socket - continuing anyway.\n"; # if off network..
-}else{$udp_rpt = 0;}
+}else{$udp_rpt=0;}
 
 # Initialize bm directory
-# $bm_drc = `pwd`; chomp $bm_drc;
-$bm_drc = "../bm"; 
-if ($wnt_log) {
+# $bm_drc=`pwd`; chomp $bm_drc;
+$bm_drc="../bm"; 
+if($wnt_log){
     open(LOG, ">$bm_drc/nco_bm.log") or die "\nUnable to open log file '$bm_drc/nco_bm.log' - check permissions on it\nor the directory you are in.\n stopped";
 }
 
 # Pass explicit threading argument
-if ($thr_nbr > 0){$omp_flg="--thr_nbr=$thr_nbr";}else{$omp_flg='';}
+if($thr_nbr > 0){$omp_flg="--thr_nbr=$thr_nbr";}else{$omp_flg='';}
 
 # does dodap require that we ignore both MPI and OpenMP?  Let's leave it in for now.
 # If dodap is not set then test with local files
 # If dodap is set and string is NULL, then test with OPeNDAP files on sand.ess.uci.edu
 # If string is NOT NULL, use URL to grab files
 
-dbg_msg(4, "before dodap assignment, \$fl_pth = $fl_pth, \$dodap = $dodap");
+dbg_msg(4, "before dodap assignment, \$fl_pth=$fl_pth, \$dodap=$dodap");
 # $dodap asks for and if defined, carries, the URL that's inserted in the '-p' place in nco command lines
-if ($dodap ne 'FALSE') {
-    if ($dodap eq '') {
-	$fl_pth = "http://dust.ess.uci.edu/cgi-bin/dods/nph-dods/dodsdata";
-	$fl_cnt = 4;
-    }elsif ($dodap =~ /http/){
-	$fl_pth = $dodap;
-	$fl_cnt = 4;
+if($dodap ne 'FALSE'){
+    if($dodap eq ''){
+	$fl_pth="http://dust.ess.uci.edu/cgi-bin/dods/nph-dods/dodsdata";
+	$fl_cnt=4;
+    }elsif($dodap =~ /http/){
+	$fl_pth=$dodap;
+	$fl_cnt=4;
     }else{
 	die "\nThe URL specified with the --dods option:\n $dodap \ndoesn't look like a valid URL.\nTry again\n\n";
     }
 }
-dbg_msg(3, "after dodap assignment, \$fl_pth = $fl_pth, \$dodap = $dodap");
+dbg_msg(3, "after dodap assignment, \$fl_pth=$fl_pth, \$dodap=$dodap");
 
 # Initialize & set up some variables
 #if($dbg_lvl > 0){printf ("$prg_nm: Calling bm_ntl()...\n");}
@@ -422,15 +422,15 @@ dbg_msg(3, "after dodap assignment, \$fl_pth = $fl_pth, \$dodap = $dodap");
 
 # Grok /usr/bin/time, as in shell scripts
 if(-e "/usr/bin/time" && -x "/usr/bin/time"){
-    $tmr_app = "/usr/bin/time ";
+    $tmr_app="/usr/bin/time ";
     if(`uname` =~ "inux"){$tmr_app.="-p ";}
 }else{ # just use whatever the shell thinks is the time app
-    $tmr_app = "time "; # bash builtin or other 'time'-like application (AIX)
+    $tmr_app="time "; # bash builtin or other 'time'-like application (AIX)
 } # endif time
 
 if($dbg_lvl > 1){
     print "\nAbout to begin requested tests; waiting for keypress to proceed.\n";
-    my $tmp = <STDIN>;
+    my $tmp=<STDIN>;
 }
 
 # Regression tests
@@ -453,36 +453,36 @@ if($tst_fl_mk ne '0' || ($bm && $dodap eq 'FALSE')){
 # If so, skip file creation if not requested
 if ($bm && $tst_fl_mk eq '0' && $dodap eq 'FALSE'){
     if ($dbg_lvl> 0){print "\nINFO: File creation tests:\n";}
-    for (my $fl_idx = 0; $fl_idx < $fl_nbr; $fl_idx++){
-	my $fl = $fl_mtd_sct[$fl_idx][2].'.nc'; # file root name stored in $fl_mtd_sct[$fl_idx][2]
+    for (my $fl_idx=0; $fl_idx < $fl_nbr; $fl_idx++){
+	my $fl=$fl_mtd_sct[$fl_idx][2].'.nc'; # file root name stored in $fl_mtd_sct[$fl_idx][2]
 	print "Testing for $drc_dat/$fl...\n";
-	if (-e "$drc_dat/$fl" && -r "$drc_dat/$fl") {
-	    if ($dbg_lvl> 0){printf ("%50s exists - can skip creation\n", $drc_dat . "/" . $fl);}
-	} else {
-	    my $e = $fl_idx+1;
+	if(-e "$drc_dat/$fl" && -r "$drc_dat/$fl"){
+	    if($dbg_lvl> 0){printf ("%50s exists - can skip creation\n",$drc_dat."/".$fl);}
+	}else{
+	    my $e=$fl_idx+1;
 	    $tst_fl_mk .= "$e";
 	}
     }
 }
 
-#	print "DEBUG:  in nco_bm.pl, \$fl_tmg[1][0] = $fl_tmg[1][0] & \$fl_nbr = $fl_nbr\n";
+#	print "DEBUG:  in nco_bm.pl, \$fl_tmg[1][0]=$fl_tmg[1][0] & \$fl_nbr=$fl_nbr\n";
 
 # file creation tests
 if ($tst_fl_mk ne '0' || $srv_sd ne "SSNOTSET"){
-    my $fc = 0; $prsrv_fl = 1;
+    my $fc=0; $prsrv_fl=1;
     if ($tst_fl_mk =~ "[Aa]"){$tst_fl_mk="123";}
     if ($tst_fl_mk =~ /1/){@fl_tmg=NCO_bm::fl_mk(0);$fc++;}
     if ($tst_fl_mk =~ /2/){@fl_tmg=NCO_bm::fl_mk(1);$fc++;}
     if ($tst_fl_mk =~ /3/){@fl_tmg=NCO_bm::fl_mk(2);$fc++;}
-    if ($notbodi && $tst_fl_mk =~ /4/){@fl_tmg = NCO_bm::fl_mk(3); $fc++;} # csz: broken
+    if ($notbodi && $tst_fl_mk =~ /4/){@fl_tmg=NCO_bm::fl_mk(3); $fc++;} # csz: broken
     if ($fc > 0){NCO_bm::rsl_smr_fl_mk(@fl_tmg); } # Print and UDPreport creation times
 }
 
 my $doit=1; # for skipping various tests (fxm: can we delete this? -dw)
 use NCO_benchmarks; #module that contains the actual benchmark code
 # and now, the REAL benchmarks, set up as the regression tests below to use tst_run() and rsl_smr_rgr()
-#print "DEBUG: prior to benchmark call, dodap = $dodap\n";
+#print "DEBUG: prior to benchmark call, dodap=$dodap\n";
 #print "in main(),just priior to the benchmarks \$mpi_prc=[$mpi_prc] \$pfx_mpi=[$pfx_mpi] \$mpi_fk=[$mpi_fk]\n";
 
-if ($bm) { NCO_benchmarks::benchmarks(); }
+if($bm){NCO_benchmarks::benchmarks();}
 
diff --git a/configure b/configure
index 2ce4e5f..d6eb03a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for NCO netCDF Operators 4.5.0.
+# Generated by GNU Autoconf 2.69 for NCO netCDF Operators 4.5.1.
 #
 # Report bugs to <nco-bugs at lists.sourceforge.net>.
 #
@@ -592,8 +592,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='NCO netCDF Operators'
 PACKAGE_TARNAME='nco'
-PACKAGE_VERSION='4.5.0'
-PACKAGE_STRING='NCO netCDF Operators 4.5.0'
+PACKAGE_VERSION='4.5.1'
+PACKAGE_STRING='NCO netCDF Operators 4.5.1'
 PACKAGE_BUGREPORT='nco-bugs at lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -1392,7 +1392,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures NCO netCDF Operators 4.5.0 to adapt to many kinds of systems.
+\`configure' configures NCO netCDF Operators 4.5.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1463,7 +1463,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of NCO netCDF Operators 4.5.0:";;
+     short | recursive ) echo "Configuration of NCO netCDF Operators 4.5.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1626,7 +1626,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-NCO netCDF Operators configure 4.5.0
+NCO netCDF Operators configure 4.5.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2492,7 +2492,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by NCO netCDF Operators $as_me 4.5.0, which was
+It was created by NCO netCDF Operators $as_me 4.5.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3255,7 +3255,7 @@ fi
 # End pvmgetarch Compatibility
 
 # Use automake to create Makefiles
-am__api_version='1.14'
+am__api_version='1.15'
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -3427,8 +3427,8 @@ test "$program_suffix" != NONE &&
 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
 program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 if test x"${MISSING+set}" != xset; then
   case $am_aux_dir in
@@ -3447,7 +3447,7 @@ else
 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
 fi
 
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
   case $am_aux_dir in
   *\ * | *\	*)
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -3741,7 +3741,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='nco'
- VERSION='4.5.0'
+ VERSION='4.5.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3775,8 +3775,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 mkdir_p='$(MKDIR_P)'
 
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 # Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AMTAR='$${TAR-tar}'
@@ -3833,6 +3833,7 @@ END
     as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
   fi
 fi
+
 #AM_INIT_AUTOMAKE(nco,"${nco_version}")
 
 # Put preprocessor symbols in config.h
@@ -19944,17 +19945,22 @@ _ACEOF
 
 fi
 
-    if test "${UDUNITS2_PATH}"; then
-	# Add ${UDUNITS2_PATH}/lib to search path if present
-	nco_udunits2_xml=${UDUNITS2_PATH}/share/udunits/udunits2.xml
-	LDFLAGS="${LDFLAGS} -L${UDUNITS2_PATH}/lib"
-	CPPFLAGS="${CPPFLAGS} -I${UDUNITS2_PATH}/include"
+    if test "${UDUNITS2_PATH}" != ''; then
+	if test -d "${UDUNITS2_PATH}"; then
+	    # NB: Use ${UDUNITS2_PATH} not ${UDUNITS2_ROOT} because UDUnits software looks for ${UDUNITS2_PATH}
+	    # Add ${UDUNITS2_PATH}/lib to search path if present
+	    nco_udunits2_xml=${UDUNITS2_PATH}/share/udunits/udunits2.xml
+	    LDFLAGS="${LDFLAGS} -L${UDUNITS2_PATH}/lib"
+	    CPPFLAGS="${CPPFLAGS} -I${UDUNITS2_PATH}/include"
+	else
+	    echo "WARNING: UDUNITS2_PATH location \"${UDUNITS2_PATH}\" does not exist!"
+	fi
     elif test "${NETCDF_INC}"; then
 	nco_udunits2_xml="${NETCDF_INC}/../share/udunits/udunits2.xml"
     else
 	# NO UDUNITS2_PATH section
-	#Fedora 1.7 has /usr/include/udunits2/udunits2.h
-	#add this path to CPPFLAGS if it exists, otherwise do nothing
+	# Fedora 1.7 has /usr/include/udunits2/udunits2.h
+	# Add this path to CPPFLAGS if it exists, otherwise do nothing
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/include/udunits2/udunits2.h" >&5
 $as_echo_n "checking for /usr/include/udunits2/udunits2.h... " >&6; }
 if ${ac_cv_file__usr_include_udunits2_udunits2_h+:} false; then :
@@ -19974,10 +19980,10 @@ if test "x$ac_cv_file__usr_include_udunits2_udunits2_h" = xyes; then :
   CPPFLAGS="$CPPFLAGS -I/usr/include/udunits2"
 fi
 
-	#Ubuntu
-	#/usr/lib/x86_64-linux-gnu/libudunits2.a
-	#/usr/lib/i386-linux-gnu/libudunits2.a
-	#/usr/include/udunits2.h
+	# Ubuntu
+	# /usr/lib/x86_64-linux-gnu/libudunits2.a
+	# /usr/lib/i386-linux-gnu/libudunits2.a
+	# /usr/include/udunits2.h
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/include/udunits2.h" >&5
 $as_echo_n "checking for /usr/include/udunits2.h... " >&6; }
 if ${ac_cv_file__usr_include_udunits2_h+:} false; then :
@@ -20035,15 +20041,15 @@ if test "x$ac_cv_file__usr_lib_i386_linux_gnu_libudunits2_a" = xyes; then :
   LDFLAGS="$LDFLAGS -L/usr/lib/i386-linux-gnu"
 fi
 
-	#Mac OSX MacPorts packages
-	#sudo port install libdap
-	#sudo port install gsl
-	#sudo port install antlr
-	#sudo port install udunits2
-	#sudo port install netcdf
-	#installs to /opt/local/include/udunits2/udunits2.h
-	#/opt/local/share/udunits/udunits2.xml
-	#add this path to CPPFLAGS if it exists, otherwise do nothing
+	# Mac OSX MacPorts packages
+	# sudo port install libdap
+	# sudo port install gsl
+	# sudo port install antlr
+	# sudo port install udunits2
+	# sudo port install netcdf
+	# installs to /opt/local/include/udunits2/udunits2.h
+	# /opt/local/share/udunits/udunits2.xml
+	# Add this path to CPPFLAGS if it exists, otherwise do nothing
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /opt/local/include/udunits2/udunits2.h" >&5
 $as_echo_n "checking for /opt/local/include/udunits2/udunits2.h... " >&6; }
 if ${ac_cv_file__opt_local_include_udunits2_udunits2_h+:} false; then :
@@ -21420,7 +21426,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by NCO netCDF Operators $as_me 4.5.0, which was
+This file was extended by NCO netCDF Operators $as_me 4.5.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21486,7 +21492,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-NCO netCDF Operators config.status 4.5.0
+NCO netCDF Operators config.status 4.5.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 2f7408f..e773e9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,7 +51,7 @@
 
 # Process configure input with autoconf to produce configure script
 # (package name,version,bug-report-address,tarball name)
-AC_INIT([NCO netCDF Operators],[4.5.0],[nco-bugs at lists.sourceforge.net],[nco])
+AC_INIT([NCO netCDF Operators],[4.5.1],[nco-bugs at lists.sourceforge.net],[nco])
 
 # Print GNU copyright in configure script
 AC_COPYRIGHT
@@ -709,34 +709,39 @@ fi # End test for UDUnits duplication
 # Check for UDUnits2 libraries unless told not to
 if test "${enable_udunits2}" != 'no'; then
     AC_CHECK_LIB([expat],[XML_ParserCreate],,)
-    if test "${UDUNITS2_PATH}"; then
-	# Add ${UDUNITS2_PATH}/lib to search path if present
-	nco_udunits2_xml=${UDUNITS2_PATH}/share/udunits/udunits2.xml
-	LDFLAGS="${LDFLAGS} -L${UDUNITS2_PATH}/lib"
-	CPPFLAGS="${CPPFLAGS} -I${UDUNITS2_PATH}/include"
+    if test "${UDUNITS2_PATH}" != ''; then
+	if test -d "${UDUNITS2_PATH}"; then
+	    # NB: Use ${UDUNITS2_PATH} not ${UDUNITS2_ROOT} because UDUnits software looks for ${UDUNITS2_PATH}
+	    # Add ${UDUNITS2_PATH}/lib to search path if present
+	    nco_udunits2_xml=${UDUNITS2_PATH}/share/udunits/udunits2.xml
+	    LDFLAGS="${LDFLAGS} -L${UDUNITS2_PATH}/lib"
+	    CPPFLAGS="${CPPFLAGS} -I${UDUNITS2_PATH}/include"
+	else
+	    echo "WARNING: UDUNITS2_PATH location \"${UDUNITS2_PATH}\" does not exist!"
+	fi
     elif test "${NETCDF_INC}"; then
 	nco_udunits2_xml="${NETCDF_INC}/../share/udunits/udunits2.xml"
     else
 	# NO UDUNITS2_PATH section
-	#Fedora 1.7 has /usr/include/udunits2/udunits2.h
-	#add this path to CPPFLAGS if it exists, otherwise do nothing
+	# Fedora 1.7 has /usr/include/udunits2/udunits2.h
+	# Add this path to CPPFLAGS if it exists, otherwise do nothing
 	AC_CHECK_FILE([/usr/include/udunits2/udunits2.h], [CPPFLAGS="$CPPFLAGS -I/usr/include/udunits2"], [])
-	#Ubuntu
-	#/usr/lib/x86_64-linux-gnu/libudunits2.a
-	#/usr/lib/i386-linux-gnu/libudunits2.a
-	#/usr/include/udunits2.h
+	# Ubuntu
+	# /usr/lib/x86_64-linux-gnu/libudunits2.a
+	# /usr/lib/i386-linux-gnu/libudunits2.a
+	# /usr/include/udunits2.h
 	AC_CHECK_FILE([/usr/include/udunits2.h], [CPPFLAGS="$CPPFLAGS -I/usr/include"], [])
 	AC_CHECK_FILE([/usr/lib/x86_64-linux-gnu/libudunits2.a], [LDFLAGS="$LDFLAGS -L/usr/lib/x86_64-linux-gnu"], [])
 	AC_CHECK_FILE([/usr/lib/i386-linux-gnu/libudunits2.a], [LDFLAGS="$LDFLAGS -L/usr/lib/i386-linux-gnu"], [])
-	#Mac OSX MacPorts packages
-	#sudo port install libdap
-	#sudo port install gsl
-	#sudo port install antlr
-	#sudo port install udunits2
-	#sudo port install netcdf
-	#installs to /opt/local/include/udunits2/udunits2.h
-	#/opt/local/share/udunits/udunits2.xml
-	#add this path to CPPFLAGS if it exists, otherwise do nothing
+	# Mac OSX MacPorts packages
+	# sudo port install libdap
+	# sudo port install gsl
+	# sudo port install antlr
+	# sudo port install udunits2
+	# sudo port install netcdf
+	# installs to /opt/local/include/udunits2/udunits2.h
+	# /opt/local/share/udunits/udunits2.xml
+	# Add this path to CPPFLAGS if it exists, otherwise do nothing
 	AC_CHECK_FILE([/opt/local/include/udunits2/udunits2.h], [CPPFLAGS="$CPPFLAGS -I/opt/local/include/udunits2"], [])
 	#/opt/local/lib/libudunits2.a
 	AC_CHECK_FILE([/opt/local/lib/libudunits2.a], [LDFLAGS="$LDFLAGS -L/opt/local/lib/"], [])
diff --git a/configure.eg b/configure.eg
index 0252c36..05c97bc 100644
--- a/configure.eg
+++ b/configure.eg
@@ -257,6 +257,17 @@ make check >> nco.make.${GNU_TRP}.foo 2>&1
 make install >> nco.make.${GNU_TRP}.foo 2>&1
 scp nco.configure.${GNU_TRP}.foo nco.config.log.${GNU_TRP}.foo nco.libtool.${GNU_TRP}.foo nco.make.${GNU_TRP}.foo dust.ess.uci.edu:/var/www/html/nco/rgr
 
+# gcc/g++ Zender uses this to develop/install/update netCDF4-enabled NCO in personal directories on cooley:
+export GNU_TRP=`~/nco/autobld/config.guess`
+cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
+ANTLR_ROOT=${HOME} CC='gcc' CXX='g++' NETCDF_ROOT='/soft/libraries/unsupported/netcdf-4.3.2' UDUNITS2_PATH=${HOME} ./configure --prefix=${HOME} --bindir=${MY_BIN_DIR} --datadir=${HOME}/nco/data --libdir=${MY_LIB_DIR} --mandir=${HOME}/nco/man > nco.configure.${GNU_TRP}.foo 2>&1
+/bin/cp -f config.log nco.config.log.${GNU_TRP}.foo
+/bin/cp -f libtool nco.libtool.${GNU_TRP}.foo
+make clean;make > nco.make.${GNU_TRP}.foo 2>&1
+make check >> nco.make.${GNU_TRP}.foo 2>&1
+make install >> nco.make.${GNU_TRP}.foo 2>&1
+scp nco.configure.${GNU_TRP}.foo nco.config.log.${GNU_TRP}.foo nco.libtool.${GNU_TRP}.foo nco.make.${GNU_TRP}.foo dust.ess.uci.edu:/var/www/html/nco/rgr
+
 # icc/icpc Zender uses this to develop/install/update netCDF4-enabled NCO in personal directories on rhea:
 export GNU_TRP=`~/nco/autobld/config.guess`
 # Commands used for Makefile builds
@@ -622,7 +633,7 @@ gcc/g++:
 export PVM_ARCH=`~/nco/bld/pvmgetarch`
 export GNU_TRP=`~/nco/autobld/config.guess`
 cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
-NETCDF_INC=${HOME}/include NETCDF_LIB=${HOME}/lib/${PVM_ARCH} ./configure --disable-regex --disable-shared --prefix=${HOME} --bindir=${HOME}/bin/${PVM_ARCH} --datadir=${HOME}/nco/data --libdir=${HOME}/lib/${PVM_ARCH} --mandir=${HOME}/nco/man > nco.configure.${GNU_TRP}.foo 2>&1
+NETCDF_INC=${HOME}/include NETCDF_LIB=${HOME}/lib ./configure --disable-regex --disable-shared --prefix=${HOME} --bindir=${HOME}/bin --datadir=${HOME}/nco/data --libdir=${HOME}/lib --mandir=${HOME}/nco/man > nco.configure.${GNU_TRP}.foo 2>&1
 /bin/cp -f config.log nco.config.log.${GNU_TRP}.foo
 make clean;make > nco.make.${GNU_TRP}.foo 2>&1
 make check >> nco.make.${GNU_TRP}.foo 2>&1
diff --git a/data/Makefile.in b/data/Makefile.in
index e0af41c..39075d7 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
 
 # $Header$ -*-makefile-*-
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -81,8 +91,6 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = data
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/autobld/mkinstalldirs
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -90,6 +98,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
@@ -114,6 +123,8 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+	$(top_srcdir)/autobld/mkinstalldirs
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -288,7 +299,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign data/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -466,6 +476,8 @@ uninstall-am:
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags-am uninstall uninstall-am
 
+.PRECIOUS: Makefile
+
 
 # netCDF build rules
 %.nc : %.cdl
diff --git a/data/in.cdl b/data/in.cdl
index 0b6d2a7..6a29c68 100644
--- a/data/in.cdl
+++ b/data/in.cdl
@@ -66,7 +66,7 @@ dimensions:
   dgn=1,bnd=2,lat=2,lat_grd=3,lev=3,rlev=3,lon=4,lon_grd=5,char_dmn_lng80=80,char_dmn_lng26=26,char_dmn_lng04=4,date_dmn=5,fl_dmn=3,lsmlev=6,wvl=2,time_udunits=3;lon_T42=128,lat_T42=64,lat_times_lon=8,gds_crd=8,gds_ncd=8,vrt_nbr=2,lon_cal=10,lat_cal=10,Lon=4,Lat=2,time=unlimited;
 variables:
   :Conventions = "CF-1.5";
-  :history = "History global attribute.\nTextual attributes like history often have embedded newlines like this.\nSuch newlines should serve as linebreaks on the screen to enhance legibility like this.\nFriendly CDL converters print a single NC_CHAR attribute as a comma-separated list of strings where each embedded delimiter marks a linebreak.\nThis makes poetry embedded in CDL much nicer to read:\nA POET by Hafiz\n\nA poet is someone\nWho can pour light into a cup,\nThen raise it to nou [...]
+  :history = "History global attribute.\nTextual attributes like history often have embedded newlines like this.\nSuch newlines should serve as linebreaks on the screen to enhance legibility like this.\nFriendly CDL converters print a single NC_CHAR attribute as a comma-separated list of strings where each embedded delimiter marks a linebreak. This makes poetry embedded in CDL much nicer to read:\n\nA POET by Hafiz\n\nA poet is someone\nWho can pour light into a cup,\nThen raise it to no [...]
   :lorem_ipsum = "The Lorem Ipsum attribute demonstrates the legibility of text without embedded linebreaks:\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lady Gaga amat indueris vestimento laetus. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Exce [...]
   :julian_day = 200000.04;
   :RCS_Header = "$Header$";
diff --git a/data/in_grp_3.cdl b/data/in_grp_3.cdl
index 8801e69..86cbd5c 100644
--- a/data/in_grp_3.cdl
+++ b/data/in_grp_3.cdl
@@ -422,16 +422,18 @@ netcdf in_grp_3 {
    lat=2;
    variables:
    float lat(lat);
+   float lat_wgt(lat);
    data:
    lat=-90,90;
+   lat_wgt=1.,2.;
    
     group: g20g1 { 
      variables:
      float lat_cpy(lat);
-	 float lat_wgt(lat);
+     float lat_wgt(lat);
      data:
      lat_cpy=-90,90;
-	 lat_wgt=1.,2.;   
+     lat_wgt=1.,0.;
     } // end g20g1 
 
   } //g20
diff --git a/data/ncap2.in b/data/ncap2.in
index 01f27f1..c887416 100644
--- a/data/ncap2.in
+++ b/data/ncap2.in
@@ -4,8 +4,7 @@
 
 /* Usage: 
    ncap2 -O -v -S ~/nco/data/ncap2.in ~/nco/data/in.nc ~/foo.nc
-   ncks ~/foo.nc | /bin/more
-*/
+   ncks ~/foo.nc | /bin/more */
 
 a1=three_dmn_var_dbl+three_dmn_var_int;
 a2=sin(three_dmn_var_dbl)^2.0 + cos(three_dmn_var_dbl)^2.0;
@@ -229,5 +228,3 @@ m3=m1.reverse($lon);
 // record dim must be the first dim in list
 m4=m1.permute($0,$2,$1);
 m5=a22.permute($time,$lev,$lon,$lat);
-
-
diff --git a/debian/changelog b/debian/changelog
index 22525f6..3467b93 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+nco (4.5.2-1) unstable; urgency=low
+
+  * new upstream version fxm
+
+ -- Charlie Zender <zender at uci.edu>  Fri, 24 Jul 2014 12:25:10 -0700
+
+nco (4.5.1-1) unstable; urgency=low
+
+  * new upstream version ncra --wgt=wgt_nm, ncap2 mibs/mabs/mebs, Tempest
+
+ -- Charlie Zender <zender at uci.edu>  Fri, 10 Jul 2014 12:25:09 -0700
+
 nco (4.5.0-1) unstable; urgency=low
 
   * new upstream version --map, --rnr=wgt, -A provenance, [date/time]_written, ncdismember
diff --git a/doc/ANNOUNCE b/doc/ANNOUNCE
index 2ac29db..d2571ef 100644
--- a/doc/ANNOUNCE
+++ b/doc/ANNOUNCE
@@ -1,88 +1,93 @@
 $Header$ -*-text-*-
 
-The netCDF Operators NCO version 4.5.0 are ready. 
+The netCDF Operators NCO version 4.5.1 are ready. 
 
 http://nco.sf.net (Homepage)
 http://dust.ess.uci.edu/nco (Homepage "mirror")
 
-This is the first NCO release that supports regridding datasets,
-currently limited to global datasets. These features build on
-infrastructure pioneered by Phil Jones (SCRIP), and the multi-agency
-Earth System Modeling Framework (ESMF). 
+This release improves regridding features, ncra weighting, and
+ncatted flexibility, and contains a raft of minor fixes and tunings.
+Notably, most implementation-specific dimension/variable names
+involved in regridding can be specified at the command line, and
+the regridder understands mapfiles generated by TempestRemap.
+ncra can now weight records by a 1-D record variable in the file.
+And ncatted supports regular expressions in both the variable name
+AND the attribute name (simultaneously, too).
 
-Work on NCO 4.5.1 has commenced and will support more regridding, 
-additional ncra flexibility with weights, better threading, and easier
-builds on supercomputer systems that use modules. 
+Work on NCO 4.5.2 has commenced and will better support regional
+regridding, masks, threading, CF-checking and easier builds on
+computer systems that use modules.  
 
 Enjoy,
 Charlie
 
 NEW FEATURES (full details always in ChangeLog):
 
-A. Regrid global datasets with ESMF or SCRIP remap files.
-   Given a map-file that contains source-to-destination grid weights,
-   ncks will regrid and input file to the destination grid.
-   Acceptable file formats for map-files are described here:
-   http://www.earthsystemcog.org/projects/regridweightgen
-   http://oceans11.lanl.gov/svn/SCRIP/trunk/SCRIP
-   ncks supports 1D->1D, 1D->2D, 2D->1D, and 2D->2D regridding for any
-   unstructured 1D grid and any rectangular 2D grid. It has been
-   tested converting among and between Gaussian, equiangular, FV, and
-   unstructured cubed-sphere grids. Support for irregular 2D and
-   regional grids (e.g., swath-like data) is planned. ncks
-   automatically annotates the output with relevant metadata such as
-   coordinate bounds, axes, and vertices (à la CF). When used with an
-   identity remapping files, this feature can signficantly improve the
-   metadata and usability of the original dataset.
+A. Regrid global datasets with TempestRemap mapfiles (in addition to
+   ESMF and SCRIP, which were already supported). Tempest mapfiles
+   use slightly different conventions than the other two, and this
+   release accounts for those differences. This capability makes
+   NCO's regridder a drop-in replacement for the Tempest program
+   ApplyOfflineMap with global (source and destination) maps.
+   The two produce the same results, modulo metadata.
+   Please give it a try and send us feedback!
    # Regrid entire file, same output format as input:
    ncks --map=map.nc in.nc out.nc
    # Deflated netCDF4 output, threading, selected variables:
    ncks -4 -L 1 -t 8 -v FS.?,T --map=map.nc in.nc out.nc
    http://nco.sf.net/nco.html#regrid
 
-B. ncdismember is a one-stop shop for flattening and CF-checking.
-   When specifically requested, or when it cannot find a local
-   cfchecker command, ncdismember will now upload each file (or,
-   in the case of netCDF4 hierarchical files, each group) to the NERC
-   CF compliance-checker, print the report summary, and save the full
-   HTML reports for viewing after Orange is the New Black is over. 
-   Previously, ncdismember required a local cfchecker command to check
-   files, though few users have managed to install a cfchecker.
-   This need is obviated by automatic uploads to the NERC web service.
-   To conserve bandwidth, ncdismember first "smallifies" the data file
-   by hyperslabbing the dataset into a single element of latitude,
-   longitude, and time---only then does it upload. Thanks to Phil
-   Rasch for this idea and sample code.
-   Using no checker, default (Decker) checker, NERC checker:
-   ncdismember ~/nco/data/mdl_1.nc /tmp
-   ncdismember ~/nco/data/mdl_1.nc /tmp decker
-   ncdismember ~/nco/data/mdl_1.nc /tmp nerc
-   http://nco.sf.net/nco.html#ncdismember
-
-C. NCO introduces a convention to retain the history-attribute
-   contents of all files that were appended to a file. This convention  
-   stores those contents in the new global attribute called
-   history_of_appended_files. This complements the history-attribute
-   to provide a more complete provenance. The optional -h switch
-   turns-off this behavior.
-   http://nco.sf.net/nco.html#history
+B. ncatted now supports regular expressions in both the variable name 
+   AND the attribute name (simultaneously, too). Previously, ncatted
+   accepted regular expressions only in the variable name. The new
+   functionality simplifies sculpting metadata topiary from files with
+   baroque metadata annotations, since whole groups of attributes may
+   now be added/modified/deleted with a single command. For example,
+   delete all attributes whose names end in "_iso19115" from all
+   variables whose names contain "H2O".
+   ncatted -a '.?_iso19115$','^H2O*',d,, in.nc
+   http://nco.sf.net/nco.html#ncatted
+
+C. Add mibs/mabs/mebs methods and operators to ncap2. These are the
+   absolute-value analogues of min/max/mean, so that, e.g., mibs()
+   returns the minimum absolute-value of the operand.
+   tpt_max=temperature.max();
+   tpt_max=max(temperature);
+   tpt_mabs=temperature.mabs();
+   tpt_mabs=mabs(temperature);
+   http://nco.sf.net/nco.html#mibs
+   http://nco.sf.net/nco.html#ppc
+   http://nco.sf.net/nco.html#ncap2
+
+D. Prevent operators from repeating existing cell_methods attribute.
+   Previously NCO would append new operations, e.g., "time: mean" to
+   the existing cell_methods attribute, if any. Now it first checks
+   to see whether that method has been applied and, if so, declines
+   to write a duplicate operation.
+   http://nco.sf.net/nco.html#cll_mth
 
-D. When copying the variables date_written or time_written to the
-   output file, NCO now updates their contents the GMT time reported
-   by the system-supplied gmtime().
-   http://nco.sf.net/nco.html#cnv_acme
-   
 BUG FIXES:
 
-A. Fix ncatted so it preserves global attributes (including history) 
-   from the output file when in append (-A) mode.
+A. Fix formatting of history_of_appended_files attribute when appended 
+   file had no history attribute.
+   http://nco.sf.net/nco.html#history
+
+B. Round-up to one rather than round-down to zero in chunking maps lfp
+   and rew. This fixes a bug that only appears on datasets with
+   certain shapes. 
+   http://nco.sf.net/nco.html#cnk
+
+C. Fix bug using min/max on coordinate variables in ncap2
+
+D. Initialize memory that appeared to cause zeros to be written
+   by regridder compiled by clang on MacOSX.
 
 KNOWN PROBLEMS DUE TO NCO:
 
    This section of ANNOUNCE reports and reminds users of the
    existence and severity of known, not yet fixed, problems. 
-   These problems occur with NCO 4.5.0 built/tested with netCDF
-   4.4.0-rc1 (20150610) on top of HDF5 hdf5-1.8.13 with:
+   These problems occur with NCO 4.5.1 built/tested with netCDF
+   4.4.0-development (20150710) on top of HDF5 hdf5-1.8.13 with:
 
    cd ~/nco;./configure # Configure mechanism -or-
    cd ~/nco/bld;make dir;make allinone # Old Makefile mechanism
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 24cd959..0ed1c0b 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,193 @@
+2015-07-11  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.5.1 release procedure:
+ 	Changes since nco-4.5.0: ncra --wgt=wgt_nm, ncap2 mibs/mabs/mebs, Tempest
+	cd ~/nco;git commit -a -m 'Version 4.5.1 release final changes'
+	git tag -d 4.5.1;git push origin :refs/tags/4.5.1
+	git tag -a 4.5.1 -m 'Version 4.5.1: Maxine';git push --tags
+
+	* Cause nco_var_get_wgt_trv() to die when weight/mask not found, re-jigger weight testing to be more thorough
+
+	* Found bug where ncwa proceeded without complaining when weights were not found
+
+	* Regridding works on Tempest RRM conus grid
+
+	* Manually normalize polar offset grid latitude weights to sum to 2.0 for global extent, less for regional
+
+	* Create area_out from analytic function when area_b has zeros in mapfile
+
+2015-07-10  Charlie Zender  <zender at uci.edu>
+
+	* Implement regional destination grid capability
+
+	* Turn-off ncra and ncwa threading for dbg_lvl >= 3 for 4.5.1 release
+
+	* Revert back to old _FillValue trick when netCDF library <= 4.4.0 because Unidata NCF-187 fix does not help NCO
+
+2015-07-07  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.5.1-beta2 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-beta2 final changes'
+	git tag -a 4.5.1-beta2 -m 'Version 4.5.1-beta2 tag: ncra --wgt=wgt_nm works';git push --tags
+
+	* Fix weighting with ncra --wgt=wgt_nm, allow for full pathnames in wgt_nm
+
+2015-07-06  Charlie Zender  <zender at uci.edu>
+
+	* Round-up to one rather than round-down to zero in cnk_map=lfp
+
+	* Fix history_of_appended_files attribute
+
+2015-07-01  Charlie Zender  <zender at uci.edu>
+
+	* Add mibs/mabs/mebs to ncap2
+
+	* NCO 4.5.1-beta1 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-beta1 final changes'
+	git tag -a 4.5.1-beta1 -m 'Version 4.5.1-beta1 tag: ncap2 fix for min/max on cordinates';git push --tags
+
+	* Verify ncap2 min/max bug reported by Maxim Petrenko. Add regression test and fix bug.
+
+	* NCO 4.5.1-alpha8 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha8 final changes'
+	git tag -a 4.5.1-alpha8 -m 'Version 4.5.1-alpha8 tag: Regridder	workaround for Tempest 1D grids';git push --tags
+
+	* Diagnose problem (incorrect Tempest dst/src_grid_dims variable) and implement workaround
+
+	* Change ncol to col in code for symmetry with lat/lon
+
+2015-06-29  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.5.1-alpha7 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha7 final changes'
+	git tag -a 4.5.1-alpha7 -m 'Version 4.5.1-alpha7 tag: ncatted rx att_nm, no duplicate cell_methods ';git push --tags
+
+	* Added attribute wildcarding to ncatted
+
+2015-06-28  Charlie Zender  <zender at uci.edu>
+
+	* Introduce routine nco_aed_prc_wrp() to expand attribute regular expressions
+
+2015-06-26  Charlie Zender  <zender at uci.edu>
+
+	* Prevent not only duplicates, but sub-string duplicates in nco_cnv_cll_mth_add()
+
+2015-06-25  Charlie Zender  <zender at uci.edu>
+
+	* Warn when non-standard "cell_method" attribute is detected
+
+	* Prevent nco_cnv_cf_cll_mth_add() from repeating existing cell_methods attribute
+
+	* Move aed_prc functions to nco_att_utl.c to prepare for RX feature
+
+2015-06-22  Charlie Zender  <zender at uci.edu>
+
+	* Bump thr_nbr_max_fsh to 16 for ncks, to 8 (with -D >= 3) for ncwa
+
+	* Version = 'git describe --abbrev=7 --dirty --always --tags', e.g., 4.5.1-alpha6-1-gaa4fe2b-dirty
+
+2015-06-21  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.5.1-alpha6 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha6 final changes'
+	git tag -a 4.5.1-alpha6 -m 'Version 4.5.1-alpha6 tag: Works on Travis and with OpenMP when compiled with g++ 4.6.3-5.1.1';git push --tags
+
+	* Code now passes Travis build when compiled with g++
+
+	* Remove assert() from within OpenMP parallel regions for g++ 4.6.3 on Travis
+
+	* Use older OpenMP shared() statement for g++ < 4.8.0 (for Travis)
+
+	* Diagnose and discriminate g++ from gcc compiler
+
+	* Code compiles warning-free with clang and g++ (without ESMF)
+
+	* Isolated all ESMF library calls in nco_sld.c
+
+2015-06-19  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.5.1-alpha5 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha5 final changes'
+	git tag -a 4.5.1-alpha5 -m 'Version 4.5.1-alpha5 tag: Revert some broken doc build changes, patch handling of library return codes by regression tests';git push --tags
+
+	* Remove autobld/mdate-sh, a testimonial to wasted time
+
+	* Add [int,long,NULL]_CEWI to quiet maybe-uninitialize warnings with GCC 4.8.2
+
+	* Fix treatment of exiting with library as return code for regression tests
+
+	* NCO 4.5.1-alpha4 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha4 final changes'
+	git tag -a 4.5.1-alpha4 -m 'Version 4.5.1-alpha4 tag: More regridding regression tests. Fix possibly uninitialized destination pointer that may have caused writing zeros to output files with clang on MacOS X';git push --tags
+
+2015-06-18  Charlie Zender  <zender at uci.edu>
+
+	* Fill-in var_nm for tedious mss_val warning
+
+	* Add 2D->1D and 2D->2D regression tests
+
+	* Ensure lat/lon_psn_dst are not used uninitialized
+
+	* One-size fits all pre-allocation for dimension IDs and cnt/srt
+
+	* firstprivate() to preserve NULL on pointers that could inadvertently be free()'d
+
+	* clang on linux with debugging produced troves of useful warning messages
+	clang messages are more thorough than gcc/icc for finding sometimes uninitialized memory
+	clang is about as unforgiving as AIX xlc at strictly enforcing initialization
+	clang would be my default development compiler if it supported OpenMP
+	That being said, had to suppress annoying clang sometimes uninitialized memory warnings :)
+
+2015-06-17  Charlie Zender  <zender at uci.edu>
+
+	* Add topology and modulo metadata to longitude
+
+	* NCO 4.5.1-alpha3 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha3 final changes'
+	git tag -a 4.5.1-alpha3 -m 'Version 4.5.1-alpha3 tag: Add regridding regression tests. Fix strcat() buffer overrun that may have caused writing zeros to output files.';git push --tags
+
+	* Introduce CEWI_unused() to prevent unused warnings on variables used only in assert() macros
+
+2015-06-16  Charlie Zender  <zender at uci.edu>
+
+	* Add regridding regression tests based on AODVIS, FSNT, and area as ncap2 regression test only for USER=zender
+
+	* Clean-up ncap2.in test in preparation for adding regridding regression tests
+
+	* Travis CI builds now pass on gcc and clang. Yay! Only regressions are due to old netCDF library.
+
+	* Work on Travis CI YAML .travis.yml file syntax with http://lint.travis-ci.org
+
+2015-06-15  Charlie Zender  <zender at uci.edu>
+
+	* Variables used only in assert() statements flag "unused" warnings with GCC < 4.9.x. Change logic to prevent some of these warnings.
+
+	* Fix off-by-one memory overwrite in nco_cnv_cf_cll_mth_add() (symptom was heap corruption bug in ncwa)
+
+	* NCO 4.5.1-alpha2 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha2 final changes'
+	git tag -a 4.5.1-alpha2 -m 'Version 4.5.1-alpha2 tag: Regrid from Tempest-generated map-files';git push --tags
+
+	* Patch Makefiles so ncap2.cc is passed ENABLE_NETCDF4 flag (solves Heather Aldridge's report)
+
+2015-06-14  Charlie Zender  <zender at uci.edu>
+
+	* Verified NCO is regression-free with GCC 5.1.1
+
+	* NCO 4.5.1-alpha1 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.5.1-alpha1 final changes'
+	git tag -a 4.5.1-alpha1 -m 'Version 4.5.1-alpha1 tag: Regrid from Tempest-generated map-files';git push --tags
+
+	* Regridder works on bds output files with Tempest-generated map-files
+
+	* Omit extensive-seeming 1D variables on 2D input grids (e.g., grd_rds_rth, grd_mrd_lng, grd_znl_lng, lat_sz, lon_sz)
+
+2015-06-13  Charlie Zender  <zender at uci.edu>
+
+	* Reverse ordinal number of lat and lon dimensions in src_grid_rank, dst_grid_rank for Tempest
+
+	* Modify routines to accept TempestRemap-generated maps
+
 2015-06-11  Charlie Zender  <zender at uci.edu>
 
 	* NCO 4.5.0 release procedure:
diff --git a/doc/MANIFEST b/doc/MANIFEST
index a0a2065..a248050 100644
--- a/doc/MANIFEST
+++ b/doc/MANIFEST
@@ -52,6 +52,7 @@ nco/src		Source files
 Autotools directory:
 nco/autobld/compile	Wrapper for compilers which do not understand '-c -o'
 nco/autobld/fxm		Many files need documentation here
+(nco/autobld/mdate-sh)	(Formerly needed by TeXInfo for version.texi, could be installed by automake --add-missing)
 
 Binary directory:
 nco/bin/README		Description of binary directory
diff --git a/doc/Makefile.in b/doc/Makefile.in
index b8e88fd..808f84f 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,17 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -79,10 +89,6 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = doc
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/autobld/mkinstalldirs \
-	$(top_srcdir)/autobld/texinfo.tex AUTHORS ChangeLog NEWS \
-	README TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -90,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
@@ -182,6 +189,10 @@ am__uninstall_files_from_dir = { \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+	$(top_srcdir)/autobld/mkinstalldirs \
+	$(top_srcdir)/autobld/texinfo.tex AUTHORS ChangeLog NEWS \
+	README TODO
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -355,7 +366,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign doc/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -774,6 +784,8 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
 	uninstall-dvi-am uninstall-html-am uninstall-info-am \
 	uninstall-pdf-am uninstall-ps-am
 
+.PRECIOUS: Makefile
+
 
 #CLEANFILES = nco nco.dvi nco.info* nco.pdf nco.ps nco.txt nco.xml
 #
diff --git a/doc/TODO b/doc/TODO
index 04e38e3..3297144 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -629,7 +629,7 @@ nco1079. ncap2: add option to return index of max/min/etc. kevin raeder suggesti
 nco1084. ncks feature: allow multiple specifications of mk_rec_dmn and fix_rec_dmn
 nco1093. ncks: print attribute function lynnes (NB: windows does not use filters)
 	 ncks -v var_lst -a att_lst (--abc=abc_md  --alphabetize=abc_md) in.nc
-nco1097. ncatted: rx attributes lynnes and 1 other 20130702
+nco1097. ncatted: rx attributes lynnes and 1 other 20130702 and 1 other 20150625
 nco1094. ncks: print statistics function lynnes (NB: windows does not use filters)
 nco1095. ncap2: user-defined functions (UDFs) lynnes
 nco1096. ncecat: --playnice, recognize, e.g., "latitude" variants lynnes
@@ -955,7 +955,7 @@ ncap71. Remove erf and gamma functions from AIX build
 ncap72. Stop linking to -lC on AIX. Get all float math functions by casting double versions
 ncap79. make abs() synonym for fabs() and pow() and ** synonyms for ^
 ncap80. ncap2+openmp+netCDF4 - script only works with threads>1 if there are no atts in input file
-ncap81. script 'defdim("a",3);defdim("b",4);a[$a,$b]=10;' works on netCDF3 not netCDF4. Known bug with netCDF4. (Why? what causes it?) 
+ncap81. (20150616: fixed by netCDF4.3.x) script 'defdim("a",3);defdim("b",4);a[$a,$b]=10;' works on netCDF3 not netCDF4. Known bug with netCDF4. (Why? what causes it?) 
 ncap82. Unable to average single/multi dimensional var of total size 1 var in ncap2 
 e.g., defdim("X",10);defdim("Y",1); m[X,Y]=10; m.avg();- fails with seg fault  
 ************************************************************************
diff --git a/doc/VERSION b/doc/VERSION
index a84947d..4404a17 100644
--- a/doc/VERSION
+++ b/doc/VERSION
@@ -1 +1 @@
-4.5.0
+4.5.1
diff --git a/doc/debian.txt b/doc/debian.txt
index 4b0da01..9047c36 100644
--- a/doc/debian.txt
+++ b/doc/debian.txt
@@ -29,19 +29,18 @@ apt-get install dh-make debhelper devscripts fakeroot gnupg debian-policy develo
 
 2. Debian build procedure recommends placing entire package source in
    subdirectory of main package. 
-   For starters, we wish to create .debs of tagged releases, e.g., nco-4.5.0
-   First we create a clean source distribution of nco and place it in nco-4.5.0
-   Once automated, we will use cvs co -rnco-4_5_0 to get source
+   For starters, we wish to create .debs of tagged releases, e.g., nco-4.5.1
+   First we create a clean source distribution of nco and place it in nco-4.5.1
    Until we know what is necessary, however, we just copy a snapshot
    
    2.1 Clean all build files from development directory
 
 cd ~/nco;make distclean;cd bld;make clean;cd ~
 tar cvzf ./nco/nco.tar.gz ./nco/*
-cd ~/nco;tar xvzf nco.tar.gz;mv nco nco-4.5.0
-/bin/rm nco.tar.gz;tar cvzf nco-4.5.0.tar.gz ./nco-4.5.0/*
-cd ~/nco/nco-4.5.0
-dh_make -e zender at uci.edu -f ../nco-4.5.0.tar.gz
+cd ~/nco;tar xvzf nco.tar.gz;mv nco nco-4.5.1
+/bin/rm nco.tar.gz;tar cvzf nco-4.5.1.tar.gz ./nco-4.5.1/*
+cd ~/nco/nco-4.5.1
+dh_make -e zender at uci.edu -f ../nco-4.5.1.tar.gz
 
     2.2 The preceding steps created template debian files for a .deb,
     Those files now reside in ~/nco/debian.
@@ -56,7 +55,7 @@ dh_make -e zender at uci.edu -f ../nco-4.5.0.tar.gz
    from previous build
 
    cd ~/nco;/bin/rm *.gz
-   cd ~/nco/nco-4.5.0
+   cd ~/nco/nco-4.5.2
    dpkg-buildpackage -rfakeroot > foo 2>&1
    dpkg-buildpackage -rsudo > foo 2>&1
 
@@ -85,36 +84,33 @@ patch -p0 < nco_X.Y.Z-3.diff   # Patch destination with Debian diff
    make tags
 # Put cute version-specific string in nco_ctl.c:nco_nmn_get()
 # Install correct version numbers before updating Debian
-# tags-query replace 4_5_0 with X_Y_Z+1
-# tags-query replace 4.5.0 with X.Y.Z+1
+# tags-query replace 4.5.2 with X.Y.Z+1
 # If tags-query replace does not work, be sure to manually change
 # versions in configure.ac, debian/files, doc/ANNOUNCE, doc/debian.txt,
 # doc/index.shtml, doc/nco.texi, bld/nco_dst.pl, doc/VERSION
 # 20141201: Change NCO_VERSION_PATCH in src/nco.h!!!!!!!!!!!!!!!!!!!!!!
-   cd ~/nco/debian;dch -b --force-distribution --distribution=unstable -v 4.5.0-1 # Update changelog (-b forces this version number)
+   cd ~/nco/debian;dch -b --force-distribution --distribution=unstable -v 4.5.2-1 # Update changelog (-b forces this version number)
    emacs ~/nco/bld/nco.spec # Update changelog
 # For unknown reason rules file may lose its executable bit
    chmod a+x ~/nco/debian/rules
 # Rebuild autotools so new version # propagates
    cd ~/nco;aclocal;autoheader;automake --foreign;autoconf
 # Save all files in emacs before tagging
-# Tag CVS code after changing files in ~/nco/debian
-   cd ~/nco;cvs commit -m "Preparing nco-4.5.0 release";cvs tag -c nco-4_5_0
-   ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4_5_0
+   ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4.5.2
 # Upload tarball to SF https://sourceforge.net/projects/nco/files 
-   cd;scp dust.ess.uci.edu:/var/www/html/nco/src/nco-4.5.0.tar.gz .
+   cd;scp dust.ess.uci.edu:/var/www/html/nco/src/nco-4.5.2.tar.gz .
 
 7. Ubuntu PPA
 https://help.launchpad.net/Packaging/PPA
-dput NCO nco_4.5.0-2~ppa1_source.changes
+dput NCO nco_4.5.2-2~ppa1_source.changes
 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com
 
 # Location of build diagnostics for mentors to help 
-http://dust.ess.uci.edu/nco/src/nco_4.5.0-1.dpkg-buildpackage.txt
-http://dust.ess.uci.edu/nco/src/nco_4.5.0-1.dsc
-http://dust.ess.uci.edu/nco/src/nco_4.5.0-1_i386.changes
-http://dust.ess.uci.edu/nco/src/nco_4.5.0-1_i386.deb
-http://dust.ess.uci.edu/nco/src/nco_4.5.0.orig.tar.gz
+http://dust.ess.uci.edu/nco/src/nco_4.5.2-1.dpkg-buildpackage.txt
+http://dust.ess.uci.edu/nco/src/nco_4.5.2-1.dsc
+http://dust.ess.uci.edu/nco/src/nco_4.5.2-1_i386.changes
+http://dust.ess.uci.edu/nco/src/nco_4.5.2-1_i386.deb
+http://dust.ess.uci.edu/nco/src/nco_4.5.2.orig.tar.gz
 
 # Becoming a Debian developer
 http://www.debian.org/devel/join/newmaint
@@ -168,31 +164,31 @@ Matej Vela <vela at debian.org>, Daniel Baumann <daniel at debian.org>, Warren Turkal
 # export LD_LIBRARY_PATH=/usr/lib:/lib:/usr/X11R6/lib
 # sudo aptitude install antlr bison flex gsl-bin libgsl0-dev libantlr-dev netcdf-bin libnetcdfc7 libnetcdf-dev texinfo libcurl4-gnutls-dev libexpat1-dev libxml2-dev udunits-bin libudunits2-0 libudunits2-dev
 cd ~/nco;cvc
-sudo /bin/rm -rf ${DATA}/nco-4.5.0 ${DATA}/nco_4.5.0* ${DATA}/debian # Cleanup last build. sudo necessary for removal because dpkg-buildpackage uses sudo?
-# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4_5_0-1 -d nco-4.5.0 nco # Export based on tag
-cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -D "1 second ago" -d nco-4.5.0 nco # Export most recent
-tar cvzf ./nco_4.5.0.orig.tar.gz --exclude='nco-4.5.0/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.5.0 
-/bin/rm -rf ${DATA}/nco-4.5.0 # Remove cvs-exported directory
-tar xvzf ./nco_4.5.0.orig.tar.gz # Untar to get directory without excluded files
-mkdir -p ${DATA}/nco-4.5.0/debian/source;cd ~/nco/debian;/bin/cp changelog compat control convert copyright doc-base files info rules ${DATA}/nco-4.5.0/debian;cd ~/nco/debian/source;/bin/cp format ${DATA}/nco-4.5.0/debian/source # Replace debian directory with _CURRENT_ (main trunk) settings
+sudo /bin/rm -rf ${DATA}/nco-4.5.2 ${DATA}/nco_4.5.2* ${DATA}/debian # Cleanup last build. sudo necessary for removal because dpkg-buildpackage uses sudo?
+# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4.5.2-1 -d nco-4.5.2 nco # Export based on tag
+cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -D "1 second ago" -d nco-4.5.2 nco # Export most recent
+tar cvzf ./nco_4.5.2.orig.tar.gz --exclude='nco-4.5.2/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.5.2 
+/bin/rm -rf ${DATA}/nco-4.5.2 # Remove cvs-exported directory
+tar xvzf ./nco_4.5.2.orig.tar.gz # Untar to get directory without excluded files
+mkdir -p ${DATA}/nco-4.5.2/debian/source;cd ~/nco/debian;/bin/cp changelog compat control convert copyright doc-base files info rules ${DATA}/nco-4.5.2/debian;cd ~/nco/debian/source;/bin/cp format ${DATA}/nco-4.5.2/debian/source # Replace debian directory with _CURRENT_ (main trunk) settings
 #export DEB_BUILD_OPTIONS='disable-dap-netcdf disable-netcdf4 disable-udunits2'; # Disable optional packages based on available Debian support
-#cd ${DATA}/nco-4.5.0;dpkg-buildpackage -rsudo -uc -us > ~/foo.nco 2>&1 # -uc -us: Do not sign changes or source files
-#cd ${DATA}/nco-4.5.0;dpkg-buildpackage -rsudo -sa > ~/foo.nco 2>&1 # -sa: Include _orig.tar.gz in .changes 
-cd ${DATA}/nco-4.5.0;dpkg-buildpackage -rsudo > ~/foo.nco 2>&1
+#cd ${DATA}/nco-4.5.2;dpkg-buildpackage -rsudo -uc -us > ~/foo.nco 2>&1 # -uc -us: Do not sign changes or source files
+#cd ${DATA}/nco-4.5.2;dpkg-buildpackage -rsudo -sa > ~/foo.nco 2>&1 # -sa: Include _orig.tar.gz in .changes 
+cd ${DATA}/nco-4.5.2;dpkg-buildpackage -rsudo > ~/foo.nco 2>&1
 sudo dpkg --remove nco
-sudo dpkg --install ${DATA}/nco_4.5.0-1_*.deb
+sudo dpkg --install ${DATA}/nco_4.5.2-1_*.deb
 cd ~/nco/bld;MY_BIN_DIR=/usr/bin ../bm/nco_bm.pl --regress
 # http://lintian.debian.org/full/zender@uci.edu.html
-lintian ${DATA}/nco_4.5.0-1_*.deb
-ls -l ${DATA}/nco_4.5.0*
+lintian ${DATA}/nco_4.5.2-1_*.deb
+ls -l ${DATA}/nco_4.5.2*
 m ~/foo.nco
 # Upload Ubuntu (rather than Debian) packages to websites
-scp ${DATA}/nco_4.5.0* dust.ess.uci.edu:/var/www/html/nco/src
-scp ${DATA}/nco_4.5.0* zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
+scp ${DATA}/nco_4.5.2* dust.ess.uci.edu:/var/www/html/nco/src
+scp ${DATA}/nco_4.5.2* zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 # NB: Make sure RPMs build before uploading to debian, since changing
 # Debian versions is a PITA
 # NB: Only upload pbuilder Debian Sid (not personal Ubuntu) .deb builds to Debian mentors
-# cd ${DATA};dupload -t mentors nco_4.5.0-1_*.changes
+# cd ${DATA};dupload -t mentors nco_4.5.2-1_*.changes
 bsrc # Reset shell environment for regular development
 
 # New build system #2
@@ -206,52 +202,52 @@ DIST=sid sudo pbuilder update # Update chroot before building package in it
 # dget http://ftp.debian.org/debian/pool/main/n/nco/nco_3.9.0-1.dsc
 # dget http://ftp.debian.org/debian/pool/main/n/netcdf/netcdf_3.6.1-1.dsc
 # apt-get source nco # Get package source
-sudo /bin/rm /var/cache/pbuilder/result/nco_4.5.0* # Cleanup prior build
+sudo /bin/rm /var/cache/pbuilder/result/nco_4.5.2* # Cleanup prior build
 # To pass DEB_BUILD_OPTIONS to pbuilder while using sudo, one must first
 # modify sudoers with visudo to prevent sudo from resetting environment
 #export DEB_BUILD_OPTIONS='disable-dap-netcdf disable-netcdf4 disable-udunits2'; # Disable optional packages based on available Debian support
-cd ${DATA};DIST=sid sudo pbuilder build nco_4.5.0-1.dsc > ~/foo.nco.pbuilder 2>&1
-cd /var/cache/pbuilder/result;debsign -k6F635D10 nco_4.5.0-1_*.changes
-lintian /var/cache/pbuilder/result/nco_4.5.0-1_*.deb
+cd ${DATA};DIST=sid sudo pbuilder build nco_4.5.2-1.dsc > ~/foo.nco.pbuilder 2>&1
+cd /var/cache/pbuilder/result;debsign -k6F635D10 nco_4.5.2-1_*.changes
+lintian /var/cache/pbuilder/result/nco_4.5.2-1_*.deb
 sudo dpkg --remove nco
-sudo dpkg --install /var/cache/pbuilder/result/nco_4.5.0-1_*.deb
+sudo dpkg --install /var/cache/pbuilder/result/nco_4.5.2-1_*.deb
 cd ~/nco/bld;MY_BIN_DIR=/usr/bin ../bm/nco_bm.pl --regress
 # NB: Upload pbuilder Debian Sid packages to Debian mentors, but not
 # to personal or NCO websites since most people use Ubuntu not Debian
 # NB: Debian versions are a PITA, ensure RPMs build before uploading to Debian
-cd /var/cache/pbuilder/result;dupload -t mentors nco_4.5.0-1_*.changes
+cd /var/cache/pbuilder/result;dupload -t mentors nco_4.5.2-1_*.changes
 
 # RPM builds as root
 export rpm_root='/usr/src/redhat'
 # export sudo_sng='' # sudo not-necessary when builing in user directories
 export sudo_sng='sudo' # sudo necessary when building in system directories
 cd ~/nco;cvc;cvu
-/bin/rm -rf ${DATA}/nco-4.5.0 ${DATA}/nco-4.5.0* # Cleanup last build
+/bin/rm -rf ${DATA}/nco-4.5.2 ${DATA}/nco-4.5.2* # Cleanup last build
 ${sudo_sng} /bin/rm -r -f \
-${rpm_root}/BUILD/nco-4.5.0 \
-${rpm_root}/RPMS/i386/nco-4.5.0-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-4.5.0-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-4.5.0-?.i386.rpm \
-${rpm_root}/SOURCES/nco-4.5.0.tar.gz \
-${rpm_root}/SPECS/nco-4.5.0.spec \
-${rpm_root}/SRPMS/nco-4.5.0-?.src.rpm
-cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4_5_0-1 -d nco-4.5.0 nco # Export based on tag
-${sudo_sng} ln -s ${HOME}/nco/bld/nco.spec ${rpm_root}/SPECS/nco-4.5.0.spec
-tar cvzf ./nco-4.5.0.tar.gz --exclude='nco-4.5.0/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.5.0 
-${sudo_sng} /bin/cp ${DATA}/nco-4.5.0.tar.gz ${rpm_root}/SOURCES
+${rpm_root}/BUILD/nco-4.5.2 \
+${rpm_root}/RPMS/i386/nco-4.5.2-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-4.5.2-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-4.5.2-?.i386.rpm \
+${rpm_root}/SOURCES/nco-4.5.2.tar.gz \
+${rpm_root}/SPECS/nco-4.5.2.spec \
+${rpm_root}/SRPMS/nco-4.5.2-?.src.rpm
+cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4.5.2-1 -d nco-4.5.2 nco # Export based on tag
+${sudo_sng} ln -s ${HOME}/nco/bld/nco.spec ${rpm_root}/SPECS/nco-4.5.2.spec
+tar cvzf ./nco-4.5.2.tar.gz --exclude='nco-4.5.2/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.5.2 
+${sudo_sng} /bin/cp ${DATA}/nco-4.5.2.tar.gz ${rpm_root}/SOURCES
 cd ${rpm_root}/SPECS
-${sudo_sng} rpmbuild -ba --sign nco-4.5.0.spec > ~/foo.nco 2>&1
+${sudo_sng} rpmbuild -ba --sign nco-4.5.2.spec > ~/foo.nco 2>&1
 scp \
-${rpm_root}/RPMS/i386/nco-4.5.0-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-4.5.0-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-4.5.0-?.i386.rpm \
-${rpm_root}/SRPMS/nco-4.5.0-?.src.rpm \
+${rpm_root}/RPMS/i386/nco-4.5.2-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-4.5.2-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-4.5.2-?.i386.rpm \
+${rpm_root}/SRPMS/nco-4.5.2-?.src.rpm \
 dust.ess.uci.edu:/var/www/html/nco/src
 scp \
-${rpm_root}/RPMS/i386/nco-4.5.0-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-4.5.0-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-4.5.0-?.i386.rpm \
-${rpm_root}/SRPMS/nco-4.5.0-?.src.rpm \
+${rpm_root}/RPMS/i386/nco-4.5.2-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-4.5.2-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-4.5.2-?.i386.rpm \
+${rpm_root}/SRPMS/nco-4.5.2-?.src.rpm \
 zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 
 # RPM builds as user
@@ -260,33 +256,33 @@ zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 export rpm_root="${DATA}/rpm/nco"
 #cd ~/nco;cvc;cvu # This risks committing unwanted *.[ch]pp files
 mkdir -p ${DATA}/rpm/nco/TMP ${DATA}/rpm/nco/BUILD
-/bin/rm -rf ${DATA}/nco-4.5.0 ${DATA}/nco-4.5.0* # Cleanup last build
+/bin/rm -rf ${DATA}/nco-4.5.2 ${DATA}/nco-4.5.2* # Cleanup last build
 /bin/rm -r -f \
-${rpm_root}/nco-4.5.0-?.src.rpm \
-${rpm_root}/nco-4.5.0.spec \
-${rpm_root}/nco-4.5.0.tar.gz \
-${rpm_root}/*/nco-4.5.0-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-4.5.0-?.*.rpm \
-${rpm_root}/*/nco-devel-4.5.0-?.*.rpm
-# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4_5_0-1 -d nco-4.5.0 nco # Export based on tag
-cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -D "1 second ago" -dnco-4.5.0 nco # Export most recent and build as 4.5.0-1
-tar cvzf ./nco-4.5.0.tar.gz --exclude='nco-4.5.0/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.5.0 
-/bin/cp ${DATA}/nco-4.5.0.tar.gz ${rpm_root}
+${rpm_root}/nco-4.5.2-?.src.rpm \
+${rpm_root}/nco-4.5.2.spec \
+${rpm_root}/nco-4.5.2.tar.gz \
+${rpm_root}/*/nco-4.5.2-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-4.5.2-?.*.rpm \
+${rpm_root}/*/nco-devel-4.5.2-?.*.rpm
+# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4.5.2-1 -d nco-4.5.2 nco # Export based on tag
+cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -D "1 second ago" -dnco-4.5.2 nco # Export most recent and build as 4.5.2-1
+tar cvzf ./nco-4.5.2.tar.gz --exclude='nco-4.5.2/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.5.2 
+/bin/cp ${DATA}/nco-4.5.2.tar.gz ${rpm_root}
 ln -s ${HOME}/nco/bld/nco.spec ${rpm_root}/nco.spec
 cd ${rpm_root}
 rpmbuild -ba --sign nco.spec > ~/foo.nco 2>&1
-rpmlint ${rpm_root}/*/nco-4.5.0-?.*.rpm
+rpmlint ${rpm_root}/*/nco-4.5.2-?.*.rpm
 sudo yum remove nco
-sudo yum install ${rpm_root}/*/nco-4.5.0-?.*.rpm
+sudo yum install ${rpm_root}/*/nco-4.5.2-?.*.rpm
 scp \
-${rpm_root}/*/nco-4.5.0-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-4.5.0-?.*.rpm \
-${rpm_root}/*/nco-devel-4.5.0-?.*.rpm \
-${rpm_root}/nco-4.5.0-?.*.src.rpm \
+${rpm_root}/*/nco-4.5.2-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-4.5.2-?.*.rpm \
+${rpm_root}/*/nco-devel-4.5.2-?.*.rpm \
+${rpm_root}/nco-4.5.2-?.*.src.rpm \
 dust.ess.uci.edu:/var/www/html/nco/src
 scp \
-${rpm_root}/*/nco-4.5.0-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-4.5.0-?.*.rpm \
-${rpm_root}/*/nco-devel-4.5.0-?.*.rpm \
-${rpm_root}/nco-4.5.0-?.*.src.rpm \
+${rpm_root}/*/nco-4.5.2-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-4.5.2-?.*.rpm \
+${rpm_root}/*/nco-devel-4.5.2-?.*.rpm \
+${rpm_root}/nco-4.5.2-?.*.src.rpm \
 zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
diff --git a/doc/index.shtml b/doc/index.shtml
index e585148..fa4290e 100644
--- a/doc/index.shtml
+++ b/doc/index.shtml
@@ -70,7 +70,7 @@ Try to disable Spammers' machines:
 <p><h1 align="center">Welcome to the netCDF Operator (NCO) Homepage</h1>
 
 <p><h2>
-Current NCO version is 4.5.0 last updated on <!--#flastmod file="VERSION"-->
+Current NCO version is 4.5.1 last updated on <!--#flastmod file="VERSION"-->
 </h2>
 
 <table border=0 width=100%>
@@ -149,7 +149,8 @@ and
 <h2>Recent Releases & Milestones</h2>
 
 <ul>
-<li>2015 Jul ??: 4.5.1 (<i>In progress</i>)
+<li>2015 Jul ??: 4.5.2 (<i>In progress</i>)
+<li>2015 Jul 10: 4.5.1 (Stability)
 <li>2015 Jun 11: 4.5.0 (Regridding)
 <li>2015 May 21: 4.4.9 (<tt>ncra</tt> weights)
 <li>2015 Feb 16: 4.4.8 (Precision-preserving Compression)
@@ -659,17 +660,22 @@ Stable releases receive unique tags and their tarballs are stored
 <a href="http://nco.sf.net/src">here</a> on SourceForge and
 <a href="https://github.com/czender/nco/releases">here</a> at GitHub.
 You may also retrieve the source of tagged versions directly
-<a name="#Source">with <tt>git clone -b 4.5.0 http://github.com/czender/nco.git nco-4.5.0</tt></a>.
+<a name="#Source">with <tt>git clone -b 4.5.1 http://github.com/czender/nco.git nco-4.5.1</tt></a>.
 <ul>
-<li><b>NCO 4.5.2</b>: (<i>Future</i>) 
+<li><b>NCO 4.5.3</b>: (<i>Future</i>) 
 <tt>ncks</tt> prints human-legible ISO8601 dates;
 <a href="http://nco.sf.net/nco.html#cnk">Chunking</a> bytes not elements, caching;
 extensive hashing?;
 netCDF4 compound types?;
 Optimize diskless files?;</li>
-<li><b>NCO 4.5.1</b>: (<i>In Progress, features completed or being worked on include</i>)
+<li><b>NCO 4.5.2</b>: (<i>In Progress, features completed or being worked on include</i>)
+<li><b>NCO 4.5.1</b>: (<i>Current Stable Release</i>)
+<tt>cell_method</tt> improvments;
+<tt>ncap2</tt> gets </tt>mibs()/mabs()/mebs()</tt> methods;
+<tt>ncatted</tt> regular expressions in </tt>att_nm</tt>;
+<tt>ncks</tt> regrid using TempestRemap mapfiles;
 <tt>ncra</tt> weights with </tt>--wgt wgt_nm</tt>;</li>
-<li><b>NCO 4.5.0</b>: (<i>Current Stable Release</i>)
+<li><b>NCO 4.5.0</b>:
 Regridding with <tt>ncks --map</tt>;
 <tt>date/time_written</tt> updates;
 <tt>history</tt> provenance with <tt>-A</tt> (append-mode);
@@ -835,7 +841,7 @@ Thanks to NSF for supporting AIX machines at NCAR over the years.
 <h3><a href="http://www.debian.org">Debian</a> and <a href="http://www.ubuntu.com">Ubuntu</a> GNU/Linux</a></h3>
 <ul>
 <!--
-<li><a href="http://www.debian.org">Debian</a> and <a href="http://www.ubuntu.com">Ubuntu</a> GNU/Linux-compatible Intel systems, prebuilt binary executable <a href="http://www.debian.org">deb</a>: <a href="http://packages.debian.org/testing/math/nco.html">nco-4.5.0</a></li>
+<li><a href="http://www.debian.org">Debian</a> and <a href="http://www.ubuntu.com">Ubuntu</a> GNU/Linux-compatible Intel systems, prebuilt binary executable <a href="http://www.debian.org">deb</a>: <a href="http://packages.debian.org/testing/math/nco.html">nco-4.5.1</a></li>
 -->
 <a href="http://packages.debian.org/unstable/science/nco">Debian NCO</a> and 
 <a href="http://packages.ubuntu.com/natty/nco">Ubuntu NCO</a> homepages.
@@ -843,12 +849,12 @@ Thanks to NSF for supporting AIX machines at NCAR over the years.
 NCO packages in the Debian/Ubuntu repositories (i.e., Sid and Raring) generally lag the packages distributed here by 6–12 months.
 <a name="beta"></a><a name="prerelease"> <!-- http://nco.sf.net#beta -->
 Newer (beta- or pre-release) packages are often available for intrepid Debian/Ubuntu users as described <a href="https://github.com/czender/nco/tree/master/doc/beta.txt">here</a>.
-<dt>Debian package for most recent NCO release (install with, e.g., ‘<tt>dpkg --install nco_4.5.0-1_i386.deb</tt>’):</dt>
-<li><a href="src/nco_4.5.0-1_amd64.deb">nco_4.5.0-1_amd64.deb</a> (<!--#fsize file="src/nco_4.5.0-1_amd64.deb"-->): Executables AMD64-compatible (last updated <!--#flastmod file="src/nco_4.5.0-1_amd64.deb"-->)</li>
-<li><a href="src/nco_4.5.0-1.dsc">nco_4.5.0-1.dsc</a> (<!--#fsize file="src/nco_4.5.0-1.dsc"-->): Description (last updated <!--#flastmod file="src/nco_4.5.0-1.dsc"-->)</li>
-<li><a href="src/nco_4.5.0-1_amd64.changes">nco_4.5.0-1_amd64.changes</a> (<!--#fsize file="src/nco_4.5.0-1_amd64.changes"-->): Changes since last deb package (last updated <!--#flastmod file="src/nco_4.5.0-1_amd64.changes"-->)</li>
-<li><a href="src/nco_4.5.0.orig.tar.gz">nco_4.5.0.orig.tar.gz</a> (<!--#fsize file="src/nco_4.5.0.orig.tar.gz"-->): Upstream Source (last updated <!--#flastmod file="src/nco_4.5.0.orig.tar.gz"-->)</li>
-<li><a href="src/nco_4.5.0-1.diff.gz">nco_4.5.0-1.diff.gz</a> (<!--#fsize file="src/nco_4.5.0-1_amd64.changes"-->): Debian patch to upstream source (last updated <!--#flastmod file="src/nco_4.5.0-1_amd64.changes"-->)</li>
+<dt>Debian package for most recent NCO release (install with, e.g., ‘<tt>dpkg --install nco_4.5.1-1_i386.deb</tt>’):</dt>
+<li><a href="src/nco_4.5.1-1_amd64.deb">nco_4.5.1-1_amd64.deb</a> (<!--#fsize file="src/nco_4.5.1-1_amd64.deb"-->): Executables AMD64-compatible (last updated <!--#flastmod file="src/nco_4.5.1-1_amd64.deb"-->)</li>
+<li><a href="src/nco_4.5.1-1.dsc">nco_4.5.1-1.dsc</a> (<!--#fsize file="src/nco_4.5.1-1.dsc"-->): Description (last updated <!--#flastmod file="src/nco_4.5.1-1.dsc"-->)</li>
+<li><a href="src/nco_4.5.1-1_amd64.changes">nco_4.5.1-1_amd64.changes</a> (<!--#fsize file="src/nco_4.5.1-1_amd64.changes"-->): Changes since last deb package (last updated <!--#flastmod file="src/nco_4.5.1-1_amd64.changes"-->)</li>
+<li><a href="src/nco_4.5.1.orig.tar.gz">nco_4.5.1.orig.tar.gz</a> (<!--#fsize file="src/nco_4.5.1.orig.tar.gz"-->): Upstream Source (last updated <!--#flastmod file="src/nco_4.5.1.orig.tar.gz"-->)</li>
+<li><a href="src/nco_4.5.1-1.diff.gz">nco_4.5.1-1.diff.gz</a> (<!--#fsize file="src/nco_4.5.1-1_amd64.changes"-->): Debian patch to upstream source (last updated <!--#flastmod file="src/nco_4.5.1-1_amd64.changes"-->)</li>
 Thanks to Daniel Baumann, Barry deFreese, Francesco Lovergine, 
 Brian Mays, Rorik Peterson, and Matej Vela for their help packaging
 NCO for Debian over the years. 
@@ -859,10 +865,10 @@ NCO for Debian over the years.
 <a name="centos"></a><a name="cnt"></a><a name="rhel"></a> <!-- http://nco.sf.net#centos --> <!-- http://nco.sf.net#cnt --> <!-- http://nco.sf.net#rhel -->
 <h3><a href="http://fedora.redhat.com">Fedora</a>, RedHat Enterprise Linux (<a href="http://www.redhat.com/rhel">RHEL</a>), and Community ENTerprise Operating System (<a href="http://www.centos.org">CentOS</a>) GNU/Linux</h3>
 <ul>
-<dt>The <a href="https://admin.fedoraproject.org/pkgdb/package/nco">Fedora NCO</a> RPMs are usually up-to-date so that ‘<tt>yum install nco</tt>’ will install a recent version. 
+<dt>The <a href="https://admin.fedoraproject.org/pkgdb/package/nco">Fedora NCO</a> RPMs are usually up-to-date so that ‘<tt>dnf install nco</tt>’ will install a recent version. 
 A comprehensive list of pre-built RPMs for many OS's is <a href="http://rpmfind.net/linux/rpm2html/search.php?query=nco">here</a>.
 <li><a href="ftp://rpmfind.net/linux/fedora/linux/development/rawhide/x86_64/os/Packages/n/nco-4.3.2-1.fc20.x86_64.rpm">nco-4.3.2-1.fc20.x86_64.rpm</a>: Executables for x86_64/Fedora Core 20-compatible environments</li></dt>
-<dt>If not, try our own most recent (we stopped building RPMs many years ago and are looking for a volunteer to do this instead) self-built NCO RPMs (install with, e.g., ‘<tt>yum install nco-3.9.5-1.fc7.i386.rpm</tt>’):
+<dt>If not, try our own most recent (we stopped building RPMs many years ago and are looking for a volunteer to do this instead) self-built NCO RPMs (install with, e.g., ‘<tt>dnf install nco-3.9.5-1.fc7.i386.rpm</tt>’):
 <li><a href="src/nco-3.9.5-1.fc7.i386.rpm">nco-3.9.5-1.fc7.i386.rpm</a> (<!--#fsize file="src/nco-3.9.5-1.fc7.i386.rpm"-->): Executables for i386/Fedora Core 7-compatible environments (last updated <!--#flastmod file="src/nco-3.9.5-1.fc7.i386.rpm"-->)</li>
 <li><a href="src/nco-3.9.5-1.fc7.src.rpm">nco-3.9.5-1.fc7.src.rpm</a> (<!--#fsize file="src/nco-3.9.5-1.fc7.src.rpm"-->): Source (last updated <!--#flastmod file="src/nco-3.9.5-1.fc7.src.rpm"-->)</li>
 <li><a href="src/nco-3.9.5-1.x86_64.rpm">nco-3.9.5-1.x86_64.rpm</a> (<!--#fsize file="src/nco-3.9.5-1.x86_64.rpm"-->): Executables for x86_64/CentOS 5-compatible environments (last updated <!--#flastmod file="src/nco-3.9.5-1.x86_64.rpm"-->)</li>
@@ -895,10 +901,10 @@ Thanks to Gavin Burris and Kyle Wilcox for documenting build procedures for RHEL
 <!-- 
 # Mac OS X 10.10 (Yosemite) systems (aerosol):
 /usr/bin/scp ~/nco/doc/index.shtml zender,nco at web.sf.net:/home/project-web/nco/htdocs
-cd ~/bin/MACOSX;tar cvzf ${DATA}/nco-4.5.0.macosx.10.10.tar.gz nc*;scp ${DATA}/nco-4.5.0.macosx.10.10.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
+cd ~/bin;tar cvzf ${DATA}/nco-4.5.1.macosx.10.10.tar.gz nc*;scp ${DATA}/nco-4.5.1.macosx.10.10.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 -->
 The most up-to-date binaries are probably those in the tarball below. Those unfamiliar with installing executables from tarballs may try the (older) <a href="http://en.wikipedia.org/wiki/Apple_Disk_Image">DMG</a> files (you may need to add <tt>/opt/local/bin</tt> to your executable path to access those operators).
-<li><a href="src/nco-4.5.0.macosx.10.10.tar.gz">nco-4.5.0.macosx.10.10.tar.gz</a> (<!--#fsize file="src/nco-4.5.0.macosx.10.10.tar.gz"-->): Executables MacOSX 10.10-compatible (last updated <!--#flastmod file="src/nco-4.5.0.macosx.10.10.tar.gz"-->). 
+<li><a href="src/nco-4.5.1.macosx.10.10.tar.gz">nco-4.5.1.macosx.10.10.tar.gz</a> (<!--#fsize file="src/nco-4.5.1.macosx.10.10.tar.gz"-->): Executables MacOSX 10.10-compatible (last updated <!--#flastmod file="src/nco-4.5.1.macosx.10.10.tar.gz"-->). 
 (NB: These executables require
   the <a href="http://trac.macosforge.org/projects/macports/wiki">MacPorts</a>
   <a href="#bld_macports">dependencies</a> for <a href="http://svn.macports.org/repository/macports/trunk/dports/science/nco">NCO</a>). Maintained by NCO Project.</li>
@@ -921,10 +927,10 @@ To build NCO from source yourself using MSVC or Qt, please see the <a href="nco_
 <ul>
 <!-- Copy files from http://glace.ess.uci.edu
 /usr/bin/scp /home/pvicente/nco/doc/index.shtml pvicente,nco at web.sf.net:/home/project-web/nco/htdocs
-/usr/bin/scp /home/pvicente/windows_setup/nco-4.4.9.windows.mvs.exe pvicente,nco at web.sf.net:/home/project-web/nco/htdocs/src
+/usr/bin/scp /home/pvicente/windows_setup/nco-4.5.1.windows.mvs.exe pvicente,nco at web.sf.net:/home/project-web/nco/htdocs/src
 /usr/bin/scp /home/pvicente/windows_setup/nco-4.4.5.win32.cygwin.tar.gz pvicente,nco at web.sf.net:/home/project-web/nco/htdocs/src
 -->
-<li><a href="src/nco-4.4.9.windows.mvs.exe">nco-4.4.9.windows.mvs.exe</a> (<!--#fsize file="src/nco-4.4.9.windows.mvs.exe"-->) : Windows Self-Extracting Installer (last updated <!--#flastmod file="src/nco-4.4.9.windows.mvs.exe"-->). Maintained by Pedro Vicente.</li>
+<li><a href="src/nco-4.5.1.windows.mvs.exe">nco-4.5.1.windows.mvs.exe</a> (<!--#fsize file="src/nco-4.5.1.windows.mvs.exe"-->) : Windows Self-Extracting Installer (last updated <!--#flastmod file="src/nco-4.5.1.windows.mvs.exe"-->). Maintained by Pedro Vicente.</li>
 </ul>
 
 <a name="cygwin"></a> <!-- http://nco.sf.net#cygwin -->
@@ -1088,11 +1094,11 @@ site.</li>
 The simplest way to acquire the source is to download the compressed tarball:
 <ul>
 <li>
-<!-- scp ${DATA}/nco-4.5.0.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src -->
-<a href="src/nco-4.5.0.tar.gz">nco-4.5.0.tar.gz</a> 
-(<!--#fsize file="src/nco-4.5.0.tar.gz"--> compressed tar-file)<br>
-<!--#exec cmd="openssl dgst -md5 src/nco-4.5.0.tar.gz"--><br>
-<!--#exec cmd="openssl dgst -sha1 src/nco-4.5.0.tar.gz"--> 
+<!-- scp ${DATA}/nco-4.5.1.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src -->
+<a href="src/nco-4.5.1.tar.gz">nco-4.5.1.tar.gz</a> 
+(<!--#fsize file="src/nco-4.5.1.tar.gz"--> compressed tar-file)<br>
+<!--#exec cmd="openssl dgst -md5 src/nco-4.5.1.tar.gz"--><br>
+<!--#exec cmd="openssl dgst -sha1 src/nco-4.5.1.tar.gz"--> 
 </li>
 </ul>
 
@@ -1111,17 +1117,17 @@ You may retrieve any NCO distribution you wish from
 <a href="https://help.github.com">GitHub</a>. 
 Usually you wish to retrieve a recent tagged (i.e., released) version.
 This command retrieves the entire NCO repository (< 20 MB) and
-then checks out NCO version <tt>4.5.0</tt>:
-<p><tt>git clone https://github.com/czender/nco.git;cd nco;git checkout -b 4.5.0</tt></p>
+then checks out NCO version <tt>4.5.1</tt>:
+<p><tt>git clone https://github.com/czender/nco.git;cd nco;git checkout -b 4.5.1</tt></p>
 This command retrieves the current (“bleeding edge”)
 development version of NCO into a local directory named <tt>nco</tt>:
 <p><tt>git clone https://github.com/czender/nco.git ~/nco</tt></p>
 Track changes to the development version using
 <p><tt>cd ~/nco;git pull</tt></p>
 One difference between running a "tagged" release 
-(e.g., <tt>4.5.0</tt>) and the development version is that the
+(e.g., <tt>4.5.1</tt>) and the development version is that the
 tagged release operators will print a valid version number (e.g.,
-<tt>4.5.0</tt>) when asked to do so with the <tt>-r</tt> flag
+<tt>4.5.1</tt>) when asked to do so with the <tt>-r</tt> flag
 (e.g., <tt>ncks -r</tt>).
 The development version simply places today's date in place of the
 version.
@@ -1157,7 +1163,8 @@ we recommend that you first try the pre-built binaries for your
 system, e.g.,  
 <tt>
 <dt>sudo aptitude install nco # Debian-based systems like Debian, Mint, Ubuntu</dt>
-<dt>sudo yum-install nco      # RPM-based systems like CentOS, Fedora, openSUSE, RHEL</dt>
+<dt>sudo dnf-install nco      # Newer RPM-based systems like CentOS, Fedora, openSUSE, RHEL</dt>
+<dt>sudo yum-install nco      # Older RPM-based systems like CentOS, Fedora, openSUSE, RHEL</dt>
 <dt>sudo port install nco     # MacPorts (after installing MacPorts on Mac OS X)</dt>
 </tt>
 If pre-built executables do not satisfy you (e.g., are out-of-date)
@@ -1208,23 +1215,26 @@ For Debian-based systems:
 
 <dt><a name="yum"></a></dt> <!-- http://nco.sf.net#yum -->
 <dt><a name="bld_yum"></a></dt> <!-- http://nco.sf.net#bld_yum -->
-For RPM-based systems:
+<dt><a name="dnf"></a></dt> <!-- http://nco.sf.net#dnf -->
+<dt><a name="bld_dnf"></a></dt> <!-- http://nco.sf.net#bld_dnf -->
+For RPM-based systems (substitute <tt>yum</tt> for <tt>dnf</tt> on older Fedora systems):
 <tt>
-<dt>sudo yum install antlr antlr-C++ -y # ANTLR</dt>
-<dt>sudo yum install curl-devel libxml2-devel -y # DAP-prereqs</dt>
-<dt>sudo yum install expat expat-devel -y # expat XML parser, a UDUnits-prereq (RHEL only?)</dt>
-<dt>sudo yum install libdap libdap-devel -y # DAP</dt>
-<dt>sudo yum install bison flex gcc gcc-c++ -y # GNU toolchain</dt>
-<dt>sudo yum install gsl gsl-devel -y # GSL</dt>
-<dt>sudo yum install netcdf netcdf-devel -y # netCDF</dt>
-<dt>sudo yum install librx librx-devel -y # RX</dt>
-<dt>sudo yum install udunits2 udunits2-devel -y # UDUnits</dt>
+<dt>sudo dnf install antlr antlr-C++ -y # ANTLR</dt>
+<dt>sudo dnf install curl-devel libxml2-devel -y # DAP-prereqs</dt>
+<dt>sudo dnf install expat expat-devel -y # expat XML parser, a UDUnits-prereq (RHEL only?)</dt>
+<dt>sudo dnf install libdap libdap-devel -y # DAP</dt>
+<dt>sudo dnf install bison flex gcc gcc-c++ -y # GNU toolchain</dt>
+<dt>sudo dnf install gsl gsl-devel -y # GSL</dt>
+<dt>sudo dnf install netcdf netcdf-devel -y # netCDF</dt>
+<dt>sudo dnf install librx librx-devel -y # RX</dt>
+<dt>sudo dnf install udunits2 udunits2-devel -y # UDUnits</dt>
 </tt>
 
 <dt><a name="port"></a></dt> <!-- http://nco.sf.net#port -->
 <dt><a name="bld_macports"></a></dt> <!-- http://nco.sf.net#bld_macports -->
 For Mac OS X with MacPorts:
 <tt>
+<dt>sudo port install antlr # Antlr</dt>
 <dt>sudo port install libdap # DAP</dt>
 <dt>sudo port install gsl # GSL</dt>
 <dt>sudo port install netcdf # netCDF</dt>
@@ -1249,9 +1259,9 @@ Users should instead first download and install the Antlr found <a href="http://
   then build the latest stable NCO and install it in,
   e.g., <tt>/usr/local</tt> with: 
 <tt>
-<dt>wget https://github.com/czender/nco/archive/4.5.0.tar.gz</dt>
-<dt>tar xvzf 4.5.0.tar.gz</dt>
-<dt>cd nco-4.5.0</dt>
+<dt>wget https://github.com/czender/nco/archive/4.5.1.tar.gz</dt>
+<dt>tar xvzf 4.5.1.tar.gz</dt>
+<dt>cd nco-4.5.1</dt>
 <dt>./configure --prefix=/usr/local</dt>
 <dt>make</dt>
 <dt>sudo make install</dt>
@@ -1293,11 +1303,12 @@ The unsatisfied or adventurous may try my personal executables which
 are built from the “master branch” of NCO, not a tagged
 version, and therefore may behave slightly differently.
 <ul>
-<li>NCAR CISL <tt>yellowstone.ucar.edu</tt> (Linux 2.6.x): <tt>~zender/bin/LINUXAMD64</tt></li>
-<li>NCAR CISL <tt>mirage0.ucar.edu</tt> (Linux 2.6.x): <tt>~zender/bin/LINUXAMD64</tt></li>
-<li>ORNL Rhea <tt></tt> (Linux 2.6.x): <tt>~zender/bin/LINUXAMD64</tt></li>
-<li>UCI ESS <tt>greenplanet.ps.uci.edu</tt> (Linux 2.6.x): <tt>~zender/bin/LINUX</tt></li>
-<li>UCI ESS <tt>dust.ess.uci.edu</tt> (Linux 3.2.x): <tt>~zender/bin/LINUXAMD64</tt></li>
+<li>ANL Cooley <tt></tt> (Linux 2.6.x): <tt>~zender/bin</tt></li>
+<li>NCAR CISL <tt>yellowstone.ucar.edu</tt> (Linux 2.6.x): <tt>~zender/bin</tt></li>
+<li>NCAR CISL <tt>mirage0.ucar.edu</tt> (Linux 2.6.x): <tt>~zender/bin</tt></li>
+<li>ORNL Rhea <tt></tt> (Linux 2.6.x): <tt>~zender/bin</tt></li>
+<li>UCI ESS <tt>greenplanet.ps.uci.edu</tt> (Linux 2.6.x): <tt>~zender/bin</tt></li>
+<li>UCI ESS <tt>dust.ess.uci.edu</tt> (Linux 3.2.x): <tt>~zender/bin</tt></li>
 </ul>
 <hr></p>
 <!-- End http://nco.sf.net#NCAR -->
diff --git a/doc/nco.texi b/doc/nco.texi
index fff0f83..1f1ad8c 100644
--- a/doc/nco.texi
+++ b/doc/nco.texi
@@ -117,12 +117,12 @@ Octave TeXInfo manual shows clean TeXInfo structure
 @setfilename nco.info
 
 @c Define edition, date, ...
- at set nco-edition 4.5.0
- at set doc-edition 4.5.0
+ at set nco-edition 4.5.1
+ at set doc-edition 4.5.1
 @set copyright-years 1995--2015
 @set update-year 2015
- at set update-date 10 June 2015
- at set update-month June 2015
+ at set update-date 10 July 2015
+ at set update-month July 2015
 
 @settitle @acronym{NCO} @value{nco-edition} User Guide
 
@@ -136,6 +136,12 @@ Octave TeXInfo manual shows clean TeXInfo structure
 @include my-bib-macros.texi
 @mybibuselist{References}
 
+ at c 20150616 Add version info as per
+ at c http://www.gnu.org/software/automake/manual/html_node/Texinfo.html
+ at c Seems to require running automake --add-missing on local maching
+ at c Nightmare because it means clients must run autoconf
+ at c @include version.texi
+
 @c end of header
 
 @c TeXInfo macros may not appear before TeXInfo @setfilename header
@@ -517,27 +523,32 @@ Charlie Zender@*
 April, 2012@*
 Irvine, California@*
 
- at ignore
 @sp 2
+ at c 20150619 Test values automagically installed by version.texi, which is a nightmare
+ at c Test print @value{EDITION}, @value{VERSION}, @value{UPDATED}, @value{UPDATED-MONTH}.
 The @acronym{NASA} @acronym{ACCESS} 2011 program generously supported 
 (Cooperative Agreement NNX12AF48A) @acronym{NCO} from 2012--2015.
-We accomplished our goals and produced the first iteration of a
-Group-oriented Data Analysis and Distribution (@acronym{GODAD}) software 
-ecosystem. 
-Shifting geoscience data analysis to @acronym{GODAD}, no small task,
-drives our plans.
-Partly due to this success, the @acronym{NASA} @acronym{ACCESS} 2013
-program agreed to support (Cooperative Agreement NNX14AH55A)
- at acronym{NCO} from 2014--2016. 
-This support will allow us to implement support for Swath-like Data
-(@acronym{SLD}) and re-gridding.
-
+This allowed us to produce the first iteration of a Group-oriented 
+Data Analysis and Distribution (@acronym{GODAD}) software ecosystem. 
+Shifting more geoscience data analysis to @acronym{GODAD} is a 
+long-term plan.
+Then the @acronym{NASA} @acronym{ACCESS} 2013 program agreed to
+support (Cooperative Agreement NNX14AH55A) @acronym{NCO} from
+2014--2016.  
+This support permits us to implement support for Swath-like Data
+(@acronym{SLD}).
+Most recently, the @acronym{DOE} has funded me to implement 
+ at acronym{NCO} re-gridding and parallelization in support of their 
+ at acronym{ACME} program.
+After many years of crafting @acronym{NCO} as an after-hours hobby,
+I finally have the cushion necessary to give it some real attention. 
+And I'm looking forward to this next, and most intense yet, phase of
+ at acronym{NCO} development.
 @sp 1
 @noindent
 Charlie Zender@*
-June, 2014@*
+June, 2015@*
 Irvine, California@*
- at end ignore
 
 @html
 <a name="smr"></a> <!-- http://nco.sf.net/nco.html#smr -->
@@ -5948,8 +5959,11 @@ Currently @acronym{NCO} understands only the mapfile format pioneered by
 @acronym{SCRIP} 
 (@url{http://oceans11.lanl.gov/svn/SCRIP/trunk/SCRIP})
 and later extended by @acronym{ESMF} 
-(@uref{http://www.earthsystemcog.org/projects/regridweightgen}).
-See those references for additional documentation on map formats.
+(@uref{http://www.earthsystemcog.org/projects/regridweightgen}),
+and adopted by Tempest
+(@uref{https://github.com/ClimateGlobalChange/tempestremap.git}).
+See those references for documentation on map formats, grid
+specification, and weight generation. 
 
 The regridding currently supported by @acronym{NCO} could equally well
 be called weight-application.
@@ -6005,8 +6019,8 @@ identifying gridcell overlap and apportioning values correctly
 from source to destination.
 The presence of missing values forces a decision on how to handle
 destination gridcells where some but not all source cells are valid. 
- at acronym{NCO} implements one of two procedures: ``conservative'' or
-``renormalized''. 
+ at acronym{NCO} allows the user to choose between two distinct algorithms:
+``conservative'' and ``renormalized''. 
 The ``conservative'' algorithm uses all valid data from the input grid
 on the output grid once and only once.
 Destination cells receive the weighted valid values of the source cells.
@@ -6014,15 +6028,19 @@ This is conservative because the global integrals of the source and
 destination fields are equal.
 The ``renormalized'' algorithm divides the destination value by the sum
 of the valid weights.
-This returns ``reasonable'' values, i.e., the mean of the valid input
-values. 
-However, renormalization is equivalent to extrapolating valid data to
-missing regions. 
+This produces values equal to the mean of the valid input values, but
+extended to the entire destination gridcell. 
+Thus renormalization is equivalent to extrapolating valid data to
+missing regions.  
 Input and output integrals are unequal and renormalized regridding is
-not conservative.  
+not conservative. 
+Both algorithms produce identical answers when no missing data maps to 
+the destination gridcell.
 
 @cindex @var{wgt_thr}
-By default, @acronym{NCO} implements the ``conservative'' algorithm.
+By default, @acronym{NCO} implements the ``conservative'' algorithm
+because it has useful properties, is simpler to understand, and requires
+no additional parameters.
 To employ the ``renormalized'' algorithm instead, use the @samp{--rnr},
 @samp{--rgr_rnr}, or @samp{--renormalize} options to supply
 @var{wgt_thr}, the threshold weight for valid destination values.
@@ -6090,7 +6108,7 @@ These annotations include
     written to an unstructured output grid will all contain the 
     @var{col_nm}-dimension.
     To treat a different dimension as unstructured, use the option
-    @samp{--rgr ncol=@var{col_nm}}. 
+    @samp{--rgr col=@var{col_nm}}. 
     Note: Often there is no coordinate variable for the
     @var{col_nm}-dimension, i.e., there is no variable named
     @var{col_nm}, although such a coordinate could contain useful
@@ -7136,7 +7154,7 @@ default mappings.@*
 @var{cnk_map} key values: @samp{xst}, @samp{cnk_xst}, @samp{map_xst}@*
 Mnemonic: E at emph{X}i at emph{ST}@*
 @item Chunksize Balances 1D and (N-1)-D Access to N-D Variable [@emph{default for netCDF4 input}]
-Definition: Chunksizes are chosen so that 1-D and (@var{(N-1)})-D
+Definition: Chunksizes are chosen so that 1-D and (@var{N-1})-D
 hyperslabs of @var{3}-D variables (e.g., point-timeseries orn
 latitude/longitude surfaces of 3-D fields) both require approximately
 the number of chunks. 
@@ -7638,19 +7656,31 @@ For clarity the @samp{-4/-7} switches are omitted in subsequent
 examples. 
 @cindex @code{number_of_significant_digits}
 @cindex @code{least_significant_digit}
+ at cindex Jeff Whitaker
+ at cindex Rich Signell
+ at cindex John Caron
 @acronym{NCO} attaches attributes that indicate the algorithm used and
 degree of precision retained for each variable affected by
 @acronym{PPC}. 
 The @acronym{NSD} and @acronym{DSD} algorithms store the attributes
 @code{number_of_significant_digits} and @code{least_significant_digit}
- at footnote{The @command{nc3tonc4} tool by Jeff Whitaker inspired
- at acronym{NCO} to implement @acronym{PPC}.
+ at footnote{
+A suggestion by Rich Signell and the @command{nc3tonc4} tool by Jeff
+Whitaker inspired @acronym{NCO} to implement @acronym{PPC}.
 @acronym{NCO} implements a different @acronym{DSD} algorithm than 
 @command{nc3tonc4}, and produces slightly different (not bit-for-bit) 
 though self-consistent and equivalent results.
 @command{nc3tonc4} records the precision of its @acronym{DSD} algorithm 
 in the attribute @code{least_significant_digit} and @acronym{NCO} 
-does the same for consistency.}, respectively.
+does the same for consistency.
+The Unidata blog 
+ at uref{http://www.unidata.ucar.edu/blogs/developer/en/entry/compression_by_bit_shaving,  
+here} also shows how to compress @acronym{IEEE} floating point data by
+zeroing insignificant bits.
+The author, John Caron, writes that the technique has been called
+``bit-shaving''.
+When combined with our bias-elimination procedure that rounds-up to one,
+a more suitable terminology might be ``bit-grooming''.}, respectively.
 
 It is safe to attempt @acronym{PPC} on input that has already been
 rounded. 
@@ -9573,23 +9603,24 @@ The input contains a single-precision global temperature field
 circulation model (@acronym{GCM}) run and stored at @w{1.9 by 2.5}
 degrees resolution. 
 This requires @w{94 latitudes} and @w{144 longitudes}, or @math{13,824} 
-total surface gridpoints, a typical GCM resolution these days.
+total surface gridpoints, a typical GCM resolution in 2008--2013.
 These input characteristics are provided only to show the context
 to the interested reader, equivalent results would be found in 
 statistics of any dataset of comparable size.
 Models often represent Earth on a spherical grid where global averages 
 must be created by weighting each gridcell by its latitude-dependent
-weight (i.e., the Gaussian weight stored in @code{gw}), or by the
+weight (e.g., a Gaussian weight stored in @code{gw}), or by the
 surface area of each contributing gridpoint (stored in @code{area}).
 
 Like many geophysical models and most @acronym{GCM}s, @acronym{CAM3}
 runs completely in double-precision yet stores its archival output in
 single-precision to save space.
 In practice such models usually save multi-dimensional prognostic and
-diagnostic fields (like @code{TREFHT(lat,lon)} and @code{area(lat,lon)})
-as single-precision, while saving all one-dimensional coordinates and
-weights (here @code{lat}, @code{lon}, and @code{gw(lon)}) as
-double-precision.  
+diagnostic fields (like @code{TREFHT(lat,lon)}) as single-precision,
+while saving all one-dimensional coordinates and weights (here
+ at code{lat}, @code{lon}, and @code{gw(lon)}) as double-precision.  
+The gridcell area @code{area(lat,lon)} is an extensive grid property
+that should be, but often is not, stored as double-precision.
 To obtain pure double-precision arithmetic @emph{and} storage of the 
 globla mean temperature, we first create and store double-precision
 versions of the single-precision fields:
@@ -9640,9 +9671,9 @@ These averages differ in the fifth digit, i.e., they agree only to four
 significant figures!
 Given that climate scientists are concerned about global temperature
 variations of a tenth of a degree or less, this difference is large.
-It means that the global mean temperature changes scientists are looking
-for are comparable in size to the numerical artifacts produced by the
-averaging procedure. 
+Global mean temperature changes significant to climate scientists are  
+comparable in size to the numerical artifacts produced by the averaging
+procedure.  
 
 @cindex rounding
 @cindex random walk
@@ -9682,7 +9713,7 @@ Hence, addition alone of about fifteen thousand single-precision floats
 is expected to consume about two significant digits of precision.
 This neglects the error due to the inner product (weights times values)
 and normalization (division by tally) aspects of a weighted average.
-the ratio of two numbers each containing a numerical bias can magnify
+The ratio of two numbers each containing a numerical bias can magnify
 the size of the bias. 
 In summary, a global mean number computed from about 15,000 gridpoints
 each with weights can be expected to lose up to three significant digits.
@@ -9876,7 +9907,7 @@ contents of all files that were appended to a file
 in append (@samp{-A}) mode only, inadvertently overwrite the global
 metadata (including  @code{history}) of the output file with that of the
 input file. 
-This is the opposite behavior most would want.}.
+This is opposite the behavior most would want.}.
 This convention stores those contents in the
 @code{history_of_appended_files} attribute, which complements
 the @code{history}-attribute to provide a more complete provenance.
@@ -11333,7 +11364,7 @@ operands are True/False.
 # Simple example
 if(time>0)
   print("All values of time are greater than zero\n");
-else if( time<0)
+else if(time<0)
   print("All values of time are less than zero\n");   
 else {
   time_max=time.max();
@@ -11515,7 +11546,8 @@ print(three_dmn_var_dbl);
 @end example
 
 @html
-<a name="ncap_mtd"></a> <!-- http://nco.sf.net/nco.html#ncap_mtd -->
+<a name="ncap_mth"></a> <!-- http://nco.sf.net/nco.html#ncap_mth -->
+<a name="ncap2_mth"></a> <!-- http://nco.sf.net/nco.html#ncap2_mth -->
 @end html
 @node Methods and functions, RAM variables, Missing values ncap2, ncap2 netCDF Arithmetic Processor
 @subsection Methods and functions
@@ -11584,7 +11616,7 @@ four_time_avg=four_dmn_rec_var($time);
 @end example
 
 @sp 1
- at noindent @strong{ Packing Methods @* } 
+ at noindent @strong{Packing Methods @*}
 For more information see @pxref{Packed data} and @pxref{ncpdq netCDF Permute Dimensions Quickly}@*
 @table @code
 @item pack() & pack_short()
@@ -11603,6 +11635,16 @@ Variable is packed to @code{NC_INT}
 @cindex unpack()
 The standard unpacking algorithm is applied. 
 @end table
+ at acronym{NCO} automatically unpacks packed data before arithmetically
+modifying it. 
+After modification @acronym{NCO} stores the unpacked data.
+To store it as packed data again, repack it with, e.g., the 
+ at code{pack()} function.
+To ensure that @code{temperature} is packed in the output file,
+regardless of whether it is packed in the input file, one uses, e.g.,
+ at example
+ncap2 -s 'temperature=pack(temperature-273.15)' in.nc out.nc
+ at end example
 
 @noindent @strong{Basic Methods @*}
 These methods work with variables and attributes. They have no arguments
@@ -14227,6 +14269,10 @@ The @var{att_dsc} fields are in the following order:@*
 @item att_nm
 Attribute name. 
 Example: @code{units}
+As of @acronym{NCO} 4.5.1 (July, 2015), @command{ncatted} accepts 
+regular expressions (@pxref{Subsetting Files}) for attribute names
+(it has ``always'' accepted regular expressions for variable names). 
+Regular expressions will select all matching attribute names. 
 @item var_nm
 Variable name. 
 Example: @code{pressure}, @code{'^H2O'}.
@@ -14235,7 +14281,7 @@ Example: @code{pressure}, @code{'^H2O'}.
 @cindex pattern matching
 @cindex wildcards
 Regular expressions (@pxref{Subsetting Files}) are accepted and will 
-select any matching variable (@emph{not} attribute) names.
+select all matching variable (and/or group) names. 
 The names @code{global} and @code{group} have special meaning.
 @item mode
 Edit mode abbreviation. 
@@ -14257,8 +14303,8 @@ appearance.
 
 The value of @var{att_nm} is the name of the attribute to edit. 
 This meaning of this should be clear to all @command{ncatted} users.
-Recall, as mentioned above, that @var{var_nm} (but not @var{att_nm}) may
-be specified as a regular expression. 
+Both @var{att_nm}) and @var{var_nm} may be specified as regular
+expressions.
 If @var{att_nm} is omitted (i.e., left blank) and @dfn{Delete} mode is 
 selected, then all attributes associated with the specified variable
 will be deleted. 
@@ -14592,13 +14638,17 @@ ncatted -a quanta,energy,o,s,'010,101,111,121' in.nc
 @cindex wildcards
 As of @acronym{NCO} 3.9.6 (January, 2009), @command{ncatted} accepts
 @dfn{extended regular expressions} as arguments for variable names,
-though not for attribute names.
-Create @code{isotope} attributes for all variables containing @samp{H2O} 
-in their names.
+and, since @acronym{NCO} 4.5.1 (July, 2015), for attribute names.
 @example
 ncatted -a isotope,'^H2O*',c,s,'18' in.nc
+ncatted -a '.?_iso19115$','^H2O*',d,, in.nc
 @end example
-See @ref{Subsetting Files} for more details.
+The first example creates @code{isotope} attributes for all variables
+whose names contain @samp{H2O}.
+The second deletes all attributes whose names end in @code{_iso19115}
+from all variables whose names contain @samp{H2O}.
+See @ref{Subsetting Files} for more details on using regular
+expressions. 
 
 @cindex groups
 As of @acronym{NCO} 4.3.8 (November, 2013), @command{ncatted} 
@@ -14623,6 +14673,10 @@ ncatted -O -a g1_grp_att,g1,c,sng,'new group attribute' in_grp.nc
 # Add new_glb_att global attribute to root group
 ncatted -O -a new_glb_att,global,c,sng,'new global attribute' in_grp.nc
 @end example
+Note that regular expressions work well in conjuction with group
+path support. 
+In other words, the variable name (including group path component) and
+the attribute names may both be extended regular expressions.
 
 Demonstrate input of C-language escape sequences (e.g., @code{\n}) and
 other special characters (e.g., @code{\"}) 
diff --git a/man/Makefile.in b/man/Makefile.in
index 437a7f0..c4932ce 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
 
 # $Header$ -*-makefile-*-
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -81,8 +91,6 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = man
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/autobld/mkinstalldirs
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -90,6 +98,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
@@ -145,6 +154,8 @@ am__installdirs = "$(DESTDIR)$(man1dir)"
 NROFF = nroff
 MANS = $(man_MANS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+	$(top_srcdir)/autobld/mkinstalldirs
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -309,7 +320,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign man/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -533,6 +543,8 @@ uninstall-man: uninstall-man1
 	ps ps-am tags-am uninstall uninstall-am uninstall-man \
 	uninstall-man1
 
+.PRECIOUS: Makefile
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/man/ncatted.1 b/man/ncatted.1
index 3435ae9..c0193aa 100644
--- a/man/ncatted.1
+++ b/man/ncatted.1
@@ -417,10 +417,10 @@ with care.
 Append the string "Data version 2.0.\\n" to the global attribute
 .BR history :
 .RS
-ncatted -O -a history,global,a,c,"Data version 2.0\\n" in.nc 
+ncatted \-O \-a history,global,a,c,"Data version 2.0\\n" in.nc 
 .RE
 Note the use of embedded C language 
-.BR printf() -style
+.BR printf() \-style
 escape
 sequences. 
 .PP
@@ -430,14 +430,14 @@ attribute for variable
 .B T
 from whatever it currently is to "temperature":
 .RS
-ncatted -O -a long_name,T,o,c,temperature in.nc
+ncatted \-O \-a long_name,T,o,c,temperature in.nc
 .RE
 .PP
 Delete all existing 
 .B units
 attributes:
 .RS
-ncatted -O -a units,,d,, in.nc
+ncatted \-O \-a units,,d,, in.nc
 .RE
 The value of 
 .I var_nm
@@ -456,7 +456,7 @@ Modify all existing
 .B units
 attributes to "meter second-1"
 .RS
-ncatted -O -a units,,m,c,"meter second-1" in.nc
+ncatted \-O \-a units,,m,c,"meter second-1" in.nc
 .RE
 .PP
 Overwrite the 
@@ -465,7 +465,7 @@ attribute of variable
 .B energy
 to an array of four integers. 
 .RS
-ncatted -O -a quanta,energy,o,s,"010,101,111,121" in.nc
+ncatted \-O \-a quanta,energy,o,s,"010,101,111,121" in.nc
 .RE
 .PP
 See the manual for more complex examples, including how to input
diff --git a/man/ncks.1 b/man/ncks.1
index 3d48a0c..b4a580d 100644
--- a/man/ncks.1
+++ b/man/ncks.1
@@ -52,7 +52,7 @@ dbg_lvl]
 .IR var1 [,
 .IR var2 [,...]]=
 .IR prc ]]
-[-Q] [\-q]
+[\-Q] [\-q]
 [\-R] [\-r] [\-\-rad] [\-\-ram_all] [\--rnr
 .IR wgt ] [\-s 
 .IR format ] [\-t
diff --git a/src/Makefile.in b/src/Makefile.in
index 23aff6d..cff8a5a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
 
 # $Header$ -*-makefile-*-
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -81,8 +91,6 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = src
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/autobld/mkinstalldirs
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -90,6 +98,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
@@ -149,6 +158,8 @@ am__define_uniq_tagged_files = \
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+	$(top_srcdir)/autobld/mkinstalldirs
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -337,7 +348,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign src/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -632,6 +642,8 @@ uninstall-am:
 	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
 	ps ps-am tags tags-am uninstall uninstall-am
 
+.PRECIOUS: Makefile
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/nco++/Makefile.in b/src/nco++/Makefile.in
index 238386d..0438847 100644
--- a/src/nco++/Makefile.in
+++ b/src/nco++/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,17 @@
 # Process this file with automake to produce Makefile.in
 
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -86,9 +96,6 @@ host_triplet = @host@
 target_triplet = @target@
 bin_PROGRAMS = ncap2$(EXEEXT)
 subdir = src/nco++
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/autobld/mkinstalldirs \
-	$(top_srcdir)/autobld/depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -96,6 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
@@ -195,6 +203,8 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autobld/depcomp \
+	$(top_srcdir)/autobld/mkinstalldirs
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -412,7 +422,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/nco++/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign src/nco++/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -782,6 +791,8 @@ uninstall-am: uninstall-binPROGRAMS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
 
+.PRECIOUS: Makefile
+
 
 # Configure automatigically includes following libraries as requested:
 # Keep list here as reminder:
diff --git a/src/nco++/Makefile.old b/src/nco++/Makefile.old
index 072c437..8d77945 100644
--- a/src/nco++/Makefile.old
+++ b/src/nco++/Makefile.old
@@ -158,7 +158,7 @@ ifndef ${MPI_FAKE} # MPI
  MPI_FAKE := N
 endif # endif MPI_FAKE
 ifndef ${NETCDF4} # netCDF4 support
- NETCDF4 := N
+ NETCDF4 := Y
 endif # endif NETCDF4
 ifndef NETCDF_ROOT
  NETCDF_ROOT := /usr/local
@@ -184,7 +184,7 @@ ifndef ${OMP} # OpenMP
  OMP := N
 endif # endif OMP
 ifndef OPTS
- OPTS := O
+ OPTS := D
 endif # endif OPTS
 ifndef ${PNETCDF} # pnetCDF support
  PNETCDF := N
@@ -542,6 +542,13 @@ endif # !UDUNITS
 ifeq (${null},$(findstring SGI,${PVM_ARCH}))
  CPP_TKN_OS += -DHAVE_CSTDLIB
 endif # SGI
+ifeq (${NETCDF4},Y)
+ CPP_TKN_OS += -DENABLE_NETCDF4 -DHAVE_NETCDF4_H
+endif # endif NETCDF4
+ifeq (${PNETCDF},Y)
+ CPP_TKN_OS += -DENABLE_PNETCDF
+endif # !PNETCDF
+# endif PNETCDF
 
 # Works on AIX and AIX46K
 ifneq (${null},$(findstring AIX,${PVM_ARCH}))
diff --git a/src/nco++/fmc_all_cls.cc b/src/nco++/fmc_all_cls.cc
index f18af5f..a2cb1e9 100644
--- a/src/nco++/fmc_all_cls.cc
+++ b/src/nco++/fmc_all_cls.cc
@@ -66,6 +66,9 @@
       fmc_vtr.push_back( fmc_cls("avg",this,(int)PAVG));
       fmc_vtr.push_back( fmc_cls("avgsqr",this,(int)PAVGSQR));
       fmc_vtr.push_back( fmc_cls("max",this,(int)PMAX));
+      fmc_vtr.push_back( fmc_cls("mibs",this,(int)PMIBS));
+      fmc_vtr.push_back( fmc_cls("mabs",this,(int)PMABS));
+      fmc_vtr.push_back( fmc_cls("mebs",this,(int)PMEBS));
       fmc_vtr.push_back( fmc_cls("min",this,(int)PMIN));
       fmc_vtr.push_back( fmc_cls("rms",this,(int)PRMS));
       fmc_vtr.push_back( fmc_cls("rmssdn",this,(int)PRMSSDN));
@@ -250,6 +253,18 @@
                     (void)nco_var_nrm(var->type,var->sz,var->has_mss_val,var->mss_val,var->tally,var->val);
                     break;
                     
+                case PMIBS:
+                    var=nco_var_avg(var1,dim,avg_nbr_dim,nco_op_mibs,False,&ddra_info);
+                    break;
+                    
+                case PMABS:
+                    var=nco_var_avg(var1,dim,avg_nbr_dim,nco_op_mabs,False,&ddra_info);
+                    break;
+                    
+                case PMEBS:
+                    var=nco_var_avg(var1,dim,avg_nbr_dim,nco_op_mebs,False,&ddra_info);
+                    break;
+                    
                 case PMAX:
                     var=nco_var_avg(var1,dim,avg_nbr_dim,nco_op_max,False,&ddra_info);
                     break;
@@ -3123,7 +3138,7 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
                   Some classes deal with a whole family of FUNCS others only one or two
                   The index's are defined in an enum. 
                   so for (basic)-    bsc_cls we have:   enum {PSIZE, PTYPE, PNDIMS, PEXISTS };
-                  and for(aggregate) agg_cls we have:   enum {PAVG ,PAVGSQR ,PMAX ,PMIN ,PRMS, PRMSSDN, PSQRAVG, PTTL} 
+                  and for(aggregate) agg_cls we have:   enum {PAVG ,PAVGSQR ,PMIBS, PMABS, PMEBS, PMAX ,PMIN ,PRMS, PRMSSDN, PSQRAVG, PTTL} 
 
   This vector 'fmc_vtr' is used by the lexer to identify FUNC names and to distingush them from var names 
   so for example:
diff --git a/src/nco++/fmc_all_cls.hh b/src/nco++/fmc_all_cls.hh
index e8245eb..325ba0b 100644
--- a/src/nco++/fmc_all_cls.hh
+++ b/src/nco++/fmc_all_cls.hh
@@ -79,7 +79,7 @@ public:
 //Aggregate Functions /***************************************/
 class agg_cls: public vtl_cls {
 private:
-  enum{ PAVG ,PAVGSQR ,PMAX ,PMIN ,PRMS,
+  enum{ PAVG ,PAVGSQR , PMIBS, PMABS, PMEBS, PMAX ,PMIN ,PRMS,
 	PRMSSDN, PSQRAVG, PTTL};
   bool _flg_dbg;
 public:
diff --git a/src/nco++/ncap2.cc b/src/nco++/ncap2.cc
index 95e7582..a8e1439 100644
--- a/src/nco++/ncap2.cc
+++ b/src/nco++/ncap2.cc
@@ -1,5 +1,5 @@
 /* $Header$ */
-
+ 
 /* ncap2 -- netCDF arithmetic processor */
 
 /* Purpose: Compute user-defined derived fields using forward algebraic notation applied to netCDF files */
@@ -554,14 +554,14 @@ main(int argc,char **argv)
   (void)pop_fmc_vtr(fmc_vtr,&misc_obj);
 
 #ifdef ENABLE_GSL
-#ifdef ENABLE_NCO_GSL
+# ifdef ENABLE_NCO_GSL
   // nco_gsl functions
   nco_gsl_cls nco_gsl_obj(true); 
 
   // Populate vector
   (void)pop_fmc_vtr(fmc_vtr,&nco_gsl_obj);
-#endif //ENABLE_NCO_GSL
-#endif //ENABLE_GSL
+# endif // !ENABLE_NCO_GSL
+#endif // !ENABLE_GSL
    
   // GSL functions
 #ifdef ENABLE_GSL
@@ -693,10 +693,10 @@ main(int argc,char **argv)
   prs_arg.cnk_sz=(size_t*)NULL; /* Chunk sizes NULL for now */ 
   
 #ifdef NCO_NETCDF4_AND_FILLVALUE
-  prs_arg.NCAP4_FILL = (fl_out_fmt==NC_FORMAT_NETCDF4 || fl_out_fmt==NC_FORMAT_NETCDF4_CLASSIC);
+  prs_arg.NCAP4_FILL=(fl_out_fmt == NC_FORMAT_NETCDF4 || fl_out_fmt == NC_FORMAT_NETCDF4_CLASSIC);
 #else
   prs_arg.NCAP4_FILL=false;
-#endif
+#endif // !ENABLE_NETCDF4
   prs_arg.ntl_scn=false;
   (void)ram_vars_add(&prs_arg);
   
@@ -759,7 +759,7 @@ main(int argc,char **argv)
       Nvar->flg_stt=2;   
       prs_arg.var_vtr.push(Nvar);
       /* Copy output attributes into var_vtr */
-      ncap_att_gnrl(xtr_lst_a[idx].nm, xtr_lst_a[idx].nm,2,&prs_arg);        
+      ncap_att_gnrl(xtr_lst_a[idx].nm,xtr_lst_a[idx].nm,2,&prs_arg);        
     } /* end loop over variables */
 
     /* Free lists */
@@ -934,9 +934,8 @@ main(int argc,char **argv)
     } /* endif */
 
      /* Write misssing value contained inside variable */
-     /* If missing value type is same as disk type  */  
-     /*
-    if(var_vtr[idx]->xpr_typ == ncap_var ){
+     /* If missing value type is same as disk type */  
+     /* if(var_vtr[idx]->xpr_typ == ncap_var){
       if(!var_vtr[idx]->var->has_mss_val) continue;  
       att_item.att_nm=strdup(nco_mss_val_sng_get());
       att_item.var_nm=strdup(var_vtr[idx]->getVar().c_str());
@@ -945,33 +944,31 @@ main(int argc,char **argv)
       att_item.val=var_vtr[idx]->var->mss_val;
       att_item.mode=aed_overwrite;
       //att_item.mode=aed_create;
-    }
-     */
+    } */
     if(var_vtr[idx]->xpr_typ == ncap_att){
       /* Skip missing values (for now) */
       if(var_vtr[idx]->getAtt() == nco_mss_val_sng_get()) continue;     
-    
       att_item.att_nm=strdup(var_vtr[idx]->getAtt().c_str());
       att_item.var_nm=strdup(var_vtr[idx]->getVar().c_str());
       att_item.sz=var_vtr[idx]->var->sz;
       att_item.type=var_vtr[idx]->var->type;
       att_item.val=var_vtr[idx]->var->val;
       att_item.mode=aed_overwrite;
-    } 
-   
+    } /* endif ncap_att */
 
-    if(!strcmp(att_item.var_nm,"global")) 
+    if(!strcmp(att_item.var_nm,"global")){
       var_id=NC_GLOBAL;
-    else{
+    }else{
       rcd=nco_inq_varid_flg(out_id,att_item.var_nm,&var_id);
       if(rcd != NC_NOERR)  goto cln_up;
     } /* end else */
     /* Check size */
-    if(att_item.sz > NC_MAX_ATTRS ){ 
+    if(att_item.sz > NC_MAX_ATTRS){ 
       (void)fprintf(stdout,"%s: Attribute %s size %ld excceeds maximum %d\n",nco_prg_nm_get(),att_item.att_nm,att_item.sz, NC_MAX_ATTRS );
       goto cln_up;
     } /* end if */
-    /* NB: These attributes should probably be written prior to last data mode */
+    /* NB: Write these attributes prior to last data mode
+       20150616: ncap2.in fails here because time1 attribute bounds is passed with att_item.val=NULL */
     (void)nco_aed_prc(out_id,var_id,att_item);
     
   cln_up:
@@ -1042,23 +1039,19 @@ main(int argc,char **argv)
     for(idx=0;idx<cnk_nbr;idx++) cnk_arg[idx]=(char *)nco_free(cnk_arg[idx]);
     if(cnk_nbr > 0) cnk.cnk_dmn=(cnk_dmn_sct **)nco_cnk_lst_free(cnk.cnk_dmn,cnk_nbr);
     /* Free dimension vectors */
-    if(dmn_in_vtr.size() > 0) { 
+    if(dmn_in_vtr.size() > 0)
       for(idx=0;idx<dmn_in_vtr.size();idx++)
         (void)nco_dmn_free(dmn_in_vtr[idx]);
-    }
-    if(dmn_out_vtr.size() > 0) { 
+    if(dmn_out_vtr.size() > 0) 
       for(idx=0;idx< dmn_out_vtr.size();idx++)
         (void)nco_dmn_free(dmn_out_vtr[idx]);
-    }
     /* Free var_vtr */
-    if(var_vtr.size() > 0) { 
+    if(var_vtr.size() > 0)
       for(idx=0; idx < var_vtr.size(); idx++)
         delete var_vtr[idx];
-    }  
 
     /* Clear vectors */
-    /*
-    fmc_vtr.clear();
+    /* fmc_vtr.clear();
     cnv_obj.fmc_vtr.clear();
     agg_obj.fmc_vtr.clear();
     utl_obj.fmc_vtr.clear();
@@ -1067,9 +1060,7 @@ main(int argc,char **argv)
     bsc_obj.fmc_vtr.clear();
     pdq_obj.fmc_vtr.clear();
     msk_obj.fmc_vtr.clear();
-    pck_obj.fmc_vtr.clear();     
-
-    */
+    pck_obj.fmc_vtr.clear(); */
     /* Free variable lists */
     if(xtr_nbr > 0) var=nco_var_lst_free(var,xtr_nbr);
     if(xtr_nbr > 0) var_out=nco_var_lst_free(var_out,xtr_nbr);
@@ -1134,31 +1125,29 @@ ram_vars_add
   
   var1=ncap_sclr_var_mk(std::string("__UINT64"),nco_int(NC_UINT64));
   prs_arg->ncap_var_write(var1,true);
-
 #endif // !ENABLE_NETCDF4
   
-  #ifdef INFINITY
-  var1=ncap_sclr_var_mk(std::string("inff"),INFINITY); //float
+#ifdef INFINITY
+  var1=ncap_sclr_var_mk(std::string("inff"),INFINITY); // float
   prs_arg->ncap_var_write(var1,true);
-  #endif
+#endif // !INFINITY
 
-  #ifdef NAN
-  var1=ncap_sclr_var_mk(std::string("nanf"),NAN);    //float
+#ifdef NAN
+  var1=ncap_sclr_var_mk(std::string("nanf"),NAN); // float
   prs_arg->ncap_var_write(var1,true);
-  #endif
+#endif // !NAN
 
-  #ifdef HUGE_VAL
-  var1=ncap_sclr_var_mk(std::string("inf"),HUGE_VAL);    //double
+#ifdef HUGE_VAL
+  var1=ncap_sclr_var_mk(std::string("inf"),HUGE_VAL); // double
   prs_arg->ncap_var_write(var1,true);
-  #endif
+#endif // !HUGE_VAL
 
   char buff[20];
   double dnan;
 #ifndef _MSC_VER
-  if( (dnan=nan(buff)) ){
-    var1=ncap_sclr_var_mk(std::string("nan"),dnan);    //double
+  if((dnan=nan(buff))){
+    var1=ncap_sclr_var_mk(std::string("nan"),dnan); // double
     prs_arg->ncap_var_write(var1,true);
-  }
-#endif
-
+  } // ! dnan
+#endif // !_MSC_VER
 } // end ram_vars_add()
diff --git a/src/nco++/ncap2_utl.cc b/src/nco++/ncap2_utl.cc
index cfe5200..f5c1a81 100644
--- a/src/nco++/ncap2_utl.cc
+++ b/src/nco++/ncap2_utl.cc
@@ -35,7 +35,7 @@ ncap_var_udf(const char *var_nm)
   // type as nco_var_cnf_typ bombs out
   // Temporary solution -- set the type to NC_INT 
   //var_ret->type=NC_INT;
-
+  
   return var_ret;
 }
 
@@ -50,7 +50,7 @@ ncap_att_get
   int rcd;
   int fl_id=int_CEWI;
   long sz;
-
+  
   char *ln_nm;
   
   nc_type type;
@@ -58,7 +58,7 @@ ncap_att_get
   
   if(location == 1) fl_id=prs_arg->in_id;  
   if(location == 2) fl_id=prs_arg->out_id;  
-
+  
   rcd=nco_inq_att_flg(fl_id,var_id,att_nm,&type,&sz);
   if(rcd == NC_ENOTATT) return NULL_CEWI;
   
@@ -89,10 +89,10 @@ ncap_att_get
   return var_ret; 
 }
 
-var_sct *                  /* O [sct] variable containing attribute */
-ncap_att_init(             /*   [fnc] Grab an attribute from input file */
-	      const std::string s_va_nm, /* I [sng] att name of form var_nm&att_nm */ 
-	      prs_cls *prs_arg)          /* I/O vectors of atts & vars & file names  */
+var_sct * /* O [sct] variable containing attribute */
+ncap_att_init /* [fnc] Grab an attribute from input file */
+(const std::string s_va_nm, /* I [sng] att name of form var_nm&att_nm */ 
+ prs_cls *prs_arg) /* I/O vectors of atts & vars & file names */
 {
   int rcd;
   int var_id;
@@ -110,81 +110,65 @@ ncap_att_init(             /*   [fnc] Grab an attribute from input file */
   var_nm=s_va_nm.substr(0,att_char_posn);
   att_nm=s_va_nm.substr(att_char_posn+1);
   
-  if(var_nm == "global")
+  if(var_nm == "global"){
     var_id=NC_GLOBAL;
-  else{
+  }else{
     rcd=nco_inq_varid_flg(prs_arg->in_id,var_nm.c_str(),&var_id);
-    if (rcd !=NC_NOERR) 
-      return NULL_CEWI;
+    if(rcd != NC_NOERR) return NULL_CEWI;
   }
   
   var_ret=ncap_att_get(var_id,var_nm.c_str(),att_nm.c_str(),1,prs_arg);
-  
   return var_ret;
 }
 
-nco_bool     /* O [flg] true if var has been stretched */
-ncap_att_stretch  /* stretch a single valued attribute from 1 to sz */
-(var_sct* var,    /* I/O [sct] variable */       
- long nw_sz)      /* I [nbr] new var size */
+nco_bool /* O [flg] true if var has been stretched */
+ncap_att_stretch /* stretch a single valued attribute from 1 to sz */
+(var_sct* var, /* I/O [sct] variable */       
+ long nw_sz) /* I [nbr] new var size */
 {
-  
   long  idx;
   long  var_typ_sz;  
   void* vp;
   char *cp;
   char **sng_cp;
-    
+  
   if(var->sz > 1L || nw_sz <1) return false; 
-
   if(nw_sz==1) return true;
-    
   var_typ_sz=nco_typ_lng(var->type);
-
-
   // handle NC_STRING -special case 
   // nb var->val.sngp is a ragged array of chars    
-  if(var->type == (nc_type)NC_STRING) {
+  if(var->type == (nc_type)NC_STRING){
     sng_cp=(char**)nco_malloc(nw_sz*var_typ_sz);    
-
+    
     (void)cast_void_nctype((nc_type)NC_STRING,&var->val);
-
-    for(idx=0 ; idx <nw_sz; idx++)
+    
+    for(idx=0;idx<nw_sz;idx++)
       sng_cp[idx]=strdup(var->val.sngp[0]);    
-
+    
     nco_free(var->val.sngp[0]);  
     (void)cast_nctype_void((nc_type)NC_STRING,&var->val);
-    
     vp=(void*)sng_cp;
-
+    
   }else{
     vp=(void*)nco_malloc(nw_sz*var_typ_sz);    
-
-    for(idx=0 ; idx < nw_sz ;idx++){
-      cp=(char*)vp + (ptrdiff_t)(idx*var_typ_sz);
-      memcpy(cp,var->val.vp ,var_typ_sz);
+    for(idx=0;idx<nw_sz;idx++){
+      cp=(char*)vp+(ptrdiff_t)(idx*var_typ_sz);
+      memcpy(cp,var->val.vp,var_typ_sz);
     }
-  
   }
-
   
   var->val.vp=(void*)nco_free(var->val.vp);
   var->sz=nw_sz;
   var->val.vp=vp;
   return true;
-
-  
-
-  
 } /* end ncap_att_stretch */
 
 int
 ncap_att_gnrl
 (const std::string s_dst,
  const std::string s_src,
- int location,         /*   I [flg] 1 - att from INPUT file  2 - att from OUTPUT file */
- prs_cls  *prs_arg
- ){
+ int location, /* I [flg] 1: attributes from INPUT file, 2: attributes from OUTPUT file */
+ prs_cls  *prs_arg){
   int idx;
   int srt_idx;
   int sz;
@@ -202,14 +186,14 @@ ncap_att_gnrl
   std::string s_fll;
   
   NcapVar *Nvar;
-
+  
   // De-reference 
   NcapVarVector &var_vtr=prs_arg->var_vtr;
-  NcapVarVector att_vtr; //hold new attributes.
+  NcapVarVector att_vtr; // hold new attributes.
+  
+  if(location == 1) fl_id=prs_arg->in_id;  
+  if(location == 2) fl_id=prs_arg->out_id;  
   
-  if(location == 1 ) fl_id=prs_arg->in_id;  
-  if(location == 2 ) fl_id=prs_arg->out_id;  
-
   // get var_id
   rcd=nco_inq_varid_flg(fl_id,s_src.c_str(),&var_id);
   
@@ -222,45 +206,45 @@ ncap_att_gnrl
       if(!strcmp(att_nm,nco_mss_val_sng_get()) || !strcmp(att_nm,scl_fct_sng) || !strcmp(att_nm,add_fst_sng))
         continue;
       var_att=ncap_att_get(var_id,s_src.c_str(),att_nm,location,prs_arg);
-      // now add to list( change the name!!)
+      // Add to list (change the name!)
       if(var_att){ 
 	s_fll=s_dst+"@"+std::string(att_nm);
-        Nvar=new NcapVar(var_att,s_fll ); 
-	att_vtr.push_back(Nvar); 
+        Nvar=new NcapVar(var_att,s_fll);
+	att_vtr.push_back(Nvar);
       } 
     } // end for
   }// end rcd
   
   sz=var_vtr.size();
-  if(s_dst != s_src && (srt_idx=var_vtr.find_lwr(s_src+"@"))!=-1) {  
-    
-    for(idx=srt_idx ;idx<sz; idx++) { 
-      if (s_src!=var_vtr[idx]->getVar()) break;
-      if( (var_vtr)[idx]->xpr_typ != ncap_att) continue;
-        tmp_att_nm=var_vtr[idx]->getAtt().c_str();
-        //skip missing value, scale_factor , add_offset
-        if(!strcmp(tmp_att_nm,nco_mss_val_sng_get()) || !strcmp(tmp_att_nm,scl_fct_sng) || !strcmp(tmp_att_nm,add_fst_sng))
+  if(s_dst != s_src && (srt_idx=var_vtr.find_lwr(s_src+"@")) != -1){  
+    
+    for(idx=srt_idx;idx<sz;idx++){ 
+      if(s_src != var_vtr[idx]->getVar()) break;
+      if((var_vtr)[idx]->xpr_typ != ncap_att) continue;
+      tmp_att_nm=var_vtr[idx]->getAtt().c_str();
+      // skip missing value, scale_factor, add_offset
+      if(!strcmp(tmp_att_nm,nco_mss_val_sng_get()) || !strcmp(tmp_att_nm,scl_fct_sng) || !strcmp(tmp_att_nm,add_fst_sng))
         continue;
 
-        // Create string for new attribute
-        s_fll= s_dst +"@"+(var_vtr[idx]->getAtt());
-        var_att=nco_var_dpl(var_vtr[idx]->var);
-        Nvar=new NcapVar(var_att,s_fll ); 
-        att_vtr.push_back(Nvar);  
-    } 
+      // Create string for new attribute
+      s_fll=s_dst+"@"+(var_vtr[idx]->getAtt());
+      var_att=nco_var_dpl(var_vtr[idx]->var);
+      Nvar=new NcapVar(var_att,s_fll);
+      att_vtr.push_back(Nvar);
+    }
   }
-
+  
   sz=att_vtr.size();
   // add new att to list;
-  for(idx=0 ; idx < sz ; idx++){
-
+  for(idx=0;idx< sz;idx++){
+    
 #ifdef _OPENMP
-    if( omp_in_parallel())
+    if(omp_in_parallel())
       prs_arg->thr_vtr.push_back(att_vtr[idx]);
     else
       var_vtr.push_ow(att_vtr[idx]);         
 #else
-      var_vtr.push_ow(att_vtr[idx]);         
+    var_vtr.push_ow(att_vtr[idx]);         
 #endif
   }
   return sz;
@@ -272,16 +256,16 @@ ncap_att_cpy_sct
 (var_sct *var1,
  var_sct *var2,
  prs_cls  *prs_arg){
-
- NcapVar *Nvar=prs_arg->var_vtr.find(var1->nm);
- // Do attribute propagation only if
- // var doesn't already exist 
-
- if(!Nvar ||  Nvar->flg_stt==1)
+  
+  NcapVar *Nvar=prs_arg->var_vtr.find(var1->nm);
+  // Do attribute propagation only if
+  // var doesn't already exist 
+  
+  if(!Nvar ||  Nvar->flg_stt==1)
     (void)ncap_att_cpy(var1->nm,var2->nm,prs_arg);
-
- return 0;
- 
+  
+  return 0;
+  
 } 	
 
 int
@@ -309,75 +293,75 @@ ncap_att_prn     /* [fnc] Print a single attribute*/
 {
   char dlm_sng[3];
   char att_sng[NCO_MAX_LEN_FMT_SNG];
-
+  
   long att_lmn;
   long att_sz;
   
-    /* Copy value to avoid indirection in loop over att_sz */
-    att_sz=var->sz;
-
-    if(att_in_sng ==(char*)NULL) {        
-      (void)fprintf(stdout,"%s, size = %li %s, value = ",var->nm,att_sz,nco_typ_sng(var->type));
+  /* Copy value to avoid indirection in loop over att_sz */
+  att_sz=var->sz;
+  
+  if(att_in_sng ==(char*)NULL) {        
+    (void)fprintf(stdout,"%s, size = %li %s, value = ",var->nm,att_sz,nco_typ_sng(var->type));
     /* Typecast pointer to values before access */
-      (void)cast_void_nctype(var->type,&var->val);
-      (void)strcpy(dlm_sng,", ");
-      (void)sprintf(att_sng,"%s%%s",nco_typ_fmt_sng(var->type));
+    (void)cast_void_nctype(var->type,&var->val);
+    (void)strcpy(dlm_sng,", ");
+    (void)sprintf(att_sng,"%s%%s",nco_typ_fmt_sng(var->type));
     /* user defined format string */ 
-     } else {
-      (void)strcpy(att_sng,att_in_sng);
-      (void)strcpy(dlm_sng,"");
-    }
- 
-    switch(var->type){
-    case NC_FLOAT:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.fp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_DOUBLE:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.dp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_SHORT:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.sp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_INT:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,(long)var->val.ip[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_CHAR:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++){
-        char char_foo;
-	/* Assume \0 is string terminator and do not print it */
-	if((char_foo=var->val.cp[att_lmn]) != '\0') (void)fprintf(stdout,"%c",char_foo);
-      } /* end loop over element */
-      break;
-    case NC_BYTE:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.bp[att_lmn]);
-      break;
-    case NC_UBYTE:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.ubp[att_lmn]);
-      break;
-    case NC_USHORT:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.usp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_UINT:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.uip[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_INT64:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.i64p[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_UINT64:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.ui64p[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    case NC_STRING:
-      for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.sngp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
-      break;
-    default: nco_dfl_case_nc_type_err();
-      break;
-    } /* end switch */
-    (void)fprintf(stdout,"\n");
-    
- (void)cast_nctype_void(var->type,&var->val);
-
+  } else {
+    (void)strcpy(att_sng,att_in_sng);
+    (void)strcpy(dlm_sng,"");
+  }
+  
+  switch(var->type){
+  case NC_FLOAT:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.fp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_DOUBLE:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.dp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_SHORT:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.sp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_INT:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,(long)var->val.ip[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_CHAR:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++){
+      char char_foo;
+      /* Assume \0 is string terminator and do not print it */
+      if((char_foo=var->val.cp[att_lmn]) != '\0') (void)fprintf(stdout,"%c",char_foo);
+    } /* end loop over element */
+    break;
+  case NC_BYTE:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.bp[att_lmn]);
+    break;
+  case NC_UBYTE:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.ubp[att_lmn]);
+    break;
+  case NC_USHORT:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.usp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_UINT:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.uip[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_INT64:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.i64p[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_UINT64:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.ui64p[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  case NC_STRING:
+    for(att_lmn=0;att_lmn<att_sz;att_lmn++) (void)fprintf(stdout,att_sng,var->val.sngp[att_lmn],(att_lmn != att_sz-1) ? dlm_sng : "");
+    break;
+  default: nco_dfl_case_nc_type_err();
+    break;
+  } /* end switch */
+  (void)fprintf(stdout,"\n");
+  
+  (void)cast_nctype_void(var->type,&var->val);
+  
   (void)fflush(stdout);
-
+  
 } /* end ncap_att_prn() */
 
 var_sct * /* O [sct] Remainder of modulo operation of input variables (var1%var2) */
@@ -387,11 +371,9 @@ ncap_var_var_mod /* [fnc] Remainder (modulo) operation of two variables */
 {
   ptr_unn op_swp;
   const char fnc_nm[]="ncap_var_var_mod"; 
-
-  if(nco_dbg_lvl_get() >= 4) 
-      dbg_prn(fnc_nm,"Entered function");
   
-
+  if(nco_dbg_lvl_get() >= 4) dbg_prn(fnc_nm,"Entered function");
+  
   if(var1->has_mss_val){
     (void)nco_var_mod(var1->type,var1->sz,var1->has_mss_val,var1->mss_val,var1->val,var2->val);
   }else{
@@ -403,7 +385,7 @@ ncap_var_var_mod /* [fnc] Remainder (modulo) operation of two variables */
   op_swp=var1->val;var1->val=var2->val;var2->val=op_swp;
   
   var2=nco_var_free(var2);
-
+  
   return var1;
 } /* end ncap_var_var_mod() */
 
@@ -417,12 +399,12 @@ ncap_var_var_atan2
   bool has_mss_val=false;
   double mss_val_dbl;
   ptr_unn op1,op2;
-
+  
   const char fnc_nm[]="ncap_var_var_atan2"; 
   if(nco_dbg_lvl_get() >= 4) dbg_prn(fnc_nm,"Entered function");
-
+  
   sz=var1->sz;
-
+  
   //Dereference
   op1=var1->val;
   op2=var2->val; 
@@ -430,43 +412,40 @@ ncap_var_var_atan2
   /* Typecast pointer to values before access */
   (void)cast_void_nctype(NC_DOUBLE,&op1);
   (void)cast_void_nctype(NC_DOUBLE,&op2);
-
+  
   if(var1->has_mss_val){
-     has_mss_val=true; 
-     (void)cast_void_nctype(NC_DOUBLE,&var1->mss_val);
-     mss_val_dbl=*var1->mss_val.dp;
+    has_mss_val=true; 
+    (void)cast_void_nctype(NC_DOUBLE,&var1->mss_val);
+    mss_val_dbl=*var1->mss_val.dp;
   } else if(var2->has_mss_val){
-     has_mss_val=true; 
-     (void)cast_void_nctype(NC_DOUBLE,&var2->mss_val);
-     mss_val_dbl=*var2->mss_val.dp;
+    has_mss_val=true; 
+    (void)cast_void_nctype(NC_DOUBLE,&var2->mss_val);
+    mss_val_dbl=*var2->mss_val.dp;
   }
-
- if(!has_mss_val){
+  
+  if(!has_mss_val){
     for(idx=0;idx<sz;idx++) op1.dp[idx]=atan2(op1.dp[idx],op2.dp[idx]);
- }else{
+  }else{
     for(idx=0;idx<sz;idx++){
-    if((op1.dp[idx] != mss_val_dbl) && (op2.dp[idx] != mss_val_dbl)) op1.dp[idx]=atan2(op1.dp[idx],op2.dp[idx]); else op2.dp[idx]=mss_val_dbl;
-      } /* end for */
+      if((op1.dp[idx] != mss_val_dbl) && (op2.dp[idx] != mss_val_dbl)) op1.dp[idx]=atan2(op1.dp[idx],op2.dp[idx]); else op2.dp[idx]=mss_val_dbl;
+    } /* end for */
+  } /* end else */
+  
+  // cast misssing value back to void
+  if(var1->has_mss_val)
+    (void)cast_nctype_void(NC_DOUBLE,&var1->mss_val);  
+  else if(var2->has_mss_val)
+    (void)cast_nctype_void(NC_DOUBLE,&var2->mss_val);  
+  
+  var2=nco_var_free(var2); 
   
- } /* end else */
-
- // cast misssing value back to void
- if(var1->has_mss_val)
-   (void)cast_nctype_void(NC_DOUBLE,&var1->mss_val);  
- else if(var2->has_mss_val)
-   (void)cast_nctype_void(NC_DOUBLE,&var2->mss_val);  
-
- var2=nco_var_free(var2); 
-
   return var1;
 } /* end ncap_var_var_atan2 */
 
-
 var_sct *        /* O [sct] Resultant variable (actually is var) */
 ncap_var_abs /* Purpose: Find absolute value of each element of var */
 (var_sct *var)    /* I/O [sct] input variable */
 {
-  
   if(var->undefined) return var;
   
   /* deal with initial scan */
@@ -488,8 +467,10 @@ ncap_var_var_pwr_old /* [fnc] Empowerment of two variables */
   /* Temporary fix */ 
   /* Swap names about so attribute propagation works */
   /* most operations unlike this one put results in left operand */
-  if( !ncap_var_is_att(var1) && isalpha(var1->nm[0])) {
-    swp_nm=var1->nm; var1->nm=var2->nm; var2->nm=swp_nm;
+  if(!ncap_var_is_att(var1) && isalpha(var1->nm[0])){
+    swp_nm=var1->nm;
+    var1->nm=var2->nm;
+    var2->nm=swp_nm;
   }  
   
   if(var1->undefined){ 
@@ -499,15 +480,14 @@ ncap_var_var_pwr_old /* [fnc] Empowerment of two variables */
   }
   
   /* Make sure variables are at least float */
-  if(nco_rth_prc_rnk(var1->type) < nco_rth_prc_rnk_float && 
-     nco_rth_prc_rnk(var2->type) < nco_rth_prc_rnk_float )
+  if(nco_rth_prc_rnk(var1->type) < nco_rth_prc_rnk_float && nco_rth_prc_rnk(var2->type) < nco_rth_prc_rnk_float)
     var1=nco_var_cnf_typ((nc_type)NC_FLOAT,var1);
   
   (void)ncap_var_retype(var1,var2);   
   
   /* Handle initial scan */
-  if(var1->val.vp==(void*)NULL ) {
-    if(var1->nbr_dim > var2->nbr_dim) {
+  if(var1->val.vp==(void*)NULL){
+    if(var1->nbr_dim > var2->nbr_dim){
       var2=nco_var_free(var2);
       return var1;
     }else{
@@ -532,30 +512,24 @@ ncap_var_var_pwr  /* [fnc] Empowerment of two variables */
 (var_sct *var1,   /* I [sct] Variable structure containing base */
  var_sct *var2)   /* I [sct] Variable structure containing exponent */
 {
-  
   ptr_unn op_swp;
-
   const char fnc_nm[]="ncap_var_var_pwr";
-   
-  if(nco_dbg_lvl_get() >= 4) 
-      dbg_prn(fnc_nm,"Entered function");
-
-
+  
+  if(nco_dbg_lvl_get() >= 4) dbg_prn(fnc_nm,"Entered function");
   if(var1->has_mss_val){
     (void)nco_var_pwr(var1->type,var1->sz,var1->has_mss_val,var1->mss_val,var1->val,var2->val);
   }else{
     (void)nco_var_pwr(var1->type,var1->sz,var2->has_mss_val,var2->mss_val,var1->val,var2->val);
     (void)nco_mss_val_cnf(var2,var1);
-    
   } /* end else */
   
   // Swap values about 
-  op_swp=var1->val;var1->val=var2->val;var2->val=op_swp;
-  
+  op_swp=var1->val;
+  var1->val=var2->val;
+  var2->val=op_swp;
   var2=nco_var_free(var2);
-
-  return var1;
   
+  return var1;
 } /* end ncap_var_var_pwr() */
 
 var_sct *           /* O [sct] Resultant variable (actually is var_in) */
@@ -567,14 +541,11 @@ ncap_var_fnc
   /* Purpose: Evaluate fnc_dbl(var) or fnc_flt(var) for each value in variable
      Float and double functions are in app */
   const char fnc_nm[]="ncap_var_fnc"; 
-
   long idx;
   long sz;
   ptr_unn op1;
-
-
-  if(nco_dbg_lvl_get() >= 4) 
-      dbg_prn(fnc_nm,"Entered function");
+  
+  if(nco_dbg_lvl_get() >= 4) dbg_prn(fnc_nm,"Entered function");
   
   if(var_in->undefined) return var_in;
   
@@ -616,8 +587,7 @@ ncap_var_fnc
   }/* end switch */
   
   if(var_in->has_mss_val) (void)cast_nctype_void(var_in->type,&(var_in->mss_val));
-
-
+  
   return var_in;
 } /* end ncap_var_fnc() */
 
@@ -626,99 +596,99 @@ ncap_lmt_evl
 (int nc_id,
  lmt_sct* lmt_ptr,
  prs_cls *prs_arg){
-
-long cnt_dmn;
-long srt;
-long end;
-long cnt;
-long srd;
-dmn_sct *dmn_ptr;
-
-//Dereference
-NcapVector<dmn_sct*> dmn_vtr;
-
-const char fnc_nm[]="ncap_lmt_evl"; 
-
-dmn_vtr=(nc_id==prs_arg->in_id ? prs_arg->dmn_in_vtr: prs_arg->dmn_out_vtr);
-
-   
-
+  
+  long cnt_dmn;
+  long srt;
+  long end;
+  long cnt;
+  long srd;
+  dmn_sct *dmn_ptr;
+  
+  //Dereference
+  NcapVector<dmn_sct*> dmn_vtr;
+  
+  const char fnc_nm[]="ncap_lmt_evl"; 
+  
+  dmn_vtr=(nc_id==prs_arg->in_id ? prs_arg->dmn_in_vtr: prs_arg->dmn_out_vtr);
+  
+  
+  
   dmn_ptr=dmn_vtr.find(lmt_ptr->nm);
-
+  
   if(dmn_ptr==NULL)
     err_prn(fnc_nm,"Dimension "+ std::string(lmt_ptr->nm)+" in limits not found");
-
+  
   cnt_dmn=dmn_ptr->sz;
-
+  
   //fill out defaults
   srt=( lmt_ptr->is_usr_spc_min ? lmt_ptr->srt:0L);
   end=( lmt_ptr->is_usr_spc_max ? lmt_ptr->end:cnt_dmn-1);
   srd=( lmt_ptr->srd_sng!=NULL_CEWI  ? lmt_ptr->srd:1L);  
- 
+  
   // do error checking 
   if(prs_arg->FORTRAN_IDX_CNV){ 
     std::ostringstream os;
-  
+    
     if(lmt_ptr->is_usr_spc_min && (srt<1 || srt>cnt_dmn)) {
-
+      
       os<<"Lower limit " <<srt<<" for dim "<<lmt_ptr->nm<<" is outside range "<<1L<<"-"<<cnt_dmn;
       err_prn(fnc_nm,os.str());
     }
-
+    
     if(lmt_ptr->is_usr_spc_max && (end<1 || end>cnt_dmn)) {
       os<<"Upper limit " <<end<<" for dim "<<lmt_ptr->nm<<" is outside range "<<1L<<"-"<<cnt_dmn;
       err_prn(fnc_nm,os.str());
     }
-   
+    
     if(srt>end){	 
       os<<"Lower limit " <<srt<<" for dim "<<lmt_ptr->nm<<" is greater than upper limit "<<end;  
       err_prn(fnc_nm,os.str());  
     }	 	
-
+    
     if(srd<1){	 
       os<<"Sride " <<srd<<" for dim "<<lmt_ptr->nm<<" is less than 1"<<end;  
       err_prn(fnc_nm,os.str());  
     }	 	
-      
-
+    
+    
     if(lmt_ptr->is_usr_spc_min) srt--;
     if(lmt_ptr->is_usr_spc_max) end--;
   }
-
+  
   // do error checking 
   if(!prs_arg->FORTRAN_IDX_CNV){ 
     std::ostringstream os;
     if(srt<0) srt+=cnt_dmn-1;       
     if(end<0) end+=cnt_dmn-1;       
     if(lmt_ptr->is_usr_spc_min && (srt<0 || srt>cnt_dmn-1)) {
-           
+      
       os<<"Lower limit " <<srt<<" for dim "<<lmt_ptr->nm<<" is outside range "<<0L<<"-"<<cnt_dmn-1;
       err_prn(fnc_nm,os.str());
     }
-
+    
     if(lmt_ptr->is_usr_spc_max && (end<0 || end>cnt_dmn-1)) {
       os<<"Upper limit " <<end<<" for dim "<<lmt_ptr->nm<<" is outside range "<<0L<<"-"<<cnt_dmn-1;
       err_prn(fnc_nm,os.str());
     }
-   
+    
     if(srt>end){	 
       os<<"Lower limit " <<srt<<" for dim "<<lmt_ptr->nm<<" is greater than upper limit "<<end;  
       err_prn(fnc_nm,os.str());  
     }	 	
-
+    
     if(srd<1){	 
       os<<"Sride " <<srd<<" for dim "<<lmt_ptr->nm<<" is less than 1"<<end;  
       err_prn(fnc_nm,os.str());  
     }	 	
   }
-
+  
   cnt=1+(end-srt)/srd;
-
+  
   lmt_ptr->srt=srt;
   lmt_ptr->end=end;
   lmt_ptr->cnt=cnt;
   lmt_ptr->srd=srd;
-
+  
   return;
 } /* end ncap_lmt_evl() */
 
@@ -735,8 +705,8 @@ nco_var_lst_copy      /* [fnc] Purpose: Copy xtr_lst and return new list */
   for(idx=0;idx<lst_nbr;idx++){
     xtr_new_lst[idx].nm=(char *)strdup(xtr_lst[idx].nm);
     xtr_new_lst[idx].id=xtr_lst[idx].id;
-
-
+    
+    
   } /* end loop over variable */
   return xtr_new_lst;           
 } /* end nco_var_lst_copy() */
@@ -767,12 +737,12 @@ nco_var_lst_sub
     if(match) continue;
     xtr_new_lst[xtr_nbr_new].nm=(char *)strdup(xtr_lst[idx].nm);
     xtr_new_lst[xtr_nbr_new].id=xtr_lst[idx].id;
-
-
+    
+    
     /* Increment */
     xtr_nbr_new++;
-
-
+    
+    
   } /* end loop over idx */
   /* realloc to actual size */
   xtr_new_lst=(nm_id_sct*)nco_realloc(xtr_new_lst,xtr_nbr_new*sizeof(nm_id_sct)); 
@@ -805,8 +775,8 @@ nco_var_lst_add
     for(idx=0;idx<xtr_nbr_crr;idx++){
       xtr_new_lst[idx].nm=(char *)strdup(xtr_lst[idx].nm);
       xtr_new_lst[idx].id=xtr_lst[idx].id;
-
-
+      
+      
     } /* end loop over variables */
   }else{
     *xtr_nbr=nbr_lst_a;
@@ -821,10 +791,10 @@ nco_var_lst_add
     xtr_new_lst=(nm_id_sct *)nco_realloc(xtr_new_lst,(size_t)(xtr_nbr_crr+1)*sizeof(nm_id_sct));
     xtr_new_lst[xtr_nbr_crr].nm=(char *)strdup(xtr_lst_a[idx].nm);
     xtr_new_lst[xtr_nbr_crr].id=xtr_lst_a[idx].id;
-
-
+    
+    
     xtr_nbr_crr++;
-
+    
   } /* end for */
   *xtr_nbr=xtr_nbr_crr;
   return xtr_new_lst;           
@@ -848,9 +818,9 @@ nco_dmn_lst /* [fnc] Create list of all dimensions in file  */
     (void)nco_inq_dimname(nc_id,idx,dmn_nm);
     dmn[idx].id=idx;
     dmn[idx].nm=(char *)strdup(dmn_nm);
-
     
-
+    
+    
   } /* end loop over dmn */
   
   *nbr_dmn=nbr_dmn_in;
@@ -875,7 +845,7 @@ nco_att_lst_mk
     // Check for attribute
     if( var_vtr[idx]->xpr_typ !=ncap_att) continue;
     (void)strcpy(var_nm, var_vtr[idx]->getVar().c_str());
-
+    
     rcd=nco_inq_varid_flg(out_id,var_nm,&var_id);
     if(rcd== NC_NOERR) continue;   
     rcd=nco_inq_varid_flg(in_id,var_nm,&var_id);   
@@ -888,15 +858,15 @@ nco_att_lst_mk
       xtr_lst=(nm_id_sct *)nco_realloc(xtr_lst,(size+1)*sizeof(nm_id_sct));
       xtr_lst[size].id=var_id;
       xtr_lst[size].nm=(char *)strdup(var_nm); 
-
+      
       /* Increment */
       size++;
-
+      
     } /* end if */
   } /* end loop over att */
-
+  
   *nbr_lst=size;
-
+  
   return xtr_lst;
 } /* end nco_att_lst_mk() */
 
@@ -936,8 +906,8 @@ ncap_var_stretch /* [fnc] Stretch variables */
      var_lsr_out=var_lsr only if variables already conform
      var_gtr_out is required since both variables may change
      var_gtr_out=var_gtr unless convolution is required */
- 
-   const char fnc_nm[]="ncap_var_stretch"; 
+  
+  const char fnc_nm[]="ncap_var_stretch"; 
   
   nco_bool CONFORMABLE=False; /* [flg] Whether var_lsr can be made to conform to var_gtr */
   nco_bool CONVOLVE=False; /* [flg] var_1 and var_2 had to be convolved */
@@ -1151,9 +1121,7 @@ ncap_var_stretch /* [fnc] Stretch variables */
 	  } /* end if */
 	  /* Sanity check */
 	  if(idx_dmn == var_gtr->nbr_dim-1){
-            err_prn(fnc_nm,"var_lsr " + std::string(var_lsr->nm)+ " has dimension "+ std::string(var_lsr->dim[idx]->nm)
-                    + " but var_gtr " + std::string(var_gtr->nm)+ " does not deep in ncap_var_stretch.");
-	    
+            err_prn(fnc_nm,"var_lsr " + std::string(var_lsr->nm)+ " has dimension "+ std::string(var_lsr->dim[idx]->nm)+" but var_gtr " + std::string(var_gtr->nm)+ " does not deep in ncap_var_stretch.");
 	    //(void)fprintf(stdout,"%s: ERROR var_lsr %s has dimension %s but var_gtr %s does not deep in ncap_var_stretch()\n",nco_prg_nm_get(),var_lsr->nm,var_lsr->dim[idx]->nm,var_gtr->nm);
 	    //nco_exit(EXIT_FAILURE);
 	  } /* end if err */
@@ -1189,13 +1157,9 @@ ncap_var_stretch /* [fnc] Stretch variables */
 	/* Map (shared) N-D array indices into 1-D index into original lesser variable data */
 	var_lsr_lmn=0L;
 	for(idx=0;idx<var_lsr_nbr_dim;idx++) var_lsr_lmn+=dmn_ss[idx_var_lsr_var_gtr[idx]]*dmn_var_lsr_map[idx];
-	
 	(void)memcpy(var_lsr_out_cp+var_gtr_lmn*var_lsr_typ_sz,var_lsr_cp+var_lsr_lmn*var_lsr_typ_sz,var_lsr_typ_sz);
-	
       } /* end loop over var_gtr_lmn */
-      
     } /* end if greater variable (and lesser variable) are arrays, not scalars */
-    
     DO_CONFORM=True;
   } /* end if we had to broadcast lesser variable to fit greater variable */
   
@@ -1215,11 +1179,12 @@ ncap_var_stretch /* [fnc] Stretch variables */
 } /* end ncap_var_stretch() */
 
 nco_bool
-ncap_def_dim(
-	     std::string dmn_nm,
-	     long sz,
-             bool bunlimited,   /* true unlimited, false limited */
-	     prs_cls *prs_arg){
+ncap_def_dim
+(std::string dmn_nm,
+ long sz,
+ bool bunlimited,   /* true unlimited, false limited */
+ prs_cls *prs_arg)
+{
   const char fnc_nm[]="ncap_def_dim"; 
 
   int is_rec_dmn=False;
@@ -1237,27 +1202,19 @@ ncap_def_dim(
   }
 
   is_rec_dmn= ( bunlimited==true ? True : False);
-
   /** hidden feature if size negative then this indicates a record dimension */  
-  if( sz < 0 ){
+  if(sz < 0){
      sz=-sz; 
      is_rec_dmn=True;
   }      
- 
-    
 
-  /*   
-  if( sz < 0  ){
+  /* if( sz < 0  ){
     std::ostringstream os;
     os<<"dim " << dmn_nm << "(size=" <<sz <<") dimension can't be negative.";
     wrn_prn(fnc_nm,os.str()); 
     return False;
-  }
-  */
-
-  
+  } */
   dmn_nw=(dmn_sct *)nco_malloc(sizeof(dmn_sct));
-  
   dmn_nw->nm=(char *)strdup(dmn_nm.c_str());
   //dmn_nw->id=dmn_id;
   dmn_nw->nc_id=prs_arg->out_id;
@@ -1281,10 +1238,10 @@ ncap_def_dim(
   return True; 
 }
 
-nco_bool         /* Returns True if shape of vars match (using cnt vectors) */
-nco_shp_chk(
-	    var_sct* var1, 
-	    var_sct* var2)
+nco_bool /* Returns True if shape of vars match (using cnt vectors) */
+nco_shp_chk
+(var_sct* var1, 
+ var_sct* var2)
 {
   
   long idx;
@@ -1296,44 +1253,36 @@ nco_shp_chk(
   long nbr_cmp;
   
   /* Check sizes */
-  if( var1->sz != var2->sz )
-    return False;
-  
-  
+  if( var1->sz != var2->sz) return False;
   
   nbr_rdmn1=var1->nbr_dim;  
   nbr_rdmn2=var2->nbr_dim;  
   
   /* skip leading 1D dims */
   for(idx=0 ; idx < (nbr_rdmn1-1) ; idx++)
-    if( var1->cnt[idx] == 1){
-      srt1++;continue;
+    if(var1->cnt[idx] == 1){
+      srt1++;
+      continue;
     } else break;
   
   /* skip leading 1D dims */
   for(idx=0 ; idx < (nbr_rdmn2-1) ; idx++)
-    if( var2->cnt[idx] == 1){
-      srt2++;continue;
-    } else break;
-  
+    if(var2->cnt[idx] == 1){
+      srt2++;
+      continue;
+    }else break;
   
   /* check sizes again */
-  if( nbr_rdmn1-srt1 != nbr_rdmn2-srt2 )
-    return False;
+  if(nbr_rdmn1-srt1 != nbr_rdmn2-srt2) return False;
  
   nbr_cmp=nbr_rdmn1-srt1;
-  /* Now compare  values */
-  for(idx=0 ; idx < nbr_cmp ;idx++)
-    if( var1->cnt[srt1++] != var2->cnt[srt2++]) break;
+  /* Now compare values */
+  for(idx=0;idx<nbr_cmp;idx++)
+    if(var1->cnt[srt1++] != var2->cnt[srt2++]) break;
   
-  if( idx==nbr_cmp) 
-    return True;
-  else
-    return False;
+  if(idx==nbr_cmp) return True; else return False;
 }
 
-
-
 /* This file is generated in makefile from ncoParserTokenTypes.hpp */ 
 #include "ncoEnumTokenTypes.hpp"
 
@@ -1396,13 +1345,10 @@ ncap_var_var_stc
   return var_ret;
 }
 
-
-
 int                /* [flg] true they conform */         
 ncap_var_att_cnf   /* [fnc] Make vars/atts conform */
 (var_sct *&var1,   /* I [sct] Input variable structure  */
- var_sct *&var2    /* I [sct] Input variable structure  */
-)
+ var_sct *&var2)    /* I [sct] Input variable structure  */
 { 
   const char fnc_nm[]="ncap_var_att_cnf"; 
   
@@ -1473,7 +1419,6 @@ ncap_var_att_cnf   /* [fnc] Make vars/atts conform */
     nco_var_free(var1);
     var1=var_tmp;   
      
-    
     // att && att
   } else if (vb1 && vb2) {
     (void)ncap_var_retype(var1,var2);
@@ -1494,7 +1439,6 @@ ncap_var_att_cnf   /* [fnc] Make vars/atts conform */
 
 } /* end ncap_var_att_cnf */
 
-
 var_sct *             /* O [sct] Result if ntl_scn true otherwize null */ 
 ncap_var_att_arr_cnf( /* I [fnc] Make all of vars in array conform to each other */
 bool ntl_scn,         /* [flg] reurb dim with correct shape as ig op had happened */
@@ -1731,8 +1675,6 @@ ncap_var_var_op   /* [fnc] Add two variables */
   return var_ret;
 }
 
-
-
 var_sct *             /* O [sct] Sum of input variables (var1+var2) INITIAL SCAN ONLY */
 ncap_var_var_op_ntl   /* [fnc] Add two variables */
 (var_sct *var1,       /* I [sct] Input variable structure containing first operand */
@@ -1754,7 +1696,6 @@ ncap_var_var_op_ntl   /* [fnc] Add two variables */
     var1=nco_var_cnf_typ((nc_type)NC_DOUBLE,var1);
     var2=nco_var_cnf_typ((nc_type)NC_DOUBLE,var2);
   }  
-
   
   vb1 = ncap_var_is_att(var1);
   vb2 = ncap_var_is_att(var2);
@@ -1776,7 +1717,6 @@ ncap_var_var_op_ntl   /* [fnc] Add two variables */
       var1=nco_var_free(var1);
       return var2;
     }
-    
   }
   // var & att
   else if( !vb1 && vb2 ){ 
@@ -1857,7 +1797,6 @@ ncap_var_var_inc   /* [fnc] Add two variables */
       NcapVar *Nvar=new NcapVar(var1,sa);
       prs_arg->var_vtr.push_ow(Nvar);       
     }
-    
     return var_ret;    
   }
   
@@ -1872,7 +1811,6 @@ ncap_var_var_inc   /* [fnc] Add two variables */
   // var & var
   if(!vb1 && !vb2) {
     nco_bool DO_CONFORM=True;;
-    
     var_sct *var_tmp=NULL_CEWI;
     
     var_tmp=nco_var_cnf_dmn(var1,var2,var_tmp,True,&DO_CONFORM);
@@ -1916,7 +1854,6 @@ ncap_var_var_inc   /* [fnc] Add two variables */
   return var_ret;
 }
 
-
 bool            /* O [flg] true if all var elemenst are true */
 ncap_var_lgcl   /* [fnc] calculate a aggregate bool value from a variable */
 (var_sct* var)  /* I [sct] input variable */
@@ -1953,9 +1890,9 @@ ncap_var_lgcl   /* [fnc] calculate a aggregate bool value from a variable */
 }
 
 var_sct* /* O [sct] casting variable has its own private dims */ 
-ncap_cst_mk( /* [fnc] create casting var from a list of dims */
-	    std::vector<std::string> &str_vtr,  /* I [sng] list of dimension subscripts */
-	    prs_cls *prs_arg)
+ncap_cst_mk  /* [fnc] create casting var from a list of dims */
+(std::vector<std::string> &str_vtr,  /* I [sng] list of dimension subscripts */
+ prs_cls *prs_arg)
 {
   const char fnc_nm[]="ncap_cst_mk"; 
   static const char * const tpl_nm="Internally generated template";
@@ -1995,11 +1932,9 @@ ncap_cst_mk( /* [fnc] create casting var from a list of dims */
     if(!bdef) { 
 
 #ifdef _OPENMP
-       if( omp_in_parallel())
+       if(omp_in_parallel())
 	 err_prn(fnc_nm,"Attempt to go into netCDF define mode while in OpenMP parallel mode");
-      
 #endif
-
        bdef=true;  
        (void)nco_redef(prs_arg->out_id);
     }
@@ -2012,8 +1947,7 @@ ncap_cst_mk( /* [fnc] create casting var from a list of dims */
     (void)nco_dmn_xrf(dmn_new,dmn_item);
     dmn[idx]=dmn_new;
   }
-  if(bdef)
-    (void)nco_enddef(prs_arg->out_id);
+  if(bdef) (void)nco_enddef(prs_arg->out_id);
   
   /* Check that un-limited dimension is first dimension for netcdf3 files only */
   if( prs_arg->fl_out_fmt != NC_FORMAT_NETCDF4 ){
@@ -2055,19 +1989,15 @@ ncap_cst_mk( /* [fnc] create casting var from a list of dims */
     var->end[idx]=dmn[idx]->end;
     var->srd[idx]=dmn[idx]->srd;
     var->sz*=var->cnt[idx];
-
   } /* end loop over dim */
-  
 
   /* NOTE VERY IMPORTANT 27-01-2009 */
   /* var->val.vp is never used in an initial or final scan 
      So we can safely set it to null here and get an immediate 
      performance boost */
-        
-     var->val.vp=(void*)NULL;
-     goto end_var;   
-   
-
+  var->val.vp=(void*)NULL;
+  goto end_var;   
+  
   /* Do not initialize val in initial scan  */
   if(prs_arg->ntl_scn) {
     var->val.vp=(void*)NULL;
@@ -2156,8 +2086,8 @@ ncap_cst_do(
 
 // Return true if string is only made of 0..9 chars
 bool
-str_is_nbr(
-	   std::string snm)
+str_is_nbr
+(std::string snm)
 { 
   unsigned idx;
   for(idx=0 ; idx < snm.size(); idx++)
@@ -2166,10 +2096,10 @@ str_is_nbr(
   return (idx==snm.size() ? true: false);
 }
 
-NcapVector<dmn_sct*>                /* O    [sct] list of new dims to limit over */ 
-ncap_dmn_mtd(
-	     var_sct *var,                      /* I   [sct] var with list of dims */
-	     std::vector<std::string> &str_vtr)  /* I   [sng] list of dimension names */
+NcapVector<dmn_sct*> /* O    [sct] list of new dims to limit over */ 
+ncap_dmn_mtd
+(var_sct *var, /* I   [sct] var with list of dims */
+ std::vector<std::string> &str_vtr)  /* I   [sng] list of dimension names */
 {
   int idx;
   int jdx;
@@ -2198,7 +2128,6 @@ ncap_dmn_mtd(
     
   } // end loop
   return dmn_vtr;  
-  
 }
 
 var_sct *
@@ -2225,9 +2154,9 @@ ncap_sclr_var_mk
 } // end ncap_sclr_var_mk<string,int,bool>()
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 float val_float)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ float val_float)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_FLOAT,true);
@@ -2238,9 +2167,9 @@ ncap_sclr_var_mk(
 } // end ncap_sclr_var_mk<float>()
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 double val_double)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ double val_double)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_DOUBLE,true);
@@ -2251,9 +2180,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_int val_int)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_int val_int)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_INT,true);
@@ -2265,9 +2194,9 @@ ncap_sclr_var_mk(
 }
  
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_short val_short)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_short val_short)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_SHORT,true);
@@ -2278,9 +2207,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_char val_char)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_char val_char)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_CHAR,true);
@@ -2291,9 +2220,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_byte val_byte)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_byte val_byte)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_BYTE,true);
@@ -2304,9 +2233,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_ubyte val_ubyte)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_ubyte val_ubyte)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_UBYTE,true);
@@ -2317,9 +2246,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_ushort val_ushort)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_ushort val_ushort)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_USHORT,true);
@@ -2330,9 +2259,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_uint val_uint)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_uint val_uint)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_UINT,true);
@@ -2343,9 +2272,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_int64 val_int64)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_int64 val_int64)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_INT64,true);
@@ -2356,9 +2285,9 @@ ncap_sclr_var_mk(
 }
 
 var_sct *
-ncap_sclr_var_mk(
-		 const std::string var_nm,
-		 nco_uint64 val_uint64)
+ncap_sclr_var_mk
+(const std::string var_nm,
+ nco_uint64 val_uint64)
 {
   var_sct *var;
   var=ncap_sclr_var_mk(var_nm,(nc_type)NC_UINT64,true);
@@ -2380,25 +2309,22 @@ ncap_sclr_var_mk(
    *var->val.sngp=val_string;
    (void)cast_nctype_void((nc_type)NC_STRING,&var->val);
    return var;
-   }
-*/ 
-
+   } */ 
 
 // Do an in-memory hyperslab !!
 void 
-ncap_get_var_mem( 
-		 int dpt,                       // Current depth
-		 int dpt_max,                   // Max depth ( same as number of dims) 
-		 std::vector<int> &shp_vtr,     // shape of input var (in bytes)
-		 NcapVector<dmn_sct*> &dmn_vtr, // New vectors
-                 var_sct* var_in,
-                 long nbr_lpp,
-		 char *cp_in,                   // Pointer to (char*)var_in->val.vp
-		 char *&cp_out){                // Reference pointer to space for new var values
+ncap_get_var_mem
+(int dpt,                       // Current depth
+ int dpt_max,                   // Max depth ( same as number of dims) 
+ std::vector<int> &shp_vtr,     // shape of input var (in bytes)
+ NcapVector<dmn_sct*> &dmn_vtr, // New vectors
+ var_sct* var_in,
+ long nbr_lpp,
+ char *cp_in,                   // Pointer to (char*)var_in->val.vp
+ char *&cp_out){                // Reference pointer to space for new var values
   
   const std::string fnc_nm("ncap_get_var_mem"); 
   
-  
   long idx;      
   long jdx;
   long srt=dmn_vtr[dpt]->srt;
@@ -2411,19 +2337,14 @@ ncap_get_var_mem(
   char *cp_srt=cp_in+ptrdiff_t(srt*slb_sz);
   char *cp_lcl;
   
-  
   if(nco_dbg_lvl_get() >= nco_dbg_scl){
     std::ostringstream os;
     os<<"Depth=" << dpt<<" "<<dmn_vtr[dpt]->nm<<" "<<srt<<" "<<end<<" "<<cnt<<" "<<srd;
     dbg_prn(fnc_nm,os.str());
   }
   
-  
   if(dpt == dpt_max){
-    
-    
     if(srd==1) {
-        
       for(jdx=0 ; jdx <nbr_lpp ; jdx++){  
         (void)memcpy(cp_out, cp_srt, ptrdiff_t(cnt*slb_sz));
         cp_out+=ptrdiff_t(cnt*slb_sz);
@@ -2442,13 +2363,10 @@ ncap_get_var_mem(
         }
         cp_srt+=ptrdiff_t(dpt_cnt*slb_sz); 
       }
-
     }
-    
   }
   
   if(dpt < dpt_max ){
-
     // The whole slab
     if( srd==1 && cnt==dpt_cnt) {
       (void)ncap_get_var_mem(dpt+1,dpt_max,shp_vtr,dmn_vtr,var_in, nbr_lpp*cnt,cp_srt,cp_out);
@@ -2473,19 +2391,13 @@ ncap_get_var_mem(
         cp_srt+=dpt_cnt*slb_sz;
       }  
     }
-
   }
-   
 } /* ncap_get_var_mem */
 
-
-
-
 void
-nco_get_var_mem(
-		var_sct *var_in,
-		NcapVector<dmn_sct*> &dmn_vtr){
-  
+nco_get_var_mem
+(var_sct *var_in,
+ NcapVector<dmn_sct*> &dmn_vtr){
   int idx;
   int ncnt;
   int dmn_nbr;
@@ -2496,7 +2408,6 @@ nco_get_var_mem(
   char *cp_in;
   std::vector<int> shp_vtr;
   
-  
   dmn_nbr=var_in->nbr_dim;
   
   ncnt=nco_typ_lng(var_in->type); 
@@ -2536,7 +2447,6 @@ nco_get_var_mem(
   
   // Call in-memory nco_get_var() (n.b is recursive of course!!)
   (void)ncap_get_var_mem(0,dpt_max-1,shp_vtr,dmn_vtr,var_in,1L,cp_in,cp_out);
-  
 
   var_in->sz=ncnt;
   
@@ -2545,12 +2455,9 @@ nco_get_var_mem(
   
 } /* end nco_get_var_mem()  */
 
-
-
-
 void
-ncap_put_var_mem(
-int dpt,                        // Current 
+ncap_put_var_mem
+(int dpt,                        // Current 
 int dpt_max,                    // Max depth ( same as number of dims) 
 std::vector<int> &shp_vtr,      // shape of input var (in bytes)
 NcapVector<lmt_sct*> &dmn_vtr,  // New vectors
@@ -2561,8 +2468,6 @@ char *cp_out)                   // Slab to be "put"
 {
   
   const std::string fnc_nm("ncap_put_var_mem"); 
-  
-  
   long idx;      
   long jdx;
   long srt=dmn_vtr[dpt]->srt;
@@ -2582,8 +2487,6 @@ char *cp_out)                   // Slab to be "put"
     dbg_prn(fnc_nm,os.str());
   }
   
-
-  
   if(dpt == dpt_max){
     cp_end=cp_out+ptrdiff_t(srt*slb_sz);
     for(idx=0; idx<nbr_lpp; idx++){
@@ -2633,17 +2536,10 @@ char *cp_out)                   // Slab to be "put"
         } //loop jdx
         cp_out+=ptrdiff_t(dpt_out*slb_sz);
       } //loop idx
-
     }
-    
   }
-
-  
 }
 
-
-
-
 // Do an in memory nco_put_var()  
 void
 nco_put_var_mem(
@@ -2662,7 +2558,6 @@ NcapVector<lmt_sct*> &dmn_vtr)
   
   std::vector<int> shp_vtr;
   
-  
   dmn_nbr=var_out->nbr_dim;
   
   ncnt=nco_typ_lng(var_out->type); 
@@ -2678,7 +2573,6 @@ NcapVector<lmt_sct*> &dmn_vtr)
   
   // Work out max depth we have to go to 
   dpt_max=dmn_nbr;
-
     
   for(idx=dmn_nbr-1; idx>0 ; idx--)
     if( var_out->dim[idx]->cnt == dmn_vtr[idx]->cnt) 
@@ -2696,13 +2590,9 @@ NcapVector<lmt_sct*> &dmn_vtr)
   else
   // Call in-memory nco_put_var_mem (n.b is recursive of course!!)
     (void)ncap_put_var_mem(0,dpt_max-1,shp_vtr,dmn_vtr,var_out,1L,cp_in,cp_out);
-
   
 } /* end nco_put_var_mem() */
 
-
-
-
 // See if node contains any utility fuctions
 // if so return true
 bool 
@@ -2717,7 +2607,6 @@ RefAST tr
     if(fnm=="set_miss" || fnm=="change_miss" || fnm=="delete_miss" || fnm=="ram_write" || fnm=="ram_delete") 
       return true;
   }
- 
   
   tr=tr->getFirstChild();
  // examine all child nodes
@@ -2728,37 +2617,23 @@ RefAST tr
   }
  
  return false;
-
 }
 
-
-
-
-
-
 /*********************************************************************************/
 /* Following - all MPI optimization routines                                     */
 /*********************************************************************************/  
 
-
-
-
 // See if any VAR_ID/ATT_ID match any in str_vtr
 // if so return true
-bool 
-ncap_mpi_srh_str(
-		 RefAST ntr,
-		 std::vector<std::string> &str_vtr
-		 )
+bool ncap_mpi_srh_str
+(RefAST ntr,
+ std::vector<std::string> &str_vtr)
 {
   
   RefAST tr=ntr->getFirstChild();
-  
   if(ntr->getType()== VAR_ID || ntr->getType() == ATT_ID )
     // see if ID is in vector
-    if( std::binary_search(str_vtr.begin(),str_vtr.end(),ntr->getText()))
-      return true;
-  
+    if(std::binary_search(str_vtr.begin(),str_vtr.end(),ntr->getText())) return true;
   
   /*  
       if(ntr->getType()== VAR_ID || ntr->getType() == ATT_ID ){
@@ -2769,21 +2644,18 @@ ncap_mpi_srh_str(
   */
   // examine all child nodes
   while(tr){
-    if( ncap_mpi_srh_str(tr,str_vtr) )
-      return true;
+    if(ncap_mpi_srh_str(tr,str_vtr)) return true;
     tr=tr->getNextSibling();
   }  
-  
   return false;
 }
 
 // Subtract matching elements of
 // one list of strings from another
 bool
-ncap_sub_str_str(
-		 std::vector<std::string> &in_vtr,
-		 std::vector<std::string> &mb_vtr
-		 )
+ncap_sub_str_str
+(std::vector<std::string> &in_vtr,
+ std::vector<std::string> &mb_vtr)
 {
   unsigned int idx;
   unsigned int jdx;
@@ -2817,16 +2689,11 @@ ncap_sub_str_str(
   */
 }
 
-
-
-
 //Extract all VAR_ID & ATT_ID from Expression
-void ncap_mpi_get_id(
-		     RefAST ntr,
-		     std::vector<std::string> &str_vtr
-		     )
+void ncap_mpi_get_id
+(RefAST ntr,
+ std::vector<std::string> &str_vtr)
 {
-  
   RefAST tr=ntr->getFirstChild();
   
   if(ntr->getType()== VAR_ID || ntr->getType() == ATT_ID )
@@ -2839,12 +2706,10 @@ void ncap_mpi_get_id(
   }  
 }
 
-
 //Extract all LValues from Expression
-void ncap_mpi_get_lvl(
-		      RefAST ntr,
-		      std::vector<std::string> &str_vtr
-		      )
+void ncap_mpi_get_lvl
+(RefAST ntr,
+ std::vector<std::string> &str_vtr)
 {
   RefAST tr=ntr->getFirstChild();
   
@@ -2888,34 +2753,24 @@ void ncap_mpi_get_lvl(
   
 } // ncap_mpi_get_lvl   
 
-
-
 bool
-ncap_evl_srp(
-	     std::vector<exp_sct**> &srp_vtr //self reverential pointer
-	     )
+ncap_evl_srp
+(std::vector<exp_sct**> &srp_vtr) //self reverential pointer
 {
   unsigned int idx;
-  
-  if(srp_vtr.empty()) 
-    return true;
-  
-  for(idx=0 ; idx < srp_vtr.size() ; idx++)
-    if( *srp_vtr[idx]) 
-      return false;
-  
+  if(srp_vtr.empty()) return true;
+  for(idx=0;idx<srp_vtr.size();idx++)
+    if(*srp_vtr[idx]) return false;
   return true;
-  
-  
 }
 
 // Sort expressions for MPI optimization
 //ntr is a pointer to nbr_lst statements of type EXPR
-int ncap_mpi_srt(
-                 RefAST ntr,   
-		 int nbr_lst,
-		 std::vector< std::vector<RefAST> > &all_ast_vtr,
-                 prs_cls *prs_arg)
+int ncap_mpi_srt
+(RefAST ntr,   
+ int nbr_lst,
+ std::vector< std::vector<RefAST> > &all_ast_vtr,
+ prs_cls *prs_arg)
 {
   const std::string fnc_nm("ncap_mpi_srt"); 
   int idx;
@@ -2926,21 +2781,15 @@ int ncap_mpi_srt(
   
   std::vector<exp_sct*> exp_vtr;
   
-  
   // populate exp_vtr;
-  if(nco_dbg_lvl_get() >= nco_dbg_std)
-    dbg_prn(fnc_nm,"Start");
-  
-  
-  
+  if(nco_dbg_lvl_get() >= nco_dbg_std) dbg_prn(fnc_nm,"Start");
   
-  idx=0;tr=ntr;
+  idx=0;
+  tr=ntr;
   
   while(idx++<nbr_lst ) {
-    
     std::vector<std::string> cl_vtr;
     exp_ptr=new exp_sct();
-    
     // Initialise structure with AST and Lvalues
     //exp_ptr->etr=tr->getFirstChild();         
     exp_ptr->etr=tr;         
@@ -2948,9 +2797,7 @@ int ncap_mpi_srt(
     //Sort Lvalues for speed
     std::sort(cl_vtr.begin(), cl_vtr.end());
     // remove any duplicates
-    cl_vtr.erase(  std::unique(cl_vtr.begin(), cl_vtr.end()), 
-                   cl_vtr.end()
-                ); 
+    cl_vtr.erase(std::unique(cl_vtr.begin(), cl_vtr.end()),cl_vtr.end()); 
     
     exp_ptr->lvl_vtr=cl_vtr;
     
@@ -2958,7 +2805,6 @@ int ncap_mpi_srt(
     tr=tr->getNextSibling();
   }
   
-  
   // Populate dependency vector
   for(idx=0 ; idx < nbr_lst ;idx++) {
     // initialize local vars
@@ -2989,20 +2835,13 @@ int ncap_mpi_srt(
 		              ),
                     out_vtr.end()
                      );
-
-
       }
       // break out of inner loop if out_lvl_vtr empty
-      if(out_vtr.empty())
-	break ;
-      
-    }// loop jdx 
-  }// loop idx
-  
-  
+      if(out_vtr.empty()) break ;
+    } // loop jdx 
+  } // loop idx
   // print out whole  structure
-  /*
-    for(idx=0; idx<nbr_lst ; idx++){
+  /* for(idx=0; idx<nbr_lst ; idx++){
     // dereference
       exp_ptr=exp_vtr[idx];
       std::cout << exp_ptr->etr->toStringTree();
@@ -3014,14 +2853,8 @@ int ncap_mpi_srt(
       for(int jdx=0 ; jdx < exp_ptr->dpd_vtr.size() ; jdx++)
       std::cout << exp_ptr->dpd_vtr[jdx] <<" ";
       std::cout<<"\n";
-    }
-    
-  */ 
-  
-  
-  
+    } */ 
   int icnt=0;
-  
   while(icnt <nbr_lst){
     
     // Store list of dependent structures
@@ -3058,7 +2891,6 @@ int ncap_mpi_srt(
     all_ast_vtr.push_back(ast_vtr);   
     icnt+=(int)grp_vtr.size();
     
-    
   } // end while
   
   //Print out vectors
@@ -3070,7 +2902,5 @@ int ncap_mpi_srt(
     } //end idx
   }
   if(nco_dbg_lvl_get() >= nco_dbg_std) dbg_prn(fnc_nm,"End");       
-  
   return 0;
 }
-
diff --git a/src/nco++/prs_cls.cc b/src/nco++/prs_cls.cc
index d465ae9..a1e483e 100644
--- a/src/nco++/prs_cls.cc
+++ b/src/nco++/prs_cls.cc
@@ -344,7 +344,7 @@ prs_cls::ncap_var_write_omp(
   
   // FINAL SCAN
   Nvar=var_vtr.find(var->nm);
-  if(Nvar) {
+  if(Nvar){
     // temporary fix make typ_dsk same as type
     Nvar->var->typ_dsk=Nvar->var->type;
     bdef=true;
@@ -352,15 +352,14 @@ prs_cls::ncap_var_write_omp(
     //Possibly overwrite bram !!
     bram=Nvar->flg_mem;
     
-    if(var->has_mss_val)
+    if(var->has_mss_val){
       (void)nco_mss_val_cp(var,Nvar->var);
     // delete missing value
-    else if(Nvar->var->has_mss_val){
+    }else if(Nvar->var->has_mss_val){
       Nvar->var->has_mss_val=False;
       Nvar->var->mss_val.vp=(void*)nco_free(Nvar->var->mss_val.vp);
-    }      
-    
-  } 
+    } // !has_mss_val
+  } // !Nvar
   
   
   // Deal with a new RAM only variable
@@ -375,7 +374,6 @@ prs_cls::ncap_var_write_omp(
     return True;
   }
   
-  
   // Deal with a an existing RAM variable
   if(bdef && bram){
     var_sct *var_ref;
@@ -384,8 +382,6 @@ prs_cls::ncap_var_write_omp(
     // De-reference
     var_ref=Nvar->var;
     
-    
-    
     // check sizes are the same 
     if(var_ref->sz != var->sz) {
       std::ostringstream os;
@@ -395,7 +391,7 @@ prs_cls::ncap_var_write_omp(
       wrn_prn(fnc_nm,os.str());  
       var = nco_var_free(var);
       return False;
-    }
+    } // var->sz
     
     /* convert type to disk type */
     var=nco_var_cnf_typ(var_ref->type,var);    
@@ -407,16 +403,15 @@ prs_cls::ncap_var_write_omp(
     
     Nvar->flg_stt=2;
     
-    
     (void)nco_var_free(var);
     
     return True;
-  }
+  } // !(bdef && bram)
   
   // var is already defined but not populated 
   if(bdef && !bram && Nvar->flg_stt==1){
     ;
-  }
+  } // endif
   
   // var is already defined & populated in output 
   if(bdef && !bram && Nvar->flg_stt==2){
@@ -424,9 +419,8 @@ prs_cls::ncap_var_write_omp(
     var_sct* var_inf;
     var_inf=Nvar->cpyVarNoData();
     
-    
     /* check sizes are the same */
-    if(var_inf->sz != var->sz) {
+    if(var_inf->sz != var->sz){
       std::ostringstream os;
       os<< "Variable "<< var->nm << " size=" << var->sz << " has aleady been saved in ";
       os<< fl_out << " with size=" << var_inf->sz;
@@ -436,12 +430,11 @@ prs_cls::ncap_var_write_omp(
       var = nco_var_free(var);
       var_inf=nco_var_free(var_inf);
       return False;
-    }
+    } // var->sz
     
     /* convert type to disk type */
     var=nco_var_cnf_typ(var_inf->type,var);
     
-    
     //Swap values about
     var_inf->val=var->val;var->val.vp=(void*)NULL;
     var_swp=var;var=var_inf;var_inf=var_swp;
@@ -457,7 +450,7 @@ prs_cls::ncap_var_write_omp(
     
 #ifdef _OPENMP
     if(omp_in_parallel()) err_prn(fnc_nm, "Attempt to go into netCDF define mode while in OpenMP parallel mode");
-#endif
+#endif // _OPENMP
     (void)nco_redef(out_id);
     
     /* Define variable */   
@@ -474,11 +467,8 @@ prs_cls::ncap_var_write_omp(
 	  /* Set chunk sizes, if requested */
 	  // fxm: must first allow cnk_sz specification in ncap2.cc main()
 	  //if(var->cnk_sz && var->nbr_dim > 0) (void)nco_def_var_chunking(out_id,var_id,(int)NC_CHUNKED,var->cnk_sz);
-      } /* endif netCDF4 */
-
-
+	} /* endif netCDF4 */
       } /* endif */
-      
     } // bdef
     /* Put missing value 
        if(var->has_mss_val) (void)nco_put_att(out_id,var_out_id,nco_mss_val_sng_get(),var->type,1,var->mss_val.vp);
@@ -505,7 +495,7 @@ prs_cls::ncap_var_write_omp(
 #ifdef NCO_RUSAGE_DBG
   /* Compile: cd ~/nco/bld;make 'USR_TKN=-DNCO_RUSAGE_DBG';cd - */
   /* Print rusage memory usage statistics */
-  if(nco_dbg_lvl_get() >= nco_dbg_fl) {
+  if(nco_dbg_lvl_get() >= nco_dbg_fl){
     std::ostringstream os;
     os<<" Writing variable "<<var_nm; <<" to disk.";
     dbg_prn(fnc_nm,os.str());
diff --git a/src/nco/Makefile.in b/src/nco/Makefile.in
index 3ee37c7..b561d0f 100644
--- a/src/nco/Makefile.in
+++ b/src/nco/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,17 @@
 
 
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -97,10 +107,6 @@ target_triplet = @target@
 @ENABLE_MPI_TRUE@	$(am__EXEEXT_2)
 TESTS =
 subdir = src/nco
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/autobld/mkinstalldirs ncap_lex.c ncap_yacc.h \
-	ncap_yacc.c $(top_srcdir)/autobld/depcomp \
-	$(top_srcdir)/autobld/ylwrap $(top_srcdir)/autobld/test-driver
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -108,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
@@ -502,6 +509,10 @@ am__set_b = \
     *) \
       b='$*';; \
   esac
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autobld/depcomp \
+	$(top_srcdir)/autobld/mkinstalldirs \
+	$(top_srcdir)/autobld/test-driver $(top_srcdir)/autobld/ylwrap \
+	ncap_lex.c ncap_yacc.c ncap_yacc.h
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -817,7 +828,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/nco/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign src/nco/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -1172,7 +1182,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	if test -n "$$am__remaking_logs"; then \
 	  echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
 	       "recursion detected" >&2; \
-	else \
+	elif test -n "$$redo_logs"; then \
 	  am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
 	fi; \
 	if $(am__make_dryrun); then :; else \
@@ -1468,6 +1478,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 	uninstall uninstall-am uninstall-binPROGRAMS uninstall-hook \
 	uninstall-libLTLIBRARIES
 
+.PRECIOUS: Makefile
+
 
 install-exec-hook:
 	cd $(DESTDIR)$(bindir) && ln -s -f ncbo ncdiff || (rm -f ncdiff && ln -s -f ncbo ncdiff)
diff --git a/src/nco/ncatted.c b/src/nco/ncatted.c
index d2ff805..b1fef31 100644
--- a/src/nco/ncatted.c
+++ b/src/nco/ncatted.c
@@ -410,31 +410,31 @@ main(int argc,char **argv)
   ddra_info.tmr_flg=nco_tmr_rgl;
 
   for(int idx_aed=0;idx_aed<nbr_aed;idx_aed++){
-    if(aed_lst[idx_aed].var_nm == NULL){
-      /* Variable name is blank so edit same attribute for all variables ... */
-      (void)nco_aed_prc_var(nc_id,aed_lst[idx_aed],trv_tbl);
+    if(!aed_lst[idx_aed].var_nm){
+      /* Variable name is blank so edit same attribute for all variables */
+      (void)nco_aed_prc_var_all(nc_id,aed_lst[idx_aed],trv_tbl);
     }else if(strpbrk(aed_lst[idx_aed].var_nm,".*^$\\[]()<>+?|{}")){
-      /* Variable name contains a "regular expression" (rx) ... */
+      /* Variable name contains a "regular expression" (rx) */
       trv_tbl_sct *trv_tbl_rx;
       char **var_lst_in; /* I [sng] User-specified list of variables */
       int var_lst_in_nbr; /* I [nbr] Number of variables in list */
       var_lst_in=nco_lst_prs_2D(aed_lst[idx_aed].var_nm,",",&var_lst_in_nbr);
       trv_tbl_init(&trv_tbl_rx); 
-      /* Construct GTT (Group Traversal Table) */
+      /* Use regular expressions in aed structure to construct traversal table
+	 Variables marked for extraction will then have the attributes edited */
       (void)nco_bld_trv_tbl(nc_id,trv_pth,(int)0,NULL,(int)0,NULL,False,False,NULL,(int)0,var_lst_in,var_lst_in_nbr,False,False,False,False,False,nco_pck_plc_nil,&flg_dne,trv_tbl_rx); 
-      /* Edit same attribute for all variables ... */
+      /* Edit same attribute for all variables marked for extraction */
       (void)nco_aed_prc_var_xtr(nc_id,aed_lst[idx_aed],trv_tbl_rx);
       trv_tbl_free(trv_tbl_rx);
       var_lst_in=nco_sng_lst_free(var_lst_in,var_lst_in_nbr);
     }else if(!strcasecmp(aed_lst[idx_aed].var_nm,"group")){
-      /* Variable name indicates a group attribute ... */
+      /* Variable name of "group" means edit group attributes */
       (void)nco_aed_prc_grp(nc_id,aed_lst[idx_aed],trv_tbl);
     }else if(!strcasecmp(aed_lst[idx_aed].var_nm,"global")){
-      /* Variable name indicates a global attribute ... */
+      /* Variable name of "global" means edit global attributes */
       (void)nco_aed_prc_glb(nc_id,aed_lst[idx_aed],trv_tbl);
     }else{ 
-      /* Variable is a normal variable ... */
-      /* Inquire if any variable matches (absolute, relative)  */
+      /* Regular ole' variable name means edits attributes that match absoluted and relative names */
       (void)nco_aed_prc_var_nm(nc_id,aed_lst[idx_aed],trv_tbl);
     } /* end var_nm */
   } /* end loop over aed structures */
diff --git a/src/nco/ncecat.c b/src/nco/ncecat.c
index ae63278..46bb59b 100644
--- a/src/nco/ncecat.c
+++ b/src/nco/ncecat.c
@@ -870,8 +870,6 @@ main(int argc,char **argv)
 	(void)nco_inq_grp_full_ncid(in_id,var_trv->grp_nm_fll,&grp_id);
 	(void)nco_var_mtd_refresh(grp_id,var_prc[idx]);
 
-        assert(var_trv);
-
         /* Read */
         (void)nco_msa_var_get_trv(in_id,var_prc[idx],trv_tbl);
 
diff --git a/src/nco/ncks.c b/src/nco/ncks.c
index 3f49915..2d08cc1 100644
--- a/src/nco/ncks.c
+++ b/src/nco/ncks.c
@@ -123,7 +123,6 @@ main(int argc,char **argv)
   nco_bool FORTRAN_IDX_CNV=False; /* Option F */
   nco_bool GET_GRP_INFO=False; /* [flg] Iterate file, get group extended information */
   nco_bool GET_FILE_INFO=False; /* [flg] Get file information (#groups, #dimensions, #attributes, #variables) */
-  nco_bool GET_PRG_INFO=False; /* [flg] Get compiled program information (e.g., libraries) */
   nco_bool GET_LIST=False; /* [flg] Iterate file, print variables and exit */
   nco_bool GRP_VAR_UNN=False; /* [flg] Select union of specified groups and variables */
   nco_bool GRP_XTR_VAR_XCL=False; /* [flg] Extract matching groups, exclude matching variables */
@@ -451,8 +450,8 @@ main(int argc,char **argv)
       {"help",no_argument,0,'?'},
       {"hlp",no_argument,0,'?'},
       {"get_grp_info",no_argument,0,0},
-      {"get_prg_info",no_argument,0,0},
       {"get_file_info",no_argument,0,0},
+      {"lbr_rcd",no_argument,0,0},
       {0,0,0,0}
     }; /* end opt_lng */
   int opt_idx=0; /* Index of current long option into opt_lng array */
@@ -551,7 +550,6 @@ main(int argc,char **argv)
       if(!strcmp(opt_crr,"fl_fmt") || !strcmp(opt_crr,"file_format")) rcd=nco_create_mode_prs(optarg,&fl_out_fmt);
       if(!strcmp(opt_crr,"get_grp_info") || !strcmp(opt_crr,"grp_info_get")) GET_GRP_INFO=True;
       if(!strcmp(opt_crr,"get_file_info")) GET_FILE_INFO=True;
-      if(!strcmp(opt_crr,"get_prg_info")) GET_PRG_INFO=True;
       if(!strcmp(opt_crr,"hdf4")) nco_fmt_xtn=nco_fmt_xtn_hdf4; /* [enm] Treat file as HDF4 */
       if(!strcmp(opt_crr,"hdn") || !strcmp(opt_crr,"hidden")) PRN_HDN=True; /* [flg] Print hidden attributes */
       if(!strcmp(opt_crr,"hdr_pad") || !strcmp(opt_crr,"header_pad")){
@@ -562,6 +560,7 @@ main(int argc,char **argv)
         (void)nco_lbr_vrs_prn();
         nco_exit(EXIT_SUCCESS);
       } /* endif "lbr" */
+      if(!strcmp(opt_crr,"lbr_rcd")) nco_exit_lbr_rcd();
       if(!strcmp(opt_crr,"scrip")){
         fl_scrip=strdup(optarg);
 	sld_nfo=(kvm_sct *)nco_malloc(BUFSIZ*sizeof(kvm_sct));
@@ -845,9 +844,6 @@ main(int argc,char **argv)
   /* Initialize traversal table */
   (void)trv_tbl_init(&trv_tbl);
  
-  /* Get program info for regressions tests */
-  if(GET_PRG_INFO) nco_get_prg_info();
-
   /* Process positional arguments and fill in filenames */
   fl_lst_in=nco_fl_lst_mk(argv,argc,optind,&fl_nbr,&fl_out,&FL_LST_IN_FROM_STDIN);
   
@@ -878,6 +874,7 @@ main(int argc,char **argv)
   /* Make output and input files consanguinous */
   (void)nco_inq_format(in_id,&fl_in_fmt);
   if(fl_out && fl_out_fmt == NCO_FORMAT_UNDEFINED) fl_out_fmt=fl_in_fmt;
+  if(fl_out_fmt == NC_FORMAT_NETCDF4 || fl_out_fmt == NC_FORMAT_NETCDF4_CLASSIC) (void)omp_set_num_threads((int)0);
 
 #ifdef ENABLE_MPI
   if(prc_rnk == rnk_mgr) (void)fprintf(stdout,"%s: MPI process rank %d reports %d process%s\n",nco_prg_nm,prc_rnk,prc_nbr,(prc_nbr == 1) ? "" : "es");
@@ -885,25 +882,21 @@ main(int argc,char **argv)
   (void)fprintf(stdout,"%s: MPI process rank %d reports %d process%s\n",nco_prg_nm,prc_rnk,prc_nbr,(prc_nbr == 1) ? "" : "es");
 #endif /* !ENABLE_MPI */
 
-  /* Process -z option if requested */ 
+  /* Pedro's options, essentially for debugging (deprecated, likely to be eliminated in future) */ 
   if(GET_LIST){ 
     if(ALPHABETIZE_OUTPUT) trv_tbl_srt(trv_tbl);
     trv_tbl_prn(trv_tbl);
     goto close_and_free; 
-  } /* end GET_LIST */ 
-
-  /* Process --get_grp_info option if requested */ 
+  } /* !GET_LIST */ 
   if(GET_GRP_INFO){ 
     nco_prn_trv_tbl(in_id,trv_tbl);
     goto close_and_free; 
-  } /* end GET_GRP_INFO */
-
-  /* Process --get_file_info option if requested */ 
+  } /* !GET_GRP_INFO */
   if(GET_FILE_INFO){ 
     (void)fprintf(stderr,"%s: INFO reports file information\n",nco_prg_nm_get());
     (void)fprintf(stdout,"%d subgroups, %d fixed dimensions, %d record dimensions, %d group + global attributes, %d atomic-type variables, %d non-atomic variables\n",grp_nbr_fl,trv_tbl->nbr_dmn-dmn_rec_fl,dmn_rec_fl,att_glb_nbr+att_glb_nbr,var_nbr_fl,var_ntm_fl);
     goto close_and_free; 
-  } /* end GET_FILE_INFO */
+  } /* !GET_FILE_INFO */
 
   if(ALPHABETIZE_OUTPUT) trv_tbl_srt(trv_tbl);
 
diff --git a/src/nco/nco.h b/src/nco/nco.h
index 3519be5..7567db9 100644
--- a/src/nco/nco.h
+++ b/src/nco/nco.h
@@ -64,12 +64,10 @@ extern "C" {
 /* Boolean values */
 /* From Wikipedia:
    "On a recent C compiler (supporting the C99 standard), there is a _Bool type, which is used to define bool by the stdbool.h header: 
-
    #include <stdbool.h>
    bool b = false;
    ...
    b = true;
-
    During its standardization process, the C++ programming language introduced the bool, true and false keywords, adding a native datatype to support boolean data.
    Preprocessor macros may be used to turn bool into _Bool, false into 0 and true into 1, allowing compatibility with the aforementioned C99 use of the stdbool.h header." */
 #define nco_bool int
@@ -110,6 +108,12 @@ extern "C" {
 #define nco_string_CEWI NULL
 #define short_CEWI 0
 #define size_t_CEWI 0UL
+
+  /* 20150617: Define macro to indicate variables are unused by design
+     http://stackoverflow.com/questions/777261/avoiding-unused-variables-warnings-when-using-assert-in-a-release-build 
+     Especially useful to keep variables used only in assert() macros from triggering unused variable warnings
+     Eventually, much CEWI code could be replaced by this macro */
+#define CEWI_unused(x)   ((void)x)
   
   /* Numeric constants to simplify arithmetic */
 #define NCO_BYT_PER_KB 1024UL
@@ -292,7 +296,7 @@ extern "C" {
 # define NCO_VERSION_MINOR 5
 #endif /* !NCO_VERSION_MINOR */
 #ifndef NCO_VERSION_PATCH
-# define NCO_VERSION_PATCH 0
+# define NCO_VERSION_PATCH 1
 #endif /* !NCO_VERSION_PATCH */
 #ifndef NCO_VERSION_NOTE
 # define NCO_VERSION_NOTE  "" /* May be blank */
@@ -302,7 +306,7 @@ extern "C" {
 # define NCO_LIB_VERSION ( NCO_VERSION_MAJOR * 100 + NCO_VERSION_MINOR * 10 + NCO_VERSION_PATCH )
 #endif /* !NCO_LIB_VERSION */
 #ifndef NCO_VERSION
-# define NCO_VERSION "4.5.0"
+# define NCO_VERSION "4.5.1"
 #endif /* !NCO_VERSION */
 
 /* Compatibility tokens new to netCDF4 netcdf.h: */
diff --git a/src/nco/nco_att_utl.c b/src/nco/nco_att_utl.c
index 4ea5d2f..acec6c1 100644
--- a/src/nco/nco_att_utl.c
+++ b/src/nco/nco_att_utl.c
@@ -18,15 +18,131 @@
 # define strtoll  _strtoi64
 #endif /* !_MSC_VER */
 
-void
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_wrp /* [fnc] Expand regular expressions then pass attribute edits to nco_aed_prc() */
+(const int nc_id, /* I [id] Input netCDF file ID */
+ const int var_id, /* I [id] ID of variable on which to perform attribute editing */
+ const aed_sct aed) /* I [sct] Attribute-edit information */
+{
+  /* Purpose: Wrapper for nco_aed_prc(), which processes single attribute edit for single variable
+     This wrapper passes its arguments straight throught to nco_aed_prc() with one exception---
+     it unrolls attribute name that are regular expression into multiple calls to nco_aed_prc() */
+  const char fnc_nm[]="nco_aed_prc_wrp()"; /* [sng] Function name */
+  nco_bool flg_chg=False; /* [flg] Attribute was altered */
+
+  if(!strpbrk(aed.att_nm,".*^$\\[]()<>+?|{}")){
+    // const char foo[]="foo {{";
+    /* NB: previous line confuses Emacs C-mode indenter. Restore with isolated parenthesis? */
+    /* If attribute name is not regular expression, call single attribute routine then return */
+    flg_chg|=nco_aed_prc(nc_id,var_id,aed);
+    return flg_chg; /* [flg] Attribute was altered */
+  } /* !rx */
+  
+#ifndef NCO_HAVE_REGEX_FUNCTIONALITY
+  (void)fprintf(stdout,"%s: ERROR: Sorry, wildcarding (extended regular expression matches to attributes) was not built into this NCO executable, so unable to compile regular expression \"%s\".\nHINT: Make sure libregex.a is on path and re-build NCO.\n",nco_prg_nm_get(),aed.att_nm);
+  nco_exit(EXIT_FAILURE);
+#else /* NCO_HAVE_REGEX_FUNCTIONALITY */
+  /* aed.att_nm is regular expression */
+
+  aed_sct aed_swp; /* [sct] Attribute-edit information */
+
+  char *rx_sng; /* [sng] Regular expression pattern */
+
+  int err_id;
+  int flg_cmp; /* Comparison flags */
+  int flg_exe; /* Execution flages */
+  int mch_nbr=0;
+  
+  regex_t *rx;
+  regmatch_t *result;
+
+  size_t rx_prn_sub_xpr_nbr;
+
+  rx_sng=aed.att_nm;
+  rx=(regex_t *)nco_malloc(sizeof(regex_t));
+
+  /* Choose RE_SYNTAX_POSIX_EXTENDED regular expression type */
+  flg_cmp=(REG_EXTENDED | REG_NEWLINE);
+  /* Set execution flags */
+  flg_exe=0;
+
+  /* Compile regular expression */
+  if((err_id=regcomp(rx,rx_sng,flg_cmp))){ /* Compile regular expression */
+    char const * rx_err_sng;  
+    /* POSIX regcomp return error codes */
+    switch(err_id){
+    case REG_BADPAT: rx_err_sng="Invalid pattern"; break;  
+    case REG_ECOLLATE: rx_err_sng="Not implemented"; break;
+    case REG_ECTYPE: rx_err_sng="Invalid character class name"; break;
+    case REG_EESCAPE: rx_err_sng="Trailing backslash"; break;
+    case REG_ESUBREG: rx_err_sng="Invalid back reference"; break;
+    case REG_EBRACK: rx_err_sng="Unmatched left bracket"; break;
+    case REG_EPAREN: rx_err_sng="Parenthesis imbalance"; break;
+    case REG_EBRACE: rx_err_sng="Unmatched {"; break;
+    case REG_BADBR: rx_err_sng="Invalid contents of { }"; break;
+    case REG_ERANGE: rx_err_sng="Invalid range end"; break;
+    case REG_ESPACE: rx_err_sng="Ran out of memory"; break;
+    case REG_BADRPT: rx_err_sng="No preceding re for repetition op"; break;
+    default: rx_err_sng="Invalid pattern"; break;  
+    } /* end switch */
+    (void)fprintf(stdout,"%s: ERROR %s error in regular expression \"%s\" %s\n",nco_prg_nm_get(),fnc_nm,rx_sng,rx_err_sng); 
+    nco_exit(EXIT_FAILURE);
+  } /* end if err */
+
+  rx_prn_sub_xpr_nbr=rx->re_nsub+1L; /* Number of parenthesized sub-expressions */
+
+  /* Search string */
+  result=(regmatch_t *)nco_malloc(sizeof(regmatch_t)*rx_prn_sub_xpr_nbr);
+
+  /* Regular expression is ready to use */
+  char **att_nm_lst;
+  int att_idx;
+  int att_nbr;
+  int grp_id;
+  grp_id=nc_id;
+  /* Get number of attributes for variable/group */
+  (void)nco_inq_varnatts(grp_id,var_id,&att_nbr);
+
+  /* 20150629: Read in all attribute names before any editing 
+     This is because creation or deletion of attributes can change their number
+     According to the netCDF documentation, "The number of an attribute is more volatile than the name, since it can change when other attributes of the same variable are deleted. This is why an attribute number is not called an attribute ID." */
+  att_nm_lst=(char **)nco_malloc(att_nbr*sizeof(char *));
+  for(att_idx=0;att_idx<att_nbr;att_idx++){
+    att_nm_lst[att_idx]=(char *)nco_malloc((NC_MAX_NAME+1L)*sizeof(char));
+    nco_inq_attname(grp_id,var_id,att_idx,att_nm_lst[att_idx]);
+  } /* !att */
+
+  /* Check each attribute for match to rx */
+  for(att_idx=0;att_idx<att_nbr;att_idx++){
+    if(!regexec(rx,att_nm_lst[att_idx],rx_prn_sub_xpr_nbr,result,flg_exe)){
+      mch_nbr++;
+      /* Swap original attibute name (the regular expression) with its current match */
+      aed_swp=aed;
+      aed_swp.att_nm=att_nm_lst[att_idx];
+      flg_chg|=nco_aed_prc(nc_id,var_id,aed_swp);
+    } /* !mch */
+  } /* !att */
+
+  if(att_nm_lst) att_nm_lst=nco_sng_lst_free(att_nm_lst,att_nbr);
+  if(!mch_nbr) (void)fprintf(stdout,"%s: WARNING: Regular expression \"%s\" does not match any attribute\nHINT: See regular expression syntax examples at http://nco.sf.net/nco.html#rx\n",nco_prg_nm_get(),aed.att_nm); 
+
+  regfree(rx); /* Free regular expression data structure */
+  rx=(regex_t *)nco_free(rx);
+  result=(regmatch_t *)nco_free(result);
+#endif /* NCO_HAVE_REGEX_FUNCTIONALITY */
+  
+ return flg_chg; /* [flg] Attribute was altered */
+} /* end nco_aed_prc() */
+
+ nco_bool /* [flg] Attribute was changed */
 nco_aed_prc /* [fnc] Process single attribute edit for single variable */
 (const int nc_id, /* I [id] Input netCDF file ID */
  const int var_id, /* I [id] ID of variable on which to perform attribute editing */
- const aed_sct aed) /* I [sct] Structure containing information necessary to edit */
+ const aed_sct aed) /* I [sct] Attribute-edit information */
 {
   /* Purpose: Process single attribute edit for single variable */
   
-  /* If var_id == NC_GLOBAL ( = -1) then global attribute will be edited */
+  /* If var_id == NC_GLOBAL == -1 then edit global/group attribute */
   
   const char fnc_nm[]="nco_aed_prc()"; /* [sng] Function name */
   
@@ -46,6 +162,7 @@ nco_aed_prc /* [fnc] Process single attribute edit for single variable */
   long att_sz;
   
   nc_type att_typ;
+  nco_bool flg_chg=False; /* [flg] Attribute was altered */
   
   void *att_val_new=NULL;
   
@@ -240,7 +357,7 @@ nco_aed_prc /* [fnc] Process single attribute edit for single variable */
      aed.att_nm && /* 20130419: Verify att_nm exists before using it in strcmp() below. att_nm does not exist when user leaves field blank. Fix provided by Etienne Tourigny. */
      !strcmp(aed.att_nm,nco_mss_val_sng_get()) && /* ... attribute is missing value and ... */
      aed.mode != aed_delete &&  /* ... we are not deleting attribute */
-     NC_LIB_VERSION < 434){ /* netCDF library does not contain fix to NCF-187 */
+     NC_LIB_VERSION <= 440){ /* netCDF library does not contain fix to NCF-187 */
     /* Rename existing attribute to netCDF4-safe name 
        After modifying missing value attribute with netCDF4-safe name below, 
        we will rename attribute to original missing value name. */
@@ -272,34 +389,47 @@ nco_aed_prc /* [fnc] Process single attribute edit for single variable */
 		   (void *)aed.val.vp,
 		   aed.sz*nco_typ_lng(aed.type));
       rcd+=nco_put_att(nc_id,var_id,aed.att_nm,aed.type,att_sz+aed.sz,att_val_new);
+      flg_chg=True; /* [flg] Attribute was altered */
       att_val_new=nco_free(att_val_new);
     }else{
       /* Create new attribute */
       rcd+=nco_put_att(nc_id,var_id,aed.att_nm,aed.type,aed.sz,aed.val.vp);
+      flg_chg=True; /* [flg] Attribute was altered */
     } /* end else */
     break;
   case aed_create:	
-    if(rcd_inq_att != NC_NOERR) rcd+=nco_put_att(nc_id,var_id,aed.att_nm,aed.type,aed.sz,aed.val.vp);  
+    if(rcd_inq_att != NC_NOERR){
+      rcd+=nco_put_att(nc_id,var_id,aed.att_nm,aed.type,aed.sz,aed.val.vp);  
+      flg_chg=True; /* [flg] Attribute was altered */
+    } /* endif */
     break;
   case aed_delete:	
     /* Delete specified attribute if attribute name was specified... */
     if(aed.att_nm){
       /* ...and if attribute is known to exist from previous inquire call... */
-      if(rcd_inq_att == NC_NOERR) rcd+=nco_del_att(nc_id,var_id,aed.att_nm);
+      if(rcd_inq_att == NC_NOERR){
+	rcd+=nco_del_att(nc_id,var_id,aed.att_nm);
+	flg_chg=True; /* [flg] Attribute was altered */
+      } /* endif */
     }else{
       /* ...else delete all attributes for this variable... */
       while(nbr_att){
 	rcd+=nco_inq_attname(nc_id,var_id,nbr_att-1,att_nm);
 	rcd+=nco_del_att(nc_id,var_id,att_nm);
 	nbr_att--;
+	flg_chg=True; /* [flg] Attribute was altered */
       } /* end while */
     } /* end else */
     break;
   case aed_modify:	
-    if(rcd_inq_att == NC_NOERR) rcd+=nco_put_att(nc_id,var_id,aed.att_nm,aed.type,aed.sz,aed.val.vp);
+    if(rcd_inq_att == NC_NOERR){
+      rcd+=nco_put_att(nc_id,var_id,aed.att_nm,aed.type,aed.sz,aed.val.vp);
+      flg_chg=True; /* [flg] Attribute was altered */
+    } /* endif */
     break;
   case aed_overwrite:	
     rcd+=nco_put_att(nc_id,var_id,aed.att_nm,aed.type,aed.sz,aed.val.vp);  
+    flg_chg=True; /* [flg] Attribute was altered */
     break;
   default: 
     break;
@@ -315,8 +445,187 @@ nco_aed_prc /* [fnc] Process single attribute edit for single variable */
 
   if(rcd != NC_NOERR) (void)fprintf(stdout,"%s: DEBUG WARNING %s reports unexpected cumulative rcd = %i on exit. Please report this to NCO project.\n",nco_prg_nm_get(),fnc_nm,rcd);
 
+  return flg_chg; /* [flg] Attribute was altered */
 } /* end nco_aed_prc() */
 
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_glb /* [fnc] Process attributes in root group */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl) /* I [lst] Traversal table */ 
+{
+  /* Purpose: Process attributes in root group */
+  const char fnc_nm[]="nco_aed_prc_glb()"; /* [sng] Function name */
+  int grp_id; /* [id] Group ID */
+  nco_bool flg_chg=nco_bool_CEWI; /* [flg] Attribute was altered */
+
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_grp && !strcmp("/",trv_tbl->lst[tbl_idx].nm_fll)){
+      (void)nco_inq_grp_full_ncid(nc_id,trv_tbl->lst[tbl_idx].grp_nm_fll,&grp_id);
+      flg_chg=nco_aed_prc_wrp(grp_id,NC_GLOBAL,aed);
+      break;
+    } /* !grp */
+  } /* !tbl */ 
+
+  if(nco_dbg_lvl_get() > nco_dbg_var && !flg_chg) (void)fprintf(stderr,"%s: INFO %s reports attribute %s was not changed in root group\n",fnc_nm,nco_prg_nm_get(),aed.att_nm);
+
+  return flg_chg;
+} /* nco_aed_prc_glb() */
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_grp /* [fnc] Process attributes in groups */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl) /* I [lst] Traversal table */ 
+{
+  /* Purpose: Process attributes in groups */
+  const char fnc_nm[]="nco_aed_prc_grp()"; /* [sng] Function name */
+  int grp_id; /* [id] Group ID */
+  nco_bool flg_chg=False; /* [flg] Attribute was altered */
+
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_grp){
+      (void)nco_inq_grp_full_ncid(nc_id,trv_tbl->lst[tbl_idx].grp_nm_fll,&grp_id);
+      flg_chg|=nco_aed_prc_wrp(grp_id,NC_GLOBAL,aed);
+    } /* !group */
+  } /* end loop over tables */ 
+
+  if(nco_dbg_lvl_get() > nco_dbg_var && !flg_chg) (void)fprintf(stderr,"%s: INFO %s reports attribute %s was not changed in any group\n",fnc_nm,nco_prg_nm_get(),aed.att_nm);
+
+  return flg_chg;
+} /* nco_aed_prc_grp() */
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_var_all /* [fnc] Process attributes in all variables */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl) /* I [lst] Traversal table */ 
+{
+  /* Purpose: Process attributes in all variables */
+  const char fnc_nm[]="nco_aed_prc_var_all()"; /* [sng] Function name */
+  int grp_id; /* [id] Group ID */
+  int var_id; /* [id] Variable ID */
+  nco_bool flg_chg=False; /* [flg] Attribute was altered */
+  nco_bool var_fnd=False; /* [flg] Variable was found */
+
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_var){
+      (void)nco_inq_grp_full_ncid(nc_id,trv_tbl->lst[tbl_idx].grp_nm_fll,&grp_id);
+      (void)nco_inq_varid(grp_id,trv_tbl->lst[tbl_idx].nm,&var_id);
+      flg_chg|=nco_aed_prc_wrp(grp_id,var_id,aed);
+      var_fnd=True;
+    } /* !var */
+  } /* !tbl */ 
+
+  if(!var_fnd){
+    (void)fprintf(stderr,"%s: ERROR File contains no variables so variable attributes cannot be changed\n",nco_prg_nm_get());
+    nco_exit(EXIT_FAILURE);
+  } /* var_fnd */
+  if(nco_dbg_lvl_get() >= nco_dbg_var && !flg_chg) (void)fprintf(stderr,"%s: INFO %s reports attribute %s was not changed in any variable\n",fnc_nm,nco_prg_nm_get(),aed.att_nm);
+
+  return flg_chg;
+} /* nco_aed_prc_var_all() */
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_var_nm /* [fnc] Process attributes in variables that match input name */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl) /* I [lst] Traversal table */ 
+{
+  /* Purpose: Process attributes in variables that match input name (absolute or relative) */
+  const char fnc_nm[]="nco_aed_prc_var_nm()"; /* [sng] Function name */
+  int grp_id; /* [id] Group ID */
+  int var_id; /* [id] Variable ID */
+  nco_bool flg_chg=False; /* [flg] Attribute was altered */
+  nco_bool var_fnd=False; /* [flg] Variable was found */
+
+  /* Loop table (absolute name) */
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    trv_sct trv=trv_tbl->lst[tbl_idx];
+    if(trv.nco_typ == nco_obj_typ_var && !strcmp(aed.var_nm,trv.nm_fll)){
+      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
+      (void)nco_inq_varid(grp_id,trv.nm,&var_id);
+      flg_chg|=nco_aed_prc_wrp(grp_id,var_id,aed);
+      /* Only 1 match possible, return */
+      if(nco_dbg_lvl_get() >= nco_dbg_var && !flg_chg) (void)fprintf(stderr,"%s: INFO %s reports attribute %s was not changed for variable %s\n",fnc_nm,nco_prg_nm_get(),aed.att_nm,trv.grp_nm_fll);
+      return flg_chg;
+    } /* !var */
+  } /* !tbl */ 
+
+  /* Try relative variable names */
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    trv_sct trv=trv_tbl->lst[tbl_idx];
+    if(trv.nco_typ == nco_obj_typ_var && !strcmp(aed.var_nm,trv.nm)){
+      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
+      (void)nco_inq_varid(grp_id,trv.nm,&var_id);
+      flg_chg|=nco_aed_prc_wrp(grp_id,var_id,aed);
+      var_fnd=True;
+    } /* !var */
+  } /* !tbl */ 
+
+  /* Try absolute group names */
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    trv_sct trv=trv_tbl->lst[tbl_idx];
+    if(trv.nco_typ == nco_obj_typ_grp && !strcmp(aed.var_nm,trv.nm_fll)){
+      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
+      flg_chg|=nco_aed_prc_wrp(grp_id,NC_GLOBAL,aed);
+      if(nco_dbg_lvl_get() >= nco_dbg_var && !flg_chg) (void)fprintf(stderr,"%s: INFO %s reports attribute %s was not changed for group %s\n",fnc_nm,nco_prg_nm_get(),aed.att_nm,trv.grp_nm_fll);
+      /* Only 1 match possible, return */
+      return flg_chg;
+    } /* !var */
+  } /* !tbl */ 
+
+  /* Try relative group names */
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    trv_sct trv=trv_tbl->lst[tbl_idx];
+    if(trv.nco_typ == nco_obj_typ_grp && !strcmp(aed.var_nm,trv.nm)){
+      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
+      flg_chg|=nco_aed_prc_wrp(grp_id,NC_GLOBAL,aed);
+      var_fnd=True;
+    } /* !var */
+  } /* !tbl */ 
+
+  if(!var_fnd){
+    (void)fprintf(stderr,"%s: ERROR File contains no variables or groups that match name %s so attribute %s cannot be changed\n",nco_prg_nm_get(),aed.var_nm,aed.att_nm);
+    nco_exit(EXIT_FAILURE);
+  } /* var_fnd */
+  if(nco_dbg_lvl_get() >= nco_dbg_var && !flg_chg) (void)fprintf(stderr,"%s: INFO %s reports attribute %s was not changed for groups or variables that match relative name %s\n",fnc_nm,nco_prg_nm_get(),aed.att_nm,aed.var_nm);
+
+  return flg_chg;
+} /* nco_aed_prc_var_nm() */
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_var_xtr /* [fnc] Process attributes in variables with extraction flag set */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl) /* I [lst] Traversal table */ 
+{
+  /* Purpose: Process attributes in extracted variables */
+  const char fnc_nm[]="nco_aed_prc_var_xtr()"; /* [sng] Function name */
+  int grp_id; /* [id] Group ID */
+  int var_id; /* [id] Variable ID */
+  nco_bool flg_chg=False; /* [flg] Attribute was altered */
+  nco_bool var_fnd=False; /* [flg] Variable was found */
+
+  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
+    trv_sct trv=trv_tbl->lst[tbl_idx];
+    if(trv.nco_typ == nco_obj_typ_var && trv.flg_xtr){
+      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
+      (void)nco_inq_varid(grp_id,trv.nm,&var_id);
+      flg_chg|=nco_aed_prc_wrp(grp_id,var_id,aed);
+      var_fnd=True;
+    } /* !var */
+  } /* !tbl */ 
+
+  if(!var_fnd){
+    (void)fprintf(stderr,"%s: ERROR File contains no extracted variables or groups so attribute %s cannot be changed\n",nco_prg_nm_get(),aed.att_nm);
+    nco_exit(EXIT_FAILURE);
+  } /* var_fnd */
+  if(nco_dbg_lvl_get() >= nco_dbg_var && !flg_chg) (void)fprintf(stderr,"%s: INFO %s reports attribute %s was not changed in any extracted variables\n",fnc_nm,nco_prg_nm_get(),aed.att_nm);
+
+  return flg_chg;
+} /* nco_aed_prc_var_xtr() */
+
 void 
 nco_att_cpy  /* [fnc] Copy attributes from input netCDF file to output netCDF file */
 (const int in_id, /* I [id] netCDF input-file ID */
@@ -619,7 +928,7 @@ nco_prv_att_cat /* [fnc] Add provenance (history contents) of appended file to p
     att_sz=strlen(hst_sng_fmt)+strlen(time_stamp_sng)+strlen(fl_in)+strlen(att_nm_hst);
     hst_sng=(char *)nco_malloc((att_sz+1L)*sizeof(char));
     hst_sng[att_sz]='\0';
-    (void)sprintf(hst_sng,hst_sng_fmt,time_stamp_sng,fl_in,att_nm_hst);
+    (void)sprintf(hst_sng,hst_sng_fmt,fl_in,att_nm_hst);
   }else{
     /* Input file contains Global attribute "[hH]istory" */
     char hst_sng_fmt[]="Appended file %s had following \"%s\" attribute:\n%s\n";
@@ -1550,12 +1859,11 @@ nco_prs_rnm_lst /* [fnc] Set old_nm, new_nm elements of rename structure */
     
     lng_arg_1=comma_1_cp-rnm_arg[idx]; 
 
-    /* If new name is absolute path, get rid of it (ncrename does in place, same group, changes, so absolute path is redundant) */
+    /* Skip absolute path component (ncrename does in place, same group, changes, so absolute path is redundant) */
     char *abs_1_cp=strrchr(comma_1_cp,'/');
+
     /* Found path separator in new name (string after ',' ) */
-    if (abs_1_cp){
-      comma_1_cp=strrchr(comma_1_cp,'/');
-    }
+    if(abs_1_cp) comma_1_cp=strrchr(comma_1_cp,'/');
 
     lng_arg_2=rnm_arg[idx]+strlen(rnm_arg[idx])-comma_1_cp-1; 
     
@@ -1567,12 +1875,11 @@ nco_prs_rnm_lst /* [fnc] Set old_nm, new_nm elements of rename structure */
     
     /* Assign pointers to member of rnm_lst */
     rnm_lst[idx].old_nm=rnm_arg[idx];
-    rnm_lst[idx].new_nm=comma_1_cp+1;
+    rnm_lst[idx].new_nm=comma_1_cp+1L;
 
     /* NUL-terminate arguments */
     rnm_lst[idx].old_nm[lng_arg_1]='\0';
     rnm_lst[idx].new_nm[lng_arg_2]='\0';
-    
   } /* end loop over rnm_lst */
 
   if(nco_dbg_lvl_get() >= nco_dbg_io){
@@ -1591,13 +1898,16 @@ nco_vrs_att_cat /* [fnc] Add NCO version global attribute */
 {
   /* Purpose: Write NCO version information to global metadata */
   aed_sct vrs_sng_aed;
-  char att_nm[]="NCO";
-  char *vrs_cvs; /* [sng] Version according to CVS release tag */
+  char att_nm[]="NCO"; /* [sng] Name of attribute in which to store NCO version */
+  char vrs_git[]=TKN2SNG(VERSION); /* [sng] Version according to Git */
+  char *vrs_cvs; /* [sng] Version according to RCS/CVS-like release tag */
   char *vrs_sng; /* [sng] NCO version */
   ptr_unn att_val;
   
   vrs_cvs=cvs_vrs_prs();
+  
   vrs_sng=vrs_cvs;
+  vrs_sng=vrs_git;
 
   /* Insert thread number into value */
   att_val.cp=vrs_sng;
@@ -1610,9 +1920,9 @@ nco_vrs_att_cat /* [fnc] Add NCO version global attribute */
   /* Insert value into attribute structure */
   vrs_sng_aed.val=att_val;
   vrs_sng_aed.mode=aed_overwrite;
-  /* Write nco_openmp_thread_number attribute to disk */
+  /* Write NCO version attribute to disk */
   (void)nco_aed_prc(out_id,NC_GLOBAL,vrs_sng_aed);
-  vrs_sng=(char *)nco_free(vrs_sng);
+  // vrs_sng=(char *)nco_free(vrs_sng);
 
 } /* end nco_vrs_att_cat() */
 
@@ -1712,6 +2022,7 @@ nco_xcp_prc /* [fnc] Perform exception processing on this variable */
      Otherwise these variables would need a dummy dimension for time or char 
      For now, do not attempt to update values when var_sz != 8 */
   assert(var_typ == NC_CHAR);
+  CEWI_unused(var_typ);
   if(var_sz != 8) return;
   
   /* One block for each variable in exception list in nco_is_xcp() */
diff --git a/src/nco/nco_att_utl.h b/src/nco/nco_att_utl.h
index 5d70abf..b2c148c 100644
--- a/src/nco/nco_att_utl.h
+++ b/src/nco/nco_att_utl.h
@@ -46,11 +46,47 @@
 extern "C" {
 #endif /* __cplusplus */
 
-void
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_wrp /* [fnc] Expand regular expressions then pass attribute edits to nco_aed_prc() */
+(const int nc_id, /* I [id] Input netCDF file ID */
+ const int var_id, /* I [id] ID of variable on which to perform attribute editing */
+ const aed_sct aed); /* I [sct] Attribute-edit information */
+
+  nco_bool /* [flg] Attribute was altered */
 nco_aed_prc /* [fnc] Process single attribute edit for single variable */
 (const int nc_id, /* I [id] Input netCDF file ID */
  const int var_id, /* I [id] ID of variable on which to perform attribute editing */
- const aed_sct aed); /* I [sct] Structure containing information necessary to edit */
+ const aed_sct aed); /* I [sct] Attribute-edit information */
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_glb /* [fnc] Process attributes in root group */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl); /* I [lst] Traversal table */ 
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_grp /* [fnc] Process attributes in groups */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl); /* I [lst] Traversal table */ 
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_var_all /* [fnc] Process attributes in all variables */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl); /* I [lst] Traversal table */ 
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_var_xtr /* [fnc] Process attributes in variables that match table extraction flag */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl); /* I [lst] Traversal table */ 
+
+nco_bool /* [flg] Attribute was changed */
+nco_aed_prc_var_nm /* [fnc] Process attributes in variables that match input name */
+(const int nc_id, /* I [id] netCDF file ID */
+ const aed_sct aed, /* I [sct] Attribute-edit information */
+ const trv_tbl_sct * const trv_tbl); /* I [lst] Traversal table */ 
 
 void 
 nco_att_cpy  /* [fnc] Copy attributes from input netCDF file to output netCDF file */
diff --git a/src/nco/nco_cnk.c b/src/nco/nco_cnk.c
index 2a59bd0..5c6bb7a 100644
--- a/src/nco/nco_cnk.c
+++ b/src/nco/nco_cnk.c
@@ -1149,6 +1149,7 @@ nco_cnk_sz_set_trv /* [fnc] Set chunksize parameters (GTT version of nco_cnk_sz_
     dmn_nbr_lft=dmn_idx_1st_rec+1;
     cnk_sz_lft_dbl=pow(cnk_sz_prd_lft,1.0/dmn_nbr_lft);
     cnk_sz_lft=(size_t)cnk_sz_lft_dbl;
+    if(cnk_sz_lft <= 0) cnk_sz_lft=1L;
     /* Assign remaining chunkspace equally amongst lefter dimensions */
     for(dmn_idx=0;dmn_idx<=dmn_idx_1st_rec;dmn_idx++) cnk_sz[dmn_idx]=cnk_sz_lft;
 
diff --git a/src/nco/nco_cnv_csm.c b/src/nco/nco_cnv_csm.c
index c54e6b2..b83872d 100644
--- a/src/nco/nco_cnv_csm.c
+++ b/src/nco/nco_cnv_csm.c
@@ -236,7 +236,7 @@ nco_cnv_cf_cll_mth_add               /* [fnc] Add cell_methods attributes */
  gpe_sct *gpe,                       /* I [sng] Group Path Editing (GPE) structure */
  const trv_tbl_sct * const trv_tbl)  /* I [sct] Traversal table */
 {
-  /* Purpose: Add/modify cell_methods attribute according to CF convention
+  /* Purpose: Add/modify CF cell_methods attribute
      http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/cf-conventions.html#cell-methods
      
      cell_methods values and description:
@@ -255,19 +255,21 @@ nco_cnv_cf_cll_mth_add               /* [fnc] Add cell_methods attributes */
      
      NCO operation types:
      avg Mean value
-     sqravg Square of the mean
      avgsqr Mean of sum of squares
      mabs Maximum absolute value
      max Maximum value
+     mebs Mean absolute value
+     mibs Minimum absolute value
      min Minimum value
      rms Root-mean-square (normalized by N)
      rmssdn Root-mean square (normalized by N-1)
+     sqravg Square of the mean
      sqrt Square root of the mean
      ttl Sum of values */
 
   const char fnc_nm[]="nco_cnv_cf_cll_mth_add()"; /* [sng] Function name */
 
-  aed_sct aed; /* [sct] Structure containing information necessary to edit */
+  aed_sct aed; /* [sct] Attribute-edit information */
 
   char att_op_sng[23]; /* [sng] Operation type (longest is nco_op_mabs which translates to "maximum_absolute_value") */
 
@@ -291,6 +293,8 @@ nco_cnv_cf_cll_mth_add               /* [fnc] Add cell_methods attributes */
   
   nc_type att_typ; /* [nbr] Attribute type */
 
+  nco_bool FIRST_WARNING=True;
+  nco_bool flg_dpl; /* [flg] New cell_methods attribute duplicates old */
   nco_bool mlt_dmn_rdc; /* [flg] Multiple dimension reduction flag */
 
   size_t dmn_sng_lng; /* [nbr] Length of dimension string */
@@ -328,6 +332,7 @@ nco_cnv_cf_cll_mth_add               /* [fnc] Add cell_methods attributes */
     aed.id=var_out_id;
     aed.sz=0L;
     dmn_nbr_mch=0;
+    flg_dpl=False;
 
     /* cell_methods format: blank-separated phrases of form "dmn1[, dmn2[...]]: op_typ" */ 
     for(dmn_idx_var=0;dmn_idx_var<var_trv->nbr_dmn;dmn_idx_var++){
@@ -342,7 +347,7 @@ nco_cnv_cf_cll_mth_add               /* [fnc] Add cell_methods attributes */
       } /* dmn_idx_rdc */
     } /* dmn_idx_var */
 
-    assert(dmn_nbr_mch != 0);
+    assert(dmn_nbr_mch > 0);
 
     /* Preserve rule to always return averages (never extrema or other statistics) of coordinates */
     if(var[var_idx]->is_crd_var) nco_op_typ_lcl=nco_op_avg; else nco_op_typ_lcl=nco_op_typ;
@@ -385,29 +390,62 @@ nco_cnv_cf_cll_mth_add               /* [fnc] Add cell_methods attributes */
     (void)strcat(aed.val.cp,": ");
     (void)strcat(aed.val.cp,att_op_sng);
 
+    /* 20150625: Older versions of CAM, e.g., CAM3, used "cell_method" instead of "cell_methods" 
+       If old attribute is not deleted then the output file will contain both attributes
+       Does variable already have "cell_method" attribute? */
+    strcpy(aed.att_nm,"cell_method");
+    rcd=nco_inq_att_flg(grp_out_id,var_out_id,aed.att_nm,&att_typ,&att_lng);
+    if(rcd == NC_NOERR){
+      if(FIRST_WARNING) (void)fprintf(stderr,"%s: WARNING: Variable \"%s\" uses the non-standard attribute name \"cell_method\" instead of \"cell_methods\", the correct attribute name. The CAM3 model (and others?) have this problem. Expect \"double attributes\" in output. This message is printed only once per invocation, although the problem likely occurs in more variables.\n",nco_prg_nm_get(),aed.var_nm);
+      FIRST_WARNING=False;
+    } /* endif attribute exists */
+
     /* Does variable already have "cell_methods" attribute? */
     strcpy(aed.att_nm,"cell_methods");
-    rcd=nco_inq_att_flg(grp_out_id,var_out_id,aed.att_nm,&att_typ,(long *)NULL);
+    rcd=nco_inq_att_flg(grp_out_id,var_out_id,aed.att_nm,&att_typ,&att_lng);
     if(rcd == NC_NOERR){
-      aed.mode=aed_append;
       if(att_typ == NC_STRING) (void)fprintf(stderr,"%s: WARNING %s reports existing cell_methods attribute for variable %s is type NC_STRING. Unpredictable results...\n",nco_prg_nm_get(),fnc_nm,aed.var_nm);
       if(att_typ != NC_STRING && att_typ != NC_CHAR) (void)fprintf(stderr,"%s: WARNING %s reports existing cell_methods attribute for variable %s is type %s. Unpredictable results...\n",nco_prg_nm_get(),fnc_nm,aed.var_nm,nco_typ_sng(att_typ));
+
+      /* 20150625: Often climatologies are multiply-averaged over time
+	 For example, climate model output is often archived as monthly means in each gridcell
+	 The cell_methods attribute of these monthly data begin as "time: mean" (i.e., monthly mean).
+	 We then create a climatology by a sequence of one or two more temporal-averaging steps
+	 The one-step method puts all the months in the hopper and averages those
+	 Variables in the resultiing file may have cell_methods = "time: mean time: mean"
+	 The two-step method first averages the months into four climatological seasons
+	 Then it averages those four seasons into the climatological annual mean
+	 Variables in the resultiing file may have cell_methods = "time: mean time: mean time: mean"
+	 To avoid this redundancy, we check that the new cell_method does not duplicate the old 
+	 If it would, then skip adding the new */
+      ptr_unn val_old; /* [sng] Old cell_methods attribute */
+      val_old.vp=(void *)nco_malloc((att_lng+1L)*sizeof(char));
+      (void)nco_get_att(grp_out_id,var_out_id,aed.att_nm,val_old.vp,NC_CHAR);
+      val_old.cp[att_lng]='\0';
+      if(strstr(val_old.cp,aed.val.cp)) flg_dpl=True;
+      if(val_old.vp) val_old.vp=(void *)nco_free(val_old.vp);
+      
+      aed.mode=aed_append;
       /* Insert space between existing attribute and appended attribute */
       att_val_cpy=(char *)strdup(aed.val.cp);
-      aed.val.cp=(char *)nco_realloc(aed.val.cp,(++aed.sz)*sizeof(char));
+      /* Add one for space character */
+      aed.sz++;
+      /* Add one for NUL-terminator */
+      aed.val.cp=(char *)nco_realloc(aed.val.cp,(aed.sz+1L)*sizeof(char));
       aed.val.cp[0]=' ';
       aed.val.cp[1]='\0';
-      (void)strcat(aed.val.cp,att_val_cpy);
+      (void)strncat(aed.val.cp,att_val_cpy,aed.sz-1L);
       if(att_val_cpy) att_val_cpy=(char *)nco_free(att_val_cpy);
     }else{
       aed.mode=aed_create;
     } /* endif attribute exists */
 
     /* Edit attribute */
-    (void)nco_aed_prc(grp_out_id,var_out_id,aed);
+    if(!flg_dpl) (void)nco_aed_prc(grp_out_id,var_out_id,aed);
 
     /* 20150308 */
-    /* Does variable already have "coordinates" attribute? */
+    /* Does variable already have "coordinates" attribute?
+       NB: This reuses att_nm which has only enough space to hold "cell_methods" */
     strcpy(aed.att_nm,"coordinates");
     rcd=nco_inq_att_flg(grp_out_id,var_out_id,aed.att_nm,&att_typ,&att_lng);
     if(rcd == NC_NOERR && att_typ == NC_CHAR){
diff --git a/src/nco/nco_ctl.c b/src/nco/nco_ctl.c
index fbd530e..23f1a59 100644
--- a/src/nco/nco_ctl.c
+++ b/src/nco/nco_ctl.c
@@ -27,8 +27,13 @@ nco_cmp_get(void) /* [fnc] Return compiler and version */
 #if defined(__GNUC__) && !defined(__clang) && !defined(__INTEL_COMPILER) && !defined(__PATHCC__) && !defined(PGI_CC)
   /* Testing for GCC macros early is dangerous because some compilers, 
      including Intel's, define GCC macros for compatibility */
+#if defined(__GNUG__)
   static const char cmp_nm[]="gcc"; /* [sng] Compiler name */
+  static const char cmp_sng[]="Token __GNUG__ defined in nco_cmp_get(). Compiled with GNU g++ (or a compiler that emulates g++)."; /* [sng] Compiler string */
+#else /* !__GNUG__ */
+  static const char cmp_nm[]="g++"; /* [sng] Compiler name */
   static const char cmp_sng[]="Token __GNUC__ defined in nco_cmp_get(). Compiled with GNU gcc (or a compiler that emulates gcc)."; /* [sng] Compiler string */
+#endif /* !__GNUG__ */
   static const char cmp_vrs[]=TKN2SNG(__VERSION__); // [sng] Compiler version
   static const char cmp_vrs_mjr[]=TKN2SNG(__GNUC__); // [sng] Compiler major version
   static const char cmp_vrs_mnr[]=TKN2SNG(__GNUC_MINOR__); // [sng] Compiler minor version
@@ -521,6 +526,36 @@ nco_exit_gracefully(void) /* [fnc] Clean up timers, file descriptors, memory, th
   nco_exit(EXIT_SUCCESS);
 } /* end nco_exit_gracefully() */
 
+void
+nco_exit_lbr_rcd(void) /* [fnc] Exit with netCDF library version as return code */
+{
+  /* Purpose: Exit with status equaling a numeric code determined by netCDF library version
+     Exit status must be 0-255
+     Modern netCDF versions range from 300-440
+     Hence program returns netCDF version minus an offset of 300 so version 4.4.0 exit()s with $?=140
+     Usage: ncks --lbr_rcd
+     Verify exit status with "echo $?" */
+  char lbr_sng[NC_MAX_NAME+1];
+
+  int rcd=360;
+#if defined(ENABLE_NETCDF4) && defined(HAVE_NETCDF4_H)
+  strcpy(lbr_sng,nc_inq_libvers());
+  rcd=400;
+  /* Detect buggy netCDF version 4.1 so that workarounds may be implemented
+     Other versions used to enable version-specific regression tests in NCO_rgr.pm */
+  if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '1'){rcd=410;}
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '0' ){rcd=430;}
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '1' ){rcd=431;}
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '2' ){rcd=432;}
+  /* NB: Same return values for 4.3.3 and 4.3.3.1. Few people installed 4.3.3, most installed 4.3.3.1. */
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '3' ){rcd=433;}
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '4' && lbr_sng[3] == '.' && lbr_sng[4] == '0' ){rcd=440;}
+#endif /* HAVE_NETCDF4_H */
+  /* exit() with custom rcd for use by Perl regression tester nco_bm.pl/NCO_rgr.pm */
+  rcd-=300;
+  exit(rcd);
+} /* end nco_exit_lbr_rcd() */
+
 nco_bool /* [flg] Program is multi-file operator */
 nco_is_mfo /* [fnc] Query whether program is multi-file operator */
 (const int nco_prg_id) /* [enm] Program ID */
@@ -808,7 +843,7 @@ nco_nmn_get(void) /* [fnc] Return mnemonic that describes current NCO version */
 { 
   /* Purpose: Return mnemonic describing current NCO version
      Always Include terminal \n so mnemonic does not dangle */
-  return "Even Keel\n";
+  return "D/F#\n";
 } /* end nco_nmn_get() */
 
 char * /* O [sng] nm_in stripped of any path (i.e., program name stub) */ 
diff --git a/src/nco/nco_ctl.h b/src/nco/nco_ctl.h
index bbf0d3d..9cd6319 100644
--- a/src/nco/nco_ctl.h
+++ b/src/nco/nco_ctl.h
@@ -53,6 +53,9 @@ nco_exit /* [fnc] Wrapper for exit() */
 void 
 nco_exit_gracefully(void); /* [fnc] Clean up timers, file descriptors, memory, then exit */
 
+void
+nco_exit_lbr_rcd(void); /* [fnc] Exit with netCDF library version as return code */
+
 nco_bool /* [flg] Program does arithmetic */
 nco_is_rth_opr /* [fnc] Query whether program does arithmetic */
 (const int nco_prg_id); /* [enm] Program ID */
diff --git a/src/nco/nco_grp_trv.c b/src/nco/nco_grp_trv.c
index b3a1676..e7f4d29 100644
--- a/src/nco/nco_grp_trv.c
+++ b/src/nco/nco_grp_trv.c
@@ -306,7 +306,9 @@ trv_tbl_var_nm_fll                    /* [fnc] Return variable object from full
   if(trv_obj && trv_obj->nco_typ == nco_obj_typ_var) return trv_obj; else return NULL;
 #else /* !NCO_HSH_TRV_OBJ */
   for(unsigned idx_tbl=0;idx_tbl<trv_tbl->nbr;idx_tbl++)
-    if(trv_tbl->lst[idx_tbl].nco_typ == nco_obj_typ_var && !strcmp(var_nm_fll,trv_tbl->lst[idx_tbl].nm_fll)) return &trv_tbl->lst[idx_tbl];
+    if(trv_tbl->lst[idx_tbl].nco_typ == nco_obj_typ_var)
+      if(!strcmp(var_nm_fll,trv_tbl->lst[idx_tbl].nm_fll))
+	return &trv_tbl->lst[idx_tbl];
 
   return NULL;
 #endif /* !NCO_HSH_TRV_OBJ */
diff --git a/src/nco/nco_grp_utl.c b/src/nco/nco_grp_utl.c
index d3a8e11..d905a30 100644
--- a/src/nco/nco_grp_utl.c
+++ b/src/nco/nco_grp_utl.c
@@ -454,15 +454,16 @@ nco_trv_rx_search /* [fnc] Search for pattern matches in traversal table */
   /* Avoid compiler warning of unused variables by using obj_typ and trv_tbl */
   if(trv_tbl->lst) trv_tbl->lst[0].nco_typ = obj_typ;
 #else /* NCO_HAVE_REGEX_FUNCTIONALITY */
-  char *sng2mch; /* [sng] String to match to regular expression */
+  const char fnc_nm[]="nco_trv_rx_search()"; /* [sng] Function name  */
   const char sls_chr='/'; /* [chr] Slash character */
+  char *sng2mch; /* [sng] String to match to regular expression */
 
   int err_id;
   int flg_cmp; /* Comparison flags */
   int flg_exe; /* Execution flages */
   
-  regmatch_t *result;
   regex_t *rx;
+  regmatch_t *result;
 
   size_t obj_idx;
   size_t rx_prn_sub_xpr_nbr;
@@ -493,7 +494,7 @@ nco_trv_rx_search /* [fnc] Search for pattern matches in traversal table */
     case REG_BADRPT: rx_err_sng="No preceding re for repetition op"; break;
     default: rx_err_sng="Invalid pattern"; break;  
     } /* end switch */
-    (void)fprintf(stdout,"%s: ERROR nco_trv_rx_search() error in regular expression \"%s\" %s\n",nco_prg_nm_get(),rx_sng,rx_err_sng); 
+    (void)fprintf(stdout,"%s: ERROR %s error in regular expression \"%s\" %s\n",nco_prg_nm_get(),fnc_nm,rx_sng,rx_err_sng); 
     nco_exit(EXIT_FAILURE);
   } /* end if err */
 
@@ -845,7 +846,7 @@ nco_xtr_mk                            /* [fnc] Check -v and -g input names and c
         } /* end loop over tbl_idx */
 
         if(!flg_usr_mch_obj && !EXCLUDE_INPUT_LIST){
-          (void)fprintf(stderr,"%s: ERROR %s reports user-supplied %s name or regular expression %s is not in and/or does not match contents of input file\n",nco_prg_nm_get(),fnc_nm,(obj_typ == nco_obj_typ_grp) ? "group" : "variable",usr_sng);
+          (void)fprintf(stderr,"%s: ERROR %s reports user-supplied %s name or regular expression \'%s\' is not in and/or does not match contents of input file\n",nco_prg_nm_get(),fnc_nm,(obj_typ == nco_obj_typ_grp) ? "group" : "variable",usr_sng);
           nco_exit(EXIT_FAILURE);
         } /* flg_usr_mch_obj */
         /* Free dynamic memory */
@@ -1331,7 +1332,7 @@ nco_xtr_crd_ass_add                   /* [fnc] Add to extraction list all coordi
                 /* Mark it for extraction */
                 (void)trv_tbl_mrk_xtr(dmn_nm_fll,True,trv_tbl);
 
-                /* Subsetting should exclude ancestor with lower scope (closer to root) coordinates, add only the most in scope (usually in same group) */
+                /* Subsetting should exclude ancestor with lower scope (closer to root) coordinates, add only the most in-scopee (usually in same group) */
                 break;
               } /* If variable is on list, mark it for extraction */
 
@@ -1360,32 +1361,8 @@ nco_xtr_crd_ass_add                   /* [fnc] Add to extraction list all coordi
   } /* Loop table */
 
   return;
-
 } /* end nco_xtr_crd_ass_cdf_add */
 
-void
-nco_get_prg_info(void) /* [fnc] Get program info */
-{
-  /* Purpose: Return numeric code depending on netCDF library version */
-  char lbr_sng[NC_MAX_NAME+1];
-
-  int rcd=3;
-  strcpy(lbr_sng,nc_inq_libvers());
-#if defined(ENABLE_NETCDF4) && defined(HAVE_NETCDF4_H)
-  rcd=400;
-  /* Detect buggy netCDF version 4.1 so that workarounds may be implemented
-     Other versions used to enable version-specific regression tests in NCO_rgr.pm */
-  if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '1'){rcd=410;}
-  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '0' ){rcd=430;}
-  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '1' ){rcd=431;}
-  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '2' ){rcd=432;}
-  /* NB: Same return values for 4.3.3 and 4.3.3.1 */
-  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '3' ){rcd=433;}
-  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '3' && lbr_sng[3] == '.' && lbr_sng[4] == '4' ){rcd=434;}
-#endif /* HAVE_NETCDF4_H */
-  exit(rcd);
-} /* end nco_get_prg_info() */
-
 void 
 nco_xtr_lst_prn /* [fnc] Print name-ID structure list */
 (nm_id_sct * const nm_id_lst, /* I [sct] Name-ID structure list */
@@ -2099,7 +2076,7 @@ nco_grp_itr                            /* [fnc] Populate traversal table by exam
  trv_tbl_sct * const trv_tbl)          /* I/O [sct] GTT (Group Traversal Table) */
 {
   /* Purpose: Populate traversal table by examining, recursively, subgroups of parent */
-
+  const char fnc_nm[]="nco_grp_itr()"; /* [sng] Function name */
   const char sls_sng[]="/";        /* [sng] Slash string */
 
   char grp_nm[NC_MAX_NAME+1];      /* [sng] Group name */
@@ -2161,7 +2138,7 @@ nco_grp_itr                            /* [fnc] Populate traversal table by exam
   sls_psn=grp_nm_fll;
   if(!strcmp(grp_nm_fll,sls_sng)) grp_dpt=0; else grp_dpt=1;
   while((sls_psn=strchr(sls_psn+1,'/'))) grp_dpt++;
-  if(nco_dbg_lvl_get() == nco_dbg_crr) (void)fprintf(stderr,"%s: INFO Group %s is at level %d\n",nco_prg_nm_get(),grp_nm_fll,grp_dpt);
+  if(nco_dbg_lvl_get() >= nco_dbg_io) (void)fprintf(stderr,"%s: INFO %s found group %s at level %d\n",nco_prg_nm_get(),fnc_nm,grp_nm_fll,grp_dpt);
 
   /* Keep the old table objects size for insertion */
   unsigned int idx;
@@ -2211,7 +2188,7 @@ nco_grp_itr                            /* [fnc] Populate traversal table by exam
   trv_tbl->lst[idx].ppc=NC_MAX_INT;               /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
   trv_tbl->lst[idx].flg_nsd=True;                 /* [flg] PPC is NSD */
 
-  trv_tbl->lst[idx].is_crd_var=nco_obj_typ_err;   /* [flg] (For variables only) Is this a coordinate variable? (unique dimension exists in scope) */
+  trv_tbl->lst[idx].is_crd_var=nco_obj_typ_err;   /* [flg] (For variables only) Is this a coordinate variable? (unique dimension exists in-scope) */
   trv_tbl->lst[idx].is_rec_var=nco_obj_typ_err;   /* [flg] (For variables only) Is a record variable? (is_crd_var must be True) */
   trv_tbl->lst[idx].var_typ=(nc_type)nco_obj_typ_err;/* [enm] (For variables only) NetCDF type  */  
   trv_tbl->lst[idx].enm_prc_typ=err_typ;          /* [enm] (For variables only) Processing type enumerator  */  
@@ -2478,7 +2455,7 @@ nco_bld_crd_rec_var_trv /* [fnc] Build dimension information for all variables *
 (const trv_tbl_sct * const trv_tbl) /* I [sct] GTT (Group Traversal Table) */
 {
   /* Purpose: Build "is_crd_var" and "is_rec_var" members for all variables */
-  const char fnc_nm[]="nco_blb_crd_var_trv()"; /* [sng] Function name */
+  const char fnc_nm[]="nco_bld_crd_var_trv()"; /* [sng] Function name */
 
   /* Loop all objects */
   for(unsigned idx_var=0;idx_var<trv_tbl->nbr;idx_var++){
@@ -2491,9 +2468,9 @@ nco_bld_crd_rec_var_trv /* [fnc] Build dimension information for all variables *
       for(unsigned idx_dmn=0;idx_dmn<trv_tbl->nbr_dmn;idx_dmn++){
         dmn_trv_sct dmn_trv=trv_tbl->lst_dmn[idx_dmn]; 
 
-        /* Is there a variable with this dimension name anywhere? (relative name)  */
+        /* Is there a variable with this dimension name anywhere? (relative name) */
         if(!strcmp(dmn_trv.nm,var_trv.nm)){
-          /* Is variable in scope of dimension ? */
+          /* Is variable in-scope of dimension? */
           if(nco_crd_var_dmn_scp(&var_trv,&dmn_trv,trv_tbl)){
             /* Mark this variable as coordinate variable. NB: True coordinate variables are 1D */
             if(var_trv.nbr_dmn == 1) trv_tbl->lst[idx_var].is_crd_var=True; else trv_tbl->lst[idx_var].is_crd_var=False;
@@ -2506,21 +2483,21 @@ nco_bld_crd_rec_var_trv /* [fnc] Build dimension information for all variables *
             } /* endif dbg */
             /* Go to next variable */
             break;
-          }/* Is variable in scope of dimension ? */
-        } /* Is there a variable with this dimension name anywhere? (relative name)  */
+          } /* Is variable in-scope of dimension? */
+        } /* Is there a variable with this dimension name anywhere? (relative name) */
       } /* Loop unique dimensions list in groups */
     } /* Interested in variables only */
   } /* Loop all variables */
 
-} /* nco_blb_crd_var_trv() */
+} /* nco_bld_crd_rec_var_trv() */
 
 void                      
-nco_bld_crd_var_trv                   /* [fnc] Build GTT "crd_sct" coordinate variable structure */
-(trv_tbl_sct * const trv_tbl)         /* I/O [sct] GTT (Group Traversal Table) */
+nco_bld_crd_var_trv /* [fnc] Build GTT "crd_sct" coordinate variable structure */
+(trv_tbl_sct * const trv_tbl) /* I/O [sct] GTT (Group Traversal Table) */
 {
   /* Purpose: Build GTT "crd_sct" coordinate variable structure */
 
-  const char fnc_nm[]="nco_blb_crd_var_trv()"; /* [sng] Function name */
+  const char fnc_nm[]="nco_bld_crd_var_trv()"; /* [sng] Function name */
 
   /* Step 1) Find the total number of coordinate variables for every dimension */
 
@@ -2536,15 +2513,15 @@ nco_bld_crd_var_trv                   /* [fnc] Build GTT "crd_sct" coordinate va
       if(var_trv.nco_typ == nco_obj_typ_var){
 
         /* Is there a variable with this dimension name anywhere? (relative name)  */
-        if(strcmp(dmn_trv.nm,var_trv.nm) == 0 ){
+        if(!strcmp(dmn_trv.nm,var_trv.nm)){
 
-          /* Is variable in scope of dimension ? */
+          /* Is variable in-scope of dimension ? */
           if(nco_crd_var_dmn_scp(&var_trv,&dmn_trv,trv_tbl)){
 
             /* Increment the number of coordinate variables for this dimension */
             trv_tbl->lst_dmn[idx_dmn].crd_nbr++;
 
-          }/* Is variable in scope of dimension ? */
+          } /* Is variable in-scope of dimension ? */
         } /* Is there a variable with this dimension name anywhere? (relative name)  */
       } /* Interested in variables only */
     } /* Loop all objects */
@@ -2581,13 +2558,13 @@ nco_bld_crd_var_trv                   /* [fnc] Build GTT "crd_sct" coordinate va
         /* Is there a variable with this dimension name anywhere? (relative name)  */
         if(strcmp(dmn_trv.nm,var_trv.nm) == 0 ){
 
-          /* Is variable in scope of dimension ? */
+          /* Is variable in-scope of dimension ? */
           if(nco_crd_var_dmn_scp(&var_trv,&dmn_trv,trv_tbl)){
 
             /* Alloc this coordinate */
             trv_tbl->lst_dmn[idx_dmn].crd[crd_idx]=(crd_sct *)nco_malloc(sizeof(crd_sct));
 
-            /* The coordinate full name is the variable full name found in scope */
+            /* The coordinate full name is the variable full name found in-scope */
             trv_tbl->lst_dmn[idx_dmn].crd[crd_idx]->crd_nm_fll=strdup(var_trv.nm_fll);
 
             /* The coordinate dimension full name is the dimension full name */
@@ -2631,21 +2608,17 @@ nco_bld_crd_var_trv                   /* [fnc] Build GTT "crd_sct" coordinate va
             if(nco_dbg_lvl_get() == nco_dbg_old){     
               crd_sct *crd=trv_tbl->lst_dmn[idx_dmn].crd[crd_idx];
               (void)fprintf(stdout,"%s: INFO %s variable <%s> has coordinate <%s> from dimension <%s>\n",nco_prg_nm_get(),fnc_nm,var_trv.nm_fll,crd->crd_nm_fll,crd->dmn_nm_fll);
-            }
+            } /* endif */
 
-            /* Limits are initialized in build limits function */
-        
-            /* Incrementr coordinate index for current dimension */
+            /* Increment coordinate index for current dimension */
             crd_idx++;
 
-          }/* Is variable in scope of dimension ? */
+          } /* Is variable in-scope of dimension ? */
         } /* Is there a variable with this dimension name anywhere? (relative name)  */
       } /* Interested in variables only */
     } /* Loop all objects */
   } /* Loop unique dimensions list in groups */
-
-} /* nco_blb_crd_var_trv() */
-
+} /* nco_bld_crd_var_trv() */
 
 static void
 prt_lmt                             /* [fnc] Print limit  */
@@ -2655,8 +2628,6 @@ prt_lmt                             /* [fnc] Print limit  */
   (void)fprintf(stdout," LIMIT[%d]%s(%li,%li,%li) ",lmt_idx,lmt->nm,lmt->srt,lmt->cnt,lmt->srd);
 } /* prt_lmt() */
 
-
-
 void                          
 nco_prn_trv_tbl                      /* [fnc] Print GTT (Group Traversal Table) */
 (const int nc_id,                    /* I [ID] File ID */
@@ -2690,59 +2661,38 @@ nco_prn_trv_tbl                      /* [fnc] Print GTT (Group Traversal Table)
   (void)fprintf(stdout,"\n");
   (void)fprintf(stdout,"%s: INFO reports variable information\n",nco_prg_nm_get());
   for(unsigned idx_var=0;idx_var<trv_tbl->nbr;idx_var++){
-
     trv_sct var_trv=trv_tbl->lst[idx_var];   
-
-    /* Filter variables  */
     if(var_trv.nco_typ == nco_obj_typ_var){
-
       (void)fprintf(stdout,"%s:",var_trv.nm_fll);
-
-      /* Filter output */
       if(var_trv.is_crd_var){
         (void)fprintf(stdout," (coordinate)");
         nbr_crd++;
       } /* endif */
-
-      /* Filter output */
       if(var_trv.is_rec_var) (void)fprintf(stdout," (record)");
 
       /* If record variable must be coordinate variable */
       if(var_trv.is_rec_var) assert(var_trv.is_crd_var);
-
       (void)fprintf(stdout," %d dimensions: ",var_trv.nbr_dmn); 
 
-      /* Dimensions */
       for(int idx_dmn_var=0;idx_dmn_var<var_trv.nbr_dmn;idx_dmn_var++){
-
         var_dmn_sct var_dmn=var_trv.var_dmn[idx_dmn_var];
-
         (void)fprintf(stdout,"[%d]%s#%d ",idx_dmn_var,var_dmn.dmn_nm_fll,var_dmn.dmn_id); 
-        /* Filter output */
         if(var_dmn.is_crd_var) (void)fprintf(stdout," (coordinate) : ");
 
-        /*  The limits have to be separated to */
-
-        /* a) case where the dimension has coordinate variables */
+        /*  Segregate limits into two cases */
         if(var_dmn.crd){
-
+	  /* Dimension has coordinate variables */
           for(int lmt_idx=0;lmt_idx<var_dmn.crd->lmt_msa.lmt_dmn_nbr;lmt_idx++)
             (void)prt_lmt(lmt_idx,var_dmn.crd->lmt_msa.lmt_dmn[lmt_idx]);
-
-          /* ! case where the dimension has coordinate variables */
         }else{
-
+          /* Dimension has no coordinate variables */
           for(int lmt_idx=0;lmt_idx<var_dmn.ncd->lmt_msa.lmt_dmn_nbr;lmt_idx++)
             (void)prt_lmt(lmt_idx,var_dmn.ncd->lmt_msa.lmt_dmn[lmt_idx]);
-
-        } /* ! case where the dimension has coordinate variables */
-      } /* Dimensions */
-
-      /* End this variable */
+        } /* !crd */
+      } /* !dmn */
       (void)fprintf(stdout,"\n");
-
-    } /* Filter variables  */
-  } /* Variables */
+    } /* !var  */
+  } /* !var */
 
   /* Unique dimension list, Coordinate variables stored in unique dimension list, limits */
   nbr_crd_var=0;
@@ -2814,22 +2764,22 @@ nco_has_crd_dmn_scp /* [fnc] Is there a variable with same name in dimension's s
         /* Is there a variable with this dimension name (a coordinate varible) anywhere (relative name)  */
         if(!strcmp(dmn_trv.nm,var_trv.nm)){
 
-          /* Is variable in scope of dimension ? */
+          /* Is variable in-scope of dimension ? */
           if(nco_crd_var_dmn_scp(&var_trv,&dmn_trv,trv_tbl)){
 
-            if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s reports variable <%s> in scope of dimension <%s>\n",nco_prg_nm_get(),fnc_nm,var_trv.nm_fll,dmn_trv.nm_fll);
+            if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s reports variable <%s> in-scope of dimension <%s>\n",nco_prg_nm_get(),fnc_nm,var_trv.nm_fll,dmn_trv.nm_fll);
 
             trv_tbl->lst_dmn[idx_dmn].has_crd_scp=True;
             /* Built before; variable must be a cordinate */
             assert(var_trv.is_crd_var);
             in_scp=True;
-          } /* Is variable in scope of dimension ? */
+          } /* Is variable in-scope of dimension ? */
         } /* Is there a variable with this dimension name anywhere? (relative name)  */
       } /* Filter variables  */
     } /* Loop object table */
 
     if(nco_dbg_lvl_get() == nco_dbg_old)
-      if(!in_scp) (void)fprintf(stdout,"%s: INFO %s dimension <%s> with no in scope variables\n",nco_prg_nm_get(),fnc_nm,dmn_trv.nm_fll);        
+      if(!in_scp) (void)fprintf(stdout,"%s: INFO %s dimension <%s> with no in-scope variables\n",nco_prg_nm_get(),fnc_nm,dmn_trv.nm_fll);        
 
     trv_tbl->lst_dmn[idx_dmn].has_crd_scp=in_scp;
   } /* Unique dimension list */
@@ -2839,17 +2789,17 @@ nco_has_crd_dmn_scp /* [fnc] Is there a variable with same name in dimension's s
 
 } /* nco_has_crd_dmn_scp() */
 
-nco_bool                               /* O [flg] True if variable is in scope of dimension */
+nco_bool                               /* O [flg] True if variable is in-scope of dimension */
 nco_crd_var_dmn_scp                    /* [fnc] Is coordinate variable in dimension scope */
 (const trv_sct * const var_trv,        /* I [sct] GTT Object Variable */
  const dmn_trv_sct * const dmn_trv,    /* I [sct] GTT unique dimension */
  const trv_tbl_sct * const trv_tbl)    /* I [sct] GTT (Group Traversal Table) */
 {
-  /* Purpose: Find if variable is in scope of the dimension: 
-     Use case in scope:
+  /* Purpose: Find if variable is in-scope of the dimension: 
+     Use case in-scope:
      dimension /lon 
      variable /g1/lon
-     Use case not in scope:
+     Use case not in-scope:
      variable /lon
      dimension /g1/lon
      
@@ -2877,16 +2827,12 @@ nco_crd_var_dmn_scp                    /* [fnc] Is coordinate variable in dimens
   }
   
   /* Most common case is for the unique dimension full name to match the full variable name   */
-  if(strcmp(var_trv->nm_fll,dmn_trv->nm_fll) == 0){
-    if(nco_dbg_lvl_get() == nco_dbg_old){
-      (void)fprintf(stdout,"%s: INFO %s found absolute match of variable <%s> and dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,
-		    var_trv->nm_fll,dmn_trv->nm_fll);
-    }
+  if(!strcmp(var_trv->nm_fll,dmn_trv->nm_fll)){
+    if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s found absolute match of variable <%s> and dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,var_trv->nm_fll,dmn_trv->nm_fll);
     return True;
   }
   
-  /* Deal with in scope cases */
-  
+  /* Deal with in-scope cases */
   var_nm_fll_lng=strlen(var_trv->nm_fll);
   dmn_nm_fll_lng=strlen(dmn_trv->nm_fll);
   var_sng_lng=strlen(var_trv->nm);
@@ -2897,41 +2843,30 @@ nco_crd_var_dmn_scp                    /* [fnc] Is coordinate variable in dimens
     /* Ensure match spans (begins and ends on) whole path-component boundaries */
     
     /* Does match begin at path component boundary ... directly on a slash? */
-    if(*sbs_srt == sls_chr){
-      flg_pth_srt_bnd=True;
-    }
+    if(*sbs_srt == sls_chr) flg_pth_srt_bnd=True;
     
     /* ...or one after a component boundary? */
-    if((sbs_srt > dmn_trv->nm_fll) && (*(sbs_srt-1L) == sls_chr)){
-      flg_pth_srt_bnd=True;
-    }
+    if((sbs_srt > dmn_trv->nm_fll) && (*(sbs_srt-1L) == sls_chr)) flg_pth_srt_bnd=True;
     
     /* Does match end at path component boundary ... directly on a slash? */
     sbs_end=sbs_srt+var_sng_lng-1L;
     
-    if(*sbs_end == sls_chr){
-      flg_pth_end_bnd=True;
-    }
+    if(*sbs_end == sls_chr) flg_pth_end_bnd=True;
     
     /* ...or one before a component boundary? */
-    if(sbs_end <= dmn_trv->nm_fll+dmn_nm_fll_lng-1L){
-      if((*(sbs_end+1L) == sls_chr) || (*(sbs_end+1L) == '\0')){
+    if(sbs_end <= dmn_trv->nm_fll+dmn_nm_fll_lng-1L)
+      if((*(sbs_end+1L) == sls_chr) || (*(sbs_end+1L) == '\0'))
         flg_pth_end_bnd=True;
-      }
-    }
     
     /* If match is on both ends of '/' then it's a "real" name, not for example "lat_lon" as a variable looking for "lon" */
     if(flg_pth_srt_bnd && flg_pth_end_bnd){
       
       /* Absolute match (equality redundant); strcmp deals cases like /g3/rlev/ and /g5/rlev  */
       if(var_nm_fll_lng == dmn_nm_fll_lng && strcmp(var_trv->nm_fll,dmn_trv->nm_fll) == 0){
-        if(nco_dbg_lvl_get() == nco_dbg_old){
-          (void)fprintf(stdout,"%s: INFO %s found absolute match of variable <%s> and dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,
-			var_trv->nm_fll,dmn_trv->nm_fll);
-        }
+        if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s found absolute match of variable <%s> and dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,var_trv->nm_fll,dmn_trv->nm_fll);
         return True;
 	
-        /* Variable in scope of dimension */
+        /* Variable in-scope of dimension */
       }else if(var_nm_fll_lng>dmn_nm_fll_lng){
 	
         /* NOTE: deal with cases like
@@ -2956,18 +2891,12 @@ nco_crd_var_dmn_scp                    /* [fnc] Is coordinate variable in dimens
           } /* Loop all objects */
         } /* Loop unique dimensions list in groups */
 
-        if(nco_dbg_lvl_get() == nco_dbg_old){
-          (void)fprintf(stdout,"%s: INFO %s found variable <%s> in scope of dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,
-            var_trv->nm_fll,dmn_trv->nm_fll);
-        }
+        if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s found variable <%s> in-scope of dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,var_trv->nm_fll,dmn_trv->nm_fll);
         return True;
 
         /* Variable out of scope of dimension */
       }else if(var_nm_fll_lng < dmn_nm_fll_lng){
-        if(nco_dbg_lvl_get() == nco_dbg_old){
-          (void)fprintf(stdout,"%s: INFO %s found variable <%s> out of scope of dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,
-            var_trv->nm_fll,dmn_trv->nm_fll);
-        }
+        if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s found variable <%s> out of scope of dimension <%s>:\n",nco_prg_nm_get(),fnc_nm,var_trv->nm_fll,dmn_trv->nm_fll);
         return False;
 
       } /* Absolute match  */
@@ -2995,7 +2924,7 @@ nco_cmp_crd_dpt /* [fnc] Compare two crd_sct's by group depth */
 } /* end nco_cmp_crd_dpt() */
 
 crd_sct *                             /* O [sct] Coordinate object */
-nco_scp_var_crd                       /* [fnc] Return in scope coordinate for variable  */
+nco_scp_var_crd                       /* [fnc] Return in-scope coordinate for variable  */
 (const trv_sct * const var_trv,       /* I [sct] Variable object */
  dmn_trv_sct * const dmn_trv)         /* I [sct] Dimension object */
 {
@@ -3010,7 +2939,7 @@ nco_scp_var_crd                       /* [fnc] Return in scope coordinate for va
      variable lon4_var(lon4)
      
      Variable /g16/g16g4/g16g4g4/g16g4g4g4/lon4_var
-     2 coordinates down in scope 
+     2 coordinates down in-scope 
      /g16/g16g4/g16g4g4/lon4
      /g16/g16g4/lon4 */
 
@@ -3021,17 +2950,17 @@ nco_scp_var_crd                       /* [fnc] Return in scope coordinate for va
   /* Loop over coordinates; they all have unique dimension ID of variable dimension */
   for(int crd_idx=0;crd_idx<dmn_trv->crd_nbr;crd_idx++){
     crd_sct *crd=dmn_trv->crd[crd_idx];
-    /* Absolute match: in scope */ 
+    /* Absolute match: in-scope */ 
     if(!strcmp(var_trv->nm_fll,crd->crd_nm_fll)){ 
       /* Variable must be coordinate for this to happen */
       assert(var_trv->is_crd_var);
       return crd;
     }else if(!strcmp(var_trv->grp_nm_fll,crd->crd_grp_nm_fll)){ 
-      /* Same group: in scope  */ 
+      /* Same group: in-scope  */ 
       return crd;
     }
     else if(crd->grp_dpt < var_trv->grp_dpt){
-      /* Level below: in scope  */
+      /* Level below: in-scope  */
       return crd;
     }
   } /* Loop coordinates */
@@ -3113,9 +3042,9 @@ nco_bld_var_dmn                       /* [fnc] Assign variables dimensions to ei
           /* Choose the "in-scope" coordinate for the variable and assign it to the variable dimension */
           crd=nco_scp_var_crd(&var_trv,dmn_trv);
 
-          /* The "in scope" coordinate is returned */
+          /* The "in-scope" coordinate is returned */
           if(crd){
-            if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s reports dimension [%d]%s of variable <%s> in scope of coordinate <%s>\n",nco_prg_nm_get(),fnc_nm,idx_dmn_var,var_trv.var_dmn[idx_dmn_var].dmn_nm_fll,var_trv.nm_fll,crd->crd_nm_fll);
+            if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s reports dimension [%d]%s of variable <%s> in-scope of coordinate <%s>\n",nco_prg_nm_get(),fnc_nm,idx_dmn_var,var_trv.var_dmn[idx_dmn_var].dmn_nm_fll,var_trv.nm_fll,crd->crd_nm_fll);
 	    
             /* Mark as True */
             trv_tbl->lst[idx_var].var_dmn[idx_dmn_var].is_crd_var=True;
@@ -3151,7 +3080,7 @@ nco_bld_var_dmn                       /* [fnc] Assign variables dimensions to ei
 
           }else{
 
-            if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s reports dimension [%d]%s of variable <%s> with out of scope coordinate\n",nco_prg_nm_get(),fnc_nm,idx_dmn_var,var_trv.var_dmn[idx_dmn_var].dmn_nm_fll,var_trv.nm_fll);         
+            if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"%s: INFO %s reports dimension [%d]%s of variable <%s> with out-of-scope coordinate\n",nco_prg_nm_get(),fnc_nm,idx_dmn_var,var_trv.var_dmn[idx_dmn_var].dmn_nm_fll,var_trv.nm_fll);         
 
             /* Mark as False */
             trv_tbl->lst[idx_var].var_dmn[idx_dmn_var].is_crd_var=False;
@@ -3182,7 +3111,7 @@ nco_bld_var_dmn                       /* [fnc] Assign variables dimensions to ei
             trv_tbl->lst[idx_var].var_dmn[idx_dmn_var].ncd->lmt_msa.MSA_USR_RDR=dmn_trv->lmt_msa.MSA_USR_RDR;
             trv_tbl->lst[idx_var].var_dmn[idx_dmn_var].ncd->lmt_msa.WRP=dmn_trv->lmt_msa.WRP;
 
-          } /* None was found in scope */
+          } /* None was found in-scope */
         } /* There are coordinates; one must be chosen */
       } /* Loop dimensions for object (variable)  */
     } /* Filter variables  */
@@ -3946,33 +3875,13 @@ nco_var_prc_fix_trv                    /* [fnc] Store processed and fixed variab
   /* Purpose: Store processed and fixed variables info into GTT */
 
   /* Store processed variables info into table */
-  for(int idx_var=0;idx_var<nbr_var_prc;idx_var++){
-    trv_sct *var_trv;
-
-    /* Obtain variable GTT object using full variable name */
-    var_trv=trv_tbl_var_nm_fll(var_prc[idx_var]->nm_fll,trv_tbl);
-
-    assert(var_trv);
-
-    /* Mark fixed/processed flag in table for "var_nm_fll" */
+  for(int idx_var=0;idx_var<nbr_var_prc;idx_var++)
     (void)trv_tbl_mrk_prc_fix(var_prc[idx_var]->nm_fll,prc_typ,trv_tbl);
 
-  } /* Store processed variables info into table */
-
   /* Store fixed variables info into table */
-  for(int idx_var=0;idx_var<nbr_var_fix;idx_var++){
-    trv_sct *var_trv;
-
-    /* Obtain variable GTT object using full variable name */
-    var_trv=trv_tbl_var_nm_fll(var_fix[idx_var]->nm_fll,trv_tbl);
-
-    assert(var_trv);
-
-    /* Mark fixed/processed flag in table for "var_nm_fll" */
+  for(int idx_var=0;idx_var<nbr_var_fix;idx_var++)
     (void)trv_tbl_mrk_prc_fix(var_fix[idx_var]->nm_fll,fix_typ,trv_tbl);
 
-  } /* Store fixed variables info into table */
-
   return;
 } /* end nco_var_prc_fix_trv() */
 
@@ -5005,7 +4914,7 @@ nco_dmn_rdr_trv                        /* [fnc] Transfer dimension structures to
 } /* end nco_dmn_rdr_trv() */
 
 void
-nco_var_dmn_rdr_mtd_trv               /* [fnc] Determine and set new dimensionality in metadata of each re-ordered variable (ncpdq) */
+nco_var_dmn_rdr_mtd_trv /* [fnc] Set new dimensionality in metadata of each re-ordered variable */
 (trv_tbl_sct * const trv_tbl,         /* I/O [sct] GTT (Group Traversal Table) */
  const int nbr_var_prc,               /* I [nbr] Number of processed variables */
  var_sct **var_prc,                   /* I/O [sct] Processed variables */
@@ -5016,31 +4925,25 @@ nco_var_dmn_rdr_mtd_trv               /* [fnc] Determine and set new dimensional
  const int dmn_rdr_nbr,               /* I [nbr] Number of dimension to re-order */
  const nco_bool *dmn_rvr_rdr)         /* I [flg] Reverse dimension */
 {
-  /* Purpose: Determine and set new dimensionality in metadata of each re-ordered variable */
-
-  /* Based in nco_var_dmn_rdr_mtd(). LIMITATION: the first record dimension for the object variable is used */
-
-  /* Test case : ncpdq -O -a lev,time -v two_dmn_rec_var in.nc out.nc */
-
-  /* Mark lev as record and un-mark time as record (by setting the record name as lev) */
-
-  char *rec_dmn_nm_out_crr;                  /* [sng] Name of record dimension, if any, required by re-order */
-  char *rec_dmn_nm_in;                       /* [sng] Record dimension name, original */
-  char *rec_dmn_nm_out;                      /* [sng] Record dimension name, re-ordered */
-
-  int dmn_idx_out_in[NC_MAX_DIMS];           /* [idx] Dimension correspondence, output->input  (Stored in GTT ) */
-  int nco_prg_id;                                /* [enm] Program ID */
-
-  nco_bool REDEFINED_RECORD_DIMENSION;       /* [flg] Re-defined record dimension */
-  nco_bool dmn_rvr_in[NC_MAX_DIMS];          /* [flg] Reverse dimension  (Stored in GTT ) */
-
-  nm_lst_sct *rec_dmn_nm;                    /* [sct] Record dimension names array */
+  /* Purpose: Determine and set new dimensionality in metadata of each re-ordered variable
+     Based in nco_var_dmn_rdr_mtd(). LIMITATION: the first record dimension for the object variable is used
+     Test case : ncpdq -O -a lev,time -v two_dmn_rec_var in.nc out.nc
+     Mark lev as record and un-mark time as record (by setting the record name as lev) */
+
+  char *rec_dmn_nm_out_crr; /* [sng] Name of record dimension, if any, required by re-order */
+  char *rec_dmn_nm_in; /* [sng] Record dimension name, original */
+  char *rec_dmn_nm_out; /* [sng] Record dimension name, re-ordered */
+  int dmn_idx_out_in[NC_MAX_DIMS]; /* [idx] Dimension correspondence, output->input  (Stored in GTT ) */
+  int nco_prg_id; /* [enm] Program ID */
+  nco_bool REDEFINED_RECORD_DIMENSION; /* [flg] Re-defined record dimension */
+  nco_bool dmn_rvr_in[NC_MAX_DIMS]; /* [flg] Reverse dimension  (Stored in GTT ) */
+  nm_lst_sct *rec_dmn_nm; /* [sct] Record dimension names array */
 
   /* Get Program ID */
   nco_prg_id=nco_prg_id_get(); 
-
   assert(nco_prg_id == ncpdq);
-
+  CEWI_unused(nco_prg_id);
+  
   /* Loop processed variables */
   for(int idx_var_prc=0;idx_var_prc<nbr_var_prc;idx_var_prc++){
 
@@ -5633,103 +5536,6 @@ nco_var_dmn_rdr_val_trv               /* [fnc] Change dimension ordering of vari
 } /* nco_var_dmn_rdr_val_trv() */
   
 void
-nco_aed_prc_trv                       /* [fnc] Process single attribute edit for single variable (GTT) */
-(const int nc_id,                     /* I [id] Input netCDF file ID */
- const aed_sct *aed_lst,              /* I [sct] Structure containing information necessary to edit */
- const int nbr_aed,                   /* I [nbr] Number of attribute structures */
- const trv_tbl_sct * const trv_tbl)   /* I [sct] GTT (Group Traversal Table) */
-{
-  int grp_id; /* [id] Group ID */
-  int var_id; /* [id] Variable ID */
-
-  /* Loop all attribure structure entries */
-  for(int idx_aed=0;idx_aed<nbr_aed;idx_aed++){
-
-    /* Variable name is blank so edit same attribute for all variables ... */
-
-    if(aed_lst[idx_aed].var_nm == NULL){
-
-      /* Loop table */
-      for(unsigned idx_tbl=0;idx_tbl<trv_tbl->nbr;idx_tbl++){
-        trv_sct var_trv=trv_tbl->lst[idx_tbl];
-        /* Filter variables */
-        if(var_trv.nco_typ == nco_obj_typ_var){
-          /* Obtain group ID */
-          (void)nco_inq_grp_full_ncid(nc_id,var_trv.grp_nm_fll,&grp_id);
-          /* Obtain variable ID */
-          (void)nco_inq_varid(grp_id,var_trv.nm,&var_id);
-          /* Edit attribute */
-          (void)nco_aed_prc(grp_id,var_id,aed_lst[idx_aed]);
-        } /* Filter variables */
-      } /* Loop table */
-
-    } /* End Variable name is blank so edit same attribute for all variables ... */
-
-    /* Variable name contains a "regular expression" (rx) ... */
-
-    else if(strpbrk(aed_lst[idx_aed].var_nm,".*^$\\[]()<>+?|{}")){
-
-      /* Loop table */
-      for(unsigned idx_tbl=0;idx_tbl<trv_tbl->nbr;idx_tbl++){
-        trv_sct var_trv=trv_tbl->lst[idx_tbl];
-        /* Filter variables */
-        if(var_trv.nco_typ == nco_obj_typ_var ){
-          /* Obtain group ID */
-          (void)nco_inq_grp_full_ncid(nc_id,var_trv.grp_nm_fll,&grp_id);
-          /* Obtain variable ID */
-          (void)nco_inq_varid(grp_id,var_trv.nm,&var_id);
-          /* Edit attribute */
-          (void)nco_aed_prc(grp_id,var_id,aed_lst[idx_aed]);
-        } /* Filter variables */
-      } /* Loop table */
-
-      /* End Variable name contains a "regular expression" (rx) ... */
-
-      /* Variable name indicates a global attribute ... */
-
-    }else if(!strcasecmp(aed_lst[idx_aed].var_nm,"global")){
-
-       /* Loop table */
-      for(unsigned idx_tbl=0;idx_tbl<trv_tbl->nbr;idx_tbl++){
-        trv_sct var_trv=trv_tbl->lst[idx_tbl];
-        /* Filter variables */
-        if(var_trv.nco_typ == nco_obj_typ_var && strcmp(aed_lst[idx_aed].var_nm,var_trv.nm) == 0){
-          /* Obtain group ID */
-          (void)nco_inq_grp_full_ncid(nc_id,var_trv.grp_nm_fll,&grp_id);
-          /* Obtain variable ID */
-          (void)nco_inq_varid(grp_id,var_trv.nm,&var_id);
-          /* Edit attribute */
-          (void)nco_aed_prc(grp_id,NC_GLOBAL,aed_lst[idx_aed]);
-        } /* Filter variables */
-      } /* Loop table */
-
-      /* End Variable name indicates a global attribute ... */
-
-    }else{ 
-      /* Variable is a normal variable ... */
-
-      /* Loop table */
-      for(unsigned idx_tbl=0;idx_tbl<trv_tbl->nbr;idx_tbl++){
-        trv_sct var_trv=trv_tbl->lst[idx_tbl];
-        /* Filter variables */
-        if(var_trv.nco_typ == nco_obj_typ_var && strcmp(aed_lst[idx_aed].var_nm,var_trv.nm) == 0){
-          /* Obtain group ID */
-          (void)nco_inq_grp_full_ncid(nc_id,var_trv.grp_nm_fll,&grp_id);
-          /* Obtain variable ID */
-          (void)nco_inq_varid(grp_id,var_trv.nm,&var_id);
-          /* Edit attribute */
-          (void)nco_aed_prc(grp_id,var_id,aed_lst[idx_aed]);
-        } /* Filter variables */
-      } /* Loop table */
-
-    }
-    /* End Variable is a normal variable ... */
-
-  } /* Loop all attribure structure entries */
-
-} /* nco_aed_prc_trv() */
-
-void
 nco_dmn_trv_msa_tbl                   /* [fnc] Update all GTT dimensions with hyperslabbed size */
 (const int nc_id,                     /* I [ID] netCDF input file ID */
  const char * const rec_dmn_nm,       /* I [sng] Record dimension name */
@@ -7262,20 +7068,18 @@ nco_var_get_wgt_trv                 /* [fnc] Retrieve weighting or mask variable
  const var_sct * const var,         /* I [sct] Variable that needs weight/mask */
  const trv_tbl_sct * const trv_tbl) /* I [lst] Traversal table */
 {
-  /* Purpose: Return weight or mask variable closest in scope to specified variable */
+  /* Purpose: Return weight or mask variable closest in-scope to specified variable */
 
-  int grp_id;        /* [ID] Group ID */
-  int var_id;        /* [ID] Variable ID */
-  int idx_wgt;       /* [nbr] Weight array counter */
-
-  /* Detect if the weight variable name is relative or absolute */
-
-  /* If first character is '/' then assume absolute path */
+  int grp_id; /* [ID] Group ID */
+  int var_id; /* [ID] Variable ID */
+  int idx_wgt; /* [nbr] Weight array counter */
+  var_sct *wgt_var;
 
+  /* If first character is '/' then weight name is absolute path */
   if(wgt_nm[0] == '/'){
     /* Absolute name given for weight. Straightforward extract and copy */
-    trv_sct *wgt_trv=trv_tbl_var_nm_fll(wgt_nm,trv_tbl);
-    var_sct *wgt_var;
+    trv_sct *wgt_trv;
+    wgt_trv=trv_tbl_var_nm_fll(wgt_nm,trv_tbl);
     (void)nco_inq_grp_full_ncid(nc_id,wgt_trv->grp_nm_fll,&grp_id);
     (void)nco_inq_varid(grp_id,wgt_trv->nm,&var_id);
     /* Transfer from table to local variable  */
@@ -7284,15 +7088,15 @@ nco_var_get_wgt_trv                 /* [fnc] Retrieve weighting or mask variable
     (void)nco_msa_var_get_trv(nc_id,wgt_var,trv_tbl);
     return wgt_var;
   }else{
-    /* Relative name given for weight. Must identify most in-scopy match... */
-    int nbr_wgt=0; /* [nbr] Number of weight/mask variables in file */
+    /* Relative name given for weight. Must identify most-in-scope match... */
+    int wgt_nbr=0; /* [nbr] Number of weight/mask variables in file */
     trv_sct **wgt_trv=NULL; /* [sct] Weight/mask list */
     
     for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++)
-      if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_var && (!strcmp(trv_tbl->lst[tbl_idx].nm,wgt_nm))) nbr_wgt++;
+      if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_var && (!strcmp(trv_tbl->lst[tbl_idx].nm,wgt_nm))) wgt_nbr++;
 
     /* Fill-in variable structure list for all weights */
-    wgt_trv=(trv_sct **)nco_malloc(nbr_wgt*sizeof(trv_sct *));
+    wgt_trv=(trv_sct **)nco_malloc(wgt_nbr*sizeof(trv_sct *));
     idx_wgt=0;
 
     for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
@@ -7300,23 +7104,19 @@ nco_var_get_wgt_trv                 /* [fnc] Retrieve weighting or mask variable
       if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_var && !strcmp(trv_tbl->lst[tbl_idx].nm,wgt_nm)){
         wgt_trv[idx_wgt]=&trv_tbl->lst[tbl_idx]; 
         idx_wgt++;
-      } /* Filter variables  */
-    } /* Loop table */
+      } /* endif */
+    } /* !tbl_idx */
 
-    /* Loop table */
     for(unsigned idx_var=0;idx_var<trv_tbl->nbr;idx_var++){
-
       /* Find variable that needs weight/mask */
       if(trv_tbl->lst[idx_var].nco_typ == nco_obj_typ_var &&
 	 trv_tbl->lst[idx_var].flg_xtr &&
 	 !strcmp(trv_tbl->lst[idx_var].nm_fll,var->nm_fll)){
 	trv_sct var_trv=trv_tbl->lst[idx_var];  
 
-	/* Loop over weights */
-	for(idx_wgt=0;idx_wgt<nbr_wgt;idx_wgt++){
-	  /* Same group */
+	/* 20150711: This is buggy, at best it returns the last weight found, not the closest-in-scope */
+	for(idx_wgt=0;idx_wgt<wgt_nbr;idx_wgt++){
 	  if(!strcmp(wgt_trv[idx_wgt]->grp_nm_fll,var_trv.grp_nm_fll)){
-	    var_sct *wgt_var;
 	    (void)nco_inq_grp_full_ncid(nc_id,wgt_trv[idx_wgt]->grp_nm_fll,&grp_id);
 	    (void)nco_inq_varid(grp_id,wgt_trv[idx_wgt]->nm,&var_id);
 	    /* Transfer from table to local variable */
@@ -7325,253 +7125,18 @@ nco_var_get_wgt_trv                 /* [fnc] Retrieve weighting or mask variable
 	    (void)nco_msa_var_get_trv(nc_id,wgt_var,trv_tbl);
 	    wgt_trv=(trv_sct **)nco_free(wgt_trv);
 	    return wgt_var;
-	  } /* Same group  */ 
-	} /* end loop loop over weights */
-      } /* Filter variables  */
-    } /* end loop over table */
-  } /* Relative name */
-  
-  return NULL;
-  
-} /* nco_var_get_wgt_trv() */
-
-void                                  
-nco_aed_prc_grp                       /* [fnc] Process attributes in groups */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl)   /* I [lst] Traversal table */ 
-{
-  /* Purpose: Process attributes  */
-
-  int grp_id; /* [id] Group ID */
-
-  nco_bool var_fnd=False; /* [flg] Variable was found */
-
-  /* Only used by ncatted */
-  assert(nco_prg_id_get() == ncatted);
-
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_grp){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv_tbl->lst[tbl_idx].grp_nm_fll,&grp_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,NC_GLOBAL,aed);
-      var_fnd=True;
-    } /* !group */
-  } /* end loop over tables */ 
-
-  if(!var_fnd){
-    (void)fprintf(stderr,"%s: ERROR No attributes were found\n",nco_prg_nm_get());
-    nco_exit(EXIT_FAILURE);
-  } 
-
-  return;
-
-} /* nco_aed_prc_grp() */
-
-void                                  
-nco_aed_prc_glb                       /* [fnc] Process attributes in root group */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl)   /* I [lst] Traversal table */ 
-{
-  /* Purpose: Process attributes  */
-
-  int grp_id; /* [id] Group ID */
-
-  nco_bool var_fnd=False; /* [flg] Variable was found */
+	  } /* !strcmp() */
+	} /* !idx_wgt */
+      } /* !var */
+    } /* !idx_var */
+  } /* !Relative name */
 
-  /* Only used by ncatted */
-  assert(nco_prg_id_get() == ncatted);
+  /* If function has not yet returned, then variable was not found */
+  (void)fprintf(stdout,"%s: ERROR nco_var_get_wgt_trv() reports unable to find specified weight or mask variable \"%s\"\n",nco_prg_nm_get(),wgt_nm);
+  nco_exit(EXIT_FAILURE); 
 
-  /* Loop table */
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    /* Is root group */
-    if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_grp && strcmp("/",trv_tbl->lst[tbl_idx].nm_fll) == 0){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv_tbl->lst[tbl_idx].grp_nm_fll,&grp_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,NC_GLOBAL,aed);
-      var_fnd=True;
-    } /* Is group */
-  } /* Loop table */ 
-
-  if(!var_fnd){
-    (void)fprintf(stderr,"%s: ERROR Attribute was not found\n",nco_prg_nm_get());
-    nco_exit(EXIT_FAILURE);
-  } 
-
-  return;
-} /* nco_aed_prc_grp() */
-
-void                                  
-nco_aed_prc_var                       /* [fnc] Process attributes in variables */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl)   /* I [lst] Traversal table */ 
-{
-  /* Purpose: Process attributes  */
-
-  int grp_id; /* [id] Group ID */
-  int var_id; /* [id] Variable ID */
-
-  nco_bool var_fnd=False; /* [flg] Variable was found */
-
-  /* Only used by ncatted */
-  assert(nco_prg_id_get() == ncatted);
-
-  /* Loop table */
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    /* Is variable */
-    if(trv_tbl->lst[tbl_idx].nco_typ == nco_obj_typ_var){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv_tbl->lst[tbl_idx].grp_nm_fll,&grp_id);
-      /* Get variable ID  */
-      (void)nco_inq_varid(grp_id,trv_tbl->lst[tbl_idx].nm,&var_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,var_id,aed);
-      var_fnd=True;
-    } /* Is variable */
-  } /* Loop table */ 
-
-  if(!var_fnd){
-    (void)fprintf(stderr,"%s: No attributes were found\n",nco_prg_nm_get());
-    nco_exit(EXIT_FAILURE);
-  } 
-
-  return;
-
-} /* nco_aed_prc_var() */
-
-
-void                                  
-nco_aed_prc_var_xtr                   /* [fnc] Process attributes in variables that match table extraction flag */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl)   /* I [lst] Traversal table */ 
-{
-  /* Purpose: Process attributes  */
-
-  int grp_id; /* [id] Group ID */
-  int var_id; /* [id] Variable ID */
-
-  nco_bool var_fnd=False; /* [flg] Variable was found */
-
-  /* Only used by ncatted */
-  assert(nco_prg_id_get() == ncatted);
-
-  /* Loop table */
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    trv_sct trv=trv_tbl->lst[tbl_idx];
-    /* Is variable to extract */
-    if(trv.nco_typ == nco_obj_typ_var && trv.flg_xtr){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
-      /* Get variable ID  */
-      (void)nco_inq_varid(grp_id,trv.nm,&var_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,var_id,aed);
-      var_fnd=True;
-    } /* Is variable */
-  } /* Loop table */ 
-
-  if(!var_fnd){
-    (void)fprintf(stderr,"%s: No attributes were found\n",nco_prg_nm_get());
-    nco_exit(EXIT_FAILURE);
-  } 
-
-  return;
-
-} /* nco_aed_prc_var_xtr() */
-
-void                                  
-nco_aed_prc_var_nm                    /* [fnc] Process attributes in variables that match input name */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl)   /* I [lst] Traversal table */ 
-{
-  /* Purpose: Process attributes in variables that match input name (absolute or relative)  */
-
-  int grp_id; /* [id] Group ID */
-  int var_id; /* [id] Variable ID */
-
-  nco_bool var_fnd=False; /* [flg] Variable was found */
-
-  /* Only used by ncatted */
-  assert(nco_prg_id_get() == ncatted);
-
-  /* Assume name is for variable */
-
-  /* Loop table (absolute name) */
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    trv_sct trv=trv_tbl->lst[tbl_idx];
-    /* Variable name match */
-    if(trv.nco_typ == nco_obj_typ_var && strcmp(aed.var_nm,trv.nm_fll) == 0){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
-      /* Get variable ID  */
-      (void)nco_inq_varid(grp_id,trv.nm,&var_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,var_id,aed);
-      /* Only 1 match possible, return */
-      return;
-    } /* Is variable */
-  } /* Loop table */ 
-
-  /* Loop table (relative name, can be many) */
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    trv_sct trv=trv_tbl->lst[tbl_idx];
-    /* Variable name (relative) match */
-    if(trv.nco_typ == nco_obj_typ_var && strcmp(aed.var_nm,trv.nm) == 0){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
-      /* Get variable ID  */
-      (void)nco_inq_varid(grp_id,trv.nm,&var_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,var_id,aed);
-      var_fnd=True;
-    } /* Is variable */
-  } /* Loop table */ 
-
-
-  /* Try name for group */
-
-  /* Loop table (absolute name) */
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    trv_sct trv=trv_tbl->lst[tbl_idx];
-    /* Group name match */
-    if(trv.nco_typ == nco_obj_typ_grp && strcmp(aed.var_nm,trv.nm_fll) == 0){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,NC_GLOBAL,aed);
-      /* Only 1 match possible, return */
-      return;
-    } /* Is variable */
-  } /* Loop table */ 
-
-  /* Loop table (relative name, can be many) */
-  for(unsigned tbl_idx=0;tbl_idx<trv_tbl->nbr;tbl_idx++){
-    trv_sct trv=trv_tbl->lst[tbl_idx];
-    /* Group name (relative) match */
-    if(trv.nco_typ == nco_obj_typ_grp && strcmp(aed.var_nm,trv.nm) == 0){
-      /* Get group ID */
-      (void)nco_inq_grp_full_ncid(nc_id,trv.grp_nm_fll,&grp_id);
-      /* Process attribute */
-      (void)nco_aed_prc(grp_id,NC_GLOBAL,aed);
-      var_fnd=True;
-    } /* Is variable */
-  } /* Loop table */ 
-
-
-  if(!var_fnd){
-    (void)fprintf(stderr,"%s: Variable <%s> was not found\n",nco_prg_nm_get(),aed.var_nm);
-    nco_exit(EXIT_FAILURE);
-  } 
-
-  return;
-
-} /* nco_aed_prc_var_nm() */
+  return NULL;
+} /* nco_var_get_wgt_trv() */
 
 void                                    
 nco_grp_var_lst                        /* [fnc] Export list of variable names for group */
@@ -7797,13 +7362,14 @@ nco_prs_aux_crd                       /* [fnc] Parse auxiliary coordinates */
             lmt_sct **lmt=aux;
             int lmt_dmn_nbr=aux_lmt_nbr;
 
-            /* The dimension IDs of both 'latitude' and 'longitude' must refer to the same dimemsion (e.g., 'gds_crd) */
+            /* Dimension IDs of both 'latitude' and 'longitude' must refer to same dimemsion (e.g., 'gds_crd) */
             assert(dmn_id_fnd_lon == dmn_id_fnd_lat);
-
+	    CEWI_unused(dmn_id_fnd_lon);
+	    
             /* Apply limits to variable in table */
             (void)nco_lmt_aux_tbl(nc_id,lmt,lmt_dmn_nbr,var_trv.nm_fll,dmn_id_fnd_lat,FORTRAN_IDX_CNV,MSA_USR_RDR,trv_tbl);
 
-            /*  Apply limits to *all* 'latitude', 'longitude' variables that share the same ID */
+            /* Apply limits to *all* 'latitude', 'longitude' variables that share the same ID */
             (void)nco_lmt_std_att_lat_lon(nc_id,lmt,lmt_dmn_nbr,dmn_id_fnd_lat,FORTRAN_IDX_CNV,MSA_USR_RDR,trv_tbl);   
 
             /* Get unique dimension object from unique dimension ID (e.g., 'gds_crd) */
@@ -7823,8 +7389,6 @@ nco_prs_aux_crd                       /* [fnc] Parse auxiliary coordinates */
                 nco_lmt_prt(lmt[idx_lmt]);
               }
             }
-
-
           } /* Found limits */
 
           /* Free limits exported from nco_aux_evl_trv() */
@@ -8151,7 +7715,7 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
       has_lat=nco_find_lat_lon_trv(nc_id,&var_trv,"latitude",&var_nm_fll,&dmn_id,&crd_typ,units_lat);
 
       if(has_lat){
-        /* Variable contains 'standard_name' attribute "latitude" */ 
+        /* Variable contains 'standard_name' attribute 'latitude' */ 
         trv_tbl->lst[idx_var].flg_std_att_lat=True; 
 
         if(nco_dbg_lvl_get() >= nco_dbg_dev) (void)fprintf(stdout,"%s: DEBUG %s 'standard_name' attribute is 'latitude' for variable %s with dimension ID = %d\n",nco_prg_nm_get(),fnc_nm,var_trv.nm_fll,dmn_id); 
@@ -8183,7 +7747,7 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
 	      int var_dim_id=trv_tbl->lst[idx_crd].var_dmn[idx_dmn].dmn_id;
 	      if(var_dim_id == dmn_id){
 		
-		/* Check if possible 'latitude' (var_trv) is in scope */
+		/* Check if possible 'latitude' (var_trv) is in-scope */
 		if(nco_var_scp(&trv_tbl->lst[idx_crd],&var_trv,trv_tbl)){
 		  
 		  /* Mark variable (e.g., gds_var, gds_3dvar) as containing auxiliary coordinates */
@@ -8201,7 +7765,7 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
 		  trv_tbl->lst[idx_crd].var_dmn[idx_dmn].lat_crd[nbr_lat_crd-1].crd_typ=crd_typ;
 		  strcpy(trv_tbl->lst[idx_crd].var_dmn[idx_dmn].lat_crd[nbr_lat_crd-1].units,units_lat);
 		  
-		} /* Is in scope */
+		} /* Is in-scope */
 	      } /* Match dimension */
 	    } /* Loop dimensions  */
           } /* variables only */
@@ -8211,7 +7775,7 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
       has_lon=nco_find_lat_lon_trv(nc_id,&var_trv,"longitude",&var_nm_fll,&dmn_id,&crd_typ,units_lon);
       
       if(has_lon){
-        /* Variable contains 'standard_name' attribute "longitude" */ 
+        /* Variable contains 'standard_name' attribute 'longitude' */ 
         trv_tbl->lst[idx_var].flg_std_att_lon=True; 
 
         if(nco_dbg_lvl_get() >= nco_dbg_dev) (void)fprintf(stdout,"%s: DEBUG %s 'standard_name' attribute is 'longitude' for variable %s with dimension ID = %d\n",nco_prg_nm_get(),fnc_nm,var_trv.nm_fll,dmn_id); 
@@ -8238,7 +7802,7 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
 	      /* Match dimension */
 	      int var_dim_id=trv_tbl->lst[idx_crd].var_dmn[idx_dmn].dmn_id;
 	      if (var_dim_id == dmn_id){
-		/* Check if possible 'longitude' (var_trv) is in scope */
+		/* Check if possible 'longitude' (var_trv) is in-scope */
 		if(nco_var_scp(&trv_tbl->lst[idx_crd],&var_trv,trv_tbl)){
 		  
 		  /* Mark variable (e.g., gds_var, gds_3dvar) as containing auxiliary coordinates */
@@ -8256,7 +7820,7 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
 		  trv_tbl->lst[idx_crd].var_dmn[idx_dmn].lon_crd[nbr_lon_crd-1].crd_typ=crd_typ;
 		  strcpy(trv_tbl->lst[idx_crd].var_dmn[idx_dmn].lon_crd[nbr_lon_crd-1].units,units_lat);
 		  
-		} /* Is in scope */
+		} /* Is in-scope */
 	      } /* Match dimension */
 	    } /* Loop dimensions  */
           } /* variables only */
@@ -8289,9 +7853,9 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
           qsort(trv_tbl->lst[idx_var].var_dmn[idx_dmn].lat_crd,(size_t)nbr_lat_crd,sizeof(trv_tbl->lst[idx_var].var_dmn[idx_dmn].lat_crd[0]),nco_cmp_aux_crd_dpt);
 
           if(nco_dbg_lvl_get() == nco_dbg_old){ 
-            (void)fprintf(stdout,"%s: DEBUG %s 'latitude' auxiliary coordinates <%s>:<%s>\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].dmn_nm_fll); 
+            (void)fprintf(stdout,"%s: DEBUG %s 'latitude' auxiliary coordinates %s: %s\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].dmn_nm_fll); 
             for(int idx_crd=0;idx_crd<nbr_lat_crd;idx_crd++)
-              (void)fprintf(stdout,"%s: DEBUG %s <%s> dpt=%d\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lat_crd[idx_crd].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lat_crd[idx_crd].grp_dpt);
+              (void)fprintf(stdout,"%s: DEBUG %s %s dpt=%d\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lat_crd[idx_crd].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lat_crd[idx_crd].grp_dpt);
           } /* endif dbg */
 
         } /* Has 'latitude' auxiliary coordinates */
@@ -8305,9 +7869,9 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
           qsort(trv_tbl->lst[idx_var].var_dmn[idx_dmn].lon_crd,(size_t)nbr_lon_crd,sizeof(trv_tbl->lst[idx_var].var_dmn[idx_dmn].lon_crd[0]),nco_cmp_aux_crd_dpt);
 
           if(nco_dbg_lvl_get() == nco_dbg_old){ 
-            (void)fprintf(stdout,"%s: DEBUG %s 'longitude' auxiliary coordinates <%s>:<%s>\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].dmn_nm_fll); 
+            (void)fprintf(stdout,"%s: DEBUG %s 'longitude' auxiliary coordinates %s: %s\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].dmn_nm_fll); 
             for(int idx_crd=0;idx_crd<nbr_lon_crd;idx_crd++)
-              (void)fprintf(stdout,"%s: DEBUG %s <%s> dpt=%d\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lon_crd[idx_crd].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lon_crd[idx_crd].grp_dpt);
+              (void)fprintf(stdout,"%s: DEBUG %s %s dpt=%d\n",nco_prg_nm_get(),fnc_nm,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lon_crd[idx_crd].nm_fll,trv_tbl->lst[idx_var].var_dmn[idx_dmn].lon_crd[idx_crd].grp_dpt);
           } /* endif dbg */
 
         } /* Has 'longitude' auxiliary coordinates */
@@ -8318,10 +7882,10 @@ nco_bld_crd_aux /* [fnc] Build auxiliary coordinates information into table */
   return;
 } /* nco_bld_crd_aux() */
 
-nco_bool                               /* O [flg] True if variable 1 is in scope of variable 2 */
-nco_var_scp                            /* [fnc] Is variable 1 is in scope of variable 2 */
+nco_bool                               /* O [flg] True if variable 1 is in-scope of variable 2 */
+nco_var_scp                            /* [fnc] Is variable 1 is in-scope of variable 2 */
 (const trv_sct * const var_trv_1,      /* I [sct] Variable 1 */
- const trv_sct * const var_trv_2,      /* I [sct] Variable 2 (use case , find 'latitude in scope )*/
+ const trv_sct * const var_trv_2,      /* I [sct] Variable 2 (use case , find 'latitude in-scope)*/
  const trv_tbl_sct * const trv_tbl)    /* I [sct] Traversal table */
 {
 
@@ -10336,7 +9900,7 @@ nco_nsm_wrt_att                  /* [fnc] Save ncge metadata attribute */
   int grp_id;                          /* [ID] Group ID in input file */
   int grp_out_id;                      /* [ID] Group ID in output file */ 
 
-  aed_sct aed; /* [sct] Structure containing information necessary to edit */
+  aed_sct aed; /* [sct] Attribute-edit information */
 
   for(unsigned idx_tbl=0;idx_tbl<trv_tbl->nbr;idx_tbl++){
     trv_sct grp_trv=trv_tbl->lst[idx_tbl];
diff --git a/src/nco/nco_grp_utl.h b/src/nco/nco_grp_utl.h
index 520f934..e3ceaaf 100644
--- a/src/nco/nco_grp_utl.h
+++ b/src/nco/nco_grp_utl.h
@@ -180,9 +180,6 @@ nco_xtr_crd_ass_add                   /* [fnc] Add to extraction list all coordi
  trv_tbl_sct * const trv_tbl);        /* I/O [sct] Traversal table */
 
 void
-nco_get_prg_info(void);               /* [fnc] Get program info */
-
-void
 nco_prn_xtr_mtd                       /* [fnc] Print variable metadata (called with PRN_VAR_METADATA) */
 (const int nc_id,                     /* I netCDF file ID */
  const prn_fmt_sct * const prn_flg, /* I [sct] Print-format information */
@@ -466,13 +463,6 @@ nco_var_prc_idx_trv                   /* [fnc] Find index of processed variable
  int * var_prc_idx_out);              /* O [nbr] Number of dimension to re-order */
 
 void
-nco_aed_prc_trv                       /* [fnc] Process single attribute edit for single variable (GTT) */
-(const int nc_id,                     /* I [id] Input netCDF file ID */
- const aed_sct *aed,                  /* I [sct] Structure containing information necessary to edit */
- const int nbr_aed,                   /* I [nbr] Number of attribute structures */
- const trv_tbl_sct * const trv_tbl);  /* I [sct] GTT (Group Traversal Table) */
-
-void
 nco_dmn_trv_msa_tbl                   /* [fnc] Update all GTT dimensions with hyperslabbed size */
 (const int nc_id,                     /* I [ID] netCDF input file ID */
  const char * const rec_dmn_nm,       /* I [sng] Record dimension name */
@@ -588,36 +578,6 @@ nco_var_get_wgt_trv                   /* [fnc] Retrieve weighting or mask variab
  const var_sct * const var,           /* I [sct] Variable that needs the weight/mask variable */
  const trv_tbl_sct * const trv_tbl);  /* I [lst] Traversal table */
 
-void                                  
-nco_aed_prc_grp                       /* [fnc] Process attributes in groups */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl);  /* I [lst] Traversal table */ 
-
-void                                  
-nco_aed_prc_glb                       /* [fnc] Process attributes in root group */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl);  /* I [lst] Traversal table */ 
-
-void                                  
-nco_aed_prc_var                       /* [fnc] Process attributes in variables */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl);  /* I [lst] Traversal table */ 
-
-void                                  
-nco_aed_prc_var_xtr                   /* [fnc] Process attributes in variables that match table extraction flag */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl);  /* I [lst] Traversal table */ 
-
-void                                  
-nco_aed_prc_var_nm                    /* [fnc] Process attributes in variables that match input name */
-(const int nc_id,                     /* I [id] netCDF file ID */
- const aed_sct aed,                   /* I [sct] Structure containing information necessary to edit */
- const trv_tbl_sct * const trv_tbl);  /* I [lst] Traversal table */ 
-
 void                                    
 nco_grp_var_lst                        /* [fnc] Export list of variable names for group */
 (const int nc_id,                      /* I [id] netCDF file ID */
diff --git a/src/nco/nco_msa.c b/src/nco/nco_msa.c
index 423e590..33fdd38 100644
--- a/src/nco/nco_msa.c
+++ b/src/nco/nco_msa.c
@@ -1387,128 +1387,119 @@ nco_cpy_msa_lmt                     /* [fnc] Copy MSA struct from table to local
  lmt_msa_sct ***lmt_msa)            /* O [sct] MSA array for dimensions */
 {
   /* Purpose: Deep copy MSA structs from table to local array used in print or write */
-
+  
   /* Loop dimensions for object (variable)  */
-  for(int dmn_idx_var=0;dmn_idx_var<var_trv->nbr_dmn;dmn_idx_var++) {
-
+  for(int dmn_idx_var=0;dmn_idx_var<var_trv->nbr_dmn;dmn_idx_var++){
+    
     (*lmt_msa)[dmn_idx_var]=(lmt_msa_sct *)nco_malloc(sizeof(lmt_msa_sct));
-
-    /* This dimension has a coordinate variable */
-    if (var_trv->var_dmn[dmn_idx_var].is_crd_var == True){
-
+    
+    if(var_trv->var_dmn[dmn_idx_var].is_crd_var == True){
+      /* This dimension has a coordinate variable */
+      
       /* Get number of limits */
       int lmt_dmn_nbr=var_trv->var_dmn[dmn_idx_var].crd->lmt_msa.lmt_dmn_nbr;
-
+      
       /* Initialize to NULL the limit array */
       (*lmt_msa)[dmn_idx_var]->lmt_dmn=NULL;
-
+      
       /* If limits, make space for them */
-      if (lmt_dmn_nbr) (*lmt_msa)[dmn_idx_var]->lmt_dmn=(lmt_sct **)nco_malloc(lmt_dmn_nbr*sizeof(lmt_sct *));
-
+      if(lmt_dmn_nbr) (*lmt_msa)[dmn_idx_var]->lmt_dmn=(lmt_sct **)nco_malloc(lmt_dmn_nbr*sizeof(lmt_sct *));
+      
       /* And copy the structure made while building limits  */
       (*lmt_msa)[dmn_idx_var]->dmn_nm=strdup(var_trv->var_dmn[dmn_idx_var].crd->nm);
-
+      
       (*lmt_msa)[dmn_idx_var]->NON_HYP_DMN=var_trv->var_dmn[dmn_idx_var].crd->lmt_msa.NON_HYP_DMN;
       (*lmt_msa)[dmn_idx_var]->dmn_cnt=var_trv->var_dmn[dmn_idx_var].crd->lmt_msa.dmn_cnt;
       (*lmt_msa)[dmn_idx_var]->dmn_sz_org=var_trv->var_dmn[dmn_idx_var].crd->sz;
       (*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr=var_trv->var_dmn[dmn_idx_var].crd->lmt_msa.lmt_dmn_nbr;
       (*lmt_msa)[dmn_idx_var]->MSA_USR_RDR=var_trv->var_dmn[dmn_idx_var].crd->lmt_msa.MSA_USR_RDR;
       (*lmt_msa)[dmn_idx_var]->WRP=var_trv->var_dmn[dmn_idx_var].crd->lmt_msa.WRP;
-
+      
       /* Loop needed limits */
       for(int lmt_idx=0;lmt_idx<lmt_dmn_nbr;lmt_idx++){
-
+	
         /* Alloc new limit */
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[lmt_idx]=(lmt_sct *)nco_malloc(sizeof(lmt_sct));
-
+	
         /* Initialize NULL/invalid */
         (void)nco_lmt_init((*lmt_msa)[dmn_idx_var]->lmt_dmn[lmt_idx]);
-
+	
         /* Deep copy from table to local array */ 
         (void)nco_lmt_cpy(var_trv->var_dmn[dmn_idx_var].crd->lmt_msa.lmt_dmn[lmt_idx],(*lmt_msa)[dmn_idx_var]->lmt_dmn[lmt_idx]);
-
-      } /* End Loop needed limits */
-
-      /* No limits? ...Make a limit to read all */
-      if ((*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr == 0){
-
+      } /* !lmt_idx */
+      
+      if((*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr == 0){
+	/* No limits so ake a limit to read all */
         if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"Warning...no limit zone\n "); 
-
+	
         /* Allocate one dummy limit */
         (*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr=1;
         (*lmt_msa)[dmn_idx_var]->lmt_dmn=(lmt_sct **)nco_malloc(1*sizeof(lmt_sct *));
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]=(lmt_sct *)nco_malloc(sizeof(lmt_sct));
-
+	
         /* Initialize NULL/invalid */
         (void)nco_lmt_init((*lmt_msa)[dmn_idx_var]->lmt_dmn[0]);
-
+	
         /* And set start,count,stride to read everything ...major success */
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]->srt=0L;
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]->cnt=(*lmt_msa)[dmn_idx_var]->dmn_sz_org;
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]->srd=1L;
-
-      } /* Make a limit to read all */
-    } /* If there are limits for this variable dimension, get MSA from table */
-
-    /* This dimension does not have a coordinate variable, it must have a unique dimension pointer */
-    else if(var_trv->var_dmn[dmn_idx_var].is_crd_var == False){
-
+      } /* !no limites */
+    }else if(var_trv->var_dmn[dmn_idx_var].is_crd_var == False){
+      /* Dimension does not have a coordinate variable, it must have a unique dimension pointer */
+      
       /* Get number of limits */
       int lmt_dmn_nbr=var_trv->var_dmn[dmn_idx_var].ncd->lmt_msa.lmt_dmn_nbr;
-
+      
       /* If limits, make space for them */
-      if (lmt_dmn_nbr) (*lmt_msa)[dmn_idx_var]->lmt_dmn=(lmt_sct **)nco_malloc(lmt_dmn_nbr*sizeof(lmt_sct *));
-
+      if(lmt_dmn_nbr) (*lmt_msa)[dmn_idx_var]->lmt_dmn=(lmt_sct **)nco_malloc(lmt_dmn_nbr*sizeof(lmt_sct *));
+      
       /* And copy the structure made while building limits  */
       (*lmt_msa)[dmn_idx_var]->dmn_nm=strdup(var_trv->var_dmn[dmn_idx_var].ncd->nm);
-
+      
       (*lmt_msa)[dmn_idx_var]->NON_HYP_DMN=var_trv->var_dmn[dmn_idx_var].ncd->lmt_msa.NON_HYP_DMN;
       (*lmt_msa)[dmn_idx_var]->dmn_cnt=var_trv->var_dmn[dmn_idx_var].ncd->lmt_msa.dmn_cnt;
       (*lmt_msa)[dmn_idx_var]->dmn_sz_org=var_trv->var_dmn[dmn_idx_var].ncd->sz;
       (*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr=var_trv->var_dmn[dmn_idx_var].ncd->lmt_msa.lmt_dmn_nbr;
       (*lmt_msa)[dmn_idx_var]->MSA_USR_RDR=var_trv->var_dmn[dmn_idx_var].ncd->lmt_msa.MSA_USR_RDR;
       (*lmt_msa)[dmn_idx_var]->WRP=var_trv->var_dmn[dmn_idx_var].ncd->lmt_msa.WRP;
-
+      
       /* Loop needed limits */
       for(int lmt_idx=0;lmt_idx<lmt_dmn_nbr;lmt_idx++){
-
+	
         /* Alloc new limit */
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[lmt_idx]=(lmt_sct *)nco_malloc(sizeof(lmt_sct));
-
+	
         /* Initialize NULL/invalid */
         (void)nco_lmt_init((*lmt_msa)[dmn_idx_var]->lmt_dmn[lmt_idx]);
-
+	
         /* Deep copy from table to local array */ 
         (void)nco_lmt_cpy(var_trv->var_dmn[dmn_idx_var].ncd->lmt_msa.lmt_dmn[lmt_idx],(*lmt_msa)[dmn_idx_var]->lmt_dmn[lmt_idx]);
-
-      } /* End Loop needed limits */
-
-      /* No limits? ...Make a limit to read all */
-      if ((*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr == 0){
-
+      } /* !lmt_idx */
+      
+      if((*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr == 0){
+	/* No limits so ake a limit to read all */
         if(nco_dbg_lvl_get() == nco_dbg_old) (void)fprintf(stdout,"Warning...no limit zone\n "); 
-
         /* Alloc 1 dummy limit */
         (*lmt_msa)[dmn_idx_var]->lmt_dmn_nbr=1;
         (*lmt_msa)[dmn_idx_var]->lmt_dmn=(lmt_sct **)nco_malloc(1*sizeof(lmt_sct *));
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]=(lmt_sct *)nco_malloc(sizeof(lmt_sct));
-
+	
         /* Initialize NULL/invalid */
         (void)nco_lmt_init((*lmt_msa)[dmn_idx_var]->lmt_dmn[0]);
-
+	
         /* And set start,count,stride to read everything ...major success */
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]->srt=0L;
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]->cnt=(*lmt_msa)[dmn_idx_var]->dmn_sz_org;
         (*lmt_msa)[dmn_idx_var]->lmt_dmn[0]->srd=1L;
-
-      } /* Make a limit to read all */
-    } /* If there are limits for this variable dimension, get MSA from table */
-
-    /* This dimension must have either a coordinate or a dimension pointer */
-    else assert(False);
-
-  } /* Loop dimensions for object (variable)  */
-
+      } /* !no limits */
+    }else{
+      /* This dimension must have either a coordinate or a dimension pointer */
+      assert(False);
+    } /* end else */
+    
+  } /* !dmn_idx_var */
+       
 } /* nco_cpy_msa_lmt() */
 
 void
@@ -1518,49 +1509,49 @@ nco_msa_var_get_trv                 /* [fnc] Get variable data from disk taking
  const trv_tbl_sct * const trv_tbl) /* I [sct] GTT (Group Traversal Table) */
 {
   const char fnc_nm[]="nco_msa_var_get_trv()"; /* [sng] Function name  */
-
+  
   int nbr_dim;
   int grp_id;
-
+  
   lmt_msa_sct **lmt_msa;
   lmt_sct **lmt;
-
+  
   nc_type mss_typ_tmp=NC_NAT; /* CEWI */
-
+  
   trv_sct *var_trv;
-
+  
   /* Obtain variable GTT object using full variable name */
   var_trv=trv_tbl_var_nm_fll(var_in->nm_fll,trv_tbl);
   assert(var_trv);
-
+  
   /* Obtain group ID */
   (void)nco_inq_grp_full_ncid(nc_id,var_trv->grp_nm_fll,&grp_id);
-
+  
   nbr_dim=var_in->nbr_dim;	
   var_in->nc_id=grp_id; 
-
+  
   assert(nbr_dim == var_trv->nbr_dmn);
   assert(!strcmp(var_in->nm_fll,var_trv->nm_fll));
-
+  
   /* Scalars */
   if(nbr_dim == 0){
     var_in->val.vp=nco_malloc(nco_typ_lng(var_in->typ_dsk));
     (void)nco_get_var1(var_in->nc_id,var_in->id,0L,var_in->val.vp,var_in->typ_dsk);
     goto do_upk;
   } /* end if scalar */
-
-  /* Allocate local MSA */
+  
+    /* Allocate local MSA */
   lmt_msa=(lmt_msa_sct **)nco_malloc(var_trv->nbr_dmn*sizeof(lmt_msa_sct *));
   lmt=(lmt_sct **)nco_malloc(var_trv->nbr_dmn*sizeof(lmt_sct *));
-
+  
   /* Copy from table to local MSA */
   (void)nco_cpy_msa_lmt(var_trv,&lmt_msa);
-
+  
   if(nco_dbg_lvl_get() == nco_dbg_old){
     (void)fprintf(stdout,"%s: DEBUG %s reports reading %s\n",nco_prg_nm_get(),fnc_nm,var_trv->nm_fll);
     for(int idx_dmn=0;idx_dmn<var_trv->nbr_dmn;idx_dmn++){
       (void)fprintf(stdout,"%s: DEBUG %s reports dimension %s has dmn_cnt = %ld",nco_prg_nm_get(),fnc_nm,lmt_msa[idx_dmn]->dmn_nm,lmt_msa[idx_dmn]->dmn_cnt);
-      for(int idx_lmt=0;idx_lmt<lmt_msa[idx_dmn]->lmt_dmn_nbr;idx_lmt++) (void)fprintf(stdout," : %ld (%ld->%ld)",lmt_msa[idx_dmn]->lmt_dmn[idx_lmt]->cnt,lmt_msa[idx_dmn]->lmt_dmn[idx_lmt]->srt,lmt_msa[idx_dmn]->lmt_dmn[idx_lmt]->end);
+	for(int idx_lmt=0;idx_lmt<lmt_msa[idx_dmn]->lmt_dmn_nbr;idx_lmt++) (void)fprintf(stdout," : %ld (%ld->%ld)",lmt_msa[idx_dmn]->lmt_dmn[idx_lmt]->cnt,lmt_msa[idx_dmn]->lmt_dmn[idx_lmt]->srt,lmt_msa[idx_dmn]->lmt_dmn[idx_lmt]->end);
       (void)fprintf(stdout,"\n");
     } /* end loop over dimensions */
   } /* endif dbg */
diff --git a/src/nco/nco_mss_val.c b/src/nco/nco_mss_val.c
index 3b19b4a..8ed37ee 100644
--- a/src/nco/nco_mss_val.c
+++ b/src/nco/nco_mss_val.c
@@ -337,7 +337,7 @@ nco_mss_val_get /* [fnc] Update number of attributes, missing_value of variable
     char sa1[1000];
     char sa2[1000]; 
     WRN_FIRST=False;
-    (void)sprintf(sa,"%s: WARNING Variable %s has attribute \"%s\" but not \"%s\". To comply with netCDF conventions, NCO ignores values that equal the %s attribute when performing arithmetic.",nco_prg_nm_get(),var->nm,nco_not_mss_val_sng_get(), nco_mss_val_sng_get(),nco_mss_val_sng_get()); 
+    (void)sprintf(sa,"%s: WARNING Variable %s has attribute \"%s\" but not \"%s\". To comply with netCDF conventions, NCO ignores values that equal the %s attribute when performing arithmetic.",nco_prg_nm_get(),var->nm,nco_not_mss_val_sng_get(),nco_mss_val_sng_get(),nco_mss_val_sng_get());
     (void)sprintf(sa1," Confusingly, values equal to the missing_value should also be neglected. However, it is tedious and (possibly) computationally expensive to check each value against multiple missing values during arithmetic on large variables. So NCO thinks that processing variables with a \"%s\" attribute and no \"%s\" attribute may produce undesired arithmetic results (i.e., where values that were intended to be neglected were not, in fact, neglected).",nco_not_mss_val_sng_get() [...]
     (void)sprintf(sa2, " We suggest you rename all \"%s\" attributes to \"%s\" or include both \"%s\" and \"%s\" attributes (with the _same values_) for all variables that have either attribute. Because it is long, this message is only printed once per operator even though multiple variables may have the same attribute configuration. More information on missing values is given at:\nhttp://nco.sf.net/nco.html#mss_val\nExamples of renaming attributes are at:\nhttp://nco.sf.net/nco.html#xmp [...]
     (void)fprintf(stderr,"%s%s%s",sa,sa1,sa2); 
@@ -371,6 +371,7 @@ nco_mss_val_get_dbl /* [fnc] Return missing_value of variable, if any, as double
   
   /* Refresh number of attributes for variable */
   (void)nco_inq_varnatts(nc_id,var_id,&var_nbr_att);
+  (void)nco_inq_varname(nc_id,var_id,var_nm);
   
   for(idx=0;idx<var_nbr_att;idx++){
     (void)nco_inq_attname(nc_id,var_id,idx,att_nm);
@@ -379,12 +380,10 @@ nco_mss_val_get_dbl /* [fnc] Return missing_value of variable, if any, as double
     if((int)strcasecmp(att_nm,nco_mss_val_sng_get())) continue;
     (void)nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
     if(att_sz != 1L){
-      (void)nco_inq_varname(nc_id,var_id,var_nm);
       (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for %s has %li elements and so will not be used\n",nco_prg_nm_get(),att_nm,var_nm,att_sz);
       continue;
     } /* end if */
     if(att_typ == NC_CHAR || att_typ == NC_STRING){
-      (void)nco_inq_varname(nc_id,var_id,var_nm);
       (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for %s has type %s and so will not be used\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ));
       continue;
     } /* end if */
@@ -407,7 +406,7 @@ nco_mss_val_get_dbl /* [fnc] Return missing_value of variable, if any, as double
     (void)sprintf(sa1," Confusingly, values equal to the missing_value should also be neglected. However, it is tedious and (possibly) computationally expensive to check each value against multiple missing values during arithmetic on large variables. So NCO thinks that processing variables with a \"%s\" attribute and no \"%s\" attribute may produce undesired arithmetic results (i.e., where values that were intended to be neglected were not, in fact, neglected).",nco_not_mss_val_sng_get() [...]
     (void)sprintf(sa2, " We suggest you rename all \"%s\" attributes to \"%s\" or include both \"%s\" and \"%s\" attributes (with the _same values_) for all variables that have either attribute. Because it is long, this message is only printed once per operator even though multiple variables may have the same attribute configuration. More information on missing values is given at:\nhttp://nco.sf.net/nco.html#mss_val\nExamples of renaming attributes are at:\nhttp://nco.sf.net/nco.html#xmp [...]
     (void)fprintf(stderr,"%s%s%s",sa,sa1,sa2); 
-  } /* endif missing_value is and _FillValue is not defined */
+  } /* !mss_val */
 
   return has_mss_val;
   
diff --git a/src/nco/nco_netcdf.c b/src/nco/nco_netcdf.c
index 525326c..f3ccd67 100644
--- a/src/nco/nco_netcdf.c
+++ b/src/nco/nco_netcdf.c
@@ -1375,11 +1375,11 @@ int nco_def_var_deflate
 } /* end nco_def_var_deflate() */
 
 int
-nco_inq_var(const int nc_id,const int var_id,char * const var_nm,nc_type *var_typ,int * const dmn_nbr,int * const dmn_id,int * const nbr_att)
+nco_inq_var(const int nc_id,const int var_id,char * const var_nm,nc_type *var_typ,int * const dmn_nbr,int * const dmn_id,int * const att_nbr)
 {
   /* Purpose: Wrapper for nco_inq_var() */
   int rcd;
-  rcd=nc_inq_var(nc_id,var_id,var_nm,var_typ,dmn_nbr,dmn_id,nbr_att);
+  rcd=nc_inq_var(nc_id,var_id,var_nm,var_typ,dmn_nbr,dmn_id,att_nbr);
   if(rcd != NC_NOERR) nco_err_exit(rcd,"nco_inq_var()");
   return rcd;
 } /* end nco_inq_var */
@@ -1648,11 +1648,11 @@ nco_inq_vardimid(const int nc_id,const int var_id,int * const dmn_id)
 } /* end nco_inq_vardimid */
 
 int
-nco_inq_varnatts(const int nc_id,const int var_id,int * const nbr_att)
+nco_inq_varnatts(const int nc_id,const int var_id,int * const att_nbr)
 {
   /* Purpose: Wrapper for nc_inq_varnatts() */
   int rcd;
-  rcd=nc_inq_varnatts(nc_id,var_id,nbr_att);
+  rcd=nc_inq_varnatts(nc_id,var_id,att_nbr);
   if(rcd != NC_NOERR) nco_err_exit(rcd,"nco_inq_varnatts()");
   return rcd;
 } /* end nco_inq_varnatts */
diff --git a/src/nco/nco_netcdf.h b/src/nco/nco_netcdf.h
index d5a5474..9423e9e 100644
--- a/src/nco/nco_netcdf.h
+++ b/src/nco/nco_netcdf.h
@@ -335,7 +335,7 @@ int nco_def_var(const int nc_id,const char * const var_nm,const nc_type var_typ,
 int nco_def_var_chunking(const int nc_id,const int var_id,const int srg_typ,const size_t * const cnk_sz);
 int nco_def_var_deflate(const int nc_id,const int var_id,const int shuffle,const int deflate,const int dfl_lvl);
 int nco_def_var_fletcher32(const int nc_id,const int var_id,const int chk_typ);
-int nco_inq_var(const int nc_id,const int var_id,char * const var_nm,nc_type * const var_typ,int * const dmn_nbr,int * const dmn_id,int * const nbr_att);
+int nco_inq_var(const int nc_id,const int var_id,char * const var_nm,nc_type * const var_typ,int * const dmn_nbr,int * const dmn_id,int * const att_nbr);
 int nco_inq_var_chunking(const int nc_id,const int var_id,int * const srg_typ,size_t * const cnk_sz);
 int nco_inq_var_deflate(const int nc_id,const int var_id,int * const shuffle,int * const deflate,int * const dfl_lvl);
 int nco_inq_var_endian(const int nc_id,const int var_id,int * const ndn_typ);
@@ -346,7 +346,7 @@ int nco_inq_vardimid(const int nc_id,const int var_id,int * const dmn_id);
 int nco_inq_varid(const int nc_id,const char * const var_nm,int * const var_id);
 int nco_inq_varid_flg(const int nc_id,const char * const var_nm,int * const var_id);
 int nco_inq_varname(const int nc_id,const int var_id,char * const var_nm);
-int nco_inq_varnatts(const int nc_id,const int var_id,int * const nbr_att);
+int nco_inq_varnatts(const int nc_id,const int var_id,int * const att_nbr);
 int nco_inq_varndims(const int nc_id,const int var_id,int * const dmn_nbr);
 int nco_inq_vartype(const int nc_id,const int var_id,nc_type * const var_typ);
 int nco_rename_var(const int nc_id,const int var_id,const char * const var_nm);
diff --git a/src/nco/nco_omp.c b/src/nco/nco_omp.c
index 248c3af..2d065a6 100644
--- a/src/nco/nco_omp.c
+++ b/src/nco/nco_omp.c
@@ -94,15 +94,15 @@ nco_openmp_ini /* [fnc] Initialize OpenMP threading environment */
     if(nvr_OMP_NUM_THREADS && *sng_cnv_rcd) nco_sng_cnv_err(nvr_OMP_NUM_THREADS,"strtol",sng_cnv_rcd);
     (void)fprintf(fp_stderr,"%s: INFO Environment variable OMP_NUM_THREADS ",nco_prg_nm_get());
     if(ntg_OMP_NUM_THREADS > 0) (void)fprintf(fp_stderr,"= %d\n",ntg_OMP_NUM_THREADS); else (void)fprintf(fp_stderr,"does not exist\n");
-    (void)fprintf(fp_stderr,"%s: INFO Number of processors available is %d\n",nco_prg_nm_get(),prc_nbr_max);
-    (void)fprintf(fp_stderr,"%s: INFO Maximum number of threads system allows is %d\n",nco_prg_nm_get(),thr_nbr_max);
+    (void)fprintf(fp_stderr,"%s: INFO omp_get_num_procs() reports number of processors available is %d\n",nco_prg_nm_get(),prc_nbr_max);
+    (void)fprintf(fp_stderr,"%s: INFO omp_get_max_threads() reports maximum number of threads system allows is %d\n",nco_prg_nm_get(),thr_nbr_max);
   } /* endif dbg */
 
   if(USR_SPC_THR_RQS){
-    /* Always try to honor user-specified thread request... */
+    /* Try to honor user-specified thread request... */
     thr_nbr_rqs=thr_nbr; /* [nbr] Number of threads to request */
     /* ...if possible... */
-    if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(fp_stderr,"%s: INFO User command-line-requested %d thread%s\n",nco_prg_nm_get(),thr_nbr,(thr_nbr > 1) ? "s" : "");
+    if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(fp_stderr,"%s: INFO Command-line requests %d thread%s\n",nco_prg_nm_get(),thr_nbr,(thr_nbr > 1) ? "s" : "");
     if(thr_nbr > thr_nbr_max){
       (void)fprintf(fp_stderr,"%s: WARNING Reducing user-requested thread number = %d to maximum thread number allowed = %d\n",nco_prg_nm_get(),thr_nbr,thr_nbr_max);
       thr_nbr_rqs=thr_nbr_max; /* [nbr] Number of threads to request */
@@ -137,21 +137,29 @@ nco_openmp_ini /* [fnc] Initialize OpenMP threading environment */
       break;
     case ncks: 
       // 20150529: Turn-on OpenMP for regridder
-      thr_nbr_max_fsh=8;
+      thr_nbr_max_fsh=16;
       break;
     case ncwa: 
       // 20150530: Turn-on OpenMP for debugging
-      // 20150610: 8 threads with ncwa seemed to work for a little while, but then got flaky. Turned-off for 4.5.0 release
-      // thr_nbr_max_fsh=8;
+      // 20150610: Eight threads with ncwa seemed to work for a little while, then it got flaky. Turned-off for 4.5.0 release
+      // 20150622: Allowing eight threads again for debugging with -D 3
+      // 20150701: Firmly established that netCDF4 involvement hoses threading because HDF5 is not threadsafe by default
+      // 20150710: Turned-off for 4.5.1 release
+      // Symptoms of bugs, if any, show up with
+      // cd ~/nco/bm;nco_bm.pl --regress ncwa;cd -
       thr_nbr_max_fsh=1;
+      if(nco_dbg_lvl_get() >= nco_dbg_scl) thr_nbr_max_fsh=1;
       break;
       /* Operators with higher maximum pre-set thread limit (NB: not all of these are threaded!) */
+    case ncra:
+      thr_nbr_max_fsh=1;
+      if(nco_dbg_lvl_get() >= nco_dbg_scl) thr_nbr_max_fsh=1;
+      break;
     case ncbo: 
     case ncatted: 
     case ncfe:
     case ncflint: 
     case ncpdq: 
-    case ncra:
     case ncrename: 
     case ncge:
       // 20140219: Turn-off OpenMP until thoroughly tested
@@ -163,9 +171,9 @@ nco_openmp_ini /* [fnc] Initialize OpenMP threading environment */
     
     /* Automatic algorithm tries to play nice with others */
     (void)omp_set_dynamic(dyn_thr); /* [flg] Allow system to dynamically set number of threads */
-    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(fp_stderr,"%s: INFO %s OS to dynamically set threads\n",nco_prg_nm_get(),(dyn_thr ? "Allowing" : "Not allowing"));
+    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(fp_stderr,"%s: INFO omp_set_dynamic() used to %s OS to dynamically set threads\n",nco_prg_nm_get(),(dyn_thr ? "ALLOW" : "DISALLOW"));
     dyn_thr=omp_get_dynamic(); /* [flg] Allow system to dynamically set number of threads */
-    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(fp_stderr,"%s: INFO System will%s utilize dynamic threading\n",nco_prg_nm_get(),(dyn_thr ? "" : " not"));
+    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(fp_stderr,"%s: INFO omp_get_dynamic() reports system will%s utilize dynamic threading\n",nco_prg_nm_get(),(dyn_thr ? "" : " NOT"));
 
     /* Apply program/system limitations */
     if(thr_nbr_max > thr_nbr_max_fsh){
@@ -175,7 +183,7 @@ nco_openmp_ini /* [fnc] Initialize OpenMP threading environment */
   } /* !USR_SPC_THR_RQS */
 
 #ifdef ENABLE_NETCDF4
-  if(nco_prg_id_get() != ncks && nco_prg_id_get() != ncwa && thr_nbr_rqs > 1){
+  if(nco_prg_id_get() != ncks && nco_prg_id_get() != ncwa && nco_prg_id_get() != ncra && thr_nbr_rqs > 1){
     if(USR_SPC_THR_RQS && nco_dbg_lvl_get() >= nco_dbg_fl) (void)fprintf(stdout,"%s: WARNING This is TODO nco939. Requested threading with netCDF4 (HDF5) support. The NCO thread request algorithm considers user-input, environment variables, and software and hardware limitations in determining the number of threads to request, thr_nbr_rqs. At this point NCO would request result %d threads from a netCDF3-based library. However, this NCO was built with netCDF4, which relies on HDF5. netCDF4 [...]
     thr_nbr_rqs=1;
   } /* endif */
@@ -207,7 +215,7 @@ nco_openmp_ini /* [fnc] Initialize OpenMP threading environment */
   
   /* Issue any warnings about OpenMP credibility during debugging phase */
   if(True)
-    if(nco_prg_id_get() == ncwa && thr_nbr_act > 1)
+     if((nco_prg_id_get() == ncwa || nco_prg_id_get() == ncra) && thr_nbr_act > 1)
       if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(fp_stderr,"%s: WARNING OpenMP threading active with %d threads but not guaranteed to work on this operator. If strange behavior (e.g., NaN results) ensues, manually turn-off multi-threading by specifying \"-t 1\" option.\n",nco_prg_nm_get(),thr_nbr_act);
 
   return thr_nbr_act; /* O [nbr] Number of threads NCO uses */
diff --git a/src/nco/nco_ppc.c b/src/nco/nco_ppc.c
index 7805a9f..aa2e516 100644
--- a/src/nco/nco_ppc.c
+++ b/src/nco/nco_ppc.c
@@ -729,7 +729,8 @@ nco_ppc_bitmask_scl /* [fnc] Round input value significand by specified number o
   unsigned long int *u64_ptr;
   unsigned long int msk_f64_u64_zro;
   assert(bit_xpl_nbr_zro >= 0 && bit_xpl_nbr_zro <= bit_xpl_nbr_sgn_dbl-NCO_PPC_BIT_XPL_NBR_MIN);
-
+  CEWI_unused(bit_xpl_nbr_sgn_dbl);
+  
   val_rnd=val_xct;
   msk_f64_u64_zro=0ul; /* Zero all bits */
   msk_f64_u64_zro=~msk_f64_u64_zro; /* Turn all bits to ones */
diff --git a/src/nco/nco_prn.c b/src/nco/nco_prn.c
index e250b0f..40eb551 100644
--- a/src/nco/nco_prn.c
+++ b/src/nco/nco_prn.c
@@ -2158,8 +2158,6 @@ nco_grp_prn /* [fnc] Recursively print group contents */
   dmn_nbr=0; /* [nbr] Number of dimensions defined in group */
   var_nbr_xtr=0; /* [nbr] Number of variables to be extracted in group */
 
-  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: DEBUG qrk5 nm = %s xtr = %s\n",nco_prg_nm_get(),trv_tbl->lst[1].nm_fll,(trv_tbl->lst[1].flg_xtr) ? "Yes" : "No");
-
   /* Find group in traversal table */
   for(obj_idx=0;obj_idx<trv_tbl->nbr;obj_idx++)
     if(trv_tbl->lst[obj_idx].nco_typ == nco_obj_typ_grp)
@@ -2241,8 +2239,6 @@ nco_grp_prn /* [fnc] Recursively print group contents */
   /* Create array to hold names and indices of extracted variables in this group */
   var_lst=(nm_id_sct *)nco_malloc(nbr_var*(sizeof(nm_id_sct)));
 
-  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: DEBUG qrk6 nm = %s xtr = %s\n",nco_prg_nm_get(),trv_tbl->lst[1].nm_fll,(trv_tbl->lst[1].flg_xtr) ? "Yes" : "No");
-
   for(var_idx=0;var_idx<nbr_var;var_idx++){
     /* Get variable name */
     rcd+=nco_inq_varname(grp_id,var_idx,var_nm);
@@ -2279,8 +2275,6 @@ nco_grp_prn /* [fnc] Recursively print group contents */
 
   } /* end loop over variables */
 
-  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: DEBUG qrk7 nm = %s xtr = %s\n",nco_prg_nm_get(),trv_tbl->lst[1].nm_fll,(trv_tbl->lst[1].flg_xtr) ? "Yes" : "No");
-
   /* Compactify array to hold names and indices of extracted variables in this group */
   var_lst=(nm_id_sct *)nco_realloc(var_lst,var_nbr_xtr*(sizeof(nm_id_sct)));
 
diff --git a/src/nco/nco_rgr.c b/src/nco/nco_rgr.c
index 140cda0..fcda70e 100644
--- a/src/nco/nco_rgr.c
+++ b/src/nco/nco_rgr.c
@@ -124,7 +124,7 @@ nco_rgr_ini /* [fnc] Initialize regridding structure */
      T42->T42 from scratch:
      ncks -O --rgr=Y --rgr_grd_src=${DATA}/scrip/grids/remap_grid_T42.nc --rgr_grd_dst=${DATA}/scrip/grids/remap_grid_T42.nc --rgr_out=${DATA}/rgr/rgr_out.nc ${DATA}/rgr/essgcm14_clm.nc ~/foo.nc
      T42->POP43 from existing weights:
-     ncks -O --rgr=Y --rgr_map=${DATA}/scrip/rmp_T42_to_POP43_conserv.nc --rgr_out=${DATA}/rgr/rgr_out.nc ${DATA}/rgr/essgcm14_clm.nc ~/foo.nc */
+     ncks -O --map=${DATA}/scrip/rmp_T42_to_POP43_conserv.nc ${DATA}/rgr/essgcm14_clm.nc ~/foo.nc */
 
   const char fnc_nm[]="nco_rgr_ini()";
   
@@ -320,13 +320,15 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 {
   /* Purpose: Regrid fields using external weights (i.e., a mapping file)
 
-     Examine SCRIP remap file:
-     ncks --cdl -m ${DATA}/scrip/rmp_T42_to_POP43_conserv.nc | m
+     Examine ESMF, SCRIP, Tempest map-files:
+     ncks --cdl -M -m ${DATA}/scrip/rmp_T42_to_POP43_conserv.nc | m
+     ncks --cdl -M -m ${DATA}/maps/map_t42_to_fv129x256_aave.20150621.nc | m
+     ncks --cdl -M -m ${DATA}/maps/map_ne30np4_to_ne120np4_tps.20150618.nc | m
 
-     Test SCRIP remapping file:
-     ncks -D 6 -O --rgr=Y --rgr_map=${DATA}/scrip/rmp_T42_to_POP43_conserv.nc ${DATA}/rgr/essgcm14_clm.nc ~/foo.nc
-     Test ESMF remapping file:
-     ncks -D 6 -O --rgr=Y --rgr_map=${DATA}/rgr/map_ne120np4_to_181x360_aave.nc ${DATA}/rgr/essgcm14_clm.nc ~/foo.nc
+     Test ESMF, SCRIP, Tempest map-files:
+     ncks -D 5 -O --map=${DATA}/scrip/rmp_T42_to_POP43_conserv.nc ${DATA}/rgr/essgcm14_clm.nc ~/foo.nc
+     ncks -D 5 -O --map=${DATA}/maps/map_t42_to_fv129x256_aave.20150621.nc ${DATA}/rgr/essgcm14_clm.nc ~/foo.nc
+     ncks -D 5 -O --map=${DATA}/maps/map_ne30np4_to_ne120np4_tps.20150618.nc ${DATA}/ne30/rgr/ne30_1D.nc ~/foo.nc
  
      Conventions:
      grid_size: Number of grid cells (product of lat*lon)
@@ -413,13 +415,15 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   rcd+=nco_fl_open(fl_in,md_open,&bfr_sz_hnt,&in_id);
 
   /* Identify mapping file type
+     Generated by ESMF_Regridder: conventions = "NCAR-CSM"
      Generated by SCRIP: conventions = "SCRIP"
-     Generated by ESMF_Regridder: conventions = "NCAR-CSM" */
+     Generated by Tempest: Title = "TempestRemap Offline Regridding Weight Generator" */
   char *att_val;
   char *cnv_sng=NULL_CEWI;
   /* netCDF standard is uppercase Conventions, though some models user lowercase */
   char cnv_sng_UC[]="Conventions"; /* Unidata standard     string (uppercase) */
   char cnv_sng_LC[]="conventions"; /* Unidata non-standard string (lowercase) */
+  char cnv_sng_tps[]="Title"; /* Tempest does not yet use convention (lowercase) */
   
   long att_sz;
 
@@ -436,16 +440,21 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     cnv_sng=cnv_sng_LC;
     rcd=nco_inq_att_flg(in_id,NC_GLOBAL,cnv_sng,&att_typ,&att_sz);
   } /* endif lowercase */
+  if(rcd != NC_NOERR){
+    /* Re-try with Tempest */
+    cnv_sng=cnv_sng_tps;
+    rcd=nco_inq_att_flg(in_id,NC_GLOBAL,cnv_sng,&att_typ,&att_sz);
+  } /* endif Tempest */
   
   if(rcd == NC_NOERR && att_typ == NC_CHAR){
-    /* Add one for NUL byte */
     att_val=(char *)nco_malloc(att_sz*nco_typ_lng(att_typ)+1L);
     rcd+=nco_get_att(in_id,NC_GLOBAL,cnv_sng,att_val,att_typ);
-    /* NUL-terminate convention attribute before using strcmp() */
+    /* NUL-terminate attribute before using strstr() */
     att_val[att_sz]='\0';
     /* ESMF conventions */
     if(strstr(att_val,"NCAR-CSM")) nco_rgr_mpf_typ=nco_rgr_mpf_ESMF;
     if(strstr(att_val,"SCRIP")) nco_rgr_mpf_typ=nco_rgr_mpf_SCRIP;
+    if(strstr(att_val,"Tempest")) nco_rgr_mpf_typ=nco_rgr_mpf_Tempest;
     if(nco_rgr_mpf_typ == nco_rgr_mpf_nil) (void)fprintf(stderr,"%s: ERROR %s unrecognized map-type specified in attribute Conventions = %s\n",nco_prg_nm_get(),fnc_nm,att_val);
     if(att_val) att_val=(char *)nco_free(att_val);
   } /* end rcd && att_typ */
@@ -462,6 +471,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     rcd+=nco_inq_dimid(in_id,"num_wgts",&num_wgts_id);
   break;
   case nco_rgr_mpf_ESMF:
+  case nco_rgr_mpf_Tempest:
     rcd+=nco_inq_dimid(in_id,"n_a",&src_grid_size_id);
     rcd+=nco_inq_dimid(in_id,"n_b",&dst_grid_size_id);
     rcd+=nco_inq_dimid(in_id,"nv_a",&src_grid_corners_id);
@@ -469,13 +479,18 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     rcd+=nco_inq_dimid(in_id,"src_grid_rank",&src_grid_rank_id);
     rcd+=nco_inq_dimid(in_id,"dst_grid_rank",&dst_grid_rank_id);
     rcd+=nco_inq_dimid(in_id,"n_s",&num_links_id);
-    rcd+=nco_inq_dimid(in_id,"num_wgts",&num_wgts_id);
+    if(nco_rgr_mpf_typ != nco_rgr_mpf_Tempest) rcd+=nco_inq_dimid(in_id,"num_wgts",&num_wgts_id);
     break;
   default:
-    (void)fprintf(stderr,"%s: ERROR %s unknown map file type\n",nco_prg_nm_get(),fnc_nm);
-    nco_dfl_case_generic_err(); break;
+    (void)fprintf(stderr,"%s: ERROR %s unknown map-file type\n",nco_prg_nm_get(),fnc_nm);
+    nco_dfl_case_generic_err();
+    /* NB: This return never executes because nco_dfl_case_generic_err() calls exit()
+       Return placed here to suppress clang -Wsometimes-uninitialized warnings
+       This is done many other times throughout the code, though explained only once, here */
+    return NCO_ERR;
+    break;
   } /* end switch */
-    
+
   /* Now we have dimension IDs, get dimension sizes */
   rcd+=nco_inq_dimlen(in_id,src_grid_size_id,&rgr_map.src_grid_size);
   rcd+=nco_inq_dimlen(in_id,dst_grid_size_id,&rgr_map.dst_grid_size);
@@ -484,7 +499,9 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   rcd+=nco_inq_dimlen(in_id,src_grid_rank_id,&rgr_map.src_grid_rank);
   rcd+=nco_inq_dimlen(in_id,dst_grid_rank_id,&rgr_map.dst_grid_rank);
   rcd+=nco_inq_dimlen(in_id,num_links_id,&rgr_map.num_links);
-  rcd+=nco_inq_dimlen(in_id,num_wgts_id,&rgr_map.num_wgts);
+  /* TempestRemap does not generate num_wgts */
+  if(nco_rgr_mpf_typ == nco_rgr_mpf_Tempest) rgr_map.num_wgts=int_CEWI; else rcd+=nco_inq_dimlen(in_id,num_wgts_id,&rgr_map.num_wgts); 
+  assert(rgr_map.src_grid_size < INT_MAX && rgr_map.dst_grid_size < INT_MAX);
   
   cnv_sng=strdup("normalization");
   nco_rgr_nrm_typ_enm nco_rgr_nrm_typ=nco_rgr_nrm_nil;
@@ -493,16 +510,19 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     /* Add one for NUL byte */
     att_val=(char *)nco_malloc(att_sz*nco_typ_lng(att_typ)+1L);
     rcd+=nco_get_att(in_id,NC_GLOBAL,cnv_sng,att_val,att_typ);
-  } /* endif */
-  /* NUL-terminate convention attribute before using strcmp() */
-  att_val[att_sz]='\0';
-  if(strstr(att_val,"fracarea")) nco_rgr_nrm_typ=nco_rgr_nrm_fracarea;
-  if(strstr(att_val,"destarea")) nco_rgr_nrm_typ=nco_rgr_nrm_destarea;
-  if(strstr(att_val,"none")) nco_rgr_nrm_typ=nco_rgr_nrm_none;
-  assert(nco_rgr_nrm_typ == nco_rgr_nrm_destarea);
-  if(att_val) att_val=(char *)nco_free(att_val);
+    /* NUL-terminate attribute before using strstr() */
+    att_val[att_sz]='\0';
+    if(strstr(att_val,"fracarea")) nco_rgr_nrm_typ=nco_rgr_nrm_fracarea;
+    if(strstr(att_val,"destarea")) nco_rgr_nrm_typ=nco_rgr_nrm_destarea;
+    if(strstr(att_val,"none")) nco_rgr_nrm_typ=nco_rgr_nrm_none;
+    assert(nco_rgr_nrm_typ == nco_rgr_nrm_destarea);
+    if(att_val) att_val=(char *)nco_free(att_val);
+  }else{
+    /* Tempest does not (yet) store a normalization attribute */
+    if(nco_rgr_mpf_typ == nco_rgr_mpf_Tempest) nco_rgr_nrm_typ=nco_rgr_nrm_unknown;
+  } /* endif normalization */
+  assert(nco_rgr_nrm_typ != nco_rgr_nrm_nil);
   if(cnv_sng) cnv_sng=(char *)nco_free(cnv_sng);
-  assert(rgr_map.src_grid_size < INT_MAX && rgr_map.dst_grid_size < INT_MAX);
 
   cnv_sng=strdup("map_method");
   nco_rgr_mth_typ_enm nco_rgr_mth_typ=nco_rgr_mth_nil;
@@ -511,19 +531,22 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     /* Add one for NUL byte */
     att_val=(char *)nco_malloc(att_sz*nco_typ_lng(att_typ)+1L);
     rcd+=nco_get_att(in_id,NC_GLOBAL,cnv_sng,att_val,att_typ);
+    /* NUL-terminate attribute before using strstr() */
+    att_val[att_sz]='\0';
+    if(strstr(att_val,"Conservative remapping")) nco_rgr_mth_typ=nco_rgr_mth_conservative;
+    if(strstr(att_val,"Bilinear remapping")) nco_rgr_mth_typ=nco_rgr_mth_bilinear;
+    if(strstr(att_val,"none")) nco_rgr_mth_typ=nco_rgr_mth_none;
+    if(att_val) att_val=(char *)nco_free(att_val);
+  }else{
+    /* Tempest does not (yet) store a map_method attribute */
+    if(nco_rgr_mpf_typ == nco_rgr_mpf_Tempest) nco_rgr_mth_typ=nco_rgr_mth_unknown;
   } /* endif */
-  /* NUL-terminate convention attribute before using strcmp() */
-  att_val[att_sz]='\0';
-  if(strstr(att_val,"Conservative remapping")) nco_rgr_mth_typ=nco_rgr_mth_conservative;
-  if(strstr(att_val,"Bilinear remapping")) nco_rgr_mth_typ=nco_rgr_mth_bilinear;
-  if(strstr(att_val,"none")) nco_rgr_mth_typ=nco_rgr_mth_none;
   assert(nco_rgr_mth_typ != nco_rgr_mth_nil);
-  if(att_val) att_val=(char *)nco_free(att_val);
   if(cnv_sng) cnv_sng=(char *)nco_free(cnv_sng);
 
   if(nco_dbg_lvl_get() >= nco_dbg_scl){
     (void)fprintf(stderr,"%s: INFO %s regridding input metadata and grid sizes: ",nco_prg_nm_get(),fnc_nm);
-    (void)fprintf(stderr,"map_method = %s, normalization = %s, src_grid_size = %li, dst_grid_size = %li, src_grid_corners = %li, dst_grid_corners = %li, src_grid_rank = %li, dst_grid_rank = %li, num_links = %li, num_wgts = %li\n",nco_rgr_mth_sng(nco_rgr_mth_typ),nco_rgr_nrm_sng(nco_rgr_nrm_typ),rgr_map.src_grid_size,rgr_map.dst_grid_size,rgr_map.src_grid_corners,rgr_map.dst_grid_corners,rgr_map.src_grid_rank,rgr_map.dst_grid_rank,rgr_map.num_links,rgr_map.num_wgts);
+    (void)fprintf(stderr,"mapfile_generator = %s, map_method = %s, normalization = %s, src_grid_size = n_a = %li, dst_grid_size = n_b = %li, src_grid_corners = nv_a = %li, dst_grid_corners = nv_b = %li, src_grid_rank = %li, dst_grid_rank = %li, num_links = n_s = %li, num_wgts = %li\n",nco_rgr_mpf_sng(nco_rgr_mpf_typ),nco_rgr_mth_sng(nco_rgr_mth_typ),nco_rgr_nrm_sng(nco_rgr_nrm_typ),rgr_map.src_grid_size,rgr_map.dst_grid_size,rgr_map.src_grid_corners,rgr_map.dst_grid_corners,rgr_map.src_g [...]
   } /* endif dbg */
 
   /* Set type of grid conversion */
@@ -551,6 +574,8 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   int dst_grd_crn_lon_id; /* [id] Destination grid corner longitudes variable ID */
   int dst_grd_ctr_lat_id; /* [id] Destination grid center latitudes  variable ID */
   int dst_grd_ctr_lon_id; /* [id] Destination grid center longitudes variable ID */
+  int frc_dst_id; /* [id] Fraction variable ID */
+  int msk_dst_id; /* [id] Mask variable ID */
   int row_dst_adr_id; /* [id] Destination address (row) variable ID */
   int wgt_raw_id; /* [id] Remap matrix variable ID */
 
@@ -562,51 +587,89 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     rcd+=nco_inq_varid(in_id,"dst_grid_center_lat",&dst_grd_ctr_lat_id); /* ESMF: yc_b */
     rcd+=nco_inq_varid(in_id,"dst_grid_corner_lon",&dst_grd_crn_lon_id); /* ESMF: xv_b */
     rcd+=nco_inq_varid(in_id,"dst_grid_corner_lat",&dst_grd_crn_lat_id); /* ESMF: yv_b */
+    rcd+=nco_inq_varid(in_id,"dst_grid_frac",&frc_dst_id); /* ESMF: frac_b */
     rcd+=nco_inq_varid(in_id,"dst_address",&row_dst_adr_id); /* ESMF: row */
     rcd+=nco_inq_varid(in_id,"src_address",&col_src_adr_id); /* ESMF: col */
     rcd+=nco_inq_varid(in_id,"remap_matrix",&wgt_raw_id); /* fxm: remap_matrix[num_links,num_wgts] != S[n_s] */
     break;
   case nco_rgr_mpf_ESMF:
+  case nco_rgr_mpf_Tempest:
     rcd+=nco_inq_varid(in_id,"area_b",&area_dst_id); /* SCRIP: dst_grid_area */
     rcd+=nco_inq_varid(in_id,"xc_b",&dst_grd_ctr_lon_id); /* SCRIP: dst_grid_center_lon */
     rcd+=nco_inq_varid(in_id,"yc_b",&dst_grd_ctr_lat_id); /* SCRIP: dst_grid_center_lat */
     rcd+=nco_inq_varid(in_id,"xv_b",&dst_grd_crn_lon_id); /* SCRIP: dst_grid_corner_lon */
     rcd+=nco_inq_varid(in_id,"yv_b",&dst_grd_crn_lat_id); /* SCRIP: dst_grid_corner_lat */
+    rcd+=nco_inq_varid(in_id,"frac_b",&frc_dst_id); /* SCRIP: dst_grid_frac */
     rcd+=nco_inq_varid(in_id,"row",&row_dst_adr_id); /* SCRIP: dst_address */
     rcd+=nco_inq_varid(in_id,"col",&col_src_adr_id); /* SCRIP: src_address */
     rcd+=nco_inq_varid(in_id,"S",&wgt_raw_id); /* fxm: remap_matrix[num_links,num_wgts] != S[n_s] */
     break;
   default:
     (void)fprintf(stderr,"%s: ERROR %s unknown map file type\n",nco_prg_nm_get(),fnc_nm);
-    nco_dfl_case_generic_err(); break;
+    nco_dfl_case_generic_err();
+    /* NB: This return never executes because nco_dfl_case_generic_err() calls exit()
+       Return placed here to suppress clang -Wsometimes-uninitialized warnings
+       This is done many other times throughout the code, though explained only once, here */
+    return NCO_ERR;
+    break;
   } /* end switch */
+  /* Obtain fields whose presence depends on mapfile type */
+  if(nco_rgr_mpf_typ == nco_rgr_mpf_ESMF){
+    rcd+=nco_inq_varid(in_id,"mask_b",&msk_dst_id); /* SCRIP: dst_grid_imask */
+  }else if(nco_rgr_mpf_typ == nco_rgr_mpf_SCRIP){
+    rcd+=nco_inq_varid(in_id,"dst_grid_imask",&msk_dst_id); /* ESMF: mask_b */
+  }else{ /* !SCRIP */
+    msk_dst_id=NC_MIN_INT;
+  } /* !Tempest */
   /* Obtain fields whose name is independent of mapfile type */
   rcd+=nco_inq_varid(in_id,"src_grid_dims",&dmn_sz_in_int_id);
   rcd+=nco_inq_varid(in_id,"dst_grid_dims",&dmn_sz_out_int_id);
 
-  const int lon_psn_dst=0; /* [idx] Ordinal position of longitude size in rectangular destination grid */
-  const int lat_psn_dst=1; /* [idx] Ordinal position of latitude  size in rectangular destination grid */
+  int lon_psn_src; /* [idx] Ordinal position of longitude size in rectangular source grid */
+  int lat_psn_src; /* [idx] Ordinal position of latitude  size in rectangular source grid */
+  int lon_psn_dst=int_CEWI; /* [idx] Ordinal position of longitude size in rectangular destination grid */
+  int lat_psn_dst=int_CEWI; /* [idx] Ordinal position of latitude  size in rectangular destination grid */
+  if(flg_grd_in_2D){
+    if(nco_rgr_mpf_typ == nco_rgr_mpf_Tempest){
+      lon_psn_src=1;
+      lat_psn_src=0;
+    }else{
+      lon_psn_src=0;
+      lat_psn_src=1;
+    } /* !Tempest */
+  } /* !flg_grd_in_2D */
+  if(flg_grd_out_2D){
+    if(nco_rgr_mpf_typ == nco_rgr_mpf_Tempest){
+      lon_psn_dst=1;
+      lat_psn_dst=0;
+    }else{
+      lon_psn_dst=0;
+      lat_psn_dst=1;
+    } /* !Tempest */
+  } /* !flg_grd_out_2D */
   const int dmn_nbr_1D=1; /* [nbr] Rank of 1-D grid variables */
   const int dmn_nbr_2D=2; /* [nbr] Rank of 2-D grid variables */
   const int dmn_nbr_grd_max=dmn_nbr_2D; /* [nbr] Maximum rank of grid variables */
   double *area_out; /* [sr] Area of destination grid */
-  double *lon_ctr_out; /* [dgr] Longitude centers of rectangular destination grid */
-  double *lat_ctr_out; /* [dgr] Latitude  centers of rectangular destination grid */
+  double *frc_out; /* [frc] Fraction of destination grid */
+  double *lat_bnd_out=NULL_CEWI; /* [dgr] Latitude  boundaries of rectangular destination grid */
+  double *lat_crn_out=NULL; /* [dgr] Latitude  corners of rectangular destination grid */
+  double *lat_ctr_out=NULL_CEWI; /* [dgr] Latitude  centers of rectangular destination grid */
+  double *lat_ntf_out=NULL; /* [dgr] Latitude  interfaces of rectangular destination grid */
   double *lat_wgt_out=NULL; /* [dgr] Latitude  weights of rectangular destination grid */
+  double *lon_bnd_out=NULL_CEWI; /* [dgr] Longitude boundaries of rectangular destination grid */
   double *lon_crn_out=NULL; /* [dgr] Longitude corners of rectangular destination grid */
-  double *lat_crn_out=NULL; /* [dgr] Latitude  corners of rectangular destination grid */
+  double *lon_ctr_out=NULL_CEWI; /* [dgr] Longitude centers of rectangular destination grid */
   double *lon_ntf_out=NULL; /* [dgr] Longitude interfaces of rectangular destination grid */
-  double *lat_ntf_out=NULL; /* [dgr] Latitude  interfaces of rectangular destination grid */
-  double *lon_bnd_out; /* [dgr] Longitude boundaries of rectangular destination grid */
-  double *lat_bnd_out; /* [dgr] Latitude  boundaries of rectangular destination grid */
   double *wgt_raw; /* [frc] Remapping weights */
   int *col_src_adr; /* [idx] Source address (col) */
   int *row_dst_adr; /* [idx] Destination address (row) */
+  int *msk_out; /* [flg] Mask of destination grid */
   int *dmn_sz_in_int; /* [nbr] Array of dimension sizes of source grid */
   int *dmn_sz_out_int; /* [nbr] Array of dimension sizes of destination grid */
-  long *dmn_cnt;
-  long *dmn_srt;
-  long *dmn_srd;
+  long *dmn_cnt=NULL;
+  long *dmn_srt=NULL;
+  long *dmn_srd=NULL;
   long idx; /* [idx] Counting index for unrolled grids */
     
   /* Allocate space to hold dimension metadata for rectangular destination grid */
@@ -623,50 +686,64 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   dmn_sz_out_int=(int *)nco_malloc(rgr_map.dst_grid_rank*nco_typ_lng((nc_type)NC_INT));
   rcd=nco_get_vara(in_id,dmn_sz_out_int_id,dmn_srt,dmn_cnt,dmn_sz_out_int,(nc_type)NC_INT);
 
+  if(nco_rgr_mpf_typ == nco_rgr_mpf_Tempest){
+    /* Check-for and workaround faulty Tempest grid sizes */
+    if(flg_grd_in_1D && (rgr_map.src_grid_size != dmn_sz_in_int[0])){
+      (void)fprintf(stdout,"%s: WARNING %s input grid dimension sizes disagree rgr_map.src_grid_size = %ld != %d = dmn_sz_in[0]. Problem may be caused by incorrect src_grid_dims variable in Tempest mapfile. Attempting workaround ...\n",nco_prg_nm_get(),fnc_nm,rgr_map.src_grid_size,dmn_sz_in_int[0]);
+      dmn_sz_in_int[0]=rgr_map.src_grid_size;
+    } /* !bug */
+    if(flg_grd_out_1D && (rgr_map.dst_grid_size != dmn_sz_out_int[0])){
+      (void)fprintf(stdout,"%s: WARNING %s output grid dimension sizes disagree rgr_map.dst_grid_size = %ld != %d = dmn_sz_out[0]. Problem may be caused by incorrect dst_grid_dims variable in Tempest mapfile. Attempting workaround ...\n",nco_prg_nm_get(),fnc_nm,rgr_map.dst_grid_size,dmn_sz_out_int[0]);
+      dmn_sz_out_int[0]=rgr_map.dst_grid_size;
+    } /* !bug */
+  } /* !Tempest */
+ 
+  long col_nbr_in; /* [idx] Number of columns in source grid */
   long lon_nbr_in; /* [idx] Number of longitudes in rectangular source grid */
   long lat_nbr_in; /* [idx] Number of latitudes  in rectangular source grid */
-  long ncol_nbr_in; /* [idx] Number of columns in source grid */
   if(flg_grd_in_1D){
+    col_nbr_in=dmn_sz_in_int[0];
     lon_nbr_in=dmn_sz_in_int[0];
     lat_nbr_in=dmn_sz_in_int[0];
-    ncol_nbr_in=dmn_sz_in_int[0];
   }else if(flg_grd_in_2D){
-    lon_nbr_in=dmn_sz_in_int[lon_psn_dst];
-    lat_nbr_in=dmn_sz_in_int[lat_psn_dst];
-    ncol_nbr_in=0;
+    col_nbr_in=0;
+    lon_nbr_in=dmn_sz_in_int[lon_psn_src];
+    lat_nbr_in=dmn_sz_in_int[lat_psn_src];
   } /* !src_grid_rank */
 
   const int bnd_tm_nbr_out=2; /* [nbr] Number of boundaries for output time */
-  int bnd_nbr_out; /* [nbr] Number of boundaries for output time and rectangular grid coordinates, and number of vertices for output non-rectangular grid coordinates */
-  long lon_nbr_out; /* [nbr] Number of longitudes in rectangular destination grid */
-  long lat_nbr_out; /* [nbr] Number of latitudes  in rectangular destination grid */
-  long ncol_nbr_out; /* [nbr] Number of columns in destination grid */
+  int bnd_nbr_out=int_CEWI; /* [nbr] Number of boundaries for output time and rectangular grid coordinates, and number of vertices for output non-rectangular grid coordinates */
+  long col_nbr_out; /* [nbr] Number of columns in destination grid */
+  long lon_nbr_out=long_CEWI; /* [nbr] Number of longitudes in rectangular destination grid */
+  long lat_nbr_out=long_CEWI; /* [nbr] Number of latitudes  in rectangular destination grid */
   if(flg_grd_out_1D){
-    bnd_nbr_out=rgr_map.dst_grid_corners; /* NB: this assumes rectangular latitude and longitude and is invalid for other quadrilaterals */
-    lon_nbr_out=dmn_sz_out_int[0];
+    bnd_nbr_out=rgr_map.dst_grid_corners;
+    col_nbr_out=dmn_sz_out_int[0];
     lat_nbr_out=dmn_sz_out_int[0];
-    ncol_nbr_out=dmn_sz_out_int[0];
+    lon_nbr_out=dmn_sz_out_int[0];
   }else if(flg_grd_out_2D){
-    bnd_nbr_out=2; /* NB: this assumes rectangular latitude and longitude and is invalid for other quadrilaterals */
-    lon_nbr_out=dmn_sz_out_int[lon_psn_dst];
+    bnd_nbr_out=2; /* NB: Assumes rectangular latitude and longitude and is invalid for other quadrilaterals */
+    col_nbr_out=0;
     lat_nbr_out=dmn_sz_out_int[lat_psn_dst];
-    ncol_nbr_out=0;
+    lon_nbr_out=dmn_sz_out_int[lon_psn_dst];
   } /* !dst_grid_rank */
 
   if(nco_dbg_lvl_get() >= nco_dbg_scl){
     (void)fprintf(stderr,"%s: INFO %s grid conversion type = %s with expected input and prescribed output grid sizes: ",nco_prg_nm_get(),fnc_nm,nco_rgr_grd_sng(nco_rgr_grd_typ));
-    (void)fprintf(stderr,"lat_in = %li, lon_in  %li, ncol_in = %li, lat_out = %li, lon_out = %li, ncol_out = %li\n",lat_nbr_in,lon_nbr_in,ncol_nbr_in,lat_nbr_out,lon_nbr_out,ncol_nbr_out);
+    (void)fprintf(stderr,"lat_in = %li, lon_in  %li, col_in = %li, lat_out = %li, lon_out = %li, col_out = %li\n",lat_nbr_in,lon_nbr_in,col_nbr_in,lat_nbr_out,lon_nbr_out,col_nbr_out);
   } /* endif dbg */
 
   /* Allocate space for and obtain coordinates and weights */
   nc_type crd_typ_out=NC_DOUBLE;
   area_out=(double *)nco_malloc(rgr_map.dst_grid_size*nco_typ_lng(crd_typ_out));
-
+  frc_out=(double *)nco_malloc(rgr_map.dst_grid_size*nco_typ_lng(crd_typ_out));
+  msk_out=(int *)nco_malloc(rgr_map.dst_grid_size*nco_typ_lng(NC_INT));
+  
   if(flg_grd_out_1D){
-    lon_ctr_out=(double *)nco_malloc(ncol_nbr_out*nco_typ_lng(crd_typ_out));
-    lat_ctr_out=(double *)nco_malloc(ncol_nbr_out*nco_typ_lng(crd_typ_out));
-    lon_bnd_out=(double *)nco_malloc(ncol_nbr_out*bnd_nbr_out*nco_typ_lng(crd_typ_out));
-    lat_bnd_out=(double *)nco_malloc(ncol_nbr_out*bnd_nbr_out*nco_typ_lng(crd_typ_out));
+    lon_ctr_out=(double *)nco_malloc(col_nbr_out*nco_typ_lng(crd_typ_out));
+    lat_ctr_out=(double *)nco_malloc(col_nbr_out*nco_typ_lng(crd_typ_out));
+    lon_bnd_out=(double *)nco_malloc(col_nbr_out*bnd_nbr_out*nco_typ_lng(crd_typ_out));
+    lat_bnd_out=(double *)nco_malloc(col_nbr_out*bnd_nbr_out*nco_typ_lng(crd_typ_out));
   } /* !flg_grd_out_1D */
   if(flg_grd_out_2D){
     lon_ctr_out=(double *)nco_malloc(lon_nbr_out*nco_typ_lng(crd_typ_out));
@@ -692,17 +769,17 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   rcd=nco_get_vara(in_id,area_dst_id,dmn_srt,dmn_cnt,area_out,crd_typ_out);
   if(flg_grd_out_1D){
     dmn_srt[0]=0L;
-    dmn_cnt[0]=ncol_nbr_out;
+    dmn_cnt[0]=col_nbr_out;
     rcd=nco_get_vara(in_id,dst_grd_ctr_lon_id,dmn_srt,dmn_cnt,lon_ctr_out,crd_typ_out);
     dmn_srt[0]=0L;
-    dmn_cnt[0]=ncol_nbr_out;
+    dmn_cnt[0]=col_nbr_out;
     rcd=nco_get_vara(in_id,dst_grd_ctr_lat_id,dmn_srt,dmn_cnt,lat_ctr_out,crd_typ_out);
     dmn_srt[0]=dmn_srt[1]=0L;
-    dmn_cnt[0]=ncol_nbr_out;
+    dmn_cnt[0]=col_nbr_out;
     dmn_cnt[1]=bnd_nbr_out;
     rcd=nco_get_vara(in_id,dst_grd_crn_lon_id,dmn_srt,dmn_cnt,lon_bnd_out,crd_typ_out);
     dmn_srt[0]=dmn_srt[1]=0L;
-    dmn_cnt[0]=ncol_nbr_out;
+    dmn_cnt[0]=col_nbr_out;
     dmn_cnt[1]=bnd_nbr_out;
     rcd=nco_get_vara(in_id,dst_grd_crn_lat_id,dmn_srt,dmn_cnt,lat_bnd_out,crd_typ_out);
     if(nco_dbg_lvl_get() >= nco_dbg_crr){
@@ -782,6 +859,8 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   } /* !flg_grd_out_2D */
   
   if(flg_grd_out_2D){
+    long int lat_idx;
+    long int lon_idx;
 
     if(nco_dbg_lvl_get() >= nco_dbg_crr){
       for(idx=0;idx<lon_nbr_out;idx++) (void)fprintf(stdout,"lon[%li] = [%g, %g, %g]\n",idx,lon_bnd_out[2*idx],lon_ctr_out[idx],lon_bnd_out[2*idx+1]);
@@ -790,6 +869,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 
     /* Diagnose type of two-dimensional output grid by testing second latitude center against formulae */
     nco_grd_2D_typ_enm nco_grd_2D_typ=nco_grd_2D_nil; /* [enm] Two-dimensional grid-type enum */
+    nco_grd_xtn_enm nco_grd_xtn=nco_grd_xtn_glb; /* [enm] Extent of grid */
     const double lat_ctr_tst_ngl_eqi_pol=-90.0+180.0/(lat_nbr_out-1);
     const double lat_ctr_tst_ngl_eqi_fst=-90.0+180.0*1.5/lat_nbr_out;
     double lat_ctr_tst_gss;
@@ -813,12 +893,40 @@ nco_rgr_map /* [fnc] Regrid using external weights */
       if((float)lat_ctr_out[1] == (float)lat_ctr_tst_gss) nco_grd_2D_typ=nco_grd_2D_gss;
       if(lat_sin_out) lat_sin_out=(double *)nco_free(lat_sin_out);
     } /* !Gaussian */
+    if(nco_grd_2D_typ == nco_grd_2D_nil){
+      /* If still of unknown type, this 2D grid may be regional (not global) and rectangular
+	 Find latitude increment, check if apparently constant throughout grid */
+      double lat_ctr_ncr_srt; /* [dgr] First latitude increment */
+      double lat_ctr_ncr_end; /* [dgr] Last latitude increment */
+      lat_ctr_ncr_srt=lat_ctr_out[1]-lat_ctr_out[0];
+      lat_ctr_ncr_end=lat_ctr_out[lat_nbr_out-1]-lat_ctr_out[lat_nbr_out-2];
+      if(lat_ctr_ncr_srt == lat_ctr_ncr_end){
+	/* Type appears to be regular in latitude, check if it is consistent with regional equiangular grid */
+	if(lat_ctr_out[0]-lat_ctr_ncr_srt > -90.0 && lat_ctr_out[lat_nbr_out-1]+lat_ctr_ncr_end < 90.0){
+	  if((float)(lat_ctr_out[0]+((lat_nbr_out-1)*lat_ctr_ncr_srt)) == (float)lat_ctr_out[lat_nbr_out-1]){
+	    nco_grd_2D_typ=nco_grd_2D_ngl_eqi_pol;
+	    nco_grd_xtn=nco_grd_xtn_rgn;
+	  } /* !rct */
+	} /* !rgn */
+      } /* srt!=end */
+    } /* !RRM */
     if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: INFO %s diagnosed output latitude grid-type: %s\n",nco_prg_nm_get(),fnc_nm,nco_grd_2D_sng(nco_grd_2D_typ));
+    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: INFO %s diagnosed output grid-extent: %s\n",nco_prg_nm_get(),fnc_nm,nco_grd_xtn_sng(nco_grd_xtn));
     
     const double dgr2rdn=M_PI/180.0;
+    double lat_wgt_ttl=0.0; /* [frc] Actual sum of quadrature weights */
     switch(nco_grd_2D_typ){
     case nco_grd_2D_ngl_eqi_fst:
-      for(idx=0;idx<lat_nbr_out;idx++) lat_wgt_out[idx]=cos(dgr2rdn*lat_ctr_out[idx]);
+      /* Manually normalize polar offset grid latitude weights to sum to 2.0 for global extent */
+      for(idx=0;idx<lat_nbr_out;idx++){
+	if(nco_grd_xtn == nco_grd_xtn_glb){
+	  lat_wgt_out[idx]=cos(dgr2rdn*lat_ctr_out[idx]);
+	  lat_wgt_ttl+=lat_wgt_out[idx];
+	  lat_wgt_out[idx]*=2.0/lat_wgt_ttl;
+	}else{ /* !glb */
+	  lat_wgt_out[idx]=sin(dgr2rdn*lat_bnd_out[2*idx+1])-sin(dgr2rdn*lat_bnd_out[2*idx]);
+	} /* !glb */
+      } /* !idx */
       break;
     case nco_grd_2D_ngl_eqi_pol:
       for(idx=0;idx<lat_nbr_out;idx++) lat_wgt_out[idx]=sin(dgr2rdn*lat_bnd_out[2*idx+1])-sin(dgr2rdn*lat_bnd_out[2*idx]);
@@ -833,10 +941,28 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     } /* end nco_grd_2D_typ switch */
     
     /* Fuzzy test of latitude weight normalization */
-    const double eps_wgt_ttl=1.0e-14; /* [frc] Roundoff tolerance for sum of quadrature weights */
-    double lat_wgt_ttl=0.0; /* [frc] Actual sum of quadrature weights */
+    double lat_wgt_ttl_xpc; /* [frc] Expected sum of latitude weights */
+    lat_wgt_ttl=0.0;
     for(idx=0;idx<lat_nbr_out;idx++) lat_wgt_ttl+=lat_wgt_out[idx];
-    assert(1.0-lat_wgt_ttl/2.0 < eps_wgt_ttl);
+    lat_wgt_ttl_xpc=sin(dgr2rdn*lat_bnd_out[2*(lat_nbr_out-1)+1])-sin(dgr2rdn*lat_bnd_out[0]);
+    assert(1.0-lat_wgt_ttl/lat_wgt_ttl_xpc < 1.0e-14); /* [frc] Round-off tolerance for sum of quadrature weights */
+    
+    if(nco_grd_xtn == nco_grd_xtn_rgn){
+      /* 20150710: Tempest regionally refined grids like conus for ACME RRM may have area_out=0 */
+      if((bnd_nbr_out == 2 || bnd_nbr_out == 4) && nco_grd_2D_typ == nco_grd_2D_ngl_eqi_pol){ 
+	/* If area_out contains a zero... */
+	for(lat_idx=0;lat_idx<lat_nbr_out;lat_idx++)
+	  for(lon_idx=0;lon_idx<lon_nbr_out;lon_idx++)
+	    if(area_out[lat_idx*lon_nbr_out+lon_idx] == 0.0) break;
+	if(lat_idx != lat_nbr_out || lon_idx != lon_nbr_out){
+	  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stdout,"%s: INFO Regional regular rectangular grid detected with zero-valued output area(s). Likely a TempestRemap regional output grid. Creating area_out from analystic formula.\n",nco_prg_nm_get());
+	  /* Regular quadrilaterals on equiangular grids have areas Mr. Enenstein taught us */
+	  for(lat_idx=0;lat_idx<lat_nbr_out;lat_idx++)
+	    for(lon_idx=0;lon_idx<lon_nbr_out;lon_idx++)
+	      area_out[lat_idx*lon_nbr_out+lon_idx]=dgr2rdn*(lon_bnd_out[2*lon_idx+1]-lon_bnd_out[2*lon_idx])*(sin(dgr2rdn*lat_bnd_out[2*lat_idx+1])-sin(dgr2rdn*lat_bnd_out[2*lat_idx]));
+	} /* !zero */
+      } /* !quad */
+    } /* !rgn */
     
     if(nco_dbg_lvl_get() >= nco_dbg_sbr){
       (void)fprintf(stderr,"%s: INFO %s reports destination rectangular latitude grid:\n",nco_prg_nm_get(),fnc_nm);
@@ -845,16 +971,16 @@ nco_rgr_map /* [fnc] Regrid using external weights */
       area_out_ttl=0.0;
       for(idx=0;idx<lat_nbr_out;idx++)
 	lat_wgt_ttl+=lat_wgt_out[idx];
-      for(long int lat_idx=0;lat_idx<lat_nbr_out;lat_idx++)
-	for(long int lon_idx=0;lon_idx<lon_nbr_out;lon_idx++)
+      for(lat_idx=0;lat_idx<lat_nbr_out;lat_idx++)
+	for(lon_idx=0;lon_idx<lon_nbr_out;lon_idx++)
 	  area_out_ttl+=area_out[lat_idx*lon_nbr_out+lon_idx];
-      (void)fprintf(stdout,"lat_wgt_ttl = %20.15f, area_ttl = %20.15f\n",lat_wgt_ttl,area_out_ttl);
+      (void)fprintf(stdout,"lat_wgt_ttl = %20.15f, area_ttl = %20.15f, frc_lat_wgt = %20.15f, frc_area = %20.15f\n",lat_wgt_ttl,area_out_ttl,lat_wgt_ttl/2.0,area_out_ttl/(4.0*M_PI));
       for(idx=0;idx<lon_nbr_out;idx++) (void)fprintf(stdout,"lon[%li] = [%g, %g, %g]\n",idx,lon_bnd_out[2*idx],lon_ctr_out[idx],lon_bnd_out[2*idx+1]);
       for(idx=0;idx<lat_nbr_out;idx++) (void)fprintf(stdout,"lat[%li] = [%g, %g, %g]\n",idx,lat_bnd_out[2*idx],lat_ctr_out[idx],lat_bnd_out[2*idx+1]);
       for(idx=0;idx<lat_nbr_out;idx++) (void)fprintf(stdout,"lat[%li], wgt[%li] = %20.15f, %20.15f\n",idx,idx,lat_ctr_out[idx],lat_wgt_out[idx]);
       if(nco_dbg_lvl_get() > nco_dbg_crr)
-	for(long int lat_idx=0;lat_idx<lat_nbr_out;lat_idx++)
-	  for(long int lon_idx=0;lon_idx<lon_nbr_out;lon_idx++)
+	for(lat_idx=0;lat_idx<lat_nbr_out;lat_idx++)
+	  for(lon_idx=0;lon_idx<lon_nbr_out;lon_idx++)
 	    (void)fprintf(stdout,"lat[%li] = %g, lon[%li] = %g, area[%li,%li] = %g\n",lat_idx,lat_ctr_out[lat_idx],lon_idx,lon_ctr_out[lon_idx],lat_idx,lon_idx,area_out[lat_idx*lon_nbr_out+lon_idx]);
     } /* endif dbg */
   } /* !flg_grd_out_2D */
@@ -895,8 +1021,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   out_id=rgr->out_id;
 
   /* Do not extract extensive variables like lon, lat, and area
-     If necessary, create them from scratch from remap data
-     I decided not to include "date_written" and "time_written" in this list, this is debatable... */
+     If necessary, create them from scratch from remap data */
   const int var_xcl_lst_nbr=13; /* [nbr] Number of objects on exclusion list */
   const char *var_xcl_lst[]={"/area","/gridcell_area","/gw","/lat","/latitude","/lat_bnds","/lat_vertices","/bounds_lat","/lon","/longitude","/lon_bnds","/lon_vertices","/bounds_lon"};
   int var_cpy_nbr=0; /* [nbr] Number of copied variables */
@@ -910,7 +1035,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
       if(!strcmp(trv_tbl->lst[idx_tbl].nm_fll,var_xcl_lst[idx])) break;
     if(idx_tbl < trv_nbr){
       if(trv_tbl->lst[idx_tbl].flg_xtr){
-	if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(stdout,"%s: INFO automatically omitting (not copying or regridding from input) variable %s\n",nco_prg_nm_get(),trv_tbl->lst[idx_tbl].nm_fll);
+	if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(stdout,"%s: INFO automatically omitting (not copying or regridding from input) pre-defined exclusion-list variable %s\n",nco_prg_nm_get(),trv_tbl->lst[idx_tbl].nm_fll);
 	var_xcl_nbr++;
       } /* endif */
       trv_tbl->lst[idx_tbl].flg_xtr=False;
@@ -924,26 +1049,50 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   int dmn_idx; /* [idx] Dimension index */
   int dmn_nbr_in; /* [nbr] Number of dimensions in input variable */
   int dmn_nbr_out; /* [nbr] Number of dimensions in output variable */
+  nco_bool has_lon; /* [flg] Contains longitude dimension */
+  nco_bool has_lat; /* [flg] Contains latitude dimension */
   trv_sct trv; /* [sct] Traversal table object structure to reduce indirection */
   /* Define regridding flag for each variable */
   for(idx_tbl=0;idx_tbl<trv_nbr;idx_tbl++){
     trv=trv_tbl->lst[idx_tbl];
     dmn_nbr_in=trv_tbl->lst[idx_tbl].nbr_dmn;
     if(trv.nco_typ == nco_obj_typ_var && trv.flg_xtr){
+      has_lon=False;
+      has_lat=False;
+      if(flg_grd_in_2D){
+	for(dmn_idx=0;dmn_idx<dmn_nbr_in;dmn_idx++){
+	  /* Pre-determine flags necessary during next loop */
+	  dmn_nm_cp=trv.var_dmn[dmn_idx].dmn_nm;
+	  /* fxm: generalize to include any variable containing two coordinates with "standard_name" = "latitude" and "longitude" */
+	  if(!has_lon) has_lon=!strcmp(dmn_nm_cp,lon_nm);
+	  if(!has_lat) has_lat=!strcmp(dmn_nm_cp,lat_nm);
+	} /* end loop over dimensions */
+      } /* !flg_grd_in_2D */
       for(dmn_idx=0;dmn_idx<dmn_nbr_in;dmn_idx++){
 	dmn_nm_cp=trv.var_dmn[dmn_idx].dmn_nm;
-	/* Regrid variables containing a horizontal spatial dimension */
-	/* fxm: generalize to include any variable containing a dimension in a coordinate with "standard_name" = "latitude" or "longitude" */
-	if(!strcmp(dmn_nm_cp,col_nm) || !strcmp(dmn_nm_cp,lat_nm) || !strcmp(dmn_nm_cp,lon_nm)){
+	/* Regrid variables containing the horizontal spatial dimension on 1D grids, and both latitude and longitude on 2D grids */
+	if(!strcmp(dmn_nm_cp,col_nm) || (has_lon && has_lat)){
 	  trv_tbl->lst[idx_tbl].flg_rgr=True;
 	  var_rgr_nbr++;
 	  break;
 	} /* endif */
       } /* end loop over dimensions */
-      if(dmn_idx == dmn_nbr_in) var_cpy_nbr++;
+      if(dmn_idx == dmn_nbr_in){
+	/* Not regridded, so must be omitted or copied... */
+	if(flg_grd_in_2D && (has_lon || has_lat)){
+	/* Single spatial dimensional variables on 2D input grids are likely extensive (e.g., grd_mrd_lng from bds)
+	   They can only be salvaged with explicit rules or implicit assumptions */
+	  trv_tbl->lst[idx_tbl].flg_xtr=False;
+	  var_xcl_nbr++;
+	  if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(stdout,"%s: INFO automatically omitting (not copying or regridding from input) extensive-seeming (i.e., 1D spatial variable in 2D input grid) variable %s\n",nco_prg_nm_get(),trv_tbl->lst[idx_tbl].nm_fll);
+	}else{ /* !omitted */
+	  /* Copy all variables that are not regridded or omitted */
+	  var_cpy_nbr++;
+	} /* !omitted */
+      } /* endif not regridded */
     } /* end nco_obj_typ_var */
   } /* end idx_tbl */
-  if(!var_rgr_nbr) (void)fprintf(stdout,"%s: WARNING %s reports no variables fit regridding criteria\n",nco_prg_nm_get(),fnc_nm);
+  if(!var_rgr_nbr) (void)fprintf(stdout,"%s: WARNING %s reports no variables fit regridding criteria. The regridder expects something to regrid, and variables not regridded are copied straight to output. HINT: If the name(s) of the input horizontal spatial dimensions to be regridded (e.g., latitude and longitude or column) do not match NCO's preset defaults (case-insensitive unambiguous forms and abbreviations of \"latitude\", \"longitude\", and \"ncol\", respectively) then change the di [...]
   
   if(nco_dbg_lvl_get() >= nco_dbg_sbr){
     for(idx_tbl=0;idx_tbl<trv_nbr;idx_tbl++){
@@ -952,7 +1101,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     } /* end idx_tbl */
   } /* end dbg */
 
-  /* Layout regridded file */
+  /* Lay-out regridded file */
   aed_sct aed_mtd;
   char *area_nm_out;
   char *att_nm;
@@ -965,7 +1114,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   char *lon_bnd_nm_out;
   char *lon_nm_out;
   int dmn_id_lat; /* [id] Dimension ID */
-  int dmn_id_ncol; /* [id] Dimension ID */
+  int dmn_id_col; /* [id] Dimension ID */
   int dmn_id_lon; /* [id] Dimension ID */
   int dmn_id_bnd; /* [id] Dimension ID */
   int dmn_id_bnd_tm; /* [id] Dimension ID */
@@ -1015,7 +1164,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 
   /* Define new horizontal dimensions before all else */
   if(flg_grd_out_1D){
-    rcd=nco_def_dim(out_id,col_nm_out,ncol_nbr_out,&dmn_id_ncol);
+    rcd=nco_def_dim(out_id,col_nm_out,col_nbr_out,&dmn_id_col);
   } /* !flg_grd_out_1D */
   if(flg_grd_out_2D){
     rcd=nco_def_dim(out_id,lat_nm_out,lat_nbr_out,&dmn_id_lat);
@@ -1030,28 +1179,29 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 
   char dmn_nm[NC_MAX_NAME]; /* [sng] Dimension name */
   char *var_nm; /* [sng] Variable name */
-  int *dmn_id_in; /* [id] Dimension IDs */
-  int *dmn_id_out; /* [id] Dimension IDs */
+  int *dmn_id_in=NULL; /* [id] Dimension IDs */
+  int *dmn_id_out=NULL; /* [id] Dimension IDs */
   int var_id_in; /* [id] Variable ID */
   int var_id_out; /* [id] Variable ID */
-  nc_type var_typ; /* [enm] Variable type */
+  nc_type var_typ_out; /* [enm] Variable type to write to disk */
+  nc_type var_typ_rgr; /* [enm] Variable type used during regridding */
   nco_bool PCK_ATT_CPY=True; /* [flg] Copy attributes "scale_factor", "add_offset" */
 
   /* Define new coordinates and variables in regridded file */
   if(flg_grd_out_1D){
-    (void)nco_def_var(out_id,lat_nm_out,crd_typ_out,dmn_nbr_1D,&dmn_id_ncol,&lat_out_id);
+    (void)nco_def_var(out_id,lat_nm_out,crd_typ_out,dmn_nbr_1D,&dmn_id_col,&lat_out_id);
     var_crt_nbr++;
-    (void)nco_def_var(out_id,lon_nm_out,crd_typ_out,dmn_nbr_1D,&dmn_id_ncol,&lon_out_id);
+    (void)nco_def_var(out_id,lon_nm_out,crd_typ_out,dmn_nbr_1D,&dmn_id_col,&lon_out_id);
     var_crt_nbr++;
-    dmn_ids_out[0]=dmn_id_ncol;
+    dmn_ids_out[0]=dmn_id_col;
     dmn_ids_out[1]=dmn_id_bnd;
     (void)nco_def_var(out_id,lat_bnd_nm_out,crd_typ_out,dmn_nbr_2D,dmn_ids_out,&lat_bnd_id);
     var_crt_nbr++;
-    dmn_ids_out[0]=dmn_id_ncol;
+    dmn_ids_out[0]=dmn_id_col;
     dmn_ids_out[1]=dmn_id_bnd;
     (void)nco_def_var(out_id,lon_bnd_nm_out,crd_typ_out,dmn_nbr_2D,dmn_ids_out,&lon_bnd_id);
     var_crt_nbr++;
-    (void)nco_def_var(out_id,area_nm_out,crd_typ_out,dmn_nbr_1D,&dmn_id_ncol,&area_out_id);
+    (void)nco_def_var(out_id,area_nm_out,crd_typ_out,dmn_nbr_1D,&dmn_id_col,&area_out_id);
     var_crt_nbr++;
   } /* !flg_grd_out_1D */
   if(flg_grd_out_2D){
@@ -1075,43 +1225,47 @@ nco_rgr_map /* [fnc] Regrid using external weights */
     var_crt_nbr++;
   } /* !flg_grd_out_2D */
 
-  /* Define regridded variables in output file */
+  /* Pre-allocate dimension ID and cnt/srt space */
+  int dmn_nbr_max; /* [nbr] Maximum number of dimensions variable can have in input or output */
+  rcd+=nco_inq_ndims(in_id,&dmn_nbr_max);
+  dmn_nbr_max++; /* Safety in case regridding adds dimension */
+  dmn_id_in=(int *)nco_malloc(dmn_nbr_max*sizeof(int));
+  dmn_id_out=(int *)nco_malloc(dmn_nbr_max*sizeof(int));
+  dmn_srt=(long *)nco_malloc(dmn_nbr_max*sizeof(long));
+  dmn_cnt=(long *)nco_malloc(dmn_nbr_max*sizeof(long));
+
+  /* Define regridded and copied variables in output file */
   for(idx_tbl=0;idx_tbl<trv_nbr;idx_tbl++){
     trv=trv_tbl->lst[idx_tbl];
     if(trv.nco_typ == nco_obj_typ_var && trv.flg_xtr){
       var_nm=trv.nm;
-      var_typ=trv.var_typ;
+      var_typ_out=trv.var_typ;
       dmn_nbr_in=trv.nbr_dmn;
       dmn_nbr_out=trv.nbr_dmn;
       rcd=nco_inq_varid(in_id,var_nm,&var_id_in);
       rcd=nco_inq_varid_flg(out_id,var_nm,&var_id_out);
       /* If variable has not been defined, define it */
       if(rcd != NC_NOERR){
-	dmn_id_in=(int *)nco_malloc((dmn_nbr_in+1)*sizeof(int)); /* Allocate an extra slot in case additional dimension in output */
-	dmn_id_out=(int *)nco_malloc((dmn_nbr_in+1)*sizeof(int));
-	dmn_srt=(long *)nco_malloc((dmn_nbr_in+1)*sizeof(long));
-	dmn_cnt=(long *)nco_malloc((dmn_nbr_in+1)*sizeof(long));
 	if(trv.flg_rgr){
 	  /* Regrid */
 	  rcd=nco_inq_vardimid(in_id,var_id_in,dmn_id_in);
 	  for(dmn_idx=0;dmn_idx<dmn_nbr_in;dmn_idx++){
 	    rcd=nco_inq_dimname(in_id,dmn_id_in[dmn_idx],dmn_nm);
 	    if(flg_grd_out_1D){
-	      if(nco_rgr_grd_typ == nco_rgr_grd_2D_to_1D && (!strcmp(dmn_nm,lat_nm) || !strcmp(dmn_nm,lon_nm))){
+	      if((nco_rgr_grd_typ == nco_rgr_grd_2D_to_1D) && (!strcmp(dmn_nm,lat_nm) || !strcmp(dmn_nm,lon_nm))){
 		/* Replace orthogonal horizontal dimensions by unstructured horizontal dimension already defined */
 		if(!strcmp(dmn_nm,lat_nm)){
-		  dmn_id_out[dmn_idx]=dmn_id_ncol;
-		  dmn_cnt[dmn_idx]=ncol_nbr_out;
+		  dmn_id_out[dmn_idx]=dmn_id_col;
+		  dmn_cnt[dmn_idx]=col_nbr_out;
 		} /* endif lat */
 		if(!strcmp(dmn_nm,lon_nm)){
-		  dmn_id_out[dmn_idx]=-999;
-		  dmn_cnt[dmn_idx]=-999;
+		  dmn_id_out[dmn_idx]=NC_MIN_INT;
+		  dmn_cnt[dmn_idx]=NC_MIN_INT;
 		  dmn_nbr_out--;
 		} /* endif lon */
 	      }else{
-		/* Always copy existing horizontal dimensions for 1D->1D */
+		/* Dimension col_nm has already been defined, replicate all other dimensions */
 		rcd=nco_inq_dimid_flg(out_id,dmn_nm,dmn_id_out+dmn_idx);
-		/* If dimension has not been defined, define it */
 		if(rcd != NC_NOERR){
 		  rcd=nco_inq_dimlen(in_id,dmn_id_in[dmn_idx],dmn_cnt+dmn_idx);
 		  rcd=nco_def_dim(out_id,dmn_nm,dmn_cnt[dmn_idx],dmn_id_out+dmn_idx);
@@ -1128,44 +1282,44 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 		dmn_idx++;
 		dmn_nbr_out++;
 	      }else{
-		/* Always copy existing horizontal dimensions for 2D->2D */
+		/* Dimensions lat_nm and lon_nm have already been defined, replicate all other dimensions */
 		rcd=nco_inq_dimid_flg(out_id,dmn_nm,dmn_id_out+dmn_idx);
-		/* If dimension has not been defined, define it */
 		if(rcd != NC_NOERR){
 		  rcd=nco_inq_dimlen(in_id,dmn_id_in[dmn_idx],dmn_cnt+dmn_idx);
 		  rcd=nco_def_dim(out_id,dmn_nm,dmn_cnt[dmn_idx],dmn_id_out+dmn_idx);
 		} /* !rcd */
-	      } /* !ncol */
+	      } /* !col */
 	    } /* !1D_to_2D */
-	  } /* end loop over dimensions */
+	  } /* !dmn_idx */
 	}else{ /* !flg_rgr */
-	  /* Copy as-is */
+	  /* Replicate non-regridded variables */
 	  rcd=nco_inq_vardimid(in_id,var_id_in,dmn_id_in);
 	  for(dmn_idx=0;dmn_idx<dmn_nbr_in;dmn_idx++){
 	    rcd=nco_inq_dimname(in_id,dmn_id_in[dmn_idx],dmn_nm);
 	    rcd=nco_inq_dimid_flg(out_id,dmn_nm,dmn_id_out+dmn_idx);
-	    /* If dimension has not been defined, define it */
 	    if(rcd != NC_NOERR){
 	      rcd=nco_inq_dimlen(in_id,dmn_id_in[dmn_idx],dmn_cnt+dmn_idx);
 	      rcd=nco_def_dim(out_id,dmn_nm,dmn_cnt[dmn_idx],dmn_id_out+dmn_idx);
 	    } /* !rcd */
-	  } /* end loop over dimensions */
-	} /* end !flg_rgr */
-	rcd=nco_def_var(out_id,var_nm,var_typ,dmn_nbr_out,dmn_id_out,&var_id_out);
+	  } /* !dmn_idx */
+	} /* !flg_rgr */
+	rcd=nco_def_var(out_id,var_nm,var_typ_out,dmn_nbr_out,dmn_id_out,&var_id_out);
 	(void)nco_att_cpy(in_id,out_id,var_id_in,var_id_out,PCK_ATT_CPY);
 	if(trv.flg_rgr){
 	  aed_mtd_crd.var_nm=var_nm;
 	  aed_mtd_crd.id=var_id_out;
 	  (void)nco_aed_prc(out_id,var_id_out,aed_mtd_crd);
 	} /* !flg_rgr */
-	if(dmn_id_in) dmn_id_in=(int *)nco_free(dmn_id_in);
-	if(dmn_id_out) dmn_id_out=(int *)nco_free(dmn_id_out);
-	if(dmn_srt) dmn_srt=(long *)nco_free(dmn_srt);
-	if(dmn_cnt) dmn_cnt=(long *)nco_free(dmn_cnt);
       } /* !rcd */
     } /* !var */
   } /* end idx_tbl */
 
+  /* Free pre-allocated array space */
+  if(dmn_id_in) dmn_id_in=(int *)nco_free(dmn_id_in);
+  if(dmn_id_out) dmn_id_out=(int *)nco_free(dmn_id_out);
+  if(dmn_srt) dmn_srt=(long *)nco_free(dmn_srt);
+  if(dmn_cnt) dmn_cnt=(long *)nco_free(dmn_cnt);
+
   /* Define new metadata in regridded file */
   att_nm=strdup("long_name");
   att_val=strdup("solid angle subtended by grid cell");
@@ -1348,6 +1502,33 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   if(att_nm) att_nm=(char *)nco_free(att_nm);
   if(att_val) att_val=(char *)nco_free(att_val);
 
+  /* UGRID Conventions define "topology" and "modulo" attributes
+     https://github.com/ugrid-conventions/ugrid-conventions/blob/master/ugrid-conventions.md */
+  att_nm=strdup("modulo");
+  double modulo=360.0;
+  aed_mtd.att_nm=att_nm;
+  aed_mtd.var_nm=lon_nm_out;
+  aed_mtd.id=lon_out_id;
+  aed_mtd.sz=1;
+  aed_mtd.type=NC_DOUBLE;
+  aed_mtd.val.dp=&modulo;
+  aed_mtd.mode=aed_create;
+  (void)nco_aed_prc(out_id,lon_out_id,aed_mtd);
+  if(att_nm) att_nm=(char *)nco_free(att_nm);
+
+  att_nm=strdup("topology");
+  att_val=strdup("circular");
+  aed_mtd.att_nm=att_nm;
+  aed_mtd.var_nm=lon_nm_out;
+  aed_mtd.id=lon_out_id;
+  aed_mtd.sz=strlen(att_val);
+  aed_mtd.type=NC_CHAR;
+  aed_mtd.val.cp=att_val;
+  aed_mtd.mode=aed_create;
+  (void)nco_aed_prc(out_id,lon_out_id,aed_mtd);
+  if(att_nm) att_nm=(char *)nco_free(att_nm);
+  if(att_val) att_val=(char *)nco_free(att_val);
+
   att_nm=strdup("bounds");
   att_val=lon_bnd_nm_out;
   aed_mtd.att_nm=att_nm;
@@ -1375,7 +1556,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 
   if(flg_grd_out_2D){
     att_nm=strdup("long_name");
-    att_val=strdup("latitude quadrature weights (normalized to sum to 2.0)");
+    att_val=strdup("latitude quadrature weights (normalized to sum to 2.0 on global grids)");
     aed_mtd.att_nm=att_nm;
     aed_mtd.var_nm=lat_wgt_nm;
     aed_mtd.id=lat_wgt_id;
@@ -1439,21 +1620,21 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   /* Write new coordinates and variables to regridded file */
   if(flg_grd_out_1D){
     dmn_srt_out[0]=0L;
-    dmn_cnt_out[0]=ncol_nbr_out;
+    dmn_cnt_out[0]=col_nbr_out;
     (void)nco_put_vara(out_id,lat_out_id,dmn_srt_out,dmn_cnt_out,lat_ctr_out,crd_typ_out);
     dmn_srt_out[0]=0L;
-    dmn_cnt_out[0]=ncol_nbr_out;
+    dmn_cnt_out[0]=col_nbr_out;
     (void)nco_put_vara(out_id,lon_out_id,dmn_srt_out,dmn_cnt_out,lon_ctr_out,crd_typ_out);
     dmn_srt_out[0]=dmn_srt_out[1]=0L;
-    dmn_cnt_out[0]=ncol_nbr_out;
+    dmn_cnt_out[0]=col_nbr_out;
     dmn_cnt_out[1]=bnd_nbr_out;
     (void)nco_put_vara(out_id,lat_bnd_id,dmn_srt_out,dmn_cnt_out,lat_bnd_out,crd_typ_out);
     dmn_srt_out[0]=dmn_srt_out[1]=0L;
-    dmn_cnt_out[0]=ncol_nbr_out;
+    dmn_cnt_out[0]=col_nbr_out;
     dmn_cnt_out[1]=bnd_nbr_out;
     (void)nco_put_vara(out_id,lon_bnd_id,dmn_srt_out,dmn_cnt_out,lon_bnd_out,crd_typ_out);
     dmn_srt_out[0]=0L;
-    dmn_cnt_out[0]=ncol_nbr_out;
+    dmn_cnt_out[0]=col_nbr_out;
     (void)nco_put_vara(out_id,area_out_id,dmn_srt_out,dmn_cnt_out,area_out,crd_typ_out);
   } /* !flg_grd_out_1D */
   if(flg_grd_out_2D){
@@ -1485,8 +1666,8 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   const nco_bool flg_rnr=rgr->flg_rnr; /* [flg] Renormalize destination values by valid area */
   const size_t grd_sz_in=rgr_map.src_grid_size; /* [nbr] Number of elements in single layer of input grid */
   const size_t grd_sz_out=rgr_map.dst_grid_size; /* [nbr] Number of elements in single layer of output grid */
-  double *var_val_dbl_in;
-  double *var_val_dbl_out;
+  double *var_val_dbl_in=NULL;
+  double *var_val_dbl_out=NULL;
   double *wgt_vld_out=NULL;
   double mss_val_dbl;
   double var_val_crr;
@@ -1510,14 +1691,27 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   FILE * const fp_stdout=stdout; /* [fl] stdout filehandle CEWI */
 
   /* OpenMP notes:
-     default(): none
-     firstprivate(): tally,wgt_vld_out (preserve NULL-initialization)
-     private(): almost everything else
-     shared(): flg_rnr,fnc_nm,wgt_vld_thr explicit shared for icc 13.1.3 (rhea), default shared for gcc 4.9.2 */
-#ifdef __INTEL_COMPILER
-# pragma omp parallel for default(none) firstprivate(tally,wgt_vld_out) private(dmn_cnt,dmn_id_in,dmn_id_out,dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_srt,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_dbl,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ,var_val_crr,var_val_dbl_in,var_val_dbl_out) shared(col_src_adr,flg_rnr,fnc_nm,lnk_nbr,out_id,row_dst_adr,wgt_raw,wgt_vld_thr)
+     default(): None
+     firstprivate(): Pointers that could inadvertently be free()'d if they lost their NULL-initialization
+     private(): Almost everything else
+     shared(): uggh...
+     1. All const variables are default shared for gcc >= 4.9.2,
+     2. fnc_nm (only!) must be explicit shared for g++ 4.6.3 (travis)
+     3. flg_rnr,fnc_nm,wgt_vld_thr must be explicit shared for icc 13.1.3 (rhea) */
+#ifdef __GNUG__
+# define GCC_LIB_VERSION ( __GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ )
+# if GCC_LIB_VERSION < 480
+#  define GXX_OLD_OPENMP_SHARED_TREATMENT 1
+# endif /* 480 */
+#endif /* !__GNUC__ */
+#if defined( __INTEL_COMPILER)
+# pragma omp parallel for default(none) firstprivate(dmn_cnt,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_dbl,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(col_src_adr,flg_rnr,fnc_nm,lnk_nbr,out_id,row_dst_adr,wgt_raw,wgt_vld_thr)
 #else /* !__INTEL_COMPILER */
-# pragma omp parallel for default(none) firstprivate(tally,wgt_vld_out) private(dmn_cnt,dmn_id_in,dmn_id_out,dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_srt,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_dbl,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ,var_val_crr,var_val_dbl_in,var_val_dbl_out) shared(col_src_adr,lnk_nbr,out_id,row_dst_adr,wgt_raw)
+# ifdef GXX_OLD_OPENMP_SHARED_TREATMENT
+#  pragma omp parallel for default(none) firstprivate(dmn_cnt,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_dbl,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(col_src_adr,fnc_nm,lnk_nbr,out_id,row_dst_adr,wgt_raw)
+# else /* !old g++ */
+#  pragma omp parallel for default(none) firstprivate(dmn_cnt,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_dbl,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(col_src_adr,lnk_nbr,out_id,row_dst_adr,wgt_raw)
+# endif /* !old g++ */
 #endif /* !__INTEL_COMPILER */
   for(idx_tbl=0;idx_tbl<trv_nbr;idx_tbl++){
     trv=trv_tbl->lst[idx_tbl];
@@ -1532,18 +1726,19 @@ nco_rgr_map /* [fnc] Regrid using external weights */
       if(trv.flg_rgr){
 	/* Regrid variable */
 	var_nm=trv.nm;
-	//var_typ=trv.var_typ;
-	var_typ=NC_DOUBLE; /* NB: Perform regridding in double precision */
+	var_typ_rgr=NC_DOUBLE; /* NB: Perform regridding in double precision */
+	var_typ_out=trv.var_typ; /* NB: Output type in file is same as input type */
 	var_sz_in=1L;
 	var_sz_out=1L;
 	rcd=nco_inq_varid(in_id,var_nm,&var_id_in);
 	rcd=nco_inq_varid(out_id,var_nm,&var_id_out);
 	rcd=nco_inq_varndims(out_id,var_id_out,&dmn_nbr_out);
 	rcd=nco_inq_varndims(in_id,var_id_in,&dmn_nbr_in);
+	dmn_nbr_max= dmn_nbr_in > dmn_nbr_out ? dmn_nbr_in : dmn_nbr_out;
 	dmn_id_in=(int *)nco_malloc(dmn_nbr_in*sizeof(int));
 	dmn_id_out=(int *)nco_malloc(dmn_nbr_out*sizeof(int));
-	dmn_srt=(long *)nco_malloc(dmn_nbr_out*sizeof(long)); /* Allocate an extra slot for new dimensions */
-	dmn_cnt=(long *)nco_malloc(dmn_nbr_out*sizeof(long));
+	dmn_srt=(long *)nco_malloc(dmn_nbr_max*sizeof(long)); /* max() for both input and output grids */
+	dmn_cnt=(long *)nco_malloc(dmn_nbr_max*sizeof(long));
 	rcd=nco_inq_vardimid(out_id,var_id_out,dmn_id_out);
 	rcd=nco_inq_vardimid(in_id,var_id_in,dmn_id_in);
 	for(dmn_idx=0;dmn_idx<dmn_nbr_in;dmn_idx++){
@@ -1551,15 +1746,15 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 	  var_sz_in*=dmn_cnt[dmn_idx];
 	  dmn_srt[dmn_idx]=0L;
 	} /* end loop over dimensions */
-	var_val_dbl_in=(double *)nco_malloc_dbg(var_sz_in*nco_typ_lng(var_typ),"Unable to malloc() input value buffer",fnc_nm);
-	rcd=nco_get_vara(in_id,var_id_in,dmn_srt,dmn_cnt,var_val_dbl_in,var_typ);
+	var_val_dbl_in=(double *)nco_malloc_dbg(var_sz_in*nco_typ_lng(var_typ_rgr),"Unable to malloc() input value buffer",fnc_nm);
+	rcd=nco_get_vara(in_id,var_id_in,dmn_srt,dmn_cnt,var_val_dbl_in,var_typ_rgr);
 
 	for(dmn_idx=0;dmn_idx<dmn_nbr_out;dmn_idx++){
 	  rcd=nco_inq_dimlen(out_id,dmn_id_out[dmn_idx],dmn_cnt+dmn_idx);
 	  var_sz_out*=dmn_cnt[dmn_idx];
 	  dmn_srt[dmn_idx]=0L;
 	} /* end loop over dimensions */
-	var_val_dbl_out=(double *)nco_malloc_dbg(var_sz_out*nco_typ_lng(var_typ),"Unable to malloc() input value buffer",fnc_nm);
+	var_val_dbl_out=(double *)nco_malloc_dbg(var_sz_out*nco_typ_lng(var_typ_rgr),"Unable to malloc() input value buffer",fnc_nm);
 	
 	lvl_nbr=1;
 	for(dmn_idx=0;dmn_idx<dmn_nbr_out-2;dmn_idx++) lvl_nbr*=dmn_cnt[dmn_idx];
@@ -1569,7 +1764,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 	/* Missing value setup */
 	has_mss_val=nco_mss_val_get_dbl(in_id,var_id_in,&mss_val_dbl);
 	if(has_mss_val) tally=(int *)nco_calloc(var_sz_out,nco_typ_lng(NC_INT));
-	if(has_mss_val && flg_rnr) wgt_vld_out=(double *)nco_malloc_dbg(var_sz_out*nco_typ_lng(var_typ),"Unable to malloc() input weight buffer",fnc_nm);
+	if(has_mss_val && flg_rnr) wgt_vld_out=(double *)nco_malloc_dbg(var_sz_out*nco_typ_lng(var_typ_rgr),"Unable to malloc() input weight buffer",fnc_nm);
 	if(has_mss_val && flg_rnr) 
 	  for(dst_idx=0;dst_idx<var_sz_out;dst_idx++) wgt_vld_out[dst_idx]=0.0;
 
@@ -1643,7 +1838,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
 	
 #pragma omp critical
 	{ /* begin OpenMP critical */
-	  rcd=nco_put_vara(out_id,var_id_out,dmn_srt,dmn_cnt,var_val_dbl_out,var_typ);
+	  rcd=nco_put_vara(out_id,var_id_out,dmn_srt,dmn_cnt,var_val_dbl_out,var_typ_rgr);
 	} /* end OpenMP critical */
 	
 	if(dmn_id_in) dmn_id_out=(int *)nco_free(dmn_id_in);
@@ -1669,8 +1864,9 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   /* Free memory allocated for grid reading/writing */
   if(area_out) area_out=(double *)nco_free(area_out);
   if(col_src_adr) col_src_adr=(int *)nco_free(col_src_adr);
-  if(dmn_sz_out_int) dmn_sz_out_int=(int *)nco_free(dmn_sz_out_int);
   if(dmn_sz_in_int) dmn_sz_in_int=(int *)nco_free(dmn_sz_in_int);
+  if(dmn_sz_out_int) dmn_sz_out_int=(int *)nco_free(dmn_sz_out_int);
+  if(frc_out) frc_out=(double *)nco_free(frc_out);
   if(lat_bnd_out) lat_bnd_out=(double *)nco_free(lat_bnd_out);
   if(lat_crn_out) lat_crn_out=(double *)nco_free(lat_crn_out);
   if(lat_ctr_out) lat_ctr_out=(double *)nco_free(lat_ctr_out);
@@ -1680,6 +1876,7 @@ nco_rgr_map /* [fnc] Regrid using external weights */
   if(lon_crn_out) lon_crn_out=(double *)nco_free(lon_crn_out);
   if(lon_ctr_out) lon_ctr_out=(double *)nco_free(lon_ctr_out);
   if(lon_ntf_out) lon_ntf_out=(double *)nco_free(lon_ntf_out);
+  if(msk_out) msk_out=(int *)nco_free(msk_out);
   if(row_dst_adr) row_dst_adr=(int *)nco_free(row_dst_adr);
   if(wgt_raw) wgt_raw=(double *)nco_free(wgt_raw);
   
@@ -1772,7 +1969,7 @@ nco_lat_wgt_gss /* [fnc] Compute and return sine of Gaussian latitudes and their
   double lat_idx_dbl; // Latitude index, double precision
   double lat_nnr_idx_dbl; // Inner latitude index, double precision
   double lat_nbr_dbl; // [nbr] Number of latitudes, double precision
-  double pk; // Polynomial
+  double pk=double_CEWI; // Polynomial
   double pkm1; // Polynomial
   double pkm2; // Polynomial
   double pkmrk; // Polynomial
@@ -1930,9 +2127,10 @@ nco_grd_2D_sng /* [fnc] Convert two-dimensional grid-type enum to string */
 {
   /* Purpose: Convert two-dimensional grid-type enum to string */
   switch(nco_grd_2D_typ){
+  case nco_grd_2D_nil: return "Unknown 2D grid type (possibly regional not global 2D grid?)";
   case nco_grd_2D_gss: return "Gaussian latitude grid used by global spectral models: CCM 1-3, CAM 1-3, LSM, MATCH, UCICTM";
-  case nco_grd_2D_ngl_eqi_pol: return "Equi-angle latitude grid with poles at centers of first and last gridpoints (i.e., lat_ctr[0]=-90), aka FV scalar grid: CAM FV, GEOS-CHEM, UCICTM, UKMO";
-  case nco_grd_2D_ngl_eqi_fst: return "Equi-angle latitude grid with poles at edges of first and last gridpoints (i.e., lat_ctr[0]=-89.xxx), aka FV staggered velocity grid: CIESIN/SEDAC, IGBP-DIS, TOMS AAI";
+  case nco_grd_2D_ngl_eqi_pol: return "Equi-angle latitude grid with odd number of latitudes so poles are at centers of first and last gridcells (i.e., lat_ctr[0]=-90), aka FV scalar grid: CAM FV, GEOS-CHEM, UCICTM, UKMO";
+  case nco_grd_2D_ngl_eqi_fst: return "Equi-angle latitude grid with even number of latitudes so poles are at edges of first and last gridcells (i.e., lat_ctr[0]=-89.xxx), aka FV staggered velocity grid: CIESIN/SEDAC, IGBP-DIS, TOMS AAI";
   default: nco_dfl_case_generic_err(); break;
   } /* end switch */
 
@@ -1940,6 +2138,22 @@ nco_grd_2D_sng /* [fnc] Convert two-dimensional grid-type enum to string */
   return (char *)NULL;
 } /* end nco_grd_2D_sng() */
 
+const char * /* O [sng] String describing grid extent */
+nco_grd_xtn_sng /* [fnc] Convert two-dimensional grid-extent enum to string */
+(const nco_grd_xtn_enm nco_grd_xtn) /* I [enm] Grid-extent enum */
+{
+  /* Purpose: Convert grid-extent enum to string */
+  switch(nco_grd_xtn){
+  case nco_grd_xtn_nil: return "Unknown";
+  case nco_grd_xtn_glb: return "Global";
+  case nco_grd_xtn_rgn: return "Regional"; 
+  default: nco_dfl_case_generic_err(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_grd_xtn_sng() */
+
 const char * /* O [sng] String describing grid conversion */
 nco_rgr_grd_sng /* [fnc] Convert grid conversion enum to string */
 (const nco_rgr_grd_typ_enm nco_rgr_grd_typ) /* I [enm] Grid conversion enum */
@@ -1966,6 +2180,7 @@ nco_rgr_mth_sng /* [fnc] Convert regridding method enum to string */
   case nco_rgr_mth_conservative: return "Conservative remapping";
   case nco_rgr_mth_bilinear: return "Bilinear remapping";
   case nco_rgr_mth_none: return "none";
+  case nco_rgr_mth_unknown: return "Unknown (Tempest)";
   default: nco_dfl_case_generic_err(); break;
   } /* end switch */
 
@@ -1973,6 +2188,22 @@ nco_rgr_mth_sng /* [fnc] Convert regridding method enum to string */
   return (char *)NULL;
 } /* end nco_rgr_mth_sng() */
 
+const char * /* O [sng] String describing mapfile generator */
+nco_rgr_mpf_sng /* [fnc] Convert mapfile generator enum to string */
+(const nco_rgr_mpf_typ_enm nco_rgr_mpf_typ) /* I [enm] Mapfile generator enum */
+{
+  /* Purpose: Convert mapfile generator enum to string */
+  switch(nco_rgr_mpf_typ){
+  case nco_rgr_mpf_ESMF: return "ESMF Offline Regridding Weight Generator (either ESMF_RegridWeightGen directly or via NCL)";
+  case nco_rgr_mpf_SCRIP: return "SCRIP (original LANL package)";
+  case nco_rgr_mpf_Tempest: return "TempestRemap (GenerateOfflineMap)";
+  default: nco_dfl_case_generic_err(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_rgr_mpf_sng() */
+
 const char * /* O [sng] String describing regridding normalization */
 nco_rgr_nrm_sng /* [fnc] Convert regridding normalization enum to string */
 (const nco_rgr_nrm_typ_enm nco_rgr_nrm_typ) /* I [enm] Regridding normalization enum */
@@ -1982,6 +2213,7 @@ nco_rgr_nrm_sng /* [fnc] Convert regridding normalization enum to string */
   case nco_rgr_nrm_fracarea: return "fracarea";
   case nco_rgr_nrm_destarea: return "destarea";
   case nco_rgr_nrm_none: return "none";
+  case nco_rgr_nrm_unknown: return "Unknown (Tempest)";
   default: nco_dfl_case_generic_err(); break;
   } /* end switch */
 
@@ -2052,582 +2284,3 @@ nco_tps_cmd_sng /* [fnc] Convert Tempest remap command enum to command name */
   return (char *)NULL;
 } /* end nco_tps_cmd_sng() */
 
-#ifdef ENABLE_ESMF
-const char * /* O [sng] String version of ESMC_FileFormat_Flag */
-nco_esmf_fl_fmt_sng /* [fnc] Convert ESMF file format to string */
-(const int nco_esmf_fl_fmt) /* I [enm] ESMF file format enum ESMC_FileFormat_Flag */
-{
-  /* Purpose: Convert ESMF fileTypeFlag enum to string */
-  switch(nco_esmf_fl_fmt){
-  case ESMC_FILEFORMAT_UNDEFINED: return "ESMC_FILEFORMAT_UNDEFINED";
-  case ESMC_FILEFORMAT_VTK: return "ESMC_FILEFORMAT_VTK";
-  case ESMC_FILEFORMAT_SCRIP: return "ESMC_FILEFORMAT_SCRIP";
-  case ESMC_FILEFORMAT_ESMFMESH: return "ESMC_FILEFORMAT_ESMFMESH";
-  case ESMC_FILEFORMAT_ESMCGRID: return "ESMC_FILEFORMAT_ESMCGRID";
-  case ESMC_FILEFORMAT_UGRID: return "ESMC_FILEFORMAT_UGRID";
-  case ESMC_FILEFORMAT_GRIDSPEC: return "ESMC_FILEFORMAT_GRIDSPEC";
-  default: nco_dfl_case_generic_err(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_fl_fmt_sng() */
-
-const char * /* O [sng] String version of ESMC_StaggerLoc enum */
-nco_esmf_stg_lcn_sng /* [fnc] Convert ESMF stagger location enum to string */
-(const int nco_esmf_stg_lcn) /* I [enm] ESMF stagger location enum ESMC_StaggerLoc */
-{
-  /* Purpose: Convert ESMF stagger location enum ESMC_StaggerLoc to string */
-  switch(nco_esmf_stg_lcn){
-  case ESMC_STAGGERLOC_INVALID: return "ESMC_STAGGERLOC_INVALID";
-  case ESMC_STAGGERLOC_UNINIT: return "ESMC_STAGGERLOC_UNINIT";
-  case ESMC_STAGGERLOC_CENTER: return "ESMC_STAGGERLOC_CENTER";
-  case ESMC_STAGGERLOC_EDGE1: return "ESMC_STAGGERLOC_EDGE1";
-  case ESMC_STAGGERLOC_EDGE2: return "ESMC_STAGGERLOC_EDGE2";
-  case ESMC_STAGGERLOC_CORNER: return "ESMC_STAGGERLOC_CORNER";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_stg_lcn_sng() */
-
-const char * /* O [sng] String version of ESMC_GridItem_Flag enum */
-nco_esmf_grd_itm_sng /* [fnc] Convert ESMF grid item enum to string */
-(const int nco_esmf_grd_itm) /* I [enm] ESMF grid item enum ESMC_GridItem_Flag */
-{
-  /* Purpose: Convert ESMF grid item enum ESMC_GridItem_Flag to string */
-  switch(nco_esmf_grd_itm){
-  case ESMC_GRIDITEM_INVALID: return "ESMC_GRIDITEM_INVALID";
-  case ESMC_GRIDITEM_UNINIT: return "ESMC_GRIDITEM_UNINIT";
-  case ESMC_GRIDITEM_MASK: return "ESMC_GRIDITEM_MASK";
-  case ESMC_GRIDITEM_AREA: return "ESMC_GRIDITEM_AREA";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_grd_itm_sng() */
-
-const char * /* O [sng] String version of ESMC_CoordSys_Flag enum */
-nco_esmf_crd_sys_sng /* [fnc] Convert ESMF coordinate system enum to string */
-(const int nco_esmf_crd_sys) /* I [enm] ESMF coordinate system enum ESMC_CoordSys_Flag */
-{
-  /* Purpose: Convert ESMF coordinate system enum ESMC_CoordSys_Flag to string */
-  switch(nco_esmf_crd_sys){
-  case ESMC_COORDSYS_INVALID: return "ESMC_COORDSYS_INVALID";
-  case ESMC_COORDSYS_UNINIT: return "ESMC_COORDSYS_UNINIT";
-  case ESMC_COORDSYS_CART: return "ESMC_COORDSYS_CART";
-  case ESMC_COORDSYS_SPH_DEG: return "ESMC_COORDSYS_SPH_DEG";
-  case ESMC_COORDSYS_SPH_RAD: return "ESMC_COORDSYS_SPH_RAD";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_crd_sys_sng() */
-
-const char * /* O [sng] String version of ESMC_TypeKind_Flag enum */
-nco_esmf_typ_knd_sng /* [fnc] Convert ESMF type kind enum to string */
-(const int nco_esmf_typ_knd) /* I [enm] ESMF type kind enum ESMC_TypeKind_Flag */
-{
-  /* Purpose: Convert ESMF type kind enum ESMC_TypeKind_Flag to string */
-  switch(nco_esmf_typ_knd){
-  case ESMC_TYPEKIND_I1: return "ESMC_TYPEKIND_I1";
-  case ESMC_TYPEKIND_I2: return "ESMC_TYPEKIND_I2";
-  case ESMC_TYPEKIND_I4: return "ESMC_TYPEKIND_I4";
-  case ESMC_TYPEKIND_I8: return "ESMC_TYPEKIND_I8";
-  case ESMC_TYPEKIND_R4: return "ESMC_TYPEKIND_R4";
-  case ESMC_TYPEKIND_R8: return "ESMC_TYPEKIND_R8";
-  case ESMC_TYPEKIND_LOGICAL: return "ESMC_TYPEKIND_LOGICAL";
-  case ESMC_TYPEKIND_CHARACTER: return "ESMC_TYPEKIND_CHARACTER";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_typ_knd_sng() */
-
-const char * /* O [sng] String version of ESMC_LogMsgType_Flag enum */
-nco_esmf_log_msg_sng /* [fnc] Convert ESMF log message type enum to string */
-(const int nco_esmf_log_msg) /* I [enm] ESMF log message type enum ESMC_LogMsgType_Flag */
-{
-  /* Purpose: Convert ESMF coordinate system enum ESMC_LogMsgType_Flag to string */
-  switch(nco_esmf_log_msg){
-  case ESMC_LOGMSG_INFO: return "ESMC_LOGMSG_INFO";
-  case ESMC_LOGMSG_WARN: return "ESMC_LOGMSG_WARN";
-  case ESMC_LOGMSG_ERROR: return "ESMC_LOGMSG_ERROR";
-  case ESMC_LOGMSG_TRACE: return "ESMC_LOGMSG_TRACE";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_log_msg_sng() */
-
-const char * /* O [sng] String version of ESMC_RegridMethod_Flag enum */
-nco_esmf_rgr_mth_sng /* [fnc] Convert ESMF regrid method type enum to string */
-(const int nco_esmf_rgr_mth) /* I [enm] ESMF regrid method type enum ESMC_RegridMethod_Flag */
-{
-  /* Purpose: Convert ESMF regrid method enum ESMC_RegridMethod_Flag to string */
-  switch(nco_esmf_rgr_mth){
-  case ESMC_REGRIDMETHOD_BILINEAR: return "ESMC_REGRIDMETHOD_BILINEAR";
-  case ESMC_REGRIDMETHOD_PATCH: return "ESMC_REGRIDMETHOD_PATCH";
-  case ESMC_REGRIDMETHOD_CONSERVE: return "ESMC_REGRIDMETHOD_CONSERVE";
-  case ESMC_REGRIDMETHOD_NEAREST_STOD: return "ESMC_REGRIDMETHOD_NEAREST_STOD";
-  case ESMC_REGRIDMETHOD_NEAREST_DTOS: return "ESMC_REGRIDMETHOD_NEAREST_DTOS";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_rgr_mth_sng() */
-
-const char * /* O [sng] String version of ESMC_PoleMethod_Flag enum */
-nco_esmf_pll_mth_sng /* [fnc] Convert ESMF pole method type enum to string */
-(const int nco_esmf_pll_mth) /* I [enm] ESMF pole method type enum ESMC_PoleMethod_Flag */
-{
-  /* Purpose: Convert ESMF pole method enum ESMC_PoleMethod_Flag to string */
-  switch(nco_esmf_pll_mth){
-  case ESMC_POLEMETHOD_NONE: return "ESMC_POLEMETHOD_NONE";
-  case ESMC_POLEMETHOD_ALLAVG: return "ESMC_POLEMETHOD_ALLAVG";
-  case ESMC_POLEMETHOD_NPNTAVG: return "ESMC_POLEMETHOD_NPNTAVG";
-  case ESMC_POLEMETHOD_TEETH: return "ESMC_POLEMETHOD_TEETH";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_pll_mth_sng() */
-
-const char * /* O [sng] String version of ESMC_UnmappedAction_Flag enum */
-nco_esmf_unm_act_sng /* [fnc] Convert ESMF unmapped action type enum to string */
-(const int nco_esmf_unm_act) /* I [enm] ESMF unmapped action type enum ESMC_UnmappedAction_Flag */
-{
-  /* Purpose: Convert ESMF unmapped action enum ESMC_UnmappedAction_Flag to string */
-  switch(nco_esmf_unm_act){
-  case ESMC_UNMAPPEDACTION_ERROR: return "ESMC_UNMAPPEDACTION_ERROR";
-  case ESMC_UNMAPPEDACTION_IGNORE: return "ESMC_UNMAPPEDACTION_IGNORE";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_unm_act_sng() */
-
-const char * /* O [sng] String version of ESMC_Region_Flag enum */
-nco_esmf_rgn_flg_sng /* [fnc] Convert ESMF region flag enum to string */
-(const int nco_esmf_rgn_flg) /* I [enm] ESMF region flag enum ESMC_Region_Flag */
-{
-  /* Purpose: Convert ESMF region flag enum ESMC_Region_Flag to string */
-  switch(nco_esmf_rgn_flg){
-  case ESMC_REGION_TOTAL: return "ESMC_REGION_TOTAL";
-  case ESMC_REGION_SELECT: return "ESMC_REGION_SELECT";
-  case ESMC_REGION_EMPTY: return "ESMC_REGION_EMPTY";
-  default: abort(); break;
-  } /* end switch */
-
-  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
-  return (char *)NULL;
-} /* end nco_esmf_rgn_flg_sng() */
-
-int /* O [enm] Return code */
-nco_rgr_esmf /* [fnc] Regrid using ESMF library */
-(rgr_sct * const rgr) /* I/O [sct] Regridding structure */
-{
-  /* Purpose: Regrid fields
-     ESMC is C-interface to ESMF documented at
-     http://www.earthsystemmodeling.org/esmf_releases/last_built/ESMC_crefdoc/ESMC_crefdoc.html
-     ESMF Developer's Guide
-     http://www.earthsystemmodeling.org/documents/dev_guide
-     ESMF_RegridWeightGen
-     http://www.earthsystemcog.org/projects/regridweightgen
-     http://www.earthsystemmodeling.org/python_releases/last_esmpy/esmpy_doc/html/index.html
-
-     ESMF C-interface examples:
-     ${DATA}/esmf/src/Infrastructure/Field/tests/ESMC_FieldRegridUTest.C
-     ${DATA}/esmf/src/Infrastructure/Field/tests/ESMC_FieldRegridCsrvUTest.C */
-  
-  const char fnc_nm[]="nco_rgr_esmf()"; /* [sng] Function name */
-  const char fl_nm_esmf_log[]="nco_rgr_log_foo.txt"; /* [sng] Log file for ESMF routines */
-  
-  enum ESMC_StaggerLoc stg_lcn_src=ESMC_STAGGERLOC_CENTER; /* [enm] Stagger location of source grid */
-  enum ESMC_StaggerLoc stg_lcn_dst=ESMC_STAGGERLOC_CENTER; /* [enm] Stagger location of destination grid */
-
-  int flg_openMPEnabledFlag; /* [flg] ESMF library was compiled with OpenMP enabled */
-  int flg_pthreadsEnabledFlag; /* [flg] ESMF library was compiled with Pthreads enabled */
-  int localPet; /* [id] ID of PET that issued call */
-  int peCount; /* [nbr] Number of PEs referenced by ESMF_VM */
-  int petCount; /* [nbr] Number of PETs referenced by ESMF_VM */
-  int rcd_esmf; /* [enm] Return codes from ESMF functions */
-  
-  int dmn_nbr_grd=2;
-  int rcd=ESMF_SUCCESS;
-  
-  int *dmn_id;
-  
-  int dmn_nbr;
-  int idx;
-  int var_in_id;
-  
-  long *dmn_cnt;
-  long *dmn_srt;
-  
-  nc_type var_typ_in;
-  nc_type crd_typ_out=NC_DOUBLE;
-  nc_type var_typ_out=NC_DOUBLE;
-  
-  double *lon_in;
-  double *lat_in;
-  void *void_ptr_var;
-  
-  int in_id; /* I [id] Input netCDF file ID */
-  int out_id; /* I [id] Output netCDF file ID */
-
-  /* SCRIP rank-2 grids are almost always lat,lon (C) and lon,lat (Fortran)
-     Indexing is confusing because ESMF always uses Fortran-ordering convention with mixture of 0- and 1-based indices
-     netCDF always uses C-ordering convention with 0-based indices
-     No data transposition is necessary because variable RAM is always in C-order (same as netCDF)
-     However, Fortran and C (i.e., ESMF and netCDF) access that same RAM using different conventions
-     2-D data are always C[lat,lon] or F(lon,lat) in practice
-     2-D stored in netCDF or RAM as C[lon,lat] and F(lat,lon) are possible, though not seen in practice
-     NCO regridding below assumes data are in C[lat,lon] order
-     NCO hardcoded subscript conventions follow this pattern:
-     crd_idx_[axs]_[ibs]_[dmn]_[grd] where
-     axs = access convention = C or Fortran = _c_ or _f_ 
-     ibs = index base = 0 or 1 = _0bs_ or _1bs_ for zero-based or one-based indices
-     NB: axs is independent from ibs! 
-     dmn = dimension = lon or lat
-     grd = grid = source or destination */
-  const int crd_idx_c_0bs_lat_dst=0; /* [dgr] 0-based index of latitude  in C       representation of rank-2 destination grids */
-  const int crd_idx_c_0bs_lon_dst=1; /* [dgr] 0-based index of longitude in C       representation of rank-2 destination grids */
-  const int crd_idx_f_0bs_lat_dst=1; /* [dgr] 0-based index of latitude  in Fortran representation of rank-2 destination grids */
-  const int crd_idx_f_0bs_lat_src=1; /* [dgr] 0-based index of latitude  in Fortran representation of rank-2 source grids */
-  const int crd_idx_f_0bs_lon_dst=0; /* [dgr] 0-based index of longitude in Fortran representation of rank-2 destination grids */
-  const int crd_idx_f_0bs_lon_src=0; /* [dgr] 0-based index of longitude in Fortran representation of rank-2 source grids */
-  const int crd_idx_f_1bs_lat_dst=2; /* [dgr] 1-based index of latitude  in Fortran representation of rank-2 destination grids */
-  const int crd_idx_f_1bs_lat_src=2; /* [dgr] 1-based index of latitude  in Fortran representation of rank-2 source grids */
-  const int crd_idx_f_1bs_lon_dst=1; /* [dgr] 1-based index of longitude in Fortran representation of rank-2 destination grids */
-  const int crd_idx_f_1bs_lon_src=1; /* [dgr] 1-based index of longitude in Fortran representation of rank-2 source grids */
-
-  /* Initialize */
-  in_id=rgr->in_id;
-  out_id=rgr->out_id;
-  
-  /* Obtain input longitude type and length */
-  char lon_nm_in[]="lon";
-  (void)nco_inq_varid(in_id,lon_nm_in,&var_in_id);
-  (void)nco_inq_var(in_id,var_in_id,(char *)NULL,&var_typ_in,&dmn_nbr,(int *)NULL,(int *)NULL);
-  if(var_typ_in != NC_DOUBLE){
-    assert(var_typ_in == NC_FLOAT);
-    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: INFO WARNING Cheapskate regridding input file %s stores coordinate as NC_FLOAT\n",nco_prg_nm_get(),rgr->fl_in);
-  } /* !var_typ_in */
-
-  /* Allocate space to hold dimension metadata */
-  dmn_cnt=(long *)nco_malloc(dmn_nbr*sizeof(long));
-  dmn_id=(int *)nco_malloc(dmn_nbr*sizeof(int));
-  dmn_srt=(long *)nco_malloc(dmn_nbr*sizeof(long));
-  (void)nco_inq_vardimid(in_id,var_in_id,dmn_id);
-  /* Get input dimension sizes */
-  long dmn_sz=1L; /* [nbr] Number of elements in dimension (will be self-multiplied) */
-  for(idx=0;idx<dmn_nbr;idx++){
-    (void)nco_inq_dimlen(in_id,dmn_id[idx],dmn_cnt+idx);
-    dmn_srt[idx]=0L;
-    dmn_sz*=dmn_cnt[idx];
-  } /* end loop over dim */
-  
-  int *max_idx; /* [nbr] Zero-based array containing dimension sizes in order? */
-  max_idx=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
-  max_idx[crd_idx_f_0bs_lon_src]=dmn_sz; /* [nbr] Number of elements in dimensions */
-  
-  /* Allocate space for and obtain longitude */
-  lon_in=(double *)nco_malloc(dmn_sz*nco_typ_lng(crd_typ_out));
-  rcd=nco_get_vara(in_id,var_in_id,dmn_srt,dmn_cnt,lon_in,crd_typ_out);
-
-  /* Obtain input latitude type and length */
-  char lat_nm_in[]="lat";
-  (void)nco_inq_varid(in_id,lat_nm_in,&var_in_id);
-  (void)nco_inq_var(in_id,var_in_id,(char *)NULL,&var_typ_in,&dmn_nbr,(int *)NULL,(int *)NULL);
-  if(var_typ_in != NC_DOUBLE){
-    assert(var_typ_in == NC_FLOAT);
-    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: INFO WARNING Cheapskate regridding input file %s stores coordinate as NC_FLOAT\n",nco_prg_nm_get(),rgr->fl_in);
-  } /* !var_typ_in */
-  (void)nco_inq_vardimid(in_id,var_in_id,dmn_id);
-  dmn_sz=1L;
-  /* Get dimension sizes from input file */
-  for(idx=0;idx<dmn_nbr;idx++){
-    (void)nco_inq_dimlen(in_id,dmn_id[idx],dmn_cnt+idx);
-    dmn_srt[idx]=0L;
-    dmn_sz*=dmn_cnt[idx];
-  } /* end loop over dim */
-  max_idx[crd_idx_f_0bs_lat_src]=dmn_sz; /* [nbr] Number of elements in dimensions */
-
-  /* Allocate space for and obtain latitude */
-  lat_in=(double *)nco_malloc(dmn_sz*nco_typ_lng(crd_typ_out));
-  rcd=nco_get_vara(in_id,var_in_id,dmn_srt,dmn_cnt,lat_in,crd_typ_out);
-
-  /* Initialize before any other ESMC API calls!
-     ESMC_ArgLast is ALWAYS at the end to indicate the end of opt args */
-  ESMC_Initialize(&rcd_esmf,
-		  ESMC_InitArgDefaultCalKind(ESMC_CALKIND_GREGORIAN),
-		  ESMC_InitArgLogFilename(fl_nm_esmf_log),
-		  ESMC_InitArgLogKindFlag(ESMC_LOGKIND_MULTI),
-		  ESMC_ArgLast);
-  enum ESMC_LogMsgType_Flag log_msg_typ=ESMC_LOGMSG_TRACE;
-  if(rcd_esmf != ESMF_SUCCESS){
-    ESMC_LogWrite("ESMC_Initialize() failed",log_msg_typ);
-    goto rgr_cln;
-  } /* endif */
-  
-  /* Set log to flush after every message */
-  rcd_esmf=ESMC_LogSet(ESMF_TRUE);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-  /* Obtain VM */
-  ESMC_VM vm;
-  vm=ESMC_VMGetGlobal(&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  /* Set-up local PET info */
-  /* Source: ${DATA}/esmf/src/Infrastructure/VM/interface/ESMC_VM.C */
-  rcd_esmf=ESMC_VMGet(vm,&localPet,&petCount,&peCount,(MPI_Comm *)NULL,&flg_pthreadsEnabledFlag,&flg_openMPEnabledFlag);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  /* Create destination grid from SCRIP file set as rgr_grd_dst */
-  int flg_isSphere=1; /* [flg] Set to 1 for a spherical grid, or 0 for regional. Defaults to 1. */
-  int flg_addCornerStagger=0; /* [flg] Add corner stagger to grid. Defaults to 0. */
-  int flg_addUserArea=0; /* [flg] Read cell area from Grid file (instead of calculate it). Defaults to 0. */
-  int flg_addMask=0; /* [flg] Generate mask using missing value attribute in var_nm (iff GRIDSPEC) */
-  /* 20150424: ESMF library bug at ESMCI_Grid.C line 365 means var_nm must non-NULL so set to blank name */
-  char var_nm[]=""; /* [sng] Iff addMask == 1 use this variable's missing value attribute */
-  char **crd_nm=NULL; /* [sng] Iff GRIDSPEC use these lon/lat variable coordinates */
-  enum ESMC_FileFormat_Flag grd_fl_typ=ESMC_FILEFORMAT_SCRIP;
-  ESMC_Grid grd_dst;
-  grd_dst=ESMC_GridCreateFromFile(rgr->fl_grd_dst,grd_fl_typ,&flg_isSphere,&flg_addCornerStagger,&flg_addUserArea,&flg_addMask,var_nm,crd_nm,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  int *msk_dst; /* [enm] Destination grid mask */
-  enum ESMC_GridItem_Flag grd_itm=ESMC_GRIDITEM_MASK;
-  msk_dst=ESMC_GridGetItem(grd_dst,grd_itm,stg_lcn_dst,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  int *bnd_lwr_dst=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
-  int *bnd_upr_dst=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
-  double *lon_dst; /* [dgr] Destination grid longitude */
-  double *lat_dst; /* [dgr] Destination grid latitude */
-  /* 20150427: Written documentation is somewhat inadequate or misleading to normal C-programmers
-     Some ESMC_Grid***() functions, like this one, return allocated void pointers that must be cast to desired numeric type
-     Source: ${DATA}/esmf/src/Infrastructure/Grid/interface/ESMC_Grid.C */
-  lon_dst=ESMC_GridGetCoord(grd_dst,crd_idx_f_1bs_lon_dst,stg_lcn_dst,bnd_lwr_dst,bnd_upr_dst,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-  lat_dst=ESMC_GridGetCoord(grd_dst,crd_idx_f_1bs_lat_dst,stg_lcn_dst,bnd_lwr_dst,bnd_upr_dst,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  double *lon_out; /* [dgr] Longitude dimension for output file */
-  double *lat_out; /* [dgr] Latitude  dimension for output file */
-  lon_out=(double *)nco_malloc(bnd_upr_dst[crd_idx_f_0bs_lon_dst]*sizeof(double));
-  lat_out=(double *)nco_malloc(bnd_upr_dst[crd_idx_f_0bs_lat_dst]*sizeof(double));
-  for(idx=0;idx<bnd_upr_dst[crd_idx_f_0bs_lon_dst];idx++) lon_out[idx]=lon_dst[idx];
-  for(idx=0;idx<bnd_upr_dst[crd_idx_f_0bs_lat_dst];idx++) lat_out[idx]=lat_dst[idx];
-  const long var_sz_dst=bnd_upr_dst[crd_idx_f_0bs_lon_dst]*bnd_upr_dst[crd_idx_f_0bs_lat_dst]; /* [nbr] Number of elements in variable */
-  for(idx=0;idx<var_sz_dst;idx++) msk_dst[idx]=0;
-
-  /* Create source grid with same sizes as those in input data file */
-  ESMC_InterfaceInt max_idx_src;
-  /* Source: ${DATA}/esmf/src/Infrastructure/Util/interface/ESMC_Interface.C
-     NB: ESMF is fragile in that dynamic memory provided as input to grids cannot be immediately freed
-     In other words, ESMF copies the values of pointers but not the contents of pointers to provided arrays
-     To be concrete, the max_idx array provided below cannot be freed until after the ESMC_Finalize() is called */
-  max_idx_src=ESMC_InterfaceIntCreate(max_idx,dmn_nbr_grd,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  enum ESMC_CoordSys_Flag crd_sys=ESMC_COORDSYS_SPH_DEG; /* NB: dyw sez ESMF supports ESMC_COORDSYS_SPH_DEG only */
-  enum ESMC_TypeKind_Flag typ_knd=ESMC_TYPEKIND_R8; /* NB: NCO default is to use double precision for coordinates */
-  ESMC_Grid grd_src;
-  /* Source: ${DATA}/esmf/src/Infrastructure/Grid/interface/ESMC_Grid.C */
-  grd_src=ESMC_GridCreateNoPeriDim(max_idx_src,&crd_sys,&typ_knd,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-  /* fxm: why destroy this now? */
-  ESMC_InterfaceIntDestroy(&max_idx_src);
-  /* Define stagger locations on source grid. Necessary for remapping later? */
-  rcd_esmf=ESMC_GridAddCoord(grd_src,stg_lcn_src);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-  
-  /* Allocate */
-  int *bnd_lwr_src=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
-  int *bnd_upr_src=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
-  double *lon_src; /* [dgr] Source grid longitude */
-  double *lat_src; /* [dgr] Source grid latitude  */
-  lon_src=(double *)ESMC_GridGetCoord(grd_src,crd_idx_f_1bs_lon_src,stg_lcn_src,bnd_lwr_src,bnd_upr_src,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-  lat_src=(double *)ESMC_GridGetCoord(grd_src,crd_idx_f_1bs_lat_src,stg_lcn_src,NULL,NULL,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  if(nco_dbg_lvl_get() >= nco_dbg_crr){
-    (void)fprintf(stderr,"%s: INFO %s reports\n",nco_prg_nm_get(),fnc_nm);
-    (void)fprintf(stderr,"ESMC_VMGet(): localPet = %d, petCount = %d, peCount = %d, pthreadsEnabledFlag = %s, openMPEnabledFlag = %s\n",localPet,petCount,peCount,flg_pthreadsEnabledFlag ? "Enabled" : "Disabled",flg_openMPEnabledFlag ? "Enabled" : "Disabled");
-    (void)fprintf(stderr,"ESMC_GridCreateFromFile(): filename = %s, fileTypeFlag = %s, isSphere = %s, addCornerStagger = %s, addUserArea = %s, addMask = %s, var_nm = %s, crd_nm = %s\n",rgr->fl_grd_dst,nco_esmf_fl_fmt_sng(grd_fl_typ),flg_isSphere ? "Enabled" : "Disabled",flg_addCornerStagger ? "Enabled" : "Disabled",flg_addUserArea ? "Enabled" : "Disabled",flg_addMask ? "Enabled" : "Disabled",var_nm,crd_nm ? "non-NULL" : "NULL");
-    (void)fprintf(stderr,"ESMC_GridGetCoord(): bnd_lwr_dst[0..1] = %d, %d; bnd_upr_dst[0..1] = %d, %d;\n",bnd_lwr_dst[0],bnd_lwr_dst[1],bnd_upr_dst[0],bnd_upr_dst[1]);
-    (void)fprintf(stderr,"ESMC_InterfaceIntCreate(): No printable information\n");
-    (void)fprintf(stderr,"ESMC_GridCreateNoPeriDim(): crd_sys = %s, typ_knd = %s\n",nco_esmf_crd_sys_sng(crd_sys),nco_esmf_typ_knd_sng(typ_knd));
-    (void)fprintf(stderr,"ESMC_GridAddCoord(): stg_lcn_src = %s,  stg_lcn_dst = %s\n",nco_esmf_stg_lcn_sng(stg_lcn_src),nco_esmf_stg_lcn_sng(stg_lcn_dst));
-    (void)fprintf(stderr,"ESMC_GridGetCoord(): bnd_lwr_src[0..1] = %d, %d; bnd_upr_src[0..1] = %d, %d;\n",bnd_lwr_src[0],bnd_lwr_src[1],bnd_upr_src[0],bnd_upr_src[1]);
-    //    (void)fprintf(stderr,"ESMC_InterfaceIntCreate(): max_idx_src[0..1] = %d, %d\n",max_idx_src[0],max_idx_src[1]);
-  } /* endif dbg */
-
-  /* Type-conversion and cell-center coordinates */
-  for(idx=0;idx<bnd_upr_src[crd_idx_f_0bs_lat_src];idx++) lat_src[idx]=lat_in[idx];
-  for(idx=0;idx<bnd_upr_src[crd_idx_f_0bs_lon_src];idx++) lon_src[idx]=lon_in[idx];
-  idx=0;
-  for(int idx_lat=0;idx_lat<bnd_upr_src[crd_idx_f_0bs_lat_src];idx_lat++){
-    for(int idx_lon=0;idx_lon<bnd_upr_src[crd_idx_f_0bs_lon_src];idx_lon++){
-      lon_src[idx]=lon_in[idx_lon];
-      lat_src[idx]=lat_in[idx_lat];
-      idx++;
-    } /* endfor */
-  } /* endfor */
-  
-  /* Create source field from source grid */
-  ESMC_Field fld_src;
-  ESMC_InterfaceInt *gridToFieldMap=NULL; /* [idx] Map of all grid dimensions to field dimensions */
-  ESMC_InterfaceInt *ungriddedLBound=NULL; /* [idx] Lower bounds of ungridded dimensions */
-  ESMC_InterfaceInt *ungriddedUBound=NULL; /* [idx] Upper bounds of ungridded dimensions */
-  fld_src=ESMC_FieldCreateGridTypeKind(grd_src,typ_knd,stg_lcn_src,gridToFieldMap,ungriddedLBound,ungriddedUBound,"fld_src",&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-  /* Create destination field from destination grid */
-  ESMC_Field fld_dst;
-  fld_dst=ESMC_FieldCreateGridTypeKind(grd_dst,typ_knd,stg_lcn_dst,gridToFieldMap,ungriddedLBound,ungriddedUBound,"fld_dst",&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  /* Get field pointers */
-  double *fld_src_ptr;
-  int localDe=0; /* [idx] Local DE for which information is requested [0..localDeCount-1] */
-  fld_src_ptr=(double *)ESMC_FieldGetPtr(fld_src,localDe,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-  double *fld_dst_ptr;
-  fld_dst_ptr=(double *)ESMC_FieldGetPtr(fld_dst,localDe,&rcd_esmf);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  /* Get variables from input file */
-  (void)nco_inq_varid(in_id,rgr->var_nm,&var_in_id);
-  (void)nco_inq_var(in_id,var_in_id,(char *)NULL,&var_typ_in,&dmn_nbr,(int *)NULL,(int *)NULL);
-  /* Get dimension IDs from input file */
-  (void)nco_inq_vardimid(in_id,var_in_id,dmn_id);
-  long var_sz_src=1L; /* [nbr] Number of elements in variable (will be self-multiplied) */
-  /* Get input dimension sizes */
-  for(idx=0;idx<dmn_nbr;idx++){
-    (void)nco_inq_dimlen(in_id,dmn_id[idx],dmn_cnt+idx);
-    dmn_srt[idx]=0L;
-    var_sz_src*=dmn_cnt[idx];
-  } /* end loop over dim */
-
-  /* Allocate space for and obtain input latitude */
-  void_ptr_var=(void *)nco_malloc_dbg(var_sz_src*nco_typ_lng(var_typ_in),"Unable to malloc() value buffer when copying hyperslab from input to output file",fnc_nm);
-  rcd=nco_get_vara(in_id,var_in_id,dmn_srt,dmn_cnt,void_ptr_var,var_typ_in);
-  float *var_fld=(float *)void_ptr_var;
-
-  /* Type-conversion and ensure every cell has data */
-  idx=0;
-  for(int idx_lat=bnd_lwr_src[crd_idx_f_0bs_lat_src];idx_lat<=bnd_upr_src[crd_idx_f_0bs_lat_src];idx_lat++){
-    for(int idx_lon=bnd_lwr_src[crd_idx_f_0bs_lon_src];idx_lon<=bnd_upr_src[crd_idx_f_0bs_lon_src];idx_lon++){
-      fld_src_ptr[idx]=(double)var_fld[idx];
-      idx++;
-    } /* idx_lon */
-  } /* idx_lat */
-
-  /* Initialize dst data ptr */
-  idx=0;
-  for(int idx_lat=bnd_lwr_dst[crd_idx_f_0bs_lat_src];idx_lat<=bnd_upr_dst[crd_idx_f_0bs_lat_src];idx_lat++){
-    for(int idx_lon=bnd_lwr_dst[crd_idx_f_0bs_lon_src];idx_lon<=bnd_upr_dst[crd_idx_f_0bs_lon_src];idx_lon++){
-      fld_dst_ptr[idx]=0.0;
-      idx++;
-    } /* idx_lon */
-  } /* idx_lat */
-
-  ESMC_LogWrite("nco_rgr_esmf() invoking ESMC to start regridstore actions",log_msg_typ);
-  /* int *msk_val=(int *)nco_malloc(sizeof(int));
-     msk_val[0]=1;
-     ESMC_InterfaceInt i_msk_val=ESMC_InterfaceIntCreate(msk_val,1,&rcd_esmf);
-     rcd_esmf = ESMC_FieldRegridStore(fld_src,fld_dst,&i_msk_val,&i_msk_val,&rte_hnd,NULL,NULL,NULL,&unmap_act,NULL,NULL);
-     rcd_esmf=ESMC_FieldRegridStore(fld_src,fld_dst,NULL,NULL,&rte_hnd,NULL,NULL,NULL,&unmap_act,NULL,NULL); */
-
-  ESMC_Field *cll_frc_dst=NULL; /* [frc] Fraction of each cell participating in regridding, destination grid */
-  ESMC_Field *cll_frc_src=NULL; /* [frc] Fraction of each cell participating in regridding, source grid */
-  ESMC_InterfaceInt *msk_src_rgr=NULL; /* [idx] Points to mask while regridding, source grid */
-  /* fxm: unsure whether/why need both msk_dst (above) and msk_dst_rgr (below) */
-  ESMC_InterfaceInt *msk_dst_rgr=NULL; /* [idx] Points to mask while regridding, destination grid */
-  ESMC_RouteHandle rte_hnd;
-  enum ESMC_RegridMethod_Flag rgr_mth=ESMC_REGRIDMETHOD_BILINEAR; /* [flg] Regrid method (default bilinear) */
-  enum ESMC_PoleMethod_Flag pll_mth=ESMC_POLEMETHOD_ALLAVG; /* [flg] Regrid method (default ESMC_POLEMETHOD_ALLAVG) */
-  enum ESMC_UnmappedAction_Flag unm_act=ESMC_UNMAPPEDACTION_ERROR; /* [flg] Unmapped action (default ESMC_UNMAPPEDACTION_ERROR) */
-  int pll_nbr=int_CEWI; /* [nbr] Number of points to average (iff ESMC_POLEMETHOD_NPNTAVG) */
-  /* Source: ${DATA}/esmf/src/Infrastructure/Field/interface/ESMC_Field.C */
-  rcd_esmf=ESMC_FieldRegridStore(fld_src,fld_dst,msk_src_rgr,msk_dst_rgr,&rte_hnd,&rgr_mth,&pll_mth,&pll_nbr,&unm_act,cll_frc_src,cll_frc_dst);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  enum ESMC_Region_Flag rgn_flg=ESMC_REGION_TOTAL; /* [flg] Whether/how to zero input fields before regridding (default ESMC_REGION_TOTAL) */
-  rcd_esmf=ESMC_FieldRegrid(fld_src,fld_dst,rte_hnd,&rgn_flg);
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  /* Call once on each PET */
-  rcd_esmf=ESMC_Finalize();
-  if(rcd_esmf != ESMF_SUCCESS) goto rgr_cln;
-
-  /* Write regridded data to netCDF file */
-  int var_out_id; /* [id] Variable ID */
-  int lon_out_id; /* [id] Variable ID for longitude */
-  int lat_out_id; /* [id] Variable ID for latitude  */
-  int dmn_id_lat; /* [id] Dimension ID */
-  int dmn_id_lon; /* [id] Dimension ID */
-  char *lat_nm_out=lat_nm_in;
-  char *lon_nm_out=lon_nm_in;
-  (void)nco_def_dim(out_id,lat_nm_out,bnd_upr_dst[crd_idx_f_0bs_lat_dst],&dmn_id_lat);
-  (void)nco_def_dim(out_id,lon_nm_out,bnd_upr_dst[crd_idx_f_0bs_lon_dst],&dmn_id_lon);
-  int dmn_ids_out[2]; /* [id] Dimension IDs array for output variable */
-  long dmn_srt_out[2];
-  long dmn_cnt_out[2];
-  dmn_ids_out[crd_idx_c_0bs_lat_dst]=dmn_id_lat;
-  dmn_ids_out[crd_idx_c_0bs_lon_dst]=dmn_id_lon;
-  (void)nco_def_var(out_id,lon_nm_out,crd_typ_out,(int)1,&dmn_id_lon,&lon_out_id);
-  (void)nco_def_var(out_id,lat_nm_out,crd_typ_out,(int)1,&dmn_id_lat,&lat_out_id);
-  (void)nco_def_var(out_id,rgr->var_nm,var_typ_out,(int)2,dmn_ids_out,&var_out_id);
-  (void)nco_enddef(out_id);
-  dmn_srt_out[crd_idx_c_0bs_lat_dst]=0L;
-  dmn_srt_out[crd_idx_c_0bs_lon_dst]=0L;
-  dmn_cnt_out[crd_idx_c_0bs_lat_dst]=bnd_upr_dst[crd_idx_f_0bs_lat_dst];
-  dmn_cnt_out[crd_idx_c_0bs_lon_dst]=bnd_upr_dst[crd_idx_f_0bs_lon_dst];
-  (void)nco_put_vara(out_id,lat_out_id,dmn_srt_out,dmn_cnt_out,lat_out,crd_typ_out);
-  (void)nco_put_vara(out_id,lon_out_id,dmn_srt_out,dmn_cnt_out,lon_out,crd_typ_out);
-  (void)nco_put_vara(out_id,var_out_id,dmn_srt_out,dmn_cnt_out,fld_dst_ptr,var_typ_out);
-
-  /* Close output file and move it from temporary to permanent location */
-  (void)nco_fl_out_cls(rgr->fl_out,rgr->fl_out_tmp,out_id);
-
-rgr_cln:
-  if(rcd_esmf != ESMF_SUCCESS){
-    /* ESMF return codes are enumerated in ESMC_ReturnCodes.h and ESMC_LogErr.h
-       However, there seems to be no translator function for these codes */
-    (void)fprintf(stderr,"%s: ERROR %s received ESMF return code %d\nSee ESMC_ReturnCodes.h or ESMC_LogErr.h for more information, e.g.,\n/bin/more /usr/local/include/ESMC_ReturnCodes.h | grep %d\n",nco_prg_nm_get(),fnc_nm,rcd_esmf,rcd_esmf);
-  } /* rcd_esmf */
-  if(max_idx) max_idx=(int *)nco_free(max_idx);
-  if(bnd_lwr_src) bnd_lwr_src=(int *)nco_free(bnd_lwr_src);
-  if(bnd_upr_src) bnd_upr_src=(int *)nco_free(bnd_upr_src);
-  if(bnd_lwr_dst) bnd_lwr_dst=(int *)nco_free(bnd_lwr_dst);
-  if(bnd_upr_dst) bnd_upr_dst=(int *)nco_free(bnd_upr_dst);
-  if(void_ptr_var) void_ptr_var=(void *)nco_free(void_ptr_var);
-  if(lat_out) lat_out=(double *)nco_free(lat_out);
-  if(lon_out) lon_out=(double *)nco_free(lon_out);
-  if(dmn_cnt) dmn_cnt=(long *)nco_free(dmn_cnt);
-  if(dmn_id) dmn_id=(int *)nco_free(dmn_id);
-  if(dmn_srt) dmn_srt=(long *)nco_free(dmn_srt);
-
-  rcd_esmf=ESMC_FieldRegridRelease(&rte_hnd);
-  rcd_esmf=ESMC_FieldDestroy(&fld_src);
-  rcd_esmf=ESMC_FieldDestroy(&fld_dst);
-  rcd_esmf=ESMC_GridDestroy(&grd_src);
-  rcd_esmf=ESMC_GridDestroy(&grd_dst);
-  ESMC_Finalize();
-
-  return rcd;
-} /* nco_rgr_esmf */
-#endif /* !ENABLE_ESMF */
-
diff --git a/src/nco/nco_rgr.h b/src/nco/nco_rgr.h
index 9e43236..0a6dcf4 100644
--- a/src/nco/nco_rgr.h
+++ b/src/nco/nco_rgr.h
@@ -22,14 +22,12 @@
 /* 3rd party vendors */
 #include <netcdf.h> /* netCDF definitions and C library */
 #include "nco_netcdf.h" /* NCO wrappers for netCDF C library */
-#ifdef ENABLE_ESMF
-# include <ESMC.h> /* ESMF definitions */
-#endif /* !ENABLE_ESMF */
 
 /* Personal headers */
 #include "nco.h" /* netCDF Operator (NCO) definitions */
 #include "nco_mmr.h" /* Memory management */
 #include "nco_omp.h" /* OpenMP utilities */
+#include "nco_sld.h" /* Swath-Like Data */
 #include "nco_sng_utl.h" /* String utilities */
 
 #ifdef __cplusplus
@@ -59,8 +57,9 @@ extern "C" {
 
   typedef enum nco_rgr_mpf_typ_enm{ /* [enm] Mapfile type enum */
     nco_rgr_mpf_nil=0,
-    nco_rgr_mpf_SCRIP,
     nco_rgr_mpf_ESMF,
+    nco_rgr_mpf_SCRIP,
+    nco_rgr_mpf_Tempest,
   } nco_rgr_mpf_typ_enm;
 
   typedef enum nco_rgr_grd_typ_enm{ /* [enm] Regrid type enum */
@@ -78,12 +77,19 @@ extern "C" {
     nco_grd_2D_ngl_eqi_fst, /* Equi-angle offset grid, FV staggered velocity grid (lat[0]=-89.X)): CIESIN/SEDAC, IGBP-DIS, TOMS AAI */
   } nco_grd_2D_typ_enm;
 
+  typedef enum nco_grd_xtn_enm{ /* [enm] Grid-extent enum */
+    nco_grd_xtn_nil=0,
+    nco_grd_xtn_glb,
+    nco_grd_xtn_rgn,
+  } nco_grd_xtn_enm;
+
   /* ESMF: The normalization attribute describes how the conservative weights are calculated, currently this is always set to "destarea" because this is the only option which we currently support. The setting "destarea" means that the conservative weights are calculated by dividing the area of the intersection of the source and destination cells by the area of the destination cell. This is set even when the weights are not conservative in which case it can be ignored. */
   typedef enum nco_rgr_nrm_typ_enm{ /* [enm] Normalization type enum */
     nco_rgr_nrm_nil=0,
     nco_rgr_nrm_fracarea, /* [] Allowed and explained by SCRIP */
     nco_rgr_nrm_destarea, /* [] Only option supported by ESMF, ignored when non-conservative methods used */
     nco_rgr_nrm_none, /* [] Allowed and explained by SCRIP */
+    nco_rgr_nrm_unknown, /* Tempest */
   } nco_rgr_nrm_typ_enm;
 
   /* ESMF: The map_method attribute indicates the interpolation type. The format of the interpolation weight file was developed by a group outside of ESMF, because of its use by utilities outside of ESMF control, the range of some of the meta data is constrained. The map_method is one of these. Because of this constraint, there is no map method corresponding to patch interpolation. A weight file generated with the "patch" interpolation method will have map_method set to "Bilinear remappi [...]
@@ -91,7 +97,8 @@ extern "C" {
     nco_rgr_mth_nil=0,
     nco_rgr_mth_conservative,
     nco_rgr_mth_bilinear,
-    nco_rgr_mth_none, /* []  */
+    nco_rgr_mth_none,
+    nco_rgr_mth_unknown, /* Tempest */
   } nco_rgr_mth_typ_enm;
 
   typedef struct{ /* nco_map_sct */
@@ -156,6 +163,10 @@ extern "C" {
   nco_grd_2D_sng /* [fnc] Convert two-dimensional grid-type enum to string */
   (const nco_grd_2D_typ_enm nco_grd_2D_typ); /* I [enm] Two-dimensional grid-type enum */
 
+  const char * /* O [sng] String describing grid extent */
+  nco_grd_xtn_sng /* [fnc] Convert two-dimensional grid-extent enum to string */
+  (const nco_grd_xtn_enm nco_grd_xtn); /* I [enm] Grid-extent enum */
+
   const char * /* O [sng] String describing grid conversion */
   nco_rgr_grd_sng /* [fnc] Convert grid conversion enum to string */
   (const nco_rgr_grd_typ_enm nco_rgr_grd_typ); /* I [enm] Grid conversion enum */
@@ -164,6 +175,10 @@ extern "C" {
   nco_rgr_mth_sng /* [fnc] Convert regridding method enum to string */
   (const nco_rgr_mth_typ_enm nco_rgr_mth_typ); /* I [enm] Regridding method enum */
 
+  const char * /* O [sng] String describing mapfile generator */
+  nco_rgr_mpf_sng /* [fnc] Convert mapfile generator enum to string */
+  (const nco_rgr_mpf_typ_enm nco_rgr_mpf_typ); /* I [enm] Mapfile generator enum */
+
   const char * /* O [sng] String describing regridding normalization */
   nco_rgr_nrm_sng /* [fnc] Convert regridding normalization enum to string */
   (const nco_rgr_nrm_typ_enm nco_rgr_nrm_typ); /* I [enm] Regridding normalization enum */
@@ -176,52 +191,6 @@ extern "C" {
   nco_tps_cmd_sng /* [fnc] Convert Tempest remap command enum to command name */
   (const nco_rgr_cmd_typ nco_rgr_cmd); /* I [enm] Tempest remap command enum */
 
-#ifdef ENABLE_ESMF
-  int /* O [enm] Return code */
-  nco_rgr_esmf /* [fnc] Regrid using ESMF library */
-  (rgr_sct * const rgr_nfo); /* I/O [sct] Regridding structure */
-
-  const char * /* O [sng] String version of ESMC_StaggerLoc enum */
-  nco_esmf_stg_lcn_sng /* [fnc] Convert ESMF stagger location enum to string */
-  (const int nco_esmf_stg_lcn); /* I [enm] ESMF stagger location enum ESMC_StaggerLoc */
-  
-  const char * /* O [sng] String version of ESMC_CoordSys_Flag enum */
-  nco_esmf_crd_sys_sng /* [fnc] Convert ESMF coordinate system enum to string */
-  (const int nco_esmf_crd_sys); /* I [enm] ESMF coordinate system enum ESMC_CoordSys_Flag */
-  
-  const char * /* O [sng] String version of ESMC_FileFormat_Flag */
-  nco_esmf_fl_fmt_sng /* [fnc] Convert ESMF file format to string */
-  (const int nco_esmf_fl_fmt); /* I [enm] ESMF file format enum ESMC_FileFormat_Flag */
-
-  const char * /* O [sng] String version of ESMC_GridItem_Flag enum */
-  nco_esmf_grd_itm_sng /* [fnc] Convert ESMF grid item enum to string */
-  (const int nco_esmf_grd_itm); /* I [enm] ESMF grid item enum ESMC_GridItem_Flag */
-  
-  const char * /* O [sng] String version of ESMC_LogMsgType_Flag enum */
-  nco_esmf_log_msg_sng /* [fnc] Convert ESMF log message type enum to string */
-  (const int nco_esmf_log_msg); /* I [enm] ESMF log message type enum ESMC_LogMsgType_Flag */
-  
-  const char * /* O [sng] String version of ESMC_PoleMethod_Flag enum */
-  nco_esmf_pll_mth_sng /* [fnc] Convert ESMF pole method type enum to string */
-  (const int nco_esmf_pll_mth); /* I [enm] ESMF pole method type enum ESMC_PoleMethod_Flag */
-
-  const char * /* O [sng] String version of ESMC_Region_Flag enum */
-  nco_esmf_rgn_flg_sng /* [fnc] Convert ESMF region flag enum to string */
-  (const int nco_esmf_rgn_flg); /* I [enm] ESMF region flag enum ESMC_Region_Flag */
-
-  const char * /* O [sng] String version of ESMC_RegridMethod_Flag enum */
-  nco_esmf_rgr_mth_sng /* [fnc] Convert ESMF regrid method type enum to string */
-  (const int nco_esmf_rgr_mth); /* I [enm] ESMF regrid method type enum ESMC_RegridMethod_Flag */
-
-  const char * /* O [sng] String version of ESMC_TypeKind_Flag enum */
-  nco_esmf_typ_knd_sng /* [fnc] Convert ESMF type kind enum to string */
-  (const int nco_esmf_typ_knd); /* I [enm] ESMF type kind enum ESMC_TypeKind_Flag */
-  
-  const char * /* O [sng] String version of ESMC_UnmappedAction_Flag enum */
-  nco_esmf_unm_act_sng /* [fnc] Convert ESMF unmapped action type enum to string */
-  (const int nco_esmf_unm_act); /* I [enm] ESMF unmapped action type enum ESMC_UnmappedAction_Flag */
-#endif /* !ENABLE_ESMF */
-
 #ifdef __cplusplus
 } /* end extern "C" */
 #endif /* __cplusplus */
diff --git a/src/nco/nco_sld.c b/src/nco/nco_sld.c
index ce4c684..27e324f 100644
--- a/src/nco/nco_sld.c
+++ b/src/nco/nco_sld.c
@@ -7,9 +7,6 @@
    You may redistribute and/or modify NCO under the terms of the 
    GNU General Public License (GPL) Version 3 with exceptions described in the LICENSE file */
 
-/* Usage:
-   ncks -4 -O -C -v ppc_dbl --ppc /ppc_dbl=3 ~/nco/data/in.nc ~/foo.nc */
-
 #include "nco_sld.h" /* Swath-Like Data */
 
 int /* O [rcd] Return code */
@@ -54,3 +51,594 @@ nco_scrip_read /* [fnc] Read, parse, and print contents of SCRIP file */
 
   return NCO_NOERR;
 } /* end nco_scrip_read */
+
+#ifdef ENABLE_ESMF
+const char * /* O [sng] String version of ESMC_FileFormat_Flag */
+nco_esmf_fl_fmt_sng /* [fnc] Convert ESMF file format to string */
+(const int nco_esmf_fl_fmt) /* I [enm] ESMF file format enum ESMC_FileFormat_Flag */
+{
+  /* Purpose: Convert ESMF fileTypeFlag enum to string */
+  switch(nco_esmf_fl_fmt){
+  case ESMC_FILEFORMAT_UNDEFINED: return "ESMC_FILEFORMAT_UNDEFINED";
+  case ESMC_FILEFORMAT_VTK: return "ESMC_FILEFORMAT_VTK";
+  case ESMC_FILEFORMAT_SCRIP: return "ESMC_FILEFORMAT_SCRIP";
+  case ESMC_FILEFORMAT_ESMFMESH: return "ESMC_FILEFORMAT_ESMFMESH";
+  case ESMC_FILEFORMAT_ESMCGRID: return "ESMC_FILEFORMAT_ESMCGRID";
+  case ESMC_FILEFORMAT_UGRID: return "ESMC_FILEFORMAT_UGRID";
+  case ESMC_FILEFORMAT_GRIDSPEC: return "ESMC_FILEFORMAT_GRIDSPEC";
+  default: nco_dfl_case_generic_err(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_fl_fmt_sng() */
+
+const char * /* O [sng] String version of ESMC_StaggerLoc enum */
+nco_esmf_stg_lcn_sng /* [fnc] Convert ESMF stagger location enum to string */
+(const int nco_esmf_stg_lcn) /* I [enm] ESMF stagger location enum ESMC_StaggerLoc */
+{
+  /* Purpose: Convert ESMF stagger location enum ESMC_StaggerLoc to string */
+  switch(nco_esmf_stg_lcn){
+  case ESMC_STAGGERLOC_INVALID: return "ESMC_STAGGERLOC_INVALID";
+  case ESMC_STAGGERLOC_UNINIT: return "ESMC_STAGGERLOC_UNINIT";
+  case ESMC_STAGGERLOC_CENTER: return "ESMC_STAGGERLOC_CENTER";
+  case ESMC_STAGGERLOC_EDGE1: return "ESMC_STAGGERLOC_EDGE1";
+  case ESMC_STAGGERLOC_EDGE2: return "ESMC_STAGGERLOC_EDGE2";
+  case ESMC_STAGGERLOC_CORNER: return "ESMC_STAGGERLOC_CORNER";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_stg_lcn_sng() */
+
+const char * /* O [sng] String version of ESMC_GridItem_Flag enum */
+nco_esmf_grd_itm_sng /* [fnc] Convert ESMF grid item enum to string */
+(const int nco_esmf_grd_itm) /* I [enm] ESMF grid item enum ESMC_GridItem_Flag */
+{
+  /* Purpose: Convert ESMF grid item enum ESMC_GridItem_Flag to string */
+  switch(nco_esmf_grd_itm){
+  case ESMC_GRIDITEM_INVALID: return "ESMC_GRIDITEM_INVALID";
+  case ESMC_GRIDITEM_UNINIT: return "ESMC_GRIDITEM_UNINIT";
+  case ESMC_GRIDITEM_MASK: return "ESMC_GRIDITEM_MASK";
+  case ESMC_GRIDITEM_AREA: return "ESMC_GRIDITEM_AREA";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_grd_itm_sng() */
+
+const char * /* O [sng] String version of ESMC_CoordSys_Flag enum */
+nco_esmf_crd_sys_sng /* [fnc] Convert ESMF coordinate system enum to string */
+(const int nco_esmf_crd_sys) /* I [enm] ESMF coordinate system enum ESMC_CoordSys_Flag */
+{
+  /* Purpose: Convert ESMF coordinate system enum ESMC_CoordSys_Flag to string */
+  switch(nco_esmf_crd_sys){
+  case ESMC_COORDSYS_INVALID: return "ESMC_COORDSYS_INVALID";
+  case ESMC_COORDSYS_UNINIT: return "ESMC_COORDSYS_UNINIT";
+  case ESMC_COORDSYS_CART: return "ESMC_COORDSYS_CART";
+  case ESMC_COORDSYS_SPH_DEG: return "ESMC_COORDSYS_SPH_DEG";
+  case ESMC_COORDSYS_SPH_RAD: return "ESMC_COORDSYS_SPH_RAD";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_crd_sys_sng() */
+
+const char * /* O [sng] String version of ESMC_TypeKind_Flag enum */
+nco_esmf_typ_knd_sng /* [fnc] Convert ESMF type kind enum to string */
+(const int nco_esmf_typ_knd) /* I [enm] ESMF type kind enum ESMC_TypeKind_Flag */
+{
+  /* Purpose: Convert ESMF type kind enum ESMC_TypeKind_Flag to string */
+  switch(nco_esmf_typ_knd){
+  case ESMC_TYPEKIND_I1: return "ESMC_TYPEKIND_I1";
+  case ESMC_TYPEKIND_I2: return "ESMC_TYPEKIND_I2";
+  case ESMC_TYPEKIND_I4: return "ESMC_TYPEKIND_I4";
+  case ESMC_TYPEKIND_I8: return "ESMC_TYPEKIND_I8";
+  case ESMC_TYPEKIND_R4: return "ESMC_TYPEKIND_R4";
+  case ESMC_TYPEKIND_R8: return "ESMC_TYPEKIND_R8";
+  case ESMC_TYPEKIND_LOGICAL: return "ESMC_TYPEKIND_LOGICAL";
+  case ESMC_TYPEKIND_CHARACTER: return "ESMC_TYPEKIND_CHARACTER";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_typ_knd_sng() */
+
+const char * /* O [sng] String version of ESMC_LogMsgType_Flag enum */
+nco_esmf_log_msg_sng /* [fnc] Convert ESMF log message type enum to string */
+(const int nco_esmf_log_msg) /* I [enm] ESMF log message type enum ESMC_LogMsgType_Flag */
+{
+  /* Purpose: Convert ESMF coordinate system enum ESMC_LogMsgType_Flag to string */
+  switch(nco_esmf_log_msg){
+  case ESMC_LOGMSG_INFO: return "ESMC_LOGMSG_INFO";
+  case ESMC_LOGMSG_WARN: return "ESMC_LOGMSG_WARN";
+  case ESMC_LOGMSG_ERROR: return "ESMC_LOGMSG_ERROR";
+  case ESMC_LOGMSG_TRACE: return "ESMC_LOGMSG_TRACE";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_log_msg_sng() */
+
+const char * /* O [sng] String version of ESMC_RegridMethod_Flag enum */
+nco_esmf_rgr_mth_sng /* [fnc] Convert ESMF regrid method type enum to string */
+(const int nco_esmf_rgr_mth) /* I [enm] ESMF regrid method type enum ESMC_RegridMethod_Flag */
+{
+  /* Purpose: Convert ESMF regrid method enum ESMC_RegridMethod_Flag to string */
+  switch(nco_esmf_rgr_mth){
+  case ESMC_REGRIDMETHOD_BILINEAR: return "ESMC_REGRIDMETHOD_BILINEAR";
+  case ESMC_REGRIDMETHOD_PATCH: return "ESMC_REGRIDMETHOD_PATCH";
+  case ESMC_REGRIDMETHOD_CONSERVE: return "ESMC_REGRIDMETHOD_CONSERVE";
+  case ESMC_REGRIDMETHOD_NEAREST_STOD: return "ESMC_REGRIDMETHOD_NEAREST_STOD";
+  case ESMC_REGRIDMETHOD_NEAREST_DTOS: return "ESMC_REGRIDMETHOD_NEAREST_DTOS";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_rgr_mth_sng() */
+
+const char * /* O [sng] String version of ESMC_PoleMethod_Flag enum */
+nco_esmf_pll_mth_sng /* [fnc] Convert ESMF pole method type enum to string */
+(const int nco_esmf_pll_mth) /* I [enm] ESMF pole method type enum ESMC_PoleMethod_Flag */
+{
+  /* Purpose: Convert ESMF pole method enum ESMC_PoleMethod_Flag to string */
+  switch(nco_esmf_pll_mth){
+  case ESMC_POLEMETHOD_NONE: return "ESMC_POLEMETHOD_NONE";
+  case ESMC_POLEMETHOD_ALLAVG: return "ESMC_POLEMETHOD_ALLAVG";
+  case ESMC_POLEMETHOD_NPNTAVG: return "ESMC_POLEMETHOD_NPNTAVG";
+  case ESMC_POLEMETHOD_TEETH: return "ESMC_POLEMETHOD_TEETH";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_pll_mth_sng() */
+
+const char * /* O [sng] String version of ESMC_UnmappedAction_Flag enum */
+nco_esmf_unm_act_sng /* [fnc] Convert ESMF unmapped action type enum to string */
+(const int nco_esmf_unm_act) /* I [enm] ESMF unmapped action type enum ESMC_UnmappedAction_Flag */
+{
+  /* Purpose: Convert ESMF unmapped action enum ESMC_UnmappedAction_Flag to string */
+  switch(nco_esmf_unm_act){
+  case ESMC_UNMAPPEDACTION_ERROR: return "ESMC_UNMAPPEDACTION_ERROR";
+  case ESMC_UNMAPPEDACTION_IGNORE: return "ESMC_UNMAPPEDACTION_IGNORE";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_unm_act_sng() */
+
+const char * /* O [sng] String version of ESMC_Region_Flag enum */
+nco_esmf_rgn_flg_sng /* [fnc] Convert ESMF region flag enum to string */
+(const int nco_esmf_rgn_flg) /* I [enm] ESMF region flag enum ESMC_Region_Flag */
+{
+  /* Purpose: Convert ESMF region flag enum ESMC_Region_Flag to string */
+  switch(nco_esmf_rgn_flg){
+  case ESMC_REGION_TOTAL: return "ESMC_REGION_TOTAL";
+  case ESMC_REGION_SELECT: return "ESMC_REGION_SELECT";
+  case ESMC_REGION_EMPTY: return "ESMC_REGION_EMPTY";
+  default: abort(); break;
+  } /* end switch */
+
+  /* Some compilers: e.g., SGI cc, need return statement to end non-void functions */
+  return (char *)NULL;
+} /* end nco_esmf_rgn_flg_sng() */
+
+int /* O [enm] Return code */
+nco_rgr_esmf /* [fnc] Regrid using ESMF library */
+(rgr_sct * const rgr) /* I/O [sct] Regridding structure */
+{
+  /* Purpose: Regrid fields using ESMF library (actually ESMC interface to ESMF library)
+     ESMC is C-interface to ESMF documented at
+     http://www.earthsystemmodeling.org/esmf_releases/last_built/ESMC_crefdoc/ESMC_crefdoc.html
+     ESMF Developer's Guide
+     http://www.earthsystemmodeling.org/documents/dev_guide
+     ESMF_RegridWeightGen
+     http://www.earthsystemcog.org/projects/regridweightgen
+     http://www.earthsystemmodeling.org/python_releases/last_esmpy/esmpy_doc/html/index.html
+
+     ESMF C-interface examples:
+     ${DATA}/esmf/src/Infrastructure/Field/tests/ESMC_FieldRegridUTest.C
+     ${DATA}/esmf/src/Infrastructure/Field/tests/ESMC_FieldRegridCsrvUTest.C
+
+     Usage:
+     ncks -4 -O -C -v ppc_dbl --ppc /ppc_dbl=3 ~/nco/data/in.nc ~/foo.nc */
+  
+  const char fnc_nm[]="nco_rgr_esmf()"; /* [sng] Function name */
+  const char fl_nm_esmf_log[]="nco_rgr_log_foo.txt"; /* [sng] Log file for ESMF routines */
+  
+  enum ESMC_StaggerLoc stg_lcn_src=ESMC_STAGGERLOC_CENTER; /* [enm] Stagger location of source grid */
+  enum ESMC_StaggerLoc stg_lcn_dst=ESMC_STAGGERLOC_CENTER; /* [enm] Stagger location of destination grid */
+
+  int flg_openMPEnabledFlag; /* [flg] ESMF library was compiled with OpenMP enabled */
+  int flg_pthreadsEnabledFlag; /* [flg] ESMF library was compiled with Pthreads enabled */
+  int localPet; /* [id] ID of PET that issued call */
+  int peCount; /* [nbr] Number of PEs referenced by ESMF_VM */
+  int petCount; /* [nbr] Number of PETs referenced by ESMF_VM */
+  int rcd_esmf; /* [enm] Return codes from ESMF functions */
+  
+  int dmn_nbr_grd=2;
+  int rcd=ESMF_SUCCESS;
+  
+  int *dmn_id;
+  
+  int dmn_nbr;
+  int idx;
+  int var_in_id;
+  
+  long *dmn_cnt;
+  long *dmn_srt;
+  
+  nc_type var_typ_in;
+  nc_type crd_typ_out=NC_DOUBLE;
+  nc_type var_typ_out=NC_DOUBLE;
+  
+  double *lon_in;
+  double *lat_in;
+  void *void_ptr_var;
+  
+  int in_id; /* I [id] Input netCDF file ID */
+  int out_id; /* I [id] Output netCDF file ID */
+
+  /* SCRIP rank-2 grids are almost always lat,lon (C) and lon,lat (Fortran)
+     Indexing is confusing because ESMF always uses Fortran-ordering convention with mixture of 0- and 1-based indices
+     netCDF always uses C-ordering convention with 0-based indices
+     No data transposition is necessary because variable RAM is always in C-order (same as netCDF)
+     However, Fortran and C (i.e., ESMF and netCDF) access that same RAM using different conventions
+     2-D data are always C[lat,lon] or F(lon,lat) in practice
+     2-D stored in netCDF or RAM as C[lon,lat] and F(lat,lon) are possible, though not seen in practice
+     NCO regridding below assumes data are in C[lat,lon] order
+     NCO hardcoded subscript conventions follow this pattern:
+     crd_idx_[axs]_[ibs]_[dmn]_[grd] where
+     axs = access convention = C or Fortran = _c_ or _f_ 
+     ibs = index base = 0 or 1 = _0bs_ or _1bs_ for zero-based or one-based indices
+     NB: axs is independent from ibs! 
+     dmn = dimension = lon or lat
+     grd = grid = source or destination */
+  const int crd_idx_c_0bs_lat_dst=0; /* [dgr] 0-based index of latitude  in C       representation of rank-2 destination grids */
+  const int crd_idx_c_0bs_lon_dst=1; /* [dgr] 0-based index of longitude in C       representation of rank-2 destination grids */
+  const int crd_idx_f_0bs_lat_dst=1; /* [dgr] 0-based index of latitude  in Fortran representation of rank-2 destination grids */
+  const int crd_idx_f_0bs_lat_src=1; /* [dgr] 0-based index of latitude  in Fortran representation of rank-2 source grids */
+  const int crd_idx_f_0bs_lon_dst=0; /* [dgr] 0-based index of longitude in Fortran representation of rank-2 destination grids */
+  const int crd_idx_f_0bs_lon_src=0; /* [dgr] 0-based index of longitude in Fortran representation of rank-2 source grids */
+  const int crd_idx_f_1bs_lat_dst=2; /* [dgr] 1-based index of latitude  in Fortran representation of rank-2 destination grids */
+  const int crd_idx_f_1bs_lat_src=2; /* [dgr] 1-based index of latitude  in Fortran representation of rank-2 source grids */
+  const int crd_idx_f_1bs_lon_dst=1; /* [dgr] 1-based index of longitude in Fortran representation of rank-2 destination grids */
+  const int crd_idx_f_1bs_lon_src=1; /* [dgr] 1-based index of longitude in Fortran representation of rank-2 source grids */
+
+  /* Initialize */
+  in_id=rgr->in_id;
+  out_id=rgr->out_id;
+  
+  /* Obtain input longitude type and length */
+  char lon_nm_in[]="lon";
+  (void)nco_inq_varid(in_id,lon_nm_in,&var_in_id);
+  (void)nco_inq_var(in_id,var_in_id,(char *)NULL,&var_typ_in,&dmn_nbr,(int *)NULL,(int *)NULL);
+  if(var_typ_in != NC_DOUBLE){
+    assert(var_typ_in == NC_FLOAT);
+    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: INFO WARNING Cheapskate regridding input file %s stores coordinate as NC_FLOAT\n",nco_prg_nm_get(),rgr->fl_in);
+  } /* !var_typ_in */
+
+  /* Allocate space to hold dimension metadata */
+  dmn_cnt=(long *)nco_malloc(dmn_nbr*sizeof(long));
+  dmn_id=(int *)nco_malloc(dmn_nbr*sizeof(int));
+  dmn_srt=(long *)nco_malloc(dmn_nbr*sizeof(long));
+  (void)nco_inq_vardimid(in_id,var_in_id,dmn_id);
+  /* Get input dimension sizes */
+  long dmn_sz=1L; /* [nbr] Number of elements in dimension (will be self-multiplied) */
+  for(idx=0;idx<dmn_nbr;idx++){
+    (void)nco_inq_dimlen(in_id,dmn_id[idx],dmn_cnt+idx);
+    dmn_srt[idx]=0L;
+    dmn_sz*=dmn_cnt[idx];
+  } /* end loop over dim */
+  
+  int *max_idx; /* [nbr] Zero-based array containing dimension sizes in order? */
+  max_idx=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
+  max_idx[crd_idx_f_0bs_lon_src]=dmn_sz; /* [nbr] Number of elements in dimensions */
+  
+  /* Allocate space for and obtain longitude */
+  lon_in=(double *)nco_malloc(dmn_sz*nco_typ_lng(crd_typ_out));
+  rcd=nco_get_vara(in_id,var_in_id,dmn_srt,dmn_cnt,lon_in,crd_typ_out);
+
+  /* Obtain input latitude type and length */
+  char lat_nm_in[]="lat";
+  (void)nco_inq_varid(in_id,lat_nm_in,&var_in_id);
+  (void)nco_inq_var(in_id,var_in_id,(char *)NULL,&var_typ_in,&dmn_nbr,(int *)NULL,(int *)NULL);
+  if(var_typ_in != NC_DOUBLE){
+    assert(var_typ_in == NC_FLOAT);
+    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: INFO WARNING Cheapskate regridding input file %s stores coordinate as NC_FLOAT\n",nco_prg_nm_get(),rgr->fl_in);
+  } /* !var_typ_in */
+  (void)nco_inq_vardimid(in_id,var_in_id,dmn_id);
+  dmn_sz=1L;
+  /* Get dimension sizes from input file */
+  for(idx=0;idx<dmn_nbr;idx++){
+    (void)nco_inq_dimlen(in_id,dmn_id[idx],dmn_cnt+idx);
+    dmn_srt[idx]=0L;
+    dmn_sz*=dmn_cnt[idx];
+  } /* end loop over dim */
+  max_idx[crd_idx_f_0bs_lat_src]=dmn_sz; /* [nbr] Number of elements in dimensions */
+
+  /* Allocate space for and obtain latitude */
+  lat_in=(double *)nco_malloc(dmn_sz*nco_typ_lng(crd_typ_out));
+  rcd=nco_get_vara(in_id,var_in_id,dmn_srt,dmn_cnt,lat_in,crd_typ_out);
+
+  /* Initialize before any other ESMC API calls!
+     ESMC_ArgLast is ALWAYS at the end to indicate the end of opt args */
+  ESMC_Initialize(&rcd_esmf,
+		  ESMC_InitArgDefaultCalKind(ESMC_CALKIND_GREGORIAN),
+		  ESMC_InitArgLogFilename(fl_nm_esmf_log),
+		  ESMC_InitArgLogKindFlag(ESMC_LOGKIND_MULTI),
+		  ESMC_ArgLast);
+  enum ESMC_LogMsgType_Flag log_msg_typ=ESMC_LOGMSG_TRACE;
+  if(rcd_esmf != ESMF_SUCCESS){
+    ESMC_LogWrite("ESMC_Initialize() failed",log_msg_typ);
+    /* 20150621: 
+       Prevent clang sometimes uninitialized warnings by using abort() before goto
+       All of the following "abort()" statements could be replace "goto rgr_cln:" statements
+       gcc is fine with this, but it triggers clang "sometimes uninitialized" warnings
+       g++ (without -fpermissive) emits "jump to label" "crosses initialization" warnings 
+       when pointers are declared between the goto statment and the label statement 
+       Hence we abandon the false premise of recovery after ESMC errors, and just abort() */
+    abort();
+  } /* endif */
+  
+  /* Set log to flush after every message */
+  rcd_esmf=ESMC_LogSet(ESMF_TRUE);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+  /* Obtain VM */
+  ESMC_VM vm;
+  vm=ESMC_VMGetGlobal(&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  /* Set-up local PET info */
+  /* Source: ${DATA}/esmf/src/Infrastructure/VM/interface/ESMC_VM.C */
+  rcd_esmf=ESMC_VMGet(vm,&localPet,&petCount,&peCount,(MPI_Comm *)NULL,&flg_pthreadsEnabledFlag,&flg_openMPEnabledFlag);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  /* Create destination grid from SCRIP file set as rgr_grd_dst */
+  int flg_isSphere=1; /* [flg] Set to 1 for a spherical grid, or 0 for regional. Defaults to 1. */
+  int flg_addCornerStagger=0; /* [flg] Add corner stagger to grid. Defaults to 0. */
+  int flg_addUserArea=0; /* [flg] Read cell area from Grid file (instead of calculate it). Defaults to 0. */
+  int flg_addMask=0; /* [flg] Generate mask using missing value attribute in var_nm (iff GRIDSPEC) */
+  /* 20150424: ESMF library bug at ESMCI_Grid.C line 365 means var_nm must non-NULL so set to blank name */
+  char var_nm[]=""; /* [sng] Iff addMask == 1 use this variable's missing value attribute */
+  char **crd_nm=NULL; /* [sng] Iff GRIDSPEC use these lon/lat variable coordinates */
+  enum ESMC_FileFormat_Flag grd_fl_typ=ESMC_FILEFORMAT_SCRIP;
+  ESMC_Grid grd_dst;
+  grd_dst=ESMC_GridCreateFromFile(rgr->fl_grd_dst,grd_fl_typ,&flg_isSphere,&flg_addCornerStagger,&flg_addUserArea,&flg_addMask,var_nm,crd_nm,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  int *msk_dst; /* [enm] Destination grid mask */
+  enum ESMC_GridItem_Flag grd_itm=ESMC_GRIDITEM_MASK;
+  msk_dst=(int *)ESMC_GridGetItem(grd_dst,grd_itm,stg_lcn_dst,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  int *bnd_lwr_dst=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
+  int *bnd_upr_dst=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
+  double *lon_dst; /* [dgr] Destination grid longitude */
+  double *lat_dst; /* [dgr] Destination grid latitude */
+  /* 20150427: Written documentation is somewhat inadequate or misleading to normal C-programmers
+     Some ESMC_Grid***() functions, like this one, return allocated void pointers that must be cast to desired numeric type
+     Source: ${DATA}/esmf/src/Infrastructure/Grid/interface/ESMC_Grid.C */
+  lon_dst=(double *)ESMC_GridGetCoord(grd_dst,crd_idx_f_1bs_lon_dst,stg_lcn_dst,bnd_lwr_dst,bnd_upr_dst,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+  lat_dst=(double *)ESMC_GridGetCoord(grd_dst,crd_idx_f_1bs_lat_dst,stg_lcn_dst,bnd_lwr_dst,bnd_upr_dst,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  double *lon_out; /* [dgr] Longitude dimension for output file */
+  double *lat_out; /* [dgr] Latitude  dimension for output file */
+  lon_out=(double *)nco_malloc(bnd_upr_dst[crd_idx_f_0bs_lon_dst]*sizeof(double));
+  lat_out=(double *)nco_malloc(bnd_upr_dst[crd_idx_f_0bs_lat_dst]*sizeof(double));
+  for(idx=0;idx<bnd_upr_dst[crd_idx_f_0bs_lon_dst];idx++) lon_out[idx]=lon_dst[idx];
+  for(idx=0;idx<bnd_upr_dst[crd_idx_f_0bs_lat_dst];idx++) lat_out[idx]=lat_dst[idx];
+  const long var_sz_dst=bnd_upr_dst[crd_idx_f_0bs_lon_dst]*bnd_upr_dst[crd_idx_f_0bs_lat_dst]; /* [nbr] Number of elements in variable */
+  for(idx=0;idx<var_sz_dst;idx++) msk_dst[idx]=0;
+
+  /* Create source grid with same sizes as those in input data file */
+  ESMC_InterfaceInt max_idx_src;
+  /* Source: ${DATA}/esmf/src/Infrastructure/Util/interface/ESMC_Interface.C
+     NB: ESMF is fragile in that dynamic memory provided as input to grids cannot be immediately freed
+     In other words, ESMF copies the values of pointers but not the contents of pointers to provided arrays
+     To be concrete, the max_idx array provided below cannot be freed until after the ESMC_Finalize() is called */
+  max_idx_src=ESMC_InterfaceIntCreate(max_idx,dmn_nbr_grd,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  enum ESMC_CoordSys_Flag crd_sys=ESMC_COORDSYS_SPH_DEG; /* NB: dyw sez ESMF supports ESMC_COORDSYS_SPH_DEG only */
+  enum ESMC_TypeKind_Flag typ_knd=ESMC_TYPEKIND_R8; /* NB: NCO default is to use double precision for coordinates */
+  ESMC_Grid grd_src;
+  /* Source: ${DATA}/esmf/src/Infrastructure/Grid/interface/ESMC_Grid.C */
+  grd_src=ESMC_GridCreateNoPeriDim(max_idx_src,&crd_sys,&typ_knd,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+  /* fxm: why destroy this now? */
+  ESMC_InterfaceIntDestroy(&max_idx_src);
+  /* Define stagger locations on source grid. Necessary for remapping later? */
+  rcd_esmf=ESMC_GridAddCoord(grd_src,stg_lcn_src);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+  
+  /* Allocate */
+  int *bnd_lwr_src=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
+  int *bnd_upr_src=(int *)nco_malloc(dmn_nbr_grd*sizeof(int));
+  double *lon_src; /* [dgr] Source grid longitude */
+  double *lat_src; /* [dgr] Source grid latitude  */
+  lon_src=(double *)ESMC_GridGetCoord(grd_src,crd_idx_f_1bs_lon_src,stg_lcn_src,bnd_lwr_src,bnd_upr_src,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+  lat_src=(double *)ESMC_GridGetCoord(grd_src,crd_idx_f_1bs_lat_src,stg_lcn_src,NULL,NULL,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  if(nco_dbg_lvl_get() >= nco_dbg_crr){
+    (void)fprintf(stderr,"%s: INFO %s reports\n",nco_prg_nm_get(),fnc_nm);
+    (void)fprintf(stderr,"ESMC_VMGet(): localPet = %d, petCount = %d, peCount = %d, pthreadsEnabledFlag = %s, openMPEnabledFlag = %s\n",localPet,petCount,peCount,flg_pthreadsEnabledFlag ? "Enabled" : "Disabled",flg_openMPEnabledFlag ? "Enabled" : "Disabled");
+    (void)fprintf(stderr,"ESMC_GridCreateFromFile(): filename = %s, fileTypeFlag = %s, isSphere = %s, addCornerStagger = %s, addUserArea = %s, addMask = %s, var_nm = %s, crd_nm = %s\n",rgr->fl_grd_dst,nco_esmf_fl_fmt_sng(grd_fl_typ),flg_isSphere ? "Enabled" : "Disabled",flg_addCornerStagger ? "Enabled" : "Disabled",flg_addUserArea ? "Enabled" : "Disabled",flg_addMask ? "Enabled" : "Disabled",var_nm,crd_nm ? "non-NULL" : "NULL");
+    (void)fprintf(stderr,"ESMC_GridGetCoord(): bnd_lwr_dst[0..1] = %d, %d; bnd_upr_dst[0..1] = %d, %d;\n",bnd_lwr_dst[0],bnd_lwr_dst[1],bnd_upr_dst[0],bnd_upr_dst[1]);
+    (void)fprintf(stderr,"ESMC_InterfaceIntCreate(): No printable information\n");
+    (void)fprintf(stderr,"ESMC_GridCreateNoPeriDim(): crd_sys = %s, typ_knd = %s\n",nco_esmf_crd_sys_sng(crd_sys),nco_esmf_typ_knd_sng(typ_knd));
+    (void)fprintf(stderr,"ESMC_GridAddCoord(): stg_lcn_src = %s,  stg_lcn_dst = %s\n",nco_esmf_stg_lcn_sng(stg_lcn_src),nco_esmf_stg_lcn_sng(stg_lcn_dst));
+    (void)fprintf(stderr,"ESMC_GridGetCoord(): bnd_lwr_src[0..1] = %d, %d; bnd_upr_src[0..1] = %d, %d;\n",bnd_lwr_src[0],bnd_lwr_src[1],bnd_upr_src[0],bnd_upr_src[1]);
+    //    (void)fprintf(stderr,"ESMC_InterfaceIntCreate(): max_idx_src[0..1] = %d, %d\n",max_idx_src[0],max_idx_src[1]);
+  } /* endif dbg */
+
+  /* Type-conversion and cell-center coordinates */
+  for(idx=0;idx<bnd_upr_src[crd_idx_f_0bs_lat_src];idx++) lat_src[idx]=lat_in[idx];
+  for(idx=0;idx<bnd_upr_src[crd_idx_f_0bs_lon_src];idx++) lon_src[idx]=lon_in[idx];
+  idx=0;
+  for(int idx_lat=0;idx_lat<bnd_upr_src[crd_idx_f_0bs_lat_src];idx_lat++){
+    for(int idx_lon=0;idx_lon<bnd_upr_src[crd_idx_f_0bs_lon_src];idx_lon++){
+      lon_src[idx]=lon_in[idx_lon];
+      lat_src[idx]=lat_in[idx_lat];
+      idx++;
+    } /* endfor */
+  } /* endfor */
+  
+  /* Create source field from source grid */
+  ESMC_Field fld_src;
+  ESMC_InterfaceInt *gridToFieldMap=NULL; /* [idx] Map of all grid dimensions to field dimensions */
+  ESMC_InterfaceInt *ungriddedLBound=NULL; /* [idx] Lower bounds of ungridded dimensions */
+  ESMC_InterfaceInt *ungriddedUBound=NULL; /* [idx] Upper bounds of ungridded dimensions */
+  fld_src=ESMC_FieldCreateGridTypeKind(grd_src,typ_knd,stg_lcn_src,gridToFieldMap,ungriddedLBound,ungriddedUBound,"fld_src",&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+  /* Create destination field from destination grid */
+  ESMC_Field fld_dst;
+  fld_dst=ESMC_FieldCreateGridTypeKind(grd_dst,typ_knd,stg_lcn_dst,gridToFieldMap,ungriddedLBound,ungriddedUBound,"fld_dst",&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  /* Get field pointers */
+  double *fld_src_ptr;
+  int localDe=0; /* [idx] Local DE for which information is requested [0..localDeCount-1] */
+  fld_src_ptr=(double *)ESMC_FieldGetPtr(fld_src,localDe,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+  double *fld_dst_ptr;
+  fld_dst_ptr=(double *)ESMC_FieldGetPtr(fld_dst,localDe,&rcd_esmf);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  /* Get variables from input file */
+  (void)nco_inq_varid(in_id,rgr->var_nm,&var_in_id);
+  (void)nco_inq_var(in_id,var_in_id,(char *)NULL,&var_typ_in,&dmn_nbr,(int *)NULL,(int *)NULL);
+  /* Get dimension IDs from input file */
+  (void)nco_inq_vardimid(in_id,var_in_id,dmn_id);
+  long var_sz_src=1L; /* [nbr] Number of elements in variable (will be self-multiplied) */
+  /* Get input dimension sizes */
+  for(idx=0;idx<dmn_nbr;idx++){
+    (void)nco_inq_dimlen(in_id,dmn_id[idx],dmn_cnt+idx);
+    dmn_srt[idx]=0L;
+    var_sz_src*=dmn_cnt[idx];
+  } /* end loop over dim */
+
+  /* Allocate space for and obtain input latitude */
+  void_ptr_var=(void *)nco_malloc_dbg(var_sz_src*nco_typ_lng(var_typ_in),"Unable to malloc() value buffer when copying hyperslab from input to output file",fnc_nm);
+  rcd=nco_get_vara(in_id,var_in_id,dmn_srt,dmn_cnt,void_ptr_var,var_typ_in);
+  float *var_fld=(float *)void_ptr_var;
+
+  /* Type-conversion and ensure every cell has data */
+  idx=0;
+  for(int idx_lat=bnd_lwr_src[crd_idx_f_0bs_lat_src];idx_lat<=bnd_upr_src[crd_idx_f_0bs_lat_src];idx_lat++){
+    for(int idx_lon=bnd_lwr_src[crd_idx_f_0bs_lon_src];idx_lon<=bnd_upr_src[crd_idx_f_0bs_lon_src];idx_lon++){
+      fld_src_ptr[idx]=(double)var_fld[idx];
+      idx++;
+    } /* idx_lon */
+  } /* idx_lat */
+
+  /* Initialize dst data ptr */
+  idx=0;
+  for(int idx_lat=bnd_lwr_dst[crd_idx_f_0bs_lat_src];idx_lat<=bnd_upr_dst[crd_idx_f_0bs_lat_src];idx_lat++){
+    for(int idx_lon=bnd_lwr_dst[crd_idx_f_0bs_lon_src];idx_lon<=bnd_upr_dst[crd_idx_f_0bs_lon_src];idx_lon++){
+      fld_dst_ptr[idx]=0.0;
+      idx++;
+    } /* idx_lon */
+  } /* idx_lat */
+
+  ESMC_LogWrite("nco_rgr_esmf() invoking ESMC to start regridstore actions",log_msg_typ);
+  /* int *msk_val=(int *)nco_malloc(sizeof(int));
+     msk_val[0]=1;
+     ESMC_InterfaceInt i_msk_val=ESMC_InterfaceIntCreate(msk_val,1,&rcd_esmf);
+     rcd_esmf = ESMC_FieldRegridStore(fld_src,fld_dst,&i_msk_val,&i_msk_val,&rte_hnd,NULL,NULL,NULL,&unmap_act,NULL,NULL);
+     rcd_esmf=ESMC_FieldRegridStore(fld_src,fld_dst,NULL,NULL,&rte_hnd,NULL,NULL,NULL,&unmap_act,NULL,NULL); */
+
+  ESMC_Field *cll_frc_dst=NULL; /* [frc] Fraction of each cell participating in regridding, destination grid */
+  ESMC_Field *cll_frc_src=NULL; /* [frc] Fraction of each cell participating in regridding, source grid */
+  ESMC_InterfaceInt *msk_src_rgr=NULL; /* [idx] Points to mask while regridding, source grid */
+  /* fxm: unsure whether/why need both msk_dst (above) and msk_dst_rgr (below) */
+  ESMC_InterfaceInt *msk_dst_rgr=NULL; /* [idx] Points to mask while regridding, destination grid */
+  ESMC_RouteHandle rte_hnd;
+  enum ESMC_RegridMethod_Flag rgr_mth=ESMC_REGRIDMETHOD_BILINEAR; /* [flg] Regrid method (default bilinear) */
+  enum ESMC_PoleMethod_Flag pll_mth=ESMC_POLEMETHOD_ALLAVG; /* [flg] Regrid method (default ESMC_POLEMETHOD_ALLAVG) */
+  enum ESMC_UnmappedAction_Flag unm_act=ESMC_UNMAPPEDACTION_ERROR; /* [flg] Unmapped action (default ESMC_UNMAPPEDACTION_ERROR) */
+  int pll_nbr=int_CEWI; /* [nbr] Number of points to average (iff ESMC_POLEMETHOD_NPNTAVG) */
+  /* Source: ${DATA}/esmf/src/Infrastructure/Field/interface/ESMC_Field.C */
+  rcd_esmf=ESMC_FieldRegridStore(fld_src,fld_dst,msk_src_rgr,msk_dst_rgr,&rte_hnd,&rgr_mth,&pll_mth,&pll_nbr,&unm_act,cll_frc_src,cll_frc_dst);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  enum ESMC_Region_Flag rgn_flg=ESMC_REGION_TOTAL; /* [flg] Whether/how to zero input fields before regridding (default ESMC_REGION_TOTAL) */
+  rcd_esmf=ESMC_FieldRegrid(fld_src,fld_dst,rte_hnd,&rgn_flg);
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  /* Call once on each PET */
+  rcd_esmf=ESMC_Finalize();
+  if(rcd_esmf != ESMF_SUCCESS) abort();
+
+  /* Write regridded data to netCDF file */
+  int var_out_id; /* [id] Variable ID */
+  int lon_out_id; /* [id] Variable ID for longitude */
+  int lat_out_id; /* [id] Variable ID for latitude  */
+  int dmn_id_lat; /* [id] Dimension ID */
+  int dmn_id_lon; /* [id] Dimension ID */
+  char *lat_nm_out=lat_nm_in;
+  char *lon_nm_out=lon_nm_in;
+  (void)nco_def_dim(out_id,lat_nm_out,bnd_upr_dst[crd_idx_f_0bs_lat_dst],&dmn_id_lat);
+  (void)nco_def_dim(out_id,lon_nm_out,bnd_upr_dst[crd_idx_f_0bs_lon_dst],&dmn_id_lon);
+  int dmn_ids_out[2]; /* [id] Dimension IDs array for output variable */
+  long dmn_srt_out[2];
+  long dmn_cnt_out[2];
+  dmn_ids_out[crd_idx_c_0bs_lat_dst]=dmn_id_lat;
+  dmn_ids_out[crd_idx_c_0bs_lon_dst]=dmn_id_lon;
+  (void)nco_def_var(out_id,lon_nm_out,crd_typ_out,(int)1,&dmn_id_lon,&lon_out_id);
+  (void)nco_def_var(out_id,lat_nm_out,crd_typ_out,(int)1,&dmn_id_lat,&lat_out_id);
+  (void)nco_def_var(out_id,rgr->var_nm,var_typ_out,(int)2,dmn_ids_out,&var_out_id);
+  (void)nco_enddef(out_id);
+  dmn_srt_out[crd_idx_c_0bs_lat_dst]=0L;
+  dmn_srt_out[crd_idx_c_0bs_lon_dst]=0L;
+  dmn_cnt_out[crd_idx_c_0bs_lat_dst]=bnd_upr_dst[crd_idx_f_0bs_lat_dst];
+  dmn_cnt_out[crd_idx_c_0bs_lon_dst]=bnd_upr_dst[crd_idx_f_0bs_lon_dst];
+  (void)nco_put_vara(out_id,lat_out_id,dmn_srt_out,dmn_cnt_out,lat_out,crd_typ_out);
+  (void)nco_put_vara(out_id,lon_out_id,dmn_srt_out,dmn_cnt_out,lon_out,crd_typ_out);
+  (void)nco_put_vara(out_id,var_out_id,dmn_srt_out,dmn_cnt_out,fld_dst_ptr,var_typ_out);
+
+  /* Close output file and move it from temporary to permanent location */
+  (void)nco_fl_out_cls(rgr->fl_out,rgr->fl_out_tmp,out_id);
+
+  goto rgr_cln; /* Prevent 'rgr_cln' defined but not used warning */
+
+ rgr_cln:
+  if(rcd_esmf != ESMF_SUCCESS){
+    /* ESMF return codes are enumerated in ESMC_ReturnCodes.h and ESMC_LogErr.h
+       However, there seems to be no translator function for these codes */
+    (void)fprintf(stderr,"%s: ERROR %s received ESMF return code %d\nSee ESMC_ReturnCodes.h or ESMC_LogErr.h for more information, e.g.,\n/bin/more /usr/local/include/ESMC_ReturnCodes.h | grep %d\n",nco_prg_nm_get(),fnc_nm,rcd_esmf,rcd_esmf);
+  } /* rcd_esmf */
+  if(max_idx) max_idx=(int *)nco_free(max_idx);
+  if(bnd_lwr_src) bnd_lwr_src=(int *)nco_free(bnd_lwr_src);
+  if(bnd_upr_src) bnd_upr_src=(int *)nco_free(bnd_upr_src);
+  if(bnd_lwr_dst) bnd_lwr_dst=(int *)nco_free(bnd_lwr_dst);
+  if(bnd_upr_dst) bnd_upr_dst=(int *)nco_free(bnd_upr_dst);
+  if(void_ptr_var) void_ptr_var=(void *)nco_free(void_ptr_var);
+  if(lat_out) lat_out=(double *)nco_free(lat_out);
+  if(lon_out) lon_out=(double *)nco_free(lon_out);
+  if(dmn_cnt) dmn_cnt=(long *)nco_free(dmn_cnt);
+  if(dmn_id) dmn_id=(int *)nco_free(dmn_id);
+  if(dmn_srt) dmn_srt=(long *)nco_free(dmn_srt);
+
+  rcd_esmf=ESMC_FieldRegridRelease(&rte_hnd);
+  rcd_esmf=ESMC_FieldDestroy(&fld_src);
+  rcd_esmf=ESMC_FieldDestroy(&fld_dst);
+  rcd_esmf=ESMC_GridDestroy(&grd_src);
+  rcd_esmf=ESMC_GridDestroy(&grd_dst);
+  ESMC_Finalize();
+
+  return rcd;
+} /* nco_rgr_esmf */
+#endif /* !ENABLE_ESMF */
diff --git a/src/nco/nco_sld.h b/src/nco/nco_sld.h
index 4ca8fd0..edaf2da 100644
--- a/src/nco/nco_sld.h
+++ b/src/nco/nco_sld.h
@@ -20,6 +20,9 @@
 /* 3rd party vendors */
 #include <netcdf.h> /* netCDF definitions and C library */
 #include "nco_netcdf.h" /* NCO wrappers for netCDF C library */
+#ifdef ENABLE_ESMF
+# include <ESMC.h> /* ESMF definitions */
+#endif /* !ENABLE_ESMF */
 
 /* Personal headers */
 #include "nco.h" /* netCDF Operator (NCO) definitions */
@@ -35,6 +38,52 @@ extern "C" {
   (char *fl_scrip, /* I [sng] SCRIP file name with proper path */
    kvm_sct *kvm_scrip); /* I/O [sct] Structure to hold contents of SCRIP file */ 
 
+#ifdef ENABLE_ESMF
+  int /* O [enm] Return code */
+  nco_rgr_esmf /* [fnc] Regrid using ESMF library */
+  (rgr_sct * const rgr_nfo); /* I/O [sct] Regridding structure */
+
+  const char * /* O [sng] String version of ESMC_StaggerLoc enum */
+  nco_esmf_stg_lcn_sng /* [fnc] Convert ESMF stagger location enum to string */
+  (const int nco_esmf_stg_lcn); /* I [enm] ESMF stagger location enum ESMC_StaggerLoc */
+  
+  const char * /* O [sng] String version of ESMC_CoordSys_Flag enum */
+  nco_esmf_crd_sys_sng /* [fnc] Convert ESMF coordinate system enum to string */
+  (const int nco_esmf_crd_sys); /* I [enm] ESMF coordinate system enum ESMC_CoordSys_Flag */
+  
+  const char * /* O [sng] String version of ESMC_FileFormat_Flag */
+  nco_esmf_fl_fmt_sng /* [fnc] Convert ESMF file format to string */
+  (const int nco_esmf_fl_fmt); /* I [enm] ESMF file format enum ESMC_FileFormat_Flag */
+
+  const char * /* O [sng] String version of ESMC_GridItem_Flag enum */
+  nco_esmf_grd_itm_sng /* [fnc] Convert ESMF grid item enum to string */
+  (const int nco_esmf_grd_itm); /* I [enm] ESMF grid item enum ESMC_GridItem_Flag */
+  
+  const char * /* O [sng] String version of ESMC_LogMsgType_Flag enum */
+  nco_esmf_log_msg_sng /* [fnc] Convert ESMF log message type enum to string */
+  (const int nco_esmf_log_msg); /* I [enm] ESMF log message type enum ESMC_LogMsgType_Flag */
+  
+  const char * /* O [sng] String version of ESMC_PoleMethod_Flag enum */
+  nco_esmf_pll_mth_sng /* [fnc] Convert ESMF pole method type enum to string */
+  (const int nco_esmf_pll_mth); /* I [enm] ESMF pole method type enum ESMC_PoleMethod_Flag */
+
+  const char * /* O [sng] String version of ESMC_Region_Flag enum */
+  nco_esmf_rgn_flg_sng /* [fnc] Convert ESMF region flag enum to string */
+  (const int nco_esmf_rgn_flg); /* I [enm] ESMF region flag enum ESMC_Region_Flag */
+
+  const char * /* O [sng] String version of ESMC_RegridMethod_Flag enum */
+  nco_esmf_rgr_mth_sng /* [fnc] Convert ESMF regrid method type enum to string */
+  (const int nco_esmf_rgr_mth); /* I [enm] ESMF regrid method type enum ESMC_RegridMethod_Flag */
+
+  const char * /* O [sng] String version of ESMC_TypeKind_Flag enum */
+  nco_esmf_typ_knd_sng /* [fnc] Convert ESMF type kind enum to string */
+  (const int nco_esmf_typ_knd); /* I [enm] ESMF type kind enum ESMC_TypeKind_Flag */
+  
+  const char * /* O [sng] String version of ESMC_UnmappedAction_Flag enum */
+  nco_esmf_unm_act_sng /* [fnc] Convert ESMF unmapped action type enum to string */
+  (const int nco_esmf_unm_act); /* I [enm] ESMF unmapped action type enum ESMC_UnmappedAction_Flag */
+#endif /* !ENABLE_ESMF */
+
 #ifdef __cplusplus
 } /* end extern "C" */
 #endif /* __cplusplus */
diff --git a/src/nco/nco_typ.h b/src/nco/nco_typ.h
index 18b7256..6b236da 100644
--- a/src/nco/nco_typ.h
+++ b/src/nco/nco_typ.h
@@ -425,7 +425,7 @@ typedef unsigned long long nco_uint64; /* [typ] NC_UINT64 */
 
 /* NC_STRING handling */
 #ifndef NCO_STRING
-/* 20070514: netcdf4-beta1 only supports nc_put_var_string() and nc_get_var_string() */
+/* 20070514: netcdf4-alpha9 only supports nc_put_var_string() and nc_get_var_string() */
 /* Only valid option is NCO_TYP_STRING
    Default is NCO_TYP_STRING, which treats NC_STRING as C-type char */
 # define NCO_STRING NCO_TYP_STRING
diff --git a/src/nco/nco_var_avg.c b/src/nco/nco_var_avg.c
index b8d765d..c54b6a6 100644
--- a/src/nco/nco_var_avg.c
+++ b/src/nco/nco_var_avg.c
@@ -322,8 +322,11 @@ nco_var_avg /* [fnc] Reduce given variable over specified dimensions */
        in same order as blocks' average values will appear in output buffer. 
        Averaging routines can take advantage of this by casting avg_val to 
        two dimensional variable and averaging over inner dimension. 
-       nco_var_avg_rdc_*() sets tally array */
-    if(var->is_crd_var) nco_op_typ_lcl=nco_op_avg; else nco_op_typ_lcl=nco_op_typ;
+       nco_var_avg_rdc_*() sets tally array
+       NCO operations on coordinate variables are restricted to averaging
+       ncap2 is an exception because presumably the user knows what he/she is doing */
+    nco_op_typ_lcl=nco_op_typ;
+    if(nco_prg_id_get() != ncap && var->is_crd_var) nco_op_typ_lcl=nco_op_avg;
     switch(nco_op_typ_lcl){
     case nco_op_mabs:
     case nco_op_max:
diff --git a/src/nco/nco_var_utl.c b/src/nco/nco_var_utl.c
index f4588af..b18c101 100644
--- a/src/nco/nco_var_utl.c
+++ b/src/nco/nco_var_utl.c
@@ -819,11 +819,11 @@ nco_var_dpl /* [fnc] Duplicate input variable */
   /* Shallow-copy structure itself */
   (void)memcpy((void *)var_cpy,(const void *)var,sizeof(var_sct));
   
-  /* Make sure var_free() frees names when variable is destructed */
+  /* Make sure nco_var_free() frees names when variable is destructed */
   if(var->nm) var_cpy->nm=(char *)strdup(var->nm);
   if(var->nm_fll) var_cpy->nm_fll=(char *)strdup(var->nm_fll);
   
-  /* Deep-copy dyamically allocated arrays from original to copy */
+  /* Deep-copy dynamically allocated arrays from original to copy */
   if(var->val.vp){
     var_cpy->val.vp=(void *)nco_malloc_dbg(var_cpy->sz*nco_typ_lng(var_cpy->type),"Unable to malloc() value buffer in variable deep-copy",fnc_nm);
     (void)memcpy((void *)(var_cpy->val.vp),(void *)(var->val.vp),var_cpy->sz*nco_typ_lng(var_cpy->type));
diff --git a/src/nco/ncra.c b/src/nco/ncra.c
index 75615bc..213f045 100644
--- a/src/nco/ncra.c
+++ b/src/nco/ncra.c
@@ -162,7 +162,7 @@ main(int argc,char **argv)
   dmn_sct **dmn_out=NULL; /* CEWI */
 
   double *wgt_arr=NULL; /* Option w */
-  double wgt_avg_scl=0.0; /* [frc] Average of weights */
+  double wgt_avg_scl=0.0; /* [frc] Scalar version of wgt_avg */
 
   extern char *optarg;
   extern int optind;
@@ -277,9 +277,9 @@ main(int argc,char **argv)
   size_t cnk_sz_scl=0UL; /* [nbr] Chunk size scalar */
   size_t hdr_pad=0UL; /* [B] Pad at end of header section */
 
-  trv_sct *var_trv;        /* [sct] Variable GTT object */
+  trv_sct *var_trv; /* [sct] Variable GTT object */
 
-  trv_tbl_sct *trv_tbl;    /* [lst] Traversal table */
+  trv_tbl_sct *trv_tbl; /* [lst] Traversal table */
 
   var_sct **var;
   var_sct **var_fix;
@@ -287,9 +287,15 @@ main(int argc,char **argv)
   var_sct **var_out=NULL_CEWI;
   var_sct **var_prc;
   var_sct **var_prc_out;
-  var_sct *wgt=NULL;
-  var_sct *wgt_out=NULL;
-  var_sct *wgt_avg=NULL;
+  var_sct *wgt=NULL; /* [sct] Raw weight on disk in input file */
+  var_sct *wgt_out=NULL; /* [sct] Copy of wgt
+			    Tally and val members malloc'd & initialized
+			    IDs updated each new file by nco_var_mtd_refresh() in file loop
+			    Current record value obtained by nco_msa_var_get_rec_trv() in record loop
+			    One copy of wgt_out used for all variables */
+  var_sct *wgt_avg=NULL; /* [sct] Copy of wgt_out created to mimic var_prc_out processing 
+			    Holds running total and tally of weight
+			    Acts as op2 for wgt_out averaging just before var_prc[nbr_var_prc-1] */
 
 #ifdef ENABLE_MPI
   /* Declare all MPI-specific variables here */
@@ -633,11 +639,8 @@ main(int argc,char **argv)
       xtr_nbr=var_lst_in_nbr;
       break;
     case 'w': /* Per-file and per-record weights */
-      if(isalpha(optarg[0])){
+      if(isalpha(optarg[0]) || optarg[0] == '/'){
 	wgt_nm=(char *)strdup(optarg);
-	(void)fprintf(stderr,"%s: WARNING The \"-w weight_name\" feature is still buggy and this switch is intended only for developers\n",nco_prg_nm);
-	//	(void)fprintf(stderr,"%s: WARNING The \"-w weight_name\" feature is still buggy and this option is intended only for developers. The \"-w weight_array\" option works fine, e.g., \"-w 31,31,28\". If you are very interested in the weight_name functionality, start a thread on SourceForge and we will update the status of that option there.\n",nco_prg_nm);
-        // nco_exit(EXIT_FAILURE);
       }else{ /* !wgt_nm */
 	optarg_lcl=(char *)strdup(optarg);
 	wgt_lst_in=nco_lst_prs_2D(optarg_lcl,",",&wgt_nbr);
@@ -859,15 +862,18 @@ main(int argc,char **argv)
   } /* end loop over idx */
 
   if(wgt_nm && (nco_op_typ == nco_op_avg || nco_op_typ == nco_op_mebs)){
-    /* Find weighting variable that matches current variable */
+    /* Find weight variable that matches current variable */
     wgt=nco_var_get_wgt_trv(in_id,wgt_nm,var_prc[0],trv_tbl);
+    assert(wgt->nbr_dim < 2);
+    /* Change wgt from a normal full variable to one that only holds one record at a time
+       This differs from ncwa wgt treatment
+       20150708: nco_var_dpl() calls below generate valgrind invalid read errors. Not sure why. */
+    wgt->val.vp=(void *)nco_realloc(wgt->val.vp,wgt->sz_rec*nco_typ_lng(wgt->type));
+    wgt->tally=(long *)nco_realloc(wgt->tally,wgt->sz_rec*sizeof(long));
+    (void)nco_var_zero(wgt->type,wgt->sz_rec,wgt->val);
+    (void)nco_zero_long(wgt->sz_rec,wgt->tally);
     wgt_out=nco_var_dpl(wgt);
-    wgt_out->tally=wgt->tally=(long *)nco_malloc(wgt_out->sz_rec*sizeof(long));
-    wgt_out->val.vp=(void *)nco_malloc(wgt_out->sz_rec*nco_typ_lng(wgt_out->type));
-    (void)nco_zero_long(wgt_out->sz_rec,wgt_out->tally);
-    (void)nco_var_zero(wgt_out->type,wgt_out->sz_rec,wgt_out->val);
-    if(nco_dbg_lvl >= nco_dbg_std) (void)fprintf(stdout,"wgt_nm = %s, wgt_out->nm = %s\n",wgt_nm,wgt_out->nm_fll);
-    assert(wgt_out->nbr_dim < 2);
+    wgt_avg=nco_var_dpl(wgt_out);
   } /* !wgt_nm */
 
   /* Close first input netCDF file */
@@ -1069,7 +1075,6 @@ main(int argc,char **argv)
 		if((wgt_arr || wgt_nm) && (nco_op_typ == nco_op_avg || nco_op_typ == nco_op_mebs) && !var_prc[idx]->is_crd_var){
 		  if(wgt_arr){
 		    /* Per-file weight */
-		    assert(wgt_nbr == fl_nbr);
 		    wgt_scv.type=NC_DOUBLE;
 		    wgt_scv.val.d=wgt_arr[fl_idx];
 		  } /* !wgt_arr */
@@ -1080,12 +1085,9 @@ main(int argc,char **argv)
 		  nco_scv_cnf_typ(var_prc[idx]->type,&wgt_scv);
 		  if(nco_dbg_lvl > nco_dbg_std && (wgt_nm || wgt_arr)) (void)fprintf(fp_stdout,"wgt_nm = %s, var_nm = %s, idx = %li, typ = %s, wgt_val = %g, var_val=%g\n",wgt_nm ? wgt_out->nm_fll : "NULL",var_prc[idx]->nm,idx_rec_crr_in,nco_typ_sng(wgt_scv.type),wgt_scv.val.d,var_prc[idx]->val.dp[0]);
 		  (void)nco_var_scv_mlt(var_prc[idx]->type,var_prc[idx]->sz,var_prc[idx]->has_mss_val,var_prc[idx]->mss_val,var_prc[idx]->val,&wgt_scv);
-		  /* Increment running total of weight after its application to last processed variable */
-		  if(wgt_nm){
-		    wgt_avg=nco_var_dpl(wgt_out);
-		    if(idx == nbr_var_prc-1){
-		      if(flg_rth_ntl) nco_opr_drv((long)0L,nco_op_typ,wgt_out,wgt_avg); else nco_opr_drv((long)1L,nco_op_typ,wgt_out,wgt_avg);
-		    } /* endif */
+		  /* Increment running total of wgt_out after its application to last processed variable */
+		  if(wgt_nm && (idx == nbr_var_prc-1)){
+		    if(flg_rth_ntl) nco_opr_drv((long)0L,nco_op_typ,wgt_out,wgt_avg); else nco_opr_drv((long)1L,nco_op_typ,wgt_out,wgt_avg);
 		  } /* !wgt_nm */
 		} /* !wgt */
 		/* Perform arithmetic operations: avg, min, max, ttl, ... */
@@ -1148,16 +1150,17 @@ main(int argc,char **argv)
 	      /* Compute mean of per-record weight, by normalizing running sum of weight by tally
 		 Then normalize all numerical record variables by mean of per-record weight
 		 Still ill-defined when MRO is invoked with --wgt 
-		 Same logic must be applied after file loop for nces, and for ncra with superfluous trailing files */
+		 Same logic applies in two locations in this code:
+		 1. During SSC normalization inside record loop when REC_LST_DSR is true
+		 2. After file loop for nces, and for ncra with superfluous trailing files */
 	      wgt_avg_scv.type=NC_DOUBLE;
-	      wgt_avg->val.dp[0]/=wgt_avg->tally[0];
+	      wgt_avg->val.dp[0]/=wgt_out->tally[0]; /* NB: wgt_avg tally is kept in wgt_out */
 	      wgt_avg_scv.val.d=wgt_avg->val.dp[0];
 	      for(idx=0;idx<nbr_var_prc;idx++){
 		if(var_prc_out[idx]->is_crd_var || var_prc[idx]->type == NC_CHAR || var_prc[idx]->type == NC_STRING) continue;
 		nco_scv_cnf_typ(var_prc_out[idx]->type,&wgt_avg_scv);
 		(void)nco_var_scv_dvd(var_prc_out[idx]->type,var_prc_out[idx]->sz,var_prc_out[idx]->has_mss_val,var_prc_out[idx]->mss_val,var_prc_out[idx]->val,&wgt_avg_scv);
 	      } /* end loop over var */
-	      if(wgt_avg) wgt_avg=(var_sct *)nco_var_free(wgt_avg);
 	    } /* !wgt_nm */
 
             /* Copy averages to output file */
@@ -1410,8 +1413,27 @@ main(int argc,char **argv)
      Occassionally last input file(s) is/are superfluous so REC_LST_DSR never set
      In such cases FLG_BFR_NRM is still true, indicating ncra still needs normalization
      FLG_BFR_NRM is always true here for ncfe and ncge */
-  if(FLG_BFR_NRM) (void)nco_opr_nrm(nco_op_typ,nbr_var_prc,var_prc,var_prc_out,(char *)NULL,(trv_tbl_sct *)NULL);
+  if(FLG_BFR_NRM){
+    (void)nco_opr_nrm(nco_op_typ,nbr_var_prc,var_prc,var_prc_out,(char *)NULL,(trv_tbl_sct *)NULL);
     
+    if(wgt_nm && (nco_op_typ == nco_op_avg || nco_op_typ == nco_op_mebs)){
+      /* Compute mean of per-record weight, by normalizing running sum of weight by tally
+	 Then normalize all numerical record variables by mean of per-record weight
+	 Still ill-defined when MRO is invoked with --wgt 
+	 Same logic applies in two locations in this code:
+	 1. During SSC normalization inside record loop when REC_LST_DSR is true
+	 2. After file loop for nces, and for ncra with superfluous trailing files */
+      wgt_avg_scv.type=NC_DOUBLE;
+      wgt_avg->val.dp[0]/=wgt_out->tally[0]; /* NB: wgt_avg tally is kept in wgt_out */
+      wgt_avg_scv.val.d=wgt_avg->val.dp[0];
+      for(idx=0;idx<nbr_var_prc;idx++){
+	if(var_prc_out[idx]->is_crd_var || var_prc[idx]->type == NC_CHAR || var_prc[idx]->type == NC_STRING) continue;
+	nco_scv_cnf_typ(var_prc_out[idx]->type,&wgt_avg_scv);
+	(void)nco_var_scv_dvd(var_prc_out[idx]->type,var_prc_out[idx]->sz,var_prc_out[idx]->has_mss_val,var_prc_out[idx]->mss_val,var_prc_out[idx]->val,&wgt_avg_scv);
+      } /* end loop over var */
+    } /* !wgt_nm */
+  } /* !FLG_BFR_NRM */
+
   /* Manually fix YYMMDD date which was mangled by averaging */
   if(CNV_CCM_CCSM_CF && nco_prg_id == ncra) (void)nco_cnv_ccm_ccsm_cf_date(grp_out_id,var_out,xtr_nbr);
 
@@ -1516,10 +1538,9 @@ main(int argc,char **argv)
     var_fix=(var_sct **)nco_free(var_fix);
     var_fix_out=(var_sct **)nco_free(var_fix_out);
     if(md5) md5=(md5_sct *)nco_md5_free(md5);
-    // fxm free this memory:
-    //    if(wgt) wgt=(var_sct *)nco_var_free(wgt);
-    //    if(wgt_out) wgt_out=(var_sct *)nco_var_free(wgt_out);
-    //    if(wgt_avg) wgt_avg=(var_sct *)nco_var_free(wgt_avg);
+    if(wgt) wgt=(var_sct *)nco_var_free(wgt);
+    if(wgt_out) wgt_out=(var_sct *)nco_var_free(wgt_out);
+    if(wgt_avg) wgt_avg=(var_sct *)nco_var_free(wgt_avg);
 
     (void)trv_tbl_free(trv_tbl);
     for(idx=0;idx<lmt_nbr;idx++) flg_dne[idx].dim_nm=(char *)nco_free(flg_dne[idx].dim_nm);
diff --git a/src/nco/ncwa.c b/src/nco/ncwa.c
index 8fbd3b8..5212468 100644
--- a/src/nco/ncwa.c
+++ b/src/nco/ncwa.c
@@ -973,7 +973,7 @@ main(int argc,char **argv)
           double mss_val_dbl=double_CEWI;
           /* Set denominator to missing value at all locations where variable is missing value
 	     If this is accomplished by setting weight to missing value wherever variable is missing value
-	     then weight must not be re-used by next variable (which might conform but have missing values in different locations)
+	     then weight must not be re-used by next variable (which may conform but have missing values in different locations)
 	     This is one good reason to copy wgt_out into disposable wgt_avg for each new variable */
           /* First, make sure wgt_avg has same missing value as variable */
           (void)nco_mss_val_cp(var_prc[idx],wgt_avg);
diff --git a/src/nco_c++/Makefile.in b/src/nco_c++/Makefile.in
index ecb8406..1fb2f1f 100644
--- a/src/nco_c++/Makefile.in
+++ b/src/nco_c++/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,17 @@
 
 
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -85,11 +95,6 @@ target_triplet = @target@
 check_PROGRAMS = $(am__EXEEXT_1)
 TESTS = $(am__EXEEXT_1)
 subdir = src/nco_c++
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/autobld/mkinstalldirs \
-	$(top_srcdir)/autobld/depcomp $(include_HEADERS) \
-	$(top_srcdir)/autobld/test-driver ChangeLog INSTALL README \
-	TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -97,6 +102,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \
+	$(am__DIST_COMMON)
 mkinstalldirs = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
@@ -386,6 +393,10 @@ TEST_LOGS = $(am__test_logs2:.test.log=.log)
 TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/autobld/test-driver
 TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
 	$(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autobld/depcomp \
+	$(top_srcdir)/autobld/mkinstalldirs \
+	$(top_srcdir)/autobld/test-driver ChangeLog INSTALL README \
+	TODO
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -562,7 +573,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/nco_c++/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign src/nco_c++/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -818,7 +828,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	if test -n "$$am__remaking_logs"; then \
 	  echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
 	       "recursion detected" >&2; \
-	else \
+	elif test -n "$$redo_logs"; then \
 	  am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
 	fi; \
 	if $(am__make_dryrun); then :; else \
@@ -1114,6 +1124,8 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
 	recheck tags tags-am uninstall uninstall-am \
 	uninstall-includeHEADERS uninstall-libLTLIBRARIES
 
+.PRECIOUS: Makefile
+
 
 all: ${test_data}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/nco.git



More information about the Pkg-grass-devel mailing list