[nco] 01/04: New upstream version 4.7.3

Bas Couwenberg sebastic at debian.org
Sat Mar 3 08:48:13 UTC 2018


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

sebastic pushed a commit to branch master
in repository nco.

commit 519a16c876c49becb977c81126368b9d7907cc3f
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Mar 3 09:35:23 2018 +0100

    New upstream version 4.7.3
---
 CMakeLists.txt                 | 125 ++++--
 Makefile.in                    |   2 -
 appveyor.yml                   |  12 +-
 bld/Makefile                   |  38 +-
 bld/nco.spec                   |  13 +-
 bld/nco_dst.pl                 |  30 +-
 bm/NCO_bm.pm                   |   4 +-
 bm/NCO_rgr.pm                  |  30 +-
 bm/bm.ncl                      |  56 +++
 bm/bm_lib.ncl                  | 130 +++++++
 bm/cch_clr.sh                  |  34 ++
 bm/chunking-times.sh           | 118 ++++++
 bm/ncclimo_profile.sh          | 108 ++++++
 bm/nco_bm.pl                   |   7 +-
 cmake/README.md                |  19 +-
 cmake/bld.bat                  | 197 ++++++++--
 cmake/build.bat                |  19 -
 cmake/clean.sh                 |   2 -
 cmake/clone.bat                |  13 -
 cmake/dep.bat                  | 122 ------
 cmake/in.nc.txt                | 750 ++++++++++++++++++------------------
 cmake/in_grp.nc.txt            | 150 ++++----
 conda.recipe/bld.bat           |   2 +-
 config.h.in                    |   6 +
 configure                      | 105 ++---
 configure.ac                   |  12 +-
 configure.eg                   |  38 +-
 data/Makefile.in               |   2 -
 data/buggy.cdl                 |  10 +
 data/ncclimo                   | 112 ++++--
 data/ncremap                   |  28 +-
 data/sort.nco                  |  53 +++
 debian/changelog               |  10 +-
 doc/ANNOUNCE                   | 146 +++----
 doc/ChangeLog                  | 178 +++++++++
 doc/Makefile.in                |   2 -
 doc/VERSION                    |   2 +-
 doc/debian.txt                 | 162 ++++----
 doc/index.shtml                |  61 +--
 doc/nco.texi                   | 409 ++++++++++++++++----
 man/Makefile.in                |   2 -
 man/ncks.1                     |  11 +-
 man/ncremap.1                  |   2 +-
 src/Makefile.in                |   2 -
 src/nco++/Invoke.cc            |   3 +-
 src/nco++/Makefile.in          |   2 -
 src/nco++/Makefile.old         |   2 +-
 src/nco++/NcapVarVector.cc     |   9 +-
 src/nco++/VarOpNew.hh          | 137 +++----
 src/nco++/fmc_all_cls.cc       | 326 +++++++---------
 src/nco++/fmc_gsl_cls.cc       | 102 ++---
 src/nco++/map_srt_tmp.hh       |   2 +-
 src/nco++/ncap2.cc             |  17 +-
 src/nco++/ncap2_utl.cc         |  20 +-
 src/nco++/ncoGrammer.g         |  21 +-
 src/nco++/ncoLexer.cpp         |   2 +-
 src/nco++/ncoLexer.hpp         |   4 +-
 src/nco++/ncoParser.cpp        |   2 +-
 src/nco++/ncoParser.hpp        |   4 +-
 src/nco++/ncoTree.cpp          | 523 +++++++++++++------------
 src/nco++/ncoTree.hpp          |   6 +-
 src/nco++/prs_cls.cc           |  18 +-
 src/nco/Makefile.am            |  32 +-
 src/nco/Makefile.in            | 123 ++----
 src/nco/mpncbo.c               |   8 +-
 src/nco/mpncecat.c             |   8 +-
 src/nco/mpncflint.c            |   8 +-
 src/nco/mpncpdq.c              |   6 +-
 src/nco/mpncra.c               | 173 +++++----
 src/nco/mpncwa.c               |   8 +-
 src/nco/ncap.c                 |   6 +-
 src/nco/ncap_lex.l             | 164 +-------
 src/nco/ncap_utl.c             | 844 ++++++----------------------------------
 src/nco/{ncap.h => ncap_utl.h} | 211 ++++++----
 src/nco/ncap_yacc.y            | 855 -----------------------------------------
 src/nco/ncatted.c              |   6 +-
 src/nco/ncbo.c                 |   6 +-
 src/nco/ncecat.c               |   6 +-
 src/nco/ncflint.c              |   6 +-
 src/nco/ncks.c                 |  57 ++-
 src/nco/nco.h                  |   6 +-
 src/nco/nco_bnr.c              |   2 +-
 src/nco/nco_ctl.c              |  41 +-
 src/nco/nco_fl_utl.c           |  35 +-
 src/nco/nco_grp_utl.c          |  10 +-
 src/nco/nco_lmt.c              |   2 +-
 src/nco/nco_map.c              |  34 +-
 src/nco/nco_mmr.c              |  14 +-
 src/nco/nco_mss_val.c          |   2 +-
 src/nco/nco_mss_val.h          |   8 +-
 src/nco/nco_netcdf.c           |  53 ++-
 src/nco/nco_netcdf.h           |  18 +-
 src/nco/nco_pck.c              |   2 +-
 src/nco/nco_prn.c              | 809 +++++++++++++++++++-------------------
 src/nco/nco_rgr.c              |  22 +-
 src/nco/nco_sng_utl.c          |  49 ++-
 src/nco/nco_sng_utl.h          |  13 +-
 src/nco/nco_var_lst.c          |   8 +-
 src/nco/nco_var_utl.c          |  10 +-
 src/nco/ncpdq.c                |   7 +-
 src/nco/ncra.c                 |   6 +-
 src/nco/ncrename.c             |  13 +-
 src/nco/ncwa.c                 |   9 +-
 src/nco_c++/Makefile.in        |   2 -
 104 files changed, 3849 insertions(+), 4387 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90cf981..4b63c0c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,7 +54,7 @@ endif()
 #on multi-configuration generators (Visual Studio, Xcode) define only 2 types: Debug;Release
 #/////////////////////////////////////////////////////////////////////////////////////
 
-set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
+set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build.")
 if(CMAKE_CONFIGURATION_TYPES)
   set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
 endif()
@@ -85,11 +85,11 @@ set(find_opt NO_SYSTEM_ENVIRONMENT_PATH)
 #If not found, business as usual
 #//////////////////////////
 
+# NETCDF_ROOT, if found in environment, will be searched after specific command line locations for NETCDF_INCLUDE
+# and NETCDF_LIBRARY
 set(netcdf_root "$ENV{NETCDF_ROOT}")
 if(netcdf_root)
-  set(NETCDF_INCLUDE "${netcdf_root}/include")
-  set(NETCDF_LIBRARY_PATH "${netcdf_root}/lib")
-  message("${color_blue}-- Using user defined netCDF location: ${netcdf_root}${color_reset}")
+  message("${color_blue}-- Using user-defined netCDF root location: ${netcdf_root}${color_reset}")
 endif()
 
 #//////////////////////////
@@ -100,7 +100,14 @@ if(NETCDF_INCLUDE)
   if(EXISTS "${NETCDF_INCLUDE}/netcdf.h")
     message("-- Using ${NETCDF_INCLUDE}/netcdf.h")
   else()
-    message(FATAL_ERROR "${color_red}netcdf.h not found at ${NETCDF_INCLUDE}${color_reset}")
+    if(netcdf_root)
+        set(NETCDF_INCLUDE "${netcdf_root}/include")
+    endif()
+    if(EXISTS "${NETCDF_INCLUDE}/netcdf.h")
+      message("-- Using ${NETCDF_INCLUDE}/netcdf.h")
+    else()
+      message(FATAL_ERROR "${color_red}netcdf.h not found at ${NETCDF_INCLUDE}${color_reset}")
+    endif()
   endif()
 endif()
 
@@ -119,7 +126,11 @@ if(NETCDF_LIBRARY)
   if(EXISTS "${NETCDF_LIBRARY}")
     message("-- Using ${NETCDF_LIBRARY}")
   else()
-    message(FATAL_ERROR "${color_red}Specified ${NETCDF_LIBRARY} does not exist${color_reset}")
+    if(netcdf_root)
+        set(NETCDF_LIBRARY_PATH "${netcdf_root}/lib")
+    else()
+        message(FATAL_ERROR "${color_red}Specified ${NETCDF_LIBRARY} does not exist${color_reset}")
+    endif()
   endif()
 endif()
 
@@ -145,12 +156,34 @@ if (has_nc_inq_path)
   message("-- Found nc_inq_path in: " ${NETCDF_LIBRARY})
   add_definitions(-DHAVE_NC_INQ_PATH)
 endif()
+
 check_library_exists(${NETCDF_LIBRARY} nc_inq_format "" has_nc_inq_format)
 if (has_nc_inq_format)
   message("-- Found nc_inq_format in: " ${NETCDF_LIBRARY})
   add_definitions(-DHAVE_NC_INQ_FORMAT)
 endif()
 
+#/////////////////////////////////////////////////////////////////////////////////////
+#netCDF 4.6.0 
+#nc_def_var_filter , has_inq_var_filter, define NC_LIB_VERSION=460 if both found 
+#/////////////////////////////////////////////////////////////////////////////////////
+
+check_library_exists(${NETCDF_LIBRARY} nc_def_var_filter "" has_nc_def_var_filter)
+if (has_nc_def_var_filter)
+  message("-- Found nc_def_var_filter in: " ${NETCDF_LIBRARY})
+  add_definitions(-DHAVE_NC_DEF_VAR_FILTER)
+endif()
+
+check_library_exists(${NETCDF_LIBRARY} nc_inq_var_filter "" has_inq_var_filter)
+if (has_inq_var_filter)
+  message("-- Found has_inq_var_filter in: " ${NETCDF_LIBRARY})
+  add_definitions(-DHAVE_NC_INQ_VAR_FILTER)
+endif()
+
+if (has_nc_def_var_filter AND has_inq_var_filter)
+  add_definitions(-DNC_LIB_VERSION=460)
+endif ()
+
 find_path(path_netcdf_mem_h netcdf_mem.h PATHS ${NETCDF_INCLUDE})
 if (path_netcdf_mem_h)
   message("-- Found netcdf_mem.h in: " ${path_netcdf_mem_h})
@@ -295,24 +328,18 @@ if (MSVC)
     message("-- Using static CRT ${MSVC_USE_STATIC_CRT}")
     foreach(flag_var CMAKE_CXX_FLAGS_DEBUG 
       CMAKE_CXX_FLAGS_RELEASE
-      CMAKE_CXX_FLAGS_MINSIZEREL 
-      CMAKE_CXX_FLAGS_RELWITHDEBINFO
       CMAKE_C_FLAGS_DEBUG 
-      CMAKE_C_FLAGS_RELEASE
-      CMAKE_C_FLAGS_MINSIZEREL 
-      CMAKE_C_FLAGS_RELWITHDEBINFO)
+      CMAKE_C_FLAGS_RELEASE)
     string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
     endforeach()
-  endif()
+  endif(MSVC_USE_STATIC_CRT)
 
   #//////////////////////////
   #compile as C++ Code (/TP)
   #//////////////////////////
   
   foreach(flag_var CMAKE_C_FLAGS_DEBUG 
-    CMAKE_C_FLAGS_RELEASE
-    CMAKE_C_FLAGS_MINSIZEREL 
-    CMAKE_C_FLAGS_RELWITHDEBINFO)
+    CMAKE_C_FLAGS_RELEASE)
   set(${flag_var} "/TP ${${flag_var}}")
   endforeach()
 
@@ -474,21 +501,21 @@ add_executable(ncatted src/nco/ncatted.c)
 
 set(ncwa_SOURCES ${ncwa_SOURCES})
 set(ncwa_SOURCES ${ncwa_SOURCES} src/nco/ncwa.c)
-find_package(BISON QUIET)
-find_package(FLEX  QUIET) 
-if(BISON_FOUND AND FLEX_FOUND)
+# find_package(BISON QUIET)
+find_package(FLEX QUIET) 
+if(FLEX_FOUND)
  add_definitions(-DHAVE_BISON_FLEX)
- message("-- Bison found at ${BISON_EXECUTABLE}")
+ # message("-- Bison found at ${BISON_EXECUTABLE}")
  message("-- Flex found at ${FLEX_EXECUTABLE}")
- BISON_TARGET(nco_parser src/nco/ncap_yacc.y ${CMAKE_CURRENT_BINARY_DIR}/ncap_yacc.c COMPILE_FLAGS "--name-prefix=nco_yy")
+ # BISON_TARGET(nco_parser src/nco/ncap_yacc.y ${CMAKE_CURRENT_BINARY_DIR}/ncap_yacc.c COMPILE_FLAGS "--name-prefix=nco_yy")
  FLEX_TARGET(nco_scanner src/nco/ncap_lex.l ${CMAKE_CURRENT_BINARY_DIR}/ncap_lex.c COMPILE_FLAGS "-Pnco_yy")
- ADD_FLEX_BISON_DEPENDENCY(nco_scanner nco_parser)
+ # ADD_FLEX_BISON_DEPENDENCY(nco_scanner nco_parser)
  include_directories(${CMAKE_CURRENT_BINARY_DIR})
  include_directories(src/nco)
- message("-- Bison/Flex will generate ${BISON_nco_parser_OUTPUTS} ${FLEX_nco_scanner_OUTPUTS}")
- set(ncwa_SOURCES ${ncwa_SOURCES} ${BISON_nco_parser_OUTPUTS} ${FLEX_nco_scanner_OUTPUTS} src/nco/ncap_utl.c)
+ message("-- Flex will generate ${FLEX_nco_scanner_OUTPUTS}")
+ set(ncwa_SOURCES ${ncwa_SOURCES}  ${FLEX_nco_scanner_OUTPUTS} src/nco/ncap_utl.c)
 else()
-  message("${color_magenta}-- Bison/Flex not found${color_reset}")
+  message("${color_magenta}--Flex not found${color_reset}")
 endif()
 add_executable(ncwa ${ncwa_SOURCES})
 
@@ -986,3 +1013,53 @@ if (UNIX)
  file(APPEND ${file_sh} "export PATH=\"${path}\"")
  execute_process(COMMAND chmod a+x ${file_sh} RESULT_VARIABLE res)
 endif()
+
+#//////////////////////////
+# compiler/linker warnings
+#//////////////////////////
+
+if(MSVC)
+add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
+set(MSVC_DEVELOPER ON CACHE BOOL "Disable MSVC warnings /wd4267 /wd4244 /wd4477")
+if (MSVC_DEVELOPER)
+  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4267 /wd4244 /wd4477")
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4267 /wd4244 /wd4477")
+  set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4267 /wd4244 /wd4477")
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4267 /wd4244 /wd4477")
+endif()
+endif()
+
+#//////////////////////////
+# disable .pdb not found warnings
+#//////////////////////////
+
+
+if (MSVC)
+set_target_properties(ncks PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncbo PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncecat PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncflint PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncpdq PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncra PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncrename PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncatted PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncwa PROPERTIES LINK_FLAGS "/ignore:4099")
+set_target_properties(ncap2 PROPERTIES LINK_FLAGS "/ignore:4099")
+endif (MSVC)
+
+#//////////////////////////
+# use of strcasecmp and strncasecmp
+# UDUNITS2 defines strcasecmp
+#//////////////////////////
+
+if (UDUNITS2_LIBRARY AND UDUNITS2_INCLUDE)
+ set(have_udunits)
+endif()
+
+if (MSVC)
+ if (NOT ${have_udunits})
+   add_definitions(-DNEED_STRCASECMP)
+ endif()
+ add_definitions(-DNEED_STRNCASECMP)
+endif(MSVC)
diff --git a/Makefile.in b/Makefile.in
index d406bd4..0d8e819 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -304,8 +304,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/appveyor.yml b/appveyor.yml
index 290f818..0abdfe2 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -20,15 +20,15 @@ install:
   - cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
 
   # # Add path, activate `conda` and update conda.
-  - cmd: conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
-  - cmd: conda update conda
-  - cmd: conda config --prepend channels conda-forge
+  - cmd: conda.exe config --set always_yes yes --set changeps1 no --set show_channel_urls true
+  - cmd: conda.exe update conda
+  - cmd: conda.exe config --prepend channels conda-forge
 
   - cmd: set PYTHONUNBUFFERED=1
 
-  - cmd: conda install conda-build
-  - cmd: conda info --all
-  - cmd: conda list
+  - cmd: conda.exe install conda-build
+  - cmd: conda.exe info --all
+  - cmd: conda.exe list
 
 
 # Skip .NET project specific build phase.
diff --git a/bld/Makefile b/bld/Makefile
index 4742212..1a6244d 100644
--- a/bld/Makefile
+++ b/bld/Makefile
@@ -15,6 +15,7 @@
 # Machine build parameters
 #                         Source     Method   Packages Compiler
 # aerosol.ess.uci.edu: NCO          Configure All else clang
+# AppVeyor CI        : NCO          CMake     All else MSVC
 # cheyenne.ucar.edu  : NCO          Makefile  All else Intel
 # cooley.alcf.anl.g  : NCO          Configure All else GCC
 # edison.nersc.gov   : NCO          Configure All else Intel
@@ -22,11 +23,10 @@
 # frazil.ess.uci.edu : NCO          Configure All else clang
 # glace.ess.uci.edu  : NCO          CMake     All else GCC
 # grele.ess.uci.edu  : NCO          Makefile  All else GCC
-# katabatic.ess.uci.e: NCO                    All else clang
+# katabatic.ess.uci.e: NCO          CMake     All else clang
 # rhea.ccs.ornl.gov  : NCO          Makefile  All else GCC
-# roulee.ess.uci.edu : NCO + netCDF Makefile  All else GCC
 # skyglow.ess.uci.edu: NCO + netCDF Configure All else GCC
-# travis CI          : NCO          Configure All else gcc,clang,g++
+# Travis CI          : NCO          Configure All else gcc,clang,g++
 
 # Usage (testing):
 # make tst                           # Vanilla regression test
@@ -75,7 +75,7 @@
 # cd ~/nco/bld;ANTLR=/sopt/ifort_icpc/bin/antlr ANTLR_ROOT=/sopt/ifort_icpc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=Y SZ=Y UDUNITS=N allinone;cd - # greenplanet intel
 # cd ~/nco/bld;ANTLR=/sopt/pgf90_pgcc/bin/antlr ANTLR_ROOT=/sopt/pgf90_pgcc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=N SZ=Y UDUNITS=N allinone;cd - # greenplanet pgi
 # cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # pbs
-# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # grele
+# cd ~/nco/bld;make OMP=Y OPTS=D UDUNITS=Y UBUNTU_440=Y allinone # grele
 # cd ~/nco/bld;make NETCDF4=N all ncap2;cd - # tephra
 # cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # silt, clay
 # cd ~/nco/bld;NETCDF_INC='/usr/include/netcdf-3' NETCDF_LIB='/usr/lib64' make GSL=N OMP=N OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # snow
@@ -574,8 +574,8 @@ TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc ../bld/lex.${NCO_YY_PF
 # TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc
 
 # Variables having to do with ncap
-MDL_NCAP_SRC := $(addprefix ${MY_SRC_DIR}/,ncap_yacc.y ncap_lex.l ncap.h) # `make tags' includes these files
-MDL_NCAP_TRG := ncap_yacc.c ncap_yacc.h ncap_lex.c # `make ncap' creates these files
+MDL_NCAP_SRC := $(addprefix ${MY_SRC_DIR}/,ncap_lex.l ncap_utl.h) # `make tags' includes these files
+MDL_NCAP_TRG := ncap_lex.c # `make ncap' creates these files
 MDL_NCAP := $(addprefix ${MY_SRC_DIR}/,${MDL_NCAP_TRG}) # `make distclean' removes these files
 
 # Variables having to do with C++ source and documentation
@@ -656,8 +656,10 @@ CPP_TKN_OS := -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -
 CPP_TKN_OS += -DHAVE_NC_INQ_FORMAT
 # Assume netCDF >= 4.3.2
 CPP_TKN_OS += -DHAVE_NC_INQ_PATH
-# Assume netCDF >= 4.4.0
-CPP_TKN_OS += -DHAVE_NETCDF_MEM_H
+# Assume netCDF >= 4.4.0, but Ubuntu 4.4.0 (e.g., on grele) fumbled netcdf_mem.h header
+ifndef UBUNTU_440
+ CPP_TKN_OS += -DHAVE_NETCDF_MEM_H
+endif # !grele
 # gcc 4.7.3 finally includes strcasestr() in string.h iff _GNU_SOURCE token is defined
 # NB: C++ (or at least g++ 4.7.3) always includes strcasestr()---work around this with tokens in nco_sng_utl.[ch]
 ifneq (${PVM_ARCH},CRAY)
@@ -1681,8 +1683,8 @@ ${MY_BIN_DIR}/mpncra:	${MY_OBJ_DIR}/mpncra.o lib
 	cd ${MY_BIN_DIR}; rm -f mpnces; ln -s -f mpncra mpnces
 	cd ${MY_BIN_DIR}; rm -f mpncrcat; ln -s -f mpncra mpncrcat
 mpncwa:   ${MY_BIN_DIR}/mpncwa
-${MY_BIN_DIR}/mpncwa:	${MY_OBJ_DIR}/mpncwa.o ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
-	${MPICC} -o $@${BNR_SFX} $<  ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
+${MY_BIN_DIR}/mpncwa:	${MY_OBJ_DIR}/mpncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
+	${MPICC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
 	chmod 755 $@${BNR_SFX}
 ncatted:   ${MY_BIN_DIR}/ncatted
 ${MY_BIN_DIR}/ncatted:	${MY_OBJ_DIR}/ncatted.o lib
@@ -1729,11 +1731,11 @@ ${MY_BIN_DIR}/ncrename:	${MY_OBJ_DIR}/ncrename.o lib
 	${CC} -o $@${BNR_SFX} $< ${LDFLAGS}
 	chmod 755 $@${BNR_SFX}
 ncwa:   ${MY_BIN_DIR}/ncwa
-${MY_BIN_DIR}/ncwa:	${MY_OBJ_DIR}/ncwa.o ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
+${MY_BIN_DIR}/ncwa:	${MY_OBJ_DIR}/ncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
 ifeq (${MSVC},TRUE)
 	${CC} -o $@${BNR_SFX} $< ${LDFLAGS}
 else
-	${CC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
+	${CC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
 endif
 	chmod 755 $@${BNR_SFX}
 bin: ${MDL_BIN_TRG} ${MDL_BIN_SPT}
@@ -2175,18 +2177,12 @@ ncap : LDFLAGS += -lC
 endif # endif AIX VA Compiler Collection
 endif # endif AIX
 # For some reason, ncap_lex.c is not remade when I expect it to be, so I explicitly remove the object file every time
-ncap:	${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ncap_yacc.h ${MY_OBJ_DIR}/ncap.o ${MY_OBJ_DIR}/ncap_utl.o ${libnco}.a
-#        ${YACC} --name-prefix=nco_
-ifneq (${null},$(findstring ${PVM_ARCH},LINUXALPHALINUXAMD64LINUXARMFREEBSDWIN32SGIMP64))
-	${CC} ${CFLAGS} -o ${MY_BIN_DIR}/$@ ${MY_OBJ_DIR}/$@.o ${MY_OBJ_DIR}/ncap_utl.o ${MY_OBJ_DIR}/$@_yacc.o ${MY_OBJ_DIR}/$@_lex.o ${LDFLAGS}
-else	
-	${CC} ${CFLAGS} -o ${MY_BIN_DIR}/$@ ${MY_OBJ_DIR}/$@.o ${MY_OBJ_DIR}/ncap_utl.o ${MY_OBJ_DIR}/$@_yacc.o ${MY_OBJ_DIR}/$@_lex.o -ll -ly ${LDFLAGS}
-endif
-	chmod 755 ${MY_BIN_DIR}/$@${BNR_SFX}
+ncap:	${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${libnco}.a
+
 ncap2 :
 	-cd ../src/nco++; ${MAKE} -f Makefile.old DAP=${DAP} DBG=${DBG} GSL=${GSL} MPI=${MPI} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} PNETCDF=${PNETCDF} SZ=${SZ} UDUNITS=${UDUNITS} all
 
-#	/bin/rm -f ${MDL_NCAP} ${MY_OBJ_DIR}/$@_lex.o ${MY_OBJ_DIR}/ncap_yacc.h ${MY_OBJ_DIR}/ncap_yacc.c
+#	/bin/rm -f ${MDL_NCAP} ${MY_OBJ_DIR}/$@_lex.o
 
 # Create dependency files only if they will not be immediately deleted
 INCLUDE_DPN := TRUE
diff --git a/bld/nco.spec b/bld/nco.spec
index 2151837..b1e5c77 100644
--- a/bld/nco.spec
+++ b/bld/nco.spec
@@ -2,17 +2,17 @@
 # http://cvs.fedoraproject.org/viewvc/devel/nco/nco.spec?view=co
 
 Name:           nco
-Version:        4.7.2
+Version:        4.7.3
 Release:        1%{?dist}
 Summary:        Programs that manipulate netCDF files
 Group:          Applications/Engineering
 License:        GPL3
 URL:            http://nco.sf.net/
 
-# Obtain NCO version 4.7.2-1 tar.gz from Sourceforge using CVS:
+# Obtain NCO version 4.7.3-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.7.2-1 -d nco-%{version} nco
-# tar czf nco-%{version}.tar.gz --exclude='nco-4.7.2/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.7.3-1 -d nco-%{version} nco
+# tar czf nco-%{version}.tar.gz --exclude='nco-4.7.3/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,7 +108,10 @@ fi
 # %{_libdir}/libnco++.so
 
 %changelog
-* Thu Jan 21 2018 Charlie Zender <zender at uci.edu> - 4.7.2-1
+* Fri Mar 03 2018 Charlie Zender <zender at uci.edu> - 4.7.3-1
+- new upstream 4.7.3
+
+* Thu Jan 25 2018 Charlie Zender <zender at uci.edu> - 4.7.2-1
 - new upstream 4.7.2
 
 * Thu Dec 21 2017 Charlie Zender <zender at uci.edu> - 4.7.1-1
diff --git a/bld/nco_dst.pl b/bld/nco_dst.pl
index 5b9130f..764e34e 100755
--- a/bld/nco_dst.pl
+++ b/bld/nco_dst.pl
@@ -5,20 +5,20 @@
 
 # Usage:
 # Export tagged, public versions
-# /usr/bin/scp ${DATA}/nco-4.7.2.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.7.2 # Build, do not release on SF
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --sf nco-4.7.2 # Build, release on SF
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --nst_all nco-4.7.2 # Install, do not build
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --nst_all nco-4.7.2 # Build and install
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_cnt nco-4.7.2
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_prs nco-4.7.2
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cgd_cnt nco-4.7.2
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cray_prs nco-4.7.2
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --bbl_cnt nco-4.7.2
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --blk_cnt nco-4.7.2
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --dat_cnt nco-4.7.2
-# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --ute_prs nco-4.7.2
+# /usr/bin/scp ${DATA}/nco-4.7.3.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.7.3 # Build, do not release on SF
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --sf nco-4.7.3 # Build, release on SF
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --nst_all nco-4.7.3 # Install, do not build
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --nst_all nco-4.7.3 # Build and install
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_cnt nco-4.7.3
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_prs nco-4.7.3
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cgd_cnt nco-4.7.3
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cray_prs nco-4.7.3
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --bbl_cnt nco-4.7.3
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --blk_cnt nco-4.7.3
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --dat_cnt nco-4.7.3
+# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --ute_prs nco-4.7.3
 
 # 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.7.2/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.7.3/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 25bc148..9d70486 100644
--- a/bm/NCO_bm.pm
+++ b/bm/NCO_bm.pm
@@ -686,7 +686,7 @@ sub tst_run {
 	    $cmd_lst_cnt++;
 	    if ($dbg_lvl > 2) {
 		print "\ntst_run: test cycle held - hit <Enter> to continue\n";
-		my $wait = <STDIN>;
+		#		my $wait = <STDIN>;
 	    }
 	} # end loop: 	foreach (@cmd_lst)
     } # end of client side 'else'
@@ -910,7 +910,7 @@ sub SS_prepare {
 ####################
 sub failed {
     $failure{$opr_nm}++;
-    $err_sng .= "   ERR: FAILURE in $opr_nm failure: $dsc_sng\n";
+    $err_sng .= "   ERR: FAILED in $opr_nm test: $dsc_sng\n";
     foreach(@cmd_lst) { $err_sng .= "   $_\n";}
     $err_sng .= "   ERR::EXPLAIN: Result: [$cmd_rsl] != Expected: [$nsr_xpc]\n\n" ;
     return;
diff --git a/bm/NCO_rgr.pm b/bm/NCO_rgr.pm
index d38d98f..2f7416c 100644
--- a/bm/NCO_rgr.pm
+++ b/bm/NCO_rgr.pm
@@ -108,9 +108,10 @@ sub tst_rgr {
     # 440 (for library 4.4.0)
     # 441 (for library 4.4.1.x)
     # 450 (for library 4.5.0)
-    # 451 (for library 4.5.1)
-    # 452 (for library 4.5.2)
-    # 453 (for library 4.5.3)
+    # 451 (for library 4.5.1) (development-only)
+    # 460 (for library 4.6.0.x)
+    # 461 (for library 4.6.1)
+    # 462 (for library 4.6.2)
 
   if($exit_value == 410){print "netCDF version 4.1.x detected\n";}
   if($exit_value == 431){print "netCDF version 4.3.1 detected\n";}
@@ -119,9 +120,10 @@ sub tst_rgr {
   if($exit_value == 440){print "netCDF version 4.4.0 detected\n";}
   if($exit_value == 441){print "netCDF version 4.4.1 detected\n";}
   if($exit_value == 450){print "netCDF version 4.5.0 detected\n";}
-  if($exit_value == 451){print "netCDF version 4.5.1 detected\n";}
-  if($exit_value == 452){print "netCDF version 4.5.2 detected\n";}
-  if($exit_value == 453){print "netCDF version 4.5.3 detected\n";}
+  if($exit_value == 451){print "netCDF version 4.5.1 detected\n";} # development-only
+  if($exit_value == 460){print "netCDF version 4.6.0 detected\n";}
+  if($exit_value == 461){print "netCDF version 4.6.1 detected\n";}
+  if($exit_value == 462){print "netCDF version 4.6.2 detected\n";}
 
   if($exit_value >= 400){$RUN_NETCDF4_TESTS=1;}
   if($exit_value >= 431){$RUN_NETCDF4_TESTS_VERSION_GE_431=1;}
@@ -486,6 +488,18 @@ if($USER eq 'zender'){
     $tst_cmd[3]="SS_OK";
     NCO_bm::tst_run(\@tst_cmd);
     $#tst_cmd=0; # Reset array
+
+# ncap2 #17
+   $dsc_sng="Run script to test sort functions";
+    $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/sort.nco' $in_pth_arg in.nc %tmp_fl_00%";
+    $tst_cmd[1]="ncks -C -H --trd -v nbr_err -s '%d' %tmp_fl_00%";
+    $tst_cmd[2]="0";
+    $tst_cmd[3]="SS_OK";
+    NCO_bm::tst_run(\@tst_cmd);
+    $#tst_cmd=0; # Reset array
+
+
+
     
     if($dodap eq "FALSE"){
 ####################
@@ -1247,7 +1261,7 @@ if($USER eq 'zender'){
     $#tst_cmd=0; # Reset array
 
 #nces #19 (check coordinate variables)
-# ncra -Y ncge -h -O mdl_1.nc ~/foo.nc
+# ncra -Y ncge -h -O ~/nco/data/mdl_1.nc ~/foo.nc
 # ncks -g cesm -v time ~/foo.nc
 # NB: This test succeeds when it fails, i.e., the NCO command fails as it should because the input files do not conform
     $dsc_sng="(Groups) Ensemble record coordinate variables";
@@ -5919,7 +5933,7 @@ if($RUN_NETCDF4_TESTS_VERSION_GE_431){
 #ncrename -O -d lev,z -d lat,y -d lon,x ~/nco/data/in_grp.nc ~/foo.nc
 #ncks -H --trd -s %d -v one ~/foo.nc
 # Check for corruption after simultaneously renaming multiple dimensions in netCDF4 file
-    $dsc_sng="netCDF4: Simultaneously rename multiple dimensions (netCDF bug, will require Unidata to fix in netCDF 4.5.???)";
+    $dsc_sng="netCDF4: Simultaneously rename multiple dimensions (netCDF bug, will require Unidata to fix)";
     $tst_cmd[0]="ncrename -O $fl_fmt $nco_D_flg -d lev,z -d lat,y -d lon,x $in_pth_arg in_grp.nc %tmp_fl_00%";
     $tst_cmd[1]="ncks -H --trd -s %d -v one %tmp_fl_00%";
     $tst_cmd[2]="1";
diff --git a/bm/bm.ncl b/bm/bm.ncl
new file mode 100644
index 0000000..d35c920
--- /dev/null
+++ b/bm/bm.ncl
@@ -0,0 +1,56 @@
+load "bm_lib.ncl"
+
+
+  
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; vars that are in ?????_xps_img.mc 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+; bm_times=new((/9/), float)
+
+
+
+; single plot list
+if(True) then  
+
+  years=(/1,3,5,10,15,20/)
+  years at units="years"
+
+
+  my_list=NewList("fifo")
+
+  bmx=make_benchmark("ctl","-3","-3",(/1.87,2.38,2.92,4.29,5.68,7.08/),"black")
+  ListPush(my_list,bmx)
+
+  ret=xy_benchmarks_plot(my_list,years,"test plot ",1.0,9.0)
+
+  
+
+end if
+
+
+
+
+if (False) then
+
+
+  my_list=NewList("fifo")
+  years=(/1,3,5/)
+  years at units="years"
+
+  ListPush(my_list, make_benchmark("ctl","-6","-6",(/63.74,68.85,74.51/) , "black"))
+  ListPush(my_list, make_benchmark("xpt1", "-6","-7",(/283.23,279.85,278.51/)  ,"red"))
+  ListPush(my_list, make_benchmark( "xpt2","-6", "-7 -L 1", (/346.56,362.56,367.27/)  ,"blue"))
+  ListPush(my_list, make_benchmark("xpt3", "-6", "-7 -L 9", (/643.09,700.14,728.24/)  ,"orange") )
+  ListPush(my_list, make_benchmark("xpt4","-6", "-7 -L 1 --ppc default=3",(/401.07,436.10,431.86/)  ,"green")) 
+  ListPush(my_list, make_benchmark("xpt5", "-6", "-7 --cnk_plc=g2d --cnk_map=nc4",(/355.09,360.92,366.49/) , "grey"))     
+  ListPush(my_list, make_benchmark("xpt6", "-6", "-7 --cnk_plc=g2d --cnk_map=nco",(/332.39,327.01,342.70/) , "orange"))
+  ListPush(my_list, make_benchmark("xpt7", "-6", "-7 --cnk_plc=g2d --cnk_map=rew",(/319.36,317.23,341.30/) , "purple"))
+
+  ret=xy_benchmarks_plot(my_list,years,"ncclimo run times",0.0,0.0)
+
+
+end if  
+
+
diff --git a/bm/bm_lib.ncl b/bm/bm_lib.ncl
new file mode 100644
index 0000000..7dc4758
--- /dev/null
+++ b/bm/bm_lib.ncl
@@ -0,0 +1,130 @@
+
+;************************************************
+undef("xy_benchmarks_plot")
+function xy_benchmarks_plot(rfl_img, xaxis, str_title:string, ymin:float, ymax:float)
+local nList, n, data, LineColors, LineThicknesses, res, wks   
+begin
+;
+;************************************************
+;  deal with multiple plots on graph 
+
+
+  nList=ListCount(rfl_img)
+  ; data = new((/nList,dimsizes(rfl_img[0]&years)/),float)
+  data = new((/nList,dimsizes(xaxis)/),float)
+  LineColors=new((/nList/),string)
+  LineThicknesses=new((/nList/),float)
+  Markers=new((/nList/),integer)
+  LineLabelStrings=new((/nList/),string)
+  
+  do n=0,nList-1
+    data(n,:)=rfl_img[n](:) 
+    if( isatt(rfl_img[n],"Color" ) )
+      LineColors(n)=rfl_img[n]@Color
+    else
+      LineColors(n)="blue"
+    end if  
+    
+    LineThicknesses(n)=4.0
+    ; set default to circle   
+    Markers(n)=16
+    LineLabelStrings(n)=rfl_img[n]@xpr_str
+  end do
+
+
+
+str_fname=str_sub_str(str_title," and ","__")
+
+;************************************************
+; plotting parameters
+;************************************************
+
+ if(ymin.eq.ymax) then 
+    ymin = min(data) 
+    ymax = max(data)
+ end if
+
+ wks   = gsn_open_wks ("png",str_fname)        ; send graphics to PNG file
+
+ res                  = True                     ; plot mods desired
+ res at tiMainString     = str_title          ; add title
+ res at tiYAxisString = rfl_img[0]@units 
+
+ ; res at tmXBMode  = "auto"
+ res at trXMinF = min(xaxis)
+ res at trXMaxF = max(xaxis)
+ res at tiXAxisString    = xaxis at units
+ res at tmXBValues=xaxis   
+
+ res at trYMinF     = ymin
+ res at trYMaxF     = ymax*1.06 ; make bound 6% larger than max value - tidy
+ 
+ res at xyLineThicknesses = LineThicknesses
+ ; res at xyLineColors      = (/"blue","red"/)        ; change line color
+ res at xyLineColors      = LineColors
+
+ res at xyMarkLineMode = "MarkLines"               ; Markers *and* lines
+ res at xyMarkers      = Markers   ; different markers
+ ; set marker colors same as line color
+ res at xyMarkerColors := LineColors
+ res at xyDashPattern  = 0                         ; Make curves all solid
+
+ wks at wkWidth =  800
+ wks at wkHeight = 800
+ 
+
+ plot = gsn_csm_xy (wks,xaxis,data,res) ; create plot
+
+;***********************************************
+; legend resources
+;***********************************************
+  lgres                    = True
+  lgres at lgLineColors       = LineColors
+  lgres at lgLineThicknessF   = LineThicknesses
+  lgres at lgItemType         = "Lines"        ; show lines only (default)
+  lgres at lgLabelFontHeightF = .04            ; set the legend label font thickness
+  lgres at lgMonoDashIndex    =  True
+  lgres at lgDashIndex        =  0             ; set all lines solid   
+  lgres at vpWidthF           = 0.15           ; width of legend (NDC)
+  lgres at vpHeightF          = 0.3            ; height of legend (NDC)
+  lgres at lgPerimColor       = "grey"         ; draw the box perimeter in orange
+  lgres at lgPerimThicknessF  = 5.0            ; thicken the box perimeter
+  lbid = gsn_create_legend(wks,nList,LineLabelStrings,lgres)         ; create legend
+
+  amres = True
+  amres at amParallelPosF   = -0.8 	    ; move legend to the right
+  amres at amOrthogonalPosF = -0.8             ; move the legend down
+  ; amres at amZone           = 1
+  ; amres at amSide           =   0 ; NhlLEFT
+  ;amres at amTrackData           =  True
+  ; amres at amDataXF           =  0.0
+  ; amres at amDataYF           =  0.0
+  amres at amJust             =  0 ;NhlTOPLEFT 
+  
+  annoid1 = gsn_add_annotation(plot,lbid,amres)   ; add legend to plot
+
+ draw(plot)   ; Draw base plot.
+ frame(wks)   ; advance frame
+
+ 
+ return 1
+end
+
+
+undef(" make_benchmark")
+function make_benchmark( xpr_str:string, cmd_in_str:string, cmd_out_str:string, bm,  Color:string)
+begin
+  bm at xpr_str=xpr_str
+  bm at cmd_in_str=cmd_in_str
+  bm at cmd_out_str=cmd_out_str
+  bm at Color=Color
+  bm at units="seconds" ; dont think this should be here
+
+  return(bm)   
+end  
+
+
+
+
+
+
diff --git a/bm/cch_clr.sh b/bm/cch_clr.sh
new file mode 100755
index 0000000..4204ae5
--- /dev/null
+++ b/bm/cch_clr.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Flush and clear the disk caches.
+
+if [ -z "$OSTYPE" ]; then
+    echo "$0: unknown OS type env-var OSTYPE not set"
+    exit 1;
+fi
+
+case "$OSTYPE" in
+    
+  darwin*)
+    purge
+    ;;
+  
+  linux*)
+    echo "$0: about to clear caches for linux"  
+    sync
+    sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
+    ;;
+	 
+  bsd*)
+    ;;
+  
+  # windoze
+  msys*)
+    ;;
+
+  #default do nothing
+  *)
+    ;;   
+
+esac
+
+exit 0
diff --git a/bm/chunking-times.sh b/bm/chunking-times.sh
new file mode 100755
index 0000000..678adb9
--- /dev/null
+++ b/bm/chunking-times.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+#######################################################################################
+# purpose: benchmark chunking tools nccopy, h5repack ncks 
+# author:  Henry Btowsky
+# date:    28th February 2018
+
+#######################################################################################
+# usage examples
+# chunking-times.sh <tool>  <input-netcdf-file> 
+#
+# chunking-times.sh nccopy cnk-tst-1032-29-35.nc
+# chunking-times.sh ncks foo.nc
+# chunking-times.sh h5repack cnk-tst-1032-29-35.nc
+#######################################################################################
+
+# get time from stderr log
+function ex_time () {    
+  tt_ar=($( cat  "$1" |grep zzz))  
+  tt_el="${tt_ar[0]}"
+  echo $tt_el 
+}
+
+dbg_flg=1
+sim_flag=0
+idx=0
+
+# nccopy or h5repack
+tool="$1" #  
+in_fl="$2"
+out_dir="."
+
+lst_tst="C1 C2 C3 C4"
+
+# lst_tst="C4"
+
+for tst in $lst_tst; do
+
+      case "$tst" in 
+        
+          C1)
+	    info_dbg="C1 test 516x20x25"    
+            cnk=(516 20 25);      
+         ;;     
+
+          C2)
+	    info_dbg="C2 test 64x8x8"    
+            cnk=(64 8 8);      
+         ;;     
+
+          C3)
+	    info_dbg="C2 test 46x6x7"    
+            cnk=(46 6 7);      
+         ;;     
+
+          C4)
+	    info_dbg="C2 test 33x5x6"    
+            cnk=(33 5 6);      
+         ;;     
+
+
+	  
+      esac
+      
+      out_fl="$out_dir/cnk-tst-dbg-${cnk[0]}-${cnk[1]}-${cnk[2]}.nc"          
+      [[ -e "$out_fl" ]]  && rm "$out_fl"
+
+      if [[ $tool = "nccopy" ]]; then
+                 
+          arg_chunks="time/${cnk[0]},y/${cnk[1]},x/${cnk[2]}"
+          exe_cmd="nccopy -k 4 -d0 -c ${arg_chunks} ${in_fl} ${out_fl}"        
+
+      elif [[ $tool = "h5repack" ]]; then
+           
+          arg_chunks="T:CHUNK=${cnk[0]}x${cnk[1]}x${cnk[2]}"
+          exe_cmd="h5repack -l ${arg_chunks} -i ${in_fl} -o ${out_fl}"        
+
+      elif [[ $tool = "ncks" ]]; then
+	  
+	  arg_chunks="--cnk_dmn time,${cnk[0]} --cnk_dmn y,${cnk[1]} --cnk_dmn x,${cnk[2]}"
+          exe_cmd="ncks -O -4 --cnk_plc g3d $arg_chunks  ${in_fl} ${out_fl}"  
+              
+      fi	  
+
+
+
+	
+        # do the deed  - nb zzz is so we can grep stderr
+        [[ $dbg_flg -ne 0 ]] && echo "exe_cmd=$exe_cmd"
+       
+        # delete old climo files
+	# rm "$out_fl"
+        
+        eval "/usr/bin/time --format \" %e zzz\" $exe_cmd 2>my_error_log" 
+        if [[ $? -ne 0 ]]; then   
+          echo "$tool ERROR"
+          cat my_error_log        
+        fi   
+        # extract time from stderr 
+        ts=$(ex_time my_error_log)
+     
+        [[ $dbg_flg -ne 0 ]] && echo  "test  $info_dbg time=$ts"  
+
+        if [[ -n "$ts" ]]; then
+          bm_times[idx]="$ts"
+        fi
+  
+        : $(( idx++ ))  
+
+done
+
+# format times into ncl array
+# e.g (/3.60,4.83,6.07,9.13,12.29,15.34/)
+ncl_sng="(/${bm_times[@]}/)"
+ncl_sng="${ncl_sng// /,}"
+
+echo $ncl_sng
+
+
diff --git a/bm/ncclimo_profile.sh b/bm/ncclimo_profile.sh
new file mode 100755
index 0000000..2f3ee14
--- /dev/null
+++ b/bm/ncclimo_profile.sh
@@ -0,0 +1,108 @@
+#!/bin/bash
+
+# get time from stderr log
+function ex_time () {    
+  tt_ar=($( cat  "$1" |grep zzz))  
+  tt_el="${tt_ar[0]}"
+  echo $tt_el 
+}
+
+dbg_flg=1
+sim_flag=0
+idx=0
+model="cam"
+
+ncclimo_sh="/ccs/home/butowsky/bin/ncclimo"
+in_dir="/lustre/atlas1/cli115/world-shared/mbranst/famipc5_ne120_v0.3_00003-wget-test"
+out_dir="/lustre/atlas/proj-shared/cli115/butowsky/ne120"
+
+
+# lst_tst="B1 B3 B5 B10 B15 B20"
+lst_tst="B1 B3 B5"
+
+# add_opts="-7 -L 7 --cnk_plc=g2d --cnk_map=rew"
+std_opts="$1"
+ext_args="$2"
+
+for tst in $lst_tst; do
+
+      case "$tst" in 
+        
+         B1)     
+           info_dbg="B1 - test a single year "
+	   srt_year=1979
+	   end_year=1979
+          ;;     
+
+         B3)   
+           info_dbg="B3 -  test 3 years"
+	   srt_year=1979
+	   end_year=1981
+          ;;     
+
+      
+         B5)
+           info_dbg="test B5 - test 5 years  "
+	   srt_year=1979
+	   end_year=1983
+          ;;
+                  
+         B10)  
+           info_dbg="test B10 - test 10 years"
+	   srt_year=1979
+	   end_year=1988
+          ;;     
+
+         B15)  
+           info_dbg="test B15 - test 15 years"
+	   srt_year=0000
+	   end_year=0014
+          ;;     
+
+         B20)  
+           info_dbg="test B20 - test 20 years"
+	   srt_year=0000
+	   end_year=0019
+          ;;     
+
+
+         DEBUG)
+	  info_dbg="B1 - test a single year "
+	  exe_cmd="ncclimo -i . -o out_climo/ -c essgcm14 -m $model -s 0000 -e 0000 -a sdc"
+          ;;     
+
+        esac   
+
+        exe_cmd="${ncclimo_sh} -d 1 -p mpi -i $in_dir -o $out_dir -c famipc5_ne120_v0.3_00003 -m $model -s $srt_year -e $end_year -a sdc $std_opts  -n '$ext_args'"
+        # do the deed  - nb zzz is so we can grep stderr
+        [[ $dbg_flg -ne 0 ]] && echo "exe_cmd=$exe_cmd"
+       
+        # delete old climo files
+	rm "${out_dir}/*.nc"
+        
+        eval "/usr/bin/time --format \" %e zzz\" $exe_cmd 2>my_error_log" 
+        if [[ $? -ne 0 ]]; then   
+          echo "NCO ERROR"
+          cat my_error_log        
+        fi   
+        # extract time from stderr 
+        ts=$(ex_time my_error_log)
+     
+        [[ $dbg_flg -ne 0 ]] && echo  "test  $info_dbg time=$ts"  
+
+        if [[ -n "$ts" ]]; then
+          bm_times[idx]="$ts"
+        fi
+  
+        : $(( idx++ ))  
+
+done
+
+# format times into ncl array
+# e.g (/3.60,4.83,6.07,9.13,12.29,15.34/)
+ncl_sng="(/${bm_times[@]}/)"
+ncl_sng="${ncl_sng// /,}"
+
+echo $ncl_sng
+
+
diff --git a/bm/nco_bm.pl b/bm/nco_bm.pl
index d119428..4272027 100755
--- a/bm/nco_bm.pl
+++ b/bm/nco_bm.pl
@@ -257,9 +257,8 @@ if ($os_sng =~ /Darwin/){
 	  If you want life to be better, consider installing the GNU coreutils
 	  which will provide an acceptable 'cut'.
 	  
-	  Hit <Enter> to acknowledge your miserable state of cut kharma.
 BADCUT
-        $tmp=<STDIN>;
+#        $tmp=<STDIN>;
 	$gnu_cut=0;
     }
 }
@@ -427,9 +426,9 @@ if(-e "/usr/bin/time" && -x "/usr/bin/time"){
     $tmr_app="time "; # bash builtin or other 'time'-like application (AIX)
 } # endif time
 
-if($dbg_lvl > 1){
+if($dbg_lvl >= 4){
     print "\nAbout to begin requested tests; waiting for keypress to proceed.\n";
-    my $tmp=<STDIN>;
+#    my $tmp=<STDIN>;
 }
 
 # Regression tests
diff --git a/cmake/README.md b/cmake/README.md
index 24ccfa3..201df54 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -6,7 +6,6 @@ https://github.com/nco/nco
 Do
 
 ```
-clone.bat
 bld.bat
 ```
 
@@ -56,17 +55,17 @@ INCLUDE_DIRECTORIES(${HDF5_HL_INCLUDE_DIR})
 NCO should detect the ZLIB dependency in HDF5 as
 
 ```
--- Looking for H5Z_DEFLATE in I:/nco/cmake/hdf5/build/bin/Debug/libhdf5_D.lib
--- Looking for H5Z_DEFLATE in I:/nco/cmake/hdf5/build/bin/Debug/libhdf5_D.lib - found
+-- Looking for H5Z_DEFLATE in I:/nco/cmake/build/hdf5/build/bin/Debug/libhdf5_D.lib
+-- Looking for H5Z_DEFLATE in I:/nco/cmake/build/hdf5/build/bin/Debug/libhdf5_D.lib - found
 -- ZLIB library is needed...
 ```
 
 the netcdf function detection should be
 
 ```
--- Found netcdf library at: I:/nco/cmake/netcdf-c/build/liblib/Debug/netcdf.lib
--- Looking for nc_inq_path in I:/nco/cmake/netcdf-c/build/liblib/Debug/netcdf.lib
--- Looking for nc_inq_path in I:/nco/cmake/netcdf-c/build/liblib/Debug/netcdf.lib - found
+-- Found netcdf library at: I:/nco/cmake/build/netcdf-c/build/liblib/Debug/netcdf.lib
+-- Looking for nc_inq_path in I:/nco/cmake/build/netcdf-c/build/liblib/Debug/netcdf.lib
+-- Looking for nc_inq_path in I:/nco/cmake/build/netcdf-c/build/liblib/Debug/netcdf.lib - found
 ```
 
 # NCO tests
@@ -124,7 +123,7 @@ edit hdf5-static.vcxproj and add full path of ZLIB and SZIP libraries as depende
 ```
 <Lib>
 <AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
-<AdditionalDependencies>I:\nco\cmake\zlib\build\Debug\zlibstaticd.lib;I:\nco\cmake\szip\build\bin\Debug\libszip_D.lib</AdditionalDependencies>
+<AdditionalDependencies>E:\nco\cmake\build\zlib\build\Debug\zlibstaticd.lib;E:\nco\cmake\build\szip\build\bin\Debug\libszip_D.lib</AdditionalDependencies>
 </Lib>
 ```
 
@@ -135,7 +134,7 @@ edit netcdf.vcxproj and add full path of HDF5 and curl libraries as dependencies
 ```
 <Lib>
 <AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
-<AdditionalDependencies>I:\nco\cmake\hdf5\build\bin\Debug\libhdf5_hl_D.lib;I:\nco\cmake\hdf5\build\bin\Debug\libhdf5_D.lib;I:\nco\cmake\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
+<AdditionalDependencies>E:\nco\cmake\build\hdf5\build\bin\Debug\libhdf5_hl_D.lib;E:\nco\cmake\build\hdf5\build\bin\Debug\libhdf5_D.lib;E:\nco\cmake\build\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
 </Lib>
 ```
 
@@ -145,7 +144,7 @@ edit netcdf.vcxproj and add full path of HDF5 and curl libraries as dependencies
 ```
 git clone https://github.com/Unidata/netcdf-c
 pushd netcdf-c
-git checkout tags/v4.5.0
+git checkout tags/v4.6.0
 popd
 git clone https://github.com/curl/curl
 git clone https://github.com/madler/zlib
@@ -154,7 +153,7 @@ git clone https://github.com/live-clones/hdf5
 git clone https://github.com/Unidata/UDUNITS-2
 git clone https://github.com/libexpat/libexpat
 git clone https://github.com/ampl/gsl
-git clone https://github.com/Distrotech/antlr2
+git clone https://github.com/nco/antlr
 ```
 
 
diff --git a/cmake/bld.bat b/cmake/bld.bat
index 9ca4a6c..9541065 100644
--- a/cmake/bld.bat
+++ b/cmake/bld.bat
@@ -3,10 +3,7 @@
 
 @echo off
 if not defined DevEnvDir (
- echo "%VS140COMNTOOLS%VsDevCmd.bat" 
- call "%VS140COMNTOOLS%VsDevCmd.bat" 
- echo "%VCINSTALLDIR%vcvarsall.bat" amd64
- call "%VCINSTALLDIR%vcvarsall.bat" amd64
+ call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
  if errorlevel 1 goto :eof
 )
 
@@ -19,13 +16,99 @@ set MSVC_VERSION="Visual Studio 14 2015 Win64"
 echo using static crt %STATIC_CRT%
 echo using %MSVC_VERSION%
 
-:: replace the character string '\' with '/' needed for cmake
+:: 'git clone' all the dependencies
+:: the build folder is 'build'
+:: git clone https://github.com/Unidata/netcdf-c
+:: git clone https://github.com/curl/curl
+:: git clone https://github.com/madler/zlib
+:: git clone https://github.com/soumagne/szip
+:: git clone https://github.com/live-clones/hdf5
+:: git clone https://github.com/Unidata/UDUNITS-2
+:: git clone https://github.com/libexpat/libexpat
+:: git clone https://github.com/ampl/gsl
+:: git clone https://github.com/nco/antlr2
+
+:: current place
 set root_win=%cd%
-set root=%root_win:\=/%
+set build=%root_win%\build
+
+if not exist %build% (
+ mkdir %build%
+ echo cloning/building in %build%
+) else (
+ echo skipping mkdir %build%
+)
+
+:: change to build place 
+:: replace the character string '\' with '/' needed for cmake
+pushd %build%
+set tmp=%cd%
+set root=%tmp:\=/%
 echo cmake root is %root%
 
+if not exist %build%\netcdf-c (
+ git clone https://github.com/nco/netcdf-c
+ pushd netcdf-c
+ git checkout Branch_v4.6.0
+ popd
+) else (
+ echo skipping netcdf git clone
+)
+
+if not exist %build%\curl (
+ git clone https://github.com/curl/curl
+) else (
+ echo skipping curl git clone
+)
+
+if not exist %build%\zlib (
+ git clone https://github.com/madler/zlib
+) else (
+ echo skipping zlib git clone
+)
+
+if not exist %build%\szip (
+ git clone https://github.com/soumagne/szip
+) else (
+ echo skipping szip git clone
+)
+
+if not exist %build%\hdf5 (
+ git clone https://github.com/live-clones/hdf5
+) else (
+ echo skipping hdf5 git clone
+)
+
+if not exist %build%\UDUNITS-2 (
+ git clone https://github.com/Unidata/UDUNITS-2
+) else (
+ echo skipping UDUNITS-2 git clone
+)
+
+if not exist %build%\libexpat (
+ git clone https://github.com/libexpat/libexpat
+) else (
+ echo skipping libexpat git clone
+)
+
+if not exist %build%\gsl (
+ git clone https://github.com/ampl/gsl
+) else (
+ echo skipping gsl git clone
+)
+
+if not exist %build%\antlr2 (
+ git clone https://github.com/nco/antlr2
+) else (
+ echo skipping antlr2 git clone
+)
+
+:: //////////////////////////////////////////////////////////
+:: zlib
+:: //////////////////////////////////////////////////////////
+
 :build_zlib
-if exist %root_win%\zlib\build\zlib.sln (
+if exist %build%\zlib\build\zlib.sln (
  echo skipping zlib build
  goto build_szip
 ) else (
@@ -37,15 +120,19 @@ if exist %root_win%\zlib\build\zlib.sln (
            -DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
            -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
            -DBUILD_SHARED_LIBS=OFF
-  msbuild zlib.sln /target:build /property:configuration=debug
-  cp %root%\zlib\build\zconf.h %root%\zlib
+  msbuild zlib.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
+  cp %build%\zlib\build\zconf.h %build%\zlib
   popd
   popd
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: szip
+:: //////////////////////////////////////////////////////////
+
 :build_szip
-if exist %root_win%\szip\build\SZIP.sln (
+if exist %build%\szip\build\SZIP.sln (
  echo skipping szip build
  goto build_hdf5
 ) else (
@@ -58,14 +145,18 @@ if exist %root_win%\szip\build\SZIP.sln (
            -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
            -DBUILD_SHARED_LIBS=OFF ^
            -DBUILD_TESTING=OFF
-  msbuild SZIP.sln /target:build /property:configuration=debug
+  msbuild SZIP.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   popd
   popd
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: hdf5
+:: //////////////////////////////////////////////////////////
+
 :build_hdf5
-if exist %root_win%\hdf5\build\bin\Debug\h5dump.exe (
+if exist %build%\hdf5\build\bin\Debug\h5dump.exe (
  echo skipping hdf5 build
  goto build_curl
 ) else (
@@ -90,15 +181,18 @@ if exist %root_win%\hdf5\build\bin\Debug\h5dump.exe (
            -DSZIP_FOUND=ON ^
            -DSZIP_STATIC_LIBRARY:FILEPATH=%root%/szip/build/bin/Debug/libszip_D.lib ^
            -DSZIP_INCLUDE_DIRS:PATH=%root%/szip/src
-  msbuild HDF5.sln /target:build /property:configuration=debug
+  msbuild HDF5.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   popd
   popd
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: curl
+:: //////////////////////////////////////////////////////////
 
 :build_curl
-if exist %root_win%\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib (
+if exist %build%\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib (
  echo skipping curl build
  goto build_netcdf
 ) else (
@@ -118,9 +212,12 @@ if exist %root_win%\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\l
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: netcdf
+:: //////////////////////////////////////////////////////////
 
 :build_netcdf
-if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
+if exist %build%\netcdf-c\build\ncdump\ncdump.exe (
  echo skipping netcdf build
  goto test_netcdf
 ) else (
@@ -143,7 +240,7 @@ if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
            -DHDF5_HL_INCLUDE_DIR=%root%/hdf5/hl/src ^
            -DCURL_LIBRARY=%root%/curl/builds/libcurl-vc14-x64-debug-static-ipv6-sspi-winssl/lib/libcurl_a_debug.lib ^
            -DCURL_INCLUDE_DIR=%root%/curl/include
-  msbuild netcdf.sln /target:build /property:configuration=debug
+  msbuild netcdf.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   popd
   popd
   if errorlevel 1 goto :eof
@@ -151,17 +248,21 @@ if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
 
 
 :test_netcdf
-if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
+if exist %build%\netcdf-c\build\ncdump\ncdump.exe (
  echo testing netcdf build
  @echo on
- %root_win%\netcdf-c\build\ncdump\ncdump.exe -k http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
+ %build%\netcdf-c\build\ncdump\ncdump.exe -h http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
  @echo off
  @echo.
  goto build_expat
 )
 
+:: //////////////////////////////////////////////////////////
+:: expat
+:: //////////////////////////////////////////////////////////
+
 :build_expat
-if exist %root_win%\libexpat\expat\build\expat.sln (
+if exist %build%\libexpat\expat\build\expat.sln (
  echo skipping expat build
  goto build_udunits
 ) else (
@@ -175,16 +276,19 @@ if exist %root_win%\libexpat\expat\build\expat.sln (
            -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
            -DBUILD_SHARED_LIBS=OFF ^
            -DBUILD_shared=OFF
-  msbuild expat.sln /target:build /property:configuration=debug
+  msbuild expat.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   popd
   popd
   popd
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: udunits
+:: //////////////////////////////////////////////////////////
 
 :build_udunits
-if exist %root_win%\UDUNITS-2\build\udunits.sln (
+if exist %build%\UDUNITS-2\build\udunits.sln (
  echo skipping udunits build
  goto build_gsl
 ) else (
@@ -198,15 +302,18 @@ if exist %root_win%\UDUNITS-2\build\udunits.sln (
            -DBUILD_SHARED_LIBS=OFF ^
            -DEXPAT_INCLUDE_DIR=%root%/libexpat/expat/lib ^
            -DEXPAT_LIBRARY=%root%/libexpat/expat/build/Debug/expatd.lib
-  msbuild udunits.sln /target:build /property:configuration=debug
+  msbuild udunits.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   popd
   popd
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: gsl
+:: //////////////////////////////////////////////////////////
 
 :build_gsl
-if exist %root_win%\GSL\build\GSL.sln (
+if exist %build%\GSL\build\GSL.sln (
  echo skipping gsl build
  goto build_antlr
 ) else (
@@ -225,14 +332,18 @@ if exist %root_win%\GSL\build\GSL.sln (
            -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
            -DBUILD_SHARED_LIBS=OFF ^
            -DGSL_DISABLE_TESTS=ON
-  msbuild GSL.sln /target:build /property:configuration=debug
+  msbuild GSL.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   popd
   popd
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: antlr
+:: //////////////////////////////////////////////////////////
+
 :build_antlr
-if exist %root_win%\antlr2\lib\cpp\build\Project.sln (
+if exist %build%\antlr2\lib\cpp\build\antlr.sln (
  echo skipping antlr build
  goto build_nco
 ) else (
@@ -246,7 +357,7 @@ if exist %root_win%\antlr2\lib\cpp\build\Project.sln (
            -DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
            -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
            -DBUILD_SHARED_LIBS=OFF
-  msbuild Project.sln /target:build /property:configuration=debug
+  msbuild antlr.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   popd
   popd
   popd
@@ -254,18 +365,24 @@ if exist %root_win%\antlr2\lib\cpp\build\Project.sln (
   if errorlevel 1 goto :eof
 )
 
+:: //////////////////////////////////////////////////////////
+:: NCO
+:: use undocumented option -H (location of CMakeLists.txt)
+:: //////////////////////////////////////////////////////////
 
 
 :build_nco
-if exist Debug\ncks.exe (
+if exist %build%\Debug\ncks.exe (
  echo skipping nco build
  goto test_nco
 ) else (
   echo building NCO
   rm -rf CMakeCache.txt CMakeFiles
-  cmake .. -G %MSVC_VERSION% ^
-  -DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
+  cmake .. -H..\.. ^
+   -G %MSVC_VERSION% ^
+  -DMSVC_DEVELOPER=ON ^
   -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
+  -DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
   -DNETCDF_INCLUDE:PATH=%root%/netcdf-c/include ^
   -DNETCDF_LIBRARY:FILE=%root%/netcdf-c/build/liblib/Debug/netcdf.lib ^
   -DHDF5_LIBRARY:FILE=%root%/hdf5/build/bin/Debug/libhdf5_D.lib ^
@@ -281,25 +398,27 @@ if exist Debug\ncks.exe (
   -DGSL_CBLAS_LIBRARY:FILE=%root%/gsl/build/Debug/gslcblas.lib ^
   -DANTLR_INCLUDE:PATH=%root%/antlr2/lib/cpp ^
   -DANTLR_LIBRARY:FILE=%root%/antlr2/lib/cpp/build/Debug/antlr.lib 
-  msbuild nco.sln /target:build /property:configuration=debug
+  msbuild nco.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
   if errorlevel 1 goto :eof
 )
 
 :test_nco
+set data=%root_win%\..\data
 @echo on
-%root_win%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %root_win%\..\data\in_grp.nc %root_win%\..\data\in_grp.cdl
-%root_win%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %root_win%\..\data\in.nc %root_win%\..\data\in.cdl
-%root_win%\Debug\ncks.exe --jsn_fmt 2 -C -g g10 -v two_dmn_rec_var %root_win%\..\data\in_grp.nc
-%root_win%\Debug\ncks.exe -v lat http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
+%build%\Debug\ncks.exe -v lat http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
+%build%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %data%\in_grp.nc %data%\in_grp.cdl
+%build%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %data%\in.nc %data%\in.cdl
+%build%\Debug\ncks.exe --jsn_fmt 2 -C -g g10 -v two_dmn_rec_var %data%\in_grp.nc
 
 :: generate text files in_grp.nc.gen.txt from in_grp.nc and in.nc and use tool FC to compare contents 
 :: with pre-existing in_grp.nc.txt, in.nc.txt, generated in Linux
 :: generation of in_grp.nc.gen.txt must be done in 'data' folder so that paths match
 
- at pushd %root_win%\..\data
-%root_win%\Debug\ncks.exe in_grp.nc > %root_win%\in_grp.nc.gen.txt 
-%root_win%\Debug\ncks.exe in.nc > %root_win%\in.nc.gen.txt 
+ at pushd %data%
+%build%\Debug\ncks.exe in_grp.nc > %build%\in_grp.nc.gen.txt 
+%build%\Debug\ncks.exe in.nc > %build%\in.nc.gen.txt 
+ at popd
 @popd
-fc in_grp.nc.gen.txt in_grp.nc.txt
-fc in.nc.gen.txt in.nc.txt
+fc %build%\in_grp.nc.gen.txt in_grp.nc.txt
+fc %build%\in.nc.gen.txt in.nc.txt
 echo done
\ No newline at end of file
diff --git a/cmake/build.bat b/cmake/build.bat
deleted file mode 100644
index 04711d7..0000000
--- a/cmake/build.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake .. ^
--DNETCDF_INCLUDE:PATH=I:/grafic_project/netcdf/include ^
--DNETCDF_LIBRARY:FILE=I:/grafic_project/Debug/netcdf.lib ^
--DHDF5_LIBRARY:FILE=I:/grafic_project/Debug/hdf5.1.8.5.patch1.lib ^
--DHDF5_HL_LIBRARY:FILE=I:/grafic_project/Debug/hdf5_hl.1.8.5.patch1.lib ^
--DZLIB_LIBRARY:FILE=I:/grafic_project/Debug/zlib.lib ^
--DSZIP_LIBRARY:FILE=I:/grafic_project/Debug/szlib.lib ^
--DCURL_LIBRARY:FILE=I:/grafic_project/Debug/libcurld.lib ^
--DANTLR_INCLUDE:PATH=I:/antlr-2.7.7/lib/cpp ^
--DANTLR_LIBRARY:FILE=I:/antlr-2.7.7/lib/cpp/debug/antlr.lib ^
--DUDUNITS2_INCLUDE:PATH=I:/udunits2/lib ^
--DUDUNITS2_LIBRARY:FILE=I:/udunits2/build/lib/Debug/udunits2.lib ^
--DEXPAT_LIBRARY:FILE=I:/expat/expat/win32/bin/Debug/libexpatMT.lib ^
--DGSL_INCLUDE:PATH=I:/gsl-1.8/src ^
--DGSL_LIBRARY:FILE=I:/gsl-1.8/src/gsl/1.8/gsl-1.8/VC8/libgsl/Debug-StaticLib/libgsl_d.lib ^
--DGSL_CBLAS_LIBRARY:FILE=I:/gsl-1.8/src/gsl/1.8/gsl-1.8/VC8/libgslcblas/Debug-StaticLib/libgslcblas_d.lib
-msbuild nco.sln /target:build /property:configuration=debug
-
-
diff --git a/cmake/clean.sh b/cmake/clean.sh
deleted file mode 100755
index 04090de..0000000
--- a/cmake/clean.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env bash
-rm -rf CMakeCache.txt CMakeFiles Makefile install_manifest.txt cmake_install.cmake cmake_uninstall.cmake
diff --git a/cmake/clone.bat b/cmake/clone.bat
deleted file mode 100644
index 79458e6..0000000
--- a/cmake/clone.bat
+++ /dev/null
@@ -1,13 +0,0 @@
-
-git clone https://github.com/Unidata/netcdf-c
-pushd netcdf-c
-git checkout tags/v4.5.0
-popd
-git clone https://github.com/curl/curl
-git clone https://github.com/madler/zlib
-git clone https://github.com/soumagne/szip
-git clone https://github.com/live-clones/hdf5
-git clone https://github.com/Unidata/UDUNITS-2
-git clone https://github.com/libexpat/libexpat
-git clone https://github.com/ampl/gsl
-git clone https://github.com/Distrotech/antlr2
\ No newline at end of file
diff --git a/cmake/dep.bat b/cmake/dep.bat
deleted file mode 100644
index 21e16ef..0000000
--- a/cmake/dep.bat
+++ /dev/null
@@ -1,122 +0,0 @@
-:: cmake build all NCO dependencies obtained with 'git clone' using nmake
-:: Pedro Vicente
-
- at echo off
- at call "%VS140COMNTOOLS%VsDevCmd.bat" amd64
-
-:: replace the character string '\' with '/' needed for cmake
-set temp=%cd%
-set root=%temp:\=/%
-echo root is %root%
-
-pushd zlib
-if exist build\Makefile (
- echo skipping zlib build
- popd
- goto build_hdf5
-) else (
-  echo building zlib
-  mkdir build
-  pushd build
-  cmake .. -G "NMake Makefiles" ^
-           -DCMAKE_BUILD_TYPE=Debug ^
-           -DBUILD_SHARED_LIBS=OFF
-  nmake
-  popd
-  popd
-)
-
-:build_hdf5
-pushd hdf5
-if exist build\Makefile (
- echo skipping hdf5 build
- popd
- goto build_curl
-) else (
-  echo building hdf5
-  mkdir build
-  pushd build
-  cmake .. -G "NMake Makefiles" ^
-           -DCMAKE_BUILD_TYPE=Debug ^
-           -DBUILD_SHARED_LIBS=OFF ^
-           -DBUILD_STATIC_EXECS=ON ^
-           -DBUILD_TESTING=OFF ^
-           -DHDF5_BUILD_EXAMPLES=OFF ^
-           -DHDF5_BUILD_CPP_LIB=OFF
-  nmake
-  popd
-  popd
-)
-
-:build_curl
-pushd curl
-if exist build\Makefile (
- echo skipping curl build
- popd
- goto build_netcdf
-) else (
-  echo building curl
-  mkdir build
-  pushd build
-  cmake .. -G "NMake Makefiles" ^
-           -DCMAKE_BUILD_TYPE=Debug ^
-           -DBUILD_SHARED_LIBS=OFF ^
-           -DBUILD_TESTING=OFF
-  nmake
-  popd
-  popd
-)
-
-:build_netcdf
-pushd netcdf-c
-if exist build\ncdump\ncdump.exe (
- echo skipping netcdf build
- popd
- goto test_netcdf
-) else (
-  echo building netcdf
-  mkdir build
-  pushd build
-  cmake .. -G "NMake Makefiles" ^
-           -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-           -DENABLE_TESTS=OFF ^
-           -DCMAKE_BUILD_TYPE=Debug ^
-           -DBUILD_SHARED_LIBS=OFF ^
-           -DHDF5_HL_LIBRARY=%root%/hdf5/build/bin/libhdf5_hl_D.lib ^
-           -DHDF5_C_LIBRARY=%root%/hdf5/build/bin/libhdf5_D.lib ^
-           -DHDF5_INCLUDE_DIR=%root%/hdf5/src ^
-           -DZLIB_LIBRARY:FILE=%root%/zlib/build/zlibstaticd.lib ^
-           -DZLIB_INCLUDE_DIR:PATH=%root%/zlib ^
-           -DHAVE_HDF5_H=%root%/hdf5/build ^
-           -DHDF5_HL_INCLUDE_DIR=%root%/hdf5/hl/src ^
-           -DCURL_LIBRARY=%root%/curl/build/lib/libcurl-d_imp.lib ^
-           -DCURL_INCLUDE_DIR=%root%/curl/include
-  nmake
-  popd
-  popd
-)
-
-:test_netcdf
-if exist %root%\netcdf-c\build\ncdump\ncdump.exe (
- echo testing netcdf build
- pushd netcdf-c
- pushd build
- pushd ncdump
- cp %root%\curl\build\lib\libcurl-d.dll %root%\netcdf-c\build\ncdump
- ncdump http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
- popd
- popd
- popd
- goto build_nco
-)
-
-:build_nco
-cmake .. ^
--DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
--DMSVC_USE_STATIC_CRT=OFF ^
--DNETCDF_INCLUDE:PATH=%root%/netcdf-c/include ^
--DNETCDF_LIBRARY:FILE=%root%/netcdf-c/build/liblib/netcdf.lib ^
--DHDF5_LIBRARY:FILE=%root%/hdf5/build/bin/libhdf5_D.lib ^
--DHDF5_HL_LIBRARY:FILE=%root%/hdf5/build/bin/libhdf5_hl_D.lib ^
--DZLIB_LIBRARY:FILE=%root%/zlib/build/zlibstaticd.lib ^
--DCURL_LIBRARY:FILE=%root%/curl/build/lib/libcurl-d_imp.lib
\ No newline at end of file
diff --git a/cmake/in.nc.txt b/cmake/in.nc.txt
index 235470a..197f8a8 100644
--- a/cmake/in.nc.txt
+++ b/cmake/in.nc.txt
@@ -1415,31 +1415,31 @@ netcdf in {
 
 
   data:
-    AQ01 = 1e+36 ; 
+    AQ01 = 1e+36 ;
 
-    H2O = 1 ; 
+    H2O = 1 ;
 
-    H2OH2O = 1 ; 
+    H2OH2O = 1 ;
 
-    H2O_ice = 1 ; 
+    H2O_ice = 1 ;
 
-    H2O_lqd = 1 ; 
+    H2O_lqd = 1 ;
 
-    H2SO4 = 1 ; 
+    H2SO4 = 1 ;
 
-    Lat = -45, 45 ; 
+    Lat = -45, 45 ;
 
     LatLon = 
     0, 1, 2, 3, 
-    4, 5, 6, 7 ; 
+    4, 5, 6, 7 ;
 
-    Lon = -180, -90, 0, 90 ; 
+    Lon = -180, -90, 0, 90 ;
 
     ORO = 
     0, 1, 0, 0, 
-    1, 1, 0, 2 ; 
+    1, 1, 0, 2 ;
 
-    P0 = 100000 ; 
+    P0 = 100000 ;
 
     PS = 
     101325, 101325, 101325, 101325, 
@@ -1461,250 +1461,250 @@ netcdf in {
     101325, 101325, 101325, 101325, 
     101325, 101325, 101325, 101325, 
     101325, 101325, 101325, 101325, 
-    101325, 101325, 101325, 101325 ; 
+    101325, 101325, 101325, 101325 ;
 
-    Q = 1e+36 ; 
+    Q = 1e+36 ;
 
-    Q01 = 1 ; 
+    Q01 = 1 ;
 
-    Q01Q = 1e+36 ; 
+    Q01Q = 1e+36 ;
 
-    Q02 = 2 ; 
+    Q02 = 2 ;
 
-    Q03 = 3 ; 
+    Q03 = 3 ;
 
-    Q04 = 4 ; 
+    Q04 = 4 ;
 
-    Q05 = 5 ; 
+    Q05 = 5 ;
 
-    Q06 = 6 ; 
+    Q06 = 6 ;
 
-    Q07 = 7 ; 
+    Q07 = 7 ;
 
-    Q08 = 8 ; 
+    Q08 = 8 ;
 
-    Q09 = 9 ; 
+    Q09 = 9 ;
 
-    Q1 = 1e+36 ; 
+    Q1 = 1e+36 ;
 
-    Q10 = 10 ; 
+    Q10 = 10 ;
 
-    Q100 = 100 ; 
+    Q100 = 100 ;
 
-    Q11 = 11 ; 
+    Q11 = 11 ;
 
-    Q12 = 12 ; 
+    Q12 = 12 ;
 
-    Q13 = 13 ; 
+    Q13 = 13 ;
 
-    Q14 = 14 ; 
+    Q14 = 14 ;
 
-    Q15 = 15 ; 
+    Q15 = 15 ;
 
-    Q16 = 16 ; 
+    Q16 = 16 ;
 
-    Q17 = 17 ; 
+    Q17 = 17 ;
 
-    Q18 = 18 ; 
+    Q18 = 18 ;
 
-    Q19 = 19 ; 
+    Q19 = 19 ;
 
-    Q20 = 20 ; 
+    Q20 = 20 ;
 
-    Q21 = 21 ; 
+    Q21 = 21 ;
 
-    Q22 = 22 ; 
+    Q22 = 22 ;
 
-    Q23 = 23 ; 
+    Q23 = 23 ;
 
-    Q24 = 24 ; 
+    Q24 = 24 ;
 
-    Q25 = 25 ; 
+    Q25 = 25 ;
 
-    Q26 = 26 ; 
+    Q26 = 26 ;
 
-    Q27 = 27 ; 
+    Q27 = 27 ;
 
-    Q28 = 28 ; 
+    Q28 = 28 ;
 
-    Q29 = 29 ; 
+    Q29 = 29 ;
 
-    Q30 = 30 ; 
+    Q30 = 30 ;
 
-    Q31 = 31 ; 
+    Q31 = 31 ;
 
-    Q32 = 32 ; 
+    Q32 = 32 ;
 
-    Q33 = 33 ; 
+    Q33 = 33 ;
 
-    Q34 = 34 ; 
+    Q34 = 34 ;
 
-    Q35 = 35 ; 
+    Q35 = 35 ;
 
-    Q36 = 36 ; 
+    Q36 = 36 ;
 
-    Q37 = 37 ; 
+    Q37 = 37 ;
 
-    Q38 = 38 ; 
+    Q38 = 38 ;
 
-    Q39 = 39 ; 
+    Q39 = 39 ;
 
-    Q40 = 40 ; 
+    Q40 = 40 ;
 
-    Q41 = 41 ; 
+    Q41 = 41 ;
 
-    Q42 = 42 ; 
+    Q42 = 42 ;
 
-    Q43 = 43 ; 
+    Q43 = 43 ;
 
-    Q44 = 44 ; 
+    Q44 = 44 ;
 
-    Q45 = 45 ; 
+    Q45 = 45 ;
 
-    Q46 = 46 ; 
+    Q46 = 46 ;
 
-    Q47 = 47 ; 
+    Q47 = 47 ;
 
-    Q48 = 48 ; 
+    Q48 = 48 ;
 
-    Q49 = 49 ; 
+    Q49 = 49 ;
 
-    Q50 = 50 ; 
+    Q50 = 50 ;
 
-    Q51 = 51 ; 
+    Q51 = 51 ;
 
-    Q52 = 52 ; 
+    Q52 = 52 ;
 
-    Q53 = 53 ; 
+    Q53 = 53 ;
 
-    Q54 = 54 ; 
+    Q54 = 54 ;
 
-    Q55 = 55 ; 
+    Q55 = 55 ;
 
-    Q56 = 56 ; 
+    Q56 = 56 ;
 
-    Q57 = 57 ; 
+    Q57 = 57 ;
 
-    Q58 = 58 ; 
+    Q58 = 58 ;
 
-    Q59 = 59 ; 
+    Q59 = 59 ;
 
-    Q60 = 60 ; 
+    Q60 = 60 ;
 
-    Q61 = 61 ; 
+    Q61 = 61 ;
 
-    Q62 = 62 ; 
+    Q62 = 62 ;
 
-    Q63 = 63 ; 
+    Q63 = 63 ;
 
-    Q64 = 64 ; 
+    Q64 = 64 ;
 
-    Q65 = 65 ; 
+    Q65 = 65 ;
 
-    Q66 = 66 ; 
+    Q66 = 66 ;
 
-    Q67 = 67 ; 
+    Q67 = 67 ;
 
-    Q68 = 68 ; 
+    Q68 = 68 ;
 
-    Q69 = 69 ; 
+    Q69 = 69 ;
 
-    Q70 = 70 ; 
+    Q70 = 70 ;
 
-    Q71 = 71 ; 
+    Q71 = 71 ;
 
-    Q72 = 72 ; 
+    Q72 = 72 ;
 
-    Q73 = 73 ; 
+    Q73 = 73 ;
 
-    Q74 = 74 ; 
+    Q74 = 74 ;
 
-    Q75 = 75 ; 
+    Q75 = 75 ;
 
-    Q76 = 76 ; 
+    Q76 = 76 ;
 
-    Q77 = 77 ; 
+    Q77 = 77 ;
 
-    Q78 = 78 ; 
+    Q78 = 78 ;
 
-    Q79 = 79 ; 
+    Q79 = 79 ;
 
-    Q80 = 80 ; 
+    Q80 = 80 ;
 
-    Q81 = 81 ; 
+    Q81 = 81 ;
 
-    Q82 = 82 ; 
+    Q82 = 82 ;
 
-    Q83 = 83 ; 
+    Q83 = 83 ;
 
-    Q84 = 84 ; 
+    Q84 = 84 ;
 
-    Q85 = 85 ; 
+    Q85 = 85 ;
 
-    Q86 = 86 ; 
+    Q86 = 86 ;
 
-    Q87 = 87 ; 
+    Q87 = 87 ;
 
-    Q88 = 88 ; 
+    Q88 = 88 ;
 
-    Q89 = 89 ; 
+    Q89 = 89 ;
 
-    Q90 = 90 ; 
+    Q90 = 90 ;
 
-    Q91 = 91 ; 
+    Q91 = 91 ;
 
-    Q92 = 92 ; 
+    Q92 = 92 ;
 
-    Q93 = 93 ; 
+    Q93 = 93 ;
 
-    Q94 = 94 ; 
+    Q94 = 94 ;
 
-    Q95 = 95 ; 
+    Q95 = 95 ;
 
-    Q96 = 96 ; 
+    Q96 = 96 ;
 
-    Q97 = 97 ; 
+    Q97 = 97 ;
 
-    Q98 = 98 ; 
+    Q98 = 98 ;
 
-    Q99 = 99 ; 
+    Q99 = 99 ;
 
-    QA01 = 1e+36 ; 
+    QA01 = 1e+36 ;
 
-    QQ01 = 1e+36 ; 
+    QQ01 = 1e+36 ;
 
-    RDM = 1, 9, 36, 84, 126, 126, 84, 36, 9, 1 ; 
+    RDM = 1, 9, 36, 84, 126, 126, 84, 36, 9, 1 ;
 
-    SALT = _, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, _, _ ; 
+    SALT = _, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, _, _ ;
 
-    albers_conical_equal_area = "" ; 
+    albers_conical_equal_area = "" ;
 
-    area = 10, 10 ; 
+    area = 10, 10 ;
 
-    area2 = 20, 5 ; 
+    area2 = 20, 5 ;
 
-    area_asm = 1, 2 ; 
+    area_asm = 1, 2 ;
 
     areacella = 
     1, 1, 2, 2, 
-    3, 3, 4, 4 ; 
+    3, 3, 4, 4 ;
 
-    att_sng = 20 ; 
+    att_sng = 20 ;
 
-    att_var = 10, 10.1, 10.2, 10.3, 10.40101, 10.5, 10.6, 10.7, 10.8, 10.99 ; 
+    att_var = 10, 10.1, 10.2, 10.3, 10.40101, 10.5, 10.6, 10.7, 10.8, 10.99 ;
 
-    att_var_jsn = 73 ; 
+    att_var_jsn = 73 ;
 
-    att_var_spc_chr = 73 ; 
+    att_var_spc_chr = 73 ;
 
     bnd_var = 
     1, 2, 
     3, 4, 
-    5, 6 ; 
+    5, 6 ;
 
     byt_2D = 
     0, 1, 2, 3, 
-    4, 5, 6, 7 ; 
+    4, 5, 6, 7 ;
 
     byt_3D = 
     0, 1, 2, 3, 
@@ -1712,7 +1712,7 @@ netcdf in {
     8, 9, 10, 11, 
     12, 13, 14, 15, 
     16, 17, 18, 19, 
-    20, 21, 22, 23 ; 
+    20, 21, 22, 23 ;
 
     byt_3D_rec = 
     1, 2, 3, 4, 
@@ -1734,31 +1734,31 @@ netcdf in {
     65, 66, 67, 68, 
     69, 70, 71, 72, 
     73, 74, 75, 76, 
-    77, 78, 79, 80 ; 
+    77, 78, 79, 80 ;
 
     byt_arr = 
     0, 1, 2, 3, 
-    4, 5, 6, 7 ; 
+    4, 5, 6, 7 ;
 
-    byte_var = 122 ; 
+    byte_var = 122 ;
 
-    byte_var_neg = -122 ; 
+    byte_var_neg = -122 ;
 
-    char_var = "z" ; 
+    char_var = "z" ;
 
-    char_var_1D_arr = "two words" ; 
+    char_var_1D_arr = "two words" ;
 
     char_var_2D_arr = 
     "one", 
-    "two" ; 
+    "two" ;
 
-    char_var_nul = "" ; 
+    char_var_nul = "" ;
 
-    char_var_nul_c_format = "0" ; 
+    char_var_nul_c_format = "0" ;
 
-    char_var_space = " " ; 
+    char_var_space = " " ;
 
-    char_var_zero = "0" ; 
+    char_var_zero = "0" ;
 
     climatology_bounds = 
     0.5, 1.5, 
@@ -1770,23 +1770,23 @@ netcdf in {
     6.5, 7.5, 
     7.5, 8.5, 
     8.5, 9.5, 
-    9.5, 10.5 ; 
+    9.5, 10.5 ;
 
-    cnv_CF_crd = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ; 
+    cnv_CF_crd = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ;
 
     cnv_CF_grd = 
     1, 2, 3, 4, 
-    5, 6, 7, 8 ; 
+    5, 6, 7, 8 ;
 
-    cnv_CF_ncl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    cnv_CF_ncl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    cnv_CF_ncl_var_1 = 11, 22, 23, 24, 25, 26, 27, 28, 29, 30 ; 
+    cnv_CF_ncl_var_1 = 11, 22, 23, 24, 25, 26, 27, 28, 29, 30 ;
 
-    cnv_CF_ncl_var_2 = 21, 32, 33, 34, 35, 36, 37, 38, 39, 40 ; 
+    cnv_CF_ncl_var_2 = 21, 32, 33, 34, 35, 36, 37, 38, 39, 40 ;
 
-    date = 640224, 640225, 640226, 640227, 640228, 640301, 640302, 640303, 640304, 640305 ; 
+    date = 640224, 640225, 640226, 640227, 640228, 640301, 640302, 640303, 640304, 640305 ;
 
-    date_int = 1964, 3, 12, 12, 9 ; 
+    date_int = 1964, 3, 12, 12, 9 ;
 
     date_rec = 
     "2010-11-01T00:00:00.000000", 
@@ -1798,36 +1798,36 @@ netcdf in {
     "2010-11-01T06:00:00.000000", 
     "2010-11-01T07:00:00.000000", 
     "2010-11-01T08:00:00.000000", 
-    "2010-11-01T09:00:00.000000" ; 
+    "2010-11-01T09:00:00.000000" ;
 
-    date_sng = "2010-11-01T00:00:00.000000" ; 
+    date_sng = "2010-11-01T00:00:00.000000" ;
 
-    dgn = 73 ; 
+    dgn = 73 ;
 
-    dgn_var = 73 ; 
+    dgn_var = 73 ;
 
-    double_var = 10 ; 
+    double_var = 10 ;
 
-    double_var2 = 10 ; 
+    double_var2 = 10 ;
 
-    dps_dry = 73 ; 
+    dps_dry = 73 ;
 
-    dps_ttl = 73 ; 
+    dps_ttl = 73 ;
 
-    dps_wet = 73 ; 
+    dps_wet = 73 ;
 
-    e_dbl = 2.71828182846 ; 
+    e_dbl = 2.71828182846 ;
 
-    e_flt = 2.718282 ; 
+    e_flt = 2.718282 ;
 
-    fl_dmn = "ab3" ; 
+    fl_dmn = "ab3" ;
 
-    fl_nm = "/home/zender/nco/data/in.cdl" ; 
+    fl_nm = "/home/zender/nco/data/in.cdl" ;
 
     fl_nm_arr = 
     "/data/zender/dstccm04/dstccm04_8589_01.nc", 
     "/data/zender/dstccm04/dstccm04_8589_02.nc", 
-    "/data/zender/dstccm04/dstccm04_8589_03.nc" ; 
+    "/data/zender/dstccm04/dstccm04_8589_03.nc" ;
 
     fl_nm_rec = 
     "/data/zender/dstccm04/dstccm04_8589_01.nc", 
@@ -1839,15 +1839,15 @@ netcdf in {
     "/data/zender/dstccm04/dstccm04_8589_07.nc", 
     "/data/zender/dstccm04/dstccm04_8589_08.nc", 
     "/data/zender/dstccm04/dstccm04_8589_09.nc", 
-    "/data/zender/dstccm04/dstccm04_8589_10.nc" ; 
+    "/data/zender/dstccm04/dstccm04_8589_10.nc" ;
 
-    fll_val = 73, _, 73, _ ; 
+    fll_val = 73, _, 73, _ ;
 
-    fll_val_mss_val = 73, _, 73, _ ; 
+    fll_val_mss_val = 73, _, 73, _ ;
 
-    float_var = 10 ; 
+    float_var = 10 ;
 
-    four = 4 ; 
+    four = 4 ;
 
     four_dmn_rec_var = 
     1, 2, 3, 4, 
@@ -1909,9 +1909,9 @@ netcdf in {
     225, 226, 227, 228, 
     229, 230, 231, 232, 
     233, 234, 235, 236, 
-    237, 238, 239, 240 ; 
+    237, 238, 239, 240 ;
 
-    g = 9.8 ; 
+    g = 9.8 ;
 
     gds_3dvar = 
     273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8, 
@@ -1923,255 +1923,255 @@ netcdf in {
     279.1, 279.2, 279.3, 279.4, 279.5, 279.9, 279.7, 279.8, 
     280.1, 280.2, 280.3, 280.4, 280.5, 280.9, 280.7, 280.8, 
     281.1, 281.2, 281.3, 281.4, 281.5, 281.9, 281.7, 281.8, 
-    282.1, 282.2, 282.3, 282.4, 282.5, 282.9, 282.7, 282.8 ; 
+    282.1, 282.2, 282.3, 282.4, 282.5, 282.9, 282.7, 282.8 ;
 
-    gds_crd = 0, 1, 2, 3, 4, 5, 6, 7 ; 
+    gds_crd = 0, 1, 2, 3, 4, 5, 6, 7 ;
 
-    gds_var = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ; 
+    gds_var = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ;
 
-    gds_var_ncd = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ; 
+    gds_var_ncd = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ;
 
-    grv_sfc = 9.80665 ; 
+    grv_sfc = 9.80665 ;
 
-    gw = 10, 10 ; 
+    gw = 10, 10 ;
 
-    gw_T42 = -87.8638, -85.09653, -82.31291, -79.5256, -76.7369, -73.94752, -71.15775, -68.36776, -65.57761, -62.78735, -59.99702, -57.20663, -54.4162, -51.62573, -48.83524, -46.04473, -43.2542, -40.46365, -37.67309, -34.88252, -32.09195, -29.30136, -26.51077, -23.72017, -20.92957, -18.13897, -15.34836, -12.55776, -9.767146, -6.976534, -4.185921, -1.395307, 1.395307, 4.185921, 6.976534, 9.767146, 12.55776, 15.34836, 18.13897, 20.92957, 23.72017, 26.51077, 29.30136, 32.09195, 34.88252, 37 [...]
+    gw_T42 = -87.8638, -85.09653, -82.31291, -79.5256, -76.7369, -73.94752, -71.15775, -68.36776, -65.57761, -62.78735, -59.99702, -57.20663, -54.4162, -51.62573, -48.83524, -46.04473, -43.2542, -40.46365, -37.67309, -34.88252, -32.09195, -29.30136, -26.51077, -23.72017, -20.92957, -18.13897, -15.34836, -12.55776, -9.767146, -6.976534, -4.185921, -1.395307, 1.395307, 4.185921, 6.976534, 9.767146, 12.55776, 15.34836, 18.13897, 20.92957, 23.72017, 26.51077, 29.30136, 32.09195, 34.88252, 37 [...]
 
-    hyai = 0.002255, 0.0438226, 0, 0 ; 
+    hyai = 0.002255, 0.0438226, 0, 0 ;
 
-    hyam = 0.0036, 0.0019894, 0 ; 
+    hyam = 0.0036, 0.0019894, 0 ;
 
-    hybi = 0, 0.457453, 0.985, 1 ; 
+    hybi = 0, 0.457453, 0.985, 1 ;
 
-    hybm = 0, 0.52, 0.992 ; 
+    hybm = 0, 0.52, 0.992 ;
 
-    ilev = 50, 200, 750, 1005 ; 
+    ilev = 50, 200, 750, 1005 ;
 
-    int_var = 10 ; 
+    int_var = 10 ;
 
-    lat = -90, 90 ; 
+    lat = -90, 90 ;
 
-    lat_1D_rct = -90, -90, -90, -90, 90, 90, 90, 90 ; 
+    lat_1D_rct = -90, -90, -90, -90, 90, 90, 90, 90 ;
 
-    lat_1D_rrg = -90, -30, -30, 0, 0, 30, 30, 90 ; 
+    lat_1D_rrg = -90, -30, -30, 0, 0, 30, 30, 90 ;
 
     lat_2D_rct = 
     -90, -90, -90, -90, 
-    90, 90, 90, 90 ; 
+    90, 90, 90, 90 ;
 
     lat_2D_rrg = 
     -90, -30, -30, 0, 
-    0, 30, 30, 90 ; 
+    0, 30, 30, 90 ;
 
-    lat_T42 = -88.24009, -85.09245, -82.31198, -79.52525, -76.73673, -73.94742, -71.1577, -68.36772, -65.57758, -62.78733, -59.99701, -57.20662, -54.41619, -51.62573, -48.83524, -46.04472, -43.25419, -40.46365, -37.67309, -34.88252, -32.09194, -29.30136, -26.51077, -23.72017, -20.92957, -18.13897, -15.34836, -12.55776, -9.767145, -6.976533, -4.185921, -1.395307, 1.395307, 4.185921, 6.976533, 9.767145, 12.55776, 15.34836, 18.13897, 20.92957, 23.72017, 26.51077, 29.30136, 32.09194, 34.8825 [...]
+    lat_T42 = -88.24009, -85.09245, -82.31198, -79.52525, -76.73673, -73.94742, -71.1577, -68.36772, -65.57758, -62.78733, -59.99701, -57.20662, -54.41619, -51.62573, -48.83524, -46.04472, -43.25419, -40.46365, -37.67309, -34.88252, -32.09194, -29.30136, -26.51077, -23.72017, -20.92957, -18.13897, -15.34836, -12.55776, -9.767145, -6.976533, -4.185921, -1.395307, 1.395307, 4.185921, 6.976533, 9.767145, 12.55776, 15.34836, 18.13897, 20.92957, 23.72017, 26.51077, 29.30136, 32.09194, 34.8825 [...]
 
     lat_bnd = 
     -90, 0, 
-    0, 90 ; 
+    0, 90 ;
 
-    lat_cal = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    lat_cal = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    lat_cpy = -90, 90 ; 
+    lat_cpy = -90, 90 ;
 
-    lat_gds = -90, -30, -30, 0, 0, 30, 30, 90 ; 
+    lat_gds = -90, -30, -30, 0, 0, 30, 30, 90 ;
 
-    lat_gds_ncd = -90, -30, -30, 0, 0, 30, 30, 90 ; 
+    lat_gds_ncd = -90, -30, -30, 0, 0, 30, 30, 90 ;
 
-    lat_grd = -90, 0, 90 ; 
+    lat_grd = -90, 0, 90 ;
 
-    lat_times_lon = 0, 1, 2, 3, 4, 5, 6, 7 ; 
+    lat_times_lon = 0, 1, 2, 3, 4, 5, 6, 7 ;
 
-    lat_times_lon_nbr = 8 ; 
+    lat_times_lon_nbr = 8 ;
 
-    lat_var = 1, 2 ; 
+    lat_var = 1, 2 ;
 
-    lat_wgt = 1, 2 ; 
+    lat_wgt = 1, 2 ;
 
-    lev = 100, 500, 1000 ; 
+    lev = 100, 500, 1000 ;
 
     lev_bnd = 
     0, 300, 
     300, 750, 
-    750, 1013.25 ; 
+    750, 1013.25 ;
 
-    lev_cpy = 100, 500, 1000 ; 
+    lev_cpy = 100, 500, 1000 ;
 
-    lev_var = 100, 500, 1000 ; 
+    lev_var = 100, 500, 1000 ;
 
-    lev_wgt = 10, 2, 1 ; 
+    lev_wgt = 10, 2, 1 ;
 
-    lon = 0, 90, 180, 270 ; 
+    lon = 0, 90, 180, 270 ;
 
-    lon_1D_rct = 0, 90, 180, 270, 0, 90, 180, 270 ; 
+    lon_1D_rct = 0, 90, 180, 270, 0, 90, 180, 270 ;
 
-    lon_1D_rrg = 0, 0, 180, 0, 180, 0, 180, 0 ; 
+    lon_1D_rrg = 0, 0, 180, 0, 180, 0, 180, 0 ;
 
     lon_2D_rct = 
     0, 90, 180, 270, 
-    0, 90, 180, 270 ; 
+    0, 90, 180, 270 ;
 
     lon_2D_rrg = 
     0, 0, 180, 0, 
-    180, 0, 180, 0 ; 
+    180, 0, 180, 0 ;
 
-    lon_T42 = 0, 2.8125, 5.625, 8.4375, 11.25, 14.0625, 16.875, 19.6875, 22.5, 25.3125, 28.125, 30.9375, 33.75, 36.5625, 39.375, 42.1875, 45, 47.8125, 50.625, 53.4375, 56.25, 59.0625, 61.875, 64.6875, 67.5, 70.3125, 73.125, 75.9375, 78.75, 81.5625, 84.375, 87.1875, 90, 92.8125, 95.625, 98.4375, 101.25, 104.0625, 106.875, 109.6875, 112.5, 115.3125, 118.125, 120.9375, 123.75, 126.5625, 129.375, 132.1875, 135, 137.8125, 140.625, 143.4375, 146.25, 149.0625, 151.875, 154.6875, 157.5, 160.3125 [...]
+    lon_T42 = 0, 2.8125, 5.625, 8.4375, 11.25, 14.0625, 16.875, 19.6875, 22.5, 25.3125, 28.125, 30.9375, 33.75, 36.5625, 39.375, 42.1875, 45, 47.8125, 50.625, 53.4375, 56.25, 59.0625, 61.875, 64.6875, 67.5, 70.3125, 73.125, 75.9375, 78.75, 81.5625, 84.375, 87.1875, 90, 92.8125, 95.625, 98.4375, 101.25, 104.0625, 106.875, 109.6875, 112.5, 115.3125, 118.125, 120.9375, 123.75, 126.5625, 129.375, 132.1875, 135, 137.8125, 140.625, 143.4375, 146.25, 149.0625, 151.875, 154.6875, 157.5, 160.3125 [...]
 
-    lon_cal = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    lon_cal = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    lon_gds = 0, 0, 180, 0, 180, 0, 180, 0 ; 
+    lon_gds = 0, 0, 180, 0, 180, 0, 180, 0 ;
 
-    lon_gds_ncd = 0, 0, 180, 0, 180, 0, 180, 0 ; 
+    lon_gds_ncd = 0, 0, 180, 0, 180, 0, 180, 0 ;
 
-    lon_grd = -45, 45, 135, 225, 315 ; 
+    lon_grd = -45, 45, 135, 225, 315 ;
 
-    lon_wgt = 0.347855, 0.652145, 0.652145, 0.347855 ; 
+    lon_wgt = 0.347855, 0.652145, 0.652145, 0.347855 ;
 
-    lond = 0, 90, 180, 270 ; 
+    lond = 0, 90, 180, 270 ;
 
-    lonf = 0, 90, 180, 270 ; 
+    lonf = 0, 90, 180, 270 ;
 
-    long_var = 10 ; 
+    long_var = 10 ;
 
-    lsmlev = 0.05, 0.1, 0.2, 0.5, 1, 3 ; 
+    lsmlev = 0.05, 0.1, 0.2, 0.5, 1, 3 ;
 
     mask = 
     0, 1, 0, 0, 
-    1, 1, 0, 1 ; 
+    1, 1, 0, 1 ;
 
-    md5_a = "a" ; 
+    md5_a = "a" ;
 
-    md5_abc = "abc" ; 
+    md5_abc = "abc" ;
 
-    mmr_CO2 = 0.000611 ; 
+    mmr_CO2 = 0.000611 ;
 
-    msk_prt_mss_prt = 0.5, _, 1.5, _ ; 
+    msk_prt_mss_prt = 0.5, _, 1.5, _ ;
 
-    mss_val = 73, _, 73, _ ; 
+    mss_val = 73, _, 73, _ ;
 
-    mss_val_all = _, _, _, _ ; 
+    mss_val_all = _, _, _, _ ;
 
-    mss_val_fst = _, 73, _, 73 ; 
+    mss_val_fst = _, 73, _, 73 ;
 
-    mss_val_scl = _ ; 
+    mss_val_scl = _ ;
 
-    mss_val_scl_sml = _ ; 
+    mss_val_scl_sml = _ ;
 
-    nan_arr = 0, 73 ; 
+    nan_arr = 0, 73 ;
 
-    nan_scl = _ ; 
+    nan_scl = _ ;
 
-    nbdate = 640224 ; 
+    nbdate = 640224 ;
 
-    negative_one = -1 ; 
+    negative_one = -1 ;
 
-    nm_pnd = 1 ; 
+    nm_pnd = 1 ;
 
-    nm_spc = 1 ; 
+    nm_spc = 1 ;
 
-    no_mss_val = 73, 1e+36, 73, 1e+36 ; 
+    no_mss_val = 73, 1e+36, 73, 1e+36 ;
 
-    non_nul_trm_char_one_dmn = "ab" ; 
+    non_nul_trm_char_one_dmn = "ab" ;
 
     non_nul_trm_char_two_dmn = 
     "abcd", 
     "efgh", 
-    "ijkm" ; 
+    "ijkm" ;
 
-    non_rec_var_flt_pck = 1, 2, 3, 4 ; 
+    non_rec_var_flt_pck = 1, 2, 3, 4 ;
 
-    od = 20, 22, 24, 26, 28, 30, 32, 34, 36, 38 ; 
+    od = 20, 22, 24, 26, 28, 30, 32, 34, 36, 38 ;
 
-    one = 1 ; 
+    one = 1 ;
 
-    one_dmn_int_val_one = 1, 1 ; 
+    one_dmn_int_val_one = 1, 1 ;
 
-    one_dmn_int_val_two = 2, 2 ; 
+    one_dmn_int_val_two = 2, 2 ;
 
-    one_dmn_rec_var = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    one_dmn_rec_var = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    one_dmn_rec_var__FillValue = 1, 2, 3, 4, 5, 6, 7, 8, 9, _ ; 
+    one_dmn_rec_var__FillValue = 1, 2, 3, 4, 5, 6, 7, 8, 9, _ ;
 
-    one_dmn_rec_var_dbl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    one_dmn_rec_var_dbl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    one_dmn_rec_var_flt = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    one_dmn_rec_var_flt = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    one_dmn_rec_var_flt_mss = _, 2, 3, 4, 5, 6, 7, 8, 9, _ ; 
+    one_dmn_rec_var_flt_mss = _, 2, 3, 4, 5, 6, 7, 8, 9, _ ;
 
-    one_dmn_rec_var_flt_mss_scl = _, 2, 3, 4, 5, 6, 7, 8, 9, _ ; 
+    one_dmn_rec_var_flt_mss_scl = _, 2, 3, 4, 5, 6, 7, 8, 9, _ ;
 
-    one_dmn_rec_var_flt_scl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    one_dmn_rec_var_flt_scl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    one_dmn_rec_var_mdn = 1, 1, 2, 2, 2, 2, 10, 10, 10, 10 ; 
+    one_dmn_rec_var_mdn = 1, 1, 2, 2, 2, 2, 10, 10, 10, 10 ;
 
-    one_dmn_rec_var_mdn__FillValue = 1, _, 2, 2, _, _, 10, 10, 10, _ ; 
+    one_dmn_rec_var_mdn__FillValue = 1, _, 2, 2, _, _, 10, 10, 10, _ ;
 
-    one_dmn_rec_var_missing_value = 1, 2, 3, 4, 5, 6, 7, 8, 9, 1e+36 ; 
+    one_dmn_rec_var_missing_value = 1, 2, 3, 4, 5, 6, 7, 8, 9, 1e+36 ;
 
-    one_dmn_rec_var_mss_val = _, _, _, _, _, _, _, _, _, _ ; 
+    one_dmn_rec_var_mss_val = _, _, _, _, _, _, _, _, _, _ ;
 
-    one_dmn_rec_var_mss_val_arr = _, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    one_dmn_rec_var_mss_val_arr = _, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    one_dmn_rec_var_sng = "Hello Worl" ; 
+    one_dmn_rec_var_sng = "Hello Worl" ;
 
-    one_dmn_rec_var_unsorted = 10, 4, 6, 2, 8, 1, 9, 7, 3, 5 ; 
+    one_dmn_rec_var_unsorted = 10, 4, 6, 2, 8, 1, 9, 7, 3, 5 ;
 
-    one_dmn_rec_var_unsorted__FillValue = _, 4, 6, 2, 8, 1, 9, 7, 3, 5 ; 
+    one_dmn_rec_var_unsorted__FillValue = _, 4, 6, 2, 8, 1, 9, 7, 3, 5 ;
 
-    one_dmn_rec_wgt = 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 ; 
+    one_dmn_rec_wgt = 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 ;
 
-    one_dmn_var = 1, 10 ; 
+    one_dmn_var = 1, 10 ;
 
     orog = 
     0, 1, 0, 0, 
-    1, 1, 0, 2 ; 
+    1, 1, 0, 2 ;
 
     orog2 = 
     1, 1, 1, 1, 
-    1, 1, 1, 1 ; 
+    1, 1, 1, 1 ;
 
     orog3 = 
     0, 0, 0, 0, 
-    1, 1, 1, 1 ; 
+    1, 1, 1, 1 ;
 
-    pck = 1 ; 
+    pck = 1 ;
 
-    pck_3 = 1 ; 
+    pck_3 = 1 ;
 
-    pck_5 = 2 ; 
+    pck_5 = 2 ;
 
-    pck_7 = 1 ; 
+    pck_7 = 1 ;
 
-    pck_arr = -32767, 0, 1, 32767 ; 
+    pck_arr = -32767, 0, 1, 32767 ;
 
-    pi = 3.14159265358979 ; 
+    pi = 3.14159265358979 ;
 
     pi_arr_dbl = 
     3.14159265358979, 3.14159265358979, 3.14159265358979, 3.14159265358979, 
-    3.14159265358979, 3.14159265358979, 3.14159265358979, 3.14159265358979 ; 
+    3.14159265358979, 3.14159265358979, 3.14159265358979, 3.14159265358979 ;
 
     pi_arr_flt = 
     3.141593, 3.141593, 3.141593, 3.141593, 
-    3.141593, 3.141593, 3.141593, 3.141593 ; 
+    3.141593, 3.141593, 3.141593, 3.141593 ;
 
-    ppc_bgr = 1.234568e+29, 1.234568e+28, 1.234568e+27, 1.234568e+26, 1.234568e+25, 1.234568e+24, 1.234568e+23, 1.234568e+22, 1.234568e+21, 1.234568e+20 ; 
+    ppc_bgr = 1.234568e+29, 1.234568e+28, 1.234568e+27, 1.234568e+26, 1.234568e+25, 1.234568e+24, 1.234568e+23, 1.234568e+22, 1.234568e+21, 1.234568e+20 ;
 
-    ppc_bgr_scl = 1.234568e+20 ; 
+    ppc_bgr_scl = 1.234568e+20 ;
 
-    ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ; 
+    ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ;
 
-    ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+    ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-    ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ; 
+    ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ;
 
-    ppc_hgh = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+    ppc_hgh = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-    ppc_hgr = 0.123456789, 0.12345678901, 0.123456789012, 0.1234567890123, 0.12345678901234, 0.123456789012345, 0.123456789012346, 0.123456789012346, 0.123456789012346, 0.123456789012346 ; 
+    ppc_hgr = 0.123456789, 0.12345678901, 0.123456789012, 0.1234567890123, 0.12345678901234, 0.123456789012345, 0.123456789012346, 0.123456789012346, 0.123456789012346, 0.123456789012346 ;
 
-    ppc_zro_dbl = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; 
+    ppc_zro_dbl = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;
 
-    ppc_zro_flt = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; 
+    ppc_zro_flt = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;
 
-    ppc_zro_int = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; 
+    ppc_zro_int = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;
 
     prs_sfc = 
     1, 2, 3, 4, 
@@ -2193,59 +2193,59 @@ netcdf in {
     65, 66, 67, 68, 
     69, 70, 71, 72, 
     73, 74, 75, 76, 
-    77, 78, 79, 80 ; 
+    77, 78, 79, 80 ;
 
-    rec_var_dbl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    rec_var_dbl = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    rec_var_dbl_mss_val_dbl_pck = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ; 
+    rec_var_dbl_mss_val_dbl_pck = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ;
 
-    rec_var_dbl_mss_val_dbl_pck_lng = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ; 
+    rec_var_dbl_mss_val_dbl_pck_lng = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ;
 
-    rec_var_dbl_mss_val_dbl_upk = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_dbl_mss_val_dbl_upk = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_dbl_mss_val_sht_pck = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ; 
+    rec_var_dbl_mss_val_sht_pck = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ;
 
-    rec_var_dbl_mss_val_sht_pck_sht = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ; 
+    rec_var_dbl_mss_val_sht_pck_sht = _, 32767, 21845, 10922, 0, -10922, -21845, -32767, _, _ ;
 
-    rec_var_dbl_mss_val_sht_upk = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_dbl_mss_val_sht_upk = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_dbl_pck = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    rec_var_dbl_pck = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    rec_var_flt = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    rec_var_flt = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    rec_var_flt_mss_val_dbl = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_flt_mss_val_dbl = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_flt_mss_val_flt = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_flt_mss_val_flt = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_flt_mss_val_flt_all = _, _, _, _, _, _, _, _, _, _ ; 
+    rec_var_flt_mss_val_flt_all = _, _, _, _, _, _, _, _, _, _ ;
 
-    rec_var_flt_mss_val_flt_all_but_one = _, _, _, _, 5, _, _, _, _, _ ; 
+    rec_var_flt_mss_val_flt_all_but_one = _, _, _, _, 5, _, _, _, _, _ ;
 
-    rec_var_flt_mss_val_flt_all_but_two = _, _, _, _, 5, _, _, _, _, 10 ; 
+    rec_var_flt_mss_val_flt_all_but_two = _, _, _, _, 5, _, _, _, _, 10 ;
 
-    rec_var_flt_mss_val_flt_pck_flt = _, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, _, _ ; 
+    rec_var_flt_mss_val_flt_pck_flt = _, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, _, _ ;
 
-    rec_var_flt_mss_val_int = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_flt_mss_val_int = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_flt_pck = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    rec_var_flt_pck = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    rec_var_int_mss_val_dbl = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_int_mss_val_dbl = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_int_mss_val_flt = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_int_mss_val_flt = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_int_mss_val_int = _, 2, 3, 4, 5, 6, 7, 8, _, _ ; 
+    rec_var_int_mss_val_int = _, 2, 3, 4, 5, 6, 7, 8, _, _ ;
 
-    rec_var_pck_scale_factor_only = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    rec_var_pck_scale_factor_only = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    rlev = 1000, 500, 100 ; 
+    rlev = 1000, 500, 100 ;
 
-    rz = 0, 5000, 17000 ; 
+    rz = 0, 5000, 17000 ;
 
-    scalar_var = 10 ; 
+    scalar_var = 10 ;
 
-    scl_dbl_pck = 10922 ; 
+    scl_dbl_pck = 10922 ;
 
-    short_var = 10 ; 
+    short_var = 10 ;
 
     td = 
     1, 
@@ -2257,7 +2257,7 @@ netcdf in {
     7, 
     8, 
     9, 
-    10 ; 
+    10 ;
 
     th = 
     1, 2, 3, 4, 
@@ -2279,9 +2279,9 @@ netcdf in {
     65, 66, 67, 68, 
     69, 70, 71, 72, 
     _, 74, 75, 76, 
-    77, 78, 79, _ ; 
+    77, 78, 79, _ ;
 
-    three = 3 ; 
+    three = 3 ;
 
     three_dmn_rec_var = 
     1, 2, 3, 4, 
@@ -2303,7 +2303,7 @@ netcdf in {
     65, 66, 67, 68, 
     69, 70, 71, 72, 
     73, 74, 75, 76, 
-    77, 78, 79, 80 ; 
+    77, 78, 79, 80 ;
 
     three_dmn_rec_var_pck = 
     32766, 31936, 31107, 30277, 
@@ -2325,7 +2325,7 @@ netcdf in {
     -20323, -21153, -21982, -22812, 
     -23641, -24471, -25300, -26130, 
     -26959, -27789, -28618, -29448, 
-    -30277, -31107, -31936, -32766 ; 
+    -30277, -31107, -31936, -32766 ;
 
     three_dmn_var = 
     0, 1, 2, 3, 
@@ -2333,7 +2333,7 @@ netcdf in {
     8, 9, 10, 11, 
     12, 13, 14, 15, 
     16, 17, 18, 19, 
-    20, 21, 22, 23 ; 
+    20, 21, 22, 23 ;
 
     three_dmn_var_crd = 
     0, 1, 2, 3, 
@@ -2341,7 +2341,7 @@ netcdf in {
     4, 5, 6, 7, 
     16, 17, 18, 19, 
     8, 9, 10, 11, 
-    20, 21, 22, 23 ; 
+    20, 21, 22, 23 ;
 
     three_dmn_var_dbl = 
     1, 2, 3, 4, 
@@ -2363,7 +2363,7 @@ netcdf in {
     65, 66, 67, 68, 
     69, 70, 71, 72, 
     _, 74, 75, 76, 
-    77, 78, 79, _ ; 
+    77, 78, 79, _ ;
 
     three_dmn_var_int = 
     1, 2, 3, 4, 
@@ -2385,7 +2385,7 @@ netcdf in {
     65, _, 67, 68, 
     69, 70, 71, 72, 
     _, 74, 75, _, 
-    77, 78, 79, 80 ; 
+    77, 78, 79, 80 ;
 
     three_dmn_var_sht = 
     1, 2, 3, 4, 
@@ -2407,9 +2407,9 @@ netcdf in {
     65, 66, 67, 68, 
     69, 70, 71, 72, 
     _, _, _, _, 
-    _, _, _, _ ; 
+    _, _, _, _ ;
 
-    time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
     time_bnds = 
     0.5, 1.5, 
@@ -2421,7 +2421,7 @@ netcdf in {
     6.5, 7.5, 
     7.5, 8.5, 
     8.5, 9.5, 
-    9.5, 10.5 ; 
+    9.5, 10.5 ;
 
     time_lon = 
     0, 90, 180, 270, 
@@ -2433,31 +2433,31 @@ netcdf in {
     0, 90, 180, 270, 
     0, 90, 180, 270, 
     0, 90, 180, 270, 
-    0, 90, 180, 270 ; 
+    0, 90, 180, 270 ;
 
-    time_udunits = 876012, 876018, 876024 ; 
+    time_udunits = 876012, 876018, 876024 ;
 
-    tm_360 = 59 ; 
+    tm_360 = 59 ;
 
-    tm_365 = 59 ; 
+    tm_365 = 59 ;
 
-    tm_366 = 59 ; 
+    tm_366 = 59 ;
 
-    tm_grg = 59 ; 
+    tm_grg = 59 ;
 
-    tm_jln = 59 ; 
+    tm_jln = 59 ;
 
-    tm_scn = 59 ; 
+    tm_scn = 59 ;
 
-    tm_std = 59 ; 
+    tm_std = 59 ;
 
-    tpt = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8, 273.9, 274 ; 
+    tpt = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8, 273.9, 274 ;
 
-    tpt_dbl = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8, 273.9, 274 ; 
+    tpt_dbl = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8, 273.9, 274 ;
 
-    tpt_flt = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8, 273.9, 274 ; 
+    tpt_flt = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8, 273.9, 274 ;
 
-    two = 2 ; 
+    two = 2 ;
 
     two_dmn_rec_var = 
     1, 2, 3, 
@@ -2469,7 +2469,7 @@ netcdf in {
     1, 2.6, 3, 
     1, 2.7, 3, 
     1, 2.8, 3, 
-    1, 2.9, 3 ; 
+    1, 2.9, 3 ;
 
     two_dmn_rec_var_sng = 
     "abc", 
@@ -2481,11 +2481,11 @@ netcdf in {
     "ghi", 
     "hij", 
     "jkl", 
-    "klm" ; 
+    "klm" ;
 
     two_dmn_var = 
     1.5, 5.5, 9.5, 
-    13.5, 17.5, 21.5 ; 
+    13.5, 17.5, 21.5 ;
 
     tx = 
     1, 2, 3, 4, 
@@ -2497,7 +2497,7 @@ netcdf in {
     25, 26, 27, 28, 
     29, 30, 31, 32, 
     33, 34, 35, 36, 
-    37, 38, 39, 40 ; 
+    37, 38, 39, 40 ;
 
     txyz = 
     1, 2, 3, 
@@ -2579,7 +2579,7 @@ netcdf in {
     229, 230, 231, 
     232, 233, 234, 
     235, 236, 237, 
-    238, 239, 240 ; 
+    238, 239, 240 ;
 
     ty = 
     1, 2, 
@@ -2591,7 +2591,7 @@ netcdf in {
     13, 14, 
     15, 16, 
     17, 18, 
-    19, 20 ; 
+    19, 20 ;
 
     tyz = 
     1, 2, 3, 
@@ -2613,7 +2613,7 @@ netcdf in {
     49, 50, 51, 
     52, 53, 54, 
     55, 56, 57, 
-    58, 59, 60 ; 
+    58, 59, 60 ;
 
     tz = 
     1, 2, 3, 
@@ -2625,67 +2625,67 @@ netcdf in {
     19, 20, 21, 
     22, 23, 24, 
     25, 26, 27, 
-    28, 29, 30 ; 
+    28, 29, 30 ;
 
-    u = 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ; 
+    u = 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ;
 
-    upk = 3 ; 
+    upk = 3 ;
 
-    upk_arr = -32767, 0, 1, 32767 ; 
+    upk_arr = -32767, 0, 1, 32767 ;
 
-    v = 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ; 
+    v = 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ;
 
-    val_eminusten = 1.1e-10 ; 
+    val_eminusten = 1.1e-10 ;
 
-    val_half = 0.5 ; 
+    val_half = 0.5 ;
 
-    val_half_half = 0.5, 0.5 ; 
+    val_half_half = 0.5, 0.5 ;
 
-    val_max_max_sht = 17000, 17000 ; 
+    val_max_max_sht = 17000, 17000 ;
 
-    val_one_int = 1 ; 
+    val_one_int = 1 ;
 
-    val_one_mss = 1, _ ; 
+    val_one_mss = 1, _ ;
 
-    val_one_mss_int = 1, _ ; 
+    val_one_mss_int = 1, _ ;
 
-    val_one_one_int = 1, 1 ; 
+    val_one_one_int = 1, 1 ;
 
-    var_1D_rct = 0, 1, 0, 0, 1, 1, 0, 2 ; 
+    var_1D_rct = 0, 1, 0, 0, 1, 1, 0, 2 ;
 
-    var_1D_rrg = 0, 1, 0, 0, 1, 1, 0, 2 ; 
+    var_1D_rrg = 0, 1, 0, 0, 1, 1, 0, 2 ;
 
     var_2D_rct = 
     0, 1, 0, 0, 
-    1, 1, 0, 2 ; 
+    1, 1, 0, 2 ;
 
     var_2D_rrg = 
     0, 1, 0, 0, 
-    1, 1, 0, 2 ; 
+    1, 1, 0, 2 ;
 
     var_msk = 
     0, 1, 0, 0, 
-    1, 1, 0, 2 ; 
+    1, 1, 0, 2 ;
 
-    var_mss_0 = _, 1, 2, 3 ; 
+    var_mss_0 = _, 1, 2, 3 ;
 
-    var_mss_1 = 0, _, 2, 3 ; 
+    var_mss_1 = 0, _, 2, 3 ;
 
-    var_mss_2 = 0, 1, _, 3 ; 
+    var_mss_2 = 0, 1, _, 3 ;
 
-    var_mss_3 = 0, 1, 2, _ ; 
+    var_mss_3 = 0, 1, 2, _ ;
 
-    var_mss_nil = 0, 1, 2, 3 ; 
+    var_mss_nil = 0, 1, 2, 3 ;
 
-    var_nm-dash = 1 ; 
+    var_nm-dash = 1 ;
 
-    vld_rng = 273, _, 180, 179, 273, 360, 361, 1e+36, -1e+36, 273 ; 
+    vld_rng = 273, _, 180, 179, 273, 360, 361, 1e+36, -1e+36, 273 ;
 
-    vmr_CO2 = 0.0004 ; 
+    vmr_CO2 = 0.0004 ;
 
-    weight = 10, 10 ; 
+    weight = 10, 10 ;
 
-    wgt_one = 1, 1 ; 
+    wgt_one = 1, 1 ;
 
     wnd_spd = 
     _, 0.5, 1.5, 0.5, 
@@ -2707,9 +2707,9 @@ netcdf in {
     0.5, 0.5, 0.5, 0.5, 
     0.5, 0.5, 0.5, 0.5, 
     0.5, 0.5, 2.5, 0.5, 
-    0.5, 2.5, 0.5, 0.5 ; 
+    0.5, 2.5, 0.5, 0.5 ;
 
-    wvl = 5e-07, 1e-06 ; 
+    wvl = 5e-07, 1e-06 ;
 
     xyz = 
     0, 1, 2, 
@@ -2719,11 +2719,11 @@ netcdf in {
     12, 13, 14, 
     15, 16, 17, 
     18, 19, 20, 
-    21, 22, 23 ; 
+    21, 22, 23 ;
 
-    z = 17000, 5000, 0 ; 
+    z = 17000, 5000, 0 ;
 
-    zero = 0 ; 
+    zero = 0 ;
 
     zg = 
     1, 2, 3, 4, 
@@ -2755,6 +2755,6 @@ netcdf in {
     105, 106, 107, 108, 
     109, 110, 111, 112, 
     113, 114, 115, 116, 
-    117, 118, 119, 120 ; 
+    117, 118, 119, 120 ;
 
 } // group /
diff --git a/cmake/in_grp.nc.txt b/cmake/in_grp.nc.txt
index de8b99f..ce517a1 100644
--- a/cmake/in_grp.nc.txt
+++ b/cmake/in_grp.nc.txt
@@ -102,46 +102,46 @@ netcdf in_grp {
 
 
   data:
-    area = 10, 10 ; 
+    area = 10, 10 ;
 
-    att_var = 10, 10.1, 10.2, 10.3, 10.40101, 10.5, 10.6, 10.7, 10.8, 10.99 ; 
+    att_var = 10, 10.1, 10.2, 10.3, 10.40101, 10.5, 10.6, 10.7, 10.8, 10.99 ;
 
-    att_var_jsn = 73 ; 
+    att_var_jsn = 73 ;
 
-    att_var_spc_chr = 73 ; 
+    att_var_spc_chr = 73 ;
 
-    lat = -90, 90 ; 
+    lat = -90, 90 ;
 
     lat_lon = 
     1, 2, 3, 4, 
-    5, 6, 7, 8 ; 
+    5, 6, 7, 8 ;
 
-    lev = 100, 500, 1000 ; 
+    lev = 100, 500, 1000 ;
 
     lev_bnd = 
     0, 300, 
     300, 750, 
-    750, 1013.25 ; 
+    750, 1013.25 ;
 
-    lon = 0, 90, 180, 270 ; 
+    lon = 0, 90, 180, 270 ;
 
-    non_coord = 9.96921e+36, 9.96921e+36 ; 
+    non_coord = 9.96921e+36, 9.96921e+36 ;
 
-    one = 1 ; 
+    one = 1 ;
 
-    ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ; 
+    ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ;
 
-    ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+    ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-    ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ; 
+    ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ;
 
-    scl = 1 ; 
+    scl = 1 ;
 
-    time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+    time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-    unique = 73 ; 
+    unique = 73 ;
 
-    val_one_mss = 1, _ ; 
+    val_one_mss = 1, _ ;
 
   group: g1 {
 
@@ -173,21 +173,21 @@ netcdf in_grp {
       :history = "History group attribute.\n" ;
 
     data:
-      g1v1 = 1 ; 
+      g1v1 = 1 ;
 
-      g1v2 = 2 ; 
+      g1v2 = 2 ;
 
-      lon = 0, 90, 180, 270 ; 
+      lon = 0, 90, 180, 270 ;
 
-      ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ; 
+      ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ;
 
-      ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+      ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-      ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ; 
+      ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ;
 
-      scl = 1.1 ; 
+      scl = 1.1 ;
 
-      v1 = 1 ; 
+      v1 = 1 ;
 
     group: g1g1 {
 
@@ -209,15 +209,15 @@ netcdf in_grp {
         int v1 ;
 
       data:
-        ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ; 
+        ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ;
 
-        ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+        ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-        ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ; 
+        ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ;
 
-        scl = 1.11 ; 
+        scl = 1.11 ;
 
-        v1 = 11 ; 
+        v1 = 11 ;
 
     } // group /g1/g1g1
     group: g1\:g2 {
@@ -240,11 +240,11 @@ netcdf in_grp {
       double time(time) ;
 
     data:
-      lon = 0, 90, 180, 270 ; 
+      lon = 0, 90, 180, 270 ;
 
-      scl = 1.2 ; 
+      scl = 1.2 ;
 
-      time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+      time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
   } // group /g2
   group: g4 {
@@ -267,13 +267,13 @@ netcdf in_grp {
         ppc_flt:original_values = "0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789" ;
 
     data:
-      one_dmn_rec_var = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+      one_dmn_rec_var = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-      ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ; 
+      ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ;
 
-      ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+      ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-      ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ; 
+      ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ;
 
   } // group /g4
   group: g5 {
@@ -291,11 +291,11 @@ netcdf in_grp {
       double time52(time52) ;
 
     data:
-      one_dmn_rec_var = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+      one_dmn_rec_var = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
-      time51 = 1, 2 ; 
+      time51 = 1, 2 ;
 
-      time52 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; 
+      time52 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 
   } // group /g5
   group: g6 {
@@ -306,9 +306,9 @@ netcdf in_grp {
       float area1(lat) ;
 
     data:
-      area = 20, 30 ; 
+      area = 20, 30 ;
 
-      area1 = 21, 31 ; 
+      area1 = 21, 31 ;
 
     group: g6g1 {
 
@@ -316,7 +316,7 @@ netcdf in_grp {
         float area(lat) ;
 
       data:
-        area = 40, 50 ; 
+        area = 40, 50 ;
 
     } // group /g6/g6g1
   } // group /g6
@@ -354,17 +354,17 @@ netcdf in_grp {
         ppc_flt:original_values = "0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789" ;
 
     data:
-      gds_crd = 0, 1, 2, 3, 4, 5, 6, 7 ; 
+      gds_crd = 0, 1, 2, 3, 4, 5, 6, 7 ;
 
-      lat_gds = -90, -30, -30, 0, 0, 30, 30, 90 ; 
+      lat_gds = -90, -30, -30, 0, 0, 30, 30, 90 ;
 
-      lon_gds = 0, 0, 180, 0, 180, 0, 180, 0 ; 
+      lon_gds = 0, 0, 180, 0, 180, 0, 180, 0 ;
 
-      ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ; 
+      ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ;
 
-      ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+      ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-      ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ; 
+      ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ;
 
     group: g7g1 {
 
@@ -374,7 +374,7 @@ netcdf in_grp {
           gds_var:coordinates = "lat_gds lon_gds" ;
 
       data:
-        gds_var = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ; 
+        gds_var = 273.1, 273.2, 273.3, 273.4, 273.5, 273.6, 273.7, 273.8 ;
 
     } // group /g7/g7g1
   } // group /g7
@@ -397,7 +397,7 @@ netcdf in_grp {
         int v6 ;
 
       data:
-        v6 = 63 ; 
+        v6 = 63 ;
 
       group: g9g1g1 {
         group: g9g1g1g1 {
@@ -424,13 +424,13 @@ netcdf in_grp {
                   int v7 ;
 
                 data:
-                  ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ; 
+                  ppc_big = 0.0123456789, 0.123456789, 1.23456789, 12.3456789, 123.456789, 1234.56789, 12345.6789, 123456.789, 1234567.89, 12345678.9 ;
 
-                  ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ; 
+                  ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
 
-                  ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ; 
+                  ppc_flt = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.1234568, 0.1234568 ;
 
-                  v7 = 73 ; 
+                  v7 = 73 ;
 
               } // group /g9/g9g1/g9g1g1/g9g1g1g1/g9g1g1g1g1/g9g1g1g1g1g1/g9g1g1g1g1g1g1
             } // group /g9/g9g1/g9g1g1/g9g1g1g1/g9g1g1g1g1/g9g1g1g1g1g1
@@ -468,7 +468,7 @@ netcdf in_grp {
       65, 66, 67, 68, 
       69, 70, 71, 72, 
       73, 74, 75, 76, 
-      77, 78, 79, 80 ; 
+      77, 78, 79, 80 ;
 
       two_dmn_rec_var = 
       1, 2, 3, 
@@ -480,7 +480,7 @@ netcdf in_grp {
       1, 2.6, 3, 
       1, 2.7, 3, 
       1, 2.8, 3, 
-      1, 2.9, 3 ; 
+      1, 2.9, 3 ;
 
   } // group /g10
   group: g11 {
@@ -541,39 +541,39 @@ netcdf in_grp {
         ushort_var:long_name = "ushort-type variable" ;
 
     data:
-      byte_var = 122 ; 
+      byte_var = 122 ;
 
-      char_var = "z" ; 
+      char_var = "z" ;
 
-      char_var_arr = "two words" ; 
+      char_var_arr = "two words" ;
 
-      double_var = 10 ; 
+      double_var = 10 ;
 
-      float_var = 10 ; 
+      float_var = 10 ;
 
-      int64_var = 9223372036854775807 ; 
+      int64_var = 9223372036854775807 ;
 
-      int_var = 10 ; 
+      int_var = 10 ;
 
-      long_var = 10 ; 
+      long_var = 10 ;
 
-      short_var = 10 ; 
+      short_var = 10 ;
 
-      string_arr = "Stanza 1", "Stanza 2" ; 
+      string_arr = "Stanza 1", "Stanza 2" ;
 
-      string_rec_arr = "One little ", "two little ", "three little indians, ", "four little ", "five little ", "six little indians, ", "seven little ", "eight little ", "nine little indians, ", "ten little indian boys." ; 
+      string_rec_arr = "One little ", "two little ", "three little indians, ", "four little ", "five little ", "six little indians, ", "seven little ", "eight little ", "nine little indians, ", "ten little indian boys." ;
 
-      string_var = "If you prick us, do we not bleed? If you tickle us, do we not laugh? If you poison us, do we not die? And if you wrong us, shall we not revenge?" ; 
+      string_var = "If you prick us, do we not bleed? If you tickle us, do we not laugh? If you poison us, do we not die? And if you wrong us, shall we not revenge?" ;
 
-      ubyte_var = 122 ; 
+      ubyte_var = 122 ;
 
-      uint64_var = 0 ; 
+      uint64_var = 0 ;
 
-      uint_arr = 4294967295, 4294967295 ; 
+      uint_arr = 4294967295, 4294967295 ;
 
-      uint_var = 0 ; 
+      uint_var = 0 ;
 
-      ushort_var = 65535 ; 
+      ushort_var = 65535 ;
 
   } // group /g11
   group: g12 {
diff --git a/conda.recipe/bld.bat b/conda.recipe/bld.bat
index e29197c..93f6c21 100644
--- a/conda.recipe/bld.bat
+++ b/conda.recipe/bld.bat
@@ -7,7 +7,7 @@ set "CXXFLAGS=%CXXFLAGS% -DWIN32 -DGSL_DLL"
 cmake -G "NMake Makefiles" ^
       -D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
       -D CMAKE_BUILD_TYPE=Release ^
-      -D NCO_MSVC_USE_MT=no ^
+      -D MSVC_USE_STATIC_CRT=OFF ^
       -D CMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
       -D NETCDF_INCLUDE=%LIBRARY_INC% ^
       -D NETCDF_LIBRARY=%LIBRARY_LIB%\netcdf.lib ^
diff --git a/config.h.in b/config.h.in
index 4ddb574..6589dfd 100644
--- a/config.h.in
+++ b/config.h.in
@@ -241,6 +241,9 @@
 /* Define to 1 if compiler finds external `nc_inq_path' function */
 #undef HAVE_NC_INQ_PATH
 
+/* Define to 1 if compiler finds external `nc_set_log_level' function */
+#undef HAVE_NC_SET_LOG_LEVEL
+
 /* Define to 1 if compiler finds external `nearbyint' function */
 #undef HAVE_NEARBYINT
 
@@ -517,6 +520,9 @@
 /* Define to 1 if compiler needs external `nc_inq_path' function */
 #undef NEED_NC_INQ_PATH
 
+/* Define to 1 if compiler needs external `nc_set_log_level' function */
+#undef NEED_NC_SET_LOG_LEVEL
+
 /* Define to 1 if compiler needs external `nearbyint' function */
 #undef NEED_NEARBYINT
 
diff --git a/configure b/configure
index eacbe0e..5f50048 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.7.2.
+# Generated by GNU Autoconf 2.69 for NCO netCDF Operators 4.7.3.
 #
 # 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.7.2'
-PACKAGE_STRING='NCO netCDF Operators 4.7.2'
+PACKAGE_VERSION='4.7.3'
+PACKAGE_STRING='NCO netCDF Operators 4.7.3'
 PACKAGE_BUGREPORT='nco-bugs at lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -666,8 +666,6 @@ LIBOBJS
 MAINT
 MAINTAINER_MODE_FALSE
 MAINTAINER_MODE_TRUE
-BUILD_YACC_SOURCE_FALSE
-BUILD_YACC_SOURCE_TRUE
 OTOOL64
 OTOOL
 LIPO
@@ -687,8 +685,6 @@ FGREP
 SED
 LIBTOOL
 LN_S
-YFLAGS
-YACC
 LEXLIB
 LEX_OUTPUT_ROOT
 LEX
@@ -844,8 +840,6 @@ CXXFLAGS
 CCC
 CPP
 CXXCPP
-YACC
-YFLAGS
 NETCDF_INC
 NETCDF_LIB
 NETCDF_ROOT
@@ -1394,7 +1388,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.7.2 to adapt to many kinds of systems.
+\`configure' configures NCO netCDF Operators 4.7.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1465,7 +1459,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of NCO netCDF Operators 4.7.2:";;
+     short | recursive ) echo "Configuration of NCO netCDF Operators 4.7.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1549,12 +1543,6 @@ Some influential environment variables:
   CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
   CXXCPP      C++ preprocessor
-  YACC        The `Yet Another Compiler Compiler' implementation to use.
-              Defaults to the first program found out of: `bison -y', `byacc',
-              `yacc'.
-  YFLAGS      The list of arguments that will be passed by default to $YACC.
-              This script will default YFLAGS to the empty string to avoid a
-              default value of `-d' given by some make applications.
   NETCDF_INC  Location of netCDF headers (compile-time)
   NETCDF_LIB  Location of netCDF library (compile-time)
   NETCDF_ROOT Root of netCDF4 installation (compile-time)
@@ -1633,7 +1621,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-NCO netCDF Operators configure 4.7.2
+NCO netCDF Operators configure 4.7.3
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2499,7 +2487,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.7.2, which was
+It was created by NCO netCDF Operators $as_me 4.7.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2847,7 +2835,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-#AC_INIT([NCO netCDF Operators],m4_esyscmd([git describe --abbrev=7 --dirty --always --tags | tr -d '\n']),[nco-bugs at lists.sourceforge.net],[nco])
 
 # Print GNU copyright in configure script
 
@@ -3755,7 +3742,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='nco'
- VERSION='4.7.2'
+ VERSION='4.7.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -6011,49 +5998,7 @@ fi
 if test "$LEX" = :; then
   LEX=${am_missing_run}flex
 fi
-for ac_prog in 'bison -y' byacc
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_YACC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$YACC"; then
-  ac_cv_prog_YACC="$YACC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_YACC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-YACC=$ac_cv_prog_YACC
-if test -n "$YACC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
-$as_echo "$YACC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$YACC" && break
-done
-test -n "$YACC" || YACC="yacc"
-
+# AC_PROG_YACC
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
 $as_echo_n "checking whether ln -s works... " >&6; }
@@ -16533,14 +16478,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 LIBTOOL="${LIBTOOL} --tag=CXX"
 #LIBTOOL="${LIBTOOL} --tag=ignore_tag_err"
 
- if test "${YACC}" != "yacc" || test -f "src/nco/ncap_yacc.c"; then
-  BUILD_YACC_SOURCE_TRUE=
-  BUILD_YACC_SOURCE_FALSE='#'
-else
-  BUILD_YACC_SOURCE_TRUE='#'
-  BUILD_YACC_SOURCE_FALSE=
-fi
-
+# AM_CONDITIONAL(BUILD_YACC_SOURCE,[test "${YACC}" != "yacc" || test -f "src/nco/ncap_yacc.c"])
 
 # Disable maintainer-only options in generated Makefiles unless flag
 # --enable-maintainer-mode is given at configure time
@@ -18454,6 +18392,20 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 fi
+ac_fn_c_check_func "$LINENO" "nc_set_log_level" "ac_cv_func_nc_set_log_level"
+if test "x$ac_cv_func_nc_set_log_level" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_NC_SET_LOG_LEVEL 1
+_ACEOF
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define NEED_NC_SET_LOG_LEVEL 1
+_ACEOF
+
+fi
 
 ac_fn_c_check_func "$LINENO" "getopt" "ac_cv_func_getopt"
 if test "x$ac_cv_func_getopt" = xyes; then :
@@ -21127,10 +21079,6 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${BUILD_YACC_SOURCE_TRUE}" && test -z "${BUILD_YACC_SOURCE_FALSE}"; then
-  as_fn_error $? "conditional \"BUILD_YACC_SOURCE\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
   as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -21548,7 +21496,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.7.2, which was
+This file was extended by NCO netCDF Operators $as_me 4.7.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21614,7 +21562,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.7.2
+NCO netCDF Operators config.status 4.7.3
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -23666,6 +23614,7 @@ echo "CXXFLAGS............. ${CXXFLAGS}"
 echo "ENABLE_DAP........... ${enable_dap}"
 echo "ENABLE_ESMF...........${enable_esmf}"
 echo "ENABLE_GSL........... ${enable_gsl}"
+echo "ENABLE_LOGGING....... ${enable_logging}"
 echo "ENABLE_NETCDF4....... ${enable_netcdf4}"
 echo "ENABLE_OPENMP........ ${enable_openmp}"
 echo "ENABLE_UDUNITS....... ${enable_udunits}"
diff --git a/configure.ac b/configure.ac
index 0344f97..3fe998f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,7 +42,7 @@
 # AC_CHECK_LIB Find libXXX.a, prepend -lXXX to LIBS, define HAVE_LIBXXX
 # AC_CHECK_PROG Find whether prg_nm is on ${PATH}, define ${flg} accordingly
 # AC_DEFINE Define token TKN to value VAL with comment CMNT in config.h
-# AC_DEFINE_UNQUOTED Define token TKN to value VAL with comment CMNT in config.h. Use then when TKN or VAL are shell variables.
+# AC_DEFINE_UNQUOTED Define token TKN to value VAL with comment CMNT in config.h. Use when TKN or VAL are shell variables.
 # AC_EGREP_HEADER Search CPP output of header.h (NB: CPP outputs C-code only), define ${flg} accordingly
 # AC_MSG_NOTICE Print MSG to output
 # AC_MSG_WARN Print MSG to output
@@ -54,8 +54,7 @@
 # 20170808: Choose between traditional version and Git-based version
 # If Git, consider that Linux dynamic libraries will have full messy name, MacOSX will not
 # https://stackoverflow.com/questions/43526939/how-to-insert-git-based-version-in-autoconf-managed-project
-AC_INIT([NCO netCDF Operators],[4.7.2],[nco-bugs at lists.sourceforge.net],[nco])
-#AC_INIT([NCO netCDF Operators],m4_esyscmd([git describe --abbrev=7 --dirty --always --tags | tr -d '\n']),[nco-bugs at lists.sourceforge.net],[nco])
+AC_INIT([NCO netCDF Operators],[4.7.3],[nco-bugs at lists.sourceforge.net],[nco])
 
 # Print GNU copyright in configure script
 AC_COPYRIGHT
@@ -179,7 +178,7 @@ AC_PROG_CPP
 AC_PROG_CXXCPP
 AC_PROG_CC_STDC
 AM_PROG_LEX
-AC_PROG_YACC
+# AC_PROG_YACC
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_LIBTOOL
@@ -188,7 +187,7 @@ AC_PROG_LIBTOOL
 LIBTOOL="${LIBTOOL} --tag=CXX"
 #LIBTOOL="${LIBTOOL} --tag=ignore_tag_err"
 
-AM_CONDITIONAL(BUILD_YACC_SOURCE,[test "${YACC}" != "yacc" || test -f "src/nco/ncap_yacc.c"])
+# AM_CONDITIONAL(BUILD_YACC_SOURCE,[test "${YACC}" != "yacc" || test -f "src/nco/ncap_yacc.c"])
 
 # Disable maintainer-only options in generated Makefiles unless flag
 # --enable-maintainer-mode is given at configure time
@@ -389,7 +388,7 @@ esac
 # "#define HAVE_XXX 1" and "#undef NEED_XXX" when function xxx() is found and
 # "#undef HAVE_XXX" and "#define NEED_XXX 1" when function xxx() is not found
 # Purpose: CPP macros like "if(NEED_XXX)" are simpler to read than "if(!HAVE_xxx)"
-NCO_CHECK_FUNCS([nc_inq_format nc_inq_path])
+NCO_CHECK_FUNCS([nc_inq_format nc_inq_path nc_set_log_level])
 NCO_CHECK_FUNCS([getopt getopt_long])
 NCO_CHECK_FUNCS([atan2])
 NCO_CHECK_FUNCS([acosf asinf atanf atan2f cosf expf fabsf fmodf log10f logf powf sinf sqrtf tanf])
@@ -1295,6 +1294,7 @@ echo "CXXFLAGS............. ${CXXFLAGS}"
 echo "ENABLE_DAP........... ${enable_dap}"
 echo "ENABLE_ESMF...........${enable_esmf}"
 echo "ENABLE_GSL........... ${enable_gsl}"
+echo "ENABLE_LOGGING....... ${enable_logging}"
 echo "ENABLE_NETCDF4....... ${enable_netcdf4}"
 echo "ENABLE_OPENMP........ ${enable_openmp}"
 echo "ENABLE_UDUNITS....... ${enable_udunits}"
diff --git a/configure.eg b/configure.eg
index 8a1f4a8..2621ef0 100644
--- a/configure.eg
+++ b/configure.eg
@@ -230,16 +230,17 @@ Start LINUX
 Status: Works
 Commands for LINUX are the only ones "regularly" used after ~2010
 ************************************************************************
-# Post upgrade requests to sysadmins at ALCF, LCRC, NCAR, NCSA, NERSC, OLCF
+# Post upgrade requests to sysadmins at ALCF, LCRC, LLNL, NCAR, NCSA, NERSC, OLCF
 # support at alcf.anl.gov # ALCF Maintainer = 
 # conda update nco # Anaconda Maintainer = Filipe Fernandes (github: ocefpaf)
 # support at lcrc.anl.gov # LCRC Maintainer = Adam
+# Tony Hoang <hoang1 at llnl.gov> # LLNL
 # cislhelp at ucar.edu # NCAR
 # Yan Liu <yanliu at illinois.edu> # NCSA Maintainer = Yan Liu (github: yanliu-chn)
 # https://nersc.service-now.com/navpage.do # NERSC Maintainer = Yun (Helen) He
 # https://www.olcf.ornl.gov/support/submit-ticket # OLCF
-# Subject: Please upgrade NCO module to 4.6.9
-# Request: NCO 4.6.9 was released 9/18 and contains many features of interest to your ACME users. Please upgrade the system NCO module to 4.6.9 and make that the default NCO module. Thanks!
+# Subject: Please upgrade NCO module to 4.7.3
+# Request: NCO 4.7.3 was released 9/18 and contains many features of interest to your ACME users. Please upgrade the system NCO module to 4.7.3 and make that the default NCO module. Thanks!
 
 zender at dust:~/nco$ pvmgetarch;uname -a;~/nco/autobld/config.guess
 LINUX
@@ -272,16 +273,19 @@ scp nco.configure.${GNU_TRP}.foo nco.config.log.${GNU_TRP}.foo nco.libtool.${GNU
 # Generic when netCDF is in /usr (Ubuntu glace, Fedora skyglow)
 export GNU_TRP=`~/nco/autobld/config.guess`
 cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
-cd ~/nco/cmake
-cmake .. -DCMAKE_INSTALL_PREFIX=${HOME}
+cd ~/nco;cmake/clean.sh
+cd ~/nco/cmake;cmake .. -DCMAKE_INSTALL_PREFIX=${HOME}
 make install
 
 # clang Zender uses this to develop/install/update netCDF4-enabled NCO in personal directories with CMake:
 # Generic when netCDF is in ~/anaconda (MacOS katabatic)
 export GNU_TRP=`~/nco/autobld/config.guess`
 cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
-cd ~/nco/cmake
-cmake .. -DCMAKE_INSTALL_PREFIX=${HOME} -DNETCDF_INCLUDE:PATH=${NETCDF_INC} -DNETCDF_LIBRARY:FILE=${NETCDF_LIB}/libnetcdf.a -DHDF5_LIBRARY:FILE=${NETCDF_LIB}/libhdf5.a -DHDF5_HL_LIBRARY:FILE=${NETCDF_LIB}/libhdf5.a
+unset NETCDF_ROOT
+export NETCDF_INC='/usr/local/opt/netcdf/include'
+export NETCDF_LIB='/usr/local/opt/netcdf/lib'
+cd ~/nco;cmake/clean.sh
+cd ~/nco/cmake;cmake .. -DCMAKE_INSTALL_PREFIX=${HOME} -DNETCDF_INCLUDE:PATH=${NETCDF_INC} -DNETCDF_LIBRARY:FILE=${NETCDF_LIB}/libnetcdf.a -DHDF5_LIBRARY:FILE=${NETCDF_LIB}/libhdf5.a -DHDF5_HL_LIBRARY:FILE=${NETCDF_LIB}/libhdf5.a
 make install
 
 # gcc/g++ Zender uses this to develop/install/update netCDF4-enabled NCO in system directories with CMake:
@@ -380,7 +384,7 @@ scp nco.configure.${GNU_TRP}.foo nco.config.log.${GNU_TRP}.foo nco.libtool.${GNU
 # gcc/g++ Zender uses this to develop/install/update netCDF4-enabled NCO in personal directories on cori:
 # Sysadmin upgrade request: https://nersc.service-now.com/navpage.do
 # Latest sysadmin-compiled module usage: module load nco/4.6.7 # 20170612 (without ncap2)
-# Personal recipe last modified: 20170411
+# Personal recipe last modified: 20180125
 # Personal recipe last used successfully: 20171221
 module load szip
 module load gsl
@@ -388,7 +392,7 @@ module load udunits
 module load cray-netcdf
 export GNU_TRP=`~/nco/autobld/config.guess`
 cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
-ANTLR_ROOT=${HOME} ANTLR_LIB=${HOME}/lib_cori CC='icc' CXX='icpc' GSL_ROOT='/usr/common/software/gsl/2.1/intel' NETCDF_INC='/opt/cray/pe/netcdf/4.4.0/INTEL/15.0/include' NETCDF_LIB='/opt/cray/pe/netcdf/4.4.0/INTEL/15.0/lib' NETCDF_ROOT='/opt/cray/pe/netcdf/4.4.0' UDUNITS2_PATH='/usr/common/software/udunits/2.2.19/hsw/intel' ./configure --prefix=${HOME} --bindir=${HOME}/bin_cori --datadir=${HOME}/nco/data --libdir=${HOME}/lib_cori --mandir=${HOME}/man > nco.configure.${GNU_TRP}.foo 2>&1
+ANTLR_ROOT=${HOME} ANTLR_LIB=${HOME}/lib_cori CC='icc' CXX='icpc' GSL_ROOT='/usr/common/software/gsl/2.1/intel' NETCDF_INC='/opt/cray/pe/netcdf/4.4.1.1.3/INTEL/16.0/include' NETCDF_LIB='/opt/cray/pe/netcdf/4.4.1.1.3/INTEL/16.0/lib' NETCDF_ROOT='/opt/cray/pe/netcdf/4.4.1.1.3' UDUNITS2_PATH='/usr/common/software/udunits/2.2.19/hsw/intel' ./configure --prefix=${HOME} --bindir=${HOME}/bin_cori --datadir=${HOME}/nco/data --libdir=${HOME}/lib_cori --mandir=${HOME}/man > nco.configure.${GNU_TRP [...]
 /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
@@ -474,6 +478,8 @@ scp nco.configure.${GNU_TRP}.foo nco.config.log.${GNU_TRP}.foo nco.libtool.${GNU
 # Personal recipe last modified: 20180124
 # Problem is that .bashrc resets PATH so cannot find icc/gcc ...
 # Personal recipe last used successfully: fxm
+# module use /projects/ClimateEnergy_2/software/modulefiles/all
+# module load e3sm-unified/1.1.2-py2-x
 export GNU_TRP=`~/nco/autobld/config.guess`
 cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
 module load cray-netcdf
@@ -742,7 +748,7 @@ 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:Sites/nco/rgr
 
-# gcc/g++ Zender uses this to debug NCO with custom-install netCDF (and ESMF) binaries in /usr/local (givre, roulee, grele, skyglow)
+# gcc/g++ Zender uses this to debug NCO with custom-install netCDF (and ESMF) binaries in /usr/local (givre, roulee, grele)
 export GNU_TRP=`~/nco/autobld/config.guess`
 cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
 CC='gcc' CXX='g++' NETCDF_INC='/usr/local/include' NETCDF_LIB='/usr/local/lib' ./configure --enable-debug-custom --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
@@ -779,18 +785,6 @@ 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:Sites/nco/rgr
 
-# gcc/g++ Zender uses this to debug NCO with pre-built netCDF (and ESMF) binaries in /opt/local (this works on MACOSX with MacPorts, e.g., aerosol, firn)
-export GNU_TRP=`~/nco/autobld/config.guess`
-cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
-CC='gcc' CFLAGS='' CXX='g++' CXXFLAGS='' ESMF_INC='/opt/local/include' ESMF_LIB='/opt/local/lib/gcc49' ./configure --enable-debug-custom --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
-CC='gcc' CFLAGS='' CXX='g++' CXXFLAGS='' ESMF_INC='/opt/local/include' ESMF_LIB='/opt/local/lib' ./configure --enable-debug-custom --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:Sites/nco/rgr
-
 # g++/g++ Zender uses this to compile NCO with _g++_ (not recommended for normal use)
 export GNU_TRP=`~/nco/autobld/config.guess`
 cd ~/nco;/bin/rm -f *.${GNU_TRP}.foo;make distclean
diff --git a/data/Makefile.in b/data/Makefile.in
index 0fe30f4..10dc0a5 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -245,8 +245,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/data/buggy.cdl b/data/buggy.cdl
index 1d2173c..69b872d 100644
--- a/data/buggy.cdl
+++ b/data/buggy.cdl
@@ -82,6 +82,14 @@ netcdf buggy {
  nan_val_dbl:note6 = "It is too troublesome to distribute in.cdl with references to NaNs because users always build with old netCDF versions that do not support it. So just comment out nan's for now.";
  nan_val_dbl:note7 = "20170505 For testing without missing values"; 
 
+ int tm3_lat_flt(tm3,lat);
+ tm3_lat_flt:purpose = "record variable compressed with netCDF 4.6.0 _Filter attribute"; 
+ tm3_lat_flt:bug = "ncgen until 4.6.0 20180125 fails to parse this. Furthermore, ncgen will only parse this correctly if the bzip2 filter is installed as per instructions below. Variables compressed with _Filters must be chunked, so we make this a record variable. More instructions at https://www.unidata.ucar.edu/software/netcdf/docs/md__Users_wfisher_Desktop_gitprojects_netcdf-c_docs_filters.html";
+ tm3_lat_flt:usage="export HDF5_PLUGIN_PATH=/usr/local/lib";
+ tm3_lat_flt:_Filter = "307,9";
+ tm3_lat_flt:_Storage = "chunked";
+ tm3_lat_flt:_ChunkSizes = 3,2;
+ 
  int lat_time(lat,time);
  lat_time:purpose = "record variable where record dimension is not first dimension"; 
  lat_time:bug = "ncgen until 4.3.3-rc2 20140922 fails to parse this because of Jira NCF-315. Some variables with non-leading record dimensions (like lat_tm2, lat_tm3) did work before today in \"standalone\" files like buggy.cdl, but lat_time did not.";
@@ -114,6 +122,8 @@ netcdf buggy {
   tm2_lat=1,2,3,4; // NB: Braces forbidden when unlimited dimension is first. sizeof(tm2)=sizeof(whole)/$lat
   tm3_lat=1,2,3,4,5,6; // NB: Braces forbidden when unlimited dimension is first. sizeof(tm2)=sizeof(whole)/$lat
 
+  tm3_lat_flt=1,2,3,4,5,6;
+
   tm2_tm3={1.,2.,3.},{4.,5.,6.};
 
   string_var2="20131121: This NC_STRING contains NCO's default XML string separator, *. And it contains multiple sequential copies of that separator, ***. Be sure ncks automatically switches to a different separator, aka the backup separator, the string obtained by removing the two spaces from this:\"* | *\". As of 20131121, ncks handles this correctly, yet toolsui breaks when trying to input the ncks-generated NcML. Appears to be a toolsui bug.";
diff --git a/data/ncclimo b/data/ncclimo
index c070d81..159d8ad 100755
--- a/data/ncclimo
+++ b/data/ncclimo
@@ -50,6 +50,8 @@
 
 # Set script name, directory, PID, run directory
 drc_pwd=${PWD}
+# Security: Explicitly unset IFS before wordsplitting, so Bash uses default IFS=<space><tab><newline>
+unset IFS
 # Set these before 'module' command which can overwrite ${BASH_SOURCE[0]}
 # NB: dash supports $0 syntax, not ${BASH_SOURCE[0]} syntax
 # http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
@@ -81,7 +83,6 @@ if [ -z "${DATA}" ]; then
 	*cheyenne* ) DATA="/glade/p/work/${USER}" ; ;; # NCAR cheyenne compute nodes named, e.g., r8i0n8, r5i3n16, r12i5n29 ... 18|(64/128) cores|GB/node (cheyenne login nodes 256 GB)
 	cooley* | cc[0123456789][0123456789][0123456789] | mira* ) DATA="/projects/HiRes_EarthSys_2/${USER}" ; ;; # ALCF cooley compute nodes named ccNNN, 384 GB/node 
 	cori* | edison* ) DATA="${SCRATCH}" ; ;; # NERSC cori/edison compute nodes all named nidNNNNN, edison 24|64 cores|GB/node; cori 32|(96/128) cores|GB/node (knl/haswell) (cori login nodes 512 GB)
-	pileus* ) DATA="/lustre/atlas/world-shared/cli115/${USER}" ; ;; # OLCF CADES
 	rhea* | titan* ) DATA="/lustre/atlas/world-shared/cli115/${USER}" ; ;; # OLCF rhea compute nodes named rheaNNN, 128 GB/node
 	theta* ) DATA="/projects/ClimateEnergy_2/${USER}" ; ;; # ALCF theta compute nodes named fxm, 64|192 cores|GB/node 
 	* ) DATA='/tmp' ; ;; # Other
@@ -155,9 +156,6 @@ if [ "${hrd_pth}" != 'No' ] && [ "${NCO_PATH_OVERRIDE}" != 'No' ]; then
 	    fi # !NCARG_ROOT
 	    export PATH='/global/homes/z/zender/bin_edison'\:${PATH}
             export LD_LIBRARY_PATH='/global/homes/z/zender/lib_edison'\:${LD_LIBRARY_PATH} ; ;;
-	pileus* )
-	    export PATH='/home/zender/bin'\:${PATH}
-	    export LD_LIBRARY_PATH='/opt/ACME/uvcdat-2.2-build/install/Externals/lib:/home/zender/lib'\:${LD_LIBRARY_PATH} ; ;;
 	rhea* )
 	    # 20151017: CSZ next three lines guarantee finding mpirun
 	    source ${MODULESHOME}/init/sh # 20150607: PMC Ensures find module commands will be found
@@ -210,6 +208,7 @@ fi # !hrd_pth && !NCO_PATH_OVERRIDE
 # Annual climo testing:
 # ncclimo -C ann -m cism -h h -c b.e10.BG20TRCN.f09_g16.002 -s 1851 -e 2006 -i /lustre/atlas1/cli115/proj-shared/4ue/data/for_charlie -o ${DATA}/ne30/clm
 # ncclimo -C ann -m cism -h h -c b.e10.BG20TRCN.f09_g16.002 -s 1851 -e 1852 -i /lustre/atlas1/cli115/proj-shared/4ue/data/for_charlie -o ${DATA}/ne30/clm > ~/ncclimo.out 2>&1 &
+# ncclimo -C ann -m mpas -s 1851 -e 1852 -i ${DATA}/hdf/mpasLIoutput.nc -o ${DATA}/mpas/clm > ~/ncclimo.out 2>&1 &
 
 # Debugging and Benchmarking:
 # ncclimo -v FSNT,AODVIS,TREFHT -c famipc5_ne30_v0.3_00003 -s 1980 -e 1983 -i ${DATA}/ne30/raw -o ${DATA}/ne30/clm -r ${DATA}/maps/map_ne30np4_to_fv129x256_aave.20150901.nc
@@ -306,7 +305,7 @@ fi # !hrd_pth && !NCO_PATH_OVERRIDE
 #              echo "ncclimo -d 1 -p mpi -c b1850c5_m2a -s 55 -e 58 -i /home/taylorm/scratch1.qtang/b1850c5_m2a/run -o ${DATA}/ne120/clm" >> ~/ncclimo.cobalt;chmod a+x ~/ncclimo.cobalt
 #   Cori,Edison a): echo '#!/bin/bash' > ~/ncclimo.slurm
 #                   echo "ncclimo -a scd -d 1 -p mpi -c famipc5_ne30_v0.3_00003 -s 1980 -e 1983 -i ${DATA}/ne30/raw -o ${DATA}/ne30/clm -r ${DATA}/maps/map_ne30np4_to_fv129x256_aave.20150901.nc" >> ~/ncclimo.slurm;chmod a+x ~/ncclimo.slurm
-#   Rhea a):   echo "ncclimo -a scd -d 1 -p mpi -c famipc5_ne120_v0.3_00003 -s 1980 -e 1983 -i /lustre/atlas1/cli115/world-shared/mbranst/famipc5_ne120_v0.3_00003-wget-test -o ${DATA}/ne120/clm -r ${DATA}/maps/map_ne120np4_to_fv257x512_aave.20150901.nc"  > ~/ncclimo.pbs;chmod a+x ~/ncclimo.pbs
+#   Rhea a):   echo "ncclimo -a scd -d 1 -p mpi -c famipc5_ne120_v0.3_00003 -s 1980 -e 1983 -i /lustre/atlas1/cli115/world-shared/mbranst/famipc5_ne120_v0.3_00003-wget-test -o ${DATA}/ne120/clm -r ${DATA}/maps/map_ne120np4_to_fv257x512_aave.20150901.nc" > ~/ncclimo.pbs;chmod a+x ~/ncclimo.pbs
 #   Blues b):  qsub -A ACME -q acme -l nodes=1 -l walltime=00:30:00 -N ncclimo -j oe -m e -o ~/ncclimo.out ~/ncclimo.pbs
 #   Cheyenne b): qsub -A SCSG0002 -l select=12:ncpus=36:mpiprocs=1 -l walltime=00:30:00 -q regular -N ncclimo -j oe -m e -o ~/ncclimo.out ~/ncclimo.pbs
 #   Cooley b): qsub -A HiRes_EarthSys --nodecount=12 --time=00:30:00 --jobname ncclimo --error ~/ncclimo.err --output ~/ncclimo.out --notify zender at uci.edu ~/ncclimo.cobalt
@@ -314,6 +313,7 @@ fi # !hrd_pth && !NCO_PATH_OVERRIDE
 #   Edison b): sbatch -A acme --nodes=12 --time=00:30:00 --partition=debug --job-name=ncclimo --mail-type=END --output=${HOME}/ncclimo.out ~/ncclimo.slurm
 #   Hopper b): qsub -A acme -V -l mppwidth=288 -l walltime=00:30:00 -q regular -N ncclimo -j oe -m e -o ~/ncclimo.out ~/ncclimo.pbs
 #   Rhea b):   qsub -A CLI115 -V -l nodes=12 -l walltime=00:30:00 -N ncclimo -j oe -m e -o ~/ncclimo.out ~/ncclimo.pbs
+# NB: stdout/stderr files returned from batch jobs are read-protected, need 'chmod 644 ~/ncclimo.out' afterwards
 
 # Normal use: Set five "mandatory" inputs (caseid, yr_srt, yr_end, drc_in, drc_out), and possibly rgr_map, on command line
 # caseid:  Simulation name (filenames must start with ${caseid})
@@ -458,11 +458,12 @@ inp_std='No' # [sng] Input file list from stdin
 job_nbr=2 # [nbr] Job simultaneity for parallelism
 lnk_flg='Yes' # [sng] Link E3SM/ACME-climo to AMWG-climo filenames
 mdl_nm='cam' # [sng] Model name (e.g., 'cam', 'cam2', 'cice', 'cism', 'clm', 'clm2', 'ice', 'mpascice', 'mpaso', 'ocn')
-mdl_typ='cesm' # [sng] Model type ('cesm', 'mpas') (for filenames and regridding)
+mdl_typ='cesm' # [sng] Model type ('cesm', 'mpas') (for regridding)
 mpi_flg='No' # [sng] Parallelize over nodes
 nco_opt='--no_tmp_fl' # [sng] NCO options (e.g., '-7 -D 1 -L 1')
 ncr_flg='No' # [sng] Incremental method
 nd_nbr=1 # [nbr] Number of nodes
+nm_typ='cesm' # [sng] Name type ('cesm', 'mpas', 'yyyymm', 'yyyy-mm', 'yyyy-mm-01') (for filenames)
 no_ntv_tms='No' # [flg] Omit native-grid split timeseries
 par_opt='' # [sng] Parallel options to shell
 par_typ='bck' # [sng] Parallelism type
@@ -863,27 +864,35 @@ let yr_nbr=${yr_end_rth}-${yr_srt_rth}+1
 out_nm=${caseid}
 if [ "${caseid}" = 'hist' ] || [ "${mdl_nm}" = 'mpaso' ] || [ "${mdl_nm}" = 'mpascice' ]; then
     mdl_typ='mpas'
+    nm_typ='mpas'
 fi # !caseid
 if [ "${mdl_typ}" = 'mpas' ]; then
     out_nm="${mdl_nm}"
     hst_nm='hist'
 fi # !mdl_typ
-if [ -n "${fml_nm_usr}" ]; then 
-    fml_nm="${fml_nm_usr}"
-    out_nm="${fml_nm}"
-fi # !fml_nm
 # http://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash
 # http://stackoverflow.com/questions/17420994/bash-regex-match-string
+# Order and 'elif' ensures name matches only fullest rx
 if [[ "${caseid}" =~ ^(.*)([0-9][0-9][0-9][0-9][01][0-9].nc.?)$ ]]; then
-    mdl_typ='yyyymm'
+    nm_typ='yyyymm'
+elif [[ "${caseid}" =~ ^(.*)([0-9][0-9][0-9][0-9]-[01][0-9]-01.nc.?)$ ]]; then
+    nm_typ='yyyy-mm-01'
+elif [[ "${caseid}" =~ ^(.*)([0-9][0-9][0-9][0-9]-[01][0-9].nc.?)$ ]]; then
+    nm_typ='yyyy-mm'
+fi # !caseid
+if [ "${nm_typ}" = 'yyyymm' ] || [ "${nm_typ}" = 'yyyy-mm-01' ] || [ "${nm_typ}" = 'yyyy-mm' ]; then
     bs_nm="${BASH_REMATCH[1]}"
     bs_nm="$(basename ${bs_nm})"
     bs_nm="${bs_nm%.*}"
     bs_nm="${bs_nm%_*}"
     out_nm=${bs_nm}
-    bs_sfx="${caseid#*.}"
-fi # !caseid
-if [ "${clm_md}" != 'ann' ] && [ "${clm_md}" != 'dly' ] && [ "${clm_md}" != 'mth' ] ; then 
+    bs_sfx="${caseid##*.}"
+fi # !nm_typ
+if [ -n "${fml_nm_usr}" ]; then 
+    fml_nm="${fml_nm_usr}"
+    out_nm="${fml_nm}"
+fi # !fml_nm
+if [ "${clm_md}" != 'ann' ] && [ "${clm_md}" != 'dly' ] && [ "${clm_md}" != 'mth' ]; then 
     echo "${spt_nm}: ERROR User-defined climatology mode is ${clm_md}. Valid options are 'ann', 'dly', or 'mth' (default)"
     exit 1
 fi # !clm_md
@@ -1376,6 +1385,8 @@ fi # !mpi
 # Print initial state
 if [ ${dbg_lvl} -ge 2 ]; then
     printf "dbg: bnr_flg  = ${bnr_flg}\n"
+    printf "dbg: bs_nm    = ${bs_nm}\n"
+    printf "dbg: bs_sfx   = ${bs_sfx}\n"
     printf "dbg: caseid   = ${caseid}\n"
     printf "dbg: cf_flg   = ${cf_flg}\n"
     printf "dbg: clm_flg  = ${clm_flg}\n"
@@ -1414,6 +1425,7 @@ if [ ${dbg_lvl} -ge 2 ]; then
     printf "dbg: nco_opt  = ${nco_opt}\n"
     printf "dbg: ncr_flg  = ${ncr_flg}\n"
     printf "dbg: nd_nbr   = ${nd_nbr}\n"
+    printf "dbg: nm_typ   = ${nm_typ}\n"
     printf "dbg: out_nm   = ${out_nm}\n"
     printf "dbg: par_typ  = ${par_typ}\n"
     printf "dbg: ppc_prc  = ${ppc_prc}\n"
@@ -1525,13 +1537,17 @@ if [ "${clm_flg}" = 'Yes' ]; then
     if [ "${bnr_flg}" = 'No' ]; then
 	printf "Climatology from ${yr_nbr} years of contiguous raw data touching ${yr_cln} calendar years from YYYYMM = ${yyyy_clm_srt_dec}${mm_ann_srt} to ${yyyy_end}${mm_ann_end}\n"
     fi # !bnr_flg
-    if [ "${mdl_typ}" = 'yyyymm' ]; then
+    if [ "${nm_typ}" = 'yyyymm' ]; then
 	printf "Filenames will be constructed with generic conventions as ${bs_nm}_YYYYMM.${bs_sfx}\n"
+    elif [ "${nm_typ}" = 'yyyy-mm' ]; then
+	printf "Filenames will be constructed with generic conventions as ${bs_nm}.YYYY-MM.${bs_sfx}\n"
+    elif [ "${nm_typ}" = 'yyyy-mm-01' ]; then
+	printf "Filenames will be constructed with generic conventions as ${bs_nm}.YYYY-MM-01.${bs_sfx}\n"
     elif [ ${inp_aut} = 'Yes' ]; then 
 	printf "Input filenames will be constructed with CESM'ish or E3SM/ACME'ish conventions\n"
-    else # !mdl_typ
+    else # !nm_typ
 	printf "Input filenames will be read from globbing, positional arguments, or stdin\n"
-    fi # !mdl_typ
+    fi # !nm_typ
     if [ ${clm_md} = 'ann' ]; then 
 	printf "Each input file assumed to contain mean of one year\n"
     elif [ ${clm_md} = 'dly' ]; then 
@@ -1571,27 +1587,35 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ]; then
 	fl_all=''
 	for yr in `seq ${yyyy_srt} ${yyyy_end}`; do
 	    YYYY=`printf "%04d" ${yr}`
-	    if [ ${mdl_typ} = 'cesm' ]; then
+	    if [ ${nm_typ} = 'cesm' ]; then
 		fl_all="${fl_all} ${caseid}.${mdl_nm}.${hst_nm}.${YYYY}-${MM}.nc"
-	    elif [ ${mdl_typ} = 'mpas' ]; then # Use MPAS not CESM conventions
+	    elif [ ${nm_typ} = 'mpas' ]; then # Use MPAS not CESM conventions
 		# 20161130: Old MPAS rule until today
 		# fl_all="${fl_all} ${caseid}.${mdl_nm}.${YYYY}-${MM}-01_00.00.00.nc"
 		# Example file: /scratch2/scratchdirs/golaz/ACME_simulations/20161117.beta0.A_WCYCL1850S.ne30_oEC_ICG.edison/run/mpascice.hist.am.timeSeriesStatsMonthly.0001-02-01.nc
  		fl_all="${fl_all} ${mdl_nm}.hist.am.timeSeriesStatsMonthly.${YYYY}-${MM}-01.nc"
-	    elif [ ${mdl_typ} = 'yyyymm' ]; then # Generate from caseid + YYYYMM
+	    elif [ ${nm_typ} = 'yyyymm' ]; then # Generate from caseid + YYYYMM
 		fl_all="${fl_all} ${bs_nm}_${YYYY}${MM}.${bs_sfx}"
+	    elif [ ${nm_typ} = 'yyyy-mm' ]; then # Generate from caseid + YYYY-MM
+		fl_all="${fl_all} ${bs_nm}.${YYYY}-${MM}.${bs_sfx}"
+	    elif [ ${nm_typ} = 'yyyy-mm-01' ]; then # Generate from caseid + YYYY-MM-01
+		fl_all="${fl_all} ${bs_nm}.${YYYY}-${MM}-01.${bs_sfx}"
 	    fi # !cesm
 	done # !yr
 	if [ ${dec_md} = 'scd' ] && [ ${MM} = '12' ]; then 
 	    fl_all=''
 	    for yr in `seq ${yr_srtm1} ${yr_endm1}`; do
 		YYYY=`printf "%04d" ${yr}`
-		if [ ${mdl_typ} = 'cesm' ]; then
+		if [ ${nm_typ} = 'cesm' ]; then
 		    fl_all="${fl_all} ${caseid}.${mdl_nm}.${hst_nm}.${YYYY}-${MM}.nc"
-		elif [ ${mdl_typ} = 'mpas' ]; then # Use MPAS not CESM conventions
+		elif [ ${nm_typ} = 'mpas' ]; then # Use MPAS not CESM conventions
  		    fl_all="${fl_all} ${mdl_nm}.hist.am.timeSeriesStatsMonthly.${YYYY}-${MM}-01.nc"
-		elif [ ${mdl_typ} = 'yyyymm' ]; then # Generate from caseid + YYYYMM
+		elif [ ${nm_typ} = 'yyyymm' ]; then # Generate from caseid + YYYYMM
 		    fl_all="${fl_all} ${bs_nm}_${YYYY}${MM}.${bs_sfx}"
+		elif [ ${nm_typ} = 'yyyy-mm' ]; then # Generate from caseid + YYYY-MM
+		    fl_all="${fl_all} ${bs_nm}.${YYYY}-${MM}.${bs_sfx}"
+		elif [ ${nm_typ} = 'yyyy-mm-01' ]; then # Generate from caseid + YYYY-MM-01
+		    fl_all="${fl_all} ${bs_nm}.${YYYY}-${MM}-01.${bs_sfx}"
 		fi # !cesm
 	    done # !yr
 	    yyyy_clm_srt=${yyyy_clm_srt_dec}
@@ -2169,6 +2193,7 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
     
     # Block 1 Loop 2: Execute and/or echo monthly climatology commands
     printf "Generating climatology...\n"
+    [[ ${dbg_lvl} -ge 1 ]] && date_clm=$(date +"%s")
     for ((clm_idx=1;clm_idx<=12;clm_idx++)); do
 	printf "Climatological monthly mean for month ${clm_idx} ...\n"
 	if [ ${dbg_lvl} -ge 1 ]; then
@@ -2203,12 +2228,16 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
 	    fi # !err
 	done # !clm_idx
     fi # !par_opt
-    # fxm: 20170809 what does this next line wait for? superfluous?
-    wait
+    if [ ${dbg_lvl} -ge 1 ]; then
+	date_crr=$(date +"%s")
+	date_dff=$((date_crr-date_clm))
+	echo "Elapsed time to generate monthly climos $((date_dff/60))m$((date_dff % 60))s"
+    fi # !dbg
     
     # Block 1: Loop 4: Regrid first twelve files. Load-balance by using idle nodes (nodes not used for seasonal climatologies).
     if [ -n "${rgr_map}" ]; then 
 	printf "Regrid monthly data...\n"
+	[[ ${dbg_lvl} -ge 1 ]] && date_rgr=$(date +"%s")
 	for ((clm_idx=1;clm_idx<=12;clm_idx++)); do
 	    # NB: Months, seasons, files are 1-based ([1..12], [13..16], [1..17]), nodes are 0-based ([0..11])
 	    let nd_idx=$(((clm_idx-1+csn_nbr) % nd_nbr))
@@ -2241,6 +2270,7 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
     # Block 2: Climatological seasonal means
     if [ "${csn_flg}" = 'Yes' ]; then
 	# Block 2 Loop 1: Generate seasonal commands
+	[[ ${dbg_lvl} -ge 1 ]] && date_clm=$(date +"%s")
 	for ((csn_idx=0;csn_idx<${csn_nbr};csn_idx++)); do
 	    printf "Climatological seasonal mean for ${csn_abb[${map_r2d[${csn_idx}]}]} ...\n"
 	    let clm_idx=1+12+${csn_idx}
@@ -2289,6 +2319,11 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
 		fi # !err
 	    done # !clm_idx
 	fi # !par_opt
+	if [ ${dbg_lvl} -ge 1 ]; then
+	    date_crr=$(date +"%s")
+	    date_dff=$((date_crr-date_rgr))
+	    echo "Elapsed time to regrid monthly climos $((date_dff/60))m$((date_dff % 60))s"
+	fi # !dbg
     fi # !rgr_map
     # wait() for seasonal climatologies to finish
     if [ "${csn_flg}" = 'Yes' ]; then
@@ -2301,14 +2336,18 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
 		fi # !err
 	    done # !clm_idx
 	fi # !par_opt
+	if [ ${dbg_lvl} -ge 1 ]; then
+	    date_crr=$(date +"%s")
+	    date_dff=$((date_crr-date_clm))
+	    echo "Elapsed time to generate seasonal climos $((date_dff/60))m$((date_dff % 60))s"
+	fi # !dbg
     fi # !csn_flg
-    # fxm: 20170809 what does this next line wait for? superfluous?
-    wait
     
     # Block 2: Loop 4: Regrid seasonal files. Load-balance by using idle nodes (nodes not used for annual mean).
     if [ "${csn_flg}" = 'Yes' ]; then
 	if [ -n "${rgr_map}" ]; then 
 	    printf "Regrid seasonal data...\n"
+	    [[ ${dbg_lvl} -ge 1 ]] && date_rgr=$(date +"%s")
 	    for ((clm_idx=${clm_csn_srt_idx};clm_idx<=${clm_csn_end_idx};clm_idx++)); do
 		let nd_idx=$(((clm_idx-1+csn_nbr) % nd_nbr))
 		if [ ${nd_idx} -lt ${csn_nbr} ]; then
@@ -2341,6 +2380,7 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
     # Block 3: Climatological annual mean
     if [ "${ann_flg}" = 'Yes' ]; then
 	printf "Climatological annual mean...\n"
+	[[ ${dbg_lvl} -ge 1 ]] && date_clm=$(date +"%s")
 	fl_lst="${fl_out[${clm_csn_mam_idx}]} ${fl_out[${clm_csn_jja_idx}]} ${fl_out[${clm_csn_son_idx}]} ${fl_out[${clm_csn_djf_idx}]}"
 	cmd_clm[${clm_nbr}]="${cmd_mpi[${clm_nbr}]} ncra --c2b -O -w 92,92,91,90 ${nco_opt} ${gaa_sng} ${fl_lst} ${fl_out[${clm_nbr}]}"
 	#    cmd_clm[17]="${cmd_mpi[17]} ncra --c2b -O -w 92,92,91,90 ${nco_opt} ${gaa_sng} ${fl_out[13]} ${fl_out[14]} ${fl_out[15]} ${fl_out[16]} ${fl_out[17]}"
@@ -2372,6 +2412,11 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
 		    fi # !err
 		done # !clm_idx
 	    fi # !par_opt
+	    if [ ${dbg_lvl} -ge 1 ]; then
+		date_crr=$(date +"%s")
+		date_dff=$((date_crr-date_rgr))
+		echo "Elapsed time to regrid seasonal climos $((date_dff/60))m$((date_dff % 60))s"
+	    fi # !dbg
 	fi # !rgr_map
     fi # !csn_flg
     if [ "${ann_flg}" = 'Yes' ]; then
@@ -2384,10 +2429,16 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
 		exit 1
 	    fi # !err
 	fi # !par_opt
+	if [ ${dbg_lvl} -ge 1 ]; then
+	    date_crr=$(date +"%s")
+	    date_dff=$((date_crr-date_clm))
+	    echo "Elapsed time to generate annual climos $((date_dff/60))m$((date_dff % 60))s"
+	fi # !dbg
 	
 	# Block 5: Regrid climatological annual mean
 	if [ -n "${rgr_map}" ]; then 
 	    printf "Regrid annual data...\n"
+	    [[ ${dbg_lvl} -ge 1 ]] && date_rgr=$(date +"%s")
 	    cmd_rgr[${clm_idx}]="${cmd_mpi[${clm_idx}]} ncks -t ${thr_nbr} -O ${nco_opt} ${rgr_opt} ${fl_out[${clm_idx}]} ${fl_rgr[${clm_idx}]}"
 	    if [ "${mdl_typ}" = 'mpas' ]; then
 		cmd_rgr[${clm_idx}]="${cmd_mpi[${clm_idx}]} ncremap -C -u .pid${spt_pid}.climo.${clm_idx}.tmp -P mpas -t ${thr_nbr} -m ${rgr_map} -i ${fl_out[${clm_idx}]} -o ${fl_rgr[${clm_idx}]}"
@@ -2403,6 +2454,11 @@ if [ "${clm_flg}" = 'Yes' ] && [ "${clm_md}" = 'mth' ] && [ "${bnr_flg}" = 'No'
 		    exit 1
 		fi # !err
 	    fi # !dbg
+	    if [ ${dbg_lvl} -ge 1 ]; then
+		date_crr=$(date +"%s")
+		date_dff=$((date_crr-date_rgr))
+		echo "Elapsed time to regrid annual climo $((date_dff/60))m$((date_dff % 60))s"
+	    fi # !dbg
 	fi # !rgr_map
     fi # !ann_flg
     
@@ -2690,7 +2746,7 @@ if [ "${sbs_flg}" = 'Yes' ]; then
 fi # !sbs_flg
 date_end=$(date +"%s")
 if [ -n "${caseid}" ]; then
-    printf "Completed ${yr_nbr_xtn}-year climatology operations for dataset ${caseid} at `date`\n"
+    printf "Completed ${yr_nbr_xtn}-year climatology operations for dataset with caseid = ${caseid} at `date`\n"
 else # !caseid
     printf "Completed ${yr_nbr_xtn}-year climatology operations for input data at `date`\n"
 fi # !caseid
diff --git a/data/ncremap b/data/ncremap
index 08679fe..ccd16a4 100755
--- a/data/ncremap
+++ b/data/ncremap
@@ -58,6 +58,8 @@
 
 # Set script name, directory, PID, run directory
 drc_pwd=${PWD}
+# Security: Explicitly unset IFS before wordsplitting, so Bash uses default IFS=<space><tab><newline>
+unset IFS
 # Set these before 'module' command which can overwrite ${BASH_SOURCE[0]}
 # NB: dash supports $0 syntax, not ${BASH_SOURCE[0]} syntax
 # http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
@@ -264,11 +266,13 @@ fi # !hrd_pth && !NCO_PATH_OVERRIDE
 # ncremap -v FSNT,AODVIS -s ${DATA}/grids/ne30np4_pentagons.091226.nc -i ${DATA}/ne30/raw/famipc5_ne30_v0.3_00003.cam.h0.1979-01.nc -d ${DATA}/dstmch90/dstmch90_clm.nc -o ~/foo.nc
 # TempestRemap boutique:
 # GenerateCSMesh --alt --res 30 --file ${DATA}/grids/ne30.g
-# ncremap --dbg=1 -a se2fv_flx --src_grd=${DATA}/grids/ne30.g --dst_grd=${DATA}/grids/129x256_SCRIP.20150901.nc -m ~/map_ne30np4_to_fv129x256_mono.20180101.nc
+# ncremap --dbg=1 -a se2fv_flx --src_grd=${DATA}/grids/ne30.g --dst_grd=${DATA}/grids/129x256_SCRIP.20150901.nc -m ~/map_ne30np4_to_fv129x256_mono.20180301.nc
 # ncremap --dbg=1 -i ${DATA}/ne30/raw/famipc5_ne30_v0.3_00003.cam.h0.1979-01.nc -m ~/map_ne30np4_to_fv129x256_mono.20180301.nc -o ~/foo_fv129x256.nc
 # ncremap --dbg=1 -a fv2se_stt --src_grd=${DATA}/grids/129x256_SCRIP.20150901.nc --dst_grd=${DATA}/grids/ne30.g -m ~/map_fv129x256_to_ne30np4_highorder.20180301.nc
 # ncremap --dbg=1 -i ~/foo_fv129x256.nc -m ~/map_fv129x256_to_ne30np4_highorder.20180301.nc -o ~/foo_ne30.nc
 # ncremap --dbg=1 -a se2fv_flx --src_grd=${DATA}/grids/ne30.g --se_mtd=${DATA}/grids/ne30np4_latlon.091226.nc --dst_grd=${DATA}/grids/129x256_SCRIP.20150901.nc -m ~/map_ne30np4_to_fv129x256_mono.20180301.nc
+# Atmosphere->Ocean:
+# ncremap --dbg=1 --a2o -a se2fv_flx --src_grd=${DATA}/grids/ne30.g --dst_grd=${DATA}/grids/129x256_SCRIP.20150901.nc -m ~/map_ne30np4_to_fv129x256_mono.20180301.nc
 # Debugging and Benchmarking:
 # ncremap -D 1 -i ${DATA}/sld/raw/AIRS.2014.10.01.202.L2.TSurfStd.Regrid010.1DLatLon.hole.nc -d ${DATA}/dstmch90/dstmch90_clm.nc -o ~/foo.nc > ~/ncremap.out 2>&1 &
 
@@ -317,6 +321,7 @@ fi # !TERM
 
 # Defaults for command-line options and some derived variables
 # Modify these defaults to save typing later
+a2o_flg='No' # [flg] Atmosphere-to-ocean (only used by Tempest mesh generator)
 alg_typ='bilinear' # [nbr] Algorithm for remapping (bilinear|conserve|nearestdtos|neareststod|patch|tempest|se2fv_flx|se2fv_stt|se2fv_alt|fv2se_flx|fv2se_stt|fv2se_alt)
 bch_pbs='No' # [sng] PBS batch (non-interactive) job
 bch_slr='No' # [sng] SLURM batch (non-interactive) job
@@ -378,7 +383,7 @@ sgs_nrm='1.0' # [frc] Sub-grid normalization
 std_flg='No' # [sng] Input available from pipe to stdin
 thr_nbr=2 # [nbr] Thread number for regridder
 tmp_out_fl='ncremap_grd_tmp.nc' # [sng] Temporary output file
-trn_map='' # [flg] Tempest transpose map (i.e., fv2se_flx == monotr)
+trn_map='No' # [flg] Tempest transpose map (i.e., fv2se_flx == monotr)
 ugrid_fl='' # [sng] UGRID file
 unq_sfx=".pid${spt_pid}" # [sng] Unique suffix
 #var_lst='FSNT,AODVIS' # [sng] Variables to process (empty means all)
@@ -426,6 +431,7 @@ function fnc_usg_prn { # NB: dash supports fnc_nm (){} syntax, not function fnc_
     echo "            ESMF algorithms: bilinear|conserve|nearestdtos|neareststod|patch|tempest|se2fv_flx|se2fv_stt|se2fv_alt|fv2se_flx|fv2se_stt|fv2se_alt"
     echo "            Tempest algorithms: tempest|se2fv_flx|se2fv_stt|se2fv_alt|fv2se_flx|fv2se_stt|fv2se_alt"
     echo "${fnt_rvr}-d${fnt_nrm} ${fnt_bld}dst_fl${fnt_nrm}   Data file to infer destination grid from (empty means none, i.e., use grd_fl, grd_sng or map_fl)) (default ${fnt_bld}${dst_fl}${fnt_nrm}) [${fnt_tlc}dst_fl, destination_file, template_file, template${fnt_nrm}]"
+    echo " ${fnt_bld}--a2o${fnt_nrm}      Atmosphere-to-ocean remap (for Tempest only) (default ${fnt_bld}${a2o_flg}${fnt_nrm}) [${fnt_tlc}a2o, atm2ocn, b2l, big2ltl, l2s, lrg2sml${fnt_nrm}]"
     echo "${fnt_rvr}-D${fnt_nrm} ${fnt_bld}dbg_lvl${fnt_nrm}  Debug level (default ${fnt_bld}${dbg_lvl}${fnt_nrm}) [${fnt_tlc}dbg_lvl, dbg, debug, debug_level${fnt_nrm}]"
     echo " ${fnt_bld}--fl_fmt${fnt_nrm}   File format (empty is netCDF3 64bit CDF2) (default ${fnt_bld}${fl_fmt}${fnt_nrm}) [${fnt_tlc}fl_fmt, fmt_out, file_format, format_out${fnt_nrm}]"
     echo "${fnt_rvr}-G${fnt_nrm} ${fnt_bld}grd_sng${fnt_nrm}  Grid generation argument string (empty means none) (default ${fnt_bld}${grd_sng}${fnt_nrm}) [${fnt_tlc}grd_sng, grid_generation, grid_gen, grid_string${fnt_nrm}]"
@@ -556,6 +562,8 @@ while getopts :34567a:CD:d:f:g:G:h:I:i:j:L:Mm:n:O:o:P:p:R:r:s:T:t:Uu:V:v:W:w:x:-
 	       # Long options with no argument, no short option counterpart
 	       # Long options with argument, no short option counterpart
 	       # Long options with short counterparts, ordered by short option key
+	       a2o | atm2ocn | b2l | big2ltl | l2s | lrg2sml ) a2o_flg='Yes' ;; # # Atmosphere-to-ocean
+	       a2o=?* | atm2ocn=?* | b2l=?* | big2ltl=?* | l2s=?* | lrg2sml=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # # Atmosphere-to-ocean
 	       alg_typ=?* | algorithm=?* | regrid_algorithm=?* ) alg_typ="${LONG_OPTARG}" ;; # -a # Algorithm
 	       clm_flg=?* | climatology_flag=?* ) clm_flg='Yes' ;; # -C # Climo flag (undocumented)
 	       dbg_lvl=?* | dbg=?* | debug=?* | debug_level=?* ) dbg_lvl="${LONG_OPTARG}" ;; # -d # Debugging level
@@ -758,9 +766,9 @@ tmp_out_fl=${tmp_out_fl}${unq_sfx}
 znl_fl=${znl_fl}${unq_sfx}
 
 # Algorithm options are bilinear|conserve|nearestdtos|neareststod|patch|tempest|se2fv_flx|se2fv_stt|se2fv_alt|fv2se_flx|fv2se_stt|fv2se_alt
-if [ ${alg_typ} = 'bilinear' ] || [ ${alg_typ} = 'bln' ]; then 
+if [ ${alg_typ} = 'bilinear' ] || [ ${alg_typ} = 'bilin' ] || [ ${alg_typ} = 'bln' ]; then 
     alg_opt='bilinear'
-elif [ ${alg_typ} = 'conserve' ] || [ ${alg_typ} = 'conservative' ] || [ ${alg_typ} = 'cns' ]; then 
+elif [ ${alg_typ} = 'conserve' ] || [ ${alg_typ} = 'conservative' ] || [ ${alg_typ} = 'cns' ] || [ ${alg_typ} = 'aave' ]; then 
     alg_opt='conserve'
 elif [ ${alg_typ} = 'nearestdtos' ] || [ ${alg_typ} = 'nds' ] || [ ${alg_typ} = 'dtos' ]; then 
     alg_opt='nearestdtos'
@@ -815,7 +823,7 @@ elif [ ${alg_typ} = 'fv2se_alt' ] || [ ${alg_typ} = 'mono_fv2se' ] || [ ${alg_ty
     wgt_typ='tempest'
 else 
     echo "${spt_nm}: ERROR ${alg_typ} is not a valid remapping algorithm\n"
-    echo "${spt_nm}: HINT Valid ESMF remapping algorithms are bilinear,bln | conserve,cns | nearestdtos,nds,dtos | neareststod,nsd,stod | patch,pch\n"
+    echo "${spt_nm}: HINT Valid ESMF remapping algorithms are bilinear,bilin,bln | conserve,cns,aave | nearestdtos,nds,dtos | neareststod,nsd,stod | patch,pch\n"
     echo "${spt_nm}: HINT Valid TempestRemap remapping options are tempest | se2fv_flx,mono_se2fv | se2fv_stt,highorder_se2fv | se2fv_alt,intbilin | fv2se_flx,monotr_fv2se | fv2se_stt,highorder_fv2se | fv2se_alt,mono_fv2se\n"
     exit 1
 fi # !alg_typ
@@ -1656,10 +1664,12 @@ if [ "${grd_src_usr_flg}" = 'Yes' ] || [ "${prc_typ}" = 'sgs' ]; then
     fi # !esmf
     if [ "${wgt_typ}" = 'tempest' ]; then 
 	cmd_msh[${fl_idx}]="GenerateOverlapMesh --a ${grd_src} --b ${grd_dst} --out ${msh_fl} > /dev/null"
+	if [ "${a2o_flg}" = 'Yes' ]; then 
+	    cmd_msh[${fl_idx}]="GenerateOverlapMesh --b ${grd_src} --a ${grd_dst} --out ${msh_fl} > /dev/null"
+	fi # !a2o_flg
 	cmd_map[${fl_idx}]="${wgt_cmd} --in_mesh ${grd_src} --out_mesh ${grd_dst} --ov_mesh ${msh_fl} --out_map ${map_fl} ${wgt_opt} > /dev/null"
 	if [ "${trn_map}" = 'Yes' ]; then 
 	    # NB: Generate mono map for opposite direction regridding (i.e., reverse switches and grids), then transpose
-	    cmd_msh[${fl_idx}]="GenerateOverlapMesh --a ${grd_dst} --b ${grd_src} --out ${msh_fl} > /dev/null"
 	    cmd_map[${fl_idx}]="${wgt_cmd} --in_mesh ${grd_dst} --out_mesh ${grd_src} --ov_mesh ${msh_fl} --out_map ${map_trn_fl} ${wgt_opt} > /dev/null"
 	    cmd_trn[${fl_idx}]="GenerateTransposeMap --in ${map_trn_fl} --out ${map_fl} > /dev/null"
 	fi # !trn_map
@@ -1670,6 +1680,7 @@ if [ "${grd_src_usr_flg}" = 'Yes' ] || [ "${prc_typ}" = 'sgs' ]; then
 	    eval ${cmd_msh[${fl_idx}]}
 	    if [ $? -ne 0 ] || [ ! -f ${msh_fl} ]; then
 		printf "${spt_nm}: ERROR Failed to generate mesh-file. Debug this:\n${cmd_msh[${fl_idx}]}\n"
+		printf "${spt_nm}: HINT GenerateOverlapMesh requires that grids of unequal area be given as arguments in the order smaller first, larger second. ncremap supplies the grid arguments in the order source first, destination second unless explicitly told otherwise. A source grid that is a superset of the destination would violate the GenerateOverlapMesh rule. The solution is to add the \"--a2o\" switch (documented at http://nco.sf.net/nco.html#a2o) that tells ncremap to swap the grid argume [...]
 		exit 1
 	    fi # !err
 	fi # !dbg
@@ -1814,10 +1825,12 @@ for ((fl_idx=0;fl_idx<${fl_nbr};fl_idx++)); do
 	if [ "${wgt_typ}" = 'tempest' ]; then 
 	    printf "Mesh-File: ${msh_fl}\n"
 	    cmd_msh[${fl_idx}]="GenerateOverlapMesh --a ${grd_src} --b ${grd_dst} --out ${msh_fl} > /dev/null"
+	    if [ "${a2o_flg}" = 'Yes' ]; then 
+		cmd_msh[${fl_idx}]="GenerateOverlapMesh --b ${grd_src} --a ${grd_dst} --out ${msh_fl} > /dev/null"
+	    fi # !a2o_flg
 	    cmd_map[${fl_idx}]="${wgt_cmd} --in_mesh ${grd_src} --out_mesh ${grd_dst} --ov_mesh ${msh_fl} --out_map ${map_fl} ${wgt_opt} > /dev/null"
 	    if [ "${trn_map}" = 'Yes' ]; then 
 		# NB: Generate mono map for opposite direction regridding (i.e., reverse switches and grids), then transpose
-		cmd_msh[${fl_idx}]="GenerateOverlapMesh --a ${grd_dst} --b ${grd_src} --out ${msh_fl} > /dev/null"
 		cmd_map[${fl_idx}]="${wgt_cmd} --in_mesh ${grd_dst} --out_mesh ${grd_src} --ov_mesh ${msh_fl} --out_map ${map_trn_fl} ${wgt_opt} > /dev/null"
 		cmd_trn[${fl_idx}]="GenerateTransposeMap --in ${map_trn_fl} --out ${map_fl} > /dev/null"
 	    fi # !trn_map
@@ -1828,6 +1841,7 @@ for ((fl_idx=0;fl_idx<${fl_nbr};fl_idx++)); do
 		eval ${cmd_msh[${fl_idx}]}
 		if [ $? -ne 0 ] || [ ! -f ${msh_fl} ]; then
 		    printf "${spt_nm}: ERROR Failed to generate mesh-file. Debug this:\n${cmd_msh[${fl_idx}]}\n"
+		    printf "${spt_nm}: HINT GenerateOverlapMesh requires that grids of unequal area be given as arguments in the order smaller first, larger second. ncremap supplies the grid arguments in the order source first, destination second unless explicitly told otherwise. A source grid that is a superset of the destination would violate the GenerateOverlapMesh rule. The solution is to add the \"--a2o\" switch (documented at http://nco.sf.net/nco.html#a2o) that tells ncremap to swap the grid ar [...]
 		    exit 1
 		fi # !err
 	    fi # !dbg
diff --git a/data/sort.nco b/data/sort.nco
new file mode 100644
index 0000000..9275449
--- /dev/null
+++ b/data/sort.nco
@@ -0,0 +1,53 @@
+
+// Count number of errors
+nbr_err=0;
+nbr_err_ttl=0;
+
+
+// check sorting block a
+{
+  a1[time]={9,8,7,6,3,2,1,10,4,5};
+  a1s[time]={1,2,3,4,5,6,7,8,9,10}; 
+  a2=a1.sort(&smap);
+
+  if(a2 != a1s)
+  {
+      print("ERROR: a1 sorting 1D array");
+      nbr_err++;	
+  }
+
+  // unsort 
+  a2=a2.unmap(smap);
+ if(a2 != a1)
+  {
+      print("ERROR: a2 unmap 1D array");
+      nbr_err++;	
+  }
+
+  // try remap
+  a2=a1.remap(smap);
+  if(a2 != a1s)
+  {
+      print("ERROR: a3 remap 1D array");
+      nbr_err++;	
+  }
+
+  // try decending sort
+  if( a1.dsort() != a1s.reverse($time))
+  {  
+      print("ERROR: a1 dsort 1D array");
+      nbr_err++;	
+  }
+
+    
+  print("RESULTS block a: Num errors="); print(nbr_err,"%d");
+  nbr_err_ttl+=nbr_err;
+  nbr_err=0;
+  
+
+}
+
+// Results summany
+print("RESULTS SUMMARY: total errors=");print(nbr_err_ttl,"%d");
+
+
diff --git a/debian/changelog b/debian/changelog
index e1ed621..2ee9918 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
+nco (4.7.3-1) unstable; urgency=low
+
+  * new upstream version sanitize, --a2o, --nm_typ, --fmt_val, --fl_prn, deprecate ncap
+
+ -- Charlie Zender <zender at uci.edu>  Fri, 03 Mar 2018 12:25:29 -0700
+
 nco (4.7.2-1) unstable; urgency=low
 
-  * new upstream version fxm
+  * new upstream version Sapiens: splitter ypf, tempest2 boutique, ncremap psn arg, cheyenne
 
- -- Charlie Zender <zender at uci.edu>  Thu, 21 Jan 2017 12:25:28 -0700
+ -- Charlie Zender <zender at uci.edu>  Thu, 25 Jan 2018 12:25:28 -0700
 
 nco (4.7.1-1) unstable; urgency=low
 
diff --git a/doc/ANNOUNCE b/doc/ANNOUNCE
index e81523b..4f75c95 100644
--- a/doc/ANNOUNCE
+++ b/doc/ANNOUNCE
@@ -1,21 +1,17 @@
 $Header$ -*-text-*-
 
-The netCDF Operators NCO version 4.7.2 have slithered out.
+The netCDF Operators NCO version 4.7.3 have hatched.
 
 http://nco.sf.net (Homepage, Mailing lists, Help)
-http://github.com/nco (Source Code, Releases, Developers)
+http://github.com/nco (Source Code, Issues, Releases, Developers)
 
 What's new?
-Version 4.7.2 contains one new cool feature for ncremap, one important
-bugfix for the splitter, and assorted minor improvements and fixes.
-ncremap now implements E3SM-recommended Tempest remapping algorithms
-for all combinations of FV<->SE remapping for flux and state variables. 
-The ncclimo splitter functionality has an important bugfix for cases
-when the total number requested time-periods (usually years) of
-averaging is not evenly divisible by the maximum number of
-time-periods per output-file.
-
-Work on NCO 4.7.3 has commenced. Planned changes include
+Version 4.7.3 contains little features and fixes.
+A new security whitelist could break some workflows, and the
+other features offer better support for TempestRemap, MPAS, and
+heavy users of NCO print features in CDL, JSON, and XML.
+
+Work on NCO 4.7.4 has commenced. Planned changes include
 better diagnosis and workarounds for the netCDF CDF5 bug,
 parallel weight generation by ncremap, and possibly workarounds for 
 using quotation marks with ncap2 in Windows.
@@ -25,66 +21,78 @@ Charlie
 
 NEW FEATURES (full details always in ChangeLog):
 
-A. ncremap implements E3SM-recommended Tempest remapping algorithms. 
-   ncremap can now easily generate and use the each of the six
-   E3SM-recommended mappings between FV<->SE flux & state variables.
-   ncremap automatically employs the "boutique" TempestRemap options 
-   so long as Tempest2 is installed.
-   ncremap -a se2fv_flx --src_grd=ne30.g --dst_grd=fv.nc -m map.nc
-   ncremap -m map.nc in.nc out.nc
-   Canonical algorithm names are se2fv_flx, se2fv_stt, se2fv_alt,
-   fv2se_flx, fv2se_stt, fv2se_alt.
+A. Filename character whitelist:
+   NCO manipulates files, sometimes with shell calls.
+   We have never received a report of a security issue due to NCO.
+   Nevertheless, to pre-emptively reduce potential vulnerabilities, we 
+   instituted in 4.7.3 a whitelist of allowed filename characters:
+   abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.@ :%\/
+   The implied blacklist includes ;|<>[](),*
+   If you want a character(s) added to the whitelist, please send us
+   the rationale and a real-world use-case.
+   http://nco.sf.net/nco.html#whitelist
+
+B. ncremap implements E3SM-recommended Tempest remapping algorithms. 
+   It has done so since 4.7.2, but that version omitted a switch that
+   only a user can provide, and is necessary to indicate to
+   TempestRemap to generate mapping weights from a source grid that
+   has more coverage than the destination grid, i.e., the destination
+   grid is a subset of the source. The switch is --a2o, or --atm2ocn,
+   or numerous synonyms (b2l, big2ltl, l2s, lrg2sml).
+   When computing the intersection of two meshes, TempestRemap uses an
+   algorithm (an executable named GenerateOverlapMesh) that expects
+   the mesh with less coverage to be the first grid, and the grid with
+   greater coverage to be the second, regardless of mapping direction.
+   By default, ncremap supplies the source grid first and the
+   destination second, and this order causes GenerateOverlapMesh to
+   fail when the source grid covers regions not in the destination
+   grid. For example, a global atmosphere grid has more coverage than
+   a global ocean grid, so that remapping from atmosphere-to-ocean
+   would require invoking the --atm2ocn switch:
+   ncremap --a2o -a se2fv_flx --src_grd=ne30.g --dst_grd=fv.nc -m map.nc
+   http://nco.sf.net/nco.html#a2o
    http://nco.sf.net/nco.html#ncremap
    
-B. ncremap supports "canonical" NCO argument ordering.
-   Canonical ordering is: command [options] [input] [output].
-   Previously ncremap required the use of options (like -i
-   and -o) or pipes to supply filenames:
-   ncremap -m map.nc -i in.nc -o out.nc
-   ncremap -m map.nc -o out.nc in.nc
-   ncremap -m map.nc -O out_dir in1.nc in2.nc
-   ls in.nc | ncremap -m map.nc -o out.nc
-   ncremap -m map.nc -o out.nc < in.nc
-   Now ncremap finally supports the canonical ordering of command line
-   arguments most frequently desired for one-off regridding, where a
-   single input and output filename are supplied as command-line
-   positional arguments without switches, pipes, or redirection:
-   ncremap -m map.nc in.nc out.nc
-   http://nco.sf.net/nco.html#ncremap
-   http://nco.sf.net/nco.html#alg_typ
-
-C. ncremap support a --mss_val=val option for MPAS data.
-   ncremap pre-processes MPAS datasets (indicated with -P mpas) and
-   annotates their floating point variables with the _FillValue
-   attribute. By default it sets _FillValue to the correct value
-   for MPAS ocean and sea-ice models. However, the MPAS land-ice model
-   uses a different missing value. Hence this option is usually
-   invoked as --mss_val=-1.0e36 to facilitate processing of
-   MPAS land-ice datasets. 
-   ncremap -P mpas --mss_val=-1.0e36 -s ais.nc -i data.nc -g fv.nc -o out.nc
-   http://nco.sf.net/nco.html#ncremap
-   http://nco.sf.net/nco.html#mss_val_ncremap
-
-D. ncclimo has improved support for NCAR cheyenne batch queues
-   Previously ncclimo -p mpi failed on Cheyenne due to differences
-   between SGI MPT mpirun and "normal" mpirun syntax.
-   Now ncclimo uses mpirun syntax expected by SGI MPT on cheyenne.
-   qsub -A SCSG0002 -l select=12:ncpus=36:mpiprocs=1 -l \
-   walltime=00:30:00 -q regular -N ncclimo -j oe -m e -o ~/ncclimo.out 
-   http://nco.sf.net/nco.html#ncclimo
+C. ncclimo supports two more dataset filename template regular
+   expressions: prefix.YYYY-MM.suffix, and prefix.YYYY-MM-01.suffix.
+   When such a name is the argument to --caseid, the prefix and suffix
+   will be automatically abstracted and used to template and generate
+   all monthly filenames based on the specified yr_srt and yr_end.
+   Please tell us any dataset filename regular expressions that you
+   would like added to ncclimo rx database. 
+   ncclimo -s 300 -e 400 --caseid=foo.0300-01-01.nc -i . -o /tmp
+   http://nco.sf.net/nco.html#caseid
+
+D. printf() format option for printed output (CDL, XML, JSON, TRD).  
+   Formerly ncks would always print variable values with the default
+   format specification for the given output type. This meant that,
+   single and double-precision values would print ~7 and ~15 digits,
+   respectively. The new --fmt_val option causes ncks to use the
+   supplied printf() format string to print floating point values:
+   ncks --fmt_val %.5f ~/nco/data/in.nc   
+   will print up to five significant digits, and no more.
+   This allows users to round numbers before printing them.
+   http://nco.sf.net/nco.html#fmt_val
+
+E. ncks now accepts a --print_file=file option to print directly to
+   the named file rather than to stdout. Previously one could
+   achieve the same result by redirecting stdout to a named file.
+   However, it is slightly faster to print formatted output directly
+   to a file than to stdout. 
+   ncks --print_file=foo.txt --jsn in.nc
+   Synonyms are --fl_prn, --prn_fl, --file_print, and --print_file.
+   http://nco.sf.net/nco.html#prn_fl
+
+F. ncap, the predecessor to ncap2, has been completely eliminated.
+   This simplifies the build procedure by eliminating Bison/Yacc.
+   (Flex/Lex is still needed for other operators (notably ncwa)).
+   Old files may cause local NCO repositories to fail to build.
+   If this occurs, simply delete then re-check-out the repository.
 
 BUG FIXES:
 
-A. Fix ncclimo splitter bug when the total number requested
-   time-periods (usually years) of averaging is not evenly divisible
-   by the maximum number of time-periods per output-file.
-   Previously the splitter would omit time-series segments.
-   The workaround for NCO < 4.7.2 is to specify a maximum number
-   of years-per-file that evenly divides the total number of years.
-   For example, split a 75 year climatology by setting --ypf
-   to 1, 3, 5, 15, 25, or 75 or greater.
-   The solution is to upgrade to 4.7.2.
-   Then you can use the default (ypf=50) or any other value.
+A. Those who build NCO from source will notice that most or all of
+   the compiler warnings from building ncap2 have been eliminated.
 
 Full release statement at http://nco.sf.net/ANNOUNCE
 
@@ -92,9 +100,9 @@ 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.7.2 built/tested under
+   These problems occur with NCO 4.7.3 built/tested under
    MacOS 10.13.2 with netCDF 4.4.1.1 on HDF5 1.10.1 and with
-   Linux with netCDF 4.5.1-development (20180110) on HDF5 1.8.19.
+   Linux with netCDF 4.6.1-development (20180110) on HDF5 1.8.19.
 
 A. NOT YET FIXED (NCO problem)
    Correctly read arrays of NC_STRING with embedded delimiters in ncatted arguments
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 7a04b9c..29a242e 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,183 @@
+2018-03-02  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.7.3 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.7.3: Avid Poi';git push
+	git tag -a 4.7.3 -m 'sanitize, --a2o, --nm_typ, --fmt_val, --fl_prn, deprecate ncap';git push --tags
+
+2018-03-01  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.7.3-beta01 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.7.3-beta01: RFC water';git push
+	git tag -a 4.7.3-beta01 -m 'sanitize, --a2o, --nm_typ, --fmt_val, --fl_prn, deprecate ncap';git push --tags
+
+	* Merge sanitize_input branch so nco_sng_sntz() allows only white-listed characters in filenames
+
+	* Deprecate ncap from bld/Makefile
+
+	* Merge ncap deprecation branch for autoconf/CMake
+
+2018-02-27  Charlie Zender  <zender at uci.edu>
+
+	* White-list forward slash on Windows so URLs are acceptable (http://...)
+
+	* Make sure single file operator input is sanitized
+
+2018-02-22  Charlie Zender  <zender at uci.edu>
+
+	* Protect MSVC backslash
+
+	* Do not call sanitizer on system memory
+
+	* White-list percent sign (NCO regression test uses, e.g., %tmp_fl_00)
+
+	* Eliminate waiting on user input for regression tests
+
+	* Implement nco_sng_sntz(), notice 13 new ncks regressions
+
+	* Create sanitize_input branch
+
+2018-02-21  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.7.3-alpha05 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.7.3-alpha05: SW4';git push
+	git tag -a 4.7.3-alpha05 -m '--fl_prn, IFS';git push --tags
+
+	* Document --fl_prn
+
+	* Change remaining printf() to fprintf() and finish printing to fp_prn
+
+2018-02-20  Charlie Zender  <zender at uci.edu>
+
+	* Allow ncks to print to formatted file fp_prn rather than to stdout
+
+2018-02-15  Charlie Zender  <zender at uci.edu>
+
+	* Security: Explicitly unset IFS before wordsplitting, so Bash uses default IFS=<space><tab><newline>
+
+	* Security: Use /bin/mv and /bin/cp instead of mv and cp, respectively
+
+	* Add 'bilin' and 'aave' as synonyms to 'bilinear' and 'conserve', respectively
+
+2018-02-14  Charlie Zender  <zender at uci.edu>
+
+	* Fix compiler warnings when nc_set_log_level() is #undef'd
+
+2018-02-13  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.7.3-alpha04 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.7.3-alpha04: Breaded venison';git push
+	git tag -a 4.7.3-alpha04 -m 'fmt_val, set_log_level()';git push --tags
+
+	* Document --fmt_val, ensure it only applies to floating point values
+
+2018-02-12  Charlie Zender  <zender at uci.edu>
+
+	* Add --fmt_val, --val_fmt, --value_format for formatting variable values
+
+2018-02-08  Charlie Zender  <zender at uci.edu>
+
+	* Deprecate old/unused feature status from nco_cnf_prn()
+
+	* Remove 'var' from Invoke.cc OMP clause
+
+	* bld/Makefile allows for Ubuntu 4.4.0 exception with UBUNTU_440 argument
+
+2018-02-07  Charlie Zender  <zender at uci.edu>
+
+	* Add --enable-logging to autoconf
+
+	* Remove duplicate nc_set_log_level() call triggered by dbg_lvl
+
+2018-02-06  Charlie Zender  <zender at uci.edu>
+
+	* Clarify CF violation warning when attribute type is NC_STRING
+
+2018-02-05  Charlie Zender  <zender at uci.edu>
+
+	* Henry cleaned-up ncap2 which now builds warning-free with gcc, clang, g++, and MSVC
+
+2018-02-05 Henry Butowsky  <henryb at hush.com>
+
+	* Add shell script bm/cch_clr.sh to clear caches. Works with Linux and MacOS.
+
+2018-02-04  Charlie Zender  <zender at uci.edu>
+
+	* Fix three bugs introduced in 10 supposedly simple lines of changes from yesterday
+
+2018-02-03  Charlie Zender  <zender at uci.edu>
+
+	* Add nm_typ='yyyy-mm' and better document all nm_typ's
+
+2018-02-02  Charlie Zender  <zender at uci.edu>
+
+	* NCO 4.7.3-alpha03 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.7.3-alpha03: Super Blue Blood Moon';git push
+	git tag -a 4.7.3-alpha03 -m 'nc_set_log_level(), nm_typ yyyy-mm-01, fml_nm';git push --tags
+
+	* Ensure fml_nm works with rx nm_typ
+
+	* Change rx to allow filenames with multiple periods for nm_typ='yyyymm' and 'yyyy-mm-01'
+
+	* ncclimo distinguish mdl_typ from nm_typ, add 'yyyy-mm-01' rx
+
+2018-02-01  Charlie Zender  <zender at uci.edu>
+
+	* Alter regression output for 'make test > ~/foo 2>&1;cat ~/foo | grep FAILED | grep Unidata'
+
+	* Add nc_set_log_level() to all binaries
+
+	* Practice git feature-based workflow with new log_level branch
+
+	* Verify rename bug still exists in 4.6.0.1
+
+	* Update NCO_rgr.pl and nco_exit_lbr_rcd() for 4.6.0, 4.6.1, 4.6.2
+
+2018-01-30  Charlie Zender  <zender at uci.edu>
+
+	* Add HINT on --a2o for GenerateOverlapMesh failures
+
+	* NCO 4.7.3-alpha02 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.7.3-alpha02: Hedgy';git push
+	git tag -a 4.7.3-alpha02 -m 'AppVeyor, a2o, nco_def/inq_var_filter(), _Filter';git push --tags
+
+	* Fix and test a2o switch to work with transpose maps
+
+2018-01-28  Charlie Zender  <zender at uci.edu>
+
+	* Integrate --a2o with consistenly with GenerateOverlapMesh call for all options including monotr
+
+2018-01-26  Charlie Zender  <zender at uci.edu>
+
+	* Pedro, Filipe, Isuru, and Xylar fixed AppVeyor failure
+
+	* ncremap --a2o indicates large-to-small regridding, e.g., atmosphere-to-ocean, so reverse grids in GenerateOverlapMesh
+
+	* Cast "size_t" to "unsigned long" for %lu formats
+
+	* Give cmake -DNETCDF_INCLUDE:PATH=${NETCDF_INC} precedence over ${NETCDF_ROOT}/include, same for lib
+
+	* Modify code to eliminate MSVC compiler warnings
+
 2018-01-25  Charlie Zender  <zender at uci.edu>
 
+	* Add _Filter printing to nco_prn_att()
+
+	* Add timers to ncclimo
+
+	* Add nc[o]_def/inq_var_filter() stubs
+
+	* NCO 4.7.3-alpha01 release procedure:
+	cd ~/nco;git commit -a -m 'Version 4.7.3-alpha01: Coughy';git push
+	git tag -a 4.7.3-alpha01 -m 'Functionally identical to 4.7.2';git push --tags
+
+	* Add tm3_lat_flt to buggy.cdl to test _Filter attribute
+
+	* Add DSCOVR L2 dimensions number_of_lines, number_of_pixels to ncremap database
+
+	* ncclimo/ncremap: deprecate pileus
+
+	* nco.texi: Fix errors introduced by solar_zenith_angle() documentation
+
 	* NCO 4.7.2 release procedure:
 	cd ~/nco;git commit -a -m 'Version 4.7.2: Sapiens';git push
 	git tag -a 4.7.2 -m 'Sapiens: splitter ypf, tempest2 boutique, ncremap psn arg, cheyenne';git push --tags
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 0156040..3a6be44 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -284,8 +284,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/doc/VERSION b/doc/VERSION
index af9764a..87b18a5 100644
--- a/doc/VERSION
+++ b/doc/VERSION
@@ -1 +1 @@
-4.7.2
+4.7.3
diff --git a/doc/debian.txt b/doc/debian.txt
index 9ca6fcc..45d0aaa 100644
--- a/doc/debian.txt
+++ b/doc/debian.txt
@@ -29,18 +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.7.2
-   First we create a clean source distribution of nco and place it in nco-4.7.2
+   For starters, we wish to create .debs of tagged releases, e.g., nco-4.7.3
+   First we create a clean source distribution of nco and place it in nco-4.7.3
    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.7.2
-/bin/rm nco.tar.gz;tar cvzf nco-4.7.2.tar.gz ./nco-4.7.2/*
-cd ~/nco/nco-4.7.2
-dh_make -e zender at uci.edu -f ../nco-4.7.2.tar.gz
+cd ~/nco;tar xvzf nco.tar.gz;mv nco nco-4.7.3
+/bin/rm nco.tar.gz;tar cvzf nco-4.7.3.tar.gz ./nco-4.7.3/*
+cd ~/nco/nco-4.7.3
+dh_make -e zender at uci.edu -f ../nco-4.7.3.tar.gz
 
     2.2 The preceding steps created template debian files for a .deb,
     Those files now reside in ~/nco/debian.
@@ -55,7 +55,7 @@ dh_make -e zender at uci.edu -f ../nco-4.7.2.tar.gz
    from previous build
 
    cd ~/nco;/bin/rm *.gz
-   cd ~/nco/nco-4.7.2
+   cd ~/nco/nco-4.7.3
    dpkg-buildpackage -rfakeroot > foo 2>&1
    dpkg-buildpackage -rsudo > foo 2>&1
 
@@ -84,33 +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.7.2 with X.Y.Z+1
+# tags-query replace 4.7.3 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.7.2-1 # Update changelog (-b forces this version number)
+   cd ~/nco/debian;dch -b --force-distribution --distribution=unstable -v 4.7.3-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
-   ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4.7.2
+   ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4.7.3
 # Upload tarball to SF https://sourceforge.net/projects/nco/files 
-   cd;scp dust.ess.uci.edu:/var/www/html/nco/src/nco-4.7.2.tar.gz .
+   cd;scp dust.ess.uci.edu:/var/www/html/nco/src/nco-4.7.3.tar.gz .
 
 7. Ubuntu PPA
 https://help.launchpad.net/Packaging/PPA
-dput NCO nco_4.7.2-2~ppa1_source.changes
+dput NCO nco_4.7.3-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.7.2-1.dpkg-buildpackage.txt
-http://dust.ess.uci.edu/nco/src/nco_4.7.2-1.dsc
-http://dust.ess.uci.edu/nco/src/nco_4.7.2-1_i386.changes
-http://dust.ess.uci.edu/nco/src/nco_4.7.2-1_i386.deb
-http://dust.ess.uci.edu/nco/src/nco_4.7.2.orig.tar.gz
+http://dust.ess.uci.edu/nco/src/nco_4.7.3-1.dpkg-buildpackage.txt
+http://dust.ess.uci.edu/nco/src/nco_4.7.3-1.dsc
+http://dust.ess.uci.edu/nco/src/nco_4.7.3-1_i386.changes
+http://dust.ess.uci.edu/nco/src/nco_4.7.3-1_i386.deb
+http://dust.ess.uci.edu/nco/src/nco_4.7.3.orig.tar.gz
 
 # Becoming a Debian developer
 http://www.debian.org/devel/join/newmaint
@@ -164,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.7.2 ${DATA}/nco_4.7.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.7.2-1 -d nco-4.7.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.7.2 nco # Export most recent
-tar cvzf ./nco_4.7.2.orig.tar.gz --exclude='nco-4.7.2/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.7.2 
-/bin/rm -rf ${DATA}/nco-4.7.2 # Remove cvs-exported directory
-tar xvzf ./nco_4.7.2.orig.tar.gz # Untar to get directory without excluded files
-mkdir -p ${DATA}/nco-4.7.2/debian/source;cd ~/nco/debian;/bin/cp changelog compat control convert copyright doc-base files info rules ${DATA}/nco-4.7.2/debian;cd ~/nco/debian/source;/bin/cp format ${DATA}/nco-4.7.2/debian/source # Replace debian directory with _CURRENT_ (main trunk) settings
+sudo /bin/rm -rf ${DATA}/nco-4.7.3 ${DATA}/nco_4.7.3* ${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.7.3-1 -d nco-4.7.3 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.7.3 nco # Export most recent
+tar cvzf ./nco_4.7.3.orig.tar.gz --exclude='nco-4.7.3/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.7.3 
+/bin/rm -rf ${DATA}/nco-4.7.3 # Remove cvs-exported directory
+tar xvzf ./nco_4.7.3.orig.tar.gz # Untar to get directory without excluded files
+mkdir -p ${DATA}/nco-4.7.3/debian/source;cd ~/nco/debian;/bin/cp changelog compat control convert copyright doc-base files info rules ${DATA}/nco-4.7.3/debian;cd ~/nco/debian/source;/bin/cp format ${DATA}/nco-4.7.3/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.7.2;dpkg-buildpackage -rsudo -uc -us > ~/foo.nco 2>&1 # -uc -us: Do not sign changes or source files
-#cd ${DATA}/nco-4.7.2;dpkg-buildpackage -rsudo -sa > ~/foo.nco 2>&1 # -sa: Include _orig.tar.gz in .changes 
-cd ${DATA}/nco-4.7.2;dpkg-buildpackage -rsudo > ~/foo.nco 2>&1
+#cd ${DATA}/nco-4.7.3;dpkg-buildpackage -rsudo -uc -us > ~/foo.nco 2>&1 # -uc -us: Do not sign changes or source files
+#cd ${DATA}/nco-4.7.3;dpkg-buildpackage -rsudo -sa > ~/foo.nco 2>&1 # -sa: Include _orig.tar.gz in .changes 
+cd ${DATA}/nco-4.7.3;dpkg-buildpackage -rsudo > ~/foo.nco 2>&1
 sudo dpkg --remove nco
-sudo dpkg --install ${DATA}/nco_4.7.2-1_*.deb
+sudo dpkg --install ${DATA}/nco_4.7.3-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.7.2-1_*.deb
-ls -l ${DATA}/nco_4.7.2*
+lintian ${DATA}/nco_4.7.3-1_*.deb
+ls -l ${DATA}/nco_4.7.3*
 m ~/foo.nco
 # Upload Ubuntu (rather than Debian) packages to websites
-scp ${DATA}/nco_4.7.2* dust.ess.uci.edu:/var/www/html/nco/src
-scp ${DATA}/nco_4.7.2* zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
+scp ${DATA}/nco_4.7.3* dust.ess.uci.edu:/var/www/html/nco/src
+scp ${DATA}/nco_4.7.3* 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.7.2-1_*.changes
+# cd ${DATA};dupload -t mentors nco_4.7.3-1_*.changes
 bsrc # Reset shell environment for regular development
 
 # New build system #2
@@ -202,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.7.2* # Cleanup prior build
+sudo /bin/rm /var/cache/pbuilder/result/nco_4.7.3* # 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.7.2-1.dsc > ~/foo.nco.pbuilder 2>&1
-cd /var/cache/pbuilder/result;debsign -k6F635D10 nco_4.7.2-1_*.changes
-lintian /var/cache/pbuilder/result/nco_4.7.2-1_*.deb
+cd ${DATA};DIST=sid sudo pbuilder build nco_4.7.3-1.dsc > ~/foo.nco.pbuilder 2>&1
+cd /var/cache/pbuilder/result;debsign -k6F635D10 nco_4.7.3-1_*.changes
+lintian /var/cache/pbuilder/result/nco_4.7.3-1_*.deb
 sudo dpkg --remove nco
-sudo dpkg --install /var/cache/pbuilder/result/nco_4.7.2-1_*.deb
+sudo dpkg --install /var/cache/pbuilder/result/nco_4.7.3-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.7.2-1_*.changes
+cd /var/cache/pbuilder/result;dupload -t mentors nco_4.7.3-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.7.2 ${DATA}/nco-4.7.2* # Cleanup last build
+/bin/rm -rf ${DATA}/nco-4.7.3 ${DATA}/nco-4.7.3* # Cleanup last build
 ${sudo_sng} /bin/rm -r -f \
-${rpm_root}/BUILD/nco-4.7.2 \
-${rpm_root}/RPMS/i386/nco-4.7.2-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-4.7.2-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-4.7.2-?.i386.rpm \
-${rpm_root}/SOURCES/nco-4.7.2.tar.gz \
-${rpm_root}/SPECS/nco-4.7.2.spec \
-${rpm_root}/SRPMS/nco-4.7.2-?.src.rpm
-cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4.7.2-1 -d nco-4.7.2 nco # Export based on tag
-${sudo_sng} ln -s ${HOME}/nco/bld/nco.spec ${rpm_root}/SPECS/nco-4.7.2.spec
-tar cvzf ./nco-4.7.2.tar.gz --exclude='nco-4.7.2/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.7.2 
-${sudo_sng} /bin/cp ${DATA}/nco-4.7.2.tar.gz ${rpm_root}/SOURCES
+${rpm_root}/BUILD/nco-4.7.3 \
+${rpm_root}/RPMS/i386/nco-4.7.3-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-4.7.3-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-4.7.3-?.i386.rpm \
+${rpm_root}/SOURCES/nco-4.7.3.tar.gz \
+${rpm_root}/SPECS/nco-4.7.3.spec \
+${rpm_root}/SRPMS/nco-4.7.3-?.src.rpm
+cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4.7.3-1 -d nco-4.7.3 nco # Export based on tag
+${sudo_sng} ln -s ${HOME}/nco/bld/nco.spec ${rpm_root}/SPECS/nco-4.7.3.spec
+tar cvzf ./nco-4.7.3.tar.gz --exclude='nco-4.7.3/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.7.3 
+${sudo_sng} /bin/cp ${DATA}/nco-4.7.3.tar.gz ${rpm_root}/SOURCES
 cd ${rpm_root}/SPECS
-${sudo_sng} rpmbuild -ba --sign nco-4.7.2.spec > ~/foo.nco 2>&1
+${sudo_sng} rpmbuild -ba --sign nco-4.7.3.spec > ~/foo.nco 2>&1
 scp \
-${rpm_root}/RPMS/i386/nco-4.7.2-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-4.7.2-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-4.7.2-?.i386.rpm \
-${rpm_root}/SRPMS/nco-4.7.2-?.src.rpm \
+${rpm_root}/RPMS/i386/nco-4.7.3-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-4.7.3-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-4.7.3-?.i386.rpm \
+${rpm_root}/SRPMS/nco-4.7.3-?.src.rpm \
 dust.ess.uci.edu:/var/www/html/nco/src
 scp \
-${rpm_root}/RPMS/i386/nco-4.7.2-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-4.7.2-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-4.7.2-?.i386.rpm \
-${rpm_root}/SRPMS/nco-4.7.2-?.src.rpm \
+${rpm_root}/RPMS/i386/nco-4.7.3-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-4.7.3-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-4.7.3-?.i386.rpm \
+${rpm_root}/SRPMS/nco-4.7.3-?.src.rpm \
 zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 
 # RPM builds as user
@@ -256,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.7.2 ${DATA}/nco-4.7.2* # Cleanup last build
+/bin/rm -rf ${DATA}/nco-4.7.3 ${DATA}/nco-4.7.3* # Cleanup last build
 /bin/rm -r -f \
-${rpm_root}/nco-4.7.2-?.src.rpm \
-${rpm_root}/nco-4.7.2.spec \
-${rpm_root}/nco-4.7.2.tar.gz \
-${rpm_root}/*/nco-4.7.2-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-4.7.2-?.*.rpm \
-${rpm_root}/*/nco-devel-4.7.2-?.*.rpm
-# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4.7.2-1 -d nco-4.7.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.7.2 nco # Export most recent and build as 4.7.2-1
-tar cvzf ./nco-4.7.2.tar.gz --exclude='nco-4.7.2/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.7.2 
-/bin/cp ${DATA}/nco-4.7.2.tar.gz ${rpm_root}
+${rpm_root}/nco-4.7.3-?.src.rpm \
+${rpm_root}/nco-4.7.3.spec \
+${rpm_root}/nco-4.7.3.tar.gz \
+${rpm_root}/*/nco-4.7.3-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-4.7.3-?.*.rpm \
+${rpm_root}/*/nco-devel-4.7.3-?.*.rpm
+# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-4.7.3-1 -d nco-4.7.3 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.7.3 nco # Export most recent and build as 4.7.3-1
+tar cvzf ./nco-4.7.3.tar.gz --exclude='nco-4.7.3/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-4.7.3 
+/bin/cp ${DATA}/nco-4.7.3.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.7.2-?.*.rpm
+rpmlint ${rpm_root}/*/nco-4.7.3-?.*.rpm
 sudo yum remove nco
-sudo yum install ${rpm_root}/*/nco-4.7.2-?.*.rpm
+sudo yum install ${rpm_root}/*/nco-4.7.3-?.*.rpm
 scp \
-${rpm_root}/*/nco-4.7.2-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-4.7.2-?.*.rpm \
-${rpm_root}/*/nco-devel-4.7.2-?.*.rpm \
-${rpm_root}/nco-4.7.2-?.*.src.rpm \
+${rpm_root}/*/nco-4.7.3-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-4.7.3-?.*.rpm \
+${rpm_root}/*/nco-devel-4.7.3-?.*.rpm \
+${rpm_root}/nco-4.7.3-?.*.src.rpm \
 dust.ess.uci.edu:/var/www/html/nco/src
 scp \
-${rpm_root}/*/nco-4.7.2-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-4.7.2-?.*.rpm \
-${rpm_root}/*/nco-devel-4.7.2-?.*.rpm \
-${rpm_root}/nco-4.7.2-?.*.src.rpm \
+${rpm_root}/*/nco-4.7.3-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-4.7.3-?.*.rpm \
+${rpm_root}/*/nco-devel-4.7.3-?.*.rpm \
+${rpm_root}/nco-4.7.3-?.*.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 5f3665c..29f41bc 100644
--- a/doc/index.shtml
+++ b/doc/index.shtml
@@ -70,7 +70,7 @@ Try to disable Spammers' machines:
 <p><h1 align="center">Bienvenue sur le netCDF Operator (NCO) site</h1>
 
 <p><h2>
-Current stable NCO version is 4.7.1 released <!--#flastmod file="src/nco-4.7.1.tar.gz"-->
+Current stable NCO version is 4.7.3 released <!--#flastmod file="src/nco-4.7.3.tar.gz"-->
 </h2>
 
 <table border=0 width=100%>
@@ -149,7 +149,8 @@ and
 <h2>Recent Releases & Milestones</h2>
 
 <ul>
-<li>2018 Feb ??: 4.7.3 <i>In Progress...</i>
+<li>2018 Apr ??: 4.7.4 <i>In Progress...</i>
+<li>2018 Mar 02: 4.7.3 Sundry features/fixes
 <li>2018 Jan 25: 4.7.2 Tempest2
 <li>2017 Dec 21: 4.7.1 Conda Windows port
 <li>2017 Nov 08: 4.7.0 Sundry features/fixes
@@ -618,17 +619,23 @@ Identical copies of those tarballs are also stored
 <a href="http://nco.sf.net/src">here</a> on SourceForge for historical
 continuity.
 You may retrieve the source of tagged versions directly with, e.g.,
-<tt>git clone -b 4.7.2 http://github.com/nco/nco.git nco-4.7.2</tt></a>.
+<tt>git clone -b 4.7.3 http://github.com/nco/nco.git nco-4.7.3</tt></a>.
 <ul>
-<li><b>NCO 4.7.4</b>: (<i>Future</i>)
+<li><b>NCO 4.7.5</b>: (<i>Future</i>)
 Chunking bytes not elements;
 extensive hashing?;
 netCDF4 compound types?;</li>
-<li><b>NCO 4.7.3</b>: (<i>In Progress, features in-progress or complete include</i>) 
+<li><b>NCO 4.7.4</b>: (<i>In Progress, features in-progress or complete include</i>) 
 <tt>ncclimo -v</tt> splitter support for regular expressions;
 <tt>ncks --xtn</tt> better extensive variable treatment;
 <tt>ncremap</tt> generate weights;</li>
-<li><b>NCO 4.7.2</b>: (<i>Current Stable Release</i>)
+<li><b>NCO 4.7.3</b>: (<i>Current Stable Release</i>)
+Sanitize input/output filenames;
+<tt>ncclimo</tt> Support <tt>YYYY-MM</tt> and <tt>YYYY-MM-01</tt> rx's;
+<tt>ncks --fmt_val --fl_prn</tt> for printing;
+<tt>ncremap --a2o</tt> for TempestRemap2 ordering;
+<tt>ncap2</tt> silence compiler warnings;</li>
+<li><b>NCO 4.7.2</b>:
 <tt>ncclimo</tt> splitter <i>ypf</i> bugfix;
 <tt>ncremap</tt> canonical positional arguments;
 <tt>ncremap</tt> TempestRemap2 support;</li>
@@ -769,7 +776,7 @@ goodies besides NCO) to your automatically-searched channels with
 ‘<tt>conda config --add channels conda-forge</tt>’, then
 install NCO with ‘<tt>conda install nco</tt>’.
 The default NCO installed by <tt>conda</tt> is generally within a month of the latest release. 
-<li><a href="https://github.com/conda-forge/nco-feedstock">nco-4.7.2</a> Executables Anaconda-compatible. Maintained by Filipe Fernandes.</li>
+<li><a href="https://github.com/conda-forge/nco-feedstock">nco-4.7.3</a> Executables Anaconda-compatible. Maintained by Filipe Fernandes.</li>
 Thanks to Rich Signell, Filipe Fernandes, Pedro Vicente, and others for developing and maintaining the NCO package for conda.
 </ul>
 
@@ -778,7 +785,7 @@ Thanks to Rich Signell, Filipe Fernandes, Pedro Vicente, and others for developi
 <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.7.2</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.7.3</a></li>
 -->
 <a href="http://packages.debian.org/unstable/science/nco">Debian NCO</a> and 
 <a href="https://launchpad.net/ubuntu/+source/nco">Ubuntu NCO</a> homepages.
@@ -786,8 +793,8 @@ Thanks to Rich Signell, Filipe Fernandes, Pedro Vicente, and others for developi
 NCO packages in the Debian/Ubuntu repositories (e.g., 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/nco/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.7.2-1_i386.deb</tt>’):</dt>
-<li><a href="https://launchpad.net/ubuntu/+source/nco/4.7.2-1">nco_4.7.2-1_amd64.deb</a> : Executables AMD64-compatible</li>
+<dt>Debian package for most recent NCO release (install with, e.g., ‘<tt>dpkg --install nco_4.7.3-1_i386.deb</tt>’):</dt>
+<li><a href="https://launchpad.net/ubuntu/+source/nco/4.7.3-1">nco_4.7.3-1_amd64.deb</a> : Executables AMD64-compatible</li>
 Thanks to Daniel Baumann, Sebastian Couwenberg, Barry deFreese, Francesco Lovergine, 
 Brian Mays, Rorik Peterson, and Matej Vela for their help packaging
 NCO for Debian over the years. 
@@ -831,10 +838,10 @@ Thanks to Gavin Burris and Kyle Wilcox for documenting build procedures for RHEL
 <!-- 
 # Mac OS X 10.13 (High Sierra) systems (aerosol):
 /usr/bin/scp ~/nco/doc/index.shtml zender,nco at web.sf.net:/home/project-web/nco/htdocs
-cd ~/bin;tar cvzf ${DATA}/nco-4.7.2.macosx.10.13.tar.gz nc*;scp ${DATA}/nco-4.7.2.macosx.10.13.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
+cd ~/bin;tar cvzf ${DATA}/nco-4.7.3.macosx.10.13.tar.gz nc*;scp ${DATA}/nco-4.7.3.macosx.10.13.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
 -->
 The most up-to-date executables 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.7.2.macosx.10.13.tar.gz">nco-4.7.2.macosx.10.13.tar.gz</a> (<!--#fsize file="src/nco-4.7.2.macosx.10.13.tar.gz"-->): Executables MacOSX 10.13-compatible (last updated <!--#flastmod file="src/nco-4.7.2.macosx.10.13.tar.gz"-->). 
+<li><a href="src/nco-4.7.3.macosx.10.13.tar.gz">nco-4.7.3.macosx.10.13.tar.gz</a> (<!--#fsize file="src/nco-4.7.3.macosx.10.13.tar.gz"-->): Executables MacOSX 10.13-compatible (last updated <!--#flastmod file="src/nco-4.7.3.macosx.10.13.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>
@@ -856,9 +863,9 @@ To build NCO from source yourself using MSVC with CMake, please see example in <
 <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.7.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.7.2.windows.mvs.exe pvicente,nco at web.sf.net:/home/project-web/nco/htdocs/src
 -->
-<li><a href="src/nco-4.7.1.windows.mvs.exe">nco-4.7.1.windows.mvs.exe</a> (<!--#fsize file="src/nco-4.7.1.windows.mvs.exe"-->) : Windows Self-Extracting Installer (last updated <!--#flastmod file="src/nco-4.7.1.windows.mvs.exe"-->). Maintained by Pedro Vicente.</li>
+<li><a href="src/nco-4.7.2.windows.mvs.exe">nco-4.7.2.windows.mvs.exe</a> (<!--#fsize file="src/nco-4.7.2.windows.mvs.exe"-->) : Windows Self-Extracting Installer (last updated <!--#flastmod file="src/nco-4.7.2.windows.mvs.exe"-->). Maintained by Pedro Vicente.</li>
 </ul>
 
 <a name="cygwin"></a> <!-- http://nco.sf.net#cygwin -->
@@ -1029,12 +1036,12 @@ site.</li>
 The simplest way to acquire the source is to download the compressed tarball:
 <ul>
 <li>
-<!-- scp ${DATA}/nco-4.7.2.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src -->
-<a href="https://github.com/nco/nco/archive/4.7.2.tar.gz">nco-4.7.2.tar.gz</a> 
-(<!--#fsize file="src/nco-4.7.2.tar.gz"--> compressed tar-file)<br>
-<!--#exec cmd="openssl dgst -md5 src/nco-4.7.2.tar.gz"--><br>
-<!--#exec cmd="openssl dgst -sha1 src/nco-4.7.2.tar.gz"--><br>
-<!--#exec cmd="openssl dgst -sha256 src/nco-4.7.2.tar.gz"--> 
+<!-- scp ${DATA}/nco-4.7.3.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src -->
+<a href="https://github.com/nco/nco/archive/4.7.3.tar.gz">nco-4.7.3.tar.gz</a> 
+(<!--#fsize file="src/nco-4.7.3.tar.gz"--> compressed tar-file)<br>
+<!--#exec cmd="openssl dgst -md5 src/nco-4.7.3.tar.gz"--><br>
+<!--#exec cmd="openssl dgst -sha1 src/nco-4.7.3.tar.gz"--><br>
+<!--#exec cmd="openssl dgst -sha256 src/nco-4.7.3.tar.gz"--> 
 </li>
 </ul>
 
@@ -1053,8 +1060,8 @@ 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.7.2</tt>:
-<p><tt>git clone https://github.com/nco/nco.git;cd nco;git checkout 4.7.2</tt></p>
+then checks out NCO version <tt>4.7.3</tt>:
+<p><tt>git clone https://github.com/nco/nco.git;cd nco;git checkout 4.7.3</tt></p>
 These commands retrieve the current (“bleeding edge”)
 development version of NCO into a local directory named <tt>nco</tt>:
 <p><tt>git clone https://github.com/nco/nco.git ~/nco</tt></p> or
@@ -1062,9 +1069,9 @@ development version of NCO into a local directory named <tt>nco</tt>:
 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.7.2</tt>) and the development version is that the
+(e.g., <tt>4.7.3</tt>) and the development version is that the
 tagged release operators will print a valid version number (e.g.,
-<tt>4.7.2</tt>) when asked to do so with the <tt>-r</tt> flag
+<tt>4.7.3</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.
@@ -1212,9 +1219,9 @@ As of 20131101 there is no Cygwin package for ANTLR, and the netCDF package does
 
 <li>Once you have installed the pre-requisites as shown above, you may then build the latest stable NCO and install it in, e.g., <tt>/usr/local</tt> with: 
 <tt>
-<dt>wget https://github.com/nco/nco/archive/4.7.2.tar.gz</dt>
-<dt>tar xvzf 4.7.2.tar.gz</dt>
-<dt>cd nco-4.7.2</dt>
+<dt>wget https://github.com/nco/nco/archive/4.7.3.tar.gz</dt>
+<dt>tar xvzf 4.7.3.tar.gz</dt>
+<dt>cd nco-4.7.3</dt>
 <dt>./configure --prefix=/usr/local</dt>
 <dt>make</dt>
 <dt>sudo make install</dt>
diff --git a/doc/nco.texi b/doc/nco.texi
index 10a3f47..8b6fd5c 100644
--- a/doc/nco.texi
+++ b/doc/nco.texi
@@ -119,12 +119,12 @@ Octave TeXInfo manual shows clean TeXInfo structure
 @setfilename nco.info
 
 @c Define edition, date, ...
- at set nco-edition 4.7.2
- at set doc-edition 4.7.2
+ at set nco-edition 4.7.3-alpha05
+ at set doc-edition 4.7.3-alpha05
 @set copyright-years 1995--2018
 @set update-year 2018
- at set update-date 22 January 2018
- at set update-month January 2018
+ at set update-date 1 March 2018
+ at set update-month March 2018
 
 @settitle @acronym{NCO} @value{nco-edition} User Guide
 
@@ -311,7 +311,7 @@ ncflint, ncks, ncra, ncrcat, ncremap, ncrename, ncwa">
 @subtitle @value{update-month}
 
 @author by Charlie Zender
- at author Departments of Earth System Science and of Computer Science
+ at author Departments of Earth System Science and Computer Science
 @author University of California, Irvine
 @html
 <p>WWW readers: Having trouble finding the section you want?</p> 
@@ -6526,10 +6526,18 @@ Generating common grids:
 ncks --rgr grd_ttl='Equi-Angular grid 180x360'#latlon=180,360#lat_typ=uni#lon_typ=grn_ctr \
      --rgr scrip=${DATA}/grids/180x360_SCRIP.20150901.nc ~zender/nco/data/in.nc ~/foo.nc
 
+# 180x360 (1x1 degree) Equi-Angular grid, first longitude west edge at Greenwich
+ncks --rgr grd_ttl='Equi-Angular grid 180x360'#latlon=180,360#lat_typ=uni#lon_typ=grn_wst \
+     --rgr scrip=${DATA}/grids/180x360wst_SCRIP.20180301.nc ~zender/nco/data/in.nc ~/foo.nc
+
 # 129x256 CAM-FV grid, first longitude centered at Greenwich
 ncks --rgr grd_ttl='CAM-FV scalar grid 129x256'#latlon=129,256#lat_typ=fv#lon_typ=grn_ctr \
      --rgr scrip=${DATA}/grids/129x256_SCRIP.20150901.nc ~zender/nco/data/in.nc ~/foo.nc
 
+# 192x288 CAM-FV grid, first longitude centered at Greenwich
+ncks --rgr grd_ttl='CAM-FV scalar grid 192x288'#latlon=192,288#lat_typ=fv#lon_typ=grn_ctr \
+     --rgr scrip=${DATA}/grids/192x288_SCRIP.20160301.nc ~zender/nco/data/in.nc ~/foo.nc
+
 # 1441x2880 CAM-FV grid, first longitude centered at Greenwich
 ncks --rgr grd_ttl='CAM-FV scalar grid 1441x2880'#latlon=1441,2880#lat_typ=fv#lon_typ=grn_ctr \
      --rgr scrip=${DATA}/grids/1441x2880_SCRIP.20170901.nc ~zender/nco/data/in.nc ~/foo.nc
@@ -12108,13 +12116,14 @@ tm5=!tm4;               // tm5=1, 1, 0, 1, 1, 0, 1, 1, 1, 1 double
 @noindent @emph{var1 '=' exp1} @*
 If var1 does not already exist in Input or Output then var1 is written to Output with the values, type and dimensions from expr1. If var1 is in Input only it is copied to Output first. Once the var is in Ouptut then the only reqirement on expr1 is that the number of elements must match the number already on disk. The type of expr1 is converted as necessary to the disk type.
 
-If you wish to change the type or shape of a variable in Input then you have to cast the variable. See @pxref{Left hand casting}
+If you wish to change the type or shape of a variable in Input then you
+must cast the variable.
+See @pxref{Left hand casting}
 @example
 time[time]=time.int();
 three_dmn_var_dbl[time,lon,lat]=666L;
 @end example
 
-
 @noindent @strong{ Other Assign Operators +=,-=,*=./= }@*
         @noindent  @emph{var1 'ass_op' exp1 }@*
 if exp1 is a variable and it doesn't conform to var1 then an attempt is made to make it conform to var1. If exp1 is an attribute it must have unity size or else have the same number of elements as var1. If expr1 has a different type to var1 the it is converted to the var1 type.
@@ -12133,7 +12142,7 @@ n3=one--+20; n3=21  one=0;
 n4=--time;   n4=time=0.,1.,2.,3.,4.,5.,6.,7.,8.,9.;
 @end example
 
- at noindent @strong{Conditional Operator ?: } @*
+ at noindent @strong{Conditional Operator ?:}@*
 @cindex conditional Operator
 @noindent @emph{exp1 ? exp2 : exp3 } @*
 The conditional operator (or ternary Operator) is a succinct way
@@ -12728,9 +12737,9 @@ See @pxref{ID Quoting}.
 A @emph{value list} is a special type of attribute. 
 It can only be used on the RHS of the assign family of statements.@*
 That is @emph{=, +=, -=, *=, /=}@*
-A value list CAN-NOT be involved in any logical, binary, or arithmetical operations (except those above).@* 
-A value list CAN-NOT be used as a function argument.@*
-A value list CANT have nested value lists.@*
+A value list CANNOT be involved in any logical, binary, or arithmetical operations (except those above).@* 
+A value list CANNOT be used as a function argument.@*
+A value list CANNOT have nested value lists.@*
 The type of a value list is the type of the member with the highest type.@*
 
 @cindex value list
@@ -12743,8 +12752,8 @@ lon[lon]={0.0,90.0,180.0,270.0};
 lon*={1.0,1.1,1.2,1.3} 
 dlon[lon]={1b,2s,3ull,4.0f}; // final type NC_FLOAT
 
-a1 at ind={1,2,3}+{4,4,4};  // BAD 
-a1 at s=sin( {1.0,16.0} );  // BAD
+a1 at ind={1,2,3}+{4,4,4}; // BAD
+a1 at s=sin({1.0,16.0}); // BAD
 @end verbatim
 @end example
 
@@ -12807,7 +12816,7 @@ the netCDF4 library and the output file must be of type @code{NETCDF4}:
 var[$time]=1UL;    // Variable will be type @code{NC_UINT}
 var[$lon]=4b;      // Variable will be type @code{NC_BYTE}
 var[$lat]=5ull;    // Variable will be type @code{NC_UINT64}  
-var[$lat]=5ll;    // Variable will be type @code{NC_INT64}  
+var[$lat]=5ll;     // Variable will be type @code{NC_INT64}  
 var at att=6.0d;      // Attribute will be type @code{NC_DOUBLE}
 var at att=-666L;     // Attribute will be type @code{NC_INT}
 var at att="kelvin"s; // Attribute will be type @code{NC_STRING} (note the "s")
@@ -13513,12 +13522,13 @@ temp_avg.ram_write();           // Write Variable to output
 @node Where statement, Loops, RAM variables, ncap2 netCDF Arithmetic Processor
 @subsection Where statement
 @cindex where()
-A @code{where()} combines the definition and application of a mask all in one go and can lead to succinct code. 
+A @code{where()} combines the definition and application of a mask all
+in one go and can lead to succinct code.  
 The full syntax of a @code{where()} statement is as follows:
 
 @example
 @verbatim
-// Single assign (the 'elsewhere' block is optional)
+// Single assign ('elsewhere' is optional)
 where(mask) 
    var1=expr1;
 elsewhere
@@ -16167,7 +16177,7 @@ netcdf-4.0 Final  2008/08/28@*
 @end example
 @c End HMB documentation
 
- at node create_bounds() function, solar_zenith_angle function , ID Quoting, ncap2 netCDF Arithmetic Processor
+ at node create_bounds() function, solar_zenith_angle function, ID Quoting, ncap2 netCDF Arithmetic Processor
 @subsection create_bounds() function
 @cindex create_bounds() function
 The @command{ncap2} custom function 'create_bounds()' takes any monotonic 1D coordinate variable with regular or irregular (e.g., Gaussian) spacing and creates a bounds variable.
@@ -16198,7 +16208,7 @@ defdim("nv",2);
 climatology_bounds=create_bounds(time,$nv,"climatology_bounds");
 @end example
 
- at node solar_zenith_angle function, , ncap2 netCDF Arithmetic Processor
+ at node solar_zenith_angle function,  , create_bounds() function, ncap2 netCDF Arithmetic Processor
 @subsection solar_zenith_angle function
 @cindex solar_zenith_angle function
 
@@ -16843,8 +16853,8 @@ omitted in batch scripts.
 SYNTAX
 @example 
 ncbo [-3] [-4] [-5] [-6] [-7] [-A] [-C] [-c]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]] [-F] [--fl_fmt @var{fl_fmt}]
 [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [-h] [--hdr_pad @var{nbr}]
 [-L @var{dfl_lvl}] [-l @var{path}] [--no_cll_msr] [--no_frm_trm] [--no_tmp_fl] 
@@ -17328,6 +17338,9 @@ Long option synonyms are given just after the letter.
 When invoked without options, @command{ncclimo} prints a succinct table
 of all options and some examples.
 @table @option
+ at html
+<a name="dec_md"></a> <!-- http://nco.sf.net/nco.html#dec_md -->
+ at end html
 @cindex @code{-a @var{dec_md}}
 @cindex @code{--dec_md}
 @cindex @code{--dec_mode}
@@ -17344,6 +17357,9 @@ The last month is November of the end year specified with @samp{-e}.
 The first month used is January of the specified start year. 
 The last month is December of the end year specified with @samp{-e}.
 
+ at html
+<a name="clm_md"></a> <!-- http://nco.sf.net/nco.html#clm_md -->
+ at end html
 @cindex @code{-C @var{clm_md}}
 @cindex @var{clm_md}
 @cindex @code{--clm_md}
@@ -17389,6 +17405,9 @@ Users have encountered this issue when attempting to run
 In such cases, explicitly specify @samp{--clm_md=mth} (or @code{ann} or
 @code{day}) to persuade @command{ncclimo} to run a normal climatology.
 
+ at html
+<a name="caseid"></a> <!-- http://nco.sf.net/nco.html#caseid -->
+ at end html
 @cindex @code{-c @var{caseid}}
 @cindex @var{caseid}
 @cindex @code{--caseid}
@@ -17403,10 +17422,28 @@ For @acronym{CESM}'ish input files like
 specify @samp{-c famipc5_ne30_v0.3_00001}. 
 The @samp{.cam.} and @samp{.h0.} bits are added internally to produce
 the input filenames.
-These can be modified via the @option{-m @var{mdl_nm}} and 
- at option{-h @var{hst_nm}} switches if needed.  
-For input files like @file{merra2_198001.nc},
-specify @samp{-c merra2_198001.nc}. 
+Modify these via the @option{-m @var{mdl_nm}} and @option{-h
+ at var{hst_nm}} switches if needed.   
+For input files named slightly differently than standard
+ at acronym{CESM}'ish names, supply the filename (excluding the path
+component) as the @var{caseid} and @command{ncclimo} will attempt
+to parse it by matching it to a database of know regular expressions
+common to model output.
+These are all of the format
+ at var{prefix}[.-]@var{YYYY}[-]@var{MM}[-]@var{DD}. at var{suffix}.
+The particular formats current supported, as of @acronym{NCO} version
+4.7.3 (February, 2018) are:
+ at var{prefix}@code{_YYYYMM}. at var{suffix}, 
+ at var{prefix}@code{.YYYY-MM}. at var{suffix}, and
+ at var{prefix}@code{.YYYY-MM-01}. at var{suffix}.
+For example, input files like @file{merra2_198001.nc} (i.e., the six
+digits that precede the suffix are @var{YYYYMM}-format), specify
+ at samp{-c merra2_198001.nc} and the prefix (@code{merra2}) will be
+automatically abstracted and used to template and generate all the
+filenames based on the specified @var{yr_srt} and @var{yr_end}. 
+Please tell us any dataset filename regular expressions that you would
+like added to @command{ncclimo}'s internal database.
+
 In timeseries reshaping mode, @var{caseid} will be used, if supplied,
 as an additional string in the output filename.
 For example, specifying @samp{-c control} would cause
@@ -17428,6 +17465,9 @@ If @math{@var{dbg_lvl} > 2}, @command{ncclimo} prints the diagnostic
 information, executes all commands, and passes-through the debugging
 level to the regridder (@command{ncks}) for additional diagnostics.
 
+ at html
+<a name="end_yr"></a> <!-- http://nco.sf.net/nco.html#end_yr -->
+ at end html
 @cindex @code{-e @var{end_yr}}
 @cindex @var{end_yr}
 @cindex @code{--end_yr}
@@ -17441,6 +17481,9 @@ is November of the specified end year.
 If @samp{-a sdd} is specified, the last month is December of the
 specified end year.  
 
+ at html
+<a name="fml_nm"></a> <!-- http://nco.sf.net/nco.html#fml_nm -->
+ at end html
 @cindex @code{-f @var{fml_nm}}
 @cindex @var{fml_nm}
 @cindex @code{--fml_nm}
@@ -17463,6 +17506,9 @@ For example, specifying @samp{-f control} would cause
 @file{T_000101_000912.nc} to be instead named 
 @file{T_control_000101_000912.nc}.
 
+ at html
+<a name="hst_nm"></a> <!-- http://nco.sf.net/nco.html#hst_nm -->
+ at end html
 @cindex @code{-h @var{hst_nm}}
 @cindex @var{hst_nm}
 @cindex @code{--history_name}
@@ -17479,6 +17525,9 @@ Use @samp{-h @var{hst_nm}} to specify alternative history volumes.
 Examples include @samp{h0} (default, works for @acronym{CAM},
 @acronym{ALM/CLM}), @samp{h1}, and @samp{h} (for @acronym{CISM}).
 
+ at html
+<a name="drc_in"></a> <!-- http://nco.sf.net/nco.html#drc_in -->
+ at end html
 @cindex @code{-i @var{drc_in}}
 @cindex @var{drc_in}
 @cindex @code{--drc_in}
@@ -17497,6 +17546,9 @@ In timeseries reshaping mode, @command{ncclimo} uses all netCDF files
 create the list of input files when no list is provided through
 @code{stdin} or as positional arguments to the command-line. 
 
+ at html
+<a name="job_nbr"></a> <!-- http://nco.sf.net/nco.html#job_nbr -->
+ at end html
 @cindex @code{-j @var{job_nbr}}
 @cindex @var{job_nbr}
 @cindex @code{--job_nbr}
@@ -17550,6 +17602,9 @@ Specify deflation level @var{dfl_lvl} on a scale from no deflation
 (@var{dfl_lvl = 0}, the default) to maximum deflation
 (@var{dfl_lvl = 9}).
 
+ at html
+<a name="lnk_flg"></a> <!-- http://nco.sf.net/nco.html#lnk_flg -->
+ at end html
 @cindex @code{-l}
 @cindex @code{--lnk_flg}
 @cindex @code{--link_flag}
@@ -17566,6 +17621,9 @@ these linked filenames.
 Use this switch to turn-off that linking and reduce filename
 proliferation if you do not need @acronym{AMWG} filenames.
 
+ at html
+<a name="mdl_nm"></a> <!-- http://nco.sf.net/nco.html#mdl_nm -->
+ at end html
 @cindex @code{-m @var{mdl_nm}}
 @cindex @var{mdl_nm}
 @cindex @code{--model_name}
@@ -17576,6 +17634,9 @@ Model name (as embedded in monthly input filenames).
 Default is @samp{cam}. Other options are @samp{clm2}, @samp{ocn},
 @samp{ice}, @samp{cism}, @samp{cice}, @samp{pop}. 
 
+ at html
+<a name="nco_opt"></a> <!-- http://nco.sf.net/nco.html#nco_opt -->
+ at end html
 @cindex @code{-n @var{nco_opt}}
 @cindex @var{nco_opt}
 @cindex @code{--nco_opt}
@@ -17586,6 +17647,9 @@ Specifies a string of options to pass-through unaltered to
 @command{ncks}. 
 @var{nco_opt} defaults to @samp{-O --no_tmp_fl}.
 
+ at html
+<a name="drc_rgr"></a> <!-- http://nco.sf.net/nco.html#drc_rgr -->
+ at end html
 @cindex @code{-O @var{drc_rgr}}
 @cindex @var{drc_rgr}
 @cindex @code{--drc_rgr}
@@ -17597,6 +17661,9 @@ Directory to hold regridded climo files.
 Regridded climos are placed in @var{drc_out} unless a separate
 directory for them is specified with @samp{-O} (NB: capital ``O''). 
 
+ at html
+<a name="no_cll_msr"></a> <!-- http://nco.sf.net/nco.html#no_cll_msr -->
+ at end html
 @cindex @code{--no_cll_msr}
 @cindex @code{--no_cll}
 @cindex @code{--no_cell_measures}
@@ -17608,6 +17675,9 @@ and @command{ncremap} add measures variables to the extraction list
 along with the primary variable and other associated variables. 
 See @ref{CF Conventions} for a detailed description.
 
+ at html
+<a name="no_frm_trm"></a> <!-- http://nco.sf.net/nco.html#no_frm_trm -->
+ at end html
 @cindex @code{--no_frm_trm}
 @cindex @code{--no_frm}
 @cindex @code{--no_formula_terms}
@@ -17658,6 +17728,9 @@ By default the staggered grid is output for all files regridded from
 a Cap (aka @acronym{FV}) grid, except when the regridding is performed
 as part of splitting (reshaping) into timeseries.
 
+ at html
+<a name="drc_out"></a> <!-- http://nco.sf.net/nco.html#drc_out -->
+ at end html
 @cindex @code{-o @var{drc_out}}
 @cindex @var{drc_out}
 @cindex @code{--drc_out}
@@ -17669,6 +17742,9 @@ Directory to hold computed (output) native grid climo files.
 Regridded climos are also placed here unless a separate directory
 for them is specified with @samp{-O} (NB: capital ``O''). 
 
+ at html
+<a name="par_typ"></a> <!-- http://nco.sf.net/nco.html#par_typ -->
+ at end html
 @cindex @code{-p @var{par_typ}}
 @cindex @var{par_typ}
 @cindex @code{--par_typ}
@@ -17714,6 +17790,9 @@ To specify variable-by-variable precision options, pass the desired
 options as a quoted string directly with @samp{-n @var{nco_opt}},
 e.g., @samp{-n '--ppc FSNT,TREFHT=4 --ppc CLOUD=2'}.
 
+ at html
+<a name="rgr_opt"></a> <!-- http://nco.sf.net/nco.html#rgr_opt -->
+ at end html
 @cindex @code{-R @var{rgr_opt}}
 @cindex @var{rgr_opt}
 @cindex @code{--rgr_opt}
@@ -17723,6 +17802,9 @@ Specifies a string of options to pass-through unaltered to
 @command{ncks}. 
 @var{rgr_opt} defaults to @samp{-O --no_tmp_fl}.
 
+ at html
+<a name="rgr_map"></a> <!-- http://nco.sf.net/nco.html#rgr_map -->
+ at end html
 @cindex @code{-r @var{rgr_map}}
 @cindex @var{rgr_map}
 @cindex @code{--rgr_map}
@@ -17741,6 +17823,9 @@ Options intended exclusively for the regridder may be passed as
 arguments to the @samp{-R} switch.
 See below the discussion on regridding.
 
+ at html
+<a name="srt_yr"></a> <!-- http://nco.sf.net/nco.html#srt_yr -->
+ at end html
 @cindex @code{-s @var{srt_yr}}
 @cindex @var{srt_yr}
 @cindex @code{--srt_yr}
@@ -17755,6 +17840,9 @@ be December of the year before the start year (to allow for contiguous
 If @samp{-a sdd} is specified, the first month used is January of
 the specified start year. 
 
+ at html
+<a name="csn_lst"></a> <!-- http://nco.sf.net/nco.html#csn_lst -->
+ at end html
 @cindex @code{--seasons=@var{csn_lst}}
 @cindex @var{csn_lst}
 @cindex @code{--seasons}
@@ -17794,6 +17882,9 @@ ncclimo --seasons=jfm,jas,ann ...     # Monthly + JFM,JAS,ANN
 ncclimo --seasons=fm,on ...           # Monthly + FM,ON
 @end example
 
+ at html
+<a name="stdin"></a> <!-- http://nco.sf.net/nco.html#stdin -->
+ at end html
 @cindex @acronym{SLURM}
 @cindex @acronym{PBS}
 @cindex @code{--stdin}
@@ -17841,6 +17932,9 @@ with climatology generation in parallel climatology mode (i.e., when
 @math{@var{par_typ}} = @code{mpi} or @code{bck}). 
 Hence @command{ncclimo} defaults to @var{thr_nbr}=2.
 
+ at html
+<a name="tpd"></a> <!-- http://nco.sf.net/nco.html#tpd -->
+ at end html
 @cindex @code{--tpd_out=@var{tpd_out}}
 @cindex @var{tpd_out}
 @cindex @code{--tpd_out}
@@ -17898,6 +17992,9 @@ and @acronym{NCO} license, directories from which the @acronym{NCO}
 scripts and binaries are running, and the locations of any separate 
 executables that may be used by the script.
 
+ at html
+<a name="ypf"></a> <!-- http://nco.sf.net/nco.html#ypf -->
+ at end html
 @cindex @code{--ypf_max @var{ypf_max}}
 @cindex @var{ypf_max}
 @cindex @code{--ypf_max}
@@ -18681,7 +18778,7 @@ EXAMPLES
 <a name="merra2"></a> <!-- http://nco.sf.net/nco.html#merra2 -->
 @end html
 How to create a climo from a collection of monthly
-non- at acronym{CESM}'ish files? 
+non- at acronym{CESM}'ish files?  
 This is a two-step procedure:
 First be sure the names are arranged with a @acronym{YYYYMM}-format date
 preceding the suffix (usually @samp{.nc}).
@@ -18770,8 +18867,8 @@ Moreover, the climatologies can be generated in parallel.
 SYNTAX
 @example
 ncecat [-3] [-4] [-5] [-6] [-7] [-A] [-C] [-c]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]] [-F] [--fl_fmt @var{fl_fmt}]
 [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--gag] [--glb ...] [-h] [--hdf] [--hdr_pad @var{nbr}]
 [-L @var{dfl_lvl}] [-l @var{path}] [-M] [--md5_digest] [--mrd] [-n @var{loop}]
@@ -19038,8 +19135,8 @@ of changing variable dimensionality, including the record dimension.
 SYNTAX
 @example
 nces [-3] [-4] [-5] [-6] [-7] [-A] [-C] [-c]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]] [-F]
 [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [-h] [--hdf] [--hdr_pad @var{nbr}] 
 [-L @var{dfl_lvl}] [-l @var{path}] [-n @var{loop}]
@@ -19267,8 +19364,8 @@ member in the first file.
 SYNTAX
 @example
 ncflint [-3] [-4] [-5] [-6] [-7] [-A] [-C] [-c]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]] [--fl_fmt @var{fl_fmt}]
 [-F] [--fix_rec_crd] [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [-h] [--hdr_pad @var{nbr}]
 [-i @var{var}, at var{val3}] [-L @var{dfl_lvl}] [-l @var{path}] [-N]
@@ -19562,16 +19659,18 @@ ncatted -a units,prs_sfc,o,c,millibar out.nc
 SYNTAX
 @example
 ncks [-3] [-4] [-5] [-6] [-7] [-A] [-a] [-b @var{fl_bnr}] [-C] [-c] [--cdl]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
-[-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]] [-F] [--fix_rec_dmn @var{dim}] 
-[--fl_fmt @var{fl_fmt}] [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [--grp_xtr_var_xcl]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]]
+[-F] [--fix_rec_dmn @var{dim}] [--fl_fmt @var{fl_fmt}] [--fmt_val @var{format}]
+[-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [--grp_xtr_var_xcl]
 [-H] [-h] [--hdn] [--hdr_pad @var{nbr}] [--jsn] [--jsn_fmt @var{lvl}] 
-[-L @var{dfl_lvl}] [-l @var{path}] [-M] [-m] [--map @var{map-file}] 
-[--md5] [--mk_rec_dmn @var{dim}] [--no_blank] [--no_cll_msr] [--no_frm_trm] [--no_tmp_fl] 
-[-O] [-o @var{output-file}] [-P] [-p @var{path}] [--ppc ...]
-[-Q] [-q] [-R] [-r] [--rad] [--ram_all] [--rgr ...] [--rnr=wgt] [-s @var{format}] 
-[-u] [--unn] [-V] [-v @var{var}[, at dots{}]] [-X ...] [-x] [--xml]
+[-L @var{dfl_lvl}] [-l @var{path}]
+[-M] [-m] [--map @var{map-file}] [--md5] [--mk_rec_dmn @var{dim}]
+[--no_blank] [--no_cll_msr] [--no_frm_trm] [--no_tmp_fl] 
+[-O] [-o @var{output-file}] [-P] [-p @var{path}] [--ppc ...] [--prn_fl @var{print-file}]
+[-Q] [-q] [-R] [-r] [--rad] [--ram_all] [--rgr ...] [--rnr=wgt]
+[-s @var{format}] [-u] [--unn] [-V] [-v @var{var}[, at dots{}]] [-X ...] [-x] [--xml]
 @var{input-file} [[@var{output-file}]]
 @end example
 
@@ -19609,11 +19708,12 @@ datum.
 @command{ncks} exposes many flexible controls over printed output,
 including @acronym{CDL}, @acronym{JSON}, and @acronym{NcML}.
 
-Options @samp{-a}, @samp{--cdl}, @samp{-F} , @samp{-H},
- at samp{--hdn}, @samp{--jsn}, @samp{-M}, @samp{-m}, @samp{-P}, @samp{-Q},
- at samp{-q}, @samp{-s}, @samp{--trd}, @samp{-u}, @samp{-V}, and
- at samp{--xml} (and their long option counterparts) control the formatted
-appearance of the data. 
+Options @samp{-a}, @samp{--cdl}, @samp{-F}, @samp{--fmt_val}, @samp{-H},
+ at samp{--hdn}, @samp{--jsn}, @samp{-M}, @samp{-m}, @samp{-P},
+ at samp{--prn_fl}, @samp{-Q}, @samp{-q}, @samp{-s}, @samp{--trd},
+ at samp{-u}, @samp{-V}, and @samp{--xml} (and their long option
+counterparts) control the presence of data and metadata and their
+formatted location and appearance when printed. 
 
 @cindex global attributes
 @cindex attributes, global
@@ -20453,6 +20553,23 @@ Also activated using @samp{--print} or @samp{--prn}.
 This set of switches is useful for exploring file contents.
 
 @html
+<a name="fl_prn"></a> <!-- http://nco.sf.net/nco.html#fl_prn -->
+<a name="prn_fl"></a> <!-- http://nco.sf.net/nco.html#prn_fl -->
+ at end html
+ at cindex print file
+ at cindex @code{--fl_prn}
+ at cindex @code{--prn_fl}
+ at item --prn_fl @file{print-file}
+Activate printing formatted output to file @file{print-file}.
+Also @samp{--print_file}, @samp{--fl_prn}, and @samp{--file_print}.
+One can achieve the same result by redirecting stdout to a named file.
+However, it is slightly faster to print formatted output directly to a
+file than to stdout:
+ at example
+ncks --fl_prn=foo.txt --jsn in.nc
+ at end example
+
+ at html
 <a name="Q"></a> <!-- http://nco.sf.net/nco.html#Q -->
 <a name="quiet"></a> <!-- http://nco.sf.net/nco.html#quiet -->
 @end html
@@ -20528,7 +20645,52 @@ Also @samp{--retain_all_dimensions}, @samp{--orphan_dimensions}, and
 @item -s @var{format}
 String format for text output. 
 Accepts @w{C language} escape sequences and @code{printf()} formats. 
-Also @samp{--string}  and @samp{--sng_fmt}. 
+Also @samp{--string}  and @samp{--sng_fmt}.
+This option is only intended for use with traditional (@acronym{TRD})
+printing, and thus automatically invokes the @samp{--trd} switch.
+
+ at html
+<a name="fmt_val"></a> <!-- http://nco.sf.net/nco.html#fmt_val -->
+<a name="val_fmt"></a> <!-- http://nco.sf.net/nco.html#val_fmt -->
+<a name="value_format"></a> <!-- http://nco.sf.net/nco.html#value_format -->
+ at end html
+ at cindex @code{--value_format}
+ at cindex @code{--fmt_val}
+ at cindex @code{--val_fmt}
+ at cindex @code{printf()}
+ at cindex C language
+ at item --fmt_val @var{format}
+Supply a @code{printf()}-style format for printed output, i.e., in
+ at acronym{CDL}, @acronym{JSON}, @acronym{TRD}, or @acronym{XML} modes. 
+Also @samp{--val_fmt} and @samp{--value_format}.
+One use for this option is to reduce the printed precision of floating
+point values: 
+ at example
+# Default printing of original double precision values
+# 0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789
+% ncks -C -v ppc_dbl ~/nco/data/in.nc
+...
+ppc_dbl = 0, 0.1, 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 0.12345678, 0.123456789 ;
+...
+# Restrict printing to three digits after the decimal
+% ncks --fmt_val=%.3f -C -v ppc_dbl ~/nco/data/in.nc
+...
+ppc_dbl = 0., 0.1, 0.12, 0.123, 0.123, 0.123, 0.123, 0.123, 0.123, 0.123 ;
+...
+ at end example
+ at noindent
+The supplied @var{format} only applies to floating point variable values 
+(@code{NC_FLOAT} or @code{NC_DOUBLE}), and not to other types or to
+attributes.
+For reference, the default @code{printf()} @var{format} for
+ at acronym{CDL}, @acronym{JSON}, @acronym{TRD}, and @acronym{XML} modes is
+ at code{%#.7gf}, @code{%#.7g},  @code{%g},    and @code{%#.7g},
+respectively, for single-precision data, and, for double-precision data is
+ at code{%#.15g}, @code{%#.15g}, @code{%.12g}, and @code{%#.15g},
+respectively.
+ at acronym{NCO} introduced this feature in version 4.7.3 (February, 2018).
+We would appreciate your feedback on whether and how to extend this
+feature to make it more useful. 
 
 @html
 <a name="ssh"></a> <!-- http://nco.sf.net/nco.html#ssh -->
@@ -20975,24 +21137,24 @@ Print variable @code{three_dmn_var} from file @file{in.nc} with
 default notations. 
 Next print @code{three_dmn_var} as an un-annotated text column.
 Then print @code{three_dmn_var} signed with very high precision.
-Finally, print @code{three_dmn_var} as a comma-separated list.
+Finally, print @code{three_dmn_var} as a comma-separated list:
 @example
-% ncks -C -v three_dmn_var in.nc
+% ncks --trd -C -v three_dmn_var in.nc
 lat[0]=-90 lev[0]=100 lon[0]=0 three_dmn_var[0]=0 
 lat[0]=-90 lev[0]=100 lon[1]=90 three_dmn_var[1]=1 
 ...
 lat[1]=90 lev[2]=1000 lon[3]=270 three_dmn_var[23]=23 
-% ncks -s '%f\n' -C -v three_dmn_var in.nc
+% ncks --trd -s '%f\n' -C -v three_dmn_var in.nc
 0.000000
 1.000000
 ...
 23.000000
-% ncks -s '%+16.10f\n' -C -v three_dmn_var in.nc
+% ncks --trd -s '%+16.10f\n' -C -v three_dmn_var in.nc
    +0.0000000000
    +1.0000000000
 ...
   +23.0000000000
-% ncks -s '%f, ' -C -v three_dmn_var in.nc
+% ncks --trd -s '%f, ' -C -v three_dmn_var in.nc
 0.000000, 1.000000, ..., 23.000000,
 @end example
 @noindent
@@ -21001,7 +21163,7 @@ Programmers will recognize these as the venerable @w{C language}
 The second and third options are useful when pasting data into text
 files like reports or papers.  
 @xref{ncatted netCDF Attribute Editor}, for more details on string
-formatting and special characters. 
+formatting and special characters.
 
 @cindex @code{--no_blank}
 As of @acronym{NCO} version 4.2.2 (October, 2012), @acronym{NCO} prints
@@ -21169,8 +21331,8 @@ For more details @xref{Wrapped Coordinates}.
 SYNTAX
 @example
 ncpdq [-3] [-4] [-5] [-6] [-7] [-A] [-a [-]@var{dim}[, at dots{}]] [-C] [-c]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]] [-F] [--fl_fmt @var{fl_fmt}]
 [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [-h] [--hdf] [--hdr_pad @var{nbr}]
 [-L @var{dfl_lvl}] [-l @var{path}] [-M @var{pck_map}] [--mrd]
@@ -21768,8 +21930,8 @@ changing variable dimensionality, including the record dimension.
 SYNTAX
 @example
 ncra [-3] [-4] [-5] [-6] [-7] [-A] [-C] [-c] [--cb]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}][,[@var{subcycle}]]]] [-F] [--fl_fmt @var{fl_fmt}]
 [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [-h] [--hdf] [--hdr_pad @var{nbr}] 
 [-L @var{dfl_lvl}] [-l @var{path}] [--mro] [-N] [-n @var{loop}] 
@@ -22017,8 +22179,8 @@ The last example
 SYNTAX
 @example
 ncrcat [-3] [-4] [-5] [-6] [-7] [-A] [-C] [-c]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}][,[@var{subcycle}]]]] [-F] [--fl_fmt @var{fl_fmt}]
 [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [-h] [--hdr_pad @var{nbr}]
 [-L @var{dfl_lvl}] [-l @var{path}] [--md5_digest] [-n @var{loop}]
@@ -22153,7 +22315,7 @@ ncrcat -d time,6.,54. ??.nc 8506_8906.nc
 SYNTAX
 @example
 ncremap [-3] [-4] [-5] [-6] [-7] 
-[-a @var{alg_typ}] [-D @var{dbg_lvl}] [-d @var{dst_fl}] [--fl_fmt=@var{fl_fmt}] 
+[-a @var{alg_typ}] [--a2o] [-D @var{dbg_lvl}] [-d @var{dst_fl}] [--fl_fmt=@var{fl_fmt}] 
 [-G @var{grd_sng}] [-g @var{grd_dst}] [-I @var{drc_in}] [-i @var{input-file}] [-j @var{job_nbr}]
 [-L @var{dfl_lvl}] [-M] [-m @var{map_fl}]
 [--msk_dst=@var{msk_dst}] [--msk_out=@var{msk_out}] [--msk_src=@var{msk_src}] [--mss_val=@var{mss_val}]
@@ -22165,7 +22327,7 @@ ncremap [-3] [-4] [-5] [-6] [-7]
 [-U] [-u @var{unq_sfx}] [--ugrid=@var{ugrid-file}]
 [-V @var{rgr_var}] [-v @var{var_lst}[, at dots{}]] [--version] [--vrb=@var{vrb_lvl}] 
 [-W @var{wgt_opt}] [-w @var{wgt_cmd}] [-x @var{xtn_lst}[, at dots{}]]
-[@var{input-file(s)}] [@var{output-file}]
+[@var{input-files}] [@var{output-file}]
 @end example
 
 @noindent
@@ -22264,12 +22426,32 @@ Features common to many operators are described in
 
 @html
 <a name="alg_typ"></a> <!-- http://nco.sf.net/nco.html#alg_typ -->
+<a name="neareststod"></a> <!-- http://nco.sf.net/nco.html#neareststod -->
+<a name="nearestdtos"></a> <!-- http://nco.sf.net/nco.html#nearestdtos -->
+<a name="patch"></a> <!-- http://nco.sf.net/nco.html#patch -->
+<a name="bilinear"></a> <!-- http://nco.sf.net/nco.html#bilinear -->
+<a name="bilin"></a> <!-- http://nco.sf.net/nco.html#bilin -->
+<a name="conserve"></a> <!-- http://nco.sf.net/nco.html#conserve -->
+<a name="aave"></a> <!-- http://nco.sf.net/nco.html#aave -->
+<a name="fv2se_flx"></a> <!-- http://nco.sf.net/nco.html#fv2se_flx -->
+<a name="se2fv_flx"></a> <!-- http://nco.sf.net/nco.html#se2fv_flx -->
+<a name="fv2se_stt"></a> <!-- http://nco.sf.net/nco.html#fv2se_stt -->
+<a name="se2fv_stt"></a> <!-- http://nco.sf.net/nco.html#se2fv_stt -->
+<a name="fv2se_alt"></a> <!-- http://nco.sf.net/nco.html#fv2se_alt -->
+<a name="se2fv_alt"></a> <!-- http://nco.sf.net/nco.html#se2fv_alt -->
 @end html
 @cindex @code{-a @var{alg_typ}}
 @cindex @var{alg_typ}
 @cindex @code{--alg_typ}
 @cindex @code{--algorithm}
 @cindex @code{--regrid_algorithm}
+ at cindex @code{neareststod}
+ at cindex @code{nearestdtos}
+ at cindex @code{patch}
+ at cindex @code{bilinear}
+ at cindex @code{bilin}
+ at cindex @code{aave}
+ at cindex @code{conserve}
 @item -a @var{alg_typ} (@code{--alg_typ}, @code{--algorithm}, @code{--regrid_algorithm})
 Specifies the interpolation algorithm for weight-generation for use by
 @command{ESMF_RegridWeightGen} (@acronym{ERWG}) and/or TempestRemap.
@@ -22279,8 +22461,8 @@ change interpolation algorithms than other options
 (that can be changed with @samp{-E @var{esmf_opt}}).
 The @var{alg_typ} argument must be @code{tempest} or one of
 @acronym{ERWG}'s five interpolation algorithms:
- at code{bilinear} (default, acceptable abbreviation is @code{bln}), 
- at code{conserve} (or @code{conservative} or @code{cns}), 
+ at code{bilinear} (default, acceptable abbreviations are @code{bilin}, @code{bln}), 
+ at code{conserve} (or @code{conservative}, @code{cns}, or @code{aave}), 
 @code{nearestdtos} (or @code{nds} or @code{dtos}), 
 @code{neareststod} (or @code{nds} or @code{stod}), 
 and @code{patch} (or @code{pch} or @code{ptc}). 
@@ -22342,7 +22524,7 @@ ncremap -a tempest --src_grd=se.g --dst_grd=fv.nc -m map.nc \
 @end example
 
 The full list of supported canonical algorithm names, their synonyms,
-and boutique options passed to @command{GenerateOfflineMap}) are:
+and boutique options passed to @command{GenerateOfflineMap} are:
 @table @asis
 @item @code{se2fv_flx} (synonyms @code{mono_se2fv}, @code{conservative_monotone_se2fv})
 Options: @samp{--in_type cgll --in_np 4 --out_type fv --out_double --mono}
@@ -22366,10 +22548,77 @@ Full documentation of the @acronym{E3SM}-recommended boutique options
 for TempestRemap is
 @uref{https://acme-climate.atlassian.net/wiki/spaces/Docs/pages/178848194/Transition+to+TempestRemap+for+Atmosphere+grids, here}
 (may require @acronym{E3SM}-authorization to view).
-Let us know iff you would like other boutique TempestRemap switch sets
+Let us know if you would like other boutique TempestRemap switch sets
 added as canonical options for @command{ncremap}.
 
 @html
+<a name="a2o"></a> <!-- http://nco.sf.net/nco.html#a2o -->
+<a name="atm2ocn"></a> <!-- http://nco.sf.net/nco.html#atm2ocn -->
+<a name="b2l"></a> <!-- http://nco.sf.net/nco.html#b2l -->
+<a name="big2ltl"></a> <!-- http://nco.sf.net/nco.html#big2ltl -->
+<a name="l2s"></a> <!-- http://nco.sf.net/nco.html#l2s -->
+<a name="lrg2sml"></a> <!-- http://nco.sf.net/nco.html#lrg2sml -->
+ at end html
+ at cindex @command{GenerateOverlapMesh}
+ at cindex @var{a2o}
+ at cindex @code{--a2o}
+ at cindex @code{--atm2ocn}
+ at cindex @code{--b2l}
+ at cindex @code{--big2ltl}
+ at cindex @code{--l2s}
+ at cindex @code{--lrg2sml}
+ at item --a2o (@code{--a2o}, @code{--atm2ocn}, @code{--b2l}, @code{--big2ltl}, @code{--l2s}, @code{--lrg2sml})
+Use one of these flags (that take no arguments) to cause TempestRemap to
+generate mapping weights from a source grid that has more coverage than
+the destination grid, i.e., the destination grid is a subset of the
+source. 
+When computing the intersection of two meshes, TempestRemap uses an
+algorithm (in an executable named @command{GenerateOverlapMesh}) that
+expects the mesh with less coverage to be the first grid, and the
+grid with greater coverage to be the second, regardless of the mapping
+direction.
+By default, @command{ncremap} supplies the source grid first and the
+destination second, but this order causes @command{GenerateOverlapMesh}  
+(which is agnostic about ordering when the grids have the same coverage)
+to fail when the source grid covers regions not in the destination grid.  
+For example, a global atmosphere grid has more coverage than a global
+ocean grid, so that remapping from atmosphere-to-ocean would require
+invoking the @samp{--atm2ocn} switch:
+ at example
+# Use --a2o to generate weights for "big" to "little" remaps:
+ncremap --a2o -a se2fv_flx --src_grd=atm.nc --dst_grd=ocn.nc -m map.nc
+# Otherwise, omit it:
+ncremap       -a se2fv_flx --src_grd=ocn.nc --dst_grd=atm.nc -m map.nc
+ncremap       -a se2fv_flx --src_grd=atm1.nc --dst_grd=atm2.nc -m map.nc
+# Only necessary when generating, not applying, weights:
+ncremap -m atm2ocn.nc in.nc out.nc
+ at end example
+As shown in the second example above, remapping from global
+ocean-to-atmosphere grids does not require (and should not invoke) this
+switch. 
+The third example shows that the switch is only needed when
+ at emph{generating} weights, not when applying them. 
+The switch is never needed (and is ignored) when generating weights
+with @acronym{ERWG} (which constructs the intersection mesh with a
+different algorithm than TempestRemap).
+Attempting to remap a larger source grid to a subset destination grid
+without using @samp{--a2o} causes @command{GenerateOverlapMesh} to emit
+an error (and a potential workaround) like this:
+ at example
+....Nearest target face 130767
+....ERROR: No overlapping face found
+....This may be caused by mesh B being a subset of mesh A
+....Try swapping order of mesh A and B, or override with --allow_no_overlap
+....EXCEPTION (../src/OverlapMesh.cpp, Line 1738) Exiting
+ at end example
+The @samp{--a2o} switch and its synonyms are available in @acronym{NCO}
+version 4.7.3 (February, 2018) and later.
+Currently (January, 2018) @code{ncremap} has no means of transmitting
+options (like @samp{--allow_no_overlap} to
+ at command{GenerateOverlapMesh}.
+Please let us know if this capability is important to you.
+
+ at html
 <a name="dbg_lvl"></a> <!-- http://nco.sf.net/nco.html#dbg_lvl -->
 @end html
 @cindex @code{-D @var{dbg_lvl}}
@@ -23461,6 +23710,8 @@ The @samp{-x} option causes @command{ncremap} to treat the variables in
 the gridcell boundaries. 
 Support for extensive variables during regridding is nascent.
 Currently variables marked as extensive are summed, not regridded.
+We are interested in ``real-world'' situations that require regridding
+extensive variables, please contact us if you have one.
 @end table
 
 @unnumberedsubsec Limitations to @command{ncremap}
@@ -23777,8 +24028,8 @@ whose attributes are to be renamed.
 <a name="bug_nc4_rename"></a> <!-- http://nco.sf.net/nco.html#bug_nc4_rename -->
 @end html
 @cartouche
-Caveat lector: Unforunately from 2007--present (November, 2017) the
-netCDF library (versions 4.0.0--4.5.0) contains bugs or limitations
+Caveat lector: Unforunately from 2007--present (February, 2018) the
+netCDF library (versions 4.0.0--4.6.0) contains bugs or limitations
 that sometimes prevent @acronym{NCO} from correctly renaming coordinate
 variables, dimensions, and groups in netCDF4 files. 
 (To our knowledge the netCDF library calls for renaming always work
@@ -24015,39 +24266,39 @@ Clearly, renaming dimensions in netCDF4 files is non-trivial.
 The penultimate chapter in this saga is a netCDF4 bug discovered in
 September, 2015, and present in versions 4.3.3.1 (and possibly earlier 
 versions too) and later.
-As of this writing (November, 2017), this bug is still present in netCDF4
-version 4.5.1-development. 
+As of this writing (February, 2018), this bug is still present in netCDF4
+version 4.6.0.1-development. 
 This bug causes @command{ncrename} to create corrupted output files
 when attempting to rename two or more dimensions simultaneously.
 The workaround is to rename the dimensions sequentially, in two separate  
 @command{ncrename} calls.
 @example
 @verbatim
-# Demonstrate bug in netCDF4 library versions 4.3.3.1--4.5.0+
+# Demonstrate bug in netCDF4 library versions 4.3.3.1--4.6.0+
 ncrename -O -d lev,z -d lat,y -d lon,x ~/nco/data/in_grp.nc ~/foo.nc # Completes but file is unreadable
 ncks -v one ~/foo.nc # File is unreadable (multiple dimensions with same ID?)
 @end verbatim
 @end example
 
 A new netCDF4 renaming bug was discovered in March, 2017.
-It is present in version 4.4.1 (and possibly earlier versions too) and later.
-As of this writing (November, 2017), this bug is still present in netCDF4
-version 4.5.1-development. 
+It is present in versions 4.4.1--4.6.0 (and possibly earlier versions).
+As of this writing (February, 2018), this bug is not present in netCDF4
+version 4.6.0.1-development (Yay Ed!). 
 This bug causes @command{ncrename} to fail to rename a variable when the
 result would become a coordinate.
 The workaround is to convert to netCDF3, then rename, then convert back
 to netCDF4.
 @example
 @verbatim
-# Demonstrate bug in netCDF4 library versions 4.4.1--4.5.0+
+# Demonstrate bug in netCDF4 library versions 4.4.1--4.6.0+
 ncrename -O -v non_coord,coord ~/nco/data/in_grp.nc ~/foo.nc # Fails (HDF error)
 @end verbatim
 @end example
 
 Last but not least is a potentially new netCDF4 bug discovered in November, 2017.
-It is present in versions 4.4.1.1--4.5.0 (and possibly earlier versions too).
-As of this writing (November, 2017), this bug is still present in netCDF4
-version 4.5.1-development. 
+It is present in versions 4.4.1.1--4.6.0 (and possibly earlier versions too).
+As of this writing (February, 2018), this bug is not present in netCDF4
+version 4.6.0.1-development (Yay Ed!). 
 This bug causes @command{ncrename} to fail to rename a variable when the
 result would become a coordinate.
 Oddly this issue shows that simultaneously renaming a dimension and
@@ -24057,7 +24308,7 @@ The workaround is to convert to netCDF3, then rename, then convert back
 to netCDF4.
 @example
 @verbatim
-# Demonstrate bug in netCDF4 library versions 4.4.1--4.5.0+
+# Demonstrate bug in netCDF4 library versions 4.4.1--4.6.0
 # 20171107: https://github.com/Unidata/netcdf-c/issues/597
 # Create test dataset
 ncks -O -C -v lon ~/nco/data/in_grp.nc ~/in_grp.nc
@@ -24145,8 +24396,8 @@ Variables not prefixed with a period (@code{global}) must be present.
 SYNTAX
 @example
 ncwa [-3] [-4] [-5] [-6] [-7] [-A] [-a @var{dim}[, at dots{}]] [-B @var{mask_cond}] [-b] [-C] [-c]
-[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}] [--cnk_map @var{map}]
-[--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
+[--cnk_byt @var{sz_byt}] [--cnk_csh @var{sz_byt}] [--cnk_dmn @var{nm}, at var{sz_lmn}]
+[--cnk_map @var{map}] [--cnk_min @var{sz_byt}] [--cnk_plc @var{plc}] [--cnk_scl @var{sz_lmn}]
 [-D @var{dbg}] [-d @var{dim},[@var{min}][,[@var{max}][,[@var{stride}]]] [-F] [--fl_fmt @var{fl_fmt}]
 [-G @var{gpe_dsc}] [-g @var{grp}[, at dots{}]] [--glb ...] [-h] [--hdr_pad @var{nbr}] [-I]
 [-L @var{dfl_lvl}] [-l @var{path}] [-M @var{mask_val}] [-m @var{mask_var}] [-N] 
diff --git a/man/Makefile.in b/man/Makefile.in
index 375ea04..a801cae 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -245,8 +245,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/man/ncks.1 b/man/ncks.1
index 96852db..f3ca133 100644
--- a/man/ncks.1
+++ b/man/ncks.1
@@ -29,9 +29,9 @@ dbg_lvl]
 .IR min ][,[
 .IR max ]][,[
 .IR stride ]]]
-[-F] [--fl_fmt=fmt] [\-\-fix_rec_dmn
-.IR dim ]
-[\-G
+[-F] [\-\-fl_fmt=fmt] [\-\-fix_rec_dmn
+.IR dim ] [\-\-fmt_val
+.IR fmt ] [\-G
 .IR gpe_dsc ]
 [\-g  
 .IR grp [,...]]
@@ -57,12 +57,13 @@ dbg_lvl]
 [\-\-ppc 
 .IR var1 [,
 .IR var2 [,...]]=
-.IR prc ]]
+.IR prc ]] [\-\-prn_fl
+.IR print-file ]
 [\-Q] [\-q]
 [\-R] [\-r] [\-\-rad] [\-\-ram_all]
 [\-\-rgr
 .IR key=
-.IR val ]]
+.IR val ]
 [\--rnr
 .IR wgt ] [\-s 
 .IR format ] [\-t
diff --git a/man/ncremap.1 b/man/ncremap.1
index 8d59326..99a530e 100644
--- a/man/ncremap.1
+++ b/man/ncremap.1
@@ -8,7 +8,7 @@ ncremap \- netCDF Remapper
 .SH SYNTAX
 ncremap
 [\-3] [\-4] [\-5] [\-6] [\-7] [\-a
-.IR alg_typ ]
+.IR alg_typ ] [\--a2o ]
 [\-D
 .IR dbg_lvl ] 
 [\-d
diff --git a/src/Makefile.in b/src/Makefile.in
index 620a68b..11fb6af 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -274,8 +274,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/src/nco++/Invoke.cc b/src/nco++/Invoke.cc
index 2cb1651..12dff33 100644
--- a/src/nco++/Invoke.cc
+++ b/src/nco++/Invoke.cc
@@ -40,7 +40,6 @@ int kdx;
 int mdx;
 int lcl_sz;
 int nbr_sz;
-var_sct *var;
 RefAST tr;
 
  static int wlk_nbr; // Same as number of threads
@@ -92,7 +91,7 @@ RefAST tr;
    } 
    */
 #ifdef _OPENMP
-#pragma omp parallel for default(none) private(kdx,wlk_lcl,var,tr) shared(wlk_ptr,idx,nbr_sz,inn_vtr )
+#pragma omp parallel for default(none) private(kdx,wlk_lcl,tr) shared(wlk_ptr,idx,nbr_sz,inn_vtr )
 #endif
    for(kdx=0 ;kdx< nbr_sz; kdx++) {      
      wlk_lcl= wlk_ptr[omp_get_thread_num()];
diff --git a/src/nco++/Makefile.in b/src/nco++/Makefile.in
index c23c244..c1c7bbc 100644
--- a/src/nco++/Makefile.in
+++ b/src/nco++/Makefile.in
@@ -294,8 +294,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/src/nco++/Makefile.old b/src/nco++/Makefile.old
index 76d9a3f..404c78f 100644
--- a/src/nco++/Makefile.old
+++ b/src/nco++/Makefile.old
@@ -229,7 +229,7 @@ else
 endif # endif PRC
 
 # NB: CPP_TKN is recursively expanded variable, define only when components are ready
-CPP_TKN = ${USR_TKN} -D${PVM_ARCH} -DNO_NETCDF_2 -DVERSION='${VRS_SNG}' -DHOSTNAME='${HOSTNAME}' -DUSER='${USER}' -DNCO_ABORT_ON_ERROR
+CPP_TKN = ${USR_TKN} -D${PVM_ARCH} -DNO_NETCDF_2 -DVERSION='${VRS_SNG}' -DHOSTNAME='${HOST}' -DUSER='${USER}' -DNCO_ABORT_ON_ERROR
 ifndef LFLAGS # Flags for Flex (Lex)
  LFLAGS := -P${NCO_YY_PFX}
 endif
diff --git a/src/nco++/NcapVarVector.cc b/src/nco++/NcapVarVector.cc
index 75af424..00423f8 100644
--- a/src/nco++/NcapVarVector.cc
+++ b/src/nco++/NcapVarVector.cc
@@ -54,7 +54,6 @@ long NcapVarVector::findi(std::string s_fnm){
 
 // used in attribute propagation
 long NcapVarVector::find_lwr(std::string s_fnm){
-    bool bmth;
     long lret;
     std::string s_fl;
     NcapVar* Ntmp;
@@ -144,7 +143,6 @@ void NcapVarVector::sort(){
 // deletes that and all associated attributes 
 // of the form var_m@
 void NcapVarVector::erase_all(std::string var_nm){
-  bool match=false;
   long sz;
   long idx;
   long srt=-1;
@@ -159,12 +157,11 @@ void NcapVarVector::erase_all(std::string var_nm){
   {
     if( (*this)[idx]->xpr_typ==ncap_att &&  (*this)[idx]->getVar()==var_nm)
       if(srt==-1) srt=idx;    
-    else      
-      if(srt>=0)
-      {    
+    else if(srt>=0)
+    {    
 	end=idx-1;
         break; 
-      } 
+    } 
   }  
 
   if(srt >=0) 
diff --git a/src/nco++/VarOpNew.hh b/src/nco++/VarOpNew.hh
index 5050179..c1604e2 100644
--- a/src/nco++/VarOpNew.hh
+++ b/src/nco++/VarOpNew.hh
@@ -315,7 +315,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp1[idx] != tmss )
 	      tp1[idx]+=*tp2;
-            else tp1[idx]=tmss;
 	    
        if(!bun) 
           { tp_swp=tp1;tp1=tp2;tp2=tp_swp;}    
@@ -332,7 +331,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 		for(idx=0 ; idx<sz ; idx++)
 		  if( tp1[idx] != tmss )
 		    tp1[idx]-=*tp2;
-		  else tp1[idx]=tmss;
 	  }
           else
 	  {
@@ -342,7 +340,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 		for(idx=0 ; idx<sz ; idx++)
 		  if( tp2[idx] != tmss )
 		    tp2[idx]=*tp1-tp2[idx];
-		  else tp2[idx]=tmss;
 	  }
           break;
 
@@ -359,7 +356,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++){
 	    if( tp1[idx] != tmss )
 	      tp1[idx]*=*tp2;
-	    else tp1[idx]=tmss;
 	  }
 	}  
         if(!bun) 
@@ -376,7 +372,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp1[idx] != tmss )
 	      tp1[idx] /= *tp2;
-	    else tp1[idx]=tmss;
 	  
 	}  
         else
@@ -387,7 +382,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp2[idx] != tmss )
 	      tp2[idx]= *tp1 / tp2[idx];
-	    else tp2[idx]=tmss;
 	  
 	}  
 
@@ -415,8 +409,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp1[idx] != tmss )
 	      tp1[idx]=tp1[idx] &&  *tp2;
-	    else tp1[idx]=tmss;
-	  
 	 
         if(!bun) 
           { tp_swp=tp1;tp1=tp2;tp2=tp_swp;}    
@@ -433,9 +425,8 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++) tp1[idx]=tp1[idx] ||  *tp2;
 	else
 	  for(idx=0 ; idx<sz ; idx++)
-	    if( tp1[idx] != tmss && tp2[idx] != tmss)
+	    if( tp1[idx] != tmss )
 	      tp1[idx]=tp1[idx] ||  *tp2;
-	    else tp1[idx]=tmss;
 	
         if(!bun) 
           { tp_swp=tp1;tp1=tp2;tp2=tp_swp;}    
@@ -452,7 +443,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp1[idx] != tmss )
 	      tp1[idx]=tp1[idx] < *tp2;
-	    else tp1[idx]=tmss;
 	} 
         else
         {
@@ -462,7 +452,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp2[idx] != tmss )
 	      tp2[idx]=*tp1 < tp2[idx];
-	    else tp2[idx]=tmss;
 	}  
         break;
 
@@ -476,7 +465,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp1[idx] != tmss )
 	      tp1[idx]=tp1[idx] > *tp2;
-	    else tp1[idx]=tmss;
 	  
 	}  
         else
@@ -487,7 +475,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp2[idx] != tmss )
 	      tp2[idx]=*tp1 > tp2[idx];
-	    else tp2[idx]=tmss;
 	  
 	}  
         break;
@@ -503,7 +490,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp1[idx] != tmss )
 	      tp1[idx]=tp1[idx] >= *tp2;
-	    else tp1[idx]=tmss;
 	  
 	}  
         else
@@ -514,7 +500,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp2[idx] != tmss )
 	      tp2[idx]=*tp1 >= tp2[idx];
-	    else tp2[idx]=tmss;
 	  
 	}  
         break;
@@ -529,7 +514,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp1[idx] != tmss )
 	      tp1[idx]=tp1[idx] <= *tp2;
-	    else tp1[idx]=tmss;
 	  
 	}  
         else
@@ -540,8 +524,6 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
 	  for(idx=0 ; idx<sz ; idx++)
 	    if( tp2[idx] != tmss )
 	      tp2[idx]= *tp1 <= tp2[idx];
-	    else tp2[idx]=tmss;
-	  
 	}  
         break;
 
@@ -549,24 +531,21 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
       case EQ:
         if(bun) 
         {
-	if(!bmss) 
-	  for(idx=0 ; idx<sz ; idx++) tp1[idx]=tp1[idx] == *tp2;
-	else
-	  for(idx=0 ; idx<sz ; idx++)
-	    if( tp1[idx] != tmss )
-	      tp1[idx]=tp1[idx] == *tp2;
-	    else tp1[idx]=tmss;
-	  
+	  if(!bmss) 
+	    for(idx=0 ; idx<sz ; idx++) tp1[idx]=tp1[idx] == *tp2;
+	  else
+	    for(idx=0 ; idx<sz ; idx++)
+	      if( tp1[idx] != tmss )
+		tp1[idx]=tp1[idx] == *tp2;
 	}  
         else
         {
-	if(!bmss) 
-	  for(idx=0 ; idx<sz ; idx++) tp2[idx]=*tp1 == tp2[idx];
-	else
-	  for(idx=0 ; idx<sz ; idx++)
-	    if( tp2[idx] != tmss )
-	      tp2[idx]=*tp1 == tp2[idx];
-	    else tp2[idx]=tmss;
+	  if(!bmss) 
+	    for(idx=0 ; idx<sz ; idx++) tp2[idx]=*tp1 == tp2[idx];
+	  else
+	    for(idx=0 ; idx<sz ; idx++)
+	      if( tp2[idx] != tmss )
+		tp2[idx]=*tp1 == tp2[idx];
 	  
 	}  
         break;
@@ -575,23 +554,21 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
       case NEQ:
         if(bun) 
         {
-	if(!bmss) 
-	  for(idx=0 ; idx<sz ; idx++) tp1[idx]=tp1[idx] != *tp2;
-	else
-	  for(idx=0 ; idx<sz ; idx++)
-	    if( tp1[idx] != tmss )
-	      tp1[idx]=tp1[idx] != *tp2;
-	    else tp1[idx]=tmss;
+	  if(!bmss) 
+	    for(idx=0 ; idx<sz ; idx++) tp1[idx]=tp1[idx] != *tp2;
+	  else
+	    for(idx=0 ; idx<sz ; idx++)
+	      if( tp1[idx] != tmss )
+		tp1[idx]=tp1[idx] != *tp2;
 	}  
         else
         {
-	if(!bmss) 
-	  for(idx=0 ; idx<sz ; idx++) tp2[idx]=*tp1 != tp2[idx];
-	else
-	  for(idx=0 ; idx<sz ; idx++)
-	    if( tp2[idx] != tmss )
-	      tp2[idx]=*tp1 != tp2[idx];
-	    else tp2[idx]=tmss;
+	  if(!bmss) 
+	    for(idx=0 ; idx<sz ; idx++) tp2[idx]=*tp1 != tp2[idx];
+	  else
+	    for(idx=0 ; idx<sz ; idx++)
+	      if( tp2[idx] != tmss )
+		tp2[idx]=*tp1 != tp2[idx];
 	}  
         break;
 
@@ -600,31 +577,31 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
       case FLTHAN:
         if(bun) 
         { 
-	if(!bmss) 
-	  for(idx=0 ; idx<sz ; idx++) 
-           if(tp1[idx] >= *tp2) tp1[idx]=*tp2;
-	else
-	{  
-          for(idx=0 ; idx<sz ; idx++)
-            if(tp1[idx]==tmss )
-               tp1[idx]=tmss; 
-	    else if(tp1[idx] >= *tp2  )
-	      tp1[idx]=*tp2;
-	}  
+	  if(!bmss)
+	  {  
+	      for(idx=0 ; idx<sz ; idx++) 
+		if(tp1[idx] >= *tp2) tp1[idx]=*tp2;
+	  }  
+	  else
+	  {  
+	      for(idx=0 ; idx<sz ; idx++)
+		if(  tp1[idx]!=tmss &&  tp1[idx] >= *tp2  )
+		  tp1[idx]=*tp2;
+	  }  
 	}
         else
         { 
-	if(!bmss) 
-	  for(idx=0 ; idx<sz ; idx++) 
-           if(*tp1 >= tp2[idx]) tp2[idx]=*tp1;
-	else
-	{  
-	  for(idx=0 ; idx<sz ; idx++)
-            if(tp2[idx]==tmss )
-               tp2[idx]=tmss; 
-	    else if(*tp1 >= tp2[idx]  )
-	      tp2[idx]=*tp1;
-	}  
+	  if(!bmss)
+	  {  
+	      for(idx=0 ; idx<sz ; idx++) 
+		if(*tp1 >= tp2[idx]) tp2[idx]=*tp1;
+	  }  
+	  else
+	  {  
+	      for(idx=0 ; idx<sz ; idx++)
+		if(tp2[idx] != tmss &&  *tp1 >= tp2[idx]  )
+		  tp2[idx]=*tp1;
+	  } 
 	}
         break;
 
@@ -632,29 +609,31 @@ var_sct* tmp_var_var_op_unequal(var_sct* var1, var_sct* var2, int op) {
       case FGTHAN:
       if(bun)
       {
-	if(!bmss) 
+	if(!bmss)
+	{  
 	  for(idx=0 ; idx<sz ; idx++) 
            if(tp1[idx] <= *tp2)
              tp1[idx]=*tp2;
+	}  
 	else
+	{  
 	  for(idx=0 ; idx<sz ; idx++)
-            if(tp1[idx]==tmss )
-               tp1[idx]=tmss; 
-            else if(tp1[idx] <= *tp2 )
-	      tp1[idx]=*tp2;
+            if(tp1[idx]!=tmss &&  tp1[idx] <= *tp2 )
+	       tp1[idx]=*tp2;
+	}  
       }
       else
       {
-	if(!bmss) 
+	if(!bmss)
+	{  
 	  for(idx=0 ; idx<sz ; idx++) 
 	    if(tp2[idx]>*tp1)
                tp2[idx]=*tp1;
+	}  
 	else
 	{
 	  for(idx=0 ; idx<sz ; idx++)
-            if(tp2[idx]==tmss )
-               tp2[idx]=tmss; 
-            else if(tp2[idx]>*tp1 )
+             if(tp2[idx]!=tmss &&  tp2[idx]>*tp1 )
 	      tp2[idx]=*tp1;
         }
       }
diff --git a/src/nco++/fmc_all_cls.cc b/src/nco++/fmc_all_cls.cc
index 2754e0a..da114f3 100644
--- a/src/nco++/fmc_all_cls.cc
+++ b/src/nco++/fmc_all_cls.cc
@@ -29,9 +29,9 @@
   } 
   var_sct * cnv_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("cnv_cls::fnd");
-    int nbr_fargs;
+    int nbr_fargs=0;
     int fdx=fmc_obj.fdx();
-    var_sct *var1;
+    var_sct *var1=NULL_CEWI;
    
     std::string sfnm =fmc_obj.fnm(); //method name
     //n.b fargs is an imaginary node -and is ALWAYS present
@@ -88,7 +88,7 @@
             int idx;
             int nbr_dim;
             int avg_nbr_dim; 
-            dmn_sct **dim;
+            dmn_sct **dim=NULL_CEWI;
             dmn_sct **dim_nw=NULL_CEWI;  
             var_sct *var=NULL_CEWI;
             var_sct *var1=NULL_CEWI;
@@ -114,10 +114,10 @@
             if(expr)
                vtr_args.push_back(expr);
 
-            if(tr=fargs->getFirstChild()) {
+            if((tr=fargs->getFirstChild())) {
               do  
 	        vtr_args.push_back(tr);
-              while(tr=tr->getNextSibling());    
+              while((tr=tr->getNextSibling()));    
             } 
       
             nbr_args=vtr_args.size();
@@ -397,10 +397,10 @@
     if(expr)
       vtr_args.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
       do  
 	vtr_args.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
      nbr_args=vtr_args.size();  
@@ -608,9 +608,9 @@
   
 var_sct * utl_cls::is_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("utl_cls::is_fnd");
-    int nbr_args;
+    // int nbr_args;
     int fdx=fmc_obj.fdx();
-    long icnt;
+    long icnt=0;
     var_sct *var=NULL_CEWI;
     nc_type styp=NC_INT; // used to hold the mapping type either NC_INT or NC_UINT64 
     std::string sfnm =fmc_obj.fnm(); //method name
@@ -632,7 +632,7 @@ var_sct * utl_cls::is_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &
 #endif 
   
 
-    nbr_args=args_vtr.size(); 
+
     var=walker.out(args_vtr[0] );
 
     if(prs_arg->ntl_scn){
@@ -673,7 +673,7 @@ var_sct * utl_cls::is_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &
 var_sct * utl_cls::get_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("utl_cls::get_fnd");
     int nbr_args;
-    int fdx=fmc_obj.fdx();
+    // int fdx=fmc_obj.fdx();
     var_sct *var=NULL_CEWI;
     var_sct *var_ret=NULL_CEWI;
     std::string sfnm =fmc_obj.fnm(); //method name
@@ -757,12 +757,8 @@ var_sct * utl_cls::linear_fill_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr,
   int nbr_dim;
   int nbr_args;
   int re_dim_nbr;
-  int swp_nbr;
-  int fdx=fmc_obj.fdx();
-  long icnt;
   var_sct *var=NULL_CEWI;
   var_sct *var_int=NULL_CEWI;
-  nc_type styp=NC_INT; // used to hold the mapping type either NC_INT or NC_UINT64
   std::string sfnm =fmc_obj.fnm(); //method name
   std::string var_nm;
   std::string dim_nm;
@@ -896,11 +892,9 @@ var_sct * utl_cls::linear_fill_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr,
 var_sct * utl_cls::fill_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("utl_cls::fill_fnd");
   int idx;
-  int jdx;
   int nbr_dim;
   int nbr_args;
   int fdx=fmc_obj.fdx();
-  long icnt;
   double *lat_dp=NULL_CEWI;
   double *lon_dp=NULL_CEWI;
   nc_type lcl_typ;
@@ -1130,7 +1124,6 @@ int utl_cls::weight_fill(var_sct* var, void* msk_vp, double *lat, double *lon){
   int nbr_dim=var->nbr_dim;
   int imax_loop=1000;
   int num_miss;
-  int cnt=0;
   int lat_sz;
   int lon_sz;
   size_t slb_sz;
@@ -1187,7 +1180,7 @@ int utl_cls::weight_fill(var_sct* var, void* msk_vp, double *lat, double *lon){
             if (xdx < 0 || xdx >= lat_sz) continue;
 
             for (int ydx = jdx - 1; ydx <= jdx + 1; ydx++) {
-              if (ydx < 0 || ydx >= lon_sz || xdx == idx && ydx == jdx) continue;
+              if (ydx < 0 || ydx >= lon_sz || (xdx == idx && ydx == jdx)) continue;
 
               if (msk_dp[xdx][ydx] != dbl_mss_val) {
                 dist = point2point(lat[idx], lon[jdx], lat[xdx], lon[ydx]);
@@ -1244,18 +1237,9 @@ double alpha;
 
 var_sct * utl_cls::mask_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker) {
   const std::string fnc_nm("utl_cls::mask_fnd");
-  nco_bool do_permute = False;
-  int idx;
-  int jdx;
-  int nbr_dim;
   int nbr_args;
-  int re_dim_nbr;
-  int swp_nbr;
-  int fdx = fmc_obj.fdx();
-  long icnt;
   var_sct *var = NULL_CEWI;
   var_sct * var_miss= NULL_CEWI;
-  nc_type styp = NC_INT; // used to hold the mapping type either NC_INT or NC_UINT64
   std::string sfnm = fmc_obj.fnm(); //method name
   std::string var_nm;
   std::string dim_nm;
@@ -1270,7 +1254,6 @@ var_sct * utl_cls::mask_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
 
   nbr_args = args_vtr.size();
   var = walker.out(args_vtr[0]);
-  nbr_dim = var->nbr_dim;
 
   if (nbr_args == 0)
     err_prn(sfnm, "Function has been called with no arguments\n" + susg);
@@ -1369,10 +1352,10 @@ var_sct * utl_cls::mask_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
     if(expr)
       vtr_args.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
       do  
 	vtr_args.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
      nbr_args=vtr_args.size();  
@@ -1480,7 +1463,7 @@ var_sct * bsc_cls::getdims_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_
 {
   const std::string fnc_nm("bsc_cls::getndims_fnd");
     int nbr_args;
-    int fdx=fmc_obj.fdx();
+    // int fdx=fmc_obj.fdx();
     var_sct *var=NULL_CEWI;
     var_sct *var_att=NULL_CEWI;
     std::string sfnm =fmc_obj.fnm(); //method name
@@ -1649,10 +1632,10 @@ var_sct * bsc_cls::getdims_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_
     if(expr)
       vtr_args.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
       do  
 	vtr_args.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
      nbr_args=vtr_args.size();  
@@ -1712,10 +1695,10 @@ var_sct * bsc_cls::getdims_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_
     if(expr)
       vtr_args.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
       do  
 	vtr_args.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
      nbr_args=vtr_args.size();  
@@ -2016,7 +1999,7 @@ var_sct * bsc_cls::getdims_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_
              lat_flt=var2->val.fp[0];
         
              // convert lat_dbl to radians    
-             lat_flt *=  M_PI /180.0f;      
+             lat_flt *=  (float)M_PI /180.0f;      
 
              sz=var1->sz;
     
@@ -2146,10 +2129,10 @@ void mth2_cls::solar_geometry(float latitude_rad, float calendar_day_of_year, in
             if(expr)
               vtr_args.push_back(expr);
 
-            if(tr=fargs->getFirstChild()) {
+            if((tr=fargs->getFirstChild())) {
               do  
 	       vtr_args.push_back(tr);
-              while(tr=tr->getNextSibling());    
+              while((tr=tr->getNextSibling()));    
             } 
       
             nbr_args=vtr_args.size();  
@@ -2302,10 +2285,10 @@ void mth2_cls::solar_geometry(float latitude_rad, float calendar_day_of_year, in
     if(expr)
       vtr_args.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
        do  
          vtr_args.push_back(tr);
-       while(tr=tr->getNextSibling());    
+       while((tr=tr->getNextSibling()));    
     } 
       
     nbr_args=vtr_args.size();  
@@ -2483,10 +2466,10 @@ void mth2_cls::solar_geometry(float latitude_rad, float calendar_day_of_year, in
     if(expr)
       vtr_args.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
        do  
          vtr_args.push_back(tr);
-       while(tr=tr->getNextSibling());    
+       while((tr=tr->getNextSibling()));    
     } 
       
     nbr_args=vtr_args.size();  
@@ -2604,10 +2587,10 @@ var_sct *srt_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walke
   if(expr)
     vtr_args.push_back(expr);
   
-  if(tr=fargs->getFirstChild()) {
+  if((tr=fargs->getFirstChild())) {
     do  
       vtr_args.push_back(tr);
-    while(tr=tr->getNextSibling());    
+    while((tr=tr->getNextSibling()));    
   }
   
   is_mtd=(expr ? true: false);
@@ -2634,9 +2617,8 @@ var_sct *srt_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walke
 var_sct * srt_cls::imap_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("srt_cls::imap_fnd");
     int nbr_args;
-    int fdx=fmc_obj.fdx();
+    // int fdx=fmc_obj.fdx();
     var_sct *var1=NULL_CEWI;
-    var_sct *var_ret=NULL_CEWI;
     nc_type styp; // used to hold the mapping type either NC_INT or NC_UINT64 
     std::string sfnm =fmc_obj.fnm(); //method name
     std::string var_nm;
@@ -2665,8 +2647,8 @@ var_sct * srt_cls::imap_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
     (void)cast_void_nctype((nc_type)NC_UINT64,&var1->val);
 
      {
-       long idx;
-       long sz; 
+       unsigned long idx;
+       unsigned long sz; 
        nco_uint64 *lp_mp;  
        nco_uint64 *lp_mp_out;   
        sz=var1->sz;
@@ -2742,7 +2724,7 @@ var_sct * srt_cls::srt_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
           err_prn(sfnm," second argument must be a call by reference variable\n"+susg);   
 
           var_nm=args_vtr[1]->getFirstChild()->getText(); 
-          bdef=prs_arg->ncap_var_init_chk(var_nm);
+          bdef=(prs_arg->ncap_var_init_chk(var_nm)>0);
           Nvar=prs_arg->var_vtr.find(var_nm);  
            
         /*This horrible line below:
@@ -2759,7 +2741,7 @@ var_sct * srt_cls::srt_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
           variable 
 	 */
 
-          if(bdef && prs_arg->ntl_scn || bdef && !prs_arg->ntl_scn && Nvar->flg_stt==2 ){
+          if( (bdef && prs_arg->ntl_scn) || (bdef && !prs_arg->ntl_scn && Nvar->flg_stt==2) ){
             var2=prs_arg->ncap_var_init(var_nm,true);  
          }else{
 	    var2=nco_var_dpl(var1);
@@ -2893,11 +2875,11 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
       {
           char *cp_in;
           char *cp_out;
-          long idx; 
-          long jdx;
-          long sz; 
-          long sz_idx;
-          long slb_sz;
+          unsigned long idx; 
+          unsigned long jdx;
+          unsigned long sz; 
+          unsigned long sz_idx;
+          unsigned long slb_sz;
           nco_uint64 *lp_mp; 
           var_sct *var_out;
 
@@ -2929,7 +2911,7 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
             cp_out=(char*)var_out->val.vp+ (ptrdiff_t)idx*sz*slb_sz;              
             for(jdx=0 ;jdx<sz; jdx++){
               // do bounds checking for the mapping
-	      if(lp_mp[jdx] >=0 && lp_mp[jdx]< sz )
+	      if(lp_mp[jdx]< sz )
                 // copy element from var1 to var_out
                 (void)memcpy(cp_out+(ptrdiff_t)(lp_mp[jdx]*slb_sz),cp_in,slb_sz); 
 	      cp_in+=(ptrdiff_t)slb_sz;
@@ -2943,7 +2925,7 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
             cp_in=(char*)var1->val.vp+ (ptrdiff_t)idx*sz*slb_sz;              
             for(jdx=0 ;jdx<sz; jdx++){
               // do bounds checking for the mapping
-	      if(lp_mp[jdx] >=0 && lp_mp[jdx]< sz )
+	      if(lp_mp[jdx]< sz )
                 // copy element from var1 to var_out
                 (void)memcpy(cp_out,cp_in+(ptrdiff_t)(lp_mp[jdx]*slb_sz),slb_sz); 
 	      cp_out+=(ptrdiff_t)slb_sz;
@@ -2984,54 +2966,52 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
 
   var_sct *agg_idx_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
     const std::string fnc_nm("agg__idx_cls::fnd");
-		int fdx;
-		int nbr_args;
-		int idx;
-		int nbr_dim;
+    int fdx;
+    int nbr_args;
+    int idx;
+    int nbr_dim;
         
-       long sz_dim=1L;
-       long my_index=0L;
+    long sz_dim=1L;
+    long my_index=0L;
        
-		dmn_sct **dim;
-		dmn_sct **dim_nw=NULL_CEWI;  
-		var_sct *var=NULL_CEWI;
-		var_sct *var_out=NULL_CEWI;
+    var_sct *var=NULL_CEWI;
+    var_sct *var_out=NULL_CEWI;
            
-	    std::string susg;
-	    std::string sfnm=fmc_obj.fnm();
+    std::string susg;
+    std::string sfnm=fmc_obj.fnm();
 
-		RefAST aRef;
-		RefAST tr;
-		std::vector<RefAST> vtr_args; 
+    RefAST aRef;
+    RefAST tr;
+    std::vector<RefAST> vtr_args; 
        
-		nc_type mp_typ=NC_INT;
+    nc_type mp_typ=NC_INT;
 		
             
-		// de-reference 
-		prs_cls *prs_arg=walker.prs_arg;
+    // de-reference 
+    prs_cls *prs_arg=walker.prs_arg;
 
-		fdx=fmc_obj.fdx();
+    fdx=fmc_obj.fdx();
  
  
-		// Put args into vector 
-		if(expr)
-			vtr_args.push_back(expr);
-
-		if(tr=fargs->getFirstChild()) {
-			do  
-			  vtr_args.push_back(tr);
-			while(tr=tr->getNextSibling());    
-		} 
+    // Put args into vector 
+    if(expr)
+      vtr_args.push_back(expr);
+
+    if((tr=fargs->getFirstChild())) {
+      do  
+	vtr_args.push_back(tr);
+      while((tr=tr->getNextSibling()));    
+    } 
       
-		nbr_args=vtr_args.size();  
+    nbr_args=vtr_args.size();  
 
-		susg="usage: var_out="+sfnm+"(var_in)";
+    susg="usage: var_out="+sfnm+"(var_in)";
 
-		if(nbr_args==0)
-			err_prn(sfnm, " Function has been called with no arguments\n"+susg); 
+    if(nbr_args==0)
+      err_prn(sfnm, " Function has been called with no arguments\n"+susg); 
 
 
-		var=walker.out(vtr_args[0]);
+    var=walker.out(vtr_args[0]);
 		
         #ifdef ENABLE_NETCDF4
         { /* scope for fl_fmt temporary */
@@ -3209,7 +3189,6 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
     int fdx;
     int nbr_args;
     var_sct *var1;
-    var_sct *var;   
     fdx=fmc_obj.fdx(); 
     std::string susg;
     std::string sfnm =fmc_obj.fnm(); 
@@ -3224,10 +3203,10 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
     if(expr)
       args_vtr.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
       do  
 	args_vtr.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
      nbr_args=args_vtr.size();  
@@ -3282,8 +3261,6 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
   int fdx;
   int nbr_args;
   int idx;
-  int nbr_dim;
-  dmn_sct **dim;
   var_sct *var1=NULL_CEWI;
   var_sct *var2=NULL_CEWI;
   var_sct *var_ret;
@@ -3298,7 +3275,6 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
 
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;            
-  vtl_typ lcl_typ;
 
   fdx=fmc_obj.fdx();
  
@@ -3306,10 +3282,10 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
   if(expr)
       args_vtr.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+  if((tr=fargs->getFirstChild())) {
       do  
 	args_vtr.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
   nbr_args=args_vtr.size();  
@@ -3472,15 +3448,13 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
   } 
   var_sct * bnds_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("arr_cls::fnd");
-  int fdx;
+  // int fdx=fmc_obj.fdx();
   int nbr_args;
   int idx;
-  int nbr_dim;
   nc_type itype;
-  dmn_sct **dim;
   var_sct *var1=NULL_CEWI;
   var_sct *var_txt=NULL_CEWI;
-  var_sct *var_ret;
+  var_sct *var_ret=NULL_CEWI;
            
   std::string susg;
   std::string sfnm=fmc_obj.fnm();
@@ -3491,19 +3465,18 @@ var_sct * srt_cls::mst_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls
 
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;            
-  vtl_typ lcl_typ;
 
-  fdx=fmc_obj.fdx();
+  
  
 
   if(expr)
       args_vtr.push_back(expr);
 
-   if(tr=fargs->getFirstChild()) 
+  if((tr=fargs->getFirstChild())) 
    {
       do  
 	args_vtr.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
    } 
       
   nbr_args=args_vtr.size();  
@@ -3683,13 +3656,11 @@ bil_cls::bil_cls(bool flg_dbg){
 var_sct * bil_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("bil_cls::fnd");
   bool bwrp;  //if tue then wrap X and Y coo-ordinates in grid
-  bool b_rev_y;
-  bool b_rev_x;
+
   int fdx;
   int nbr_args;
-  int in_nbr_args;
+  int in_nbr_args=0;
   int idx;
-  int nbr_dim;
   var_sct *var_arr[6];
   
   nc_type in_typ;           
@@ -3702,17 +3673,17 @@ var_sct * bil_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walk
   std::vector<RefAST> vtr_args; 
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;            
-  vtl_typ lcl_typ;
   
   fdx=fmc_obj.fdx();
+  bwrp=false;
   
   if(expr)
     vtr_args.push_back(expr);
   
-  if(tr=fargs->getFirstChild()) {
+  if((tr=fargs->getFirstChild())) {
     do  
       vtr_args.push_back(tr);
-    while(tr=tr->getNextSibling());    
+    while((tr=tr->getNextSibling()));    
   } 
   
   nbr_args=vtr_args.size();  
@@ -3867,7 +3838,7 @@ void bil_cls::clc_bil_fnc(var_sct *v_xin,var_sct *v_yin, var_sct *v_din, var_sct
      y_min=(long)(lower_bound(v_yin->val.dp, v_yin->val.dp+v_yin->sz, v_yout->val.dp[jdx])-v_yin->val.dp);
 
      // do some bounds checking      
-     if(y_min==v_yin->sz || y_min==0L && v_yout->val.dp[jdx]< v_yin->val.dp[0] )   
+     if(y_min==v_yin->sz || ( y_min==0L && v_yout->val.dp[jdx]< v_yin->val.dp[0] ) )   
          err_prn(sfnm, "Bounding error with \""+string(v_yout->nm)+"\" output co-ordinate variable");   
 
      // not an exact match 
@@ -3897,7 +3868,7 @@ void bil_cls::clc_bil_fnc(var_sct *v_xin,var_sct *v_yin, var_sct *v_din, var_sct
        x_min=(long)(lower_bound(v_xin->val.dp, v_xin->val.dp+v_xin->sz, v_xout->val.dp[kdx])-v_xin->val.dp);     
 
        // do some bounds checking      
-       if(x_min==v_xin->sz || x_min==0L && v_xout->val.dp[kdx]< v_xin->val.dp[0] )   
+       if(x_min==v_xin->sz || ( x_min==0L && v_xout->val.dp[kdx]< v_xin->val.dp[0] ))   
          err_prn(sfnm, "Bounding error with \""+string(v_xout->nm)+"\" output co-ordinate variable");   
 
        // not an exact match
@@ -4150,11 +4121,8 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
 
   var_sct * cod_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("cod_cls::fnd");
-  int fdx;
+  // int fdx=fmc_obj.fdx();
   int nbr_args;
-  int nbr_dim;
-  long lret;
-  dmn_sct **dim;
   var_sct *var1=NULL_CEWI;
   var_sct *var2=NULL_CEWI;
   var_sct *var_ret;
@@ -4168,18 +4136,17 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
 
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;            
-  vtl_typ lcl_typ;
 
-  fdx=fmc_obj.fdx();
+
  
 
   if(expr)
       args_vtr.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+  if((tr=fargs->getFirstChild())) {
       do  
 	args_vtr.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
   nbr_args=args_vtr.size();  
@@ -4325,10 +4292,10 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
     int idx;
     int fdx=fmc_obj.fdx();   //index
     int nbr_args;
-    int in_nbr_args;
+    int in_nbr_args=0;
     prs_cls* prs_arg=walker.prs_arg;
-    var_sct *var_arr[4];
-    var_sct *var_out;
+    var_sct *var_arr[4]={NULL_CEWI};
+    var_sct *var_out=NULL_CEWI;
     RefAST tr;
     nc_type in_typ;  
     std::string susg;
@@ -4341,10 +4308,10 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
     if(expr)
       vtr_args.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
        do  
          vtr_args.push_back(tr);
-       while(tr=tr->getNextSibling());    
+       while((tr=tr->getNextSibling()));    
     } 
 
       
@@ -4481,8 +4448,7 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
       long vmcnt=0l; // num missing processed;   
       double mss_dbl=9.999e20; 
       double *dpi;   // input pointer
-      double *dpo;   //output pointer 
-      double *dpm;   // mask pointer;  
+      double *dpo;   //output pointer
       // save in type; 
       ostringstream os; 
       
@@ -4501,7 +4467,6 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
       
       dpo=var_out->val.dp;
       dpi=var_arr[0]->val.dp;     
-      dpm=var_arr[1]->val.dp;      
  
       // grab missing value;  
      if( var_arr[0]->has_mss_val ){
@@ -4567,7 +4532,6 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
       long m_sz;
       long x_sz;
       long y_sz;
-      size_t m_offset=0ll; 
       double mss_dbl=9.999e20; 
       double *dpi;   // input pointer
       double *dpo;   //output pointer 
@@ -4688,9 +4652,8 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
 
   var_sct *vlist_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("vlist_cls::fnd");
-  bool bret;
   int fdx;
-  int nbr_args;
+  // int nbr_args;
 
   std::string susg;
   std::string sfnm=fmc_obj.fnm();
@@ -4698,7 +4661,7 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
 
   RefAST tr;
   std::vector<RefAST> vtr_args; 
-  prs_cls *prs_arg=walker.prs_arg;
+  // prs_cls *prs_arg=walker.prs_arg;
 
   bool is_mtd;  
         
@@ -4709,10 +4672,10 @@ double bil_cls::clc_lin_ipl(double x1,double x2, double x, double Q0,double Q1){
   if(expr)
     vtr_args.push_back(expr);
 
-  if(tr=fargs->getFirstChild())
+  if((tr=fargs->getFirstChild()))
     do  
       vtr_args.push_back(tr);
-    while(tr=tr->getNextSibling());    
+    while((tr=tr->getNextSibling()));    
   
   
   is_mtd=(expr ? true: false);
@@ -4746,8 +4709,7 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   {
   const std::string fnc_nm("push_fnd::fnd");
   bool bret;
-  int idx;
-  int fdx;
+  // int fdx=fmc_obj.fdx();
   int nbr_args;
   std::string susg;
   std::string sfnm=fmc_obj.fnm();
@@ -4764,7 +4726,7 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
 
   NcapVar *Nvar=NULL;
           
-  fdx=fmc_obj.fdx();
+
 
   nbr_args=vtr_args.size();  
 
@@ -4914,17 +4876,14 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   var_sct *vlist_cls::get_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker)
   {
   const std::string fnc_nm("push_fnd::fnd");
-  bool bret;
-  int idx;
   int fdx;
   int nbr_args;
+  int rcd;
   std::string susg;
   std::string sfnm=fmc_obj.fnm();
   std::string att_nm;
 
   var_sct *var=NULL_CEWI;
-  var_sct *var_att=NULL_CEWI;
-  var_sct *var_add=NULL_CEWI;
   var_sct *var_regexp=NULL_CEWI;
   
   nc_type vtype;
@@ -4973,10 +4932,8 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
     int xtr_nbr;
     int nbr_var_fl;
     int fl_id;
-    int rcd;
-    nm_id_sct *xtr_lst; 
-    nco_string *val_str;        
-    char **lst_cp;
+    nm_id_sct *xtr_lst=NULL_CEWI; 
+    nco_string *val_str=NULL_CEWI;        
 
     xtr_nbr=0;
     nbr_var_fl=0;
@@ -5060,8 +5017,6 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   var_sct *vlist_cls::atoi_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker)
   {
   const std::string fnc_nm("push_fnd::fnd");
-  bool bret;
-  int idx;
   int fdx;
   int ierr=0;
   int nbr_args;
@@ -5081,6 +5036,7 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
 
   nbr_args=args_vtr.size();  
 
+  vtype=NC_NAT;
   susg="usage: att_out="+sfnm+"( nc_char|nc_string  )";
 
   if(nbr_args<1)
@@ -5184,16 +5140,14 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
 
   var_sct *vlist_cls::join_fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("vlist_cls::fnd");
-  int idx;
-  int fdx;
+  unsigned  idx;
+  // int fdx=fmc_obj.fdx();
   int nbr_args;
-  int nbr_dim;         
   char *cstr;
   std::string susg;
   std::string sfnm=fmc_obj.fnm();
-  var_sct *var;
-  var_sct *var_att;
-  var_sct *var_add;
+  var_sct *var=NULL_CEWI;
+  var_sct *var_att=NULL_CEWI;
 
   RefAST tr;
   RefAST aRef;
@@ -5202,18 +5156,18 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   prs_cls *prs_arg=walker.prs_arg;
   std::vector<std::string> str_vtr;
           
-  fdx=fmc_obj.fdx();
+  
 
 
   // Put args into vector 
   if(expr)
     vtr_args.push_back(expr);
 
-  if(tr=fargs->getFirstChild())
+  if((tr=fargs->getFirstChild()))
   {
     do  
       vtr_args.push_back(tr);
-    while(tr=tr->getNextSibling());    
+    while((tr=tr->getNextSibling()));    
   } 
             
   nbr_args=vtr_args.size();  
@@ -5305,11 +5259,8 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
 
   var_sct *aggd_cls::fnd(RefAST expr, RefAST fargs,fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("aggd_cls::fnd");
-  int fdx;
+  // int fdx=fmc_obj.fdx();
   int nbr_args;
-  int idx;
-  int nbr_dim;
-  int avg_nbr_dim; 
            
   std::string susg;
   std::string sfnm=fmc_obj.fnm();
@@ -5318,25 +5269,24 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   RefAST tr;
 
   // de-reference 
-  ddra_info_sct ddra_info;        
   prs_cls *prs_arg=walker.prs_arg;
-  var_sct *var_weight;
-  var_sct *var_weight_sum;
-  var_sct *var_weight_avg;
-  var_sct *var_in;
-  var_sct *var_out;
+  var_sct *var_weight=NULL_CEWI;
+  var_sct *var_weight_sum=NULL_CEWI;
+  var_sct *var_weight_avg=NULL_CEWI;
+  var_sct *var_in=NULL_CEWI;
+  var_sct *var_out=NULL_CEWI;
 
-  fdx=fmc_obj.fdx();
+  ddra_info_sct ddra_info;        
  
  
   // Put args into vector 
   if(expr)
     vtr_args.push_back(expr);
 
-  if(tr=fargs->getFirstChild()) {
+  if((tr=fargs->getFirstChild())) {
     do  
       vtr_args.push_back(tr);
-    while(tr=tr->getNextSibling());    
+    while((tr=tr->getNextSibling()));    
   } 
       
   nbr_args=vtr_args.size();  
@@ -5464,9 +5414,6 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   const std::string fnc_nm("print_cls::fnd");
   int fdx;
   int nbr_args;
-  int idx;
-  int nbr_dim;
-  int avg_nbr_dim; 
     
   char *fmt_sng=(char*)NULL;
   vtl_typ lcl_type;
@@ -5477,7 +5424,6 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   RefAST tr;
 
   // de-reference 
-  ddra_info_sct ddra_info;        
   prs_cls *prs_arg=walker.prs_arg;
   var_sct *var =NULL_CEWI;
   var_sct *var_att=NULL_CEWI; 
@@ -5491,10 +5437,10 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   if(expr)
     vtr_args.push_back(expr);
 
-  if(tr=fargs->getFirstChild()) {
+  if((tr=fargs->getFirstChild())) {
     do  
       vtr_args.push_back(tr);
-    while(tr=tr->getNextSibling());    
+    while((tr=tr->getNextSibling()));    
   } 
 
   nbr_args=vtr_args.size();
@@ -5626,9 +5572,7 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   case PSNPRINT:
      {
        char *cp; 
-       long sz;   
        cp=ncap_att_sprn(var_att,fmt_sng);
-       sz=strlen(cp);  
        var=ncap_sclr_var_mk("~zz at print_methods",NC_STRING,true);    
        cast_void_nctype(NC_STRING,&var->val);
        var->val.sngp[0]=(nco_string)cp;   
@@ -5668,13 +5612,9 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   const std::string fnc_nm("udunits_cls::fnd");
   int fdx;
   int nbr_args;
-  int nbr_dim;
   int rcd;
   bool is_mtd;
-  long lret;
-
-
-  dmn_sct **dim;
+ 
   var_sct *var=NULL_CEWI;
   var_sct *var_ud_out=NULL_CEWI;
 
@@ -5696,8 +5636,6 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   prs_cls *prs_arg=walker.prs_arg;            
   nc_type lcl_typ;
 
-  NcapVar *Nvar;
-
 
   fdx=fmc_obj.fdx();
  
@@ -5705,10 +5643,10 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
   if(expr)
       args_vtr.push_back(expr);
 
-    if(tr=fargs->getFirstChild()) {
+    if((tr=fargs->getFirstChild())) {
       do  
 	args_vtr.push_back(tr);
-      while(tr=tr->getNextSibling());    
+      while((tr=tr->getNextSibling()));    
     } 
       
   nbr_args=args_vtr.size();  
@@ -5808,7 +5746,7 @@ var_sct *vlist_cls::push_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_cl
 var_sct *udunits_cls::strftime_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker)
  {
     int nbr_args;
-    int fdx=fmc_obj.fdx();
+    //int fdx=fmc_obj.fdx();
     int rcd;
     char *cformat=(char*)NULL;
 
@@ -5825,7 +5763,6 @@ var_sct *udunits_cls::strftime_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr,
 
 
     prs_cls *prs_arg=walker.prs_arg;            
-    nc_type lcl_typ;
     nco_cln_typ cln_typ;
 
     nbr_args=args_vtr.size();
@@ -5843,7 +5780,6 @@ var_sct *udunits_cls::strftime_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr,
     var=walker.out(args_vtr[0]);  
 
 
-    lcl_typ=var->type;
     if( !var->undefined && var->type !=NC_FLOAT && var->type !=NC_DOUBLE )
       nco_var_cnf_typ(NC_DOUBLE,var); 
 
@@ -5961,7 +5897,7 @@ var_sct *udunits_cls::strftime_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr,
 var_sct *udunits_cls::regular_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker)
  {
     int nbr_args;
-    int fdx=fmc_obj.fdx();
+    // int fdx=fmc_obj.fdx();
     int rcd;
     int iformat=0;
 
@@ -5978,7 +5914,6 @@ var_sct *udunits_cls::regular_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, f
 
 
     prs_cls *prs_arg=walker.prs_arg;            
-    nc_type lcl_typ;
     nco_cln_typ cln_typ;
 
     nbr_args=args_vtr.size();
@@ -5996,7 +5931,6 @@ var_sct *udunits_cls::regular_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, f
     var=walker.out(args_vtr[0]);  
 
 
-    lcl_typ=var->type;
     if( !var->undefined && var->type !=NC_FLOAT && var->type !=NC_DOUBLE )
       nco_var_cnf_typ(NC_DOUBLE,var); 
 
diff --git a/src/nco++/fmc_gsl_cls.cc b/src/nco++/fmc_gsl_cls.cc
index cda2b91..9641837 100644
--- a/src/nco++/fmc_gsl_cls.cc
+++ b/src/nco++/fmc_gsl_cls.cc
@@ -835,7 +835,7 @@ var_sct *gsl_cls::hnd_fnc_x(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&gp
       nco_uint *uip;
       double *dp;
       
-      var_sct *var_out;
+      var_sct *var_out=NULL_CEWI;
       
       gsl_sf_result rslt;  /* structure for result from gsl lib call */
       
@@ -890,7 +890,7 @@ var_sct *gsl_cls::hnd_fnc_x(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&gp
       nco_int *ip;
       double *dp;
       
-      var_sct *var_out;
+      var_sct *var_out=NULL_CEWI;
       
       gsl_sf_result rslt;  /* structure for result from gsl lib call */
       
@@ -1036,14 +1036,13 @@ var_sct *gsl_cls::hnd_fnc_xd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&g
   case NC_DOUBLE:
     // This is handled in hnd_fnc_nd,P2DBL
      break;
-    
+
+     
   case NC_INT: { 
     bool has_mss_val=false;
     int sz;
-    nco_int mss_val_ntg; 
     nco_int *ip1; 
     double *dp2;
-    
     double mss_val_dbl;
     gsl_sf_result rslt;  /* structure for result from gsl lib call */
     int (*fnc_int)(int,double, gsl_sf_result*);
@@ -1067,7 +1066,7 @@ var_sct *gsl_cls::hnd_fnc_xd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&g
     if(var1->has_mss_val){
       //has_mss_val=true; 
       (void)cast_void_nctype(NC_INT,&var1->mss_val);
-      mss_val_ntg=*var1->mss_val.ip;
+      // mss_val_ntg=*var1->mss_val.ip;
       (void)cast_nctype_void(NC_INT,&(var1->mss_val));
     } 
     
@@ -1249,7 +1248,7 @@ var_sct *gsl_cls::hnd_fnc_idpd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls
   std::string sfnm=gpr_obj.fnm();
   std::string susg;        // usage string;   
   std::string var_nm;
-  var_sct *var_arr[2];
+  var_sct *var_arr[2]={NULL_CEWI};
   var_sct *var_out=NULL_CEWI;
   var_sct *var_tmp=NULL_CEWI;
   
@@ -1361,16 +1360,14 @@ var_sct *gsl_cls::hnd_fnc_nd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&g
   int fdx=gpr_obj.type(); // very important 
   int args_nbr;
   int args_in_nbr(-1); // CEWI
-  nc_type type;
   std::string styp=(is_mtd ? "method":"function");
   std::string sfnm=gpr_obj.fnm();
-  var_sct *var_ret; 
-  var_sct **var_arr;
-  var_sct ***var_arr_ptr;
+  var_sct *var_ret=NULL_CEWI; 
+  var_sct **var_arr=NULL_CEWI;
+  var_sct ***var_arr_ptr=NULL_CEWI;
   
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;
-  type=gpr_obj.type();  
   
   args_nbr=args_vtr.size();
   
@@ -1908,7 +1905,7 @@ var_sct *gsl_cls::hnd_fnc_idd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&
   int args_nbr;
   std::string styp=(is_mtd ? "method":"function");
   std::string sfnm=gpr_obj.fnm();
-  var_sct *var_ret;
+  var_sct *var_ret=NULL_CEWI;
   var_sct *var_arr[3];
   var_sct **var_arr_ptr[3]; 
   
@@ -2015,7 +2012,6 @@ var_sct *gsl_cls::hnd_fnc_ud(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&g
   const std::string fnc_nm("hnd_fnc_ud");
   long idx;
   int args_nbr;
-  nc_type type;
   std::string styp=(is_mtd ? "method":"function");
   std::string sfnm=gpr_obj.fnm();
   var_sct *var1=NULL_CEWI;
@@ -2024,7 +2020,6 @@ var_sct *gsl_cls::hnd_fnc_ud(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&g
   
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;
-  type=gpr_obj.type();  
   
   args_nbr=args_vtr.size();
   
@@ -2217,7 +2212,6 @@ var_sct *gsl_cls::hnd_fnc_rnd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&
   int fdx=gpr_obj.type(); // very important 
   int args_nbr;
   int args_in_nbr(-1); // CEWI
-  nc_type type;
   std::string styp=(is_mtd ? "method":"function");
   std::string sfnm=gpr_obj.fnm();
   var_sct *var_ret; 
@@ -2228,7 +2222,6 @@ var_sct *gsl_cls::hnd_fnc_rnd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&
 
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;
-  type=gpr_obj.type();  
   
   args_nbr=args_vtr.size();
   
@@ -2300,8 +2293,6 @@ var_sct *gsl_cls::hnd_fnc_rnd(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&
     double **dp;
     double mss_val_dbl=0.0;
               
-    gsl_mode_t mde_t=ncap_gsl_mode_prec; // initialize local from global variable */
-    gsl_sf_result rslt;  /* structure for result from gsl lib call */
 
     dp=(double**)nco_malloc(sizeof(double*)*args_in_nbr);
     
@@ -2434,7 +2425,6 @@ var_sct *gsl_cls::hnd_fnc_ru(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&g
   const std::string fnc_nm("hnd_fnc_ru");
   int idx;
   int args_nbr;
-  nc_type type;
   std::string styp=(is_mtd ? "method":"function");
   std::string sfnm=gpr_obj.fnm();
   var_sct *var=NULL_CEWI;
@@ -2446,7 +2436,6 @@ var_sct *gsl_cls::hnd_fnc_ru(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls&g
   
   args_nbr=args_vtr.size();
   
-  type=gpr_obj.type(); 
   
   if(args_nbr==0) err_prn(fnc_nm,styp+" \""+sfnm+"\" has been called with no arguments"); 
   
@@ -2869,7 +2858,6 @@ var_sct *gsl_cls::hnd_fnc_uerx(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cls
       long sz=var->sz;
       nco_uint64 *ui64p;
       nco_uint64 mss_val_uint64;
-      double *dp; 
 
       unsigned long int(*fnc_int)(const gsl_rng*,unsigned long int);
       
@@ -2933,7 +2921,6 @@ var_sct *gsl_cls::hnd_fnc_stat1(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
   int idx;
   int nbr_args;
   int in_nbr_args;
-  nc_type type;
   std::string susg;
   std::string sfnm=gpr_obj.fnm();
   var_sct *var[3];
@@ -2944,12 +2931,13 @@ var_sct *gsl_cls::hnd_fnc_stat1(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
   
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;
-  type=gpr_obj.type();  
   
   nbr_args=args_vtr.size();
   
   susg=susg="usage: double_val="+sfnm+"(var_data, data_stride?, n?)";
 
+  r_val=0.0;
+  
   if(nbr_args <1){
     err_prn(sfnm,"Function requires at least one argument.\n"+susg  ); 
   }
@@ -3005,7 +2993,7 @@ var_sct *gsl_cls::hnd_fnc_stat1(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
    }
    
    // Check hyperslab limits
-   if( 1+ (sz-1)*d_srd >var[0]->sz){
+   if( 1+ (sz-1)*d_srd >(size_t)var[0]->sz){
      err_prn(sfnm,"Requested hyperslab with stride="+nbr2sng(d_srd)+" and n="+ nbr2sng(sz)+" doesn't fit into variable \""+string(var[0]->nm)+"\" with size="+nbr2sng(var[0]->sz)); 
     }
    
@@ -3068,16 +3056,15 @@ var_sct *gsl_cls::hnd_fnc_stat2(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
   const std::string fnc_nm("hnd_fnc_stat2");
   int idx;
   int args_nbr;
-  nc_type type;
   std::string susg;
   std::string sfnm=gpr_obj.fnm();
   var_sct *var_arr[4];
   double r_val;
-   
-    
+
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;
-  type=gpr_obj.type();  
+  
+  r_val=0.0;
   
   args_nbr=args_vtr.size();
   
@@ -3133,7 +3120,7 @@ var_sct *gsl_cls::hnd_fnc_stat2(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
 
    
    // Check hyperslab limits
-   if( 1+ (sz-1)*d_srd >var_arr[0]->sz){
+   if( 1+ (sz-1)*d_srd > (size_t)var_arr[0]->sz){
      err_prn(sfnm,"Requested hyperslab with stride="+nbr2sng(d_srd)+" and n="+ nbr2sng(sz)+" doesn't fit into variable \""+string(var_arr[0]->nm)+"\" with size="+nbr2sng(var_arr[0]->sz)); 
     }
 
@@ -3205,19 +3192,16 @@ var_sct *gsl_cls::hnd_fnc_stat3(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
   int nbr_args;
   int in_nbr_args;
   int fdx=gpr_obj.type(); // very important
-  nc_type type;
   std::string susg;
   std::string sfnm=gpr_obj.fnm();
   var_sct *var[3];
-  var_sct *var_ret;
-  double r_val;
+  var_sct *var_ret=NULL_CEWI;
    
   
   var[0]=var[1]=var[2]=(var_sct*)NULL;    
   
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;
-  type=gpr_obj.type();  
   
   nbr_args=args_vtr.size();
   
@@ -3303,14 +3287,16 @@ var_sct *gsl_cls::hnd_fnc_stat3(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
    }
    
    // Check hyperslab limits
-   if(1L+(sz-1)*d_srd > var[0]->sz){
+   if(1L+(sz-1)*d_srd > (size_t)var[0]->sz){
      err_prn(sfnm,"Requested hyperslab with stride="+nbr2sng(d_srd)+" and n="+ nbr2sng(sz)+" does not fit into variable \""+string(var[0]->nm)+"\" with size="+nbr2sng(var[0]->sz)); 
     }
   
    switch(fdx){
     
    case PS_MAX_IDX:{
-     nco_int r_val; 
+     nco_int r_val;
+     r_val=0;
+
      switch(var[0]->type){
        case NC_FLOAT:  r_val=gsl_stats_float_max_index( var[0]->val.fp,d_srd,sz);break;
        case NC_DOUBLE: r_val=gsl_stats_max_index( var[0]->val.dp,d_srd,sz);break;
@@ -3342,7 +3328,9 @@ var_sct *gsl_cls::hnd_fnc_stat3(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
    
     
    case PS_MIN_IDX:{
-     nco_int r_val; 
+     nco_int r_val;
+     r_val=0;
+
      switch(var[0]->type){
        case NC_FLOAT:  r_val=gsl_stats_float_min_index( var[0]->val.fp,d_srd,sz);break;
        case NC_DOUBLE: r_val=gsl_stats_min_index( var[0]->val.dp,d_srd,sz);break;
@@ -3494,7 +3482,6 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
   int idx;
   int fdx=gpr_obj.type(); // very important
   int args_nbr;
-  nc_type type;
   std::string susg;
   std::string sfnm=gpr_obj.fnm();
   var_sct *var_arr[6];
@@ -3503,7 +3490,6 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
     
   // de-reference 
   prs_cls *prs_arg=walker.prs_arg;
-  type=gpr_obj.type();  
   
   args_nbr=args_vtr.size();
   
@@ -3764,7 +3750,7 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
     int fdx=fmc_obj.fdx();   //index
     int nbr_args;
     unsigned long vlng;
-    var_sct *var;
+    var_sct *var=NULL_CEWI;
     prs_cls* prs_arg=walker.prs_arg;
     std::string sfnm =fmc_obj.fnm(); //method name
     std::string styp;
@@ -3871,22 +3857,20 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
   const std::string fnc_nm("gsl_stt2_cls::fnd");
     int idx;
     int fdx=fmc_obj.fdx();   //index
-    int nbr_args;
-    int in_nbr_args;
+    int nbr_args=0;
+    int in_nbr_args=0;
     double r_val;
-    var_sct *var;
     prs_cls* prs_arg=walker.prs_arg;
     std::string sfnm =fmc_obj.fnm(); //method name
     std::string susg;
     RefAST tr;
     std::vector<RefAST> vtr_args; 
     var_sct **var_arr;
-    var_sct ***var_arr_ptr;
 
 
     nbr_args=0;
-
-
+    r_val=0.0; 
+     
 
     if(expr)
       vtr_args.push_back(expr);
@@ -3958,7 +3942,7 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
   
  // check weight type and data type 
  
- if(var_arr[0]->type != var_arr[2]->type || var_arr[2]->type != NC_FLOAT && var_arr[2]->type != NC_DOUBLE  ){   
+  if(var_arr[0]->type != var_arr[2]->type || (var_arr[2]->type != NC_FLOAT && var_arr[2]->type != NC_DOUBLE  )){   
    ostringstream os;  
    os<<"The data type and the weight type most both be NC_FLOAT or NC_DOUBLE. In your arguments the data is type "<<nco_typ_sng(var_arr[2]->type)<< " and the weight is type "<<nco_typ_sng(var_arr[0]->type);
 
@@ -4031,7 +4015,7 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
 
    
    // Check hyperslab limits
-   if( 1+ (sz-1)*d_srd >var_arr[0]->sz){
+   if( 1+ (sz-1)*d_srd > (size_t)var_arr[0]->sz){
      err_prn(sfnm,"Requested hyperslab with stride="+nbr2sng(d_srd)+" and n="+ nbr2sng(sz)+" doesn't fit into variable \""+string(var_arr[0]->nm)+"\" with size="+nbr2sng(var_arr[0]->sz)); 
     }
 
@@ -4240,7 +4224,7 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
 // nb this method is only call with fdx==PEVAL
 var_sct *gsl_spl_cls::eval_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_cls &fmc_obj, ncoTree &walker){
   const std::string fnc_nm("gsl_spl_cls::eval_fnd");
-    int fdx=fmc_obj.fdx();   //index
+    // int fdx=fmc_obj.fdx();   //index
     int nbr_args;
     int in_nbr_args;
     prs_cls* prs_arg=walker.prs_arg;
@@ -4369,7 +4353,7 @@ var_sct *gsl_spl_cls::spl_fnd(bool &is_mtd, std::vector<RefAST> &args_vtr, fmc_c
 
     
     NcapVar *Nvar;       
-    const gsl_interp_type *ts;
+    const gsl_interp_type *ts=NULL_CEWI;
     gsl_spline *spline;   
  
     nbr_args=args_vtr.size();  
@@ -4565,8 +4549,8 @@ var_sct *gsl_fit_cls::fit_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_c
     int idx;
     int fdx=fmc_obj.fdx();   //index
     int nbr_args;    // actual nunber of args
-    int in_nbr_args; // target number of args
-    int in_val_nbr_args; // number of expressions
+    int in_nbr_args=0; // target number of args
+    int in_val_nbr_args=0; // number of expressions
     int ret; 
     prs_cls* prs_arg=walker.prs_arg;
     std::string sfnm =fmc_obj.fnm(); //method name
@@ -4576,7 +4560,8 @@ var_sct *gsl_fit_cls::fit_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, fmc_c
     
     var_sct *var_in[13];  
        
- 
+    ret=NCO_GSL_SUCCESS;
+    
     nbr_args=vtr_args.size();  
 
     switch(fdx){
@@ -4901,9 +4886,8 @@ var_sct *gsl_fit_cls::fit_est_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, f
     bool has_mss_val; 
     int idx;
     int fdx=fmc_obj.fdx();   //index
-    int nbr_args;    // actual nunber of args
-    int in_nbr_args; // target number of args
-    int in_val_nbr_args; // number of expressions
+    int nbr_args=0;    // actual nunber of args
+    int in_nbr_args=0; // target number of args
     double mss_val_dbl;
 
     prs_cls* prs_arg=walker.prs_arg;
@@ -4911,8 +4895,8 @@ var_sct *gsl_fit_cls::fit_est_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, f
     std::string susg;
     std::string serr;    
     
-    var_sct *var_in[12];  
-    var_sct *var_out; 
+    var_sct *var_in[12]={NULL_CEWI};  
+    var_sct *var_out=NULL_CEWI; 
        
  
     nbr_args=vtr_args.size();  
@@ -4920,12 +4904,10 @@ var_sct *gsl_fit_cls::fit_est_fnd(bool &is_mtd, std::vector<RefAST> &vtr_args, f
     switch(fdx){
       case PLIN_EST:
 	in_nbr_args=6;
-        in_val_nbr_args=4;
         susg="usage: data_y="+sfnm+"(data_x,c0,c1,cov00,cov01,cov11)";
 	break;   
       case PMUL_EST:
 	in_nbr_args=3;
-        in_val_nbr_args=1;
         susg="usage: data_y="+sfnm+"(data_x,c1,cov11)";
 	break; 
 
diff --git a/src/nco++/map_srt_tmp.hh b/src/nco++/map_srt_tmp.hh
index beb28d1..45babc5 100644
--- a/src/nco++/map_srt_tmp.hh
+++ b/src/nco++/map_srt_tmp.hh
@@ -70,7 +70,7 @@ void ncap_sort_and_map(var_sct *var, var_sct *var_mp, bool bd)
   if(bd)
     std::sort(mp,mp+sz);  // increasing
   else 
-    std:sort(mp,mp+sz,map_srt<T>::greater);  // decreasing
+    std::sort(mp,mp+sz,map_srt<T>::greater);  // decreasing
 
   //The above line may not work with some compilers if so replace with the following
   // { std::sort(mp,mp+sz); std::reverse(mp,mp+sz);}           
diff --git a/src/nco++/ncap2.cc b/src/nco++/ncap2.cc
index 5138210..a4c7688 100644
--- a/src/nco++/ncap2.cc
+++ b/src/nco++/ncap2.cc
@@ -282,6 +282,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
@@ -402,6 +404,7 @@ main(int argc,char **argv)
 	(void)nco_usg_prn();
 	nco_exit(EXIT_SUCCESS);
       } /* endif "help" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"lbr") || !strcmp(opt_crr,"library")){
         (void)nco_lbr_vrs_prn();
         nco_exit(EXIT_SUCCESS);
@@ -453,7 +456,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'F': /* Toggle index convention. Default is 0-based arrays (C-style). */
       FORTRAN_IDX_CNV=!FORTRAN_IDX_CNV;
@@ -672,7 +674,7 @@ main(int argc,char **argv)
   /* Initialize thread information */
   thr_nbr=nco_openmp_ini(thr_nbr);
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   if(fl_out) FL_OUT_NEW=True; else fl_out=(char *)strdup(fl_lst_in[0]);
   
@@ -754,9 +756,9 @@ main(int argc,char **argv)
   if(RAM_OPEN) md_open=NC_NOWRITE|NC_DISKLESS; else md_open=NC_NOWRITE;
   rcd+=nco_fl_open(fl_out_tmp,md_open,&bfr_sz_hnt,&prs_arg.out_id_readonly);
   
-  prs_arg.FORTRAN_IDX_CNV=FORTRAN_IDX_CNV;
-  prs_arg.ATT_PROPAGATE=ATT_PROPAGATE;      
-  prs_arg.ATT_INHERIT=ATT_INHERIT;
+  prs_arg.FORTRAN_IDX_CNV=(FORTRAN_IDX_CNV==True);
+  prs_arg.ATT_PROPAGATE=(ATT_PROPAGATE==True);      
+  prs_arg.ATT_INHERIT=(ATT_INHERIT==True);
   prs_arg.NCAP_MPI_SORT=(thr_nbr > 1 ? true:false);
   prs_arg.FLG_CLL_MTH=(flg_cll_mth ? true:false);
   prs_arg.dfl_lvl=dfl_lvl;  /* [enm] Deflate level */
@@ -1178,8 +1180,7 @@ ram_vars_add
 (prs_cls *prs_arg)
 {
   char buff[20]={0};
-  double dnan;
-
+  
   var_sct *var1;
   
   var1=ncap_sclr_var_mk(std::string("NC_BYTE"),nco_int(NC_NAT));
@@ -1240,6 +1241,8 @@ ram_vars_add
 #endif // !HUGE_VAL
 
 #ifndef _MSC_VER
+  double dnan=0.0;
+  
   if((dnan=nan(buff))){
     var1=ncap_sclr_var_mk(std::string("nan"),dnan); // double
     prs_arg->ncap_var_write(var1,true);
diff --git a/src/nco++/ncap2_utl.cc b/src/nco++/ncap2_utl.cc
index 377f06a..d811a04 100644
--- a/src/nco++/ncap2_utl.cc
+++ b/src/nco++/ncap2_utl.cc
@@ -14,7 +14,7 @@
 std::vector<std::string> /* [O] [vector] array of files paths to be used to locate include files */
 ncap_make_include_paths(const char *spaths)       /* list of file path(s) delimited by ':' */
 {
-  int vdx;
+  unsigned long vdx;
   size_t srt; 
   size_t idx; 
   std::vector<std::string> str_vtr;  
@@ -78,7 +78,7 @@ ncap_var_is_op_doable( var_sct *var1, var_sct *var2)
   if( var1->sz==var2->sz) 
     return True; 
   
-  if( var1->sz >1 && var2->sz==1 || var1->sz==1 && var2->sz>1)
+  if( (var1->sz >1 && var2->sz==1) || (var1->sz==1 && var2->sz>1))
     return True;
 
   return False;
@@ -1132,7 +1132,7 @@ var_sct* var_var_op(var_sct* var1 , var_sct* var2, int op)
       default: nco_dfl_case_nc_type_err(); break;
       }
   }
-   else if( var1->sz ==1 && var2->sz>1 || var1->sz>1 && var2->sz==1 ) 
+  else if( (var1->sz ==1 && var2->sz>1) || (var1->sz>1 && var2->sz==1) ) 
    {
      switch (var1->type) 
       {
@@ -1946,17 +1946,15 @@ ncap_cst_mk  /* [fnc] create casting var from a list of dims */
     // Search dmn_in_vtr for dimension
     dmn_item=prs_arg->dmn_in_vtr.find(lst_nm);
     // die if not in list
-    if(dmn_item == NULL_CEWI) {
-      err_prn(fnc_nm,"Unrecognized dimension \""+std::string(lst_nm)+ "\"in LHS subscripts");
-    }
-    if(!bdef) { 
+    if(dmn_item == NULL_CEWI) err_prn(fnc_nm,"Unrecognized dimension \""+std::string(lst_nm)+"\" in LHS subscripts");
 
+    if(!bdef){
 #ifdef _OPENMP
-       if(omp_in_parallel())
-	 err_prn(fnc_nm,"Attempt to go into netCDF define mode while in OpenMP parallel mode");
+      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);
+      bdef=true;  
+      (void)nco_redef(prs_arg->out_id);
     }
 
     dmn_new=nco_dmn_dpl(dmn_item);
diff --git a/src/nco++/ncoGrammer.g b/src/nco++/ncoGrammer.g
index f8571da..94de874 100644
--- a/src/nco++/ncoGrammer.g
+++ b/src/nco++/ncoGrammer.g
@@ -819,7 +819,6 @@ NcapVector<lmt_sct*> &lmt_vtr )
 	long jdx;
 	long sz;   
     long dmn_sz;     
-    ptr_unn op1;
 	var_sct *var;
 	std::string fnc_nm="lmt_var_mk"; 
 	
@@ -909,7 +908,6 @@ NcapVector<lmt_sct*> &lmt_vtr )
 
 int idx;
 int jdx;
-int sz;
 long ldx=0L;
 var_sct *var_out;
 lmt_sct *lmt_ptr;
@@ -1417,7 +1415,6 @@ static std::vector<std::string> lpp_vtr;
           bunlimited =true;
         } else    
         if(dCall==1 && var2){
-           int ityp;
            // nb var2 is in upper scope - defined at statment action start
            var2=nco_var_cnf_typ(NC_INT,var2);
            (void)cast_void_nctype(NC_INT,&var2->val);
@@ -1964,8 +1961,8 @@ end0:         if(bret)
           | vid2:VAR_ID {
 
                // Set class wide variables
-               var_sct *var_rhs;
-               var_sct *var_shp;
+               var_sct *var_rhs=NULL_CEWI; ;
+               var_sct *var_shp=NULL_CEWI; ;
                NcapVar *Nvar;
                std::string var_nm;
  
@@ -2127,11 +2124,11 @@ end0:         if(bret)
             { 
               long szn; 
               long idx; 
-              long cnt=0;  
-              char buffer[NC_MAX_ATTRS];  
 
+              char buffer[NC_MAX_ATTRS];  
+               
               buffer[0]='\0';
- 
+              cnt=0L;
               cast_void_nctype(NC_STRING, &var_lhs->val);    
               cast_void_nctype(var_rhs->type, &var_rhs->val);     
                
@@ -2933,7 +2930,7 @@ NcapVar *Nvar;
     // Plain attribute
     |   att:ATT_ID { 
             // check "output"
-            NcapVar *Nvar=NULL;
+
          
             if(att->getFirstChild())
                 err_prn(fnc_nm,"Invalid Lvalue " +att->getText() );
@@ -2976,7 +2973,7 @@ att_plain returns [var_sct *var]
 const std::string fnc_nm("att_plain");
 var=NULL_CEWI; 
 string att_nm; 
-NcapVar *Nvar;
+
    
 }
 
@@ -3151,7 +3148,7 @@ var=NULL_CEWI;
 }
  :(vlst:VALUE_LIST) {
 
-         char *cp;
+
          int nbr_lst;
          int idx;
          int tsz;
@@ -3432,7 +3429,6 @@ var_sct *var_rhs;
     char *cp_out;
     short *sp;
     long idx;
-    long jdx;
     long sz;
     size_t slb_sz;
 
@@ -3602,7 +3598,6 @@ var_sct *var_nbr;
 }
   :#(vid:VAR_ID #(LMT_LIST #(LMT var_nbr=out))) {
                int idx; 
-               int var_id; 
                int slb_sz;
                long srt;
 
diff --git a/src/nco++/ncoLexer.cpp b/src/nco++/ncoLexer.cpp
index f62724d..1cfc42d 100644
--- a/src/nco++/ncoLexer.cpp
+++ b/src/nco++/ncoLexer.cpp
@@ -1,4 +1,4 @@
-/* $ANTLR 2.7.7 (20161013): "ncoGrammer.g" -> "ncoLexer.cpp"$ */
+/* $ANTLR 2.7.7 (20160429): "ncoGrammer.g" -> "ncoLexer.cpp"$ */
 #include "ncoLexer.hpp"
 #include <antlr/CharBuffer.hpp>
 #include <antlr/TokenStreamException.hpp>
diff --git a/src/nco++/ncoLexer.hpp b/src/nco++/ncoLexer.hpp
index 0481651..08cb6e9 100644
--- a/src/nco++/ncoLexer.hpp
+++ b/src/nco++/ncoLexer.hpp
@@ -2,7 +2,7 @@
 #define INC_ncoLexer_hpp_
 
 #include <antlr/config.hpp>
-/* $ANTLR 2.7.7 (20161013): "ncoGrammer.g" -> "ncoLexer.hpp"$ */
+/* $ANTLR 2.7.7 (20160429): "ncoGrammer.g" -> "ncoLexer.hpp"$ */
 #include <antlr/CommonToken.hpp>
 #include <antlr/InputBuffer.hpp>
 #include <antlr/BitSet.hpp>
@@ -14,7 +14,7 @@
 
 /* Purpose: ANTLR Grammar and support files for ncap2 */
 
-/* Copyright (C) 1995--2017 Charlie Zender
+/* Copyright (C) 1995--2018 Charlie Zender
    This file is part of NCO, the netCDF Operators. NCO is free software.
    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 */
diff --git a/src/nco++/ncoParser.cpp b/src/nco++/ncoParser.cpp
index ae6c192..4cec283 100644
--- a/src/nco++/ncoParser.cpp
+++ b/src/nco++/ncoParser.cpp
@@ -1,4 +1,4 @@
-/* $ANTLR 2.7.7 (20161013): "ncoGrammer.g" -> "ncoParser.cpp"$ */
+/* $ANTLR 2.7.7 (20160429): "ncoGrammer.g" -> "ncoParser.cpp"$ */
 #include "ncoParser.hpp"
 #include <antlr/NoViableAltException.hpp>
 #include <antlr/SemanticException.hpp>
diff --git a/src/nco++/ncoParser.hpp b/src/nco++/ncoParser.hpp
index e406e51..43498ce 100644
--- a/src/nco++/ncoParser.hpp
+++ b/src/nco++/ncoParser.hpp
@@ -2,7 +2,7 @@
 #define INC_ncoParser_hpp_
 
 #include <antlr/config.hpp>
-/* $ANTLR 2.7.7 (20161013): "ncoGrammer.g" -> "ncoParser.hpp"$ */
+/* $ANTLR 2.7.7 (20160429): "ncoGrammer.g" -> "ncoParser.hpp"$ */
 #include <antlr/TokenStream.hpp>
 #include <antlr/TokenBuffer.hpp>
 #include "ncoParserTokenTypes.hpp"
@@ -14,7 +14,7 @@
 
 /* Purpose: ANTLR Grammar and support files for ncap2 */
 
-/* Copyright (C) 1995--2017 Charlie Zender
+/* Copyright (C) 1995--2018 Charlie Zender
    This file is part of NCO, the netCDF Operators. NCO is free software.
    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 */
diff --git a/src/nco++/ncoTree.cpp b/src/nco++/ncoTree.cpp
index 9909fc9..c4fff74 100644
--- a/src/nco++/ncoTree.cpp
+++ b/src/nco++/ncoTree.cpp
@@ -1,4 +1,4 @@
-/* $ANTLR 2.7.7 (20161013): "ncoGrammer.g" -> "ncoTree.cpp"$ */
+/* $ANTLR 2.7.7 (20160429): "ncoGrammer.g" -> "ncoTree.cpp"$ */
 #include "ncoTree.hpp"
 #include <antlr/Token.hpp>
 #include <antlr/AST.hpp>
@@ -13,7 +13,7 @@ ncoTree::ncoTree()
 }
 
 int  ncoTree::lmt_peek(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 1163 "ncoGrammer.g"
+#line 1161 "ncoGrammer.g"
 	int nbr_dmn=0;
 #line 19 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST lmt_peek_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
@@ -24,7 +24,7 @@ int  ncoTree::lmt_peek(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 		match(_t,LMT_LIST);
 		_t = _t->getNextSibling();
 		if ( inputState->guessing==0 ) {
-#line 1165 "ncoGrammer.g"
+#line 1163 "ncoGrammer.g"
 			
 			RefAST aRef;     
 			aRef=lmt->getFirstChild();
@@ -51,7 +51,7 @@ int  ncoTree::lmt_peek(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 }
 
 int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 1176 "ncoGrammer.g"
+#line 1174 "ncoGrammer.g"
 	int iret=0;
 #line 57 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST statements_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
@@ -69,7 +69,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 	ANTLR_USE_NAMESPACE(antlr)RefAST stmt2 = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST dtyp = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST def = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 1176 "ncoGrammer.g"
+#line 1174 "ncoGrammer.g"
 	
 	var_sct *var=NULL;
 	var_sct *var2=NULL;
@@ -91,7 +91,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,BLOCK);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1186 "ncoGrammer.g"
+#line 1184 "ncoGrammer.g"
 				
 				//std::cout <<"Num of Children in block="<<blk->getNumberOfChildren()<<endl;
 				iret=run_exe(blk->getFirstChild(),lpp_vtr.size() );
@@ -113,7 +113,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t231;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1193 "ncoGrammer.g"
+#line 1191 "ncoGrammer.g"
 				
 				int aType; 
 				
@@ -146,7 +146,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t232;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1213 "ncoGrammer.g"
+#line 1211 "ncoGrammer.g"
 				
 				
 				var=out(fss);
@@ -174,7 +174,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t233;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1223 "ncoGrammer.g"
+#line 1221 "ncoGrammer.g"
 				
 				//if can have only 3 or 4 parts  , 1 node and 2 or 3 siblings
 				// IF LOGICAL_EXP STATEMENT1 STATEMENT2
@@ -222,7 +222,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t234;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1253 "ncoGrammer.g"
+#line 1251 "ncoGrammer.g"
 				
 				// convert mask to short 
 				RefAST tr; 
@@ -285,7 +285,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t235;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1297 "ncoGrammer.g"
+#line 1295 "ncoGrammer.g"
 				
 				
 				bool br;
@@ -339,7 +339,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t236;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1326 "ncoGrammer.g"
+#line 1324 "ncoGrammer.g"
 				
 				bool b1,b2,b3,br;
 				var_sct *var_f1;
@@ -405,7 +405,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t237;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1378 "ncoGrammer.g"
+#line 1376 "ncoGrammer.g"
 				
 				int sret;
 				ostringstream os;       
@@ -432,7 +432,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,ELSE);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1394 "ncoGrammer.g"
+#line 1392 "ncoGrammer.g"
 				iret=ELSE;
 #line 438 "ncoTree.cpp"
 			}
@@ -444,7 +444,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,BREAK);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1395 "ncoGrammer.g"
+#line 1393 "ncoGrammer.g"
 				iret=BREAK;
 #line 450 "ncoTree.cpp"
 			}
@@ -456,7 +456,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,CONTINUE);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1396 "ncoGrammer.g"
+#line 1394 "ncoGrammer.g"
 				iret=CONTINUE;
 #line 462 "ncoTree.cpp"
 			}
@@ -468,7 +468,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NULL_NODE);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1397 "ncoGrammer.g"
+#line 1395 "ncoGrammer.g"
 				iret=NULL_NODE;
 #line 474 "ncoTree.cpp"
 			}
@@ -554,7 +554,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t238;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1399 "ncoGrammer.g"
+#line 1397 "ncoGrammer.g"
 				
 				
 				bool bunlimited=false;      
@@ -576,7 +576,6 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				bunlimited =true;
 				} else    
 				if(dCall==1 && var2){
-				int ityp;
 				// nb var2 is in upper scope - defined at statment action start
 				var2=nco_var_cnf_typ(NC_INT,var2);
 				(void)cast_void_nctype(NC_INT,&var2->val);
@@ -595,7 +594,7 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				
 				(void)ncap_def_dim(def->getText(),sz,bunlimited,prs_arg);
 				
-#line 599 "ncoTree.cpp"
+#line 598 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -619,9 +618,9 @@ int  ncoTree::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 }
 
 var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 2272 "ncoGrammer.g"
+#line 2269 "ncoGrammer.g"
 	var_sct *var;
-#line 625 "ncoTree.cpp"
+#line 624 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST out_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST aposti = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST apostd = ANTLR_USE_NAMESPACE(antlr)nullAST;
@@ -663,7 +662,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 	ANTLR_USE_NAMESPACE(antlr)RefAST val_uint = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST val_int64 = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST val_uint64 = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 2272 "ncoGrammer.g"
+#line 2269 "ncoGrammer.g"
 	
 	bool bret=true;   
 	const std::string fnc_nm("out"); 
@@ -681,7 +680,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 	bret=false;
 	}      
 	
-#line 685 "ncoTree.cpp"
+#line 684 "ncoTree.cpp"
 	
 	try {      // for error handling
 		if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST )
@@ -700,9 +699,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t309;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2313 "ncoGrammer.g"
+#line 2310 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, TIMES );
-#line 706 "ncoTree.cpp"
+#line 705 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -719,9 +718,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t310;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2316 "ncoGrammer.g"
+#line 2313 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, DIVIDE );
-#line 725 "ncoTree.cpp"
+#line 724 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -738,9 +737,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t311;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2318 "ncoGrammer.g"
+#line 2315 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, MOD);
-#line 744 "ncoTree.cpp"
+#line 743 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -757,9 +756,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t312;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2320 "ncoGrammer.g"
+#line 2317 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, CARET);
-#line 763 "ncoTree.cpp"
+#line 762 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -774,9 +773,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t313;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2323 "ncoGrammer.g"
+#line 2320 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,NULL_CEWI, LNOT );
-#line 780 "ncoTree.cpp"
+#line 779 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -793,9 +792,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t320;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2342 "ncoGrammer.g"
+#line 2339 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, LAND );
-#line 799 "ncoTree.cpp"
+#line 798 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -812,9 +811,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t321;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2344 "ncoGrammer.g"
+#line 2341 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, LOR );
-#line 818 "ncoTree.cpp"
+#line 817 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -831,9 +830,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t322;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2347 "ncoGrammer.g"
+#line 2344 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, LTHAN );
-#line 837 "ncoTree.cpp"
+#line 836 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -850,9 +849,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t323;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2349 "ncoGrammer.g"
+#line 2346 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, GTHAN );
-#line 856 "ncoTree.cpp"
+#line 855 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -869,9 +868,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t324;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2351 "ncoGrammer.g"
+#line 2348 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, GEQ );
-#line 875 "ncoTree.cpp"
+#line 874 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -888,9 +887,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t325;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2353 "ncoGrammer.g"
+#line 2350 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, LEQ );
-#line 894 "ncoTree.cpp"
+#line 893 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -907,9 +906,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t326;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2355 "ncoGrammer.g"
+#line 2352 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, EQ );
-#line 913 "ncoTree.cpp"
+#line 912 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -926,9 +925,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t327;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2357 "ncoGrammer.g"
+#line 2354 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, NEQ );
-#line 932 "ncoTree.cpp"
+#line 931 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -945,9 +944,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t328;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2360 "ncoGrammer.g"
+#line 2357 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, FLTHAN );
-#line 951 "ncoTree.cpp"
+#line 950 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -964,9 +963,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t329;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2362 "ncoGrammer.g"
+#line 2359 "ncoGrammer.g"
 				var=ncap_var_var_op(var1,var2, FGTHAN );
-#line 970 "ncoTree.cpp"
+#line 969 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -982,11 +981,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t413;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2495 "ncoGrammer.g"
+#line 2492 "ncoGrammer.g"
 				
 				var=out(att2var(attz));    
 				
-#line 990 "ncoTree.cpp"
+#line 989 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1002,11 +1001,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t414;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2501 "ncoGrammer.g"
+#line 2498 "ncoGrammer.g"
 				
 				
 				
-#line 1010 "ncoTree.cpp"
+#line 1009 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1024,7 +1023,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t415;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2506 "ncoGrammer.g"
+#line 2503 "ncoGrammer.g"
 				
 				bool br;
 				
@@ -1041,7 +1040,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				}   
 				var1=nco_var_free(var1);
 				
-#line 1045 "ncoTree.cpp"
+#line 1044 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1057,7 +1056,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t416;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2524 "ncoGrammer.g"
+#line 2521 "ncoGrammer.g"
 				
 				// The lexer has appended the index of the function to the function name m - (name#index)
 				//  the index is into fmc_vtr  
@@ -1067,7 +1066,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				RefAST tr;  
 				var=prs_arg->fmc_vtr[idx].vfnc()->fnd(tr ,args, prs_arg->fmc_vtr[idx],*this); 
 				
-#line 1071 "ncoTree.cpp"
+#line 1070 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1089,7 +1088,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t417;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2535 "ncoGrammer.g"
+#line 2532 "ncoGrammer.g"
 				
 				// The lexer has appended the index of the function to the function name m - (name#index)
 				//  the index is into fmc_vtr  
@@ -1098,7 +1097,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				int idx=atoi(sdx.c_str());
 				var=prs_arg->fmc_vtr[idx].vfnc()->fnd(mtd ,margs, prs_arg->fmc_vtr[idx],*this); 
 				
-#line 1102 "ncoTree.cpp"
+#line 1101 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1108,7 +1107,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,DIM_ID_SIZE);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2545 "ncoGrammer.g"
+#line 2542 "ncoGrammer.g"
 				
 				string sDim=dval->getText();
 				dmn_sct *dmn_fd;
@@ -1148,7 +1147,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				} 
 				
 				
-#line 1152 "ncoTree.cpp"
+#line 1151 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1158,11 +1157,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,VALUE_LIST);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2786 "ncoGrammer.g"
+#line 2783 "ncoGrammer.g"
 				
 				var=value_list(vlst);
 				
-#line 1166 "ncoTree.cpp"
+#line 1165 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1172,7 +1171,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NSTRING);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2791 "ncoGrammer.g"
+#line 2788 "ncoGrammer.g"
 				
 				/* use malloc here rather than strdup(str->getText().c_str()) as this causes 
 				an invalid-read when using GCC compiler */ 
@@ -1196,7 +1195,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				}
 				tsng=(char*)nco_free(tsng);      
 				
-#line 1200 "ncoTree.cpp"
+#line 1199 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1206,7 +1205,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,N4STRING);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2819 "ncoGrammer.g"
+#line 2816 "ncoGrammer.g"
 				
 				char *tsng;
 				tsng=(char*)nco_malloc(str1->getText().size()+1);    
@@ -1234,7 +1233,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				}
 				tsng=(char*)nco_free(tsng);      
 				
-#line 1238 "ncoTree.cpp"
+#line 1237 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1244,9 +1243,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_FLOAT);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2849 "ncoGrammer.g"
+#line 2846 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~float"),(nc_type)NC_FLOAT,false); else var=ncap_sclr_var_mk(SCS("~float"),static_cast<float>(std::strtod(val_float->getText().c_str(),(char **)NULL)));
-#line 1250 "ncoTree.cpp"
+#line 1249 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1256,9 +1255,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_DOUBLE);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2851 "ncoGrammer.g"
+#line 2848 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~double"),(nc_type)NC_DOUBLE,false); else var=ncap_sclr_var_mk(SCS("~double"),strtod(val_double->getText().c_str(),(char **)NULL));
-#line 1262 "ncoTree.cpp"
+#line 1261 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1268,9 +1267,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_INT);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2853 "ncoGrammer.g"
+#line 2850 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~int"),(nc_type)NC_INT,false); else var=ncap_sclr_var_mk(SCS("~int"),static_cast<nco_int>(std::strtol(val_int->getText().c_str(),(char **)NULL,NCO_SNG_CNV_BASE10)));
-#line 1274 "ncoTree.cpp"
+#line 1273 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1280,9 +1279,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_SHORT);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2855 "ncoGrammer.g"
+#line 2852 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~short"),(nc_type)NC_SHORT,false); else var=ncap_sclr_var_mk(SCS("~short"),static_cast<nco_short>(std::strtol(val_short->getText().c_str(),(char **)NULL,NCO_SNG_CNV_BASE10)));
-#line 1286 "ncoTree.cpp"
+#line 1285 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1292,9 +1291,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_BYTE);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2857 "ncoGrammer.g"
+#line 2854 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~byte"),(nc_type)NC_BYTE,false); else var=ncap_sclr_var_mk(SCS("~byte"),static_cast<nco_byte>(std::strtol(val_byte->getText().c_str(),(char **)NULL,NCO_SNG_CNV_BASE10)));
-#line 1298 "ncoTree.cpp"
+#line 1297 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1304,9 +1303,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_UBYTE);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2862 "ncoGrammer.g"
+#line 2859 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~ubyte"),(nc_type)NC_UBYTE,false); else var=ncap_sclr_var_mk(SCS("~ubyte"),static_cast<nco_ubyte>(std::strtoul(val_ubyte->getText().c_str(),(char **)NULL,NCO_SNG_CNV_BASE10)));
-#line 1310 "ncoTree.cpp"
+#line 1309 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1316,9 +1315,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_USHORT);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2866 "ncoGrammer.g"
+#line 2863 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~ushort"),(nc_type)NC_USHORT,false); else var=ncap_sclr_var_mk(SCS("~ushort"),static_cast<nco_ushort>(std::strtoul(val_ushort->getText().c_str(),(char **)NULL,NCO_SNG_CNV_BASE10)));
-#line 1322 "ncoTree.cpp"
+#line 1321 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1328,9 +1327,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_UINT);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2868 "ncoGrammer.g"
+#line 2865 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~uint"),(nc_type)NC_UINT,false); else var=ncap_sclr_var_mk(SCS("~uint"),static_cast<nco_uint>(std::strtoul(val_uint->getText().c_str(),(char **)NULL,NCO_SNG_CNV_BASE10)));
-#line 1334 "ncoTree.cpp"
+#line 1333 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1340,9 +1339,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_INT64);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2870 "ncoGrammer.g"
+#line 2867 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~int64"),(nc_type)NC_INT64,false); else var=ncap_sclr_var_mk(SCS("~int64"),sng2nbr(val_int64->getText(),nco_int64_CEWI));
-#line 1346 "ncoTree.cpp"
+#line 1345 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1352,9 +1351,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,NCAP_UINT64);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2874 "ncoGrammer.g"
+#line 2871 "ncoGrammer.g"
 				if(prs_arg->ntl_scn) var=ncap_sclr_var_mk(SCS("~uint64"),(nc_type)NC_UINT64,false); else var=ncap_sclr_var_mk(SCS("~uint64"),sng2nbr(val_uint64->getText(),nco_uint64_CEWI));
-#line 1358 "ncoTree.cpp"
+#line 1357 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -1398,9 +1397,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				_t = __t280;
 				_t = _t->getNextSibling();
 				if ( inputState->guessing==0 ) {
-#line 2293 "ncoGrammer.g"
+#line 2290 "ncoGrammer.g"
 					var=ncap_var_var_op(var1,var2, PLUS );
-#line 1404 "ncoTree.cpp"
+#line 1403 "ncoTree.cpp"
 				}
 			}
 			else {
@@ -1443,9 +1442,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 					_t = __t284;
 					_t = _t->getNextSibling();
 					if ( inputState->guessing==0 ) {
-#line 2295 "ncoGrammer.g"
+#line 2292 "ncoGrammer.g"
 						var=ncap_var_var_op(var1,var2, MINUS );
-#line 1449 "ncoTree.cpp"
+#line 1448 "ncoTree.cpp"
 					}
 				}
 				else {
@@ -1498,12 +1497,12 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 						_t = __t289;
 						_t = _t->getNextSibling();
 						if ( inputState->guessing==0 ) {
-#line 2296 "ncoGrammer.g"
+#line 2293 "ncoGrammer.g"
 							
 							var1=out(att2var(aposti));     
 							var=ncap_var_var_inc(var1,NULL_CEWI,POST_INC,false,bret,prs_arg);      
 							
-#line 1507 "ncoTree.cpp"
+#line 1506 "ncoTree.cpp"
 						}
 					}
 					else {
@@ -1556,12 +1555,12 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 							_t = __t295;
 							_t = _t->getNextSibling();
 							if ( inputState->guessing==0 ) {
-#line 2300 "ncoGrammer.g"
+#line 2297 "ncoGrammer.g"
 								
 								var1=out(att2var(apostd));     
 								var=ncap_var_var_inc(var1,NULL_CEWI,POST_DEC,false,bret,prs_arg);      
 								
-#line 1565 "ncoTree.cpp"
+#line 1564 "ncoTree.cpp"
 							}
 						}
 						else {
@@ -1614,12 +1613,12 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 								_t = __t301;
 								_t = _t->getNextSibling();
 								if ( inputState->guessing==0 ) {
-#line 2304 "ncoGrammer.g"
+#line 2301 "ncoGrammer.g"
 									
 									var1=out(att2var(aprei));     
 									var=ncap_var_var_inc(var1,NULL_CEWI,INC,false,bret,prs_arg);      
 									
-#line 1623 "ncoTree.cpp"
+#line 1622 "ncoTree.cpp"
 								}
 							}
 							else {
@@ -1672,12 +1671,12 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 									_t = __t307;
 									_t = _t->getNextSibling();
 									if ( inputState->guessing==0 ) {
-#line 2308 "ncoGrammer.g"
+#line 2305 "ncoGrammer.g"
 										
 										var1=out(att2var(apred));     
 										var=ncap_var_var_inc(var1,NULL_CEWI,DEC,false,bret,prs_arg);      
 										
-#line 1681 "ncoTree.cpp"
+#line 1680 "ncoTree.cpp"
 									}
 								}
 								else if ((_t->getType() == MINUS)) {
@@ -1690,9 +1689,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 									_t = __t314;
 									_t = _t->getNextSibling();
 									if ( inputState->guessing==0 ) {
-#line 2325 "ncoGrammer.g"
+#line 2322 "ncoGrammer.g"
 										var=ncap_var_var_op(var1,NULL_CEWI, MINUS );
-#line 1696 "ncoTree.cpp"
+#line 1695 "ncoTree.cpp"
 									}
 								}
 								else if ((_t->getType() == PLUS)) {
@@ -1715,9 +1714,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 									_t = __t316;
 									_t = _t->getNextSibling();
 									if ( inputState->guessing==0 ) {
-#line 2329 "ncoGrammer.g"
+#line 2326 "ncoGrammer.g"
 										var=ncap_var_var_inc(var1,NULL_CEWI,INC,false,bret,prs_arg);
-#line 1721 "ncoTree.cpp"
+#line 1720 "ncoTree.cpp"
 									}
 								}
 								else if ((_t->getType() == DEC)) {
@@ -1730,9 +1729,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 									_t = __t317;
 									_t = _t->getNextSibling();
 									if ( inputState->guessing==0 ) {
-#line 2332 "ncoGrammer.g"
+#line 2329 "ncoGrammer.g"
 										var=ncap_var_var_inc(var1,NULL_CEWI, DEC,false,bret,prs_arg );
-#line 1736 "ncoTree.cpp"
+#line 1735 "ncoTree.cpp"
 									}
 								}
 								else if ((_t->getType() == POST_INC)) {
@@ -1745,11 +1744,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 									_t = __t318;
 									_t = _t->getNextSibling();
 									if ( inputState->guessing==0 ) {
-#line 2334 "ncoGrammer.g"
+#line 2331 "ncoGrammer.g"
 										
 										var=ncap_var_var_inc(var1,NULL_CEWI,POST_INC,false,bret,prs_arg);
 										
-#line 1753 "ncoTree.cpp"
+#line 1752 "ncoTree.cpp"
 									}
 								}
 								else if ((_t->getType() == POST_DEC)) {
@@ -1762,11 +1761,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 									_t = __t319;
 									_t = _t->getNextSibling();
 									if ( inputState->guessing==0 ) {
-#line 2337 "ncoGrammer.g"
+#line 2334 "ncoGrammer.g"
 										
 										var=ncap_var_var_inc(var1,NULL_CEWI,POST_DEC,false,bret,prs_arg);
 										
-#line 1770 "ncoTree.cpp"
+#line 1769 "ncoTree.cpp"
 									}
 								}
 								else {
@@ -1831,11 +1830,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 										_t = __t334;
 										_t = _t->getNextSibling();
 										if ( inputState->guessing==0 ) {
-#line 2370 "ncoGrammer.g"
+#line 2367 "ncoGrammer.g"
 											
 											var=ncap_var_var_inc(var1,var2,PLUS_ASSIGN ,false, bret,prs_arg);
 											
-#line 1839 "ncoTree.cpp"
+#line 1838 "ncoTree.cpp"
 										}
 									}
 									else {
@@ -1891,11 +1890,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 											_t = __t339;
 											_t = _t->getNextSibling();
 											if ( inputState->guessing==0 ) {
-#line 2374 "ncoGrammer.g"
+#line 2371 "ncoGrammer.g"
 												
 												var=ncap_var_var_inc(var1,var2, PLUS_ASSIGN ,true, bret,prs_arg);
 												
-#line 1899 "ncoTree.cpp"
+#line 1898 "ncoTree.cpp"
 											}
 										}
 										else {
@@ -1952,13 +1951,13 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 												_t = __t345;
 												_t = _t->getNextSibling();
 												if ( inputState->guessing==0 ) {
-#line 2378 "ncoGrammer.g"
+#line 2375 "ncoGrammer.g"
 													
 													
 													var1=out(att2var(atp));     
 													var=ncap_var_var_inc(var1,var2, PLUS_ASSIGN ,false,bret, prs_arg);
 													
-#line 1962 "ncoTree.cpp"
+#line 1961 "ncoTree.cpp"
 												}
 											}
 											else {
@@ -2023,11 +2022,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 													_t = __t351;
 													_t = _t->getNextSibling();
 													if ( inputState->guessing==0 ) {
-#line 2385 "ncoGrammer.g"
+#line 2382 "ncoGrammer.g"
 														
 														var=ncap_var_var_inc(var1,var2, MINUS_ASSIGN ,false, bret,prs_arg);
 														
-#line 2031 "ncoTree.cpp"
+#line 2030 "ncoTree.cpp"
 													}
 												}
 												else {
@@ -2083,11 +2082,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 														_t = __t356;
 														_t = _t->getNextSibling();
 														if ( inputState->guessing==0 ) {
-#line 2389 "ncoGrammer.g"
+#line 2386 "ncoGrammer.g"
 															
 															var=ncap_var_var_inc(var1,var2, MINUS_ASSIGN ,true, bret,prs_arg);
 															
-#line 2091 "ncoTree.cpp"
+#line 2090 "ncoTree.cpp"
 														}
 													}
 													else {
@@ -2144,12 +2143,12 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 															_t = __t362;
 															_t = _t->getNextSibling();
 															if ( inputState->guessing==0 ) {
-#line 2393 "ncoGrammer.g"
+#line 2390 "ncoGrammer.g"
 																
 																var1=out(att2var(atm));     
 																var=ncap_var_var_inc(var1,var2, MINUS_ASSIGN ,false, bret,prs_arg);
 																
-#line 2153 "ncoTree.cpp"
+#line 2152 "ncoTree.cpp"
 															}
 														}
 														else {
@@ -2214,11 +2213,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																_t = __t368;
 																_t = _t->getNextSibling();
 																if ( inputState->guessing==0 ) {
-#line 2398 "ncoGrammer.g"
+#line 2395 "ncoGrammer.g"
 																	
 																	var=ncap_var_var_inc(var1,var2, TIMES_ASSIGN ,false, bret,prs_arg);
 																	
-#line 2222 "ncoTree.cpp"
+#line 2221 "ncoTree.cpp"
 																}
 															}
 															else {
@@ -2274,11 +2273,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																	_t = __t373;
 																	_t = _t->getNextSibling();
 																	if ( inputState->guessing==0 ) {
-#line 2402 "ncoGrammer.g"
+#line 2399 "ncoGrammer.g"
 																		
 																		var=ncap_var_var_inc(var1,var2, TIMES_ASSIGN ,true, bret,prs_arg);
 																		
-#line 2282 "ncoTree.cpp"
+#line 2281 "ncoTree.cpp"
 																	}
 																}
 																else {
@@ -2335,12 +2334,12 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																		_t = __t379;
 																		_t = _t->getNextSibling();
 																		if ( inputState->guessing==0 ) {
-#line 2406 "ncoGrammer.g"
+#line 2403 "ncoGrammer.g"
 																			
 																			var1=out(att2var(attm));     
 																			var=ncap_var_var_inc(var1,var2, TIMES_ASSIGN ,false, bret,prs_arg);
 																			
-#line 2344 "ncoTree.cpp"
+#line 2343 "ncoTree.cpp"
 																		}
 																	}
 																	else {
@@ -2405,11 +2404,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																			_t = __t385;
 																			_t = _t->getNextSibling();
 																			if ( inputState->guessing==0 ) {
-#line 2411 "ncoGrammer.g"
+#line 2408 "ncoGrammer.g"
 																				
 																				var=ncap_var_var_inc(var1,var2, DIVIDE_ASSIGN ,false, bret,prs_arg);
 																				
-#line 2413 "ncoTree.cpp"
+#line 2412 "ncoTree.cpp"
 																			}
 																		}
 																		else {
@@ -2465,11 +2464,11 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																				_t = __t390;
 																				_t = _t->getNextSibling();
 																				if ( inputState->guessing==0 ) {
-#line 2415 "ncoGrammer.g"
+#line 2412 "ncoGrammer.g"
 																					
 																					var=ncap_var_var_inc(var1,var2, DIVIDE_ASSIGN ,true, bret,prs_arg);
 																					
-#line 2473 "ncoTree.cpp"
+#line 2472 "ncoTree.cpp"
 																				}
 																			}
 																			else {
@@ -2526,12 +2525,12 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																					_t = __t396;
 																					_t = _t->getNextSibling();
 																					if ( inputState->guessing==0 ) {
-#line 2419 "ncoGrammer.g"
+#line 2416 "ncoGrammer.g"
 																						
 																						var1=out(att2var(atd));        
 																						var=ncap_var_var_inc(var1,var2, DIVIDE_ASSIGN ,false, bret,prs_arg);
 																						
-#line 2535 "ncoTree.cpp"
+#line 2534 "ncoTree.cpp"
 																					}
 																				}
 																				else {
@@ -2593,14 +2592,14 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																						_t = __t402;
 																						_t = _t->getNextSibling();
 																						if ( inputState->guessing==0 ) {
-#line 2425 "ncoGrammer.g"
+#line 2422 "ncoGrammer.g"
 																							
 																							if(prs_arg->ntl_scn)
 																							var=assign_ntl(asn,false,bret); 
 																							else
 																							var=assign(asn,false,bret);
 																							
-#line 2604 "ncoTree.cpp"
+#line 2603 "ncoTree.cpp"
 																						}
 																					}
 																					else {
@@ -2653,7 +2652,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																							_t = __t407;
 																							_t = _t->getNextSibling();
 																							if ( inputState->guessing==0 ) {
-#line 2433 "ncoGrammer.g"
+#line 2430 "ncoGrammer.g"
 																								
 																								
 																								RefAST tr;
@@ -2668,7 +2667,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																								else
 																								var=assign(tr,false,bret);
 																								
-#line 2672 "ncoTree.cpp"
+#line 2671 "ncoTree.cpp"
 																							}
 																						}
 																						else if ((_t->getType() == ASSIGN)) {
@@ -2715,7 +2714,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																							_t = __t409;
 																							_t = _t->getNextSibling();
 																							if ( inputState->guessing==0 ) {
-#line 2449 "ncoGrammer.g"
+#line 2446 "ncoGrammer.g"
 																								
 																								// Check for RAM variable - if present 
 																								// change tree - for example from:
@@ -2759,7 +2758,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																								var=assign(tr, true,bret);
 																								
 																								
-#line 2763 "ncoTree.cpp"
+#line 2762 "ncoTree.cpp"
 																							}
 																						}
 																						else {
@@ -2800,7 +2799,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																								_t = __t421;
 																								_t = _t->getNextSibling();
 																								if ( inputState->guessing==0 ) {
-#line 2586 "ncoGrammer.g"
+#line 2583 "ncoGrammer.g"
 																									
 																											
 																											    // fxm: 4 Oct 2015
@@ -2827,7 +2826,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																									
 																									
 																									
-#line 2831 "ncoTree.cpp"
+#line 2830 "ncoTree.cpp"
 																								}
 																							}
 																							else {
@@ -2868,7 +2867,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																									_t = __t425;
 																									_t = _t->getNextSibling();
 																									if ( inputState->guessing==0 ) {
-#line 2614 "ncoGrammer.g"
+#line 2611 "ncoGrammer.g"
 																										
 																										
 																										std::string att_nm=attl->getText();
@@ -2970,7 +2969,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																										
 																										attl_end: ; 
 																										
-#line 2974 "ncoTree.cpp"
+#line 2973 "ncoTree.cpp"
 																									}
 																								}
 																								else if ((_t->getType() == VAR_ID)) {
@@ -2978,7 +2977,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																									match(_t,VAR_ID);
 																									_t = _t->getNextSibling();
 																									if ( inputState->guessing==0 ) {
-#line 2720 "ncoGrammer.g"
+#line 2717 "ncoGrammer.g"
 																										
 																										//dbg_prn(fnc_nm,"getting regular var in out "+v->getText());
 																										
@@ -3009,7 +3008,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																										
 																										
 																										
-#line 3013 "ncoTree.cpp"
+#line 3012 "ncoTree.cpp"
 																									}
 																								}
 																								else if ((_t->getType() == ATT_ID)) {
@@ -3017,7 +3016,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																									match(_t,ATT_ID);
 																									_t = _t->getNextSibling();
 																									if ( inputState->guessing==0 ) {
-#line 2752 "ncoGrammer.g"
+#line 2749 "ncoGrammer.g"
 																										
 																										
 																										var=att_plain(att);  
@@ -3050,7 +3049,7 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 																										*/
 																										
 																										
-#line 3054 "ncoTree.cpp"
+#line 3053 "ncoTree.cpp"
 																									}
 																								}
 		else {
@@ -3074,9 +3073,9 @@ var_sct * ncoTree::out(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 	bool bram,bool bret
 ) {
-#line 1442 "ncoGrammer.g"
+#line 1439 "ncoGrammer.g"
 	var_sct *var;
-#line 3080 "ncoTree.cpp"
+#line 3079 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST assign_ntl_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vid = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST lmt = ANTLR_USE_NAMESPACE(antlr)nullAST;
@@ -3086,12 +3085,12 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 	ANTLR_USE_NAMESPACE(antlr)RefAST att = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST att1 = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST att2 = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 1442 "ncoGrammer.g"
+#line 1439 "ncoGrammer.g"
 	
 	const std::string fnc_nm("assign_ntl"); 
 	var=NULL_CEWI;
 	
-#line 3095 "ncoTree.cpp"
+#line 3094 "ncoTree.cpp"
 	
 	try {      // for error handling
 		bool synPredMatched243 = false;
@@ -3131,7 +3130,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 			_t = __t244;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1447 "ncoGrammer.g"
+#line 1444 "ncoGrammer.g"
 				
 				
 				std::string var_nm; 
@@ -3163,7 +3162,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 				(void)prs_arg->int_vtr.push_ow(Nvar);
 				}
 				
-#line 3167 "ncoTree.cpp"
+#line 3166 "ncoTree.cpp"
 			}
 		}
 		else {
@@ -3225,7 +3224,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 				_t = __t249;
 				_t = _t->getNextSibling();
 				if ( inputState->guessing==0 ) {
-#line 1479 "ncoGrammer.g"
+#line 1476 "ncoGrammer.g"
 					
 					
 					int idx;
@@ -3301,7 +3300,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 					
 					bcst=false;   
 					
-#line 3305 "ncoTree.cpp"
+#line 3304 "ncoTree.cpp"
 				}
 			}
 			else if ((_t->getType() == VAR_ID)) {
@@ -3309,7 +3308,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 				match(_t,VAR_ID);
 				_t = _t->getNextSibling();
 				if ( inputState->guessing==0 ) {
-#line 1555 "ncoGrammer.g"
+#line 1552 "ncoGrammer.g"
 					
 					
 					var_sct *var_rhs=NULL_CEWI;
@@ -3369,7 +3368,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 					
 					
 					
-#line 3373 "ncoTree.cpp"
+#line 3372 "ncoTree.cpp"
 				}
 			}
 			else {
@@ -3410,7 +3409,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 					_t = __t253;
 					_t = _t->getNextSibling();
 					if ( inputState->guessing==0 ) {
-#line 1615 "ncoGrammer.g"
+#line 1612 "ncoGrammer.g"
 						
 						
 						//In Initial scan all newly defined atts are flagged as Undefined
@@ -3431,7 +3430,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 						var=(var_sct*)NULL; 
 						
 						
-#line 3435 "ncoTree.cpp"
+#line 3434 "ncoTree.cpp"
 					}
 				}
 				else {
@@ -3472,11 +3471,11 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 						_t = __t257;
 						_t = _t->getNextSibling();
 						if ( inputState->guessing==0 ) {
-#line 1636 "ncoGrammer.g"
+#line 1633 "ncoGrammer.g"
 							
 							;
 							
-#line 3480 "ncoTree.cpp"
+#line 3479 "ncoTree.cpp"
 						}
 					}
 					else if ((_t->getType() == ATT_ID)) {
@@ -3484,7 +3483,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 						match(_t,ATT_ID);
 						_t = _t->getNextSibling();
 						if ( inputState->guessing==0 ) {
-#line 1639 "ncoGrammer.g"
+#line 1636 "ncoGrammer.g"
 							
 							
 							//In Initial scan all newly defined atts are flagged as Undefined
@@ -3505,7 +3504,7 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 							var=(var_sct*)NULL;    
 							
 							
-#line 3509 "ncoTree.cpp"
+#line 3508 "ncoTree.cpp"
 						}
 					}
 		else {
@@ -3529,9 +3528,9 @@ var_sct * ncoTree::assign_ntl(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 	bool bram,bool bret
 ) {
-#line 1662 "ncoGrammer.g"
+#line 1659 "ncoGrammer.g"
 	var_sct *var;
-#line 3535 "ncoTree.cpp"
+#line 3534 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST assign_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vid = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST lmt = ANTLR_USE_NAMESPACE(antlr)nullAST;
@@ -3542,12 +3541,12 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 	ANTLR_USE_NAMESPACE(antlr)RefAST lmta = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST att1 = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST att2 = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 1662 "ncoGrammer.g"
+#line 1659 "ncoGrammer.g"
 	
 	const std::string fnc_nm("assign"); 
 	var=NULL_CEWI;
 	
-#line 3551 "ncoTree.cpp"
+#line 3550 "ncoTree.cpp"
 	
 	try {      // for error handling
 		bool synPredMatched261 = false;
@@ -3587,7 +3586,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 			_t = __t262;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 1668 "ncoGrammer.g"
+#line 1665 "ncoGrammer.g"
 				
 				
 				int idx;
@@ -3784,7 +3783,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 				
 				
 				
-#line 3788 "ncoTree.cpp"
+#line 3787 "ncoTree.cpp"
 			}
 		}
 		else {
@@ -3846,7 +3845,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 				_t = __t267;
 				_t = _t->getNextSibling();
 				if ( inputState->guessing==0 ) {
-#line 1866 "ncoGrammer.g"
+#line 1863 "ncoGrammer.g"
 					
 					
 					var_sct *var1;
@@ -3944,7 +3943,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 					var_cst=nco_var_free(var_cst); 
 					
 					
-#line 3948 "ncoTree.cpp"
+#line 3947 "ncoTree.cpp"
 				}
 			}
 			else if ((_t->getType() == VAR_ID)) {
@@ -3952,12 +3951,12 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 				match(_t,VAR_ID);
 				_t = _t->getNextSibling();
 				if ( inputState->guessing==0 ) {
-#line 1964 "ncoGrammer.g"
+#line 1961 "ncoGrammer.g"
 					
 					
 					// Set class wide variables
-					var_sct *var_rhs;
-					var_sct *var_shp;
+					var_sct *var_rhs=NULL_CEWI; ;
+					var_sct *var_shp=NULL_CEWI; ;
 					NcapVar *Nvar;
 					std::string var_nm;
 					
@@ -4061,7 +4060,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 					
 					
 					
-#line 4065 "ncoTree.cpp"
+#line 4064 "ncoTree.cpp"
 				}
 			}
 			else {
@@ -4102,7 +4101,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 					_t = __t271;
 					_t = _t->getNextSibling();
 					if ( inputState->guessing==0 ) {
-#line 2073 "ncoGrammer.g"
+#line 2070 "ncoGrammer.g"
 						
 						
 						long srt,end,cnt,srd;  
@@ -4160,11 +4159,11 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 						{ 
 						long szn; 
 						long idx; 
-						long cnt=0;  
+						
 						char buffer[NC_MAX_ATTRS];  
 						
 						buffer[0]='\0';
-						
+						cnt=0L;
 						cast_void_nctype(NC_STRING, &var_lhs->val);    
 						cast_void_nctype(var_rhs->type, &var_rhs->val);     
 						
@@ -4257,7 +4256,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 						
 						
 						
-#line 4261 "ncoTree.cpp"
+#line 4260 "ncoTree.cpp"
 					}
 				}
 				else {
@@ -4298,11 +4297,11 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 						_t = __t275;
 						_t = _t->getNextSibling();
 						if ( inputState->guessing==0 ) {
-#line 2228 "ncoGrammer.g"
+#line 2225 "ncoGrammer.g"
 							
 							;
 							
-#line 4306 "ncoTree.cpp"
+#line 4305 "ncoTree.cpp"
 						}
 					}
 					else if ((_t->getType() == ATT_ID)) {
@@ -4310,7 +4309,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 						match(_t,ATT_ID);
 						_t = _t->getNextSibling();
 						if ( inputState->guessing==0 ) {
-#line 2231 "ncoGrammer.g"
+#line 2228 "ncoGrammer.g"
 							
 							
 							var_sct *var1;
@@ -4350,7 +4349,7 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 							
 							
 							
-#line 4354 "ncoTree.cpp"
+#line 4353 "ncoTree.cpp"
 						}
 					}
 		else {
@@ -4372,14 +4371,14 @@ var_sct * ncoTree::assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 }
 
 var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 2885 "ncoGrammer.g"
+#line 2882 "ncoGrammer.g"
 	var_sct *var;
-#line 4378 "ncoTree.cpp"
+#line 4377 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST out_asn_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vid1 = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vid = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST att = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 2885 "ncoGrammer.g"
+#line 2882 "ncoGrammer.g"
 	
 	const std::string fnc_nm("assign_asn");
 	var=NULL_CEWI; 
@@ -4387,7 +4386,7 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 	NcapVar *Nvar;
 	
 	
-#line 4391 "ncoTree.cpp"
+#line 4390 "ncoTree.cpp"
 	
 	try {      // for error handling
 		if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST )
@@ -4405,7 +4404,7 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			_t = __t427;
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2895 "ncoGrammer.g"
+#line 2892 "ncoGrammer.g"
 				
 				if(vid1->getFirstChild())
 				err_prn(fnc_nm,"Invalid Lvalue " +vid1->getText() );
@@ -4423,7 +4422,7 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				}
 				
 				
-#line 4427 "ncoTree.cpp"
+#line 4426 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -4433,7 +4432,7 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,VAR_ID);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2913 "ncoGrammer.g"
+#line 2910 "ncoGrammer.g"
 				
 				var_nm_s=vid->getText();  
 				if(vid->getFirstChild())
@@ -4454,7 +4453,7 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				}
 				
 				
-#line 4458 "ncoTree.cpp"
+#line 4457 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -4464,10 +4463,10 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			match(_t,ATT_ID);
 			_t = _t->getNextSibling();
 			if ( inputState->guessing==0 ) {
-#line 2934 "ncoGrammer.g"
+#line 2931 "ncoGrammer.g"
 				
 				// check "output"
-				NcapVar *Nvar=NULL;
+				
 				
 				if(att->getFirstChild())
 				err_prn(fnc_nm,"Invalid Lvalue " +att->getText() );
@@ -4501,7 +4500,7 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 				
 				
 				
-#line 4505 "ncoTree.cpp"
+#line 4504 "ncoTree.cpp"
 			}
 			break;
 		}
@@ -4525,27 +4524,27 @@ var_sct * ncoTree::out_asn(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 }
 
 var_sct * ncoTree::att_plain(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 2974 "ncoGrammer.g"
+#line 2971 "ncoGrammer.g"
 	var_sct *var;
-#line 4531 "ncoTree.cpp"
+#line 4530 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST att_plain_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST att = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 2974 "ncoGrammer.g"
+#line 2971 "ncoGrammer.g"
 	
 	const std::string fnc_nm("att_plain");
 	var=NULL_CEWI; 
 	string att_nm; 
-	NcapVar *Nvar;
 	
 	
-#line 4542 "ncoTree.cpp"
+	
+#line 4541 "ncoTree.cpp"
 	
 	try {      // for error handling
 		att = _t;
 		match(_t,ATT_ID);
 		_t = _t->getNextSibling();
 		if ( inputState->guessing==0 ) {
-#line 2984 "ncoGrammer.g"
+#line 2981 "ncoGrammer.g"
 			
 			// check "output"
 			NcapVar *Nvar=NULL;
@@ -4576,7 +4575,7 @@ var_sct * ncoTree::att_plain(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			var->val.vp=(void*)nco_free(var->val.vp);
 			
 			
-#line 4580 "ncoTree.cpp"
+#line 4579 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -4593,12 +4592,12 @@ var_sct * ncoTree::att_plain(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 }
 
  RefAST  ncoTree::att2var(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 3021 "ncoGrammer.g"
+#line 3018 "ncoGrammer.g"
 	 RefAST tr ;
-#line 4599 "ncoTree.cpp"
+#line 4598 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST att2var_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST att = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 3021 "ncoGrammer.g"
+#line 3018 "ncoGrammer.g"
 	
 	var_sct *var=NULL_CEWI; 
 	NcapVar *Nvar;
@@ -4607,7 +4606,7 @@ var_sct * ncoTree::att_plain(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 	std::string fnc_nm("att2var");
 	
 	
-#line 4611 "ncoTree.cpp"
+#line 4610 "ncoTree.cpp"
 	
 	try {      // for error handling
 		{
@@ -4616,7 +4615,7 @@ var_sct * ncoTree::att_plain(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 		_t = _t->getNextSibling();
 		}
 		if ( inputState->guessing==0 ) {
-#line 3032 "ncoGrammer.g"
+#line 3029 "ncoGrammer.g"
 			
 			/* sn can be empty on 1st Parse but not 2nd */
 			att_nm=att->getText();
@@ -4645,7 +4644,7 @@ var_sct * ncoTree::att_plain(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			tr->setText(sn);
 			
 			
-#line 4649 "ncoTree.cpp"
+#line 4648 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -4662,17 +4661,17 @@ var_sct * ncoTree::att_plain(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 }
 
 var_sct * ncoTree::value_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 3065 "ncoGrammer.g"
+#line 3062 "ncoGrammer.g"
 	var_sct *var;
-#line 4668 "ncoTree.cpp"
+#line 4667 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST value_list_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vlst = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 3065 "ncoGrammer.g"
+#line 3062 "ncoGrammer.g"
 	
 	const std::string fnc_nm("value_list");
 	var=NULL_CEWI; 
 	
-#line 4676 "ncoTree.cpp"
+#line 4675 "ncoTree.cpp"
 	
 	try {      // for error handling
 		{
@@ -4681,7 +4680,7 @@ var_sct * ncoTree::value_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 		_t = _t->getNextSibling();
 		}
 		if ( inputState->guessing==0 ) {
-#line 3070 "ncoGrammer.g"
+#line 3067 "ncoGrammer.g"
 			
 			char *cp;  
 			int nbr_lst;
@@ -4756,7 +4755,7 @@ var_sct * ncoTree::value_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			var=var_ret;
 			
 			
-#line 4760 "ncoTree.cpp"
+#line 4759 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -4773,17 +4772,17 @@ var_sct * ncoTree::value_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 }
 
 var_sct * ncoTree::value_list_string(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 3147 "ncoGrammer.g"
+#line 3144 "ncoGrammer.g"
 	var_sct *var;
-#line 4779 "ncoTree.cpp"
+#line 4778 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST value_list_string_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vlst = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 3147 "ncoGrammer.g"
+#line 3144 "ncoGrammer.g"
 	
 	const std::string fnc_nm("value_list");
 	var=NULL_CEWI; 
 	
-#line 4787 "ncoTree.cpp"
+#line 4786 "ncoTree.cpp"
 	
 	try {      // for error handling
 		{
@@ -4792,10 +4791,10 @@ var_sct * ncoTree::value_list_string(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 		_t = _t->getNextSibling();
 		}
 		if ( inputState->guessing==0 ) {
-#line 3152 "ncoGrammer.g"
+#line 3149 "ncoGrammer.g"
+			
 			
 			
-			char *cp;
 			int nbr_lst;
 			int idx;
 			int tsz;
@@ -4850,7 +4849,7 @@ var_sct * ncoTree::value_list_string(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			
 			
 			
-#line 4854 "ncoTree.cpp"
+#line 4853 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -4867,17 +4866,17 @@ var_sct * ncoTree::value_list_string(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 }
 
 var_sct * ncoTree::value_list_old(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 3213 "ncoGrammer.g"
+#line 3210 "ncoGrammer.g"
 	var_sct *var;
-#line 4873 "ncoTree.cpp"
+#line 4872 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST value_list_old_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vlst = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 3213 "ncoGrammer.g"
+#line 3210 "ncoGrammer.g"
 	
 	const std::string fnc_nm("value_list");
 	var=NULL_CEWI; 
 	
-#line 4881 "ncoTree.cpp"
+#line 4880 "ncoTree.cpp"
 	
 	try {      // for error handling
 		{
@@ -4886,7 +4885,7 @@ var_sct * ncoTree::value_list_old(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 		_t = _t->getNextSibling();
 		}
 		if ( inputState->guessing==0 ) {
-#line 3218 "ncoGrammer.g"
+#line 3215 "ncoGrammer.g"
 			
 			
 			char *cp;
@@ -4975,7 +4974,7 @@ var_sct * ncoTree::value_list_old(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			var=var_ret;
 			
 			
-#line 4979 "ncoTree.cpp"
+#line 4978 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -4994,20 +4993,20 @@ var_sct * ncoTree::value_list_old(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 var_sct * ncoTree::value_list_string_old(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 	 std::vector<var_sct*> &exp_vtr
 ) {
-#line 3314 "ncoGrammer.g"
+#line 3311 "ncoGrammer.g"
 	var_sct *var;
-#line 5000 "ncoTree.cpp"
+#line 4999 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST value_list_string_old_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
-#line 3314 "ncoGrammer.g"
+#line 3311 "ncoGrammer.g"
 	
 	const std::string fnc_nm("value_list_string");
 	var=NULL_CEWI; 
 	
-#line 5007 "ncoTree.cpp"
+#line 5006 "ncoTree.cpp"
 	
 	try {      // for error handling
 		if ( inputState->guessing==0 ) {
-#line 3320 "ncoGrammer.g"
+#line 3317 "ncoGrammer.g"
 			
 			int idx;
 			int nbr_lst;
@@ -5056,7 +5055,7 @@ var_sct * ncoTree::value_list_string_old(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 			end_val: var=var_ret;
 			
 			
-#line 5060 "ncoTree.cpp"
+#line 5059 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -5075,18 +5074,18 @@ var_sct * ncoTree::value_list_string_old(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 bool  ncoTree::where_assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 	var_sct *var_msk
 ) {
-#line 3371 "ncoGrammer.g"
+#line 3368 "ncoGrammer.g"
 	bool bret=false;
-#line 5081 "ncoTree.cpp"
+#line 5080 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST where_assign_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
-#line 3371 "ncoGrammer.g"
+#line 3368 "ncoGrammer.g"
 	
 	const std::string fnc_nm("where_assign");
 	var_sct *var_lhs;
 	var_sct *var_rhs;
 	
 	
-#line 5090 "ncoTree.cpp"
+#line 5089 "ncoTree.cpp"
 	
 	try {      // for error handling
 		ANTLR_USE_NAMESPACE(antlr)RefAST __t439 = _t;
@@ -5106,7 +5105,7 @@ bool  ncoTree::where_assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 		_t = __t439;
 		_t = _t->getNextSibling();
 		if ( inputState->guessing==0 ) {
-#line 3379 "ncoGrammer.g"
+#line 3376 "ncoGrammer.g"
 			
 			
 			bool bfr=false;
@@ -5163,7 +5162,6 @@ bool  ncoTree::where_assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 			char *cp_out;
 			short *sp;
 			long idx;
-			long jdx;
 			long sz;
 			size_t slb_sz;
 			
@@ -5210,7 +5208,7 @@ bool  ncoTree::where_assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 			prs_arg->ncap_var_write(var_lhs,false);
 			bret=true;
 			
-#line 5214 "ncoTree.cpp"
+#line 5212 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -5227,18 +5225,18 @@ bool  ncoTree::where_assign(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 }
 
 var_sct * ncoTree::var_lmt_one(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 3486 "ncoGrammer.g"
+#line 3482 "ncoGrammer.g"
 	var_sct *var;
-#line 5233 "ncoTree.cpp"
+#line 5231 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST var_lmt_one_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vid = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 3486 "ncoGrammer.g"
+#line 3482 "ncoGrammer.g"
 	
 	const std::string fnc_nm("var_lmt_one");
 	var=NULL_CEWI; 
 	var_sct *var_nbr;
 	
-#line 5242 "ncoTree.cpp"
+#line 5240 "ncoTree.cpp"
 	
 	try {      // for error handling
 		ANTLR_USE_NAMESPACE(antlr)RefAST __t442 = _t;
@@ -5262,7 +5260,7 @@ var_sct * ncoTree::var_lmt_one(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 		_t = __t442;
 		_t = _t->getNextSibling();
 		if ( inputState->guessing==0 ) {
-#line 3492 "ncoGrammer.g"
+#line 3488 "ncoGrammer.g"
 			
 			
 			int idx;
@@ -5363,7 +5361,7 @@ var_sct * ncoTree::var_lmt_one(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			end0:       var_nbr=nco_var_free(var_nbr);
 			var_rhs=nco_var_free(var_rhs);   
 			
-#line 5367 "ncoTree.cpp"
+#line 5365 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -5382,18 +5380,18 @@ var_sct * ncoTree::var_lmt_one(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 var_sct * ncoTree::var_lmt_one_lhs(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 	bool bram
 ) {
-#line 3597 "ncoGrammer.g"
+#line 3593 "ncoGrammer.g"
 	var_sct *var;
-#line 5388 "ncoTree.cpp"
+#line 5386 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST var_lmt_one_lhs_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vid = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 3597 "ncoGrammer.g"
+#line 3593 "ncoGrammer.g"
 	
 	const std::string fnc_nm("var_lmt_one_lhs");
 	var=NULL_CEWI; 
 	var_sct *var_nbr;
 	
-#line 5397 "ncoTree.cpp"
+#line 5395 "ncoTree.cpp"
 	
 	try {      // for error handling
 		ANTLR_USE_NAMESPACE(antlr)RefAST __t446 = _t;
@@ -5417,10 +5415,9 @@ var_sct * ncoTree::var_lmt_one_lhs(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 		_t = __t446;
 		_t = _t->getNextSibling();
 		if ( inputState->guessing==0 ) {
-#line 3603 "ncoGrammer.g"
+#line 3599 "ncoGrammer.g"
 			
 			int idx; 
-			int var_id; 
 			int slb_sz;
 			long srt;
 			
@@ -5568,7 +5565,7 @@ var_sct * ncoTree::var_lmt_one_lhs(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 			var_rhs=nco_var_free(var_rhs); 
 			var_nbr=nco_var_free(var_nbr); 
 			
-#line 5572 "ncoTree.cpp"
+#line 5569 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@@ -5585,18 +5582,18 @@ var_sct * ncoTree::var_lmt_one_lhs(ANTLR_USE_NAMESPACE(antlr)RefAST _t,
 }
 
 var_sct * ncoTree::var_lmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
-#line 3757 "ncoGrammer.g"
+#line 3752 "ncoGrammer.g"
 	var_sct *var;
-#line 5591 "ncoTree.cpp"
+#line 5588 "ncoTree.cpp"
 	ANTLR_USE_NAMESPACE(antlr)RefAST var_lmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t;
 	ANTLR_USE_NAMESPACE(antlr)RefAST vid = ANTLR_USE_NAMESPACE(antlr)nullAST;
 	ANTLR_USE_NAMESPACE(antlr)RefAST lmt = ANTLR_USE_NAMESPACE(antlr)nullAST;
-#line 3757 "ncoGrammer.g"
+#line 3752 "ncoGrammer.g"
 	
 	const std::string fnc_nm("var_lmt");
 	var=NULL_CEWI; 
 	
-#line 5600 "ncoTree.cpp"
+#line 5597 "ncoTree.cpp"
 	
 	try {      // for error handling
 		ANTLR_USE_NAMESPACE(antlr)RefAST __t450 = _t;
@@ -5609,7 +5606,7 @@ var_sct * ncoTree::var_lmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 		_t = __t450;
 		_t = _t->getNextSibling();
 		if ( inputState->guessing==0 ) {
-#line 3762 "ncoGrammer.g"
+#line 3757 "ncoGrammer.g"
 			
 			bool bram;   // Check for a RAM variable
 			bool bnrm;
@@ -5862,7 +5859,7 @@ var_sct * ncoTree::var_lmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) {
 			
 			end2: var_rhs=nco_var_free(var_rhs); 
 			
-#line 5866 "ncoTree.cpp"
+#line 5863 "ncoTree.cpp"
 		}
 	}
 	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
diff --git a/src/nco++/ncoTree.hpp b/src/nco++/ncoTree.hpp
index aa8a222..a74dc3e 100644
--- a/src/nco++/ncoTree.hpp
+++ b/src/nco++/ncoTree.hpp
@@ -3,7 +3,7 @@
 
 #include <antlr/config.hpp>
 #include "ncoParserTokenTypes.hpp"
-/* $ANTLR 2.7.7 (20161013): "ncoGrammer.g" -> "ncoTree.hpp"$ */
+/* $ANTLR 2.7.7 (20160429): "ncoGrammer.g" -> "ncoTree.hpp"$ */
 #include <antlr/TreeParser.hpp>
 
 #line 1 "ncoGrammer.g"
@@ -12,7 +12,7 @@
 
 /* Purpose: ANTLR Grammar and support files for ncap2 */
 
-/* Copyright (C) 1995--2017 Charlie Zender
+/* Copyright (C) 1995--2018 Charlie Zender
    This file is part of NCO, the netCDF Operators. NCO is free software.
    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 */
@@ -180,7 +180,6 @@ NcapVector<lmt_sct*> &lmt_vtr )
 	long jdx;
 	long sz;   
     long dmn_sz;     
-    ptr_unn op1;
 	var_sct *var;
 	std::string fnc_nm="lmt_var_mk"; 
 	
@@ -270,7 +269,6 @@ NcapVector<lmt_sct*> &lmt_vtr )
 
 int idx;
 int jdx;
-int sz;
 long ldx=0L;
 var_sct *var_out;
 lmt_sct *lmt_ptr;
diff --git a/src/nco++/prs_cls.cc b/src/nco++/prs_cls.cc
index 05b6622..7cc6ddd 100644
--- a/src/nco++/prs_cls.cc
+++ b/src/nco++/prs_cls.cc
@@ -312,8 +312,8 @@ prs_cls::ncap_var_write_omp(
   const char scl_fct_sng[]="scale_factor"; /* [sng] Unidata standard string for scale factor */
   const char fnc_nm[]="prs_cls::ncap_var_write";
 
-  int idx;
-  int rcd; /* [rcd] Return code */
+
+
   int var_out_id;
   
   bool bdef=false;
@@ -552,11 +552,11 @@ prs_cls::ncap_var_write_omp(
 
 void prs_cls::ncap_def_ntl_scn(void) {
   int idx;
-  int jdx;
+
   int sz;
   int var_id;
-  int rcd;
-  size_t cnks[NC_MAX_VAR_DIMS] = {0};
+
+  // size_t cnks[NC_MAX_VAR_DIMS] = {0};
   NcapVar *Nvar;
   NcapVar *Cvar;
   var_sct *var1;
@@ -747,11 +747,11 @@ int prs_cls::ncap_get_cnk_sz(var_sct *var){
   sz=dmn_in_vtr.size();
   for(idx=0;idx<dmn_var_nbr;idx++){
     for(jdx=0;jdx< sz;jdx++  )
-      if (dmn_in_vtr[jdx]->id == dim_id[idx])
-        break;
-        cnt[idx]= ( jdx<sz ?   dmn_in_vtr[jdx]->cnt: 0);
+      if (dmn_in_vtr[jdx]->id == dim_id[idx]) break;
+    
+    cnt[idx]= ( jdx<sz ?   dmn_in_vtr[jdx]->cnt: 0);
 
-    }
+  }
 
 
   // compare disc var cnt with var->cnt
diff --git a/src/nco/Makefile.am b/src/nco/Makefile.am
index 7f85af3..e91c91d 100644
--- a/src/nco/Makefile.am
+++ b/src/nco/Makefile.am
@@ -1,17 +1,5 @@
 # $Header$ -*-makefile-*-
 
-if BUILD_YACC_SOURCE
-NCAP=ncap
-else
-NCAP=
-endif
-
-if BUILD_YACC_SOURCE
-NCWA=ncwa
-else
-NCWA=
-endif
-
 if NCO_NEED_GETOPT_LONG
 NCO_GETOPT_C=nco_getopt.c
 NCO_GETOPT_H=nco_getopt.h
@@ -21,17 +9,14 @@ NCO_GETOPT_H=
 endif
 
 if ENABLE_MPI
-bin_PROGRAMS = ${NCAP} ncatted ncbo ncecat ncflint ncks ncpdq ncra ncrename mpncbo mpncecat mpncflint mpncpdq mpncra mpncwa ${NCWA}
+bin_PROGRAMS = ncatted ncbo ncecat ncflint ncks ncpdq ncra ncrename mpncbo mpncecat mpncflint mpncpdq mpncra mpncwa ncwa
 else
-bin_PROGRAMS = ${NCAP} ncatted ncbo ncecat ncflint ncks ncpdq ncra ncrename ${NCWA}
+bin_PROGRAMS = ncatted ncbo ncecat ncflint ncks ncpdq ncra ncrename ncwa
 endif
 
-BUILT_SOURCES = ncap_yacc.h
 
 AM_YFLAGS = -d --name-prefix=nco_yy
 
-ncap_SOURCES = ncap_utl.c ncap.c ncap_yacc.y ncap_lex.l
-ncap_LDADD = libnco.la
 
 ncatted_SOURCES = ncatted.c
 ncatted_LDADD = libnco.la
@@ -72,19 +57,19 @@ mpncpdq_LDADD = libnco.la
 mpncra_SOURCES = mpncra.c
 mpncra_LDADD = libnco.la
 
-# ncwa also requires ncap_yacc.y which should already have been built for ncap
-ncwa_SOURCES = ncwa.c ncap_utl.c ncap_lex.l ncap_yacc.c
+
+ncwa_SOURCES = ncwa.c ncap_utl.c ncap_lex.l 
 ncwa_LDADD = libnco.la
 
-mpncwa_SOURCES = mpncwa.c ncap_utl.c ncap_lex.l ncap_yacc.c
+mpncwa_SOURCES = mpncwa.c ncap_utl.c ncap_lex.l 
 mpncwa_LDADD = libnco.la
 
+
+
 HEADER_SRC = \
 libnco.h \
 ${NCO_GETOPT_H} \
 ncap.h \
-ncap_yacc.h \
-nco.h \
 nco_att_utl.h \
 nco_aux.h \
 nco_bnr.h \
@@ -131,6 +116,7 @@ nco_var_rth.h \
 nco_var_scv.h \
 nco_var_utl.h
 
+
 lib_LTLIBRARIES = libnco.la
 
 # This creates version-stamped shared-library, e.g., libnco-2.9.4.so
@@ -195,7 +181,7 @@ TESTS = ${DAP_TESTS}
 
 EXTRA_DIST = ${NCO_GETOPT_C}
 
-DISTCLEANFILES = ncap_lex.c ncap_yacc.c ncap_yacc.h
+DISTCLEANFILES = ncap_lex.c ncap_yacc.c 
 
 install-exec-hook:
 	cd $(DESTDIR)$(bindir) && ln -s -f ncbo ncdiff || (rm -f ncdiff && ln -s -f ncbo ncdiff)
diff --git a/src/nco/Makefile.in b/src/nco/Makefile.in
index c3b882c..d196ef4 100644
--- a/src/nco/Makefile.in
+++ b/src/nco/Makefile.in
@@ -92,19 +92,17 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
- at ENABLE_MPI_FALSE@bin_PROGRAMS = $(am__EXEEXT_1) ncatted$(EXEEXT) \
- at ENABLE_MPI_FALSE@	ncbo$(EXEEXT) ncecat$(EXEEXT) \
- at ENABLE_MPI_FALSE@	ncflint$(EXEEXT) ncks$(EXEEXT) \
- at ENABLE_MPI_FALSE@	ncpdq$(EXEEXT) ncra$(EXEEXT) \
- at ENABLE_MPI_FALSE@	ncrename$(EXEEXT) $(am__EXEEXT_2)
- at ENABLE_MPI_TRUE@bin_PROGRAMS = $(am__EXEEXT_1) ncatted$(EXEEXT) \
- at ENABLE_MPI_TRUE@	ncbo$(EXEEXT) ncecat$(EXEEXT) \
- at ENABLE_MPI_TRUE@	ncflint$(EXEEXT) ncks$(EXEEXT) ncpdq$(EXEEXT) \
- at ENABLE_MPI_TRUE@	ncra$(EXEEXT) ncrename$(EXEEXT) \
- at ENABLE_MPI_TRUE@	mpncbo$(EXEEXT) mpncecat$(EXEEXT) \
- at ENABLE_MPI_TRUE@	mpncflint$(EXEEXT) mpncpdq$(EXEEXT) \
- at ENABLE_MPI_TRUE@	mpncra$(EXEEXT) mpncwa$(EXEEXT) \
- at ENABLE_MPI_TRUE@	$(am__EXEEXT_2)
+ at ENABLE_MPI_FALSE@bin_PROGRAMS = ncatted$(EXEEXT) ncbo$(EXEEXT) \
+ at ENABLE_MPI_FALSE@	ncecat$(EXEEXT) ncflint$(EXEEXT) \
+ at ENABLE_MPI_FALSE@	ncks$(EXEEXT) ncpdq$(EXEEXT) ncra$(EXEEXT) \
+ at ENABLE_MPI_FALSE@	ncrename$(EXEEXT) ncwa$(EXEEXT)
+ at ENABLE_MPI_TRUE@bin_PROGRAMS = ncatted$(EXEEXT) ncbo$(EXEEXT) \
+ at ENABLE_MPI_TRUE@	ncecat$(EXEEXT) ncflint$(EXEEXT) \
+ at ENABLE_MPI_TRUE@	ncks$(EXEEXT) ncpdq$(EXEEXT) ncra$(EXEEXT) \
+ at ENABLE_MPI_TRUE@	ncrename$(EXEEXT) mpncbo$(EXEEXT) \
+ at ENABLE_MPI_TRUE@	mpncecat$(EXEEXT) mpncflint$(EXEEXT) \
+ at ENABLE_MPI_TRUE@	mpncpdq$(EXEEXT) mpncra$(EXEEXT) \
+ at ENABLE_MPI_TRUE@	mpncwa$(EXEEXT) ncwa$(EXEEXT)
 TESTS =
 subdir = src/nco
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -149,13 +147,13 @@ am__uninstall_files_from_dir = { \
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libnco_la_LIBADD =
-am__libnco_la_SOURCES_DIST = libnco.h nco_getopt.h ncap.h ncap_yacc.h \
-	nco.h nco_att_utl.h nco_aux.h nco_bnr.h nco_cln_utl.h \
-	nco_cnf_dmn.h nco_cnf_typ.h nco_cnk.h nco_cnv_arm.h \
-	nco_cnv_csm.h nco_ctl.h nco_dbg.h nco_dmn_utl.h nco_fl_utl.h \
-	nco_grp_utl.h nco_grp_trv.h nco_lmt.h nco_lst_utl.h nco_map.h \
-	nco_md5.h nco_mmr.h nco_mpi.h nco_msa.h nco_mss_val.h \
-	nco_mta.h nco_netcdf.h nco_omp.h nco_pck.h nco_ppc.h nco_prn.h \
+am__libnco_la_SOURCES_DIST = libnco.h nco_getopt.h ncap.h \
+	nco_att_utl.h nco_aux.h nco_bnr.h nco_cln_utl.h nco_cnf_dmn.h \
+	nco_cnf_typ.h nco_cnk.h nco_cnv_arm.h nco_cnv_csm.h nco_ctl.h \
+	nco_dbg.h nco_dmn_utl.h nco_fl_utl.h nco_grp_utl.h \
+	nco_grp_trv.h nco_lmt.h nco_lst_utl.h nco_map.h nco_md5.h \
+	nco_mmr.h nco_mpi.h nco_msa.h nco_mss_val.h nco_mta.h \
+	nco_netcdf.h nco_omp.h nco_pck.h nco_ppc.h nco_prn.h \
 	nco_rec_var.h nco_rgr.h nco_rth_flt.h nco_rth_utl.h \
 	nco_scl_utl.h nco_scm.h nco_sld.h nco_sng_utl.h nco_srm.h \
 	nco_typ.h nco_uthash.h nco_var_avg.h nco_var_lst.h \
@@ -191,8 +189,6 @@ am__v_lt_1 =
 libnco_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libnco_la_LDFLAGS) $(LDFLAGS) -o $@
- at BUILD_YACC_SOURCE_TRUE@am__EXEEXT_1 = ncap$(EXEEXT)
- at BUILD_YACC_SOURCE_TRUE@am__EXEEXT_2 = ncwa$(EXEEXT)
 PROGRAMS = $(bin_PROGRAMS)
 am_mpncbo_OBJECTS = mpncbo.$(OBJEXT)
 mpncbo_OBJECTS = $(am_mpncbo_OBJECTS)
@@ -210,13 +206,9 @@ am_mpncra_OBJECTS = mpncra.$(OBJEXT)
 mpncra_OBJECTS = $(am_mpncra_OBJECTS)
 mpncra_DEPENDENCIES = libnco.la
 am_mpncwa_OBJECTS = mpncwa.$(OBJEXT) ncap_utl.$(OBJEXT) \
-	ncap_lex.$(OBJEXT) ncap_yacc.$(OBJEXT)
+	ncap_lex.$(OBJEXT)
 mpncwa_OBJECTS = $(am_mpncwa_OBJECTS)
 mpncwa_DEPENDENCIES = libnco.la
-am_ncap_OBJECTS = ncap_utl.$(OBJEXT) ncap.$(OBJEXT) \
-	ncap_yacc.$(OBJEXT) ncap_lex.$(OBJEXT)
-ncap_OBJECTS = $(am_ncap_OBJECTS)
-ncap_DEPENDENCIES = libnco.la
 am_ncatted_OBJECTS = ncatted.$(OBJEXT)
 ncatted_OBJECTS = $(am_ncatted_OBJECTS)
 ncatted_DEPENDENCIES = libnco.la
@@ -241,8 +233,7 @@ ncra_DEPENDENCIES = libnco.la
 am_ncrename_OBJECTS = ncrename.$(OBJEXT)
 ncrename_OBJECTS = $(am_ncrename_OBJECTS)
 ncrename_DEPENDENCIES = libnco.la
-am_ncwa_OBJECTS = ncwa.$(OBJEXT) ncap_utl.$(OBJEXT) ncap_lex.$(OBJEXT) \
-	ncap_yacc.$(OBJEXT)
+am_ncwa_OBJECTS = ncwa.$(OBJEXT) ncap_utl.$(OBJEXT) ncap_lex.$(OBJEXT)
 ncwa_OBJECTS = $(am_ncwa_OBJECTS)
 ncwa_DEPENDENCIES = libnco.la
 AM_V_P = $(am__v_P_ at AM_V@)
@@ -288,28 +279,18 @@ am__v_LEX_ = $(am__v_LEX_ at AM_DEFAULT_V@)
 am__v_LEX_0 = @echo "  LEX     " $@;
 am__v_LEX_1 = 
 YLWRAP = $(top_srcdir)/autobld/ylwrap
- at MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
-am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
-		   -e s/c++$$/h++/ -e s/c$$/h/
-YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
-LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS)
-AM_V_YACC = $(am__v_YACC_ at AM_V@)
-am__v_YACC_ = $(am__v_YACC_ at AM_DEFAULT_V@)
-am__v_YACC_0 = @echo "  YACC    " $@;
-am__v_YACC_1 = 
 SOURCES = $(libnco_la_SOURCES) $(mpncbo_SOURCES) $(mpncecat_SOURCES) \
 	$(mpncflint_SOURCES) $(mpncpdq_SOURCES) $(mpncra_SOURCES) \
-	$(mpncwa_SOURCES) $(ncap_SOURCES) $(ncatted_SOURCES) \
+	$(mpncwa_SOURCES) $(ncatted_SOURCES) $(ncbo_SOURCES) \
+	$(ncecat_SOURCES) $(ncflint_SOURCES) $(ncks_SOURCES) \
+	$(ncpdq_SOURCES) $(ncra_SOURCES) $(ncrename_SOURCES) \
+	$(ncwa_SOURCES)
+DIST_SOURCES = $(am__libnco_la_SOURCES_DIST) $(mpncbo_SOURCES) \
+	$(mpncecat_SOURCES) $(mpncflint_SOURCES) $(mpncpdq_SOURCES) \
+	$(mpncra_SOURCES) $(mpncwa_SOURCES) $(ncatted_SOURCES) \
 	$(ncbo_SOURCES) $(ncecat_SOURCES) $(ncflint_SOURCES) \
 	$(ncks_SOURCES) $(ncpdq_SOURCES) $(ncra_SOURCES) \
 	$(ncrename_SOURCES) $(ncwa_SOURCES)
-DIST_SOURCES = $(am__libnco_la_SOURCES_DIST) $(mpncbo_SOURCES) \
-	$(mpncecat_SOURCES) $(mpncflint_SOURCES) $(mpncpdq_SOURCES) \
-	$(mpncra_SOURCES) $(mpncwa_SOURCES) $(ncap_SOURCES) \
-	$(ncatted_SOURCES) $(ncbo_SOURCES) $(ncecat_SOURCES) \
-	$(ncflint_SOURCES) $(ncks_SOURCES) $(ncpdq_SOURCES) \
-	$(ncra_SOURCES) $(ncrename_SOURCES) $(ncwa_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -512,7 +493,7 @@ am__set_b = \
 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
+	ncap_lex.c
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -602,8 +583,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -661,18 +640,11 @@ target_vendor = @target_vendor@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
- at BUILD_YACC_SOURCE_FALSE@NCAP = 
- at BUILD_YACC_SOURCE_TRUE@NCAP = ncap
- at BUILD_YACC_SOURCE_FALSE@NCWA = 
- at BUILD_YACC_SOURCE_TRUE@NCWA = ncwa
 @NCO_NEED_GETOPT_LONG_FALSE at NCO_GETOPT_C = 
 @NCO_NEED_GETOPT_LONG_TRUE at NCO_GETOPT_C = nco_getopt.c
 @NCO_NEED_GETOPT_LONG_FALSE at NCO_GETOPT_H = 
 @NCO_NEED_GETOPT_LONG_TRUE at NCO_GETOPT_H = nco_getopt.h
-BUILT_SOURCES = ncap_yacc.h
 AM_YFLAGS = -d --name-prefix=nco_yy
-ncap_SOURCES = ncap_utl.c ncap.c ncap_yacc.y ncap_lex.l
-ncap_LDADD = libnco.la
 ncatted_SOURCES = ncatted.c
 ncatted_LDADD = libnco.la
 ncbo_SOURCES = ncbo.c
@@ -699,18 +671,14 @@ mpncpdq_SOURCES = mpncpdq.c
 mpncpdq_LDADD = libnco.la
 mpncra_SOURCES = mpncra.c
 mpncra_LDADD = libnco.la
-
-# ncwa also requires ncap_yacc.y which should already have been built for ncap
-ncwa_SOURCES = ncwa.c ncap_utl.c ncap_lex.l ncap_yacc.c
+ncwa_SOURCES = ncwa.c ncap_utl.c ncap_lex.l 
 ncwa_LDADD = libnco.la
-mpncwa_SOURCES = mpncwa.c ncap_utl.c ncap_lex.l ncap_yacc.c
+mpncwa_SOURCES = mpncwa.c ncap_utl.c ncap_lex.l 
 mpncwa_LDADD = libnco.la
 HEADER_SRC = \
 libnco.h \
 ${NCO_GETOPT_H} \
 ncap.h \
-ncap_yacc.h \
-nco.h \
 nco_att_utl.h \
 nco_aux.h \
 nco_bnr.h \
@@ -817,13 +785,12 @@ nco_var_scv.c \
 nco_var_utl.c
 
 EXTRA_DIST = ${NCO_GETOPT_C}
-DISTCLEANFILES = ncap_lex.c ncap_yacc.c ncap_yacc.h
+DISTCLEANFILES = ncap_lex.c ncap_yacc.c 
 CLEANFILES = ncdiff ncea nces ncrcat mpncdiff mpncea mpnces mpncrcat
-all: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) all-am
+all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .l .lo .log .o .obj .test .test$(EXEEXT) .trs .y
+.SUFFIXES: .c .l .lo .log .o .obj .test .test$(EXEEXT) .trs
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -964,13 +931,6 @@ mpncra$(EXEEXT): $(mpncra_OBJECTS) $(mpncra_DEPENDENCIES) $(EXTRA_mpncra_DEPENDE
 mpncwa$(EXEEXT): $(mpncwa_OBJECTS) $(mpncwa_DEPENDENCIES) $(EXTRA_mpncwa_DEPENDENCIES) 
 	@rm -f mpncwa$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(mpncwa_OBJECTS) $(mpncwa_LDADD) $(LIBS)
-ncap_yacc.h: ncap_yacc.c
-	@if test ! -f $@; then rm -f ncap_yacc.c; else :; fi
-	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) ncap_yacc.c; else :; fi
-
-ncap$(EXEEXT): $(ncap_OBJECTS) $(ncap_DEPENDENCIES) $(EXTRA_ncap_DEPENDENCIES) 
-	@rm -f ncap$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(ncap_OBJECTS) $(ncap_LDADD) $(LIBS)
 
 ncatted$(EXEEXT): $(ncatted_OBJECTS) $(ncatted_DEPENDENCIES) $(EXTRA_ncatted_DEPENDENCIES) 
 	@rm -f ncatted$(EXEEXT)
@@ -1020,10 +980,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpncpdq.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpncra.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpncwa.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncap.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncap_lex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncap_utl.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncap_yacc.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncatted.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncbo.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncecat.Po at am__quote@
@@ -1101,9 +1059,6 @@ distclean-compile:
 .l.c:
 	$(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
 
-.y.c:
-	$(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE)
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -1350,8 +1305,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) check-am
+check: check-am
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
 install-binPROGRAMS: install-libLTLIBRARIES
 
@@ -1359,8 +1313,7 @@ installdirs:
 	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) install-am
+install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -1396,9 +1349,6 @@ maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
 	-rm -f ncap_lex.c
-	-rm -f ncap_yacc.c
-	-rm -f ncap_yacc.h
-	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
@@ -1472,8 +1422,7 @@ ps-am:
 uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 	@$(NORMAL_INSTALL)
 	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
-.MAKE: all check check-am install install-am install-exec-am \
-	install-strip uninstall-am
+.MAKE: check-am install-am install-exec-am install-strip uninstall-am
 
 .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
 	clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
diff --git a/src/nco/mpncbo.c b/src/nco/mpncbo.c
index 1254ba5..d9b7d9f 100644
--- a/src/nco/mpncbo.c
+++ b/src/nco/mpncbo.c
@@ -240,7 +240,7 @@ main(int argc,char **argv)
   
   static struct option opt_lng[]={ /* Structure ordered by short option key if possible */
     /* Long options with no argument, no short option counterpart */
-        {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
+    {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"mmr_cln",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
     {"dirty",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
@@ -279,6 +279,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
@@ -397,6 +399,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"msa_usr_rdr") || !strcmp(opt_crr,"msa_user_order")) MSA_USR_RDR=True; /* [flg] Multi-Slab Algorithm returns hyperslabs in user-specified order */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"create_ram") || !strcmp(opt_crr,"diskless_all")) RAM_CREATE=True; /* [flg] Open (netCDF3) file(s) in RAM */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
@@ -438,7 +441,6 @@ main(int argc,char **argv)
     case 'D': /* The debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -523,7 +525,7 @@ main(int argc,char **argv)
     if(opt_crr) opt_crr=(char *)nco_free(opt_crr);
   } /* end while loop */
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Make uniform list of user-specified chunksizes */
diff --git a/src/nco/mpncecat.c b/src/nco/mpncecat.c
index 90d7157..8fffcd5 100644
--- a/src/nco/mpncecat.c
+++ b/src/nco/mpncecat.c
@@ -196,7 +196,7 @@ main(int argc,char **argv)
   
   static struct option opt_lng[]={ /* Structure ordered by short option key if possible */
     /* Long options with no argument, no short option counterpart */
-        {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
+    {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"mmr_cln",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
     {"dirty",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
@@ -233,6 +233,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
@@ -352,6 +354,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"msa_usr_rdr") || !strcmp(opt_crr,"msa_user_order")) MSA_USR_RDR=True; /* [flg] Multi-Slab Algorithm returns hyperslabs in user-specified order */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"create_ram") || !strcmp(opt_crr,"diskless_all")) RAM_CREATE=True; /* [flg] Open (netCDF3) file(s) in RAM */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
@@ -393,7 +396,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -488,7 +490,7 @@ main(int argc,char **argv)
     if(opt_crr) opt_crr=(char *)nco_free(opt_crr);
   } /* end while loop */
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Make uniform list of user-specified chunksizes */
diff --git a/src/nco/mpncflint.c b/src/nco/mpncflint.c
index 15f5e07..6fc6dc2 100644
--- a/src/nco/mpncflint.c
+++ b/src/nco/mpncflint.c
@@ -218,7 +218,7 @@ main(int argc,char **argv)
   
   static struct option opt_lng[]={ /* Structure ordered by short option key if possible */
     /* Long options with no argument, no short option counterpart */
-        {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
+    {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"mmr_cln",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
     {"dirty",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
@@ -253,6 +253,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
@@ -369,6 +371,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"create_ram") || !strcmp(opt_crr,"diskless_all")) RAM_CREATE=True; /* [flg] Open (netCDF3) file(s) in RAM */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
@@ -409,7 +412,6 @@ main(int argc,char **argv)
     case 'D': /* The debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -529,7 +531,7 @@ main(int argc,char **argv)
     nco_exit(EXIT_FAILURE);
   } /* end else */
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Make uniform list of user-specified chunksizes */
diff --git a/src/nco/mpncpdq.c b/src/nco/mpncpdq.c
index 6dfcfa3..59ad9d0 100644
--- a/src/nco/mpncpdq.c
+++ b/src/nco/mpncpdq.c
@@ -252,6 +252,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
@@ -376,6 +378,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"create_ram") || !strcmp(opt_crr,"diskless_all")) RAM_CREATE=True; /* [flg] Open (netCDF3) file(s) in RAM */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
@@ -420,7 +423,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -511,7 +513,7 @@ main(int argc,char **argv)
     if(opt_crr) opt_crr=(char *)nco_free(opt_crr);
   } /* end while loop */
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Make uniform list of user-specified chunksizes */
diff --git a/src/nco/mpncra.c b/src/nco/mpncra.c
index b901e04..2f7139b 100644
--- a/src/nco/mpncra.c
+++ b/src/nco/mpncra.c
@@ -247,45 +247,48 @@ main(int argc,char **argv)
   int wrk_id_bfr[wrk_id_bfr_lng]; /* [bfr] Buffer for rnk_wrk */
 #endif /* !ENABLE_MPI */
   
-  static struct option opt_lng[]=
-    { /* Structure ordered by short option key if possible */
-      /* Long options with no argument, no short option counterpart */
-            {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
-      {"mmr_cln",no_argument,0,0}, /* [flg] Clean memory prior to exit */
-      {"drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
-      {"dirty",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
-      {"mmr_drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
-      {"ram_all",no_argument,0,0}, /* [flg] Open (netCDF3) and create file(s) in RAM */
-      {"create_ram",no_argument,0,0}, /* [flg] Create file in RAM */
-      {"open_ram",no_argument,0,0}, /* [flg] Open (netCDF3) file(s) in RAM */
-      {"diskless_all",no_argument,0,0}, /* [flg] Open (netCDF3) and create file(s) in RAM */
-      {"wrt_tmp_fl",no_argument,0,0}, /* [flg] Write output to temporary file */
-      {"write_tmp_fl",no_argument,0,0}, /* [flg] Write output to temporary file */
-      {"no_tmp_fl",no_argument,0,0}, /* [flg] Do not write output to temporary file */
-      {"version",no_argument,0,0},
-      {"vrs",no_argument,0,0},
-      /* Long options with argument, no short option counterpart */
-      {"bfr_sz_hnt",required_argument,0,0}, /* [B] Buffer size hint */
-      {"buffer_size_hint",required_argument,0,0}, /* [B] Buffer size hint */
-      {"cnk_byt",required_argument,0,0}, /* [B] Chunk size in bytes */
-      {"chunk_byte",required_argument,0,0}, /* [B] Chunk size in bytes */
-      {"cnk_dmn",required_argument,0,0}, /* [nbr] Chunk size */
-      {"chunk_dimension",required_argument,0,0}, /* [nbr] Chunk size */
-      {"cnk_map",required_argument,0,0}, /* [nbr] Chunking map */
-      {"chunk_map",required_argument,0,0}, /* [nbr] Chunking map */
-      {"cnk_min",required_argument,0,0}, /* [B] Minimize size of variable to chunk */
-      {"chunk_min",required_argument,0,0}, /* [B] Minimize size of variable to chunk */
-      {"cnk_plc",required_argument,0,0}, /* [nbr] Chunking policy */
-      {"chunk_policy",required_argument,0,0}, /* [nbr] Chunking policy */
-      {"cnk_scl",required_argument,0,0}, /* [nbr] Chunk size scalar */
-      {"chunk_scalar",required_argument,0,0}, /* [nbr] Chunk size scalar */
-      {"fl_fmt",required_argument,0,0},
-      {"file_format",required_argument,0,0},
-      {"gaa",required_argument,0,0}, /* [sng] Global attribute add */
-      {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
-      {"hdr_pad",required_argument,0,0},
-      {"header_pad",required_argument,0,0},
-      /* Long options with short counterparts */
+  static struct option opt_lng[]={ /* Structure ordered by short option key if possible */
+    /* Long options with no argument, no short option counterpart */
+    {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
+    {"mmr_cln",no_argument,0,0}, /* [flg] Clean memory prior to exit */
+    {"drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
+    {"dirty",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
+    {"mmr_drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
+    {"ram_all",no_argument,0,0}, /* [flg] Open (netCDF3) and create file(s) in RAM */
+    {"create_ram",no_argument,0,0}, /* [flg] Create file in RAM */
+    {"open_ram",no_argument,0,0}, /* [flg] Open (netCDF3) file(s) in RAM */
+    {"diskless_all",no_argument,0,0}, /* [flg] Open (netCDF3) and create file(s) in RAM */
+    {"wrt_tmp_fl",no_argument,0,0}, /* [flg] Write output to temporary file */
+    {"write_tmp_fl",no_argument,0,0}, /* [flg] Write output to temporary file */
+    {"no_tmp_fl",no_argument,0,0}, /* [flg] Do not write output to temporary file */
+    {"version",no_argument,0,0},
+    {"vrs",no_argument,0,0},
+    /* Long options with argument, no short option counterpart */
+    {"bfr_sz_hnt",required_argument,0,0}, /* [B] Buffer size hint */
+    {"buffer_size_hint",required_argument,0,0}, /* [B] Buffer size hint */
+    {"cnk_byt",required_argument,0,0}, /* [B] Chunk size in bytes */
+    {"chunk_byte",required_argument,0,0}, /* [B] Chunk size in bytes */
+    {"cnk_dmn",required_argument,0,0}, /* [nbr] Chunk size */
+    {"chunk_dimension",required_argument,0,0}, /* [nbr] Chunk size */
+    {"cnk_map",required_argument,0,0}, /* [nbr] Chunking map */
+    {"chunk_map",required_argument,0,0}, /* [nbr] Chunking map */
+    {"cnk_min",required_argument,0,0}, /* [B] Minimize size of variable to chunk */
+    {"chunk_min",required_argument,0,0}, /* [B] Minimize size of variable to chunk */
+    {"cnk_plc",required_argument,0,0}, /* [nbr] Chunking policy */
+    {"chunk_policy",required_argument,0,0}, /* [nbr] Chunking policy */
+    {"cnk_scl",required_argument,0,0}, /* [nbr] Chunk size scalar */
+    {"chunk_scalar",required_argument,0,0}, /* [nbr] Chunk size scalar */
+    {"fl_fmt",required_argument,0,0},
+    {"file_format",required_argument,0,0},
+    {"gaa",required_argument,0,0}, /* [sng] Global attribute add */
+    {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
+    {"hdr_pad",required_argument,0,0},
+    {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
     {"netcdf4",no_argument,0,'4'},
@@ -295,50 +298,50 @@ main(int argc,char **argv)
     {"pnetcdf",no_argument,0,'5'},
     {"64bit_offset",no_argument,0,'6'},
     {"7",no_argument,0,'7'},
-      {"append",no_argument,0,'A'},
-      {"coords",no_argument,0,'c'},
-      {"crd",no_argument,0,'c'},
-      {"no-coords",no_argument,0,'C'},
-      {"no-crd",no_argument,0,'C'},
-      {"debug",required_argument,0,'D'},
-      {"nco_dbg_lvl",required_argument,0,'D'},
-      {"dimension",required_argument,0,'d'},
-      {"dmn",required_argument,0,'d'},
-      {"fortran",no_argument,0,'F'},
-      {"ftn",no_argument,0,'F'},
-      {"fl_lst_in",no_argument,0,'H'},
-      {"file_list",no_argument,0,'H'},
-      {"history",no_argument,0,'h'},
-      {"hst",no_argument,0,'h'},
-      {"dfl_lvl",required_argument,0,'L'}, /* [enm] Deflate level */
-      {"deflate",required_argument,0,'L'}, /* [enm] Deflate level */
-      {"local",required_argument,0,'l'},
-      {"lcl",required_argument,0,'l'},
-      {"nintap",required_argument,0,'n'},
-      {"overwrite",no_argument,0,'O'},
-      {"ovr",no_argument,0,'O'},
-      {"output",required_argument,0,'o'},
-      {"fl_out",required_argument,0,'o'},
-      {"path",required_argument,0,'p'},
-      {"pack",required_argument,0,'P'},
-      {"retain",no_argument,0,'R'},
-      {"rtn",no_argument,0,'R'},
-      {"revision",no_argument,0,'r'},
-      {"suspend", no_argument,0,'S'},
-      {"thr_nbr",required_argument,0,'t'},
-      {"threads",required_argument,0,'t'},
-      {"omp_num_threads",required_argument,0,'t'},
-      {"variable",required_argument,0,'v'},
-      {"exclude",no_argument,0,'x'},
-      {"xcl",no_argument,0,'x'},
-      {"pseudonym",required_argument,0,'Y'},
-      {"program",required_argument,0,'Y'},
-      {"prg_nm",required_argument,0,'Y'},
-      {"math",required_argument,0,'y'},
-      {"help",no_argument,0,'?'},
-      {"hlp",no_argument,0,'?'},
-      {0,0,0,0}
-    }; /* end opt_lng */
+    {"append",no_argument,0,'A'},
+    {"coords",no_argument,0,'c'},
+    {"crd",no_argument,0,'c'},
+    {"no-coords",no_argument,0,'C'},
+    {"no-crd",no_argument,0,'C'},
+    {"debug",required_argument,0,'D'},
+    {"nco_dbg_lvl",required_argument,0,'D'},
+    {"dimension",required_argument,0,'d'},
+    {"dmn",required_argument,0,'d'},
+    {"fortran",no_argument,0,'F'},
+    {"ftn",no_argument,0,'F'},
+    {"fl_lst_in",no_argument,0,'H'},
+    {"file_list",no_argument,0,'H'},
+    {"history",no_argument,0,'h'},
+    {"hst",no_argument,0,'h'},
+    {"dfl_lvl",required_argument,0,'L'}, /* [enm] Deflate level */
+    {"deflate",required_argument,0,'L'}, /* [enm] Deflate level */
+    {"local",required_argument,0,'l'},
+    {"lcl",required_argument,0,'l'},
+    {"nintap",required_argument,0,'n'},
+    {"overwrite",no_argument,0,'O'},
+    {"ovr",no_argument,0,'O'},
+    {"output",required_argument,0,'o'},
+    {"fl_out",required_argument,0,'o'},
+    {"path",required_argument,0,'p'},
+    {"pack",required_argument,0,'P'},
+    {"retain",no_argument,0,'R'},
+    {"rtn",no_argument,0,'R'},
+    {"revision",no_argument,0,'r'},
+    {"suspend", no_argument,0,'S'},
+    {"thr_nbr",required_argument,0,'t'},
+    {"threads",required_argument,0,'t'},
+    {"omp_num_threads",required_argument,0,'t'},
+    {"variable",required_argument,0,'v'},
+    {"exclude",no_argument,0,'x'},
+    {"xcl",no_argument,0,'x'},
+    {"pseudonym",required_argument,0,'Y'},
+    {"program",required_argument,0,'Y'},
+    {"prg_nm",required_argument,0,'Y'},
+    {"math",required_argument,0,'y'},
+    {"help",no_argument,0,'?'},
+    {"hlp",no_argument,0,'?'},
+    {0,0,0,0}
+  }; /* end opt_lng */
   int opt_idx=0; /* Index of current long option into opt_lng array */
   
 #ifdef _LIBINTL_H
@@ -413,6 +416,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"create_ram") || !strcmp(opt_crr,"diskless_all")) RAM_CREATE=True; /* [flg] Open (netCDF3) file(s) in RAM */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
@@ -453,7 +457,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -555,7 +558,7 @@ main(int argc,char **argv)
     if(opt_crr) opt_crr=(char *)nco_free(opt_crr);
   } /* end while loop */
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Make uniform list of user-specified chunksizes */
diff --git a/src/nco/mpncwa.c b/src/nco/mpncwa.c
index b582ca4..baf8638 100644
--- a/src/nco/mpncwa.c
+++ b/src/nco/mpncwa.c
@@ -235,7 +235,7 @@ main(int argc,char **argv)
   
   static struct option opt_lng[]={ /* Structure ordered by short option key if possible */
     /* Long options with no argument, no short option counterpart */
-        {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
+    {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"mmr_cln",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
     {"dirty",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
@@ -272,6 +272,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
@@ -419,6 +421,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"create_ram") || !strcmp(opt_crr,"diskless_all")) RAM_CREATE=True; /* [flg] Open (netCDF3) file(s) in RAM */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
@@ -475,7 +478,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -615,7 +617,7 @@ main(int argc,char **argv)
   /* Ensure we do not attempt to normalize by non-existent weight */
   if(wgt_nm == NULL) NORMALIZE_BY_WEIGHT=False;
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Make uniform list of user-specified chunksizes */
diff --git a/src/nco/ncap.c b/src/nco/ncap.c
index f29184f..7af1b55 100644
--- a/src/nco/ncap.c
+++ b/src/nco/ncap.c
@@ -292,6 +292,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"3",no_argument,0,'3'},
     {"4",no_argument,0,'4'},
@@ -406,6 +408,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"create_ram") || !strcmp(opt_crr,"diskless_all")) RAM_CREATE=True; /* [flg] Open (netCDF3) file(s) in RAM */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
@@ -446,7 +449,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -629,7 +631,7 @@ main(int argc,char **argv)
     nco_exit(EXIT_SUCCESS);
   } /* end if PRN_FNC_TBL */
   
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Make uniform list of user-specified chunksizes */
diff --git a/src/nco/ncap_lex.l b/src/nco/ncap_lex.l
index be48e5e..c7d319c 100644
--- a/src/nco/ncap_lex.l
+++ b/src/nco/ncap_lex.l
@@ -55,9 +55,8 @@
 #include "nco_netcdf.h" /* NCO wrappers for netCDF C library */
 
   /* Headers specific to this program */
-#include "nco.h" /* netCDF Operator (NCO) definitions */
-#include "ncap.h" /* netCDF arithmetic processor-specific definitions (symbol table, ...) */
-#include "ncap_yacc.h" /* Symbol definitions from parser */
+#include "ncap_utl.h" /* netCDF arithmetic processor-specific definitions (symbol table, ...) */
+  //#include "ncap_yacc.h" /* Symbol definitions from parser */
 
   /* We want yylex() errors to skip current line rather than stop execution
      We do this by provoking error in parser by returning unrecognized token
@@ -907,159 +906,6 @@ yywrap(void)
   return 1;
 } /* end yywrap() */
 
-void 
-ncap_ntl_scn /* [fnc] Scan command script, construct I/O lists */
-(prs_sct * const prs_arg, /* I/O [sct] Global information required in parser routines */
- const char * const spt_arg_cat, /* I [sng] User-specified script */
- nm_id_sct** const xtr_lst_a, /* O [sct] RHS variables present in input file */
- int * const nbr_lst_a, /* O [nbr] Number of distinct RHS variables in input file */
- nm_id_sct** const xtr_lst_b, /* O [sct] LHS variables present in input file */
- int * const nbr_lst_b, /* O [nbr] Number of distinct LHS variables in input file */
- nm_id_sct** const xtr_lst_c, /* O [sct] Parent variables of LHS attributes in input file */
- int * const nbr_lst_c, /* O [nbr] Number of attribute parent variables in input file */
- nm_id_sct** const xtr_lst_d, /* O [sct] LHS dimensions in input file */
- int * const nbr_lst_d) /* O [nbr] Number of LHS dimensions in input file */
-{
-  /* Purpose: Scan command script, construct I/O lists
-     Call routine to learn metadata contents of output file prior to arithmetic processing
-     lst_a: RHS variables present in input file
-     lst_b: LHS variables present in input file
-     lst_c: Parent variables of LHS attributes in input file
-     lst_d: Dimensions required by LHS subscripts (casting) */
-  
-  /* 20020510: ncap_ntl_scn() was in ncap_utl.c but chokes g++ (not gcc)
-     g++ complains that since YYSTYPE is defined in ncap_yacc.h,
-     it is an error to call external function (yylex()) that uses this type
-     Although the error is somewhat bogus, there is some merit to it
-     Placing routine in ncap.l gives routine access to yylex() prototype and YYSTYPE
-     Since ncap_ntl_scn() does call yylex(), it may reside in ncap.l
-     To move routine to other file, #define NCAP_NTL_SCN_NOT_IN_NCAP_L */
-#undef NCAP_NTL_SCN_NOT_IN_NCAP_L
-#ifdef NCAP_NTL_SCN_NOT_IN_NCAP_L
-  /* Get YYSTYPE prior to calling scanner */
-#include "ncap_yacc.h" /* ncap_yacc.h (ncap.tab.h) is produced from ncap_yacc.y by parser generator */
-  extern FILE *yyin; /* [fl] File handle for script file */
-  extern int yylex(YYSTYPE *lval_ptr,prs_sct *prs_arg); /* [fnc] Scanner entrypoint */
-/* Following declaration gets rid of implicit declaration compiler warning
-   It is a condensation of the lexer declaration from lex.yy.c:
-   YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); */
-  extern int yy_scan_string(const char *);
-#endif /* NCAP_NTL_SCN_NOT_IN_NCAP_L */
-
-  nco_bool mch_flg; /* [flg] Variable is defined in list already */
-  
-  char *var_nm;  
-
-  int lst_a_nbr=0; /* [nbr] Number of elements in list A */
-  int lst_b_nbr=0; /* [nbr] Number of elements in list B */
-  int lst_c_nbr=0; /* [nbr] Number of elements in list C */
-  int lst_d_nbr=0; /* [nbr] Number of elements in list D */
-  int lst_t_nbr=0; /* [nbr] Number of elements in list T */
-  int tkn_crr=-1; /* [tkn] Current token, must initialize to non-zero value */
-  int var_id;
-  int var_idx;
-
-  nm_id_sct *lst_a=NULL_CEWI;
-  nm_id_sct *lst_b=NULL_CEWI;
-  nm_id_sct *lst_c=NULL_CEWI;
-  nm_id_sct *lst_d=NULL_CEWI;
-  nm_id_sct *lst_t=NULL_CEWI;  
-  
-  YYSTYPE lval; /* [tkn] Token */
-
-  if(spt_arg_cat){
-    yy_scan_string(spt_arg_cat);
-  }else{
-    /* Open script file for reading */
-    if((yyin=fopen(ncap_fl_spt_glb[ncap_ncl_dpt_crr],"r")) == NULL){
-      (void)fprintf(stderr,"%s: ERROR Unable to open script file %s\n",nco_prg_nm_get(),ncap_fl_spt_glb[ncap_ncl_dpt_crr]);
-      nco_exit(EXIT_FAILURE);
-    } /* endif error */
-  } /* endif input from script */
-  
-  /* While there are more tokens... */
-  while(tkn_crr != 0){
-    /* ...obtain next token from lexer... */
-    tkn_crr=yylex(&lval,prs_arg);
-    /* ...determine which variables and attributes exist in input file... */
-    switch (tkn_crr){
-    case IGNORE: break; /* Do nothing  */
-    case SCV: break; /* Do nothing  */
-    case EPROVOKE: break; /* Do nothing */
-    case VAR: 
-      /* Search for RHS variables in input file */
-      var_nm=lval.var_nm_RHS;
-      if(NC_NOERR == nco_inq_varid_flg(prs_arg->in_id,var_nm,&var_id)){
-	mch_flg=False; /* [flg] Variable is defined in list already */
-	/* Search RHS variables already known to be in input file... */
-	for(var_idx=0;var_idx<lst_a_nbr;var_idx++){
-	  /* ...if the new variable is found then... */
-	  if(!strcmp(lst_a[var_idx].nm,var_nm)){
-	    /* ...set flag and... */
-	    mch_flg=True; /* [flg] Variable is defined in list already */
-	    /* ...stop looking through list... */
-	    break;
-	  } /* end if */
-	} /* end loop over var */
-	/* If RHS variable information is already in list we are done */
-	if(mch_flg) break;
-	/* Otherwise add new RHS variable to list */
-	if(lst_a_nbr==0) lst_a=(nm_id_sct *)nco_malloc(sizeof(nm_id_sct)); else lst_a=(nm_id_sct *)nco_realloc(lst_a,((lst_a_nbr+1)*sizeof(nm_id_sct)));
-	lst_a[lst_a_nbr].nm=(char *)strdup(var_nm);
-	lst_a[lst_a_nbr++].id=var_id;
-      } /* endif RHS variable is in input file */
-      break; 
-    case OUT_VAR: 
-      /* Search for LHS variables in input file */
-      var_nm=lval.var_nm_LHS;
-      if(NC_NOERR == nco_inq_varid_flg(prs_arg->in_id,var_nm,&var_id)){
-	mch_flg=False;
-	for(var_idx=0;var_idx<lst_b_nbr;var_idx++)
-	  if(!strcmp(lst_b[var_idx].nm,var_nm)){mch_flg=True; break;}
-	if(mch_flg) break;
-	if(lst_b_nbr == 0) lst_b=(nm_id_sct *)nco_malloc(sizeof(nm_id_sct));
-	else lst_b=(nm_id_sct *)nco_realloc(lst_b,((lst_b_nbr+1)*sizeof(nm_id_sct)));
-	lst_b[lst_b_nbr].nm=(char *)strdup(var_nm);
-	lst_b[lst_b_nbr++].id=var_id;
-      } /* endif LHS variable is in input file */
-      break;
-    case OUT_ATT:
-      /* Search for LHS attribute's parent variable in input file */
-      var_nm=lval.aed.var_nm;     
-      if(NC_NOERR == nco_inq_varid_flg(prs_arg->in_id,var_nm,&var_id)){
-	mch_flg=False;
-	for(var_idx=0;var_idx<lst_c_nbr;var_idx++)
-	  if(!strcmp(lst_c[var_idx].nm,var_nm)){mch_flg=True;break;}
-	if(mch_flg) break;
-	if(lst_c_nbr == 0) lst_c=(nm_id_sct *)nco_malloc(sizeof(nm_id_sct));
-	else lst_c=(nm_id_sct *)nco_realloc(lst_c,((lst_c_nbr+1)*sizeof(nm_id_sct)));
-	lst_c[lst_c_nbr].nm=(char *)strdup(var_nm);
-	lst_c[lst_c_nbr++].id=var_id;
-      } /* endif LHS attribute's parent variable is in input file  */
-      break;
-    case LHS_SBS:
-      /* Add dimensions defined in LHS subscripts */
-      lst_t=lst_d;
-      lst_t_nbr=lst_t_nbr+0;
-      /* 20140526: clang flags argument lval.sbs_lst->lst as incompatible with nm_id_sct * in receiving prototype
-	 This is true. Not sure how/if this line ever worked. Were ncap not in maintenance mode, would be worth fixing? */
-      lst_d=nco_var_lst_add(lst_d,&lst_d_nbr,(nm_id_sct *)lval.sbs_lst->lst,lval.sbs_lst->nbr);
-      if(lst_t_nbr > 0) (void)nco_nm_id_lst_free(lst_t,lst_t_nbr);
-      break;
-    default: 
-      /* Tokens that fall through are perfectly safe and normal
-	 Tokens values 1--256 are ASCII characters, values > 256 defined in yy.tab.h */
-      if(nco_dbg_lvl_get() >= 5)(void)fprintf(stderr,"%s: DEBUG Token type %d not handled in ncap_ntl_scn()\n",nco_prg_nm_get(),tkn_crr);
-      break;
-    } /* end switch */
-  } /* end while */
-  
-  if(lst_a_nbr > 0){*xtr_lst_a=lst_a;*nbr_lst_a=lst_a_nbr;}
-  if(lst_b_nbr > 0){*xtr_lst_b=lst_b;*nbr_lst_b=lst_b_nbr;}
-  if(lst_c_nbr > 0){*xtr_lst_c=lst_c;*nbr_lst_c=lst_c_nbr;}
-  if(lst_d_nbr > 0){*xtr_lst_d=lst_d;*nbr_lst_d=lst_d_nbr;}
-  
-} /* end ncap_ntl_scn() */
 
 int /* O [enm] Return code */ 
 ncap_ncwa_scn /* [fnc] Scan command script, construct I/O lists */
@@ -1151,4 +997,8 @@ ncap_ncwa_scn /* [fnc] Scan command script, construct I/O lists */
   
 } /* end ncap_ncwa_scn() */
 
-/* End user functions section */
+
+
+
+
+
diff --git a/src/nco/ncap_utl.c b/src/nco/ncap_utl.c
index cd83534..237379c 100644
--- a/src/nco/ncap_utl.c
+++ b/src/nco/ncap_utl.c
@@ -8,8 +8,14 @@
    GNU General Public License (GPL) Version 3 with exceptions described in the LICENSE file */
 
 #include <assert.h>
-#include "ncap.h" /* netCDF arithmetic processor */
+#include "ncap_utl.h" /* netCDF arithmetic processor */
 extern char ncap_err_sng[200]; /* [sng] Buffer for error string (declared in ncap_lex.l) */
+/* Global variables */
+extern size_t ncap_ncl_dpt_crr; /* [nbr] Depth of current #include file (declared in ncap.c) */
+extern size_t *ncap_ln_nbr_crr; /* [cnt] Line number (declared in ncap.c) */
+extern char **ncap_fl_spt_glb; /* [fl] Script file (declared in ncap.c) */
+
+
 
 var_sct *
 /* fxm: which prototype to use? */
@@ -312,551 +318,6 @@ ncap_scv_2_ptr_unn
   return val;
 } /* end ncap_scv_2_ptr_unn() */
 
-var_sct * /* O [sct] Sum of input variables (var_1+var_2) */
-ncap_var_var_add /* [fnc] Add two variables */
-(var_sct *var_1, /* I [sct] Input variable structure containing first operand */
- var_sct *var_2) /* I [sct] Input variable structure containing second operand */
-{
-  /* Purpose: Add two variables */
-  /* Store result in var_2 */
-  if(var_1->undefined) var_2->undefined=True;
-  if(var_2->undefined) {
-    var_1=nco_var_free(var_1);
-    return var_2;
-  }
-  (void)ncap_var_retype(var_1,var_2);
-  
-  /* Handle initial scan */
-  if(var_1->val.vp==(void*)NULL ) {
-    if(var_1->nbr_dim > var_2->nbr_dim) {
-      var_2=nco_var_free(var_2);
-      return var_1;
-    }else{
-      var_1=nco_var_free(var_1);
-      return var_2;
-    }
-  } 
-  
-  (void)ncap_var_cnf_dmn(&var_1,&var_2);
-  
-  //  if(var_1 != var_chk1) var_chk1 = (var_sct*)nco_var_free(var_chk1);
-  //if(var_2 != var_chk2) var_chk2 = (var_sct*)nco_var_free(var_chk2);
-  
-  /* fxm: bug in nco_var_add()? missing_value is not carried over to var_2 in result when var_1->has_mss_val is true */
-  if(var_1->has_mss_val){
-    (void)nco_var_add(var_1->type,var_1->sz,var_1->has_mss_val,var_1->mss_val,var_1->val,var_2->val);
-  }else{
-    (void)nco_var_add(var_1->type,var_1->sz,var_2->has_mss_val,var_2->mss_val,var_1->val,var_2->val);
-  } /* end if */
-  
-  var_1=nco_var_free(var_1);
-  return var_2;
-} /* end ncap_var_var_add() */
-
-var_sct * /* O [sct] Quotient of input variables (var_2/var_1) */
-ncap_var_var_dvd /* [fnc] Divide two variables (var_2/var_1) */ 
-(var_sct *var_1, /* I [sct] Variable structure containing denominator */
- var_sct *var_2) /* I [sct] Variable structure containing numerator */
-{
-  /* Purpose: Divide two variables (var_2/var_1) */
-  
-  /* Purpose: Divide two variables */
-  /* Store result in var_2 */
-  if(var_1->undefined) var_2->undefined=True;
-  if(var_2->undefined) {
-    var_1=nco_var_free(var_1);
-    return var_2;
-  }
-  (void)ncap_var_retype(var_1,var_2);
-  
-  /* Handle initial scan */
-  if(var_1->val.vp==(void*)NULL ) {
-    if(var_1->nbr_dim > var_2->nbr_dim) {
-      var_2=nco_var_free(var_2);
-      return var_1;
-    }else{
-      var_1=nco_var_free(var_1);
-      return var_2;
-    }
-  } 
-  
-  (void)ncap_var_cnf_dmn(&var_1,&var_2);
-  if(var_1->has_mss_val){
-    (void)nco_var_dvd(var_1->type,var_1->sz,var_1->has_mss_val,var_1->mss_val,var_1->val,var_2->val);
-  }else{
-    (void)nco_var_dvd(var_1->type,var_1->sz,var_2->has_mss_val,var_2->mss_val,var_1->val,var_2->val);
-  } /* end else */
-  
-  var_1=nco_var_free(var_1);
-  return var_2;
-} /* end ncap_var_var_dvd() */
-
-var_sct * /* O [sct] Product of input variables (var_1*var_2) */
-ncap_var_var_mlt /* [fnc] Multiply two variables */ 
-(var_sct *var_1, /* I [sct] Variable structure containing first operand */
- var_sct *var_2) /* I [sct] Variable structure containing second operand */
-{
-  
-  /* Purpose: Multiply two variables */
-  /* Store result in var_2 */
-  if(var_1->undefined) var_2->undefined=True;
-  if(var_2->undefined) {
-    var_1=nco_var_free(var_1);
-    return var_2;
-  }
-  (void)ncap_var_retype(var_1,var_2);
-  
-  /* Handle initial scan */
-  if(var_1->val.vp==(void*)NULL ) {
-    if(var_1->nbr_dim > var_2->nbr_dim) {
-      var_2=nco_var_free(var_2);
-      return var_1;
-    }else{
-      var_1=nco_var_free(var_1);
-      return var_2;
-    }
-  } 
-  
-  (void)ncap_var_cnf_dmn(&var_1,&var_2);
-  if(var_1->has_mss_val){
-    (void)nco_var_mlt(var_1->type,var_1->sz,var_1->has_mss_val,var_1->mss_val,var_1->val,var_2->val);
-  }else{
-    (void)nco_var_mlt(var_1->type,var_1->sz,var_2->has_mss_val,var_2->mss_val,var_1->val,var_2->val);
-  } /* end else */
-  
-  var_1=nco_var_free(var_1);
-  return var_2;
-} /* end ncap_var_var_mlt() */
-
-var_sct * /* O [sct] Remainder of modulo operation of input variables (var_1%var_2) */
-ncap_var_var_mod /* [fnc] Remainder (modulo) operation of two variables */
-(var_sct *var_1, /* I [sct] Variable structure containing field */
- var_sct *var_2) /* I [sct] Variable structure containing divisor */
-{
-  /* Purpose: Remainder (modulo) operation of two variables (var_1%var_2) */
-  /* Store result in var_2 */
-  if(var_1->undefined) var_2->undefined=True;
-  if(var_2->undefined) {
-    var_1=nco_var_free(var_1);
-    return var_2;
-  }
-  (void)ncap_var_retype(var_1,var_2);
-  
-  /* Handle initial scan */
-  if(var_1->val.vp==(void*)NULL ) {
-    if(var_1->nbr_dim > var_2->nbr_dim) {
-      var_2=nco_var_free(var_2);
-      return var_1;
-    }else{
-      var_1=nco_var_free(var_1);
-      return var_2;
-    }
-  } 
-  
-  (void)ncap_var_cnf_dmn(&var_1,&var_2);
-  if(var_1->has_mss_val){
-    (void)nco_var_mod(var_1->type,var_1->sz,var_1->has_mss_val,var_1->mss_val,var_1->val,var_2->val);
-  }else{
-    (void)nco_var_mod(var_1->type,var_1->sz,var_2->has_mss_val,var_2->mss_val,var_1->val,var_2->val);
-  } /* end else */
-  
-  var_1=nco_var_free(var_1);
-  return var_2;
-} /* end ncap_var_var_mod() */
-
-var_sct * /* O [sct] Empowerment of input variables (var_1^var_2) */
-ncap_var_var_pwr /* [fnc] Empowerment of two variables */ 
-(var_sct *var_1, /* I [sct] Variable structure containing base */
- var_sct *var_2) /* I [sct] Variable structure containing exponent */
-{
-  /* Purpose: Empower two variables (var_1^var_2) */
-  
-  /* Purpose: Add two variables */
-  /* Store result in var_2 */
-  if(var_1->undefined) var_2->undefined=True;
-  if(var_2->undefined) {
-    var_1=nco_var_free(var_1);
-    return var_2;
-  }
-  /* Make sure vars are at least float precision */
-  if(nco_rth_prc_rnk(var_1->type) < nco_rth_prc_rnk_float && nco_rth_prc_rnk(var_2->type < nco_rth_prc_rnk_float)) var_1=nco_var_cnf_typ((nc_type)NC_FLOAT,var_1);
-  
-  (void)ncap_var_retype(var_1,var_2);   
-  
-  /* Handle initial scan */
-  if(var_1->val.vp==(void*)NULL ) {
-    if(var_1->nbr_dim > var_2->nbr_dim) {
-      var_2=nco_var_free(var_2);
-      return var_1;
-    }else{
-      var_1=nco_var_free(var_1);
-      return var_2;
-    }
-  } 
-  
-  (void)ncap_var_cnf_dmn(&var_1,&var_2);
-  if(var_1->has_mss_val){
-    (void)nco_var_pwr(var_1->type,var_1->sz,var_1->has_mss_val,var_1->mss_val,var_1->val,var_2->val);
-  }else{
-    (void)nco_var_pwr(var_1->type,var_1->sz,var_2->has_mss_val,var_2->mss_val,var_1->val,var_2->val);
-  } /* end else */
-  return var_2;
-} /* end ncap_var_var_pwr() */
-
-var_sct * /* O [frc] Remainder of input variables (var_2-var_1) */
-ncap_var_var_sub /* [fnc] Subtract two variables (var_2-var_1) */ 
-(var_sct *var_2, /* I [sct] Variable structure containing second operand */ /* fxm TODO: 19 non-standard argument order */
- var_sct *var_1) /* I [sct] Variable structure containing first operand */
-{
-  /* Purpose: Subtract a variable from another variable */
-  
-  /* Purpose: Add two variables */
-  /* Store result in var_2 */
-  if(var_1->undefined) var_2->undefined=True;
-  if(var_2->undefined) {
-    var_1=nco_var_free(var_1);
-    return var_2;
-  }
-  (void)ncap_var_retype(var_1,var_2);
-  
-  /* Handle initial scan */
-  if(var_1->val.vp==(void*)NULL ) {
-    if(var_1->nbr_dim > var_2->nbr_dim) {
-      var_2=nco_var_free(var_2);
-      return var_1;
-    }else{
-      var_1=nco_var_free(var_1);
-      return var_2;
-    }
-  } 
-  
-  (void)ncap_var_cnf_dmn(&var_1,&var_2);
-  if(var_1->has_mss_val){
-    (void)nco_var_sbt(var_1->type,var_1->sz,var_1->has_mss_val,var_1->mss_val,var_1->val,var_2->val);
-  }else{
-    (void)nco_var_sbt(var_1->type,var_1->sz,var_2->has_mss_val,var_2->mss_val,var_1->val,var_2->val);
-  }/* end else */
-  var_1=nco_var_free(var_1);
-  return var_2;
-} /* end ncap_var_var_sub() */
-
-var_sct *
-ncap_var_fnc(var_sct *var_in,sym_sct *app)
-{
-  /* Purpose: Evaluate fnc_dbl(var) or fnc_flt(var) for each value in variable
-     Float and double functions are in app */
-  long idx;
-  long sz;
-  ptr_unn op1;
-  
-  if(var_in->undefined) return var_in;
-  
-  
-  /* Promote variable to NC_FLOAT */
-  if(nco_rth_prc_rnk(var_in->type) < nco_rth_prc_rnk_float) var_in=nco_var_cnf_typ((nc_type)NC_FLOAT,var_in);
-  
-  /* Handle initial scan differently */
-  if(var_in->val.vp == NULL) return var_in; 
-  
-  op1=var_in->val;
-  sz=var_in->sz;
-  (void)cast_void_nctype(var_in->type,&op1);
-  if(var_in->has_mss_val) (void)cast_void_nctype(var_in->type,&(var_in->mss_val));
-  
-  switch(var_in->type){ 
-  case NC_DOUBLE: {
-    if(!var_in->has_mss_val){
-      for(idx=0;idx<sz;idx++) op1.dp[idx]=(*(app->fnc_dbl))(op1.dp[idx]);
-    }else{
-      double mss_val_dbl=*(var_in->mss_val.dp); /* Temporary variable reduces de-referencing */
-      for(idx=0;idx<sz;idx++){
-        if(op1.dp[idx] != mss_val_dbl) op1.dp[idx]=(*(app->fnc_dbl))(op1.dp[idx]);
-      } /* end for */
-    } /* end else */
-    break;
-  }
-  case NC_FLOAT: {
-    if(!var_in->has_mss_val){
-      for(idx=0;idx<sz;idx++) op1.fp[idx]=(*(app->fnc_flt))(op1.fp[idx]);
-    }else{
-      float mss_val_flt=*(var_in->mss_val.fp); /* Temporary variable reduces de-referencing */
-      for(idx=0;idx<sz;idx++){
-        if(op1.fp[idx] != mss_val_flt) op1.fp[idx]=(*(app->fnc_flt))(op1.fp[idx]);
-      } /* end for */
-    } /* end else */
-    break;
-  }
-  default: nco_dfl_case_nc_type_err(); break;
-  }/* 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() */
-
-var_sct *
-ncap_var_scv_add(var_sct *var,scv_sct scv)
-{
-  /* Purpose: add the value in scv to each element of var */
-  
-  if(var->undefined) return var;
-  
-  (void)ncap_var_scv_cnf_typ_hgh_prc(&var,&scv);
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_var_scv_add(var->type,var->sz,var->has_mss_val,var->mss_val,var->val,&scv);
-  return var;
-} /* end ncap_var_scv_add() */
-
-var_sct *
-ncap_var_scv_sub(var_sct *var,scv_sct scv)
-{
-  /* Purpose: Subtract value in scv from each element of var */
-  if(var->undefined) return var;
-  
-  (void)ncap_var_scv_cnf_typ_hgh_prc(&var,&scv);
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)ncap_scv_minus(&scv);
-  (void)nco_var_scv_add(var->type,var->sz,var->has_mss_val,var->mss_val,var->val,&scv);
-  
-  return var;
-} /* end ncap_var_scv_sub() */
-
-var_sct *
-ncap_var_scv_mlt(var_sct *var,scv_sct scv)
-{
-  /* Purpose: Multiply variable by value in scv */
-  if(var->undefined) return var;
-  (void)ncap_var_scv_cnf_typ_hgh_prc(&var,&scv);
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-    
-  (void)nco_var_scv_mlt(var->type,var->sz,var->has_mss_val,var->mss_val,var->val,&scv);
-  return var;
-} /* end ncap_var_scv_mlt */
-
-var_sct *
-ncap_var_scv_dvd(var_sct *var,scv_sct scv)
-{
-  /* Purpose: Divide each element of var by value in scv */
-  (void)ncap_var_scv_cnf_typ_hgh_prc(&var,&scv);
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_var_scv_dvd(var->type,var->sz,var->has_mss_val,var->mss_val,var->val,&scv);
-  return var;
-} /* end ncap_var_scv_dvd */
-
-var_sct *
-ncap_scv_var_dvd(scv_sct scv,var_sct *var)
-{
-  /* Purpose: Divide scv by value of each element in var */
-  if(var->undefined) return var;
-  
-  (void)ncap_var_scv_cnf_typ_hgh_prc(&var,&scv);
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_scv_var_dvd(var->type,var->sz,var->has_mss_val,var->mss_val,&scv,var->val);
-  return var;
-} /* end ncap_scv_var_dvd */
-
-var_sct *
-ncap_var_scv_mod(var_sct *var,scv_sct scv)
-{
-  /* Purpose: Modulus of each element of var with scv */
-  if(var->undefined) return var;
-  
-  (void)ncap_var_scv_cnf_typ_hgh_prc(&var,&scv);
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_var_scv_mod(var->type,var->sz,var->has_mss_val,var->mss_val,var->val,&scv);
-  return var;
-} /* ncap_var_scv_mod */
-
-var_sct *
-ncap_scv_var_mod(scv_sct scv,var_sct *var)
-{
-  /* Purpose: Modulus of scv with each element of var */
-  if(var->undefined) return var;
-  
-  (void)ncap_var_scv_cnf_typ_hgh_prc(&var,&scv);
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_scv_var_mod(var->type,var->sz,var->has_mss_val,var->mss_val,&scv,var->val);
-  return var;
-} /* ncap_var_scv_mod */
-
-var_sct *
-ncap_var_scv_pwr(var_sct *var,scv_sct scv)
-{
-  /* Purpose: Empower each element in var by scv */
-  /* Promote scv and var to NC_FLOAT if necessary since C has no integer empowerment 
-     This reduces type conversion warnings (it is not done to avoid overflow) */
-  if(nco_rth_prc_rnk(var->type) < nco_rth_prc_rnk_float) var=nco_var_cnf_typ((nc_type)NC_FLOAT,var);
-  (void)nco_scv_cnf_typ(var->type,&scv);
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_var_scv_pwr(var->type,var->sz,var->has_mss_val,var->mss_val,var->val,&scv);
-  return var;
-} /* end ncap_var_scv_pwr */
-
-var_sct *
-ncap_scv_var_pwr(scv_sct scv,var_sct *var)
-{
-  /* Purpose: Empower each element in scv by var */
-  /* Promote scv and var to NC_FLOAT if necessary since C has no integer empowerment 
-     This reduces type conversion warnings (it is not done to avoid overflow) */
-  if(var->undefined) return var;
-  
-  if(nco_rth_prc_rnk(var->type) < nco_rth_prc_rnk_float) var=nco_var_cnf_typ((nc_type)NC_FLOAT,var);
-  (void)nco_scv_cnf_typ(var->type,&scv);
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_scv_var_pwr(var->type,var->sz,var->has_mss_val,var->mss_val,&scv,var->val);
-  return var;
-} /* end ncap_var_scv_pwr */
-
-var_sct *
-ncap_var_abs(var_sct *var)
-{
-  /* Purpose: Find absolute value of each element of var */
-  if(var->undefined) return var;
-  
-  /* Deal with inital scan */
-  if(var->val.vp == NULL) return var; 
-  
-  (void)nco_var_abs(var->type,var->sz,var->has_mss_val,var->mss_val,var->val);
-  return var;
-} /* end ncap_var_abs */
-
-scv_sct  
-ncap_scv_clc
-(scv_sct scv_1,
- const char op,
- scv_sct scv_2)
-{
-  /* Purpose: Calculate (scv_1 op scv_2) NB: Scalar values must be of same type */
-  
-  /* http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
-     __GNUC__ : Defined by gcc 
-     __GNUG__ : Defined by g++, equivalent to (__GNUC__ && __cplusplus) */
-  
-#ifndef __GNUG__ 
-  extern float fmodf(float,float); /* Cannot insert fmodf in ncap_sym_init() because it takes two arguments TODO #20 */
-  extern float fabsf(float); /* Sun math.h does not include fabsf() prototype */
-#endif   /* __GNUG__ */
-  
-  scv_sct scv_out;
-  scv_out.type=scv_1.type;
-  
-  /*
-    if(scv_1.undefined || scv_2.undefined ) {
-    scv_out.undefined=True;
-    return scv_out;
-    }
-  */
-  switch(scv_out.type){ 
-  case NC_FLOAT:
-    switch(op){
-    case '+': scv_out.val.f=scv_1.val.f+scv_2.val.f;break;
-    case '-': scv_out.val.f=scv_1.val.f-scv_2.val.f;break;
-    case '/': scv_out.val.f=scv_1.val.f/scv_2.val.f;break;
-    case '*': scv_out.val.f=scv_1.val.f*scv_2.val.f;break;
-    case '%': scv_out.val.f=fmodf(scv_1.val.f,fabsf(scv_2.val.f));break;
-    } break;
-  case NC_DOUBLE:
-    switch(op){
-    case '+': scv_out.val.d=scv_1.val.d+scv_2.val.d;break;
-    case '-': scv_out.val.d=scv_1.val.d-scv_2.val.d;break;
-    case '/': scv_out.val.d=scv_1.val.d/scv_2.val.d;break;
-    case '*': scv_out.val.d=scv_1.val.d*scv_2.val.d;break;
-    case '%': scv_out.val.d=fmod(scv_1.val.d,fabs(scv_2.val.d));break;
-    } break;
-  case NC_INT:
-    switch(op){
-    case '+': scv_out.val.i=scv_1.val.i+scv_2.val.i;break;
-    case '-': scv_out.val.i=scv_1.val.i-scv_2.val.i;break;
-    case '/': scv_out.val.i=scv_1.val.i/scv_2.val.i;break;
-    case '*': scv_out.val.i=scv_1.val.i*scv_2.val.i;break;
-    case '%': scv_out.val.i=scv_1.val.i%scv_2.val.i;break;
-    } break;
-  case NC_SHORT:
-    switch(op){
-    case '+': scv_out.val.s=scv_1.val.s+scv_2.val.s;break;
-    case '-': scv_out.val.s=scv_1.val.s-scv_2.val.s;break;
-    case '/': scv_out.val.s=scv_1.val.s/scv_2.val.s;break;
-    case '*': scv_out.val.s=scv_1.val.s*scv_2.val.s;break;
-    case '%': scv_out.val.s=scv_1.val.s%scv_2.val.s;break;
-    } break;
-  case NC_USHORT:
-    switch(op){
-    case '+': scv_out.val.us=scv_1.val.us+scv_2.val.us;break;
-    case '-': scv_out.val.us=scv_1.val.us-scv_2.val.us;break;
-    case '/': scv_out.val.us=scv_1.val.us/scv_2.val.us;break;
-    case '*': scv_out.val.us=scv_1.val.us*scv_2.val.us;break;
-    case '%': scv_out.val.us=scv_1.val.us%scv_2.val.us;break;
-    } break;
-  case NC_UINT:
-    switch(op){
-    case '+': scv_out.val.ui=scv_1.val.ui+scv_2.val.ui;break;
-    case '-': scv_out.val.ui=scv_1.val.ui-scv_2.val.ui;break;
-    case '/': scv_out.val.ui=scv_1.val.ui/scv_2.val.ui;break;
-    case '*': scv_out.val.ui=scv_1.val.ui*scv_2.val.ui;break;
-    case '%': scv_out.val.ui=scv_1.val.ui%scv_2.val.ui;break;
-    } break;
-  case NC_INT64:
-    switch(op){
-    case '+': scv_out.val.i64=scv_1.val.i64+scv_2.val.i64;break;
-    case '-': scv_out.val.i64=scv_1.val.i64-scv_2.val.i64;break;
-    case '/': scv_out.val.i64=scv_1.val.i64/scv_2.val.i64;break;
-    case '*': scv_out.val.i64=scv_1.val.i64*scv_2.val.i64;break;
-    case '%': scv_out.val.i64=scv_1.val.i64%scv_2.val.i64;break;
-    } break;
-  case NC_UINT64:
-    switch(op){
-    case '+': scv_out.val.ui64=scv_1.val.ui64+scv_2.val.ui64;break;
-    case '-': scv_out.val.ui64=scv_1.val.ui64-scv_2.val.ui64;break;
-    case '/': scv_out.val.ui64=scv_1.val.ui64/scv_2.val.ui64;break;
-    case '*': scv_out.val.ui64=scv_1.val.ui64*scv_2.val.ui64;break;
-    case '%': scv_out.val.ui64=scv_1.val.ui64%scv_2.val.ui64;break;
-    } break;
-  case NC_BYTE:
-    switch(op){
-    case '+': scv_out.val.b=scv_1.val.b+scv_2.val.b;break;
-    case '-': scv_out.val.b=scv_1.val.b-scv_2.val.b;break;
-    case '/': scv_out.val.b=scv_1.val.b/scv_2.val.b;break;
-    case '*': scv_out.val.b=scv_1.val.b*scv_2.val.b;break;
-    case '%': scv_out.val.b=scv_1.val.b%scv_2.val.b;break;
-    } break;
-  case NC_UBYTE:
-    switch(op){
-    case '+': scv_out.val.ub=scv_1.val.ub+scv_2.val.ub;break;
-    case '-': scv_out.val.ub=scv_1.val.ub-scv_2.val.ub;break;
-    case '/': scv_out.val.ub=scv_1.val.ub/scv_2.val.ub;break;
-    case '*': scv_out.val.ub=scv_1.val.ub*scv_2.val.ub;break;
-    case '%': scv_out.val.ub=scv_1.val.ub%scv_2.val.ub;break;
-    } break;
-  case NC_CHAR: break; /* Do nothing */
-  case NC_STRING: break; /* Do nothing */
-  default: nco_dfl_case_nc_type_err(); break;
-  }/* end switch */    
-  
-  return scv_out;
-} /* end ncap_scv_clc_type */
 
 scv_sct
 ncap_scv_abs(scv_sct scv)
@@ -913,198 +374,7 @@ ncap_scv_minus(scv_sct *scv)
   return scv->type;
 } /* end ncap_scv_minus() */
 
-nm_id_sct *
-nco_var_lst_copy(nm_id_sct *xtr_lst,int lst_nbr)
-{
-  /* Purpose: Copy xtr_lst and return new list */
-  int idx;
-  nm_id_sct *xtr_new_lst;
-  
-  if(lst_nbr == 0) return NULL;
-  xtr_new_lst=(nm_id_sct *)nco_malloc(lst_nbr*sizeof(nm_id_sct));
-  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() */
 
-nm_id_sct *
-nco_var_lst_sub(nm_id_sct *xtr_lst,int *xtr_nbr,nm_id_sct *xtr_lst_b,int nbr_lst_b)
-{
-  /* Purpose: Subtract from xtr_lst any elements from xtr_lst_b which are present and return new list */
-  int idx;
-  int xtr_idx;
-  int xtr_nbr_new=0;
-  
-  nco_bool match;
-  
-  nm_id_sct *xtr_new_lst=NULL;
-  
-  if(*xtr_nbr == 0) return xtr_lst;
-  
-  xtr_new_lst=(nm_id_sct *)nco_malloc((size_t)(*xtr_nbr)*sizeof(nm_id_sct)); 
-  for(idx=0;idx<*xtr_nbr;idx++){
-    match=False;
-    for(xtr_idx=0;xtr_idx<nbr_lst_b;xtr_idx++)
-      if(!strcmp(xtr_lst[idx].nm,xtr_lst_b[xtr_idx].nm)){match=True;break;}
-    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;
-  } /* 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)); 
-  /* free old list */
-  xtr_lst=nco_nm_id_lst_free(xtr_lst,*xtr_nbr);
-  
-  *xtr_nbr=xtr_nbr_new;
-  return xtr_new_lst;     
-}/* end nco_var_lst_sub */
-
-nm_id_sct *
-nco_var_lst_add(nm_id_sct *xtr_lst,int *xtr_nbr,nm_id_sct *xtr_lst_a,int nbr_lst_a)
-{
-  /* Purpose: Add to xtr_lst any elements from xtr_lst_a not already present and return new list */
-  int idx;
-  int xtr_idx;
-  int xtr_nbr_crr;
-  
-  nm_id_sct *xtr_new_lst;
-  
-  nco_bool match;
-  
-  xtr_nbr_crr=*xtr_nbr;
-  if(xtr_nbr_crr > 0){
-    xtr_new_lst=(nm_id_sct *)nco_malloc((size_t)(*xtr_nbr)*sizeof(nm_id_sct));
-    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;
-    return nco_var_lst_copy(xtr_lst_a,nbr_lst_a);
-  }/* end if */
-  
-  for(idx=0;idx<nbr_lst_a;idx++){
-    match=False;
-    for(xtr_idx=0;xtr_idx<*xtr_nbr;xtr_idx++)
-      if(!strcmp(xtr_lst[xtr_idx].nm,xtr_lst_a[idx].nm)){match=True;break;}
-    if(match) continue;
-    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;
-  } /* end for */
-  *xtr_nbr=xtr_nbr_crr;
-  return xtr_new_lst;           
-} /* nco_var_lst_add */
-
-nm_id_sct *
-nco_nm_id_lst_crd_make
-(int nc_id,
- nm_id_sct *xtr_lst,
- int *xtr_nbr)
-     /* 
-	int nc_id: I netCDF file ID
-	nm_id_sct *xtr_lst: I/O current extraction list 
-	int *xtr_nbr: I/O number of variables in current extraction list: Overwritten by new list 
-	nm_id_sct nco_nm_id_lst_crd_make: list of coordinate dimensions 
-     */
-{
-  /* Purpose: Make list co-ordinate dimensions from list of ordinary and co-ordinate variables */
-  char dmn_nm[NC_MAX_NAME];
-  
-  int crd_id;
-  int idx_dim;
-  int idx_var;
-  int nbr_dim;
-  int rcd=NC_NOERR; /* [rcd] Return code */
-  int nbr_new_lst=0;
-  
-  nm_id_sct *new_lst=NULL_CEWI;
-  
-  /* Get number of dimensions */
-  (void)nco_inq(nc_id,&nbr_dim,(int *)NULL,(int *)NULL,(int *)NULL);
-  /* ...for each dimension in input file... */
-  for(idx_dim=0;idx_dim<nbr_dim;idx_dim++){
-    /* ...see if it is a coordinate dimension... */
-    (void)nco_inq_dimname(nc_id,idx_dim,dmn_nm);
-    rcd=nco_inq_varid_flg(nc_id,dmn_nm,&crd_id);
-    if(rcd == NC_NOERR){
-      /* Is this coordinate already on extraction list? */
-      for(idx_var=0;idx_var<*xtr_nbr;idx_var++){
-	if(!strcmp(dmn_nm,xtr_lst[idx_var].nm)){
-	  if(nbr_new_lst == 0) new_lst=(nm_id_sct *)nco_malloc(sizeof(nm_id_sct));
-	  else new_lst=(nm_id_sct *)nco_realloc((void *)new_lst,(size_t)(nbr_new_lst+1)*sizeof(nm_id_sct));
-	  new_lst[nbr_new_lst].nm=(char *)strdup(dmn_nm);
-	  new_lst[nbr_new_lst++].id=crd_id;
-	  break;
-        } /* end if */
-      } /* end for */
-    } /* end if */
-  } /* end for */
-  
-  *xtr_nbr=nbr_new_lst;
-  return new_lst;
-} /* end nco_nm_id_lst_crd_make() */
-
-nm_id_sct * /* O [sct] List of dimensions associated with input variable list */
-nco_dmn_lst /* [fnc] Create list of all dimensions in file  */
-(const int nc_id, /* I [id] netCDF input-file ID */
- int * const nbr_dmn) /* O [nbr] Number of dimensions in  list */
-{
-  int idx;
-  int nbr_dmn_in;
-  char dmn_nm[NC_MAX_NAME];
-  nm_id_sct *dmn;
-  /* Get number of dimensions */
-  (void)nco_inq(nc_id,&nbr_dmn_in,(int *)NULL,(int *)NULL,(int *)NULL);
-  
-  dmn=(nm_id_sct *)nco_malloc(nbr_dmn_in*sizeof(nm_id_sct));
-  
-  for(idx=0;idx<nbr_dmn_in;idx++){
-    (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;
-  return dmn;
-} /* end nco_dmn_lst() */
-
-nm_id_sct * 
-nco_att_lst_mk
-(const int in_id,
- const int out_id,
- aed_sct **att_lst,
- int nbr_att,
- int *nbr_lst)
-{
-  int idx;
-  int jdx;
-  int rcd;
-  int var_id;
-  int size=0;
-  nm_id_sct *xtr_lst=NULL;  
-  for(idx=0;idx<nbr_att;idx++){
-    rcd=nco_inq_varid_flg(out_id,att_lst[idx]->var_nm,&var_id);
-    if(rcd== NC_NOERR) continue;   
-    rcd=nco_inq_varid_flg(in_id,att_lst[idx]->var_nm,&var_id);   
-    if(rcd == NC_NOERR){
-      /* eliminate any duplicates from list */
-      for(jdx=0;jdx<size;jdx++)
-	if(!strcmp(xtr_lst[jdx].nm,att_lst[idx]->var_nm)) break;
-      if(jdx!=size) continue;
-      /* fxm mmr TODO 491: memory leak xtr_lst */
-      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(att_lst[idx]->var_nm);
-    } /* end if */
-  } /* end loop over att */
-  
-  *nbr_lst=size;
-  
-  return xtr_lst;
-} /* end nco_att_lst_mk() */
 
 nco_bool /* O [flg] Variables now conform */
 ncap_var_stretch /* [fnc] Stretch variables */
@@ -1395,3 +665,103 @@ ncap_var_stretch /* [fnc] Stretch variables */
   /* Variables now conform */
   return DO_CONFORM;
 } /* end ncap_var_stretch() */
+
+
+
+int /* [rcd] Return code */
+nco_yyerror /* [fnc] Print error/warning/info messages generated by parser */
+(prs_sct *prs_arg, const char * const err_sng_lcl) /* [sng] Message to print */
+{
+  /* Purpose: Print error/warning/info messages generated by parser
+     Use eprokoke_skip to skip error message after sending error message from yylex()
+     Stop provoked error message from yyparse being printed */
+  
+  static nco_bool eprovoke_skip;
+  
+  prs_arg=prs_arg+0; /* CEWI otherwise unused parameter error */
+
+  /* if(eprovoke_skip){eprovoke_skip=False ; return 0;} */
+  if(nco_dbg_lvl_get() >= nco_dbg_std){
+    (void)fprintf(stderr,"%s: %s line %lu",nco_prg_nm_get(),ncap_fl_spt_glb[ncap_ncl_dpt_crr],(unsigned long)ncap_ln_nbr_crr[ncap_ncl_dpt_crr]);
+    if(nco_dbg_lvl_get() >= nco_dbg_fl) (void)fprintf(stderr," %s",err_sng_lcl);
+    (void)fprintf(stderr,"\n");
+    (void)fflush(stderr);
+  } /* endif dbg */
+  
+  if(err_sng_lcl[0] == '#') eprovoke_skip=True;
+  eprovoke_skip=eprovoke_skip+0; /* CEWI Do nothing except avoid compiler warnings */
+  return 0;
+} /* end yyerror() */
+
+aed_sct *  /* O [idx] Location of attribute in list */
+ncap_aed_lookup /* [fnc] Find location of existing attribute or add new attribute */
+(const char * const var_nm, /* I [sng] Variable name */
+ const char * const att_nm, /* I [sng] Attribute name */
+ prs_sct *  prs_arg,   /* contains attribute list */       
+ const nco_bool update) /* I [flg] Delete existing value or add new attribute to list */
+{
+  int idx;
+  int size;
+  aed_sct *ptr_aed;
+  
+  size=*(prs_arg->nbr_att);
+  
+  for(idx=0;idx<size;idx++){
+    ptr_aed=(*(prs_arg->att_lst))[idx];
+    
+    if(strcmp(ptr_aed->att_nm,att_nm) || strcmp(ptr_aed->var_nm,var_nm)) 
+      continue; 
+    
+    if(update) ptr_aed->val.vp=nco_free(ptr_aed->val.vp);   
+    /* Return pointer to list element */
+    return ptr_aed;
+    
+  } /* end for */
+  
+  if(!update) return (aed_sct *)NULL;
+  
+  *(prs_arg->att_lst)=(aed_sct **)nco_realloc(*(prs_arg->att_lst),(size+1)*sizeof(aed_sct*));
+  ++*(prs_arg->nbr_att);
+  (*(prs_arg->att_lst))[size]=(aed_sct *)nco_malloc(sizeof(aed_sct));
+  (*(prs_arg->att_lst))[size]->var_nm=strdup(var_nm);
+  (*(prs_arg->att_lst))[size]->att_nm=strdup(att_nm);
+  
+  return (*(prs_arg->att_lst))[size];
+} /* end ncap_aed_lookup() */
+
+var_sct * /*I [sct] varibale in list */
+ncap_var_lookup
+(var_sct *var, /* I  [sct] variable  */
+ prs_sct *prs_arg, /* I/O [sct] contains var list */
+ const nco_bool add) /* I if not in list then add to list */          
+{
+  int idx;
+  int size;
+  
+  var_sct *ptr_var; 
+  
+  size = *(prs_arg->nbr_var);
+  
+  for(idx=0;idx<size;idx++){
+    
+    ptr_var=(*(prs_arg->var_lst))[idx];
+    /*
+      assert(var->nm);
+      assert(ptr_var->nm);
+      if(!strcmp(var->nm,ptr_var->nm)) return ptr_var;    
+    */
+    if(ptr_var==NULL || strcmp(var->nm,ptr_var->nm) ) continue;
+    
+    return ptr_var;
+  } /* end loop over idx */
+  
+  if(!add) return (var_sct *)NULL;
+  
+  *(prs_arg->var_lst)=(var_sct **)nco_realloc(*(prs_arg->var_lst),(size+1)*sizeof(var_sct*));
+  ++*(prs_arg->nbr_var);
+  (*(prs_arg->var_lst))[size]=var;
+  
+  return (var_sct *)NULL;
+} /* end ncap_var_lookup() */
+
+
diff --git a/src/nco/ncap.h b/src/nco/ncap_utl.h
similarity index 61%
rename from src/nco/ncap.h
rename to src/nco/ncap_utl.h
index 2a6085c..36202bc 100644
--- a/src/nco/ncap.h
+++ b/src/nco/ncap_utl.h
@@ -10,8 +10,8 @@
 /* Usage:
    #include "ncap.h" *//* netCDF arithmetic processor-specific definitions (symbol table, ...) */
 
-#ifndef NCAP_H /* Header file has not yet been defined in current source file */
-#define NCAP_H
+#ifndef NCAP_UTL_H /* Header file has not yet been defined in current source file */
+#define NCAP_UTL_H
 
 #ifdef HAVE_CONFIG_H
 # include <config.h> /* Autotools tokens */
@@ -96,21 +96,8 @@ typedef struct{ /* prs_sct */
   size_t *cnk_sz; /* [nbr] Chunk sizes */
 } prs_sct;
 
-/* Begin funtions in ncap_lex.l */
-void
-ncap_ntl_scn /* [fnc] Scan command script, construct I/O lists */
-(prs_sct * const prs_arg, /* I/O [sct] Global information required in parser routines */
- const char * const spt_arg_cat, /* I [sng] User-specified script */
- nm_id_sct** const xtr_lst_a, /* O [sct] RHS variables present in input file */
- int * const nbr_lst_a, /* O [nbr] Number of distinct RHS variables in input file */
- nm_id_sct** const xtr_lst_b, /* O [sct] LHS variables present in input file */
- int * const nbr_lst_b, /* O [nbr] Number of distinct LHS variables in input file */
- nm_id_sct** const xtr_lst_c, /* O [sct] Parent variables of LHS attributes in input file */
- int * const nbr_lst_c, /* O [nbr] Number of attribute parent variables in input file */
- nm_id_sct** const xtr_lst_d, /* O [sct] LHS dimensions in input file */
- int * const nbr_lst_d); /* O [nbr] Number of LHS dimensions in input file */
- /* end ncap_ntl_scn() prototype */
-
+  
+/*  funtion in ncap_lex.l */
 int 
 ncap_ncwa_scn
 (prs_sct * const prs_arg,
@@ -150,48 +137,11 @@ opr_ctl /* [fnc] Operation controller function Nie02 opr() */
 int nco_yyerror(prs_sct* prs_arg, const char * const sng);
 /* End funtions in ncap_yacc.y */
 
-/* Begin funtions in ncap_utl.c */
-var_sct * /* O [sct] Sum of input variables (var_1+var_2) */
-ncap_var_var_add /* [fnc] Add two variables (var_1+var_2) */
-(var_sct *var_1, /* I [sct] Input variable structure containing first operand */
- var_sct *var_2); /* I [sct] Input variable structure containing second operand */
-
-var_sct * /* O [sct] Quotient of input variables (var_2/var_1) */
-ncap_var_var_dvd /* [fnc] Divide two variables (var_2/var_1) */ 
-(var_sct *var_1, /* I [sct] Variable structure containing denominator */
- var_sct *var_2); /* I [sct] Variable structure containing numerator */
-
-var_sct * /* O [sct] Product of input variables (var_1*var_2) */
-ncap_var_var_mlt /* [fnc] Multiply two variables (var_1*var_2) */ 
-(var_sct *var_1, /* I [sct] Variable structure containing first operand */
- var_sct *var_2); /* I [sct] Variable structure containing second operand */
-
-var_sct * /* O [sct] Remainder of modulo operation of input variables (var_1%var_2) */
-ncap_var_var_mod /* [fnc] Remainder operation of two variables */ 
-(var_sct *var_1, /* I [sct] Variable structure containing field */
- var_sct *var_2); /* I [sct] Variable structure containing divisor */
-
-var_sct * /* O [sct] Empowerment of input variables (var_1^var_2) */
-ncap_var_var_pwr /* [fnc] Empowerment of two variables */ 
-(var_sct *var_1, /* I [sct] Variable structure containing base */
- var_sct *var_2); /* I [sct] Variable structure containing exponent */
-
-var_sct * /* O [frc] Remainder of input variables (var_2-var_1) */
-ncap_var_var_sub /* [fnc] Subtract two variables (var_2-var_1) */ 
-(var_sct *var_2, /* I [sct] Variable structure containing second operand */ /* fxm TODO: 19 non-standard argument order */
- var_sct *var_1); /* I [sct] Variable structure containing first operand */
-
   /* fxm: Following functions need editing, const'ifying, etc. */
 nco_bool ncap_var_stretch(var_sct **,var_sct **);
 dmn_sct **nco_dmn_out_grow(prs_sct *);
 int ncap_scv_minus(scv_sct *);
 int ncap_var_write(var_sct *,prs_sct*);
-nm_id_sct *nco_nm_id_lst_crd_make(int,nm_id_sct *,int *);
-nm_id_sct *nco_var_lst_add(nm_id_sct *,int *,nm_id_sct *,int);
-nm_id_sct *nco_var_lst_copy(nm_id_sct *,int);
-nm_id_sct *nco_var_lst_sub(nm_id_sct *,int *,nm_id_sct *,int);
-nm_id_sct *nco_dmn_lst(const int, int * const);
-nm_id_sct *nco_att_lst_mk(int,int,aed_sct **,int,int *);
 ptr_unn ncap_scv_2_ptr_unn(scv_sct); 
 scv_sct ncap_scv_abs(scv_sct);
 scv_sct ncap_scv_clc(scv_sct,const char,scv_sct);
@@ -202,28 +152,151 @@ var_sct *ncap_var_abs(var_sct *);
 var_sct *ncap_var_fnc(var_sct *,sym_sct *);
 /* var_sct *ncap_var_init(const char * const,prs_sct *);*/
 var_sct *ncap_var_init(char * ,prs_sct *);
-var_sct *ncap_var_scv_add(var_sct *,scv_sct);
-var_sct *ncap_var_scv_mlt(var_sct *,scv_sct);
-var_sct *ncap_var_scv_sub(var_sct *,scv_sct);
-var_sct *ncap_var_scv_dvd(var_sct *,scv_sct);
-var_sct *ncap_var_scv_mod(var_sct *,scv_sct);
-var_sct *ncap_var_scv_pwr(var_sct *,scv_sct);
-var_sct *ncap_scv_var_dvd(scv_sct scv,var_sct *var);
-var_sct *ncap_scv_var_mod(scv_sct scv,var_sct *var);
-var_sct *ncap_scv_var_pwr(scv_sct scv,var_sct *var);
 void ncap_fnc_add(char *nm, double (*fnc_dbl)());
 void nco_lbr_vrs_prn(void);
 
 /* End funtions in ncap_utl.c */
 
-/* Source code for following functions is generated by parser but parser
-   does not do good job of making these prototypes known so routines that
-   call these functions must either include their prototypes locally,
-   which is bad form if it needs to be done in more than one location,
-   or prototype the parser routines here */
+/*  the following file is ncap_yacc.h generated by BISON */
+
+/* A Bison parser, made by GNU Bison 3.0.4.  */
+
+/* Bison interface for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+#ifndef YY_NCO_YY_NCAP_YACC_H_INCLUDED
+# define YY_NCO_YY_NCAP_YACC_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int nco_yydebug;
+#endif
+
+/* Token type.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+  enum yytokentype
+  {
+    OUT_ATT = 258,
+    COMPARISON = 259,
+    LHS_SBS = 260,
+    SCV = 261,
+    SNG = 262,
+    FUNCTION = 263,
+    OUT_VAR = 264,
+    VAR = 265,
+    CNV_TYPE = 266,
+    ABS = 267,
+    ATOSTR = 268,
+    EPROVOKE = 269,
+    IGNORE = 270,
+    NAMED_CONSTANT = 271,
+    PACK = 272,
+    POWER = 273,
+    RDC = 274,
+    UNPACK = 275,
+    IF = 276,
+    PRINT = 277,
+    AND = 278,
+    NOT = 279,
+    OR = 280,
+    UMINUS = 281,
+    LOWER_THAN_ELSE = 282,
+    ELSE = 283
+  };
+#endif
+/* Tokens.  */
+#define OUT_ATT 258
+#define COMPARISON 259
+#define LHS_SBS 260
+#define SCV 261
+#define SNG 262
+#define FUNCTION 263
+#define OUT_VAR 264
+#define VAR 265
+#define CNV_TYPE 266
+#define ABS 267
+#define ATOSTR 268
+#define EPROVOKE 269
+#define IGNORE 270
+#define NAMED_CONSTANT 271
+#define PACK 272
+#define POWER 273
+#define RDC 274
+#define UNPACK 275
+#define IF 276
+#define PRINT 277
+#define AND 278
+#define NOT 279
+#define OR 280
+#define UMINUS 281
+#define LOWER_THAN_ELSE 282
+#define ELSE 283
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+
+union YYSTYPE
+{
+#line 114 "ncap_yacc.y" /* yacc.c:1909  */
+
+  char *sng; /* [sng] String value */
+  char *var_nm_LHS; /* [sng] Variables on LHS */
+  char *var_nm_RHS; /* [sng] Variables on RHS */
+  aed_sct aed; /* [sct] Attribute */
+  sym_sct *sym; /* [sct] Intrinsic function name */
+  scv_sct scv; /* [sct] Scalar value */
+  var_sct *var; /* [sct] Variable */
+  nm_lst_sct *sbs_lst; /* [sct] Subscript list */
+  int nco_rlt_opr; /* [enm] Comparison operator type */
+  nc_type cnv_type;  /* [enm] Used for type conversion functions */
+
+#line 123 "ncap_yacc.h" /* yacc.c:1909  */
+};
+
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+
+int nco_yyparse (prs_sct *prs_arg);
+
+#endif /* !YY_NCO_YY_NCAP_YACC_H_INCLUDED  */
 
 #ifdef __cplusplus
 } /* end extern "C" */
 #endif /* __cplusplus */
 
-#endif /* NCAP_H */
+#endif /* NCAP_UTL_H */
+
diff --git a/src/nco/ncap_yacc.y b/src/nco/ncap_yacc.y
deleted file mode 100644
index 5c24098..0000000
--- a/src/nco/ncap_yacc.y
+++ /dev/null
@@ -1,855 +0,0 @@
-%{ /* $Header$ -*-C-*- */
-  
-/* Begin C declarations section */
-  
-/* Purpose: Grammar parser for ncap */
-  
-/* Copyright (C) 1995--2018 Charlie Zender
-   This file is part of NCO, the netCDF Operators. NCO is free software.
-   You may redistribute and/or modify NCO under the terms of the 
-   GNU General Public License (GPL) Version 3.
-   As a special exception to the terms of the GPL, you are permitted 
-   to link the NCO source code with the HDF, netCDF, OPeNDAP, and UDUnits
-   libraries and to distribute the resulting executables under the terms 
-   of the GPL, but in addition obeying the extra stipulations of the 
-   HDF, netCDF, OPeNDAP, and UDUnits licenses.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-   See the GNU General Public License for more details.
-   
-   The original author of this software, Charlie Zender, seeks to improve
-   it with your suggestions, contributions, bug-reports, and patches.
-   Please contact the NCO project at http://nco.sf.net or write to
-   Charlie Zender
-   Department of Earth System Science
-   University of California, Irvine
-   Irvine, CA 92697-3100 */
-
-/* Usage:
-   bison --output=${HOME}/nco/src/nco/ncap_yacc.c -d ~/nco/src/nco/ncap_yacc.y */
-
-/* Example yacc text:
-   Nie02 "A Compact Guide to Lex & Yacc" by Thomas Niemann, ePaper Press, URL:http://epaperpress.com/lexandyacc/index.html
-   LMB92 ${DATA}/ora/lexyacc/ch3-05.y
-   GCC c-parse.y
-   GCC parser_build_binary_op() c-typeck.c
-   Unidata ncgen.y */
-
-/* Standard header files */
-#include <math.h> /* sin cos cos sin 3.14159 */
-#include <stdarg.h> /* va_start, va_arg, va_end */
-#include <stdio.h> /* stderr, FILE, NULL, etc. */
-#include <stdlib.h> /* atof, atoi, malloc, getopt */
-  /* 20161204 GNU since gcc 4.7.3 string.h provides strcasestr() as non-standard extension iff _GNU_SOURCE is defined
-     20161205 stpcpy() prototype provided since glibc 2.10 with _POSIX_C_SOURCE >= 200809L and before glibc 2.10 with _GNU_SOURCE
-     Abandoned _GNU_SOURCE because unable to get ncap to find stpcpy() prototype */
-#if 0
-#ifdef __GNUC__  
-# define _GNU_SOURCE
-#endif /* __GNUC__ */
-#endif
-#include <string.h> /* strcmp() */
-#include <assert.h>
-/* 3rd party vendors */
-#include <netcdf.h> /* netCDF definitions and C library */
-#include "nco_netcdf.h" /* NCO wrappers for netCDF C library */
-
-/* Personal headers */
-#include "nco.h" /* netCDF Operator (NCO) definitions */
-#include "ncap.h" /* netCDF arithmetic processor-specific definitions (symbol table, ...) */
-
-/* Bison adds routines which reference YY*LEX token to ncap_yacc.c 
-   These routines generate warnings unless YY*LEX prototype appears above
-   YYLEX prototype generates error unless YYSTYPE token is defined
-   Thus must #include ncap_yacc.h solely to pre-define YY*STYPE for YY*LEX prototype
-   There is no other reason for ncap_yacc.h to appear in ncap_yacc.y 
-   Yes, this is rather circular */
-/* Get YYSTYPE prior to prototyping scanner */
-#include "ncap_yacc.h" /* ncap_yacc.h (ncap.tab.h) is produced from ncap_yacc.y by parser generator */
-
-#define YY_DECL int yylex(YYSTYPE *lval_ptr,prs_sct *prs_arg)
-  YY_DECL;
-
-/* Turn-on parser debugging option (Bison manual p. 85) */
-#define YYDEBUG 0
-int yydebug=0; /* 0: Normal operation. 1: Print parser rules during execution */
-
-/* Turns on more verbose errors than just plain "parse error" when yyerror() is called by parser */
-#define YYERROR_VERBOSE 1
-/* Bison manual p. 60 describes how to call yyparse() with arguments 
-   Following two statements superceded 20051213 by parse-param and lex-param below */
-/* #define YYPARSE_PARAM prs_arg */
-/* #define YYLEX_PARAM prs_arg */
-
-int rcd; /* [enm] Return value for function calls */
-
-/* Global variables */
-extern size_t ncap_ncl_dpt_crr; /* [nbr] Depth of current #include file (declared in ncap.c) */
-extern size_t *ncap_ln_nbr_crr; /* [cnt] Line number (declared in ncap.c) */
-extern char **ncap_fl_spt_glb; /* [fl] Script file (declared in ncap.c) */
-extern char ncap_err_sng[200]; /* [sng] Buffer for error string (declared in ncap_lex.l) */
-
-/* End C declarations section */
-%}
-/* Begin parser declaration section */
-
-/* Request pure, re-entrant parser, so we can pass a structure to parser
-   fxm: 20020122 ncap16: Code breaks on Linux when pure_parser is _not_ used---why?
-   e.g., ncap -O -D 5 -S ${HOME}/dst/dst.nco ${DATA}/${caseid}/${caseid}_${yr_sng}_xy.nc ${DATA}/${caseid}/${caseid}_${yr_sng}_xy.nc
-   Possibly because hardcoded yy* function prototypes change? */
-%pure-parser
-%parse-param {prs_sct *prs_arg}
-%lex-param {prs_sct *prs_arg}
-
-/* NB: "terminal symbol" is just a fancy name for token produced by lexer 
-   Symbols defined on LHS of rules are called "non-terminal symbols" or "non-terminals" 
-   Examples of non-terminals are xpr, stt, stt_lst
-   Examples of terminal symbols, or tokens, are NAME, NUMBER
-   Convention is to make token names all uppercase, and non-terminals lowercase */
-
-/* Define YYSTYPE union (type of lex variable yylval value)
-   This specifies all possible data types for semantic values */
-%union{
-  char *sng; /* [sng] String value */
-  char *var_nm_LHS; /* [sng] Variables on LHS */
-  char *var_nm_RHS; /* [sng] Variables on RHS */
-  aed_sct aed; /* [sct] Attribute */
-  sym_sct *sym; /* [sct] Intrinsic function name */
-  scv_sct scv; /* [sct] Scalar value */
-  var_sct *var; /* [sct] Variable */
-  nm_lst_sct *sbs_lst; /* [sct] Subscript list */
-  int nco_rlt_opr; /* [enm] Comparison operator type */
-  nc_type cnv_type;  /* [enm] Used for type conversion functions */
-} /* end YYSTYPE union (type of yylval value) */
-
-/* Tell parser which kind of values each token takes
-   Token name (traditionally in all caps) becomes #define directive in parser
-   so we can refer to token name rather than token's numeric code */
-%token <aed> OUT_ATT
-%token <nco_rlt_opr> COMPARISON
-%token <sbs_lst> LHS_SBS
-%token <scv> SCV
-%token <sng> SNG
-%token <sym> FUNCTION
-%token <var_nm_LHS> OUT_VAR
-%token <var_nm_RHS> VAR
-%token <cnv_type> CNV_TYPE
-%token ABS ATOSTR EPROVOKE IGNORE NAMED_CONSTANT PACK POWER RDC UNPACK
-%token IF PRINT
-
-/* "type" declaration sets type for non-terminal symbols which otherwise need no declaration
-   Format of "type" declaration is
-   %type <YYSTYPE_member> RHS_xpr
-   RHS expression type RHS_xpr is same type as YYSTYPE union member with name in <> */
-%type <scv> scv_xpr
-%type <sng> sng_xpr
-%type <var> var_xpr
-%type <var_nm_LHS> out_var_xpr
-%type <aed> out_att_xpr
-
-/* "left", "right", and "nonassoc" perform same function as "token" and,
-   in addition, specify associativity and relative precedence of symbols.
-   Each successive line has higher precedence than preceding lines */
-/* fxm: 20020608 AND, NOT, OR not implemented in lexer yet */
-%left AND NOT OR /* && ! || */
-%left COMPARISON /* == != < > <= >= */
-%left '+' '-'
-%left '*' '/' '%'
-%right '^'
-%nonassoc UMINUS
-%nonassoc LOWER_THAN_ELSE
-%nonassoc ELSE
-
-/* End parser declaration section */
-%%
-/* Begin Rules section
-   Format is rule: action
-   Comments OK in space between C code but must be indented */
-
-program: 
-stmt_lst
-; /* end program */
-
-stmt_lst:
- ';' { ;}           /* collect extra ; */
-| stmt_lst ';' { ;} /* collect extra ; */
-| stmt_lst stmt ';' {
-  /* Purpose: Actions to be performed at end-of-statement go here */
-  /* Clean up from and exit LHS_cst mode */
-  (void)nco_var_free_wrp(&((prs_sct *)prs_arg)->var_LHS);
-} /* end stmt ';' */
-| stmt_lst error ';' {(void)nco_var_free_wrp(&((prs_sct *)prs_arg)->var_LHS);}
-| stmt ';' {(void)nco_var_free_wrp(&((prs_sct *)prs_arg)->var_LHS);}
-| error ';' {(void)nco_var_free_wrp(&((prs_sct *)prs_arg)->var_LHS);}
-
-
-/* Catch most errors then read up to next semi-colon */
-; /* end stmt_lst */
-
-stmt: /* Statement is definition of out_att_xpr or out_var_xpr (LHS tokens)
-	 in terms of scv_xpr, var_xpr, and sng_xpr (RHS tokens). 
-	 All permutations are valid so this rule has six possible actions */
-IF '(' bln_xpr ')' stmt %prec LOWER_THAN_ELSE {
-  /* LMB92 p. 234 */
-  ;
-} /* end IF bln_xpr stmt */
-| IF '(' bln_xpr ')' stmt ELSE stmt {
-  /* LMB92 p. 234 */
-  ;
-} /* end IF bln_xpr stmt ELSE stmt */
-PRINT '(' scv_xpr ')' ';' {
-  ;
-} /* end PRINT '(' scv_xpr ')' */
-PRINT '(' var_xpr ')' ';' {
-  ;
-} /* end PRINT '(' var_xpr ')' */
-| out_att_xpr '=' scv_xpr { 
-  aed_sct *ptr_aed;
-  
-  ptr_aed=ncap_aed_lookup($1.var_nm,$1.att_nm,((prs_sct *)prs_arg),True);
-  
-  ptr_aed->val=ncap_scv_2_ptr_unn($3);
-  ptr_aed->type=$3.type;
-  ptr_aed->sz=1L;
-  (void)cast_nctype_void(ptr_aed->type,&ptr_aed->val);    
-  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)sprintf(ncap_err_sng,"Saving attribute %s@%s to %s",$1.var_nm,$1.att_nm,((prs_sct *)prs_arg)->fl_out);
-  (void)nco_yyerror(prs_arg,ncap_err_sng);
-  
-  if(nco_dbg_lvl_get() >= nco_dbg_fl){
-    (void)fprintf(stderr,"Saving in array attribute %s@%s=",$1.var_nm,$1.att_nm);
-    switch($3.type){
-  /* NB: Format depends on opaque type of nco_int
-     Until 200911, nco_int was C-type long, and now nco_int is C-type int
-     case NC_INT: (void)fprintf(stderr,"%ld\n",$3.val.i); break; */
-    case NC_FLOAT: (void)fprintf(stderr,"%G\n",$3.val.f); break;
-    case NC_DOUBLE: (void)fprintf(stderr,"%.5G\n",$3.val.d);break;
-    case NC_INT: (void)fprintf(stderr,"%d\n",$3.val.i); break;
-    case NC_SHORT: (void)fprintf(stderr,"%hi\n",$3.val.s); break;
-    case NC_BYTE: (void)fprintf(stderr,"%hhi\n",$3.val.b); break;
-    case NC_UBYTE: (void)fprintf(stderr,"%hhu\n",$3.val.ub); break;
-    case NC_USHORT: (void)fprintf(stderr,"%hu\n",$3.val.us); break;
-    case NC_UINT: (void)fprintf(stderr,"%u\n",$3.val.ui); break;
-    case NC_INT64: (void)fprintf(stderr,"%lld\n",$3.val.i64); break;
-    case NC_UINT64: (void)fprintf(stderr,"%llu\n",$3.val.ui64); break;
-    case NC_CHAR: (void)fprintf(stderr,"%c\n",$3.val.c); break;
-    case NC_STRING: (void)fprintf(stderr,"%s\n",$3.val.sng); break;
-    default: break;
-    } /* end switch */
-  } /* end if */
-  $1.var_nm=(char *)nco_free($1.var_nm);
-  $1.att_nm=(char *)nco_free($1.att_nm);
-} /* end out_att_xpr '=' scv_xpr */
-| out_att_xpr '=' sng_xpr 
-{
-  aed_sct *ptr_aed;
-  size_t sng_lng;
-  
-  sng_lng=strlen($3);
-  ptr_aed=ncap_aed_lookup($1.var_nm,$1.att_nm,((prs_sct *)prs_arg),True);
-  ptr_aed->type=NC_CHAR;
-  ptr_aed->sz=(long int)((sng_lng+1)*nco_typ_lng(NC_CHAR));
-  ptr_aed->val.cp=(nco_char *)nco_malloc((sng_lng+1)*nco_typ_lng(NC_CHAR));
-  strcpy((char *)(ptr_aed->val.cp),$3);
-  (void)cast_nctype_void((nc_type)NC_CHAR,&ptr_aed->val);    
-  
-  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)sprintf(ncap_err_sng,"Saving attribute %s@%s=%s",$1.var_nm,$1.att_nm,$3);
-  (void)nco_yyerror(prs_arg,ncap_err_sng);
-  $1.var_nm=(char *)nco_free($1.var_nm);
-  $1.att_nm=(char *)nco_free($1.att_nm);
-  $3=(char *)nco_free($3);
-} /* end out_att_xpr '=' sng_xpr */
-| out_att_xpr '=' var_xpr
-{ 
-  /* Storing 0-dimensional variables in attribute is OK */ 
-  aed_sct *ptr_aed;
-  
-  if($3->nbr_dim < 2){
-    ptr_aed=ncap_aed_lookup($1.var_nm,$1.att_nm,((prs_sct *)prs_arg),True);
-    ptr_aed->sz=$3->sz;
-    ptr_aed->type=$3->type;
-    /* if inital scan then fill attribute with zeros */
-    if( ((prs_sct*)prs_arg)->ntl_scn) {
-    ptr_aed->val.vp=(void*)nco_calloc( ptr_aed->sz,nco_typ_lng(ptr_aed->type));
-    } else {
-    ptr_aed->val.vp=(void*)nco_malloc((ptr_aed->sz)*nco_typ_lng(ptr_aed->type));
-    (void)nco_var_copy(ptr_aed->type,ptr_aed->sz,$3->val,ptr_aed->val);
-    }
-    /* cast_nctype_void($3->type,&ptr_aed->val); */
-    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)sprintf(ncap_err_sng,"Saving attribute %s@%s %d dimensional variable",$1.var_nm,$1.att_nm,$3->nbr_dim);
-    (void)yyerror(prs_arg,ncap_err_sng); 
-  }else{
-    (void)sprintf(ncap_err_sng,"Warning: Cannot store in attribute %s@%s a variable with dimension %d",$1.var_nm,$1.att_nm,$3->nbr_dim);
-    (void)yyerror(prs_arg,ncap_err_sng);
-  } /* endif */
-  $1.var_nm=(char *)nco_free($1.var_nm);
-  $1.att_nm=(char *)nco_free($1.att_nm);
-  (void)nco_var_free($3); 
-} /* end out_att_xpr '=' var_xpr */
-| out_var_xpr '=' var_xpr 
-{
-  ($3->nm)=(char*)nco_free($3->nm);
-  $3->nm=strdup($1);
-  (void)ncap_var_write($3,(prs_sct *)prs_arg);
-  
-  /* Print mess only for defined variables */
-  if(nco_dbg_lvl_get() >= nco_dbg_std && !$3->undefined){(void)sprintf(ncap_err_sng,"Saving variable %s to %s",$1,((prs_sct *)prs_arg)->fl_out);
-  (void)yyerror(prs_arg,ncap_err_sng);
-  } /* endif */
-  $1=(char *)nco_free($1);
-} /* end out_var_xpr '=' var_xpr */
-| out_var_xpr '=' scv_xpr
-{
-  var_sct *var;
-  var_sct *var_tmp;  
-  if(nco_dbg_lvl_get() > 5) (void)fprintf(stderr,"%s: DEBUG out_var_xpr = scv_xpr rule for %s\n",nco_prg_nm_get(),$1);
-  
-  /* Turn attribute into temporary variable for writing */
-  var=(var_sct *)nco_malloc(sizeof(var_sct));
-  /* Set defaults */
-  (void)var_dfl_set(var); /* [fnc] Set defaults for each member of variable structure */
-  /* Overwrite with attribute expression information */
-  var->nm=strdup($1);
-  var->nbr_dim=0;
-  var->sz=1;
-  var->type=$3.type;
-  var->val=ncap_scv_2_ptr_unn($3);
-  
-  if(((prs_sct *)prs_arg)->var_LHS != NULL){
-    /* User intends LHS to cast RHS to same dimensionality
-       Stretch newly initialized variable to size of LHS template */
-    /*    (void)ncap_var_cnf_dmn(&$$,&(((prs_sct *)prs_arg)->var_LHS));*/
-    var_tmp=var;
-    (void)ncap_var_stretch(&var_tmp,&(((prs_sct *)prs_arg)->var_LHS));
-    if(var_tmp != var) {
-      var=nco_var_free(var);
-      var=var_tmp;
-	}
-
-    if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(stderr,"%s: Stretching former scv_xpr defining %s with LHS template: Template var->nm %s, var->nbr_dim %d, var->sz %li\n",nco_prg_nm_get(),$1,((prs_sct *)prs_arg)->var_LHS->nm,((prs_sct *)prs_arg)->var_LHS->nbr_dim,((prs_sct *)prs_arg)->var_LHS->sz);
-  } /* endif LHS_cst */
-
-  var->undefined=False;
-  (void)ncap_var_write(var,(prs_sct *)prs_arg);
-  
-  if(nco_dbg_lvl_get() >= nco_dbg_std ) (void)sprintf(ncap_err_sng,"Saving variable %s to %s",$1,((prs_sct *)prs_arg)->fl_out);
-  (void)yyerror(prs_arg,ncap_err_sng);
-  
-  
-  $1=(char *)nco_free($1);
-} /* end out_var_xpr '=' scv_xpr */
-| out_var_xpr '=' sng_xpr
-{
-  
-  var_sct *var;
-  
-  var=(var_sct *)nco_calloc((size_t)1,sizeof(var_sct));
-  var->nm=strdup($1);
-  var->nbr_dim=0;
-  var->dmn_id=(int *)NULL;
-  var->sz=strlen($3)+1;
-  var->val.cp=(nco_char *)strdup($3);
-  var->type=NC_CHAR;
-  var->undefined=False;
-  (void)cast_nctype_void((nc_type)NC_CHAR,&var->val);
-  (void)ncap_var_write(var,(prs_sct *)prs_arg);
-  
-  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)sprintf(ncap_err_sng,"Saving variable %s to %s",$1,((prs_sct *)prs_arg)->fl_out);
-  (void)yyerror(prs_arg,ncap_err_sng);
-  
-  $1=(char *)nco_free($1);
-  $3=(char *)nco_free($3);
-} /* end out_var_xpr '=' sng_xpr */
-; /* end stmt */
-
-scv_xpr: /* scv_xpr results from RHS action which involves only scv_xpr's
-	    One action exists for each binary and unary attribute-valid operator */
-scv_xpr '+' scv_xpr {
-  (void)ncap_scv_scv_cnf_typ_hgh_prc(&$1,&$3);
-  $$=ncap_scv_clc($1,'+',$3);                            
-}
-| scv_xpr '-' scv_xpr {
-  (void)ncap_scv_scv_cnf_typ_hgh_prc(&$1,&$3); 
-  $$=ncap_scv_clc($1,'-',$3);
-}
-| scv_xpr '*' scv_xpr {
-  (void)ncap_scv_scv_cnf_typ_hgh_prc(&$1,&$3);
-  $$=ncap_scv_clc($1,'*',$3);
-}
-| scv_xpr '/' scv_xpr {
-  (void)ncap_scv_scv_cnf_typ_hgh_prc(&$1,&$3); 
-  $$=ncap_scv_clc($1,'/',$3);  
-}
-| scv_xpr '%' scv_xpr {
-  (void)ncap_scv_scv_cnf_typ_hgh_prc(&$1,&$3);
-  
-  $$=ncap_scv_clc($1,'%',$3);  
-}
-| '-' scv_xpr %prec UMINUS {
-  (void)ncap_scv_minus(&$2);
-  $$=$2;
-}
-| '+' scv_xpr %prec UMINUS {
-  $$=$2;
-}
-| scv_xpr '^' scv_xpr {
-  if(nco_rth_prc_rnk($1.type) <= nco_rth_prc_rnk_float && nco_rth_prc_rnk($3.type) <= nco_rth_prc_rnk_float) {
-    (void)nco_scv_cnf_typ((nc_type)NC_FLOAT,&$1);
-    (void)nco_scv_cnf_typ((nc_type)NC_FLOAT,&$3);
-    $$.val.f=powf($1.val.f,$3.val.f);
-    $$.type=NC_FLOAT;
-  }else{
-    (void)nco_scv_cnf_typ((nc_type)NC_DOUBLE,&$1);
-    (void)nco_scv_cnf_typ((nc_type)NC_DOUBLE,&$3);
-    $$.val.d=pow($1.val.d,$3.val.d);
-    $$.type=NC_DOUBLE; 
-  } /* end else */
-} /* end scv_xpr '^' scv_xpr */
-| POWER '(' scv_xpr ',' scv_xpr ')' { /* fxm: ncap52 this is identical to previous clause except for argument numbering, should be functionalized to use common code */
-  if(nco_rth_prc_rnk($3.type) <= nco_rth_prc_rnk_float && nco_rth_prc_rnk($5.type) <= nco_rth_prc_rnk_float) {
-    (void)nco_scv_cnf_typ((nc_type)NC_FLOAT,&$3);
-    (void)nco_scv_cnf_typ((nc_type)NC_FLOAT,&$5);
-    $$.val.f=powf($3.val.f,$5.val.f);
-    $$.type=NC_FLOAT;
-  }else{ 
-    (void)nco_scv_cnf_typ((nc_type)NC_DOUBLE,&$3);
-    (void)nco_scv_cnf_typ((nc_type)NC_DOUBLE,&$5);
-    $$.val.d=pow($3.val.d,$5.val.d);
-    $$.type=NC_DOUBLE; 
-  } /* end else */
-} /* end POWER '(' scv_xpr ',' scv_xpr ')' */
-| ABS '(' scv_xpr ')' {
-  $$=ncap_scv_abs($3);
-}
-| FUNCTION '(' scv_xpr ')' {
-  if(nco_rth_prc_rnk($3.type) <= nco_rth_prc_rnk_float) {
-    (void)nco_scv_cnf_typ((nc_type)NC_FLOAT,&$3);
-    $$.val.f=(*($1->fnc_flt))($3.val.f);
-    $$.type=NC_FLOAT;
-  }else{
-    $$.val.d=(*($1->fnc_dbl))($3.val.d);
-    $$.type=NC_DOUBLE;
-  } /* end else */
-} /* end FUNCTION '(' scv_xpr ')' */
-| CNV_TYPE '(' scv_xpr ')' {
-  (void)nco_scv_cnf_typ($1,&$3);
-  $$=$3;
-}
-| '(' scv_xpr ')' {$$=$2;}
-| SCV {$$=$1;}
-; /* end scv_xpr */
-
-out_var_xpr: OUT_VAR {$$=$1;}
-;
-
-out_att_xpr: OUT_ATT {$$=$1;}
-;
-
-sng_xpr: /* sng_xpr is any combination of sng_xpr or attribute */
-sng_xpr '+' sng_xpr {
-  size_t sng_lng;
-  sng_lng=strlen($1)+strlen($3);
-  $$=(char*)nco_malloc((sng_lng+1)*sizeof(char));
-  strcpy($$,$1);
-  strcat($$,$3);
-  $1=(char *)nco_free($1);
-  $3=(char *)nco_free($3);
-} /* end sng_xpr '+' sng_xpr */
-| ATOSTR '(' scv_xpr ')' {
-  char bfr[50];
-  switch ($3.type){
-  /* NB: Format depends on opaque type of nco_int
-     Until 200911, nco_int was C-type long, and now nco_int is C-type int
-     case NC_INT: sprintf(bfr,"%ld",$3.val.i); break; */
-  case NC_DOUBLE: sprintf(bfr,"%.10G",$3.val.d); break;
-  case NC_FLOAT: sprintf(bfr,"%G",$3.val.f); break;
-  case NC_INT: sprintf(bfr,"%d",$3.val.i); break;
-  case NC_SHORT: sprintf(bfr,"%hi",$3.val.s); break;
-  case NC_BYTE: sprintf(bfr,"%hhi",$3.val.b); break;
-  case NC_UBYTE: sprintf(bfr,"%hhu",$3.val.ub); break;
-  case NC_USHORT: sprintf(bfr,"%hu",$3.val.us); break;
-  case NC_UINT: sprintf(bfr,"%u",$3.val.ui); break;
-  case NC_INT64: sprintf(bfr,"%lld",$3.val.i64); break;
-  case NC_UINT64: sprintf(bfr,"%llu",$3.val.ui64); break;
-  case NC_CHAR: sprintf(bfr,"%c",$3.val.c); break;
-  case NC_STRING: sprintf(bfr,"%s",$3.val.sng); break;
-  default:  break;
-  } /* end switch */
-  $$=strdup(bfr);      
-} /* end ATOSTR '(' scv_xpr ')' */
-| ATOSTR '(' scv_xpr ',' sng_xpr ')' {
-  char bfr[150];
-  /* Format string according to string expression */
-  /* User decides which format corresponds to which type */
-  switch ($3.type){
-  case NC_DOUBLE: sprintf(bfr,$5,$3.val.d); break;
-  case NC_FLOAT: sprintf(bfr,$5,$3.val.f); break;
-  case NC_INT: sprintf(bfr,$5,$3.val.i); break;
-  case NC_SHORT: sprintf(bfr,$5,$3.val.s); break;
-  case NC_BYTE: sprintf(bfr,$5,$3.val.b); break;
-  case NC_UBYTE: sprintf(bfr,$5,$3.val.ub); break;
-  case NC_USHORT: sprintf(bfr,$5,$3.val.us); break;
-  case NC_UINT: sprintf(bfr,$5,$3.val.ui); break;
-  case NC_INT64: sprintf(bfr,$5,$3.val.i64); break;
-  case NC_UINT64: sprintf(bfr,$5,$3.val.ui64); break;
-  case NC_CHAR: sprintf(bfr,$5,$3.val.c); break;
-  case NC_STRING: sprintf(bfr,$5,$3.val.sng); break;
-  default:  break;
-  } /* end switch */
-  $5=(char *)nco_free($5);
-  $$=strdup(bfr);      
-} /* end ATOSTR '(' scv_xpr ',' sng_xpr ')' */
-| SNG {$$=$1;} /* Terminal symbol action */
-; /* end sng_xpr */
-
-bln_xpr: /* bln_xpr results from comparison of var_xpr's and scv_xpr's */
-var_xpr COMPARISON var_xpr {
-}
-| scv_xpr COMPARISON scv_xpr {
-}
-| var_xpr COMPARISON scv_xpr {
-}
-| scv_xpr COMPARISON var_xpr {
-}
-; /* end bln_xpr */
-
-var_xpr: /* var_xpr results from RHS action which involves a var_xpr, i.e.,
-	    OP var, var OP var, var OP att, att OP var */
-var_xpr '+' var_xpr { /* Begin Addition */
-  $$=ncap_var_var_add($1,$3); 
-}
-| var_xpr '+' scv_xpr {
-  $$=ncap_var_scv_add($1,$3);
-}            
-| scv_xpr '+' var_xpr {
-  /* Addition commutes so swap arguments and use S+V = V+S */
-  $$=ncap_var_scv_add($3,$1);
-}  /* End Addition */
-| var_xpr '-' var_xpr { /* Begin Subtraction */
-  $$=ncap_var_var_sub($1,$3);
-}
-| var_xpr '-' scv_xpr {
-  $$=ncap_var_scv_sub($1,$3);
-}
-| scv_xpr '-' var_xpr { 
-  /* Subtraction is non-commutative, do not swap arguments and/or re-use V-S subtraction function
-     Use anti-symmetric property that V-S=-(S-V) */
-  scv_sct minus;
-  minus.val.b=-1;
-  minus.type=NC_BYTE;
-  (void)nco_scv_cnf_typ($3->type,&minus);
-  (void)ncap_var_scv_sub($3,$1);
-  $$=ncap_var_scv_mlt($3,minus);
-} /* End Subtraction */
-| var_xpr '*' var_xpr { /* Begin Multiplication */
-  $$=ncap_var_var_mlt($1,$3); 
-}
-| var_xpr '*' scv_xpr {
-  $$=ncap_var_scv_mlt($1,$3);
-}
-| scv_xpr '*' var_xpr {
-  /* Addition commutes so swap arguments and use S*V = V*S */
-  $$=ncap_var_scv_mlt($3,$1);
-} /* End Multiplication */
-| var_xpr '/' var_xpr { /* Begin Division */
-  /* NB: Order was important (keeping denominator as I/O variable)
-     This is no longer true with ncbo
-     Maybe rewrite to keep argument ordering consitent with multiplication, addition */
-  $$=ncap_var_var_dvd($3,$1);
-}
-| var_xpr '/' scv_xpr { /* Keep V as I/O */
-  $$=ncap_var_scv_dvd($1,$3);
-}
-| scv_xpr '/' var_xpr {
- /* Division is non-commutative, use S/V not V/S division function */
-  $$=ncap_scv_var_dvd($1,$3);
-} /* End Division */
-| var_xpr '%' var_xpr { /* Begin Modulo */
-  $$=ncap_var_var_mod($1,$3);
-}
-| var_xpr '%' scv_xpr {
-  $$=ncap_var_scv_mod($1,$3);
-}
-| scv_xpr '%' var_xpr {
-  /* Modulo is non-commutative, use S%V not V%S modulo function */
-  $$=ncap_scv_var_mod($1,$3);
-} /* End Modulo */
-| var_xpr '^' var_xpr { /* Begin Empowerment of form x^y */
-  $$=ncap_var_var_pwr($1,$3);
-}
-| var_xpr '^' scv_xpr {
-  $$=ncap_var_scv_pwr($1,$3);
-}
-| scv_xpr '^' var_xpr {
-  /* Empowerment is non-commutative, use S^V not V^S empowerment function */
-  $$=ncap_scv_var_pwr($1,$3);
-}
-| POWER '(' var_xpr ',' var_xpr ')' { /* Begin Empowerment of form pow(x,y) */
-  /* fxm: TODO ncap52 Combine pow() with ^ parsing in parser ncap_yacc.y */
-  $$=ncap_var_var_pwr($3,$5);
-}
-| POWER '(' var_xpr ',' scv_xpr ')' {
-  $$=ncap_var_scv_pwr($3,$5);
-}
-| POWER '(' scv_xpr ',' var_xpr ')' {
-  /* Empowerment is non-commutative, use S^V not V^S empowerment function */
-  $$=ncap_scv_var_pwr($3,$5);
-} /* End Empowerment */
-| '-' var_xpr %prec UMINUS { /* Begin Unary Subtraction */
-  scv_sct minus;
-  minus.val.b=-1;
-  minus.type=NC_BYTE;
-  $$=ncap_var_scv_mlt($2,minus);
-} /* End Unary Subtraction */
-| '+' var_xpr %prec UMINUS { /* Begin Unary Addition */
-  $$=$2;
-} /* End Unary Addition */
-| ABS '(' var_xpr ')' {
-  $$=ncap_var_abs($3);
-} /* end ABS */
-| RDC '(' var_xpr ')' {
-  $$=ncap_var_abs($3);
-  /* fxm Finish avg,min,max,ttl */
-  /* $$=nco_var_avg($3,dim,dmn_nbr,nco_op_typ); */
-  /* if(prs_arg->nco_op_typ == nco_op_avg) (void)nco_var_dvd(var_prc_out[idx]->type,var_prc_out[idx]->sz,var_prc_out[idx]->has_mss_val,var_prc_out[idx]->mss_val,wgt_avg->val,var_prc_out[idx]->val); */
-  (void)fprintf(stderr,"%s: WARNING RDC tokens not implemented yet\n",nco_prg_nm_get());
-  /* $3 is freed in nco_var_avg() */
-} /* end ABS */
-| PACK '(' var_xpr ')' {
-  /* Packing variable does not create duplicate so DO NOT free $3 */
-  const nc_type nc_typ_pck_dfl=NC_SHORT; /* [enm] Default type to pack to */
-  nco_bool PCK_VAR_WITH_NEW_PCK_ATT;
-  
-  if(((prs_sct*)prs_arg)->ntl_scn){
-    $3->undefined=True;
-    $$=$3;
-  }else{ 
-    $$=nco_var_pck($3,nc_typ_pck_dfl,&PCK_VAR_WITH_NEW_PCK_ATT);
-    PCK_VAR_WITH_NEW_PCK_ATT=PCK_VAR_WITH_NEW_PCK_ATT+0; /* CEWI */
-  } /* end else */
-} /* end PACK */
-| UNPACK '(' var_xpr ')' {
-  /* Unpacking variable does not create duplicate so DO NOT free $3 */
-  /* Do not unpack on first pass */
-  if(((prs_sct*)prs_arg)->ntl_scn){
-    $3->undefined=True;
-    $$=$3;
-  }else{ 
-    $$=nco_var_upk($3);
-  } /* end else */
-} /* end UNPACK */
-| FUNCTION '(' var_xpr ')' {
-  $$=ncap_var_fnc($3,$1);
-}  
-| '(' var_xpr ')' {
-  $$=$2;
-}
-| CNV_TYPE '(' var_xpr ')' {
-  $$=nco_var_cnf_typ($1,$3);
-}
-| NAMED_CONSTANT { /* Terminal symbol action */
-  /* fxm: Allow commands like a=M_PI*rds^2; to work */
-}
-| VAR { /* Terminal symbol action */
-  
-  var_sct *var;
-  var_sct *var_tmp;
-  prs_sct *prs_drf; /*Pointer for de-referencing */
-  
-  prs_drf=(prs_sct*)prs_arg;
-  
-  var=ncap_var_init($1,prs_drf);
-  var->undefined=False;
-  
-  if(prs_drf->ntl_scn == True && prs_drf->var_LHS != NULL){
-    var_tmp=nco_var_dpl(prs_drf->var_LHS);
-    var_tmp->id=var->id;
-    var_tmp->nm=(char*)nco_free(var_tmp->nm);
-    var_tmp->nm=strdup($1);
-    var_tmp->type=var->type;
-    var_tmp->typ_dsk=var->typ_dsk;
-    var_tmp->undefined=False;
-    var_tmp->val.vp=(void*)NULL;
-    var=nco_var_free(var);
-    var=var_tmp;
-  } /* endif ntl_scn */
-  
-  if(prs_drf->ntl_scn == False && prs_drf->var_LHS != NULL){
-    /* User intends LHS to cast RHS to same dimensionality
-       Stretch newly initialized variable to size of LHS template */
-    /*    (void)ncap_var_cnf_dmn(&$$,&(((prs_sct *)prs_arg)->var_LHS));*/
-    var_tmp=var;
-    (void)ncap_var_stretch(&var_tmp,&(prs_drf->var_LHS));
-    if(var_tmp != var) { 
-      var=nco_var_free(var); 
-      var=var_tmp;
-    }
-  
-    if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(stderr,"%s: Stretching variable %s with LHS template: Template var->nm %s, var->nbr_dim %d, var->sz %li\n",nco_prg_nm_get(),var->nm,prs_drf->var_LHS->nm,prs_drf->var_LHS->nbr_dim,prs_drf->var_LHS->sz);
-    var->undefined=False;
-  } /* endif LHS_cst */
-  $1=(char*)nco_free($1);
-  $$=var;
-  /* Sanity check */
-  if ($$==(var_sct *)NULL) YYERROR;
-} /* end VAR terminal symbol */
-; /* end var_xpr */
-
-/* End Rules section */
-%%
-/* Begin User Functions section */
-
-aed_sct *  /* O [idx] Location of attribute in list */
-ncap_aed_lookup /* [fnc] Find location of existing attribute or add new attribute */
-(const char * const var_nm, /* I [sng] Variable name */
- const char * const att_nm, /* I [sng] Attribute name */
- prs_sct *  prs_arg,   /* contains attribute list */       
- const nco_bool update) /* I [flg] Delete existing value or add new attribute to list */
-{
-  int idx;
-  int size;
-  aed_sct *ptr_aed;
-  
-  size=*(prs_arg->nbr_att);
-  
-  for(idx=0;idx<size;idx++){
-    ptr_aed=(*(prs_arg->att_lst))[idx];
-    
-    if(strcmp(ptr_aed->att_nm,att_nm) || strcmp(ptr_aed->var_nm,var_nm)) 
-      continue; 
-    
-    if(update) ptr_aed->val.vp=nco_free(ptr_aed->val.vp);   
-    /* Return pointer to list element */
-    return ptr_aed;
-    
-  } /* end for */
-  
-  if(!update) return (aed_sct *)NULL;
-  
-  *(prs_arg->att_lst)=(aed_sct **)nco_realloc(*(prs_arg->att_lst),(size+1)*sizeof(aed_sct*));
-  ++*(prs_arg->nbr_att);
-  (*(prs_arg->att_lst))[size]=(aed_sct *)nco_malloc(sizeof(aed_sct));
-  (*(prs_arg->att_lst))[size]->var_nm=strdup(var_nm);
-  (*(prs_arg->att_lst))[size]->att_nm=strdup(att_nm);
-  
-  return (*(prs_arg->att_lst))[size];
-} /* end ncap_aed_lookup() */
-
-var_sct * /*I [sct] varibale in list */
-ncap_var_lookup
-(var_sct *var, /* I  [sct] variable  */
- prs_sct *prs_arg, /* I/O [sct] contains var list */
- const nco_bool add) /* I if not in list then add to list */          
-{
-  int idx;
-  int size;
-  
-  var_sct *ptr_var; 
-  
-  size = *(prs_arg->nbr_var);
-  
-  for(idx=0;idx<size;idx++){
-    
-    ptr_var=(*(prs_arg->var_lst))[idx];
-    /*
-      assert(var->nm);
-      assert(ptr_var->nm);
-      if(!strcmp(var->nm,ptr_var->nm)) return ptr_var;    
-    */
-    if(ptr_var==NULL || strcmp(var->nm,ptr_var->nm) ) continue;
-    
-    return ptr_var;
-  } /* end loop over idx */
-  
-  if(!add) return (var_sct *)NULL;
-  
-  *(prs_arg->var_lst)=(var_sct **)nco_realloc(*(prs_arg->var_lst),(size+1)*sizeof(var_sct*));
-  ++*(prs_arg->nbr_var);
-  (*(prs_arg->var_lst))[size]=var;
-  
-  return (var_sct *)NULL;
-} /* end ncap_var_lookup() */
-
-int /* [rcd] Return code */
-yyerror /* [fnc] Print error/warning/info messages generated by parser */
-(prs_sct *prs_arg, const char * const err_sng_lcl) /* [sng] Message to print */
-{
-  /* Purpose: Print error/warning/info messages generated by parser
-     Use eprokoke_skip to skip error message after sending error message from yylex()
-     Stop provoked error message from yyparse being printed */
-  
-  static nco_bool eprovoke_skip;
-  
-  prs_arg=prs_arg+0; /* CEWI otherwise unused parameter error */
-
-  /* if(eprovoke_skip){eprovoke_skip=False ; return 0;} */
-  if(nco_dbg_lvl_get() >= nco_dbg_std){
-    (void)fprintf(stderr,"%s: %s line %lu",nco_prg_nm_get(),ncap_fl_spt_glb[ncap_ncl_dpt_crr],(unsigned long)ncap_ln_nbr_crr[ncap_ncl_dpt_crr]);
-    if(nco_dbg_lvl_get() >= nco_dbg_fl) (void)fprintf(stderr," %s",err_sng_lcl);
-    (void)fprintf(stderr,"\n");
-    (void)fflush(stderr);
-  } /* endif dbg */
-  
-  if(err_sng_lcl[0] == '#') eprovoke_skip=True;
-  eprovoke_skip=eprovoke_skip+0; /* CEWI Do nothing except avoid compiler warnings */
-  return 0;
-} /* end yyerror() */
-
-void 
-nco_var_free_wrp /* [fnc] Safely free variable */
-(var_sct **var) /* I/O [sct] Variable */
-{
-  /* Purpose: Safely free variable
-     Routine is wrapper for nco_var_free() that simplifies code in calling routine */
-  if(*var != NULL) *var=nco_var_free(*var);
-} /* end nco_var_free_wrp() */
-
-nodeType * /* O [unn] Syntax tree node */
-opr_ctl /* [fnc] Operation controller function Nie02 opr() */
-(int opr_tkn, /* I [enm] Operator token */
- int arg_nbr, /* I [nbr] Number of optional arguments to malloc() wrapper */
- ...) /* I [llp] Ellipsis defined in stdarg.h */
-{
-  /* Purpose: Create and return syntax tree node */
-  va_list arg_lst; /* [] Variable argument list */
-  nodeType *nod; /* [sct] Syntax tree node */
-  size_t nod_sz; /* [nbr] Node size */
-  int arg_idx; /* [idx] Argument index */
-  
-  /* Operator node requires space for token and arguments */
-  nod_sz=sizeof(opr_nod_sct)+(arg_nbr-1)*sizeof(nodeType *);
-  nod=(nodeType *)nco_malloc(nod_sz);
-  /* Copy information into new node */
-  nod->nod_typ=typ_opr; /* [enm] Node type */
-  nod->opr.opr_tkn=opr_tkn; /* [enm] Operator token */
-  nod->opr.arg_nbr=arg_nbr; /* [nbr] Number of arguments */
-  /* Begin variable argument list access */
-  va_start(arg_lst,arg_nbr);
-  for(arg_idx=0;arg_idx<nod->opr.arg_nbr;arg_idx++) nod->opr.arg[arg_idx]=va_arg(arg_lst,nodeType); /* NB: Nie02 p. 27 has typo in va_arg() */
-  /* End variable argument list access */
-  va_end(arg_lst);
-  return nod;
-} /* end opr_ctl() */
-
-void
-freeNode /* [fnc] Free syntax tree node Nie02 freeNode() */
-(nodeType *nod) /* I/O [sct] Syntax tree node to free */
-{
-  /* Purpose: Free syntax tree node */
-  int arg_idx; /* [idx] Argument index */
-  
-  if(!nod) return;
-  
-  /* Operator nodes have copies of arguments. Free these first. */
-  if(nod->nod_typ == typ_opr){
-    /* Recursive call to freeNode continue until statement is reduced */
-    for(arg_idx=0;arg_idx<nod->opr.arg_nbr;arg_idx++) freeNode(nod->opr.arg+arg_idx); /* Nie02 p. 28 has typo and passes node not node pointer */
-  } /* endif */
-  /* Free node itself */
-  nod=(nodeType *)nco_free(nod);
-  
-  return; /* 20050109: fxm added return to void function to squelch erroneous gcc-3.4.2 warning */ 
-} /* end freeNode() */
-
-/* End User Functions section */
diff --git a/src/nco/ncatted.c b/src/nco/ncatted.c
index 4a30a5b..e0c6157 100644
--- a/src/nco/ncatted.c
+++ b/src/nco/ncatted.c
@@ -235,6 +235,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"append",no_argument,0,'A'},
     {"attribute",required_argument,0,'a'},
@@ -301,6 +303,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
         (void)nco_vrs_prn(CVS_Id,CVS_Revision);
@@ -321,7 +324,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'h': /* Toggle appending to history global attribute */
       HISTORY_APPEND=!HISTORY_APPEND;
@@ -367,7 +369,7 @@ main(int argc,char **argv)
     if(opt_crr) opt_crr=(char *)nco_free(opt_crr);
   } /* end while loop */
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   if(fl_out) FL_OUT_NEW=True; else fl_out=(char *)strdup(fl_lst_in[0]);
 
diff --git a/src/nco/ncbo.c b/src/nco/ncbo.c
index 32e5f10..d987a5e 100644
--- a/src/nco/ncbo.c
+++ b/src/nco/ncbo.c
@@ -303,6 +303,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     {"ppc",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"precision_preserving_compression",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"quantize",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
@@ -441,6 +443,7 @@ main(int argc,char **argv)
 	(void)nco_usg_prn();
 	nco_exit(EXIT_SUCCESS);
       } /* endif "help" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"msa_usr_rdr") || !strcmp(opt_crr,"msa_user_order")) MSA_USR_RDR=True; /* [flg] Multi-Slab Algorithm returns hyperslabs in user-specified order */
       if(!strcmp(opt_crr,"ppc") || !strcmp(opt_crr,"precision_preserving_compression") || !strcmp(opt_crr,"quantize")){
         ppc_arg[ppc_nbr]=(char *)strdup(optarg);
@@ -488,7 +491,6 @@ main(int argc,char **argv)
     case 'D': /* The debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -588,7 +590,7 @@ main(int argc,char **argv)
   /* Default operation depends on invocation name */
   if(nco_op_typ_sng == NULL) nco_op_typ=nco_op_typ_get(nco_op_typ_sng);
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
 
   /* Initialize thread information */
diff --git a/src/nco/ncecat.c b/src/nco/ncecat.c
index 5b5c852..71c24fb 100644
--- a/src/nco/ncecat.c
+++ b/src/nco/ncecat.c
@@ -294,6 +294,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     {"ppc",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"precision_preserving_compression",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"quantize",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
@@ -436,6 +438,7 @@ main(int argc,char **argv)
 	(void)nco_usg_prn();
 	nco_exit(EXIT_SUCCESS);
       } /* endif "help" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"md5_dgs") || !strcmp(opt_crr,"md5_digest")){
         if(!md5) md5=nco_md5_ini();
 	md5->dgs=True;
@@ -489,7 +492,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -609,7 +611,7 @@ main(int argc,char **argv)
     fl_out_fmt=NC_FORMAT_NETCDF4; 
   } /* !GROUP_AGGREGATE */
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
 
   /* Parse filename */
diff --git a/src/nco/ncflint.c b/src/nco/ncflint.c
index 3473bce..f873836 100644
--- a/src/nco/ncflint.c
+++ b/src/nco/ncflint.c
@@ -294,6 +294,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     {"ppc",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"precision_preserving_compression",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"quantize",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
@@ -436,6 +438,7 @@ main(int argc,char **argv)
 	(void)nco_usg_prn();
 	nco_exit(EXIT_SUCCESS);
       } /* endif "help" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"msa_usr_rdr") || !strcmp(opt_crr,"msa_user_order")) MSA_USR_RDR=True; /* [flg] Multi-Slab Algorithm returns hyperslabs in user-specified order */
       if(!strcmp(opt_crr,"ppc") || !strcmp(opt_crr,"precision_preserving_compression") || !strcmp(opt_crr,"quantize")){
         ppc_arg[ppc_nbr]=(char *)strdup(optarg);
@@ -483,7 +486,6 @@ main(int argc,char **argv)
     case 'D': /* The debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -617,7 +619,7 @@ main(int argc,char **argv)
     nco_exit(EXIT_FAILURE);
   } /* end else */
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
 
   /* Initialize thread information */
diff --git a/src/nco/ncks.c b/src/nco/ncks.c
index eba92cf..8f57cae 100644
--- a/src/nco/ncks.c
+++ b/src/nco/ncks.c
@@ -129,8 +129,10 @@ main(int argc,char **argv)
   char *fl_in=NULL;
   char *fl_out=NULL; /* Option o */
   char *fl_out_tmp=NULL_CEWI;
+  char *fl_prn=NULL; /* [sng] Formatted text output file */
   char *fl_pth=NULL; /* Option p */
   char *fl_pth_lcl=NULL; /* Option l */
+  char *fmt_val=NULL; /* [sng] Format string for variable values */
   char *lmt_arg[NC_MAX_DIMS];
   char *opt_crr=NULL; /* [sng] String representation of current long-option name */
   char *optarg_lcl=NULL; /* [sng] Local copy of system optarg */
@@ -173,6 +175,7 @@ main(int argc,char **argv)
   extern int optind;
 
   FILE *fp_bnr=NULL; /* [fl] Unformatted binary output file handle */
+  FILE *fp_prn=NULL; /* [fl] Formatted text output file handle */
 
   gpe_sct *gpe=NULL; /* [sng] Group Path Editing (GPE) structure */
 
@@ -404,6 +407,13 @@ main(int argc,char **argv)
     {"file_format",required_argument,0,0},
     {"fix_rec_dmn",required_argument,0,0}, /* [sng] Fix record dimension */
     {"no_rec_dmn",required_argument,0,0}, /* [sng] Fix record dimension */
+    {"fl_prn",required_argument,0,0}, /* [sng] Formatted text output file */
+    {"file_print",required_argument,0,0}, /* [sng] Formatted text output file */
+    {"prn_fl",required_argument,0,0}, /* [sng] Formatted text output file */
+    {"print_file",required_argument,0,0}, /* [sng] Formatted text output file */
+    {"fmt_val",required_argument,0,0}, /* [sng] Format string for variable values */
+    {"val_fmt",required_argument,0,0}, /* [sng] Format string for variable values */
+    {"value_format",required_argument,0,0}, /* [sng] Format string for variable values */
     {"gaa",required_argument,0,0}, /* [sng] Global attribute add */
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
@@ -412,6 +422,8 @@ main(int argc,char **argv)
     {"jsn_format",required_argument,0,0}, /* [enm] JSON format */
     {"json_fmt",required_argument,0,0}, /* [enm] JSON format */
     {"json_format",required_argument,0,0}, /* [enm] JSON format */
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     {"mk_rec_dmn",required_argument,0,0}, /* [sng] Name of record dimension in output */
     {"mk_rec_dim",required_argument,0,0}, /* [sng] Name of record dimension in output */
     {"mta_dlm",required_argument,0,0}, /* [sng] Multi-argument delimiter */
@@ -630,12 +642,14 @@ main(int argc,char **argv)
         rec_dmn_nm=strcpy(rec_dmn_nm,fix_pfx);
         rec_dmn_nm=strcat(rec_dmn_nm,optarg);
         rec_dmn_nm_fix=strdup(optarg);
-      } /* endif fix_rec_dmn */
+      } /* !fix_rec_dmn */
       if(!strcmp(opt_crr,"fl_fmt") || !strcmp(opt_crr,"file_format")) rcd=nco_create_mode_prs(optarg,&fl_out_fmt);
+      if(!strcmp(opt_crr,"fl_prn") || !strcmp(opt_crr,"file_print") || !strcmp(opt_crr,"prn_fl") || !strcmp(opt_crr,"print_file")) fl_prn=(char *)strdup(optarg);
+      if(!strcmp(opt_crr,"fmt_val") || !strcmp(opt_crr,"val_fmt") || !strcmp(opt_crr,"value_format")) fmt_val=(char *)strdup(optarg);
       if(!strcmp(opt_crr,"gaa") || !strcmp(opt_crr,"glb_att_add")){
         gaa_arg=(char **)nco_realloc(gaa_arg,(gaa_nbr+1)*sizeof(char *));
         gaa_arg[gaa_nbr++]=(char *)strdup(optarg);
-      } /* endif gaa */
+      } /* !gaa */
       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")){
@@ -651,6 +665,7 @@ main(int argc,char **argv)
         nco_exit(EXIT_SUCCESS);
       } /* endif "lbr" */
       if(!strcmp(opt_crr,"lbr_rcd")) nco_exit_lbr_rcd();
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"lst_rnk_ge2") || !strcmp(opt_crr,"rank_ge2"))	LST_RNK_GE2=True; /* [flg] Print extraction list of rank >= 2 variables */
       if(!strcmp(opt_crr,"lst_xtr") || !strcmp(opt_crr,"xtr_lst")) LST_XTR=True; /* [flg] Print extraction list */
       if(!strcmp(opt_crr,"mk_rec_dmn") || !strcmp(opt_crr,"mk_rec_dim")){
@@ -706,7 +721,7 @@ main(int argc,char **argv)
 	rgr_var=(char *)strdup(optarg);
       } /* !rgr_var */
       if(!strcmp(opt_crr,"secret") || !strcmp(opt_crr,"scr") || !strcmp(opt_crr,"shh")){
-        (void)fprintf(stdout,"Hidden/unsupported NCO options:\nBit-Adjustment Alg.\t--baa, --bit_alg\nBuild-engine\t\t--bld, --build_engine\nCompiler used\t\t--cmp, --compiler\nCopyright\t\t--cpy, --copyright, --license\nHidden functions\t--scr, --shh, --secret\nLibrary used\t\t--lbr, --library\nList rank >= 2 vars\t--lst_rnk_ge2\n\nList extracted vars\t--lst_xtr\nMemory clean\t\t--mmr_cln, --cln, --clean\nMemory dirty\t\t--mmr_drt, --drt, --dirty\nMPI implementation\t--mpi_implementatio [...]
+        (void)fprintf(stdout,"Hidden/unsupported NCO options:\nBit-Adjustment Alg.\t--baa, --bit_alg\nBuild-engine\t\t--bld, --build_engine\nCompiler used\t\t--cmp, --compiler\nCopyright\t\t--cpy, --copyright, --license\nHidden functions\t--scr, --shh, --secret\nLibrary used\t\t--lbr, --library\nLog level\t\t--log_lvl, --log_level\nList rank >= 2 vars\t--lst_rnk_ge2\n\nList extracted vars\t--lst_xtr\nMemory clean\t\t--mmr_cln, --cln, --clean\nMemory dirty\t\t--mmr_drt, --drt, --dirty\nMP [...]
         nco_exit(EXIT_SUCCESS);
       } /* endif "shh" */
       if(!strcmp(opt_crr,"srm")) PRN_SRM=True; /* [flg] Print ncStream */
@@ -762,9 +777,9 @@ main(int argc,char **argv)
 	JSN_ATT_FMT%=4; /* 20161221: Valid values are 0,1,2 */
 	if(JSN_ATT_FMT == 3) JSN_ATT_FMT=2;
       } /* !jsn_att_fmt */
+      if(!strcmp(opt_crr,"jsn") || !strcmp(opt_crr,"json") || !strcmp(opt_crr,"w10") || !strcmp(opt_crr,"w10n")) PRN_JSN=True; /* [flg] Print JSON */
       if(!strcmp(opt_crr,"wrt_tmp_fl") || !strcmp(opt_crr,"write_tmp_fl")) WRT_TMP_FL=True;
       if(!strcmp(opt_crr,"no_tmp_fl")) WRT_TMP_FL=False;
-      if(!strcmp(opt_crr,"jsn") || !strcmp(opt_crr,"json") || !strcmp(opt_crr,"w10") || !strcmp(opt_crr,"w10n")) PRN_JSN=True; /* [flg] Print JSON */
       if(!strcmp(opt_crr,"xml") || !strcmp(opt_crr,"ncml")) PRN_XML=True; /* [flg] Print XML (NcML) */
       if(!strcmp(opt_crr,"xml_no_location") || !strcmp(opt_crr,"ncml_no_location")){PRN_XML_LOCATION=False;PRN_XML=True;} /* [flg] Print XML location tag */
       if(!strcmp(opt_crr,"xml_spr_chr")){spr_chr=(char *)strdup(optarg);PRN_XML=True;} /* [flg] Separator for XML character types */
@@ -815,7 +830,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -890,7 +904,8 @@ main(int argc,char **argv)
       while(!nco_spn_lck_brk) usleep(nco_spn_lck_us); /* Spinlock. fxm: should probably insert a sched_yield */
       break;
 #endif /* !ENABLE_MPI */
-    case 's': /* User specified delimiter string for printed output */
+    case 's': /* User-specified delimiter string for traditional printed output */
+      PRN_TRD=True; /* [flg] Print traditional */
       dlm_sng=(char *)strdup(optarg);
       break;
     case 't': /* Thread number */
@@ -971,7 +986,7 @@ main(int argc,char **argv)
   /* Initialize traversal table */
   (void)trv_tbl_init(&trv_tbl);
  
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   
   /* Initialize thread information */
@@ -1201,7 +1216,8 @@ main(int argc,char **argv)
 
     /* No output file was specified so PRN_ tokens refer to screen printing */
     prn_fmt_sct prn_flg;
-    // prn_flg.trd=PRN_TRD || !(PRN_CDL || PRN_XML || PRN_JSN); // 20170522
+    /* Printing defaults to stdout */
+    prn_flg.fp_out=stdout;
     PRN_CDL=PRN_CDL || !(PRN_TRD || PRN_XML || PRN_JSN); // 20170817
     prn_flg.cdl=PRN_CDL;
     prn_flg.trd=PRN_TRD;
@@ -1239,6 +1255,7 @@ main(int argc,char **argv)
     prn_flg.dlm_sng=dlm_sng;
     prn_flg.cdl_fmt_dt=dt_fmt;
     prn_flg.fl_out_fmt=fl_out_fmt;
+    prn_flg.fmt_val=fmt_val;
     prn_flg.ALPHA_BY_FULL_GROUP=ALPHA_BY_FULL_GROUP;
     prn_flg.ALPHA_BY_STUB_GROUP=ALPHA_BY_STUB_GROUP;
     prn_flg.FORTRAN_IDX_CNV=FORTRAN_IDX_CNV;
@@ -1283,9 +1300,16 @@ main(int argc,char **argv)
 	prn_flg.smr_fl_sz_sng=smr_fl_sz_sng=(char *)nco_malloc(300L*sizeof(char)); /* [sng] String describing estimated file size */
  	(void)nco_fl_sz_est(smr_fl_sz_sng,trv_tbl);
       } /* !dbg */
-      // if(!prn_flg.cdl && !prn_flg.xml && !prn_flg.srm) (void)fprintf(stdout,"%s\n\n",smr_sng);
     } /* endif summary */
 
+    if(fl_prn){
+      if((fp_prn=fopen(fl_prn,"w")) == NULL){
+	(void)fprintf(stderr,"%s: ERROR unable to open formatted output file %s\n",nco_prg_nm_get(),fl_prn);
+	nco_exit(EXIT_FAILURE);
+      } /* !fp_prn */
+      prn_flg.fp_out=fp_prn;
+    } /* !fl_prn */
+
     if(!prn_flg.new_fmt){
       /* Traditional printing order/format always used prior to 201307 */
       if(PRN_GLB_METADATA){
@@ -1298,7 +1322,7 @@ main(int argc,char **argv)
           long rec_dmn_sz;
           for(int rec_idx=0;rec_idx<nbr_rec_lcl;rec_idx++){
             (void)nco_inq_dim(in_id,dmn_ids_rec[rec_idx],dmn_nm,&rec_dmn_sz);
-            (void)fprintf(stdout,"Root record dimension %d: name = %s, size = %li\n",rec_idx,dmn_nm,rec_dmn_sz);
+            (void)fprintf(prn_flg.fp_out,"Root record dimension %d: name = %s, size = %li\n",rec_idx,dmn_nm,rec_dmn_sz);
           } /* end loop over rec_idx */
           (void)fprintf(stdout,"\n");
         } /* NCO_REC_DMN_UNDEFINED */
@@ -1319,12 +1343,10 @@ main(int argc,char **argv)
       } /* !PRN_SRM */
 
       if(ALPHA_BY_FULL_GROUP || ALPHA_BY_STUB_GROUP){
-	/* Ineptly named nco_grp_prn() emits full CDL and XML formats, and partial JSN 
-	   rcd+=nco_grp_prn(in_id,trv_pth,&prn_flg,trv_tbl); */
+	/* Print CDL, JSN, TRD, and XML formats */
         if(prn_flg.jsn) rcd+=nco_prn_jsn(in_id,trv_pth,&prn_flg,trv_tbl);
         else if(prn_flg.xml) rcd+=nco_prn_xml(in_id,trv_pth,&prn_flg,trv_tbl);
         else if(prn_flg.cdl || prn_flg.trd) rcd+=nco_prn_cdl_trd(in_id,trv_pth,&prn_flg,trv_tbl); 
-        /* else rcd+=nco_grp_prn(in_id,trv_pth,&prn_flg,trv_tbl); */
       }else{
 	/* Place-holder for other options for organization/alphabetization */
 	if(PRN_VAR_METADATA) (void)nco_prn_xtr_mtd(in_id,&prn_flg,trv_tbl);
@@ -1332,7 +1354,15 @@ main(int argc,char **argv)
       } /* end if */
     } /* endif new format */
 
+    if(fl_prn){
+      rcd=fclose(fp_prn);
+      if(rcd != 0){
+	(void)fprintf(stderr,"%s: ERROR unable to close formatted output file %s\n",nco_prg_nm_get(),fl_prn);
+	nco_exit(EXIT_FAILURE);
+      } /* !fp_prn */
+    } /* !fl_prn */
     if(fl_in_dpl) fl_in_dpl=(char *)nco_free(fl_in_dpl);
+
   } /* !fl_out */
 
   /* goto close_and_free */
@@ -1348,6 +1378,7 @@ close_and_free:
   if(flg_mmr_cln){
     /* ncks-specific memory */
     if(fl_bnr) fl_bnr=(char *)nco_free(fl_bnr);
+    if(fl_prn) fl_prn=(char *)nco_free(fl_prn);
     if(rec_dmn_nm) rec_dmn_nm=(char *)nco_free(rec_dmn_nm); 
     /* NCO-generic clean-up */
     /* Free individual strings/arrays */
diff --git a/src/nco/nco.h b/src/nco/nco.h
index 9812282..eba9378 100644
--- a/src/nco/nco.h
+++ b/src/nco/nco.h
@@ -344,7 +344,7 @@ extern "C" {
 # define NCO_VERSION_MINOR 7
 #endif /* !NCO_VERSION_MINOR */
 #ifndef NCO_VERSION_PATCH
-# define NCO_VERSION_PATCH 2
+# define NCO_VERSION_PATCH 3
 #endif /* !NCO_VERSION_PATCH */
 #ifndef NCO_VERSION_NOTE
 # define NCO_VERSION_NOTE "" /* Blank for final versions, non-blank (e.g., "-beta37") for pre-release versions */
@@ -354,7 +354,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.7.2"
+# define NCO_VERSION "4.7.3"
 #endif /* !NCO_VERSION */
 
 /* Compatibility tokens new to netCDF4 netcdf.h: */
@@ -953,10 +953,12 @@ extern "C" {
     char *dlm_sng; /* [sng] User specified delimiter string for printed output */
     char *fl_in; /* [sng] Input filename */
     char *fl_stb; /* [sng] Input filename stub */
+    char *fmt_val; /* [sng] Format string for variable values */
     char *smr_sng; /* [sng] Summary string */
     char *smr_fl_sz_sng; /* [sng] String describing estimated file size */
     char *spr_chr; /* [sng] Separator string for character types */
     char *spr_nmr; /* [sng] Separator string for numeric types */
+    FILE *fp_out; /* [fl] Formatted text output file handle */
     gpe_sct *gpe; /* I [sng] GPE structure */
     md5_sct *md5; /* [flg] MD5 configuration */
     nco_bool cdl; /* [flg] Print CDL */
diff --git a/src/nco/nco_bnr.c b/src/nco/nco_bnr.c
index aba4e5d..3137e81 100644
--- a/src/nco/nco_bnr.c
+++ b/src/nco/nco_bnr.c
@@ -87,7 +87,7 @@ nco_bnr_rd /* [fnc] Read unformatted binary data */
     (void)fprintf(stderr,"%s: ERROR only succeeded in reading %ld of %ld elements into variable %s\n",nco_prg_nm_get(),rd_nbr,var_sz,var_nm);
     nco_exit(EXIT_FAILURE);
   } /* end if */
-  if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(stdout,"Binary read of %s (%s, %ld x %lu b)",var_nm,c_typ_nm(var_typ),var_sz,(unsigned long)nco_typ_lng(var_typ));
+  if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(stdout,"Binary read of %s (%s, %ld x %lu B)",var_nm,c_typ_nm(var_typ),var_sz,(unsigned long)nco_typ_lng(var_typ));
   if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fflush(stderr);
   return rd_nbr; /* O [nbr] Number of elements successfully written */
 } /* end nco_bnr_rd() */
diff --git a/src/nco/nco_ctl.c b/src/nco/nco_ctl.c
index 2f4db79..d9214bb 100644
--- a/src/nco/nco_ctl.c
+++ b/src/nco/nco_ctl.c
@@ -551,12 +551,15 @@ nco_exit_lbr_rcd(void) /* [fnc] Exit with netCDF library version as return code
   /* 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;}
-  /* NB: Same return values for 4.4.1 and 4.4.1.1, which simply fixes an ncgen bug in 4.4.1. */
+  /* NB: Same return values for 4.4.1 and 4.4.1.1, which simply fixes an ncgen bug in 4.4.1 */
   else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '4' && lbr_sng[3] == '.' && lbr_sng[4] == '1' ){rcd=441;}
   else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '5' && lbr_sng[3] == '.' && lbr_sng[4] == '0' ){rcd=450;}
+  /* NB: 4.5.1 was never released, though some development branches employed this version number */
   else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '5' && lbr_sng[3] == '.' && lbr_sng[4] == '1' ){rcd=451;}
-  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '5' && lbr_sng[3] == '.' && lbr_sng[4] == '2' ){rcd=452;}
-  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '5' && lbr_sng[3] == '.' && lbr_sng[4] == '3' ){rcd=453;}
+  /* NB: Same return values for 4.6.0 and 4.6.0.1, which appeared quickly after 4.6.0 */
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '6' && lbr_sng[3] == '.' && lbr_sng[4] == '0' ){rcd=460;}
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '6' && lbr_sng[3] == '.' && lbr_sng[4] == '1' ){rcd=461;}
+  else if(lbr_sng[0] == '4' && lbr_sng[1] == '.' && lbr_sng[2] == '6' && lbr_sng[3] == '.' && lbr_sng[4] == '2' ){rcd=462;}
 #endif /* HAVE_NETCDF4_H */
   /* exit() with custom rcd for use by Perl regression tester nco_bm.pl/NCO_rgr.pm */
   rcd-=300;
@@ -742,7 +745,7 @@ nco_cnf_prn(void) /* [fnc] Print NCO configuration and help text */
 #define TKN2YESNO(x) ((x+0) ? ("No"):("Yes"))
   /* NB: Keep configuration option tokens consistent among configure.ac, bld/Makefile, and nco_ctl.c
      Alphabetize list by first word in English text description of token */
-  (void)fprintf(stdout,"Configuration Option:\tActive?\tMeaning or Reference:\nCheck _FillValue\t%s\thttp://nco.sf.net/nco.html#mss_val\nDAP support\t\t%s\thttp://nco.sf.net/nco.html#dap\nDebugging: Custom\t%s\tPedantic, bounds checking (slowest execution)\nDebugging: Symbols\t%s\tProduce symbols for debuggers (e.g., dbx, gdb)\nGNU Scientific Library\t%s\thttp://nco.sf.net/nco.html#gsl\nHDF4 support\t\t%s\thttp://nco.sf.net/nco.html#hdf4\nInternationalization\t%s\thttp://nco.sf.net/nco.h [...]
+  (void)fprintf(stdout,"Configuration Option:\tActive?\tMeaning or Reference:\nCheck _FillValue\t%s\thttp://nco.sf.net/nco.html#mss_val\nDAP support\t\t%s\thttp://nco.sf.net/nco.html#dap\nDebugging: Custom\t%s\tPedantic, bounds checking (slowest execution)\nDebugging: Symbols\t%s\tProduce symbols for debuggers (e.g., dbx, gdb)\nGNU Scientific Library\t%s\thttp://nco.sf.net/nco.html#gsl\nHDF4 support\t\t%s\thttp://nco.sf.net/nco.html#hdf4\nInternationalization\t%s\thttp://nco.sf.net/nco.h [...]
 		(!strcmp("_FillValue",nco_mss_val_sng_get())) ? "Yes" : "No",
 #if defined(ENABLE_DAP) && (ENABLE_DAP)
 		"Yes",
@@ -779,11 +782,11 @@ nco_cnf_prn(void) /* [fnc] Print NCO configuration and help text */
 #else /* !I18N */
 		"No",
 #endif /* !I18N */
-#if defined(ENABLE_MPI) && (ENABLE_MPI)
+#if defined(ENABLE_LOGGING) && (ENABLE_LOGGING)
 		"Yes",
-#else /* !ENABLE_MPI */
+#else /* !ENABLE_LOGGING */
 		"No",
-#endif /* !ENABLE_MPI */
+#endif /* !ENABLE_LOGGING */
 #if defined(NC_64BIT_OFFSET) && (NC_64BIT_OFFSET)
 		"Yes",
 #else /* !NC_64BIT_OFFSET */
@@ -808,31 +811,11 @@ nco_cnf_prn(void) /* [fnc] Print NCO configuration and help text */
 #else /* !_OPENMP */
 		"No",
 #endif /* !_OPENMP */
-#if defined(ENABLE_OPTIMIZE_CUSTOM) && (ENABLE_OPTIMIZE_CUSTOM)
-		"Yes",
-#else /* !ENABLE_OPTIMIZE_CUSTOM */
-		"No",
-#endif /* !ENABLE_OPTIMIZE_CUSTOM */
-#if defined(ENABLE_PNETCDF) && (ENABLE_PNETCDF)
-		"Yes",
-#else /* !ENABLE_PNETCDF */
-		"No",
-#endif /* !ENABLE_PNETCDF */
 #if defined(NCO_HAVE_REGEX_FUNCTIONALITY) && (NCO_HAVE_REGEX_FUNCTIONALITY)
 		"Yes",
 #else /* !NCO_HAVE_REGEX_FUNCTIONALITY */
 		"No",
 #endif /* !NCO_HAVE_REGEX_FUNCTIONALITY */
-#if defined(ENABLE_SHARED) && (ENABLE_SHARED)
-		"Yes",
-#else /* !ENABLE_SHARED */
-		"No",
-#endif /* !ENABLE_SHARED */
-#if defined(ENABLE_STATIC) && (ENABLE_STATIC)
-		"Yes",
-#else /* !ENABLE_STATIC */
-		"No",
-#endif /* !ENABLE_STATIC */
 #if defined(ENABLE_UDUNITS) && (ENABLE_UDUNITS)
 # if defined(HAVE_UDUNITS2_H) && (HAVE_UDUNITS2_H)
 		"Yes",
@@ -850,7 +833,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 "Mnemonic: Sapiens\n";
+  return "Mnemonic: Avid Poi\n";
 } /* end nco_nmn_get() */
 
 char * /* O [sng] nm_in stripped of any path (i.e., program name stub) */ 
@@ -973,7 +956,7 @@ nco_usg_prn(void)
     opt_sng=(char *)strdup("[-3] [-4] [-5] [-6] [-7] [-A] [--bfr byt] [-C] [-c] [--cnk_byt byt] [--cnk_csh byt] [--cnk_dmn nm,lmn] [--cnk_map map] [--cnk_min byt] [--cnk_plc plc] [--cnk_scl sz] [-D nco_dbg_lvl] [-d ...] [-F] [--fix_rec_crd] [--fl_fmt fmt] [--glb ...] [-h] [--hdf] [--hdr_pad nbr] [-i var,val] [-L lvl] [-l path] [--msa] [--no_cll_msr] [--no_frm_trm] [--no_tmp_fl] [-O] [-o out.nc] [-p path] [--ppc ...] [-R] [-r] [--ram_all] [-t thr_nbr] [-v ...] [-X box] [-x] [-w wgt_1[,wgt [...]
     break;
   case ncks:
-    opt_sng=(char *)strdup("[-3] [-4] [-5] [-6] [-7] [-A] [-a] [-b fl_bnr] [--bfr byt] [-C] [-c] [--cal] [--cdl] [--cnk_byt byt] [--cnk_csh byt] [--cnk_dmn nm,lmn] [--cnk_map map] [--cnk_min byt] [--cnk_plc plc] [--cnk_scl sz] [-D nco_dbg_lvl] [-d ...] [--dt_fmt fmt] [-F] [--fix_rec_dmn dim] [--fl_fmt fmt] [-G grp:lvl] [-g ...] [--glb ...] [--grp_xtr_var_xcl] [-H] [-h] [--hdn] [--hdr_pad nbr] [--jsn] [--jsn_fmt lvl] [-L lvl] [-l path] [-M] [-m] [--map map.nc] [--md5_dgs] [--md5_wrt] [--m [...]
+    opt_sng=(char *)strdup("[-3] [-4] [-5] [-6] [-7] [-A] [-a] [-b fl_bnr] [--bfr byt] [-C] [-c] [--cal] [--cdl] [--cnk_byt byt] [--cnk_csh byt] [--cnk_dmn nm,lmn] [--cnk_map map] [--cnk_min byt] [--cnk_plc plc] [--cnk_scl sz] [-D nco_dbg_lvl] [-d ...] [--dt_fmt fmt] [-F] [--fix_rec_dmn dim] [--fl_fmt fmt] [--fmt_val fmt] [-G grp:lvl] [-g ...] [--glb ...] [--grp_xtr_var_xcl] [-H] [-h] [--hdn] [--hdr_pad nbr] [--jsn] [--jsn_fmt lvl] [-L lvl] [-l path] [-M] [-m] [--map map.nc] [--md5_dgs]  [...]
     break;
   case ncpdq:
     opt_sng=(char *)strdup("[-3] [-4] [-5] [-6] [-7] [-A] [-a ...] [--bfr byt] [-C] [-c] [--cnk_byt byt] [--cnk_csh byt] [--cnk_dmn nm,lmn] [--cnk_map map] [--cnk_min byt] [--cnk_plc plc] [--cnk_scl sz] [-D nco_dbg_lvl] [-d ...] [-F] [--fl_fmt fmt] [-G grp:lvl] [-g ...] [--glb ...] [-h] [--hdf] [--hdr_pad nbr] [-L lvl] [-l path] [-M pck_map] [--mrd] [--msa] [--no_cll_msr] [--no_frm_trm] [--no_tmp_fl] [-O] [-o out.nc] [-P pck_plc] [-p path] [--ppc ...] [-R] [-r] [--ram_all] [-t thr_nbr] [ [...]
diff --git a/src/nco/nco_fl_utl.c b/src/nco/nco_fl_utl.c
index 5aa9f3f..62cca54 100644
--- a/src/nco/nco_fl_utl.c
+++ b/src/nco/nco_fl_utl.c
@@ -99,7 +99,7 @@ nco_fl_sz_est /* [fnc] Estimate RAM size == uncompressed file size */
  const trv_tbl_sct * const trv_tbl) /* I [sct] Traversal table */
 {
   /* Purpose: Estimate RAM size == uncompressed file size */
-  const char fnc_nm[]="nco_fl_sz_est()"; /* [sng] Function name  */
+  const char fnc_nm[]="nco_fl_sz_est()"; /* [sng] Function name */
 
   size_t ram_sz_crr;
   size_t ram_sz_ttl=0L;
@@ -263,7 +263,7 @@ nco_fl_cp /* [fnc] Copy first file to second */
 #ifdef _MSC_VER
   const char cmd_cp_fmt[]="copy %s %s";
 #else /* !_MSC_VER */
-  const char cmd_cp_fmt[]="cp %s %s";
+  const char cmd_cp_fmt[]="/bin/cp %s %s";
 #endif /* !_MSC_VER */
 
   int rcd;
@@ -357,6 +357,8 @@ nco_fl_lst_mk /* [fnc] Create file list from command line positional arguments *
      Multi-file operators take input filenames from positional arguments, if any
      Otherwise, multi-file operators try to get input filenames from stdin */
 
+  const char fnc_nm[]="nco_fl_lst_mk()"; /* [sng] Function name */
+
   nco_bool FL_OUT_FROM_PSN_ARG=True; /* [flg] fl_out comes from positional argument */
 
   char **fl_lst_in=NULL_CEWI; /* [sng] List of user-specified filenames */
@@ -403,8 +405,15 @@ nco_fl_lst_mk /* [fnc] Create file list from command line positional arguments *
     } /* end if */
     fl_lst_in=(char **)nco_malloc(sizeof(char *)); /* fxm: free() this memory sometime */
     fl_lst_in[(*fl_nbr)++]=(char *)strdup(argv[arg_crr++]);
+
+    /* Sanitize input list from stdin and from positional arguments */
+    for(int fl_idx=0;fl_idx<*fl_nbr;fl_idx++) (void)nco_sng_sntz(fl_lst_in[fl_idx]);
+
     /* Output file is optional for these operators */
-    if(arg_crr == argc-1) *fl_out=(char *)strdup(argv[arg_crr]);
+    if(arg_crr == argc-1){
+      *fl_out=(char *)strdup(argv[arg_crr]);
+      *fl_out=nco_sng_sntz(*fl_out);
+    } /* !arg_crr */
     return fl_lst_in;
     /* break; *//* NB: break after return in case statement causes SGI cc warning */
   case ncbo:
@@ -536,9 +545,15 @@ nco_fl_lst_mk /* [fnc] Create file list from command line positional arguments *
     nco_exit(EXIT_FAILURE);
   } /* end if */
 
-  /* Assign output file from positional argument */
-  if(FL_OUT_FROM_PSN_ARG) *fl_out=(char *)strdup(argv[argc-1]);
+  /* Sanitize input list from stdin and from positional arguments */
+  for(int fl_idx=0;fl_idx<*fl_nbr;fl_idx++) (void)nco_sng_sntz(fl_lst_in[fl_idx]);
 
+  /* Assign output file from positional argument */
+  if(FL_OUT_FROM_PSN_ARG){
+    *fl_out=(char *)strdup(argv[argc-1]);
+    *fl_out=nco_sng_sntz(*fl_out);
+  } /* !FL_OUT_FROM_PSN_ARG */
+ 
   return fl_lst_in;
 
 } /* end nco_fl_lst_mk() */
@@ -550,8 +565,8 @@ nco_fl_mk_lcl /* [fnc] Retrieve input file and return local filename */
  nco_bool * const FL_RTR_RMT_LCN) /* O [flg] File was retrieved from remote location */
 {
   /* Purpose: Locate input file, retrieve it from remote storage system if necessary,
-  create local storage directory if neccessary, check file for read-access,
-  return name of file on local system */
+     create local storage directory if neccessary, check file for read-access,
+     return name of file on local system */
 
 #ifdef _MSC_VER
   /* TODO nco1068 The stat function retuns -1 for large files; assume success */
@@ -585,7 +600,6 @@ nco_fl_mk_lcl /* [fnc] Retrieve input file and return local filename */
 #endif /* !ENABLE_DAP */
   int rcd_stt=0; /* [rcd] Return code from stat() */
   int rcd_sys; /* [rcd] Return code from system() */
-  int rcd_frd; /* [rcd] Return code from fread() and fclose() */
 
   size_t url_sng_lng=0L; /* CEWI */
 
@@ -827,7 +841,7 @@ nco_fl_mk_lcl /* [fnc] Retrieve input file and return local filename */
             /* fxm: use autoconf HAVE_XXX rather than WIN32 token TODO nco292 */
 #ifdef WIN32
             /* #ifndef HAVE_NETWORK fxm */
-            /* I have no idea how networking calls work in MS Windows, so just exit */
+            /* I have no idea how FTP networking calls work in MS Windows, so just exit */
             (void)fprintf(stdout,"%s: ERROR Networking required to obtain %s is not supported by this operating system\n",nco_prg_nm_get(),fl_nm_rmt);
             nco_exit(EXIT_FAILURE);
 #else /* !WIN32 */
@@ -878,6 +892,7 @@ nco_fl_mk_lcl /* [fnc] Retrieve input file and return local filename */
               char *host_nm_rmt_psn;
               char *fl_netrc_bfr;
               FILE *fp_netrc; /* [fl] .netrc inpu file handle */
+	      int rcd_frd; /* [rcd] Return code from fread() and fclose() */
               if((fp_netrc=fopen(fl_nm_netrc,"r")) == NULL){
                 (void)fprintf(stderr,"%s: ERROR unable to open user's .netrc file %s\n",nco_prg_nm_get(),fl_nm_netrc);
                 /* Why did fopen() command fail? */
@@ -1209,7 +1224,7 @@ nco_fl_mv /* [fnc] Move first file to second */
 #ifdef _MSC_VER
   const char cmd_mv_fmt[]="move %s %s";
 #else /* !_MSC_VER */
-  const char cmd_mv_fmt[]="mv -f %s %s";
+  const char cmd_mv_fmt[]="/bin/mv -f %s %s";
 #endif /* !_MSC_VER */
 
   int rcd_sys; /* [rcd] Return code from system() */
diff --git a/src/nco/nco_grp_utl.c b/src/nco/nco_grp_utl.c
index 2cd9fff..243a0f8 100644
--- a/src/nco/nco_grp_utl.c
+++ b/src/nco/nco_grp_utl.c
@@ -1224,7 +1224,7 @@ nco_xtr_cf_var_add /* [fnc] Add variables associated (via CF) with specified var
       /* Yes, get list of specified attributes */
       (void)nco_inq_att(grp_id,var_id,att_nm,&att_typ,&att_sz);
       if(att_typ != NC_CHAR){
-        (void)fprintf(stderr,"%s: WARNING \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute. If you want CF to support NC_STRING attributes, please tell them and CC: NCO.\n",nco_prg_nm_get(),att_nm,var_trv->nm_fll,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+        (void)fprintf(stderr,"%s: WARNING \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute. If you want CF to support NC_STRING attributes, please tell CF and CC: NCO.\n",nco_prg_nm_get(),att_nm,var_trv->nm_fll,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
         return;
       } /* end if */
       att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
@@ -2099,12 +2099,12 @@ nco_prn_dmn_grp /* [fnc] Print dimensions for a group  */
     for(int dnm_ult_idx=0;dnm_ult_idx<nbr_dmn_ult;dnm_ult_idx++){ 
       if(dmn_ids[dnm_idx] == dmn_ids_ult[dnm_ult_idx]){ 
         is_rec_dim=True;
-        (void)fprintf(stdout," #%d record dimension: '%s'(%li)\n",dmn_ids[dnm_idx],dmn_nm,dmn_sz);
+        (void)fprintf(stdout,"Record dimension name, size, ID = %s, %li, %d\n",dmn_nm,dmn_sz,dmn_ids[dnm_idx]);
       } /* end if */
     } /* end dnm_ult_idx dimensions */
 
     /* An unlimited ID was not matched, so dimension is a plain vanilla dimension */
-    if(!is_rec_dim) (void)fprintf(stdout," #%d dimension: '%s'(%li)\n",dmn_ids[dnm_idx],dmn_nm,dmn_sz);
+    if(!is_rec_dim) (void)fprintf(stdout,"Fixed dimension name, size, ID = %s, %li, %d\n",dmn_nm,dmn_sz,dmn_ids[dnm_idx]);
 
   } /* end dnm_idx dimensions */
 
@@ -2191,7 +2191,7 @@ nco_bld_dmn_ids_trv                   /* [fnc] Build dimension info for all vari
 	  */
 	  
           (void)fprintf(stdout,"%s: INFO %s reports variable <%s> with duplicate dimensions\n",nco_prg_nm_get(),fnc_nm,var_trv.nm_fll);
-          (void)fprintf(stdout,"%s: ERROR netCDF file with duplicate dimension IDs detected. Please use netCDF version at least 4.3.0. NB: Simultaneously renaming multiple dimensions with ncrename can trigger this bug with netCDF versions up to 4.5.1 (current as of 20180119).\n",nco_prg_nm_get());
+          (void)fprintf(stdout,"%s: ERROR netCDF file with duplicate dimension IDs detected. Please use netCDF version at least 4.3.0. NB: Simultaneously renaming multiple dimensions with ncrename can trigger this bug with netCDF versions up to 4.6.0.1 (current as of 20180201).\n",nco_prg_nm_get());
           (void)nco_prn_trv_tbl(nc_id,trv_tbl);
           nco_exit(EXIT_FAILURE);
         }
@@ -7663,7 +7663,7 @@ nco_var_has_cf /* [fnc] Variable has CF-compliant attributes ("ancillary_variabl
       /* Yes, get list of specified attributes */
       (void)nco_inq_att(grp_id,var_id,att_nm,&att_typ,&att_sz);
       if(att_typ != NC_CHAR){
-        (void)fprintf(stderr,"%s: WARNING \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_trv->nm_fll,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+        (void)fprintf(stderr,"%s: WARNING \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_trv->nm_fll,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
         return NULL;
       } /* end if */
       att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
diff --git a/src/nco/nco_lmt.c b/src/nco/nco_lmt.c
index bbb4a88..8b2d2f4 100644
--- a/src/nco/nco_lmt.c
+++ b/src/nco/nco_lmt.c
@@ -311,7 +311,7 @@ nco_lmt_sct_mk /* [fnc] Create stand-alone limit structure for given dimension *
        dimension.
        Then, when nco_lmt_sct_mk() creates the record dimension structure, it must
        be created consistently with the FORTRAN_IDX_CNV flag for the other dimensions.
-       In order to do that, fill in max_sng, min_sng, and srd_sng
+       In order to do that, fill-in max_sng, min_sng, and srd_sng
        arguments with strings as if they had been read from keyboard.
        An alternate solution is to add flag to lmt_sct indicating whether this
        limit struct had been automatically generated and then act accordingly. */
diff --git a/src/nco/nco_map.c b/src/nco/nco_map.c
index 537966d..2cf2e4e 100644
--- a/src/nco/nco_map.c
+++ b/src/nco/nco_map.c
@@ -217,9 +217,9 @@ nco_map_mk /* [fnc] Create ESMF-format map file */
     /* Sanity-check */
     assert(col_nbr_out == (long)grd_sz_out);
   }else if(flg_grd_out_2D){
-    col_nbr_out=lat_nbr_out*lon_nbr_out;
     lat_nbr_out=dmn_sz_out_int[lat_psn];
     lon_nbr_out=dmn_sz_out_int[lon_psn];
+    col_nbr_out=lat_nbr_out*lon_nbr_out;
     /* Sanity-check */
     assert(lat_nbr_out*lon_nbr_out == (long)grd_sz_out);
   } /* !dst_grid_rank */
@@ -421,7 +421,7 @@ nco_map_mk /* [fnc] Create ESMF-format map file */
 
   size_t wgt_nbr=1L; /* [nbr] Number of weights */
   size_t lnk_nbr; /* [nbr] Number of links */
-  size_t lnk_idx; /* [idx] Link index */
+  //size_t lnk_idx; /* [idx] Link index */
 
   deflate=(int)True;
   shuffle=NC_SHUFFLE;
@@ -555,16 +555,16 @@ nco_map_mk /* [fnc] Create ESMF-format map file */
   aed_mtd.val.cp=att_val;
   aed_mtd.mode=aed_create;
 
-  aed_mtd.var_nm="yc_a";
+  strcpy(aed_mtd.var_nm,"yc_a");
   aed_mtd.id=src_grd_ctr_lat_id;
   (void)nco_aed_prc(out_id,src_grd_ctr_lat_id,aed_mtd);
-  aed_mtd.var_nm="yv_a";
+  strcpy(aed_mtd.var_nm,"yv_a");
   aed_mtd.id=src_grd_crn_lat_id;
   (void)nco_aed_prc(out_id,src_grd_crn_lat_id,aed_mtd);
-  aed_mtd.var_nm="yc_b";
+  strcpy(aed_mtd.var_nm,"yc_b");
   aed_mtd.id=dst_grd_ctr_lat_id;
   (void)nco_aed_prc(out_id,dst_grd_ctr_lat_id,aed_mtd);
-  aed_mtd.var_nm="yv_b";
+  strcpy(aed_mtd.var_nm,"yv_b");
   aed_mtd.id=dst_grd_crn_lat_id;
   (void)nco_aed_prc(out_id,dst_grd_crn_lat_id,aed_mtd);
 
@@ -580,16 +580,16 @@ nco_map_mk /* [fnc] Create ESMF-format map file */
   aed_mtd.val.cp=att_val;
   aed_mtd.mode=aed_create;
 
-  aed_mtd.var_nm="xc_a";
+  strcpy(aed_mtd.var_nm,"xc_a");
   aed_mtd.id=src_grd_ctr_lon_id;
   (void)nco_aed_prc(out_id,src_grd_ctr_lon_id,aed_mtd);
-  aed_mtd.var_nm="xv_a";
+  strcpy(aed_mtd.var_nm,"xv_a");
   aed_mtd.id=src_grd_crn_lon_id;
   (void)nco_aed_prc(out_id,src_grd_crn_lon_id,aed_mtd);
-  aed_mtd.var_nm="xc_b";
+  strcpy(aed_mtd.var_nm,"xc_b");
   aed_mtd.id=dst_grd_ctr_lon_id;
   (void)nco_aed_prc(out_id,dst_grd_ctr_lon_id,aed_mtd);
-  aed_mtd.var_nm="xv_b";
+  strcpy(aed_mtd.var_nm,"xv_b");
   aed_mtd.id=dst_grd_crn_lon_id;
   (void)nco_aed_prc(out_id,dst_grd_crn_lon_id,aed_mtd);
 
@@ -605,16 +605,16 @@ nco_map_mk /* [fnc] Create ESMF-format map file */
   aed_mtd.val.cp=att_val;
   aed_mtd.mode=aed_create;
 
-  aed_mtd.var_nm="frac_a";
+  strcpy(aed_mtd.var_nm,"frac_a");
   aed_mtd.id=frc_in_id;
   (void)nco_aed_prc(out_id,frc_in_id,aed_mtd);
-  aed_mtd.var_nm="mask_a";
+  strcpy(aed_mtd.var_nm,"mask_a");
   aed_mtd.id=msk_in_id;
   (void)nco_aed_prc(out_id,msk_in_id,aed_mtd);
-  aed_mtd.var_nm="frac_b";
+  strcpy(aed_mtd.var_nm,"frac_b");
   aed_mtd.id=frc_out_id;
   (void)nco_aed_prc(out_id,frc_out_id,aed_mtd);
-  aed_mtd.var_nm="mask_b";
+  strcpy(aed_mtd.var_nm,"mask_b");
   aed_mtd.id=msk_out_id;
   (void)nco_aed_prc(out_id,msk_out_id,aed_mtd);
 
@@ -624,7 +624,7 @@ nco_map_mk /* [fnc] Create ESMF-format map file */
   att_nm=strdup("units");
   att_val=strdup("steradian");
   aed_mtd.att_nm=att_nm;
-  aed_mtd.var_nm="area_a";
+  strcpy(aed_mtd.var_nm,"area_a");
   aed_mtd.id=area_in_id;
   aed_mtd.sz=strlen(att_val);
   aed_mtd.type=NC_CHAR;
@@ -637,7 +637,7 @@ nco_map_mk /* [fnc] Create ESMF-format map file */
   att_nm=strdup("units");
   att_val=strdup("steradian");
   aed_mtd.att_nm=att_nm;
-  aed_mtd.var_nm="area_b";
+  strcpy(aed_mtd.var_nm,"area_b");
   aed_mtd.id=area_out_id;
   aed_mtd.sz=strlen(att_val);
   aed_mtd.type=NC_CHAR;
@@ -779,7 +779,7 @@ nco_msh_mk /* [fnc] Compute overlap mesh and weights */
   long grd_crn_nbr_vrl; /* [nbr] Maximum number of corners in overlap polygon */
 
   size_t lnk_nbr; /* [nbr] Number of links */
-  size_t lnk_idx; /* [idx] Link index */
+  //size_t lnk_idx; /* [idx] Link index */
 
   /* Construct overlap mesh here
      NB: Parallelize loop with OpenMP and/or MPI
diff --git a/src/nco/nco_mmr.c b/src/nco/nco_mmr.c
index a8d888c..30d23d7 100644
--- a/src/nco/nco_mmr.c
+++ b/src/nco/nco_mmr.c
@@ -100,13 +100,14 @@ nco_malloc /* [fnc] Wrapper for malloc() */
     if((nvr_NCO_MMR_DBG=getenv("NCO_MMR_DBG"))) ntg_NCO_MMR_DBG=(int)strtol(nvr_NCO_MMR_DBG,&sng_cnv_rcd,NCO_SNG_CNV_BASE10); /* [sng] Environment variable NCO_MMR_DBG */
   } /* endif dbg */
 
-  if(ntg_NCO_MMR_DBG && sz > sz_thr) (void)fprintf(stdout,"%s: INFO %s received request to allocate %lu B = %lu kB = %lu MB = %lu GB\n",nco_prg_nm_get(),fnc_nm,sz,sz/NCO_BYT_PER_KB,sz/NCO_BYT_PER_MB,sz/NCO_BYT_PER_GB);
+  /* Casting from "size_t" to "unsigned long" necessary since %zu format only available in C99 */
+  if(ntg_NCO_MMR_DBG && sz > sz_thr) (void)fprintf(stdout,"%s: INFO %s received request to allocate %lu B = %lu kB = %lu MB = %lu GB\n",nco_prg_nm_get(),fnc_nm,(unsigned long)sz,(unsigned long)sz/NCO_BYT_PER_KB,(unsigned long)sz/NCO_BYT_PER_MB,(unsigned long)sz/NCO_BYT_PER_GB);
 
-  if(sz > sz_max) (void)fprintf(stdout,"%s: WARNING %s received request to allocate %lu B = %lu kB = %lu MB = %lu GB = %lu TB\n",nco_prg_nm_get(),fnc_nm,sz,sz/NCO_BYT_PER_KB,sz/NCO_BYT_PER_MB,sz/NCO_BYT_PER_GB,sz/NCO_BYT_PER_TB);
+  if(sz > sz_max) (void)fprintf(stdout,"%s: WARNING %s received request to allocate %lu B = %lu kB = %lu MB = %lu GB = %lu TB\n",nco_prg_nm_get(),fnc_nm,(unsigned long)sz,(unsigned long)sz/NCO_BYT_PER_KB,(unsigned long)sz/NCO_BYT_PER_MB,(unsigned long)sz/NCO_BYT_PER_GB,(unsigned long)sz/NCO_BYT_PER_TB);
 
   ptr=malloc(sz); /* [ptr] Pointer to new buffer */
   if(ptr == NULL){
-    (void)fprintf(stdout,"%s: ERROR %s unable to allocate %lu B = %lu kB = %lu MB = %lu GB\n",nco_prg_nm_get(),fnc_nm,sz,sz/NCO_BYT_PER_KB,sz/NCO_BYT_PER_MB,sz/NCO_BYT_PER_GB);
+    (void)fprintf(stdout,"%s: ERROR %s unable to allocate %lu B = %lu kB = %lu MB = %lu GB\n",nco_prg_nm_get(),fnc_nm,(unsigned long)sz,(unsigned long)sz/NCO_BYT_PER_KB,(unsigned long)sz/NCO_BYT_PER_MB,(unsigned long)sz/NCO_BYT_PER_GB);
     (void)nco_malloc_err_hnt_prn();
     /* fxm: Should be exit(8) on ENOMEM errors? */
     nco_exit(EXIT_FAILURE);
@@ -503,7 +504,6 @@ nco_mmr_usg_prn /* [fnc] Print rusage memory usage statistics */
 
   int rcd_stm; /* [enm] Return code for /proc/PID/statm call */
   int rcd_stt; /* [enm] Return code for /proc/PID/stat call */
-  int rcd_sys; /* [enm] Return code for system call */
 
 #ifndef __GNUG__
   extern int errno; /* [enm] Error code in errno.h */
@@ -585,10 +585,10 @@ nco_mmr_usg_prn /* [fnc] Print rusage memory usage statistics */
   (void)fprintf(stdout,"%s: INFO %s reports system type is SUNMP so getrusage() uses pages [pg] for size and ticks [tck] for time. Page size is %d B.\n",nco_prg_nm_get(),fnc_nm,sz_pg);
 #endif /* !SUNMP */
 
-  /* fxm: CEWI, not necessary */
-  rcd_sys=rusage_who;
   /* fxm: use input argument rusage_who instead of RUSAGE_SELF */
-  rcd_sys=0*rcd_sys+getrusage(RUSAGE_SELF,&usg);
+  int rcd_sys; /* [enm] Return code for system call */
+  rcd_sys=getrusage(RUSAGE_SELF,&usg);
+  if(rcd_sys) rcd_sys+=0; /* CEWI */
   /* MACOSX rusage structure elements ru_utime and ru_stime are of type 'int' not 'long int' */
   if(nco_dbg_lvl_get() > nco_dbg_io) (void)fprintf(stdout,"%s: INFO %s reports: rusage.ru_utime.tv_sec = user time used = %li s, rusage.ru_utime.tv_usec = user time used = %li us, rusage.ru_stime.tv_sec = system time used = %li s, rusage.ru_stime.tv_usec = system time used = %li us, rusage.ru_maxrss = maximum resident set size = %li [sz], rusage.ru_ixrss = integral shared memory size =  %li [sz tm], rusage.ru_idrss = integral unshared data size = %li [sz], rusage.ru_isrss = integral unsh [...]
 
diff --git a/src/nco/nco_mss_val.c b/src/nco/nco_mss_val.c
index 71dee77..989443f 100644
--- a/src/nco/nco_mss_val.c
+++ b/src/nco/nco_mss_val.c
@@ -236,7 +236,7 @@ nco_mss_val_cnf /* [fnc] Change missing_value of var2 to missing_value of var1 *
 void
 nco_mss_val_cp /* [fnc] Copy missing value from var1 to var2 */
 (const var_sct * const var1, /* I [sct] Variable with template missing value to copy */
- var_sct * const var2) /* I/O [sct] Variable with missing value to fill in/overwrite */
+ var_sct * const var2) /* I/O [sct] Variable with missing value to fill-in/overwrite */
 {
   /* Threads: Routine is thread safe and calls no unsafe routines */
   /* Purpose: Copy missing value from var1 to var2
diff --git a/src/nco/nco_mss_val.h b/src/nco/nco_mss_val.h
index d11dbb1..61cb337 100644
--- a/src/nco/nco_mss_val.h
+++ b/src/nco/nco_mss_val.h
@@ -33,9 +33,9 @@
 #include "nco_cnf_typ.h" /* Conform variable types */
 #include "nco_mmr.h" /* Memory management */
 #include "nco_prn.h" /* Print variables, attributes, metadata */
-#if (defined NEED_STRCASECMP) || (defined NEED_STRDUP)
+#if (defined NEED_STRCASECMP) || (defined NEED_STRNCASECMP) || (defined NEED_STRDUP)
 # include "nco_sng_utl.h" /* String utilities */
-#endif /* NEED_STRCASECMP || NEED_STRDUP */
+#endif /* NEED_STRCASECMP || NEED_STRNCASECMP || NEED_STRDUP */
 
 #ifdef __cplusplus
 extern "C" {
@@ -48,12 +48,12 @@ nco_mss_val_mk /* [fnc] Return default missing value for type type */
 nco_bool /* O [flg] One or both operands have missing value */
 nco_mss_val_cnf /* [fnc] Change missing_value of var2 to missing_value of var1 */
 (var_sct * const var1, /* I [sct] Variable with template missing value to copy */
- var_sct * const var2); /* I/O [sct] Variable with missing value to fill in/overwrite */
+ var_sct * const var2); /* I/O [sct] Variable with missing value to fill-in/overwrite */
 
 void
 nco_mss_val_cp /* [fnc] Copy missing value from var1 to var2 */
 (const var_sct * const var1, /* I [sct] Variable with template missing value to copy */
- var_sct * const var2); /* I/O [sct] Variable with missing value to fill in/overwrite */
+ var_sct * const var2); /* I/O [sct] Variable with missing value to fill-in/overwrite */
 
 int /* O [flg] Variable has missing value on output */
 nco_mss_val_get /* [fnc] Update number of attributes, missing value of variable */
diff --git a/src/nco/nco_netcdf.c b/src/nco/nco_netcdf.c
index 4b98f19..4ba4409 100644
--- a/src/nco/nco_netcdf.c
+++ b/src/nco/nco_netcdf.c
@@ -84,7 +84,7 @@ nco_err_exit /* [fnc] Print netCDF error message, routine name, then exit */
   case NC_EIO: /* netcdf.h added NC_EIO in ~2012 */
     (void)fprintf(stdout,"ERROR NC_EIO Generic IO error\nHINT: NC_EIO errors can occur when NCO tries to read a file through a non-existant DAP location. Then NCO automatically tries to retrieve the file through another method, e.g., searching for a file of the same name in the current directory. This can trigger a subsequent error. When debugging the problem, first address the originating error (from NC_EIO).\n"); break;
   case NC_ELATEFILL: /* netcdf.h replaced NC_EFILLVALUE by NC_ELATEFILL after about netCDF ~4.2.1 */ 
-     (void)fprintf(stdout,"ERROR NC_ELATEFILL (formerly NC_EFILLVALUE) Attempt to define fill value when data already exists\nHINT: NC_ELATEFILL errors can occur when NCO attempts to create, modify, or overwrite a _FillValue attribute for an existing variable in a netCDF4 file. The netCDF4 format (unlike netCDF3) does not permit this. Does your output file need to be netCDF4 or netCDF4_classic format? One workaround is to change the output format to netCDF3 (e.g., ncks -3 in.nc out.nc),  [...]
+     (void)fprintf(stdout,"ERROR NC_ELATEFILL (formerly NC_EFILLVALUE) Attempt to define fill value when data already exists\nHINT: NC_ELATEFILL errors can occur when NCO attempts to create, modify, or overwrite a _FillValue attribute for an existing variable in a netCDF4 file. The netCDF4 format (unlike netCDF3) does not permit this. Does your output file need to be netCDF4 or netCDF4_classic format? One workaround is to change the output format to netCDF3 (e.g., ncks -3 in.nc out.nc),  [...]
 #ifdef ENABLE_NETCDF4 
   case NC_ENOTBUILT: (void)fprintf(stdout,"ERROR NC_ENOTBUILT Attempt to use feature that was not turned on when netCDF was built\nHINT: NC_ENOTBUILT errors occur only, in our experience, when NCO attempts to access an HDF4 (including HDF-EOS2) file. It is only possible to access HDF4 files from NCO if NCO is first re-linked to a version of netCDF configured with the --enable-hdf4 option, which itself must be linked to a version of HDF4 configured with the --disable-netcdf option. These  [...]
 #endif /* !ENABLE_NETCDF4 */
@@ -737,7 +737,7 @@ nc_open_mem(const char * const fl_nm,const int mode,const size_t sz,void * const
   int rcd;
   const char fnc_nm[]="nc_open_mem()";
   rcd=strlen(fl_nm)+mode+sz;
-  (void)fprintf(stdout,"ERROR: %s reports attempt to open file memory was foiled because libnetcdf.a does not contain nc_open_mem(). To obtain this functionality, please rebuild NCO against netCDF library version 4.4.0-rc1 (released ~20150610) or later.\nExiting...\n",fnc_nm);
+  (void)fprintf(stdout,"ERROR: %s reports attempt to open file memory was foiled because libnetcdf.a does not contain %s. To obtain this functionality, please rebuild NCO against netCDF library version 4.4.0-rc1 (released ~20150610) or later.\nExiting...\n",fnc_nm,fnc_nm);
   nco_err_exit(rcd,fnc_nm);
   *nc_id=*((int *)void_ptr);
   return rcd;
@@ -758,6 +758,35 @@ nco_open_mem(const char * const fl_nm,const int mode,const size_t sz,void * cons
   return rcd;
 } /* end nco_open_mem() */
 
+#if NC_LIB_VERSION < 460
+int nc_def_var_filter(const int nc_id,const int var_id,const unsigned int flt_id,const size_t prm_nbr,const unsigned int * const prm_lst)
+{
+  /* Purpose: Pseudo-library stub function to create a filter for a variable
+     This particular stub routine is only called by netCDF4-enabled code
+     when built against a netCDF library that it too old to have the nc_def_var_filter() function. */
+  int rcd;
+  const char fnc_nm[]="nc_def_var_filter()";
+  rcd=NC_NOERR+0*(nc_id+var_id+flt_id+prm_nbr+*prm_lst); /* CEWI */
+  (void)fprintf(stdout,"ERROR: %s reports define variable filter was foiled because libnetcdf.a does not contain %s. To obtain this functionality, please rebuild NCO against netCDF library version 4.6.0 (released ~20180125) or later.\nExiting...\n",fnc_nm,fnc_nm);
+  nco_err_exit(rcd,fnc_nm);
+  return rcd;
+} /* end nc_def_var_filter() */
+
+int nc_inq_var_filter(const int nc_id,const int var_id,unsigned int * const flt_id,size_t * const prm_nbr,unsigned int * const prm_lst)
+{
+  /* Purpose: Pseudo-library stub function to inquire a filter for a variable
+     This particular stub routine is only called by netCDF4-enabled code
+     when built against a netCDF library that it too old to have the nc_inq_var_filter() function. */
+  int rcd;
+  const char fnc_nm[]="nc_inq_var_filter()";
+  rcd=NC_NOERR+0*(nc_id+var_id);
+  *flt_id=*prm_nbr=*prm_lst=rcd; /* CEWI */
+  (void)fprintf(stdout,"ERROR: %s reports define variable filter was foiled because libnetcdf.a does not contain %s. To obtain this functionality, please rebuild NCO against netCDF library version 4.6.0 (released ~20180125) or later.\nExiting...\n",fnc_nm,fnc_nm);
+  nco_err_exit(rcd,fnc_nm);
+  return rcd;
+} /* end nc_inq_var_filter() */
+#endif /* 4.6.0 */
+
 #ifdef ENABLE_MPI
 # ifdef HAVE_NETCDF4_H
 /* netCDF4 routines defined by Unidata netCDF4 Library libnetcdf.a 
@@ -979,7 +1008,7 @@ nco_inq(const int nc_id,int * const dmn_nbr_fl,int * const var_nbr_fl,int * cons
   return rcd;
 } /* end nco_inq() */
 
-  /* NB: nc_inq_path() introduced in netCDF 4.3.2, but NC_LIB_VERSION does not work until netCDF 4.4.0 */
+/* NB: nc_inq_path() introduced in netCDF 4.3.2, but NC_LIB_VERSION does not work until netCDF 4.4.0 */
 #ifndef HAVE_NC_INQ_PATH
 int nc_inq_path(const int nc_id,size_t * const pathlen,char * const path)
 {
@@ -1549,6 +1578,15 @@ int nco_def_var_deflate
   return rcd;
 } /* end nco_def_var_deflate() */
 
+int nco_def_var_filter(const int nc_id,const int var_id,const unsigned int flt_id,const size_t prm_nbr,const unsigned int * const prm_lst)
+{
+  /* Purpose: Wrapper for nc_def_var_filter() */
+  int rcd;
+  rcd=nc_def_var_filter(nc_id,var_id,flt_id,prm_nbr,prm_lst);
+  if(rcd != NC_NOERR) nco_err_exit(rcd,"nco_def_var_filter()");
+  return rcd;
+} /* end nco_def_var_filter() */
+
 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 att_nbr)
 {
@@ -1653,6 +1691,15 @@ nco_inq_var_fill
   return rcd;
 } /* end nco_inq_var_fill() */
 
+int nco_inq_var_filter(const int nc_id,const int var_id,unsigned int * const flt_id,size_t * const prm_nbr,unsigned int * const prm_lst)
+{
+  /* Purpose: Wrapper for nc_inq_var_filter() */
+  int rcd;
+  rcd=nc_inq_var_filter(nc_id,var_id,flt_id,prm_nbr,prm_lst);
+  if(rcd != NC_NOERR) nco_err_exit(rcd,"nco_inq_var_filter()");
+  return rcd;
+} /* end nco_inq_var_filter() */
+
 int
 nco_def_var_fletcher32
 (const int nc_id, /* I [ID] netCDF ID */
diff --git a/src/nco/nco_netcdf.h b/src/nco/nco_netcdf.h
index 2dc070a..b89322c 100644
--- a/src/nco/nco_netcdf.h
+++ b/src/nco/nco_netcdf.h
@@ -344,11 +344,11 @@ int nco_sync(const int nc_id);
 int nco_abort(const int nc_id);
 int nco_close(const int nc_id);
 int nco_inq(const int nc_id,int * const dmn_nbr_fl,int * const var_nbr_fl,int * const att_glb_nbr,int * const rec_dmn_id);
-  /* NB: nc_inq_path() introduced in netCDF 4.3.2, but   NC_LIB_VERSION does not work until netCDF 4.4.0 */
+  /* NB: nc_inq_path() introduced in netCDF 4.3.2, but NC_LIB_VERSION does not work until netCDF 4.4.0 */
 #ifndef HAVE_NC_INQ_PATH
   int nc_inq_path(const int nc_id,size_t * const pathlen,char * const path);
 #endif /* !HAVE_NC_INQ_PATH */
-int nco_inq_path(const int nc_id,size_t * const pathlen,char * const path);
+  int nco_inq_path(const int nc_id,size_t * const pathlen,char * const path);
   /* NB: nc_inq_format() introduced in netCDF 3.6.1, but NC_LIB_VERSION does not work until netCDF 4.4.0 */
 #ifndef HAVE_NC_INQ_FORMAT
   /* Stub for nc_inq_format(), introduced in netCDF 3.6.1 or 3.6.2 */
@@ -407,12 +407,14 @@ int nco_copy_var(const int nc_in_id,const int var_id,const int nc_out_id);
 int nco_def_var(const int nc_id,const char * const var_nm,const nc_type var_typ,const int dmn_nbr,const int * const dmn_id,int * const var_id);
 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_filter(const int nc_id,const int var_id,const unsigned int flt_id,const size_t prm_nbr,const unsigned int *prm_lst);
 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 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);
 int nco_inq_var_fill(const int nc_id,const int var_id,int * const fll_nil,void * const fll_val);
+int nco_inq_var_filter(const int nc_id,const int var_id,unsigned int * const flt_id,size_t * const prm_nbr,unsigned int * const prm_lst);
 int nco_inq_var_fletcher32(const int nc_id,const int var_id,int * const chk_typ);
 int nco_inq_var_packing(const int nc_id,const int var_id,int * const packing);
 int nco_inq_vardimid(const int nc_id,const int var_id,int * const dmn_id);
@@ -458,7 +460,7 @@ int nco_get_att(const int nc_id,const int var_id,const char * const att_nm,void
   int nc_rename_grp(int grp_id,const char * const grp_nm);
 #endif /* NC_HAVE_RENAME_GRP */
   /* nc_open_mem() is defined in netCDF >= 4.4.0, however ...
-     Ubuntu (Xenial at least) used broken netCDF CMake (not autoconf) to package 4.4.0 (it does not install netcdf_mem.h):
+     Ubuntu (Xenial at least) used broken netCDF CMake (not autoconf) to package 4.4.0, and it does not install netcdf_mem.h:
      https://github.com/nco/nco/issues/44
      Symptom of "missing netcdf_mem.h" and/or "unresolved nc_open_mem()" occurs with NCO 4.6.2+
      Until 20171112 we used (Option 1): 
@@ -469,15 +471,19 @@ int nco_get_att(const int nc_id,const int var_id,const char * const att_nm,void
      #if defined(HAVE_NETCDF_MEM_H)
      which requires additional build tests in Autoconf/CMake/Makefile 
      20180106 For CMake this is correctly done by detecting both the existence of
-     netcdf_mem.h and symbol nc_open_mem in the netCDF library and defining HAVE_NETCDF_MEM_H 
-     only when both exist */
+     netcdf_mem.h and symbol nc_open_mem() in the netCDF library and defining HAVE_NETCDF_MEM_H only when both exist */
 #ifdef HAVE_NETCDF_MEM_H
 # include <netcdf_mem.h> /* nc_open_mem() defined in netCDF >= 4.4.0 */
 #else /* 4.4.0 */
   int nc_open_mem(const char * const fl_nm,const int mode,const size_t sz,void * const void_ptr,int * const nc_id);
 #endif /* 4.4.0 */
 
-/* Begin netCDF4 stubs */
+#if NC_LIB_VERSION < 460 
+  int nc_def_var_filter(const int nc_id,const int var_id,const unsigned int flt_id,const size_t prm_nbr,const unsigned int * const prm_lst);
+  int nc_inq_var_filter(const int nc_id,const int var_id,unsigned int * const flt_id,size_t * const prm_nbr,unsigned int * const prm_lst);
+#endif /* 4.6.0 */
+
+  /* Begin netCDF4 stubs */
 #ifndef HAVE_NETCDF4_H
   /* Stubs so netCDF4 functions work without protection in netCDF3 environments */
 # ifdef NC_HAVE_NEW_CHUNKING_API
diff --git a/src/nco/nco_pck.c b/src/nco/nco_pck.c
index 866f286..a4d64e8 100644
--- a/src/nco/nco_pck.c
+++ b/src/nco/nco_pck.c
@@ -381,7 +381,7 @@ nco_pck_plc_typ_get /* [fnc] Determine type, if any, to pack input type to */
     break;
   } /* end nco_pck_map switch */ 
   
-  /* Only fill in nc_typ_pck_out if it is non-NULL */
+  /* Only fill-in nc_typ_pck_out if it is non-NULL */
   if(nc_typ_pck_out) *nc_typ_pck_out=nc_typ_pck_out_tmp;
   
   return nco_pck_plc_alw; /* O [flg] Packing policy allows packing nc_typ_in */
diff --git a/src/nco/nco_prn.c b/src/nco/nco_prn.c
index e56bab4..b441006 100644
--- a/src/nco/nco_prn.c
+++ b/src/nco/nco_prn.c
@@ -41,7 +41,7 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 
   att_sct *att=NULL_CEWI;
 
-  //  const char fnc_nm[]="nco_prn_att()"; /* [sng] Function name  */
+  const char fnc_nm[]="nco_prn_att()"; /* [sng] Function name */
   const char spc_sng[]=""; /* [sng] Space string */
 
   char *nm_cdl;
@@ -67,6 +67,8 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 
   float val_flt;
 
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   int att_nbr_ttl;
   int att_nbr_vsb;
   int dmn_nbr=0;
@@ -251,6 +253,33 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	  att[idx].val.vp=(void *)nco_malloc(att_sz*nco_typ_lng(att[idx].type));
 	  for(int dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++) att[idx].val.ip[dmn_idx]=cnk_sz[dmn_idx];
 	} /* srg_typ != NC_CHUNKED */
+	/* _Filter */
+	if(NC_LIB_VERSION >= 460){
+	  if(!XML){
+	    if(srg_typ == NC_CHUNKED){
+	      /* Support dynamic compression filters as of netCDF 4.6.0 (January, 2018)
+		 Unfortunately, I don't have an actual file or dynamic filter library for testing:
+		 https://www.unidata.ucar.edu/software/netcdf/docs/filters_8md_source.html */
+	      unsigned int flt_id;
+	      size_t prm_nbr;
+	      //unsigned int *prm_lst=NULL;
+	      rcd=nco_inq_var_filter(grp_id,var_id,&flt_id,&prm_nbr,NULL);
+	      if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stdout,"%s: DEBUG %s reports flt_id = %u, prm_nbr = %lu\n",nco_prg_nm_get(),fnc_nm,flt_id,(unsigned long)prm_nbr);
+	      if(flt_id){
+		/* Print _Filter for filtered variables */
+		idx=att_nbr_ttl++;
+		att=(att_sct *)nco_realloc(att,att_nbr_ttl*sizeof(att_sct));
+		att[idx].nm=(char *)strdup("_Filter");
+		att[idx].type=NC_UINT;
+		att_sz=att[idx].sz=prm_nbr;
+		att[idx].val.vp=(void *)nco_malloc(att_sz*nco_typ_lng(att[idx].type));
+		rcd=nco_inq_var_filter(grp_id,var_id,NULL,NULL,att[idx].val.uip);
+		/* prm_lst=(unsigned int *)nco_malloc(prm_nbr*sizeof(unsigned int));
+		   if(prm_lst) prm_lst=(unsigned int *)nco_free(prm_lst); */
+	      } /* !flt_id */
+	    } /* srg_typ != NC_CHUNKED */
+	  } /* !xml */
+	} /* !4.6.0 */
 	/* _DeflateLevel */
 	if(!XML){
 	  rcd=nco_inq_var_deflate(grp_id,var_id,&shuffle,&deflate,&dfl_lvl);
@@ -317,7 +346,7 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
   } /* !hdn, NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC */
 
   if(JSN && att_nbr_ttl > 0){
-    (void)fprintf(stdout,"%*s\"attributes\": {\n",prn_ndn,spc_sng);
+    (void)fprintf(fp_out,"%*s\"attributes\": {\n",prn_ndn,spc_sng);
     prn_ndn+=prn_flg->sxn_fst;  
   } /* !JSN */
  
@@ -347,7 +376,7 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 
     if(CDL){
       nm_cdl=nm2sng_cdl(att[idx].nm);
-      (void)fprintf(stdout,"%*s%s%s:%s = ",prn_ndn,spc_sng,(att[idx].type == NC_STRING) ? "string " : "",src_sng,nm_cdl); 
+      (void)fprintf(fp_out,"%*s%s%s:%s = ",prn_ndn,spc_sng,(att[idx].type == NC_STRING) ? "string " : "",src_sng,nm_cdl); 
       nm_cdl=(char *)nco_free(nm_cdl);
     } /* !cdl */
 
@@ -359,13 +388,13 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	 (prn_flg->jsn_att_fmt == 1 && (att[idx].type != NC_FLOAT && att[idx].type != NC_INT && att[idx].type != NC_STRING && att[idx].type != NC_CHAR)))
         jsn_obj=True;   
  
-      if(jsn_obj) (void)fprintf(stdout,"%*s\"%s\": { \"type\": \"%s\", \"data\": ",prn_ndn,spc_sng,nm_jsn,jsn_typ_nm(att[idx].type)); else (void)fprintf(stdout,"%*s\"%s\": ",prn_ndn,spc_sng,nm_jsn); 
+      if(jsn_obj) (void)fprintf(fp_out,"%*s\"%s\": { \"type\": \"%s\", \"data\": ",prn_ndn,spc_sng,nm_jsn,jsn_typ_nm(att[idx].type)); else (void)fprintf(fp_out,"%*s\"%s\": ",prn_ndn,spc_sng,nm_jsn); 
  
       /* Multi-element so print array open */ 
-      if(att_sz > 1L && att[idx].type != NC_CHAR) (void)fprintf(stdout,"["); 
+      if(att_sz > 1L && att[idx].type != NC_CHAR) (void)fprintf(fp_out,"["); 
       nm_jsn=(char *)nco_free(nm_jsn);    
     } /* !JSN */
-    if(TRD) (void)fprintf(stdout,"%*s%s attribute %i: %s, size = %li %s, value = ",prn_ndn,spc_sng,src_sng,idx,att[idx].nm,att_sz,nco_typ_sng(att[idx].type));
+    if(TRD) (void)fprintf(fp_out,"%*s%s attribute %i: %s, size = %li %s, value = ",prn_ndn,spc_sng,src_sng,idx,att[idx].nm,att_sz,nco_typ_sng(att[idx].type));
 
     spr_sng=cma_sng; /* [sng] Output separator string */
     if(XML){
@@ -374,7 +403,7 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	 http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/ncml/v2.2/AnnotatedSchema4.html // older
 	 http://www.unidata.ucar.edu/schemas/netcdf/ncml-2.2.xsd */
 
-      (void)fprintf(stdout,"%*s<attribute name=\"%s\"",prn_ndn,spc_sng,att[idx].nm);
+      (void)fprintf(fp_out,"%*s<attribute name=\"%s\"",prn_ndn,spc_sng,att[idx].nm);
 
       /* User may override default separator string for XML only */
       if(att[idx].type == NC_STRING || att[idx].type == NC_CHAR) spr_sng= (prn_flg->spr_chr) ? prn_flg->spr_chr : spr_xml_chr; else spr_sng= (prn_flg->spr_nmr) ? prn_flg->spr_nmr : spr_xml_nmr;
@@ -386,11 +415,11 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	 toolsui NcML does not print "type=char" for for char attributes
 	 Hence neither does ncks */
       if(att[idx].type != NC_STRING && att[idx].type != NC_CHAR){
-	(void)fprintf(stdout," type=\"%s\"",xml_typ_nm(att[idx].type));
+	(void)fprintf(fp_out," type=\"%s\"",xml_typ_nm(att[idx].type));
 	/* Print hidden attributes */
 	/* Until ~2014 toolsui showed no way to indicate unsigned types for attributes
 	   20151207 Aleksander Jelenak and Ed Armstrong request "_Unsigned" attributes to denote unsigned attribute types */
-	if(nco_xml_typ_rqr_nsg_att(att[idx].type)) (void)fprintf(stdout," isUnsigned=\"true\"");
+	if(nco_xml_typ_rqr_nsg_att(att[idx].type)) (void)fprintf(fp_out," isUnsigned=\"true\"");
       } /* endif */
       
       /* Print separator element for non-whitespace separators */
@@ -412,9 +441,9 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	spr_sng_lng=strlen(spr_sng);
 	while(spr_sng_idx < spr_sng_lng)
 	  if(!isspace(spr_sng[spr_sng_idx])) break; else spr_sng_idx++;
-	if(spr_sng_idx < spr_sng_lng) (void)fprintf(stdout," separator=\"%s\"",spr_sng);
+	if(spr_sng_idx < spr_sng_lng) (void)fprintf(fp_out," separator=\"%s\"",spr_sng);
       } /* att[idx].sz */
-      (void)fprintf(stdout," value=\"");
+      (void)fprintf(fp_out," value=\"");
 
       /* XML-mode if dataset defines its own _FillValue for this variable? */
       // if(!(int)strcasecmp(att[idx].nm,nco_mss_val_sng_get())) has_fll_val=True;
@@ -436,7 +465,7 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	  if(isnan(val_flt)) (void)sprintf(val_sng,(JSN) ? "null" : "NaNf");
 	  else if(isinf(val_flt)) (void)sprintf(val_sng,"%s",(JSN) ? "null" : (val_flt < 0.0f) ? "-Infinityf" : "Infinityf");
 	} /* endelse */
-	(void)fprintf(stdout,"%s%s",val_sng,(lmn != att_szm1) ? spr_sng : "");
+	(void)fprintf(fp_out,"%s%s",val_sng,(lmn != att_szm1) ? spr_sng : "");
       } /* end loop */
       break;
     case NC_DOUBLE:
@@ -449,14 +478,14 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	  if(isnan(val_dbl)) (void)sprintf(val_sng,(JSN) ? "null" : "NaN");
 	  else if(isinf(val_dbl)) (void)sprintf(val_sng,"%s",(JSN) ? "null" : (val_dbl < 0.0) ? "-Infinity" : "Infinity");
 	} /* endelse */
-	(void)fprintf(stdout,"%s%s",val_sng,(lmn != att_szm1) ? spr_sng : "");
+	(void)fprintf(fp_out,"%s%s",val_sng,(lmn != att_szm1) ? spr_sng : "");
       } /* end loop */
       break;
     case NC_SHORT:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,att[idx].val.sp[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,att[idx].val.sp[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_INT:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,(long)att[idx].val.ip[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,(long)att[idx].val.ip[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_CHAR:
       for(lmn=0;lmn<att_sz;lmn++){
@@ -472,40 +501,40 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	  } /* endif first element of string array */
 	  /* New string begins each element where penultimate dimension changes */
 	  if(lmn%sng_lng == 0L){
-	    if(CDL_OR_JSN) (void)fprintf(stdout,"\"");
+	    if(CDL_OR_JSN) (void)fprintf(fp_out,"\"");
 	    sng_val_sng[0]='\0';
 	  } /* endif new string */
 	  (void)strcat(sng_val_sng,(CDL ? chr2sng_cdl(chr_val,val_sng) : XML ? chr2sng_xml(chr_val,val_sng) : chr2sng_jsn(chr_val,val_sng)));
 	  if(chr_val == '\n' && lmn != att_szm1 && CDL) (void)sprintf(sng_val_sng,"%s\",\n%*s\"",sng_val_sng_cpy,prn_ndn+prn_flg->var_fst,spc_sng);
 	  if(lmn%sng_lng == sng_lngm1){
-	    (void)fprintf(stdout,"%s%s",sng_val_sng,(CDL_OR_JSN) ? "\"" : "");
+	    (void)fprintf(fp_out,"%s%s",sng_val_sng,(CDL_OR_JSN) ? "\"" : "");
 	    /* Print separator after non-final string */
-	    if(lmn != att_szm1) (void)fprintf(stdout,"%s",spr_sng);
+	    if(lmn != att_szm1) (void)fprintf(fp_out,"%s",spr_sng);
 	  } /* endif string end */
 	  if(lmn == att_szm1) sng_val_sng=(char *)nco_free(sng_val_sng);
 	}else{ /* Traditional */
 	  /* Assume \0 is string terminator and do not print it */
-	  if(chr_val != '\0') (void)fprintf(stdout,"%c",chr_val);
+	  if(chr_val != '\0') (void)fprintf(fp_out,"%c",chr_val);
 	} /* endelse CDL, XML, Traditional */
       } /* end loop over element */
       break;
     case NC_BYTE:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,att[idx].val.bp[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,att[idx].val.bp[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_UBYTE:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,att[idx].val.ubp[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,att[idx].val.ubp[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_USHORT:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,att[idx].val.usp[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,att[idx].val.usp[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_UINT:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,att[idx].val.uip[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,att[idx].val.uip[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_INT64:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,att[idx].val.i64p[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,att[idx].val.i64p[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_UINT64:
-      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(stdout,att_sng_dlm,att[idx].val.ui64p[lmn],(lmn != att_szm1) ? spr_sng : "");
+      for(lmn=0;lmn<att_sz;lmn++) (void)fprintf(fp_out,att_sng_dlm,att[idx].val.ui64p[lmn],(lmn != att_szm1) ? spr_sng : "");
       break;
     case NC_STRING:
       for(lmn=0;lmn<att_sz;lmn++){
@@ -516,7 +545,7 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	if(CDL||XML||JSN){
 	  /* Worst case is printable strings are six or four times longer than unformatted, i.e., '\"' == """ or '\\' == "\\\\" */
 	  sng_val_sng=(char *)nco_malloc(6*sng_lng+1UL);
-	  if(CDL||JSN) (void)fprintf(stdout,"\"");
+	  if(CDL||JSN) (void)fprintf(fp_out,"\"");
 	  sng_val_sng[0]='\0';
 	  for(chr_idx=0;chr_idx<sng_lng;chr_idx++){
 	    val_sng[0]='\0';
@@ -524,12 +553,12 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
 	    /* (void)strcat(sng_val_sng,(CDL) ? chr2sng_cdl(chr_val,val_sng) : chr2sng_xml(chr_val,val_sng)); */
 	    (void)strcat(sng_val_sng,(CDL ? chr2sng_cdl(chr_val,val_sng) : XML ? chr2sng_xml(chr_val,val_sng) : chr2sng_jsn(chr_val,val_sng)));
 	  } /* end loop over character */
-	  (void)fprintf(stdout,"%s%s",sng_val_sng,(XML) ? "" : "\"");
+	  (void)fprintf(fp_out,"%s%s",sng_val_sng,(XML) ? "" : "\"");
 	  /* Print separator after non-final string */
-	  if(lmn != att_szm1) (void)fprintf(stdout,"%s",spr_sng);
+	  if(lmn != att_szm1) (void)fprintf(fp_out,"%s",spr_sng);
 	  sng_val_sng=(char *)nco_free(sng_val_sng);
 	}else if(TRD){ /* Traditional */
-	  (void)fprintf(stdout,att_sng_dlm,att[idx].val.sngp[lmn],(lmn != att_szm1) ? spr_sng : "");
+	  (void)fprintf(fp_out,att_sng_dlm,att[idx].val.sngp[lmn],(lmn != att_szm1) ? spr_sng : "");
 	} /* endelse CDL, XML, Traditional */
       } /* end loop over element */
       break;
@@ -539,18 +568,18 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
     if(CDL){
       if(nco_dbg_lvl_get() >= nco_dbg_std){
 	/* 20161129: Add netCDF attribute type as comment after semi-colon. Yes, "string" is redundant. */
-	(void)fprintf(stdout," ; // %s\n",cdl_typ_nm(att[idx].type));
+	(void)fprintf(fp_out," ; // %s\n",cdl_typ_nm(att[idx].type));
       }else{ /* !dbg */
-	(void)fprintf(stdout," ;\n");
+	(void)fprintf(fp_out," ;\n");
       } /* !dbg */
     } /* !CDL */
-    if(TRD) (void)fprintf(stdout,"\n");
-    if(XML) (void)fprintf(stdout,"\" />\n");
+    if(TRD) (void)fprintf(fp_out,"\n");
+    if(XML) (void)fprintf(fp_out,"\" />\n");
     if(JSN){ 
       /* Close list for multi-element attributes */ 
-      if(att_sz > 1L && att[idx].type != NC_CHAR) (void)fprintf(stdout,"]");          
+      if(att_sz > 1L && att[idx].type != NC_CHAR) (void)fprintf(fp_out,"]");          
       /* Close JSON object tag */  
-      if(jsn_obj) (void)fprintf(stdout,"%s",(idx < att_nbr_ttl-1) ? "},\n" : "}"); else (void)fprintf(stdout,"%s",(idx < att_nbr_ttl-1) ? ",\n" : "");
+      if(jsn_obj) (void)fprintf(fp_out,"%s",(idx < att_nbr_ttl-1) ? "},\n" : "}"); else (void)fprintf(fp_out,"%s",(idx < att_nbr_ttl-1) ? ",\n" : "");
     } /* !JSN */
 
     rcd_prn+=0; /* CEWI */
@@ -559,13 +588,13 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
   /* Omit comma and carriage-return for final attribute */
   if(JSN && att_nbr_ttl>0){
     prn_ndn-=prn_flg->sxn_fst;  
-    (void)fprintf(stdout,"\n%*s}",prn_ndn,spc_sng);
+    (void)fprintf(fp_out,"\n%*s}",prn_ndn,spc_sng);
   } /* !JSN */
 
   /* Print extra line after global attributes */
-  if(CDL && flg_glb) (void)fprintf(stdout,"\n");
-  if(!prn_flg->new_fmt && CDL_OR_TRD) (void)fprintf(stdout,"\n");
-  (void)fflush(stdout);
+  if(CDL && flg_glb) (void)fprintf(fp_out,"\n");
+  if(!prn_flg->new_fmt && CDL_OR_TRD) (void)fprintf(fp_out,"\n");
+  (void)fflush(fp_out);
   
   /* Print additional hidden attributes */
   if(XML && var_id != NC_GLOBAL){
@@ -587,9 +616,9 @@ nco_prn_att /* [fnc] Print all attributes of single variable or group */
        "There are not separate unsigned integer types. The Variable and Array objects have isUnsigned() methods, and conversion to wider types is correctly done. Since Java does not have unsigned types, the alternative is to automatically widen unsigned data arrays, which would double the memory used. */
     nc_type var_type;
     (void)nco_inq_vartype(grp_id,var_id,&var_type);
-    if(nco_xml_typ_rqr_nsg_att(var_type)) (void)fprintf(stdout,"%*s<attribute name=\"_Unsigned\" value=\"true\" />\n",prn_ndn,spc_sng);
+    if(nco_xml_typ_rqr_nsg_att(var_type)) (void)fprintf(fp_out,"%*s<attribute name=\"_Unsigned\" value=\"true\" />\n",prn_ndn,spc_sng);
     /* 20131231: Emulate toolsUI 4.3 _FillValue behavior for unsigned types (present in NCO 4.3.7-4.3.9, deprecated in 4.4.0 */
-    // if(nco_xml_typ_rqr_flv_att(var_type) && !has_fll_val) (void)fprintf(stdout,"%*s<attribute name=\"_FillValue\" type=\"%s\" value=\"%d\" />\n",prn_ndn,spc_sng,xml_typ_nm(var_type),(var_type == NC_UINT64) ? -2 : -1);
+    // if(nco_xml_typ_rqr_flv_att(var_type) && !has_fll_val) (void)fprintf(fp_out,"%*s<attribute name=\"_FillValue\" type=\"%s\" value=\"%d\" />\n",prn_ndn,spc_sng,xml_typ_nm(var_type),(var_type == NC_UINT64) ? -2 : -1);
   } /* !xml */
 
   /* Free space holding attribute values */
@@ -833,34 +862,41 @@ nco_typ_fmt_sng /* [fnc] Provide sprintf() format string for specified type */
 } /* end nco_typ_fmt_sng() */
 
 void
-nco_prn_var_val_cmt /* 0 print to stdout var values as CDL comment (delimited by comma ) */
-(var_sct *var,          /* I [sct] variable to print */
- const prn_fmt_sct * const prn_flg)  /* I [sct] Print-format information */
+nco_prn_var_val_cmt /* Print variable values as CDL comment (delimited by comma) */
+(var_sct *var, /* I [sct] variable to print */
+ const prn_fmt_sct * const prn_flg) /* I [sct] Print-format information */
 {
+  const char *mss_val_sng="_";
+
+  char *fmt_sng_mss_val=NULL;
+
+  char dlm_sng[NCO_MAX_LEN_FMT_SNG]={0};
+
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   nco_bool is_mss_val=False;
+
   long lmn;
   long sz;
+
   size_t val_sz_byt;
-  char *fmt_sng_mss_val=NULL;
-  char dlm_sng[200]={0};
-  const char *mss_val_sng="_";
+
   /* Print each element with user-supplied formatting code */
   /* Replace C language '\X' escape codes with ASCII bytes */
-
   sz=var->sz;
-  sprintf(dlm_sng, "%s",nco_typ_fmt_sng_var_cdl(var->type));
+  sprintf(dlm_sng,"%s",nco_typ_fmt_sng_var_cdl(var->type));
 
   (void)sng_ascii_trn(dlm_sng);
 
   if(var->has_mss_val) val_sz_byt=nco_typ_lng(var->type);
 
-  // (void)printf(stdout,"nco_prn_var_val_cmt(): fmt_sng_mss_val=%s\n","hello" );
+  // (void)fprintf(stdout,"nco_prn_var_val_cmt(): fmt_sng_mss_val=%s\n","hello" );
 
   /* Assume -s argument (dlm_sng) formats entire string
-   Otherwise, one could assume that field will be printed with format nco_typ_fmt_sng(var->type),
-   and that user is only allowed to affect text between fields. 
-   This would be accomplished with:
-   (void)sprintf(var_sng,"%s%s",nco_typ_fmt_sng(var->type),dlm_sng);*/
+     Otherwise, one could assume that field will be printed with format nco_typ_fmt_sng(var->type),
+     and that user is only allowed to affect text between fields. 
+     This would be accomplished with:
+     (void)sprintf(var_sng,"%s%s",nco_typ_fmt_sng(var->type),dlm_sng);*/
 
   /* Find replacement format string at most once, then re-use */
   #ifdef NCO_HAVE_REGEX_FUNCTIONALITY
@@ -869,7 +905,7 @@ nco_prn_var_val_cmt /* 0 print to stdout var values as CDL comment (delimited by
   #endif /* !NCO_HAVE_REGEX_FUNCTIONALITY */
 
   /* Print type in English in prefix text */
-  if(var->type == NC_STRING) (void)fprintf(stdout,"calendar format: "); else (void)fprintf(stdout,"%s value%s: ",cdl_typ_nm(var->type),(var->sz > 1 ? "s":""));
+  if(var->type == NC_STRING) (void)fprintf(fp_out,"calendar format: "); else (void)fprintf(fp_out,"%s value%s: ",cdl_typ_nm(var->type),(var->sz > 1 ? "s":""));
 
   for(lmn=0;lmn<sz;lmn++){
 
@@ -880,34 +916,34 @@ nco_prn_var_val_cmt /* 0 print to stdout var values as CDL comment (delimited by
       
     if(prn_flg->PRN_MSS_VAL_BLANK && var->has_mss_val && is_mss_val){
       if(strcmp(dlm_sng,fmt_sng_mss_val)){
-	(void)fprintf(stdout,fmt_sng_mss_val,mss_val_sng);
+	(void)fprintf(fp_out,fmt_sng_mss_val,mss_val_sng);
       }else{
-	(void)fprintf(stdout,"%s",mss_val_sng);
+	(void)fprintf(fp_out,"%s",mss_val_sng);
       } /* !strcmp() */
     }else{ /* !is_mss_val */
         switch(var->type){
-          case NC_FLOAT: (void)fprintf(stdout,dlm_sng,var->val.fp[lmn]); break;
-          case NC_DOUBLE: (void)fprintf(stdout,dlm_sng,var->val.dp[lmn]); break;
-          case NC_SHORT: (void)fprintf(stdout,dlm_sng,var->val.sp[lmn]); break;
-          case NC_INT: (void)fprintf(stdout,dlm_sng,var->val.ip[lmn]); break;
-          case NC_CHAR: (void)fprintf(stdout,dlm_sng,var->val.cp[lmn]); break;
-          case NC_BYTE: (void)fprintf(stdout,dlm_sng,var->val.bp[lmn]); break;
-          case NC_UBYTE: (void)fprintf(stdout,dlm_sng,var->val.ubp[lmn]); break;
-          case NC_USHORT: (void)fprintf(stdout,dlm_sng,var->val.usp[lmn]); break;
-          case NC_UINT: (void)fprintf(stdout,dlm_sng,var->val.uip[lmn]); break;
-          case NC_INT64: (void)fprintf(stdout,dlm_sng,var->val.i64p[lmn]); break;
-          case NC_UINT64: (void)fprintf(stdout,dlm_sng,var->val.ui64p[lmn]); break;
-          case NC_STRING: (void)fprintf(stdout,dlm_sng,var->val.sngp[lmn]); break;
+          case NC_FLOAT: (void)fprintf(fp_out,dlm_sng,var->val.fp[lmn]); break;
+          case NC_DOUBLE: (void)fprintf(fp_out,dlm_sng,var->val.dp[lmn]); break;
+          case NC_SHORT: (void)fprintf(fp_out,dlm_sng,var->val.sp[lmn]); break;
+          case NC_INT: (void)fprintf(fp_out,dlm_sng,var->val.ip[lmn]); break;
+          case NC_CHAR: (void)fprintf(fp_out,dlm_sng,var->val.cp[lmn]); break;
+          case NC_BYTE: (void)fprintf(fp_out,dlm_sng,var->val.bp[lmn]); break;
+          case NC_UBYTE: (void)fprintf(fp_out,dlm_sng,var->val.ubp[lmn]); break;
+          case NC_USHORT: (void)fprintf(fp_out,dlm_sng,var->val.usp[lmn]); break;
+          case NC_UINT: (void)fprintf(fp_out,dlm_sng,var->val.uip[lmn]); break;
+          case NC_INT64: (void)fprintf(fp_out,dlm_sng,var->val.i64p[lmn]); break;
+          case NC_UINT64: (void)fprintf(fp_out,dlm_sng,var->val.ui64p[lmn]); break;
+          case NC_STRING: (void)fprintf(fp_out,dlm_sng,var->val.sngp[lmn]); break;
           default: nco_dfl_case_nc_type_err(); break;
        } /* end switch */
 
     } /* !is_mss_val */
 
-    if(lmn<sz-1L) (void)fprintf(stdout,", ");
+    if(lmn<sz-1L) (void)fprintf(fp_out,", ");
 
   } /* end loop over element */
 
-  (void)fprintf(stdout,"\n");
+  (void)fprintf(fp_out,"\n");
 
   if(fmt_sng_mss_val) fmt_sng_mss_val=(char *)nco_free(fmt_sng_mss_val);
 
@@ -931,13 +967,12 @@ nco_prn_var_val_lmt /* [fnc] Print variable data */
      NB: nco_prn_var_val_lmt() is simple, pre-MSA, pre-GTT code kept only for historical interest 
      It lacks most of the clutter caused by weird corner cases */
 
-  nco_bool SRD=False; /* Stride is non-unity */
-  nco_bool WRP=False; /* Coordinate is wrapped */
-
   char nul_chr='\0';
   char var_sng[NCO_MAX_LEN_FMT_SNG];
   char *unit_sng=NULL;
   
+  dmn_sct *dim=NULL_CEWI;
+
   int rcd=NC_NOERR; /* [rcd] Return code */
   int *dmn_id=NULL_CEWI;
   int idx;
@@ -952,7 +987,9 @@ nco_prn_var_val_lmt /* [fnc] Print variable data */
   long *hyp_mod=NULL_CEWI;
   long lmn;  
   
-  dmn_sct *dim=NULL_CEWI;
+  nco_bool SRD=False; /* Stride is non-unity */
+  nco_bool WRP=False; /* Coordinate is wrapped */
+
   var_sct var;
 
   /* Initialize units string, overwrite later if necessary */
@@ -1126,7 +1163,7 @@ nco_prn_var_val_lmt /* [fnc] Print variable data */
 
   } /* end if dlm_sng */
 
-  if(var.nbr_dim == 0 && dlm_sng == NULL){ 
+  if(var.nbr_dim == 0 && !dlm_sng){ 
     /* Variable is scalar, byte, or character */
     lmn=0;
     (void)sprintf(var_sng,"%%s = %s %%s\n",nco_typ_fmt_sng(var.type));
@@ -1150,7 +1187,7 @@ nco_prn_var_val_lmt /* [fnc] Print variable data */
     } /* end switch */
   } /* end if variable is scalar, byte, or character */
 
-  if(var.nbr_dim > 0 && dlm_sng == NULL){ 
+  if(var.nbr_dim > 0 && !dlm_sng){ 
     /* Generate nicely formatted output for multidimensional arrays */
 
     char arr_lft_dlm=char_CEWI;
@@ -1358,6 +1395,8 @@ nco_prn_var_dfn                     /* [fnc] Print variable metadata */
   char sng_foo[NC_MAX_NAME+10]; /* Add 10 for extra formatting characters */
   char sz_sng[100];
 
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   int deflate; /* [flg] Deflation is on */
   int dfl_lvl; /* [enm] Deflate level [0..9] */
   int dmn_idx;
@@ -1425,12 +1464,12 @@ nco_prn_var_dfn                     /* [fnc] Print variable metadata */
   if(prn_flg->jsn) prn_ndn=prn_flg->ndn;
 
   if(prn_flg->trd){
-    if(nco_fmt_xtn_get() != nco_fmt_xtn_hdf4 || NC_LIB_VERSION >= 433) (void)fprintf(stdout,"%*s%s: type %s, %i dimension%s, %i attribute%s, compressed? %s, chunked? %s, packed? %s\n",prn_ndn,spc_sng,var_trv->nm,nco_typ_sng(var_typ),nbr_dim,(nbr_dim == 1) ? "" : "s",nbr_att,(nbr_att == 1) ? "" : "s",(deflate) ? "yes" : "no",(srg_typ == NC_CHUNKED) ? "yes" : "no",(packing) ? "yes" : "no"); else (void)fprintf(stdout,"%*s%s: type %s, %i dimension%s, %i attribute%s, compressed? HDF4_UNKNOWN, [...]
+    if(nco_fmt_xtn_get() != nco_fmt_xtn_hdf4 || NC_LIB_VERSION >= 433) (void)fprintf(fp_out,"%*s%s: type %s, %i dimension%s, %i attribute%s, compressed? %s, chunked? %s, packed? %s\n",prn_ndn,spc_sng,var_trv->nm,nco_typ_sng(var_typ),nbr_dim,(nbr_dim == 1) ? "" : "s",nbr_att,(nbr_att == 1) ? "" : "s",(deflate) ? "yes" : "no",(srg_typ == NC_CHUNKED) ? "yes" : "no",(packing) ? "yes" : "no"); else (void)fprintf(fp_out,"%*s%s: type %s, %i dimension%s, %i attribute%s, compressed? HDF4_UNKNOWN, [...]
     /* 20170913: Typically users not interested in variable ID. However, ID helps diagnose susceptibility to CDF5 bug */
-    if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(stdout,"%*s%s ID = netCDF define order = %d\n",prn_ndn,spc_sng,var_trv->nm,var_id);
+    if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(fp_out,"%*s%s ID = netCDF define order = %d\n",prn_ndn,spc_sng,var_trv->nm,var_id);
   } /* !trd */
-  if(prn_flg->xml) (void)fprintf(stdout,"%*s<variable name=\"%s\" type=\"%s\"",prn_ndn,spc_sng,var_trv->nm,xml_typ_nm(var_typ));
-  if(prn_flg->jsn) (void)fprintf(stdout,"%*s\"%s\": {\n",prn_ndn,spc_sng,var_trv->nm);
+  if(prn_flg->xml) (void)fprintf(fp_out,"%*s<variable name=\"%s\" type=\"%s\"",prn_ndn,spc_sng,var_trv->nm,xml_typ_nm(var_typ));
+  if(prn_flg->jsn) (void)fprintf(fp_out,"%*s\"%s\": {\n",prn_ndn,spc_sng,var_trv->nm);
 
   /* Print type, shape, and total size of variable */
   /* Use nbr_dmn+1 in malloc() to handle case when nbr_dim == 0 and allow for formatting characters */
@@ -1439,7 +1478,7 @@ nco_prn_var_dfn                     /* [fnc] Print variable metadata */
   sz_sng[0]='\0';
   if(nbr_dim == 0){
     ram_sz_crr=var_sz*nco_typ_lng(var_typ);
-    if(prn_flg->trd) (void)fprintf(stdout,"%*s%s size (RAM) = %ld*sizeof(%s) = %ld*%lu = %lu bytes\n",prn_ndn,spc_sng,var_trv->nm,var_sz,nco_typ_sng(var_typ),var_sz,(unsigned long)nco_typ_lng(var_typ),(unsigned long)ram_sz_crr);
+    if(prn_flg->trd) (void)fprintf(fp_out,"%*s%s size (RAM) = %ld*sizeof(%s) = %ld*%lu = %lu bytes\n",prn_ndn,spc_sng,var_trv->nm,var_sz,nco_typ_sng(var_typ),var_sz,(unsigned long)nco_typ_lng(var_typ),(unsigned long)ram_sz_crr);
     /* 20131122: Implement ugly NcML requirement that scalars have shape="" attribute */
     if(prn_flg->xml) (void)sprintf(dmn_sng," shape=\"\"");
     (void)sprintf(sng_foo,"1*sizeof(%s)",nco_typ_sng(var_typ));
@@ -1474,9 +1513,9 @@ nco_prn_var_dfn                     /* [fnc] Print variable metadata */
     if(nco_fmt_xtn_get() != nco_fmt_xtn_hdf4 || NC_LIB_VERSION >= 433) (void)nco_inq_var_deflate(grp_id,var_id,&shuffle,&deflate,&dfl_lvl);
 
     if(prn_flg->trd){
-      if((nco_fmt_xtn_get() != nco_fmt_xtn_hdf4 || NC_LIB_VERSION >= 433) && deflate) (void)fprintf(stdout,"%*s%s compression (Lempel-Ziv %s shuffling) level = %d\n",prn_ndn,spc_sng,var_trv->nm,(shuffle) ? "with" : "without",dfl_lvl);
-      if(nco_fmt_xtn_get() == nco_fmt_xtn_hdf4 && NC_LIB_VERSION < 433) (void)fprintf(stdout,"%*s%s compression and shuffling characteristics are HDF4_UNKNOWN\n",prn_ndn,spc_sng,var_trv->nm);
-      (void)fprintf(stdout,"%*s%s size (RAM) = %s = %li*%lu = %lu bytes\n",prn_ndn,spc_sng,var_trv->nm,sz_sng,var_sz,(unsigned long)nco_typ_lng(var_typ),(unsigned long)ram_sz_crr);
+      if((nco_fmt_xtn_get() != nco_fmt_xtn_hdf4 || NC_LIB_VERSION >= 433) && deflate) (void)fprintf(fp_out,"%*s%s compression (Lempel-Ziv %s shuffling) level = %d\n",prn_ndn,spc_sng,var_trv->nm,(shuffle) ? "with" : "without",dfl_lvl);
+      if(nco_fmt_xtn_get() == nco_fmt_xtn_hdf4 && NC_LIB_VERSION < 433) (void)fprintf(fp_out,"%*s%s compression and shuffling characteristics are HDF4_UNKNOWN\n",prn_ndn,spc_sng,var_trv->nm);
+      (void)fprintf(fp_out,"%*s%s size (RAM) = %s = %li*%lu = %lu bytes\n",prn_ndn,spc_sng,var_trv->nm,sz_sng,var_sz,(unsigned long)nco_typ_lng(var_typ),(unsigned long)ram_sz_crr);
     } /* !prn_flg->trd */
 
   } /* end if variable is scalar */
@@ -1484,22 +1523,22 @@ nco_prn_var_dfn                     /* [fnc] Print variable metadata */
 
   if(prn_flg->cdl){
     nm_cdl=nm2sng_cdl(var_trv->nm);
-    (void)fprintf(stdout,"%*s%s %s%s ;",prn_ndn,spc_sng,cdl_typ_nm(var_typ),nm_cdl,dmn_sng);
-    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stdout," // RAM size = %s = %li*%lu = %lu bytes",sz_sng,var_sz,(unsigned long)nco_typ_lng(var_typ),(unsigned long)ram_sz_crr);
+    (void)fprintf(fp_out,"%*s%s %s%s ;",prn_ndn,spc_sng,cdl_typ_nm(var_typ),nm_cdl,dmn_sng);
+    if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(fp_out," // RAM size = %s = %li*%lu = %lu bytes",sz_sng,var_sz,(unsigned long)nco_typ_lng(var_typ),(unsigned long)ram_sz_crr);
     /* 20170913: Typically users not interested in variable ID. However, ID helps diagnose susceptibility to CDF5 bug */
-    if(nco_dbg_lvl_get() >= nco_dbg_fl) (void)fprintf(stdout,", ID = %d",var_id);
-    (void)fprintf(stdout,"\n");
+    if(nco_dbg_lvl_get() >= nco_dbg_fl) (void)fprintf(fp_out,", ID = %d",var_id);
+    (void)fprintf(fp_out,"\n");
     nm_cdl=(char *)nco_free(nm_cdl);
   } /* !cdl */
   if(prn_flg->xml){
-    if(prn_flg->PRN_VAR_DATA || prn_flg->PRN_VAR_METADATA) (void)fprintf(stdout,"%s>\n",dmn_sng); else (void)fprintf(stdout,"%s />\n",dmn_sng);
+    if(prn_flg->PRN_VAR_DATA || prn_flg->PRN_VAR_METADATA) (void)fprintf(fp_out,"%s>\n",dmn_sng); else (void)fprintf(fp_out,"%s />\n",dmn_sng);
   } /* !xml */
 
   /* Add comma as next in queue is the atts - NB: DONT LIKE THIS */
   if(prn_flg->jsn){
-    if(nbr_dim > 0) (void)fprintf(stdout,"%s\n",dmn_sng); 
+    if(nbr_dim > 0) (void)fprintf(fp_out,"%s\n",dmn_sng); 
     /* Print netCDF type with same names as XML */ 
-    (void)fprintf(stdout,"%*s\"type\": \"%s\"",prn_ndn+prn_flg->sxn_fst,spc_sng,jsn_typ_nm(var_typ));
+    (void)fprintf(fp_out,"%*s\"type\": \"%s\"",prn_ndn+prn_flg->sxn_fst,spc_sng,jsn_typ_nm(var_typ));
   } /* !xml */
 
   if(dmn_sng) dmn_sng=(char *)nco_free(dmn_sng);
@@ -1517,9 +1556,9 @@ nco_prn_var_dfn                     /* [fnc] Print variable metadata */
         crd_sct *crd=var_trv->var_dmn[dmn_idx].crd;
 
         /* NOTE: Use hyperslabbed sizes for dimension size */
-        if(srg_typ == NC_CHUNKED) (void)fprintf(stdout,"%*s%s dimension %i: %s, size = %li %s, chunksize = %lu (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(crd->dmn_grp_nm_fll,var_trv->grp_nm_fll)) ? crd->nm : crd->dmn_nm_fll,crd->lmt_msa.dmn_cnt,nco_typ_sng(crd->var_typ),(unsigned long)cnk_sz[dmn_idx]); else (void)fprintf(stdout,"%*s%s dimension %i: %s, size = %li %s (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(crd->dmn_grp_nm_fll,var_trv->grp_nm_fll)) ? crd->nm : crd->dmn_nm_fll, [...]
+        if(srg_typ == NC_CHUNKED) (void)fprintf(fp_out,"%*s%s dimension %i: %s, size = %li %s, chunksize = %lu (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(crd->dmn_grp_nm_fll,var_trv->grp_nm_fll)) ? crd->nm : crd->dmn_nm_fll,crd->lmt_msa.dmn_cnt,nco_typ_sng(crd->var_typ),(unsigned long)cnk_sz[dmn_idx]); else (void)fprintf(fp_out,"%*s%s dimension %i: %s, size = %li %s (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(crd->dmn_grp_nm_fll,var_trv->grp_nm_fll)) ? crd->nm : crd->dmn_nm_fll, [...]
 
-        (void)fprintf(stdout,"%soordinate is %s)",(CRR_DMN_IS_REC_IN_INPUT[dmn_idx]) ? "Record c" : "C",(!strcmp(crd->crd_grp_nm_fll,var_trv->grp_nm_fll)) ? crd->nm : crd->crd_nm_fll);
+        (void)fprintf(fp_out,"%soordinate is %s)",(CRR_DMN_IS_REC_IN_INPUT[dmn_idx]) ? "Record c" : "C",(!strcmp(crd->crd_grp_nm_fll,var_trv->grp_nm_fll)) ? crd->nm : crd->crd_nm_fll);
 
         /* Non-coordinate dimension */
       }else if(!var_trv->var_dmn[dmn_idx].is_crd_var){
@@ -1527,18 +1566,18 @@ nco_prn_var_dfn                     /* [fnc] Print variable metadata */
         dmn_trv_sct *dmn_trv=var_trv->var_dmn[dmn_idx].ncd;
 
         /* NOTE: Use hyperslabbed sizes for dimension size */
-        if(srg_typ == NC_CHUNKED) (void)fprintf(stdout,"%*s%s dimension %i: %s, size = %li, chunksize = %lu (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(dmn_trv->grp_nm_fll,var_trv->grp_nm_fll)) ? dmn_trv->nm : dmn_trv->nm_fll,dmn_trv->lmt_msa.dmn_cnt,(unsigned long)cnk_sz[dmn_idx]); else (void)fprintf(stdout,"%*s%s dimension %i: %s, size = %li (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(dmn_trv->grp_nm_fll,var_trv->grp_nm_fll)) ? dmn_trv->nm : dmn_trv->nm_fll,dmn_trv->lmt_msa.dmn_cnt);
-        (void)fprintf(stdout,"%son-coordinate dimension)",(CRR_DMN_IS_REC_IN_INPUT[dmn_idx]) ? "Record n" : "N");
+        if(srg_typ == NC_CHUNKED) (void)fprintf(fp_out,"%*s%s dimension %i: %s, size = %li, chunksize = %lu (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(dmn_trv->grp_nm_fll,var_trv->grp_nm_fll)) ? dmn_trv->nm : dmn_trv->nm_fll,dmn_trv->lmt_msa.dmn_cnt,(unsigned long)cnk_sz[dmn_idx]); else (void)fprintf(fp_out,"%*s%s dimension %i: %s, size = %li (",prn_ndn,spc_sng,var_trv->nm,dmn_idx,(!strcmp(dmn_trv->grp_nm_fll,var_trv->grp_nm_fll)) ? dmn_trv->nm : dmn_trv->nm_fll,dmn_trv->lmt_msa.dmn_cnt);
+        (void)fprintf(fp_out,"%son-coordinate dimension)",(CRR_DMN_IS_REC_IN_INPUT[dmn_idx]) ? "Record n" : "N");
 
       } /* end non-coordinate dimension */
-      (void)fprintf(stdout,"\n"); 
+      (void)fprintf(fp_out,"\n"); 
     } /* end loop over dimensions */
 
     /* Caveat user */
-    if((nc_type)var_typ == NC_STRING) (void)fprintf(stdout,"%*s%s size (RAM) above is space required for pointers only, full size of strings is unknown until data are read\n",prn_ndn,spc_sng,var_trv->nm);
+    if((nc_type)var_typ == NC_STRING) (void)fprintf(fp_out,"%*s%s size (RAM) above is space required for pointers only, full size of strings is unknown until data are read\n",prn_ndn,spc_sng,var_trv->nm);
   } /* !prn_flg->trd */
 
-  (void)fflush(stdout);
+  (void)fflush(fp_out);
 } /* end nco_prn_var_dfn() */
 
 void
@@ -1577,6 +1616,7 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
   char nul_chr='\0'; /* [sng] Character to end string */ 
 
   char *dlm_sng=NULL; /* [sng] User-specified delimiter string, if any */
+  char *fmt_val=NULL; /* [sng] Format string for variable values */
   char *nm_cdl;
   char *sng_val_sng=NULL_CEWI; /* [sng] String of NC_CHAR */
   char *sng_val_sng_cpy; /* [sng] Copy of sng_val_sng to avoid cppcheck error about using sng_val_sng as both parameter and desitnation in sprintf(). NB: free() only one of these two pointers. */
@@ -1594,6 +1634,8 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
 
   double val_dbl;
 
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   float val_flt;
 
   int dmn_idx; /* [idx] Counter over dimensions */
@@ -1601,10 +1643,10 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
   int rcd_prn;
   int prn_ndn=0; /* [nbr] Indentation for printing */
   int val_sz_byt=int_CEWI; /* [nbr] Type size */
+
   lmt_msa_sct **lmt_msa=NULL_CEWI; /* [sct] MSA Limits for only for variable dimensions  */          
   lmt_sct **lmt=NULL_CEWI; /* [sct] Auxiliary Limit used in MSA */
 
-
   long *dmn_sbs_dsk=NULL_CEWI; /* [nbr] Indices of hyperslab relative to original on disk */
   long *dmn_sbs_ram=NULL_CEWI; /* [nbr] Indices in hyperslab */
   long *mod_map_cnt=NULL_CEWI; /* [nbr] MSA modulo array */
@@ -1617,6 +1659,7 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
   long var_szm1;
 
   nco_cln_typ lmt_cln = cln_std;   /* calendar type - for time at units */
+
   const nco_bool CDL=prn_flg->cdl; /* [flg] CDL output */
   const nco_bool XML=prn_flg->xml; /* [flg] XML output */
   const nco_bool TRD=prn_flg->trd; /* [flg] Traditional output */
@@ -1626,12 +1669,11 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
   nco_bool flg_malloc_unit_crd=False; /* [flg] Allocated memory for coordinate units string */
   nco_bool flg_malloc_unit_var=False; /* [flg] Allocated memory for variable units string */
   nco_bool unit_cln_crd=False; /* [flg] Coordinate has calendar units */
-  //nco_bool unit_cln_var=False; /* [flg] Variable has calendar units */
 
   nco_string sng_val; /* [sng] Current string */
 
   var_sct *var=NULL_CEWI; /* [sct] Variable structure */
-  var_sct *var_aux=NULL_CEWI; /* used to hold var data to be printed as CDL comment AFTER regular var data */
+  var_sct *var_aux=NULL_CEWI; /* Holds variable data printed as CDL comment AFTER regular variable data */
 
   if(prn_flg->new_fmt && (CDL||TRD||JSN)) prn_ndn=prn_flg->ndn+prn_flg->var_fst;
   if(XML) prn_ndn=prn_flg->ndn;
@@ -1695,39 +1737,30 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
        !nco_is_spc_in_cf_att(grp_id, "climatology", var->id, &cf_var_id))
       cf_var_id = var->id;
 
-    unit_sng_var=nco_lmt_get_udu_att(grp_id, cf_var_id, "units");
+    unit_sng_var=nco_lmt_get_udu_att(grp_id,cf_var_id,"units");
     if(unit_sng_var && strlen(unit_sng_var)){
-      flg_malloc_unit_var = True;
-      //unit_cln_var = nco_cln_chk_tm(unit_sng_var);
-
-      cln_sng = nco_lmt_get_udu_att(grp_id, cf_var_id, "calendar");
-      if(cln_sng) lmt_cln = nco_cln_get_cln_typ(cln_sng); else lmt_cln=cln_std;
+      flg_malloc_unit_var=True;
+      cln_sng=nco_lmt_get_udu_att(grp_id, cf_var_id,"calendar");
+      if(cln_sng) lmt_cln=nco_cln_get_cln_typ(cln_sng); else lmt_cln=cln_std;
       if(cln_sng) cln_sng=(char *)nco_free(cln_sng);
-    } 
+    } /* !unit_sng_var */
 
     /* Set default for TRD */
     if(TRD && flg_malloc_unit_var == False){
       unit_sng_var=strdup("(no units)");
       flg_malloc_unit_var=True;
     }else if(CDL && flg_malloc_unit_var == True){
-      if(prn_flg->PRN_CLN_LGB || nco_dbg_lvl_get()== nco_dbg_std){
+      if(prn_flg->PRN_CLN_LGB || nco_dbg_lvl_get() == nco_dbg_std){
         var_tmp=nco_var_dpl(var);
+        var_aux=nco_var_dpl(var);
+        var_aux->val.vp=nco_free(var_aux->val.vp);
 
-        var_aux = nco_var_dpl(var);
-        var_aux->val.vp = nco_free(var_aux->val.vp);
-
-        if(var_aux->has_mss_val)
-          var_aux->mss_val.vp=nco_free(var_aux->mss_val.vp);
+        if(var_aux->has_mss_val) var_aux->mss_val.vp=nco_free(var_aux->mss_val.vp);
         var_aux->has_mss_val=False;
+        nco_var_cnf_typ(NC_STRING,var_aux);
 
-        nco_var_cnf_typ(NC_STRING, var_aux);
-
-        /* nb nco_cln_var_prs modifies var_tmp and var_aux */
-        if (nco_cln_var_prs(unit_sng_var, lmt_cln, prn_flg->cdl_fmt_dt , var_tmp, var_aux) == NCO_ERR)
-          var_aux = nco_var_free(var_aux);
-        /* swap values about */
-        else if (prn_flg->PRN_CLN_LGB) { var_swp=var;var=var_aux;var_aux=var_swp; }
-
+        /* NB: nco_cln_var_prs() modifies var_tmp and var_aux */
+        if(nco_cln_var_prs(unit_sng_var,lmt_cln,prn_flg->cdl_fmt_dt,var_tmp,var_aux) == NCO_ERR) var_aux=nco_var_free(var_aux); else if(prn_flg->PRN_CLN_LGB){var_swp=var;var=var_aux;var_aux=var_swp;}
         if(var_tmp) var_tmp=(var_sct*)nco_var_free(var_tmp);
       } /* !PRN_CLN_LGB */
     } /* !CDL */
@@ -1777,8 +1810,9 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
       (void)fprintf(stderr,"%s: WARNING will print packed values of variable \"%s\". Unpack first (with ncpdq -U) to see actual values.\n",nco_prg_nm_get(),var_nm);
 
   if(prn_flg->dlm_sng) dlm_sng=strdup(prn_flg->dlm_sng); /* [sng] User-specified delimiter string, if any */
+  if(prn_flg->fmt_val) fmt_val=strdup(prn_flg->fmt_val); /* [sng] Format string for variable values */
 
-  if(dlm_sng){
+  if(dlm_sng && TRD){
     /* Print variable with user-supplied dlm_sng (includes nbr_dmn == 0) */
     char *fmt_sng_mss_val=NULL;
 
@@ -1806,64 +1840,59 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
       } /* !PRN_MSS_VAL_BLANK */
 	
       if(prn_flg->PRN_MSS_VAL_BLANK && var->has_mss_val &&  is_mss_val){
-        if(strcmp(dlm_sng,fmt_sng_mss_val)) (void)fprintf(stdout,fmt_sng_mss_val,mss_val_sng); else (void)fprintf(stdout,"%s, ",mss_val_sng);
+        if(strcmp(dlm_sng,fmt_sng_mss_val)) (void)fprintf(fp_out,fmt_sng_mss_val,mss_val_sng); else (void)fprintf(fp_out,"%s, ",mss_val_sng);
       }else{ /* !is_mss_val */
         switch(var->type){
-        case NC_FLOAT: (void)fprintf(stdout,dlm_sng,var->val.fp[lmn]); break;
-        case NC_DOUBLE: (void)fprintf(stdout,dlm_sng,var->val.dp[lmn]); break;
-        case NC_SHORT: (void)fprintf(stdout,dlm_sng,var->val.sp[lmn]); break;
-        case NC_INT: (void)fprintf(stdout,dlm_sng,var->val.ip[lmn]); break;
-        case NC_CHAR: (void)fprintf(stdout,dlm_sng,var->val.cp[lmn]); break;
-        case NC_BYTE: (void)fprintf(stdout,dlm_sng,var->val.bp[lmn]); break;
-        case NC_UBYTE: (void)fprintf(stdout,dlm_sng,var->val.ubp[lmn]); break;
-        case NC_USHORT: (void)fprintf(stdout,dlm_sng,var->val.usp[lmn]); break;
-        case NC_UINT: (void)fprintf(stdout,dlm_sng,var->val.uip[lmn]); break;
-        case NC_INT64: (void)fprintf(stdout,dlm_sng,var->val.i64p[lmn]); break;
-        case NC_UINT64: (void)fprintf(stdout,dlm_sng,var->val.ui64p[lmn]); break;
-        case NC_STRING: (void)fprintf(stdout,dlm_sng,var->val.sngp[lmn]); break;
+        case NC_FLOAT: (void)fprintf(fp_out,dlm_sng,var->val.fp[lmn]); break;
+        case NC_DOUBLE: (void)fprintf(fp_out,dlm_sng,var->val.dp[lmn]); break;
+        case NC_SHORT: (void)fprintf(fp_out,dlm_sng,var->val.sp[lmn]); break;
+        case NC_INT: (void)fprintf(fp_out,dlm_sng,var->val.ip[lmn]); break;
+        case NC_CHAR: (void)fprintf(fp_out,dlm_sng,var->val.cp[lmn]); break;
+        case NC_BYTE: (void)fprintf(fp_out,dlm_sng,var->val.bp[lmn]); break;
+        case NC_UBYTE: (void)fprintf(fp_out,dlm_sng,var->val.ubp[lmn]); break;
+        case NC_USHORT: (void)fprintf(fp_out,dlm_sng,var->val.usp[lmn]); break;
+        case NC_UINT: (void)fprintf(fp_out,dlm_sng,var->val.uip[lmn]); break;
+        case NC_INT64: (void)fprintf(fp_out,dlm_sng,var->val.i64p[lmn]); break;
+        case NC_UINT64: (void)fprintf(fp_out,dlm_sng,var->val.ui64p[lmn]); break;
+        case NC_STRING: (void)fprintf(fp_out,dlm_sng,var->val.sngp[lmn]); break;
         default: nco_dfl_case_nc_type_err(); break;
         } /* end switch */
       } /* !is_mss_val */
     } /* end loop over element */
-    (void)fprintf(stdout,"\n");
+    (void)fprintf(fp_out,"\n");
 
     if(fmt_sng_mss_val) fmt_sng_mss_val=(char *)nco_free(fmt_sng_mss_val);
-  } /* end if dlm_sng */
+  } /* !dlm_sng */
 
   spr_sng=cma_sng; /* [sng] Output separator string */
   if(CDL || JSN || XML){
     char fmt_sng[NCO_MAX_LEN_FMT_SNG];
     dmn_trv_sct *dmn_trv; /* [sct] Unique dimension object */
     long chr_idx;
-    nco_bool is_compound; /* [flg] Variable is compound (has non-leading record dimension) */
     char * (*chr2sng_sf)(const char chr_val, /* I [chr] Character to process */
     char * const val_sng); /* I/O [sng] String to stuff printable result into */
 
     if(CDL){     
       chr2sng_sf=chr2sng_cdl;
-      (void)sprintf(fmt_sng,"%s",nco_typ_fmt_sng_var_cdl(var->type));
+      if(fmt_val && (var->type == NC_FLOAT || var->type == NC_DOUBLE)) (void)sprintf(fmt_sng,"%s",fmt_val); else (void)sprintf(fmt_sng,"%s",nco_typ_fmt_sng_var_cdl(var->type));
     } /* !CDL */
     if(XML){     
       chr2sng_sf=chr2sng_xml;
-      (void)sprintf(fmt_sng,"%s",nco_typ_fmt_sng_att_xml(var->type));
+      if(fmt_val && (var->type == NC_FLOAT || var->type == NC_DOUBLE)) (void)sprintf(fmt_sng,"%s",fmt_val); else (void)sprintf(fmt_sng,"%s",nco_typ_fmt_sng_att_xml(var->type));
     } /* !XML */
     if(JSN){
       chr2sng_sf=chr2sng_jsn;
-      (void)sprintf(fmt_sng,"%s",nco_typ_fmt_sng_att_xml(var->type));
+      if(fmt_val && (var->type == NC_FLOAT || var->type == NC_DOUBLE)) (void)sprintf(fmt_sng,"%s",fmt_val); else (void)sprintf(fmt_sng,"%s",nco_typ_fmt_sng_att_xml(var->type));
    
-      (void)fprintf(stdout,"%*s\"data\": ",prn_ndn,spc_sng);
-
-      /* if  false then this means  only one set of braces for nbr_dim>1 */
-      if( prn_flg->jsn_data_brk == False)
-        for(dmn_idx=1;dmn_idx<var->nbr_dim;dmn_idx++) 
-           mod_map_rv_cnt[dmn_idx]=0L;
-
-
-      /* switch   off final level braces for NC_CHAR as string is already quoted */      
-      if(var->nbr_dim >=1 && var->type==NC_CHAR)  
-           mod_map_rv_cnt[var->nbr_dim-1]=0L;
+      (void)fprintf(fp_out,"%*s\"data\": ",prn_ndn,spc_sng);
 
+      /* If false then print only one set of braces even when nbr_dim > 1 */
+      if(prn_flg->jsn_data_brk == False)
+        for(dmn_idx=1;dmn_idx<var->nbr_dim;dmn_idx++)
+	  mod_map_rv_cnt[dmn_idx]=0L;
 
+      /* Switch-off final level braces for NC_CHAR as string is already quoted */      
+      if(var->nbr_dim >=1 && var->type==NC_CHAR) mod_map_rv_cnt[var->nbr_dim-1]=0L;
     } /* !JSN */
 
     nm_cdl=nm2sng_cdl(var_nm);
@@ -1872,7 +1901,7 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
       /* User may override default separator string for XML only */
       if(var->type == NC_STRING || var->type == NC_CHAR) spr_sng= (prn_flg->spr_chr) ? prn_flg->spr_chr : spr_xml_chr; else spr_sng= (prn_flg->spr_nmr) ? prn_flg->spr_nmr : spr_xml_nmr;
 
-      (void)fprintf(stdout,"%*s<values",prn_ndn+prn_flg->var_fst,spc_sng);
+      (void)fprintf(fp_out,"%*s<values",prn_ndn+prn_flg->var_fst,spc_sng);
       /* Print non-whitespace separators between elements */
       if((var->sz == 1L && var->type == NC_STRING) || var->sz > 1L){
 	/* Ensure string variable value does not contain separator string */
@@ -1893,7 +1922,7 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
 	spr_sng_lng=strlen(spr_sng);
 	while(spr_sng_idx < spr_sng_lng)
 	  if(!isspace(spr_sng[spr_sng_idx])) break; else spr_sng_idx++;
-	if(spr_sng_idx < spr_sng_lng) (void)fprintf(stdout," separator=\"%s\"",spr_sng);
+	if(spr_sng_idx < spr_sng_lng) (void)fprintf(fp_out," separator=\"%s\"",spr_sng);
 	if(var->type == NC_CHAR && var->nbr_dim > 1 && FIRST_WARNING && nco_dbg_lvl_get() > 0){
 	  /* 20131122: Warnings about XML ambiguities caused by spr_sng appearing in val_sng would go here
 	     New procedure to pre-check strings above obviates need for this in all all cases except one:
@@ -1904,41 +1933,39 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
 	  FIRST_WARNING=False;
 	} /* endif WARNING */
       } /* var.sz */
-      (void)fprintf(stdout,">");
+      (void)fprintf(fp_out,">");
     } /* !xml */
-    if(CDL) {
-      (void)fprintf(stdout,"%*s%s = ",prn_ndn,spc_sng,nm_cdl);
-      /* pretty printing */
-      if(var->nbr_dim >=2)
-        (void)fprintf(stdout,"\n%*s",prn_ndn,spc_sng);
-    }
+    if(CDL){
+      (void)fprintf(fp_out,"%*s%s = ",prn_ndn,spc_sng,nm_cdl);
+      /* Pretty printing */
+      if(var->nbr_dim >= 2) (void)fprintf(fp_out,"\n%*s",prn_ndn,spc_sng);
+    } /* !CDL */
     nm_cdl=(char *)nco_free(nm_cdl);
     var_szm1=var->sz-1L;
 
     /* Pre-compute elements that need brace punctuation */
-    if(CDL && var->nbr_dim>=1){
+    if(CDL && var->nbr_dim >= 1){
       mod_map_rv_cnt[0]=0L;
-      /* Create brace list - here we simply modify mod_map_rv_cnt[idx] -
-       * if the dim is NOT unlimited we set mod_map_rv_cnt[idx] to zero  */
-      for(dmn_idx=1;dmn_idx<var->nbr_dim;dmn_idx++) { /* NB: dimension index starts at 1 */
-        dmn_trv = nco_dmn_trv_sct(var_trv->var_dmn[dmn_idx].dmn_id, trv_tbl);
-        if(dmn_trv->is_rec_dmn == False)
-          mod_map_rv_cnt[dmn_idx]=0L;
-      }
-    }
+      /* Create brace list here we simply modify mod_map_rv_cnt[idx]
+	 If dimensions is NOT unlimited we set mod_map_rv_cnt[idx] to zero */
+      for(dmn_idx=1;dmn_idx<var->nbr_dim;dmn_idx++){ /* NB: dimension index starts at 1 */
+        dmn_trv=nco_dmn_trv_sct(var_trv->var_dmn[dmn_idx].dmn_id,trv_tbl);
+        if(dmn_trv->is_rec_dmn == False) mod_map_rv_cnt[dmn_idx]=0L;
+      } /* !dmn_idx */
+    } /* !CDL */
 
     for(lmn=0;lmn<var->sz;lmn++){
 
-      /* do bracketing of data if specified */
+      /* Bracket data if specified */
       if(JSN || CDL)
-        for(int bdz=0; bdz<var->nbr_dim ; bdz++)
-          if(mod_map_rv_cnt[bdz]  && lmn % mod_map_rv_cnt[bdz] == 0)
-	    (void)fprintf(stdout,"%c", (JSN ? '[' : '{' ) );
+        for(int bdz=0;bdz<var->nbr_dim;bdz++)
+          if(mod_map_rv_cnt[bdz] && lmn % mod_map_rv_cnt[bdz] == 0)
+	    (void)fprintf(fp_out,"%c",(JSN ? '[' : '{' ));
 
       is_mss_val=False;
       if(prn_flg->PRN_MSS_VAL_BLANK && var->has_mss_val){
-        if(var->type == NC_STRING) is_mss_val = !strcmp( var->val.sngp[lmn] ,var->mss_val.sngp[0]);
-	  /* in regular CDL format for NC_CHAR if FillValue is NOT '\0' then the char is printed as is */
+        if(var->type == NC_STRING) is_mss_val=!strcmp(var->val.sngp[lmn],var->mss_val.sngp[0]);
+	  /* In regular CDL format for NC_CHAR if _FillValue is NOT '\0' then the char is printed as is */
 	else if(var->type==NC_CHAR) is_mss_val=False;
 	/* memcmp() triggers pedantic warning unless pointer arithmetic is cast to type char * */
 	else is_mss_val=!memcmp((char *)var->val.vp+lmn*val_sz_byt,var->mss_val.vp,(size_t)val_sz_byt);
@@ -1956,7 +1983,7 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
           }else{
 	    if(isnan(val_flt)) (void)sprintf(val_sng,(JSN) ? "null" : "NaNf");
 	    else if(isinf(val_flt)) (void)sprintf(val_sng,"%s",(JSN) ? "null" : (val_flt < 0.0f) ? "-Infinityf" : "Infinityf");
-          } /* endelse */
+          } /* !isfinite() */
           break;
         case NC_DOUBLE:
           val_dbl=var->val.dp[lmn];
@@ -1966,18 +1993,17 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
           }else{
 	    if(isnan(val_dbl)) (void)sprintf(val_sng,(JSN) ? "null" : "NaN");
 	    else if(isinf(val_dbl)) (void)sprintf(val_sng,"%s",(JSN) ? "null" : (val_dbl < 0.0) ? "-Infinity" : "Infinity");
-          } /* endelse */
+          } /* !isfinite() */
           break;
         case NC_SHORT: (void)sprintf(val_sng,fmt_sng,var->val.sp[lmn]); break;
         case NC_INT: (void)sprintf(val_sng,fmt_sng,var->val.ip[lmn]); break;
         case NC_CHAR: 
           chr_val=var->val.cp[lmn];
           if(var->nbr_dim == 0){
-            if(CDL||TRD||JSN) (void)fprintf(stdout,"\"");
-	    /* the NetCDF standard is to print nul as "0" but  we shall  print "" for all formats */
-            if(chr_val != 0 )
-	       (void)fprintf(stdout,"%s",(*chr2sng_sf)(chr_val,val_sng));
-            if(CDL||TRD||JSN) (void)fprintf(stdout,"\"");
+            if(CDL||TRD||JSN) (void)fprintf(fp_out,"\"");
+	    /* ncdump prints NUL as "0" but NCO prints NUL as "" for all formats to disambiguate from zero */
+            if(chr_val != 0) (void)fprintf(fp_out,"%s",(*chr2sng_sf)(chr_val,val_sng));
+            if(CDL||TRD||JSN) (void)fprintf(fp_out,"\"");
             val_sng[0]='\0'; /* Re-initialize with NUL byte to be safe */
           }else{ /* var.nbr_dim > 0 */
             /* Multi-dimensional string arrays of NC_CHAR */
@@ -1990,15 +2016,15 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
             } /* endif first element of string array */
             /* New string begins each element where penultimate dimension changes */
             if(lmn%sng_lng == 0L){
-              if(CDL||JSN) (void)fprintf(stdout,"\"");
+              if(CDL||JSN) (void)fprintf(fp_out,"\"");
               sng_val_sng[0]='\0';
             } /* endif new string */
-            if(chr_val != '\0') (void)fprintf(stdout,"%s",(*chr2sng_sf)(chr_val,val_sng));
+            if(chr_val != '\0') (void)fprintf(fp_out,"%s",(*chr2sng_sf)(chr_val,val_sng));
             if(chr_val == '\n' && lmn != var_szm1) (void)sprintf(sng_val_sng,"%s\",\n%*s\"",sng_val_sng_cpy,prn_ndn+prn_flg->var_fst,spc_sng);
             if(lmn%sng_lng == sng_lngm1){
-              (void)fprintf(stdout,"%s%s",sng_val_sng,(CDL||JSN) ? "\"" : "");
+              (void)fprintf(fp_out,"%s%s",sng_val_sng,(CDL||JSN) ? "\"" : "");
               /* Print separator after non-final string 
-              //if(lmn != var_szm1) (void)fprintf(stdout,"%s",spr_sng); */
+              //if(lmn != var_szm1) (void)fprintf(fp_out,"%s",spr_sng); */
             } /* endif string end */
             if(lmn == var_szm1) sng_val_sng=(char *)nco_free(sng_val_sng);
           } /* var.nbr_dim > 0 */
@@ -2015,62 +2041,54 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
           sng_lngm1=sng_lng-1UL;
           /* Worst case is printable strings are six or four times longer than unformatted, i.e., '\"' == """ or '\\' == "\\\\" */
           sng_val_sng=(char *)nco_malloc(6*sng_lng+1UL);
-          if(CDL||JSN) (void)fprintf(stdout,"\"");
+          if(CDL||JSN) (void)fprintf(fp_out,"\"");
           sng_val_sng[0]='\0';
           for(chr_idx=0;chr_idx<sng_lng;chr_idx++){
             val_sng[0]='\0';
             chr_val=sng_val[chr_idx];
 	    (void)strcat(sng_val_sng,(*chr2sng_sf)(chr_val,val_sng));
           } /* end loop over character */
-          (void)fprintf(stdout,"%s%s",sng_val_sng,(XML) ? "" : "\"");
+          (void)fprintf(fp_out,"%s%s",sng_val_sng,(XML) ? "" : "\"");
           /* Print separator after non-final string nb with json bracketed no comma 
-          if(lmn != var_szm1) (void)fprintf(stdout,"%s",spr_sng); */
+          if(lmn != var_szm1) (void)fprintf(fp_out,"%s",spr_sng); */
           sng_val_sng=(char *)nco_free(sng_val_sng);
           break;
         default: nco_dfl_case_nc_type_err(); break;
         } /* end switch */
       } /* !is_mss_val */
 
-      if((var->type != NC_CHAR && var->type != NC_STRING) || (var->type==NC_STRING && is_mss_val))
-        (void)fprintf(stdout,"%s",val_sng);
+      if((var->type != NC_CHAR && var->type != NC_STRING) || (var->type==NC_STRING && is_mss_val)) (void)fprintf(fp_out,"%s",val_sng);
 
       /* Bracket data if specified */
       if(JSN || CDL)
-        for(int bdz=0; bdz<var->nbr_dim ; bdz++)
-          if(mod_map_rv_cnt[bdz]  && (lmn+1) % mod_map_rv_cnt[bdz] == 0)
-	        (void)fprintf(stdout,"%c",  (JSN ? ']' : '}' ));
+        for(int bdz=0;bdz<var->nbr_dim;bdz++)
+          if(mod_map_rv_cnt[bdz] && (lmn+1) % mod_map_rv_cnt[bdz] == 0)
+	    (void)fprintf(fp_out,"%c",(JSN ? ']' : '}'));
 
       if(lmn != var_szm1)
         if((var->type == NC_CHAR && lmn%sng_lng == sng_lngm1) || var->type != NC_CHAR)
-          (void)fprintf(stdout,"%s",spr_sng);
-
-      /* pretty printing */
-      if(CDL && var->nbr_dim && lmn< var_szm1 && (lmn+1) % lmt_msa[var->nbr_dim-1]->dmn_cnt  ==0)
-        (void)fprintf(stdout,"\n%*s",prn_ndn,spc_sng);
-
+          (void)fprintf(fp_out,"%s",spr_sng);
 
+      /* Pretty printing */
+      if(CDL && var->nbr_dim && lmn< var_szm1 && (lmn+1) % lmt_msa[var->nbr_dim-1]->dmn_cnt == 0) (void)fprintf(fp_out,"\n%*s",prn_ndn,spc_sng);
     } /* end loop over element */
     rcd_prn+=0; /* CEWI */
 
     if(CDL){
       char tmp_sng[100]={0};
-      if(nco_dbg_lvl_get() >= nco_dbg_std && flg_malloc_unit_var)
-	(void)sprintf(tmp_sng,"units=\"%s\"",unit_sng_var);
-
+      if(nco_dbg_lvl_get() >= nco_dbg_std && flg_malloc_unit_var) (void)sprintf(tmp_sng,"units=\"%s\"",unit_sng_var);
       if(nco_dbg_lvl_get() == nco_dbg_std && var_aux){
-        fprintf(stdout, "; // %s  ",tmp_sng);
-        // Print values as CDL text comment
+        (void)fprintf(fp_out,"; // %s  ",tmp_sng);
+        /* Print values as CDL text comment */
         nco_prn_var_val_cmt(var_aux,prn_flg);
       }else if(tmp_sng[0]){
-        (void)fprintf(stdout, " ; // %s\n",tmp_sng);
+        (void)fprintf(fp_out," ; // %s\n",tmp_sng);
       }else{
-        (void) fprintf(stdout, " ; \n");
+        (void)fprintf(fp_out," ;\n");
       } /* !dbg */
     } /* !CDL */
 
-    if(XML) (void)fprintf(stdout,"</values>\n");
-
-    
+    if(XML) (void)fprintf(fp_out,"</values>\n");
   } /* end if CDL_OR_JSN_OR_XML */
 
   if(var->nbr_dim == 0 && !dlm_sng && TRD){
@@ -2079,52 +2097,52 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
     if(prn_flg->PRN_MSS_VAL_BLANK) is_mss_val = var->has_mss_val ? !memcmp(var->val.vp,var->mss_val.vp,(size_t)val_sz_byt) : False;
     if(prn_flg->PRN_DMN_VAR_NM) (void)sprintf(var_sng,"%*s%%s = %s %%s\n",prn_ndn,spc_sng,nco_typ_fmt_sng(var->type)); else (void)sprintf(var_sng,"%*s%s\n",prn_ndn,spc_sng,nco_typ_fmt_sng(var->type));
     if(prn_flg->PRN_MSS_VAL_BLANK && is_mss_val){
-      if(prn_flg->PRN_DMN_VAR_NM) (void)fprintf(stdout,"%*s%s = %s %s\n",prn_ndn,spc_sng,var_nm,mss_val_sng,unit_sng_var); else (void)fprintf(stdout,"%*s%s\n",prn_ndn,spc_sng,mss_val_sng);
+      if(prn_flg->PRN_DMN_VAR_NM) (void)fprintf(fp_out,"%*s%s = %s %s\n",prn_ndn,spc_sng,var_nm,mss_val_sng,unit_sng_var); else (void)fprintf(fp_out,"%*s%s\n",prn_ndn,spc_sng,mss_val_sng);
     }else{ /* !is_mss_val */
       if(prn_flg->PRN_DMN_VAR_NM){
         switch(var->type){
-        case NC_FLOAT: (void)fprintf(stdout,var_sng,var_nm,var->val.fp[lmn],unit_sng_var); break;
-        case NC_DOUBLE: (void)fprintf(stdout,var_sng,var_nm,var->val.dp[lmn],unit_sng_var); break;
-        case NC_SHORT: (void)fprintf(stdout,var_sng,var_nm,var->val.sp[lmn],unit_sng_var); break;
-        case NC_INT: (void)fprintf(stdout,var_sng,var_nm,var->val.ip[lmn],unit_sng_var); break;
+        case NC_FLOAT: (void)fprintf(fp_out,var_sng,var_nm,var->val.fp[lmn],unit_sng_var); break;
+        case NC_DOUBLE: (void)fprintf(fp_out,var_sng,var_nm,var->val.dp[lmn],unit_sng_var); break;
+        case NC_SHORT: (void)fprintf(fp_out,var_sng,var_nm,var->val.sp[lmn],unit_sng_var); break;
+        case NC_INT: (void)fprintf(fp_out,var_sng,var_nm,var->val.ip[lmn],unit_sng_var); break;
         case NC_CHAR:
           if(var->val.cp[lmn] != '\0'){
             (void)sprintf(var_sng,"%*s%%s = '%s' %%s\n",prn_ndn,spc_sng,nco_typ_fmt_sng(var->type));
-            (void)fprintf(stdout,var_sng,var_nm,var->val.cp[lmn],unit_sng_var);
+            (void)fprintf(fp_out,var_sng,var_nm,var->val.cp[lmn],unit_sng_var);
           }else{ /* 20171220 Deal with NUL character here, otherwise NUL will print as '0' (which ncdump does, though we think that is a bug) */
-            (void)fprintf(stdout,"%*s%s = \"\" %s\n",prn_ndn,spc_sng,var_nm,unit_sng_var);
+            (void)fprintf(fp_out,"%*s%s = \"\" %s\n",prn_ndn,spc_sng,var_nm,unit_sng_var);
           } /* end if */
           break;
-        case NC_BYTE: (void)fprintf(stdout,var_sng,var_nm,(unsigned char)var->val.bp[lmn],unit_sng_var); break;
-        case NC_UBYTE: (void)fprintf(stdout,var_sng,var_nm,var->val.ubp[lmn],unit_sng_var); break;
-        case NC_USHORT: (void)fprintf(stdout,var_sng,var_nm,var->val.usp[lmn],unit_sng_var); break;
-        case NC_UINT: (void)fprintf(stdout,var_sng,var_nm,var->val.uip[lmn],unit_sng_var); break;
-        case NC_INT64: (void)fprintf(stdout,var_sng,var_nm,var->val.i64p[lmn],unit_sng_var); break;
-        case NC_UINT64: (void)fprintf(stdout,var_sng,var_nm,var->val.ui64p[lmn],unit_sng_var); break;
-        case NC_STRING: (void)fprintf(stdout,var_sng,var_nm,var->val.sngp[lmn],unit_sng_var); break;
+        case NC_BYTE: (void)fprintf(fp_out,var_sng,var_nm,(unsigned char)var->val.bp[lmn],unit_sng_var); break;
+        case NC_UBYTE: (void)fprintf(fp_out,var_sng,var_nm,var->val.ubp[lmn],unit_sng_var); break;
+        case NC_USHORT: (void)fprintf(fp_out,var_sng,var_nm,var->val.usp[lmn],unit_sng_var); break;
+        case NC_UINT: (void)fprintf(fp_out,var_sng,var_nm,var->val.uip[lmn],unit_sng_var); break;
+        case NC_INT64: (void)fprintf(fp_out,var_sng,var_nm,var->val.i64p[lmn],unit_sng_var); break;
+        case NC_UINT64: (void)fprintf(fp_out,var_sng,var_nm,var->val.ui64p[lmn],unit_sng_var); break;
+        case NC_STRING: (void)fprintf(fp_out,var_sng,var_nm,var->val.sngp[lmn],unit_sng_var); break;
         default: nco_dfl_case_nc_type_err(); break;
         } /* end switch */
       }else{ /* !PRN_DMN_VAR_NM */
         switch(var->type){
-        case NC_FLOAT: (void)fprintf(stdout,var_sng,var->val.fp[lmn]); break;
-        case NC_DOUBLE: (void)fprintf(stdout,var_sng,var->val.dp[lmn]); break;
-        case NC_SHORT: (void)fprintf(stdout,var_sng,var->val.sp[lmn]); break;
-        case NC_INT: (void)fprintf(stdout,var_sng,var->val.ip[lmn]); break;
+        case NC_FLOAT: (void)fprintf(fp_out,var_sng,var->val.fp[lmn]); break;
+        case NC_DOUBLE: (void)fprintf(fp_out,var_sng,var->val.dp[lmn]); break;
+        case NC_SHORT: (void)fprintf(fp_out,var_sng,var->val.sp[lmn]); break;
+        case NC_INT: (void)fprintf(fp_out,var_sng,var->val.ip[lmn]); break;
         case NC_CHAR:
           if(var->val.cp[lmn] != '\0'){
             (void)sprintf(var_sng,"'%s'\n",nco_typ_fmt_sng(var->type));
-            (void)fprintf(stdout,var_sng,var->val.cp[lmn]);
+            (void)fprintf(fp_out,var_sng,var->val.cp[lmn]);
           }else{ /* 20171220 Deal with NUL character here, otherwise NUL will print as '0' (which ncdump does, though we think that is a bug) */
-            (void)fprintf(stdout, "\"\"\n");
+            (void)fprintf(fp_out, "\"\"\n");
           } /* end if */
           break;
-        case NC_BYTE: (void)fprintf(stdout,var_sng,(unsigned char)var->val.bp[lmn]); break;
-        case NC_UBYTE: (void)fprintf(stdout,var_sng,var->val.ubp[lmn]); break;
-        case NC_USHORT: (void)fprintf(stdout,var_sng,var->val.usp[lmn]); break;
-        case NC_UINT: (void)fprintf(stdout,var_sng,var->val.uip[lmn]); break;
-        case NC_INT64: (void)fprintf(stdout,var_sng,var->val.i64p[lmn]); break;
-        case NC_UINT64: (void)fprintf(stdout,var_sng,var->val.ui64p[lmn]); break;
-        case NC_STRING: (void)fprintf(stdout,var_sng,var->val.sngp[lmn]); break;
+        case NC_BYTE: (void)fprintf(fp_out,var_sng,(unsigned char)var->val.bp[lmn]); break;
+        case NC_UBYTE: (void)fprintf(fp_out,var_sng,var->val.ubp[lmn]); break;
+        case NC_USHORT: (void)fprintf(fp_out,var_sng,var->val.usp[lmn]); break;
+        case NC_UINT: (void)fprintf(fp_out,var_sng,var->val.uip[lmn]); break;
+        case NC_INT64: (void)fprintf(fp_out,var_sng,var->val.i64p[lmn]); break;
+        case NC_UINT64: (void)fprintf(fp_out,var_sng,var->val.ui64p[lmn]); break;
+        case NC_STRING: (void)fprintf(fp_out,var_sng,var->val.sngp[lmn]); break;
         default: nco_dfl_case_nc_type_err(); break;
         } /* end switch */
       } /* !PRN_DMN_VAR_NM */
@@ -2198,7 +2216,7 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
 		if(unit_cln_crd){
 #ifdef HAVE_UDUNITS2_H
 		/* 20160418: Even when UDUnits is available, the lgb software produces poor formatting and needs work so turn-off for now */
-		unit_cln_crd=False;
+		  unit_cln_crd=False;
 #else /* !HAVE_UDUNITS2 */
 		  if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stdout,"%s: INFO %s reports units string \"%s\" is a calendar string, but UDUNITS2 not built-in, so will not attempt to print calendar dates legibly\n",nco_prg_nm_get(),fnc_nm,unit_sng_crd);
 		  unit_cln_crd=False;
@@ -2253,7 +2271,7 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
 
           if(!dim[dmn_idx].is_crd_dmn){ /* If dimension is not a coordinate... */
             if(prn_flg->PRN_DMN_VAR_NM){
-              if(prn_flg->FORTRAN_IDX_CNV) (void)fprintf(stdout,"%*s%s(%ld) ",(idx == 0) ? prn_ndn : 0,spc_sng,dim[dmn_idx].nm,dmn_sbs_dsk[dmn_idx]+1L); else (void)fprintf(stdout,"%*s%s[%ld] ",(idx == 0) ? prn_ndn : 0,spc_sng,dim[dmn_idx].nm,dmn_sbs_dsk[dmn_idx]);
+              if(prn_flg->FORTRAN_IDX_CNV) (void)fprintf(fp_out,"%*s%s(%ld) ",(idx == 0) ? prn_ndn : 0,spc_sng,dim[dmn_idx].nm,dmn_sbs_dsk[dmn_idx]+1L); else (void)fprintf(fp_out,"%*s%s[%ld] ",(idx == 0) ? prn_ndn : 0,spc_sng,dim[dmn_idx].nm,dmn_sbs_dsk[dmn_idx]);
             } /* !PRN_DMN_VAR_NM */
             continue;
           } /* end if */
@@ -2276,38 +2294,38 @@ nco_prn_var_val_trv /* [fnc] Print variable data (GTT version) */
 	  } /* !unit_cln_crd */
           if(prn_flg->PRN_DMN_VAR_NM){
             switch(dim[dmn_idx].type){
-            case NC_FLOAT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.fp[crd_idx_crr]); break;
-            case NC_DOUBLE: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.dp[crd_idx_crr]); break;
-            case NC_SHORT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.sp[crd_idx_crr]); break;
-            case NC_INT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.ip[crd_idx_crr]); break;
+            case NC_FLOAT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.fp[crd_idx_crr]); break;
+            case NC_DOUBLE: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.dp[crd_idx_crr]); break;
+            case NC_SHORT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.sp[crd_idx_crr]); break;
+            case NC_INT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.ip[crd_idx_crr]); break;
             case NC_CHAR:
-	      if(unit_cln_crd) (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,crd_sng_lgb); else (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.cp[crd_idx_crr]);
+	      if(unit_cln_crd) (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,crd_sng_lgb); else (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.cp[crd_idx_crr]);
 	      break;
-	    case NC_BYTE: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,(unsigned char)dim[dmn_idx].val.bp[crd_idx_crr]); break;
-            case NC_UBYTE: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.ubp[crd_idx_crr]); break;
-            case NC_USHORT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.usp[crd_idx_crr]); break;
-            case NC_UINT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.uip[crd_idx_crr]); break;
-            case NC_INT64: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.i64p[crd_idx_crr]); break;
-            case NC_UINT64: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.ui64p[crd_idx_crr]); break;
-            case NC_STRING: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.sngp[crd_idx_crr]); break;
+	    case NC_BYTE: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,(unsigned char)dim[dmn_idx].val.bp[crd_idx_crr]); break;
+            case NC_UBYTE: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.ubp[crd_idx_crr]); break;
+            case NC_USHORT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.usp[crd_idx_crr]); break;
+            case NC_UINT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.uip[crd_idx_crr]); break;
+            case NC_INT64: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.i64p[crd_idx_crr]); break;
+            case NC_UINT64: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.ui64p[crd_idx_crr]); break;
+            case NC_STRING: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].nm,dmn_sbs_prn,dim[dmn_idx].val.sngp[crd_idx_crr]); break;
             default: nco_dfl_case_nc_type_err(); break;
             } /* end switch */
           }else{ /* !PRN_DMN_VAR_NM */
             switch(dim[dmn_idx].type){
-            case NC_FLOAT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.fp[crd_idx_crr]); break;
-            case NC_DOUBLE: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.dp[crd_idx_crr]); break;
-            case NC_SHORT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.sp[crd_idx_crr]); break;
-            case NC_INT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.ip[crd_idx_crr]); break;
+            case NC_FLOAT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.fp[crd_idx_crr]); break;
+            case NC_DOUBLE: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.dp[crd_idx_crr]); break;
+            case NC_SHORT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.sp[crd_idx_crr]); break;
+            case NC_INT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.ip[crd_idx_crr]); break;
             case NC_CHAR:
-	      if(unit_cln_crd) (void)fprintf(stdout,dmn_sng,crd_sng_lgb); else (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.cp[crd_idx_crr]);
+	      if(unit_cln_crd) (void)fprintf(fp_out,dmn_sng,crd_sng_lgb); else (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.cp[crd_idx_crr]);
 	      break;
-            case NC_BYTE: (void)fprintf(stdout,dmn_sng,(unsigned char)dim[dmn_idx].val.bp[crd_idx_crr]); break;
-            case NC_UBYTE: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.ubp[crd_idx_crr]); break;
-            case NC_USHORT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.usp[crd_idx_crr]); break;
-            case NC_UINT: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.uip[crd_idx_crr]); break;
-            case NC_INT64: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.i64p[crd_idx_crr]); break;
-            case NC_UINT64: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.ui64p[crd_idx_crr]); break;
-            case NC_STRING: (void)fprintf(stdout,dmn_sng,dim[dmn_idx].val.sngp[crd_idx_crr]); break;
+            case NC_BYTE: (void)fprintf(fp_out,dmn_sng,(unsigned char)dim[dmn_idx].val.bp[crd_idx_crr]); break;
+            case NC_UBYTE: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.ubp[crd_idx_crr]); break;
+            case NC_USHORT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.usp[crd_idx_crr]); break;
+            case NC_UINT: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.uip[crd_idx_crr]); break;
+            case NC_INT64: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.i64p[crd_idx_crr]); break;
+            case NC_UINT64: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.ui64p[crd_idx_crr]); break;
+            case NC_STRING: (void)fprintf(fp_out,dmn_sng,dim[dmn_idx].val.sngp[crd_idx_crr]); break;
             default: nco_dfl_case_nc_type_err(); break;
             } /* end switch */
           } /* !PRN_DMN_VAR_NM */
@@ -2356,9 +2374,9 @@ lbl_chr_prn:
             var_dsk_srt++; 
             var_dsk_end++; 
           } /* end if */
-          (void)fprintf(stdout,var_sng,var_nm,var_dsk_srt,var_dsk_end,prn_sng,unit_sng_var);
-          (void)fprintf(stdout,"\n");
-          (void)fflush(stdout);
+          (void)fprintf(fp_out,var_sng,var_nm,var_dsk_srt,var_dsk_end,prn_sng,unit_sng_var);
+          (void)fprintf(fp_out,"\n");
+          (void)fflush(fp_out);
           (void)nco_free(prn_sng);
         } /* endif */
         continue;
@@ -2372,45 +2390,45 @@ lbl_chr_prn:
       } /* end if FORTRAN_IDX_CNV */
 
       if(prn_flg->PRN_MSS_VAL_BLANK && is_mss_val){
-        if(prn_flg->PRN_DMN_VAR_NM) (void)fprintf(stdout,"%*s%s%s%ld%s=%s %s\n",(var_trv->is_crd_var) ? prn_ndn : 0,spc_sng,var_nm,prn_flg->FORTRAN_IDX_CNV ? "(" : "[",var_dsk,prn_flg->FORTRAN_IDX_CNV ? ")" : "]",mss_val_sng,unit_sng_var); else (void)fprintf(stdout,"%*s%s\n",(var_trv->is_crd_var) ? prn_ndn : 0,spc_sng,mss_val_sng); 
+        if(prn_flg->PRN_DMN_VAR_NM) (void)fprintf(fp_out,"%*s%s%s%ld%s=%s %s\n",(var_trv->is_crd_var) ? prn_ndn : 0,spc_sng,var_nm,prn_flg->FORTRAN_IDX_CNV ? "(" : "[",var_dsk,prn_flg->FORTRAN_IDX_CNV ? ")" : "]",mss_val_sng,unit_sng_var); else (void)fprintf(fp_out,"%*s%s\n",(var_trv->is_crd_var) ? prn_ndn : 0,spc_sng,mss_val_sng); 
       }else{ /* !is_mss_val */
         if(prn_flg->PRN_DMN_VAR_NM){
           switch(var->type){
-          case NC_FLOAT: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.fp[lmn],unit_sng_var); break;
-          case NC_DOUBLE: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.dp[lmn],unit_sng_var); break;
-          case NC_SHORT: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.sp[lmn],unit_sng_var); break;
-          case NC_INT: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.ip[lmn],unit_sng_var); break;
-          case NC_CHAR: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.cp[lmn],unit_sng_var); break;
-          case NC_BYTE: (void)fprintf(stdout,var_sng,var_nm,var_dsk,(unsigned char)var->val.bp[lmn],unit_sng_var); break;
-          case NC_UBYTE: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.ubp[lmn],unit_sng_var); break;
-          case NC_USHORT: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.usp[lmn],unit_sng_var); break;
-          case NC_UINT: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.uip[lmn],unit_sng_var); break;
-          case NC_INT64: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.i64p[lmn],unit_sng_var); break;
-          case NC_UINT64: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.ui64p[lmn],unit_sng_var); break;
-          case NC_STRING: (void)fprintf(stdout,var_sng,var_nm,var_dsk,var->val.sngp[lmn],unit_sng_var); break;
+          case NC_FLOAT: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.fp[lmn],unit_sng_var); break;
+          case NC_DOUBLE: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.dp[lmn],unit_sng_var); break;
+          case NC_SHORT: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.sp[lmn],unit_sng_var); break;
+          case NC_INT: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.ip[lmn],unit_sng_var); break;
+          case NC_CHAR: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.cp[lmn],unit_sng_var); break;
+          case NC_BYTE: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,(unsigned char)var->val.bp[lmn],unit_sng_var); break;
+          case NC_UBYTE: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.ubp[lmn],unit_sng_var); break;
+          case NC_USHORT: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.usp[lmn],unit_sng_var); break;
+          case NC_UINT: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.uip[lmn],unit_sng_var); break;
+          case NC_INT64: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.i64p[lmn],unit_sng_var); break;
+          case NC_UINT64: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.ui64p[lmn],unit_sng_var); break;
+          case NC_STRING: (void)fprintf(fp_out,var_sng,var_nm,var_dsk,var->val.sngp[lmn],unit_sng_var); break;
           default: nco_dfl_case_nc_type_err(); break;
           } /* end switch */
         }else{ /* !PRN_DMN_VAR_NM */
           switch(var->type){
-          case NC_FLOAT: (void)fprintf(stdout,var_sng,var->val.fp[lmn],unit_sng_var); break;
-          case NC_DOUBLE: (void)fprintf(stdout,var_sng,var->val.dp[lmn],unit_sng_var); break;
-          case NC_SHORT: (void)fprintf(stdout,var_sng,var->val.sp[lmn],unit_sng_var); break;
-          case NC_INT: (void)fprintf(stdout,var_sng,var->val.ip[lmn],unit_sng_var); break;
-          case NC_CHAR: (void)fprintf(stdout,var_sng,var->val.cp[lmn],unit_sng_var); break;
-          case NC_BYTE: (void)fprintf(stdout,var_sng,(unsigned char)var->val.bp[lmn],unit_sng_var); break;
-          case NC_UBYTE: (void)fprintf(stdout,var_sng,var->val.ubp[lmn],unit_sng_var); break;
-          case NC_USHORT: (void)fprintf(stdout,var_sng,var->val.usp[lmn],unit_sng_var); break;
-          case NC_UINT: (void)fprintf(stdout,var_sng,var->val.uip[lmn],unit_sng_var); break;
-          case NC_INT64: (void)fprintf(stdout,var_sng,var->val.i64p[lmn],unit_sng_var); break;
-          case NC_UINT64: (void)fprintf(stdout,var_sng,var->val.ui64p[lmn],unit_sng_var); break;
-          case NC_STRING: (void)fprintf(stdout,var_sng,var->val.sngp[lmn],unit_sng_var); break;
+          case NC_FLOAT: (void)fprintf(fp_out,var_sng,var->val.fp[lmn],unit_sng_var); break;
+          case NC_DOUBLE: (void)fprintf(fp_out,var_sng,var->val.dp[lmn],unit_sng_var); break;
+          case NC_SHORT: (void)fprintf(fp_out,var_sng,var->val.sp[lmn],unit_sng_var); break;
+          case NC_INT: (void)fprintf(fp_out,var_sng,var->val.ip[lmn],unit_sng_var); break;
+          case NC_CHAR: (void)fprintf(fp_out,var_sng,var->val.cp[lmn],unit_sng_var); break;
+          case NC_BYTE: (void)fprintf(fp_out,var_sng,(unsigned char)var->val.bp[lmn],unit_sng_var); break;
+          case NC_UBYTE: (void)fprintf(fp_out,var_sng,var->val.ubp[lmn],unit_sng_var); break;
+          case NC_USHORT: (void)fprintf(fp_out,var_sng,var->val.usp[lmn],unit_sng_var); break;
+          case NC_UINT: (void)fprintf(fp_out,var_sng,var->val.uip[lmn],unit_sng_var); break;
+          case NC_INT64: (void)fprintf(fp_out,var_sng,var->val.i64p[lmn],unit_sng_var); break;
+          case NC_UINT64: (void)fprintf(fp_out,var_sng,var->val.ui64p[lmn],unit_sng_var); break;
+          case NC_STRING: (void)fprintf(fp_out,var_sng,var->val.sngp[lmn],unit_sng_var); break;
           default: nco_dfl_case_nc_type_err(); break;
           } /* end switch */
         } /* !PRN_DMN_VAR_NM */
       } /* !is_mss_val */
     } /* end loop over elements */
 
-    (void)fflush(stdout);
+    (void)fflush(fp_out);
 
     /* Clean-up information for multi-dimensional arrays */
     for(int idx=0;idx<var->nbr_dim;idx++) if(dim[idx].val.vp) dim[idx].val.vp=nco_free(dim[idx].val.vp);
@@ -2436,10 +2454,8 @@ lbl_chr_prn:
 
   if(flg_malloc_unit_crd) unit_sng_crd=(char *)nco_free(unit_sng_crd);
   if(flg_malloc_unit_var) unit_sng_var=(char *)nco_free(unit_sng_var);
-
   if(dlm_sng) dlm_sng=(char *)nco_free(dlm_sng);
-
-  if(prn_flg->nwl_pst_val) (void)fprintf(stdout,"\n");
+  if(prn_flg->nwl_pst_val) (void)fprintf(fp_out,"\n");
 
   /* Free (allocated for non scalars only) */
   if(var->nbr_dim > 0){
@@ -2448,7 +2464,6 @@ lbl_chr_prn:
   } /* endif */
 
   var=nco_var_free(var);
-  /* free var_aux */
   if(var_aux) var_aux=nco_var_free(var_aux);
 
 } /* end nco_prn_var_val_trv() */
@@ -2480,6 +2495,8 @@ nco_grp_prn /* [fnc] Recursively print group contents */
   char *nm_jsn;
   char *var_nm_fll;                /* [sng] Full path for variable */
 
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   int *grp_ids;                    /* [ID] Sub-group IDs array */  
 
   int dmn_idx_grp[NC_MAX_DIMS];    /* [ID] Dimension indices array for group */ 
@@ -2556,49 +2573,49 @@ nco_grp_prn /* [fnc] Recursively print group contents */
 
   if(XML){
     if(grp_dpt == 0){
-      if(prn_flg->xml_lcn) (void)fprintf(stdout,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\" location=\"%s\">\n",prn_flg->fl_in); else (void)fprintf(stdout,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\">\n");
-      if(prn_flg->nfo_xtr) (void)fprintf(stdout,"%*s<!-- %s -->\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
+      if(prn_flg->xml_lcn) (void)fprintf(fp_out,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\" location=\"%s\">\n",prn_flg->fl_in); else (void)fprintf(fp_out,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\">\n");
+      if(prn_flg->nfo_xtr) (void)fprintf(fp_out,"%*s<!-- %s -->\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
     }else{ /* grp_dpt != 0 */
-      (void)fprintf(stdout,"%*s<group name=\"%s\">\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,trv_tbl->lst[obj_idx].nm);
+      (void)fprintf(fp_out,"%*s<group name=\"%s\">\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,trv_tbl->lst[obj_idx].nm);
     } /* grp_dpt != 0 */
   }else if(SRM){ /* !xml */
     /* https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/stream/NcStream.html */
   }else if(CDL_OR_TRD){ /* !xml */
     nm_cdl=nm2sng_cdl(nco_gpe_evl_stb(prn_flg->gpe,trv_tbl->lst[obj_idx].nm_fll));
-    if(grp_dpt == 0 && CDL) (void)fprintf(stdout,"netcdf %s {",prn_flg->fl_stb); else (void)fprintf(stdout,"%*sgroup: %s {",grp_dpt*prn_flg->spc_per_lvl,spc_sng,nm_cdl);
+    if(grp_dpt == 0 && CDL) (void)fprintf(fp_out,"netcdf %s {",prn_flg->fl_stb); else (void)fprintf(fp_out,"%*sgroup: %s {",grp_dpt*prn_flg->spc_per_lvl,spc_sng,nm_cdl);
     nm_cdl=(char *)nco_free(nm_cdl);
-    if(prn_flg->fll_pth) (void)fprintf(stdout," // fullname: %s\n",nco_gpe_evl(prn_flg->gpe,grp_nm_fll)); else (void)fprintf(stdout,"\n");
-    if(grp_dpt == 0 && prn_flg->nfo_xtr && prn_flg->PRN_GLB_METADATA) (void)fprintf(stdout,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
-    if(grp_dpt == 0 && prn_flg->nfo_xtr) (void)fprintf(stdout,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_fl_sz_sng);
-    if(grp_dpt == 0 && prn_flg->nfo_xtr) (void)fprintf(stdout,"%*s// %sncgen -k %s -b -o %s.nc %s.cdl\n",prn_flg->sxn_fst,spc_sng,prn_flg->PRN_GLB_METADATA ? "Generate binary file: " : "",nco_fmt_hdn_sng(prn_flg->fl_out_fmt),prn_flg->fl_stb,prn_flg->fl_stb);
+    if(prn_flg->fll_pth) (void)fprintf(fp_out," // fullname: %s\n",nco_gpe_evl(prn_flg->gpe,grp_nm_fll)); else (void)fprintf(fp_out,"\n");
+    if(grp_dpt == 0 && prn_flg->nfo_xtr && prn_flg->PRN_GLB_METADATA) (void)fprintf(fp_out,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
+    if(grp_dpt == 0 && prn_flg->nfo_xtr) (void)fprintf(fp_out,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_fl_sz_sng);
+    if(grp_dpt == 0 && prn_flg->nfo_xtr) (void)fprintf(fp_out,"%*s// %sncgen -k %s -b -o %s.nc %s.cdl\n",prn_flg->sxn_fst,spc_sng,prn_flg->PRN_GLB_METADATA ? "Generate binary file: " : "",nco_fmt_hdn_sng(prn_flg->fl_out_fmt),prn_flg->fl_stb,prn_flg->fl_stb);
   }else if(JSN){
     nm_jsn=nm2sng_jsn(nco_gpe_evl_stb(prn_flg->gpe,trv_tbl->lst[obj_idx].nm_fll));
     /* JSN print main opening brace */
-    if(grp_dpt==0) (void)fprintf(stdout,"{\n"); else (void)fprintf(stdout,"%*s\"%s\": {\n",prn_flg->sxn_fst+grp_dpt*prn_flg->spc_per_lvl,spc_sng,nm_jsn);
+    if(grp_dpt==0) (void)fprintf(fp_out,"{\n"); else (void)fprintf(fp_out,"%*s\"%s\": {\n",prn_flg->sxn_fst+grp_dpt*prn_flg->spc_per_lvl,spc_sng,nm_jsn);
     nm_jsn=(char *)nco_free(nm_jsn);  
   } /* !JSN */
   
   /* Print dimension information for group */
   prn_ndn=prn_flg->ndn=prn_flg->sxn_fst+grp_dpt*prn_flg->spc_per_lvl;
-  if(dmn_nbr > 0 && CDL_OR_TRD) (void)fprintf(stdout,"%*sdimensions:\n",prn_flg->ndn,spc_sng); 
-  if(dmn_nbr > 0 && JSN) (void)fprintf(stdout,"%*s\"dimensions\": {\n",prn_flg->ndn,spc_sng);
+  if(dmn_nbr > 0 && CDL_OR_TRD) (void)fprintf(fp_out,"%*sdimensions:\n",prn_flg->ndn,spc_sng); 
+  if(dmn_nbr > 0 && JSN) (void)fprintf(fp_out,"%*s\"dimensions\": {\n",prn_flg->ndn,spc_sng);
   if(CDL||JSN) prn_ndn+=prn_flg->var_fst;
   for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++){
     if(XML){
-      (void)fprintf(stdout,"%*s<dimension name=\"%s\" length=\"%lu\" %s/>\n",prn_ndn,spc_sng,dmn_lst[dmn_idx].nm,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn ? "isUnlimited=\"true\" " : "");
+      (void)fprintf(fp_out,"%*s<dimension name=\"%s\" length=\"%lu\" %s/>\n",prn_ndn,spc_sng,dmn_lst[dmn_idx].nm,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn ? "isUnlimited=\"true\" " : "");
     }else if(CDL_OR_TRD){ /* !XML */
       nm_cdl=nm2sng_cdl(dmn_lst[dmn_idx].nm);
-      if(trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn) (void)fprintf(stdout,"%*s%s = UNLIMITED%s// (%lu currently)\n",prn_ndn,spc_sng,nm_cdl,(CDL) ? " ; " : " ",(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt); else (void)fprintf(stdout,"%*s%s = %lu%s\n",prn_ndn,spc_sng,nm_cdl,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,(CDL) ? " ;" : "");
+      if(trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn) (void)fprintf(fp_out,"%*s%s = UNLIMITED%s// (%lu currently)\n",prn_ndn,spc_sng,nm_cdl,(CDL) ? " ; " : " ",(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt); else (void)fprintf(fp_out,"%*s%s = %lu%s\n",prn_ndn,spc_sng,nm_cdl,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,(CDL) ? " ;" : "");
       nm_cdl=(char *)nco_free(nm_cdl);
     } /* !XML */
     if(JSN){ 
       nm_jsn=nm2sng_jsn(dmn_lst[dmn_idx].nm);
-      (void)fprintf(stdout,"%*s\"%s\": %lu",prn_ndn,spc_sng,nm_jsn,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt);   
+      (void)fprintf(fp_out,"%*s\"%s\": %lu",prn_ndn,spc_sng,nm_jsn,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt);   
       /* Add comma and carriage-return unless last element */
-      if(dmn_idx<dmn_nbr-1) (void)printf(",\n");
+      if(dmn_idx<dmn_nbr-1) (void)fprintf(fp_out,",\n");
       else{  
         prn_ndn-=prn_flg->var_fst;
-	(void)printf("\n%*s}",prn_ndn,spc_sng);         
+	(void)fprintf(fp_out,"\n%*s}",prn_ndn,spc_sng);         
       } /* !dmn_idx */
        
       nm_jsn=(char *)nco_free(nm_jsn);   
@@ -2658,10 +2675,10 @@ nco_grp_prn /* [fnc] Recursively print group contents */
   if(var_nbr_xtr > 1) var_lst=nco_lst_srt_nm_id(var_lst,var_nbr_xtr,prn_flg->ALPHA_BY_STUB_GROUP);
     
 
-  // if(JSN) (void)fprintf(stdout,"{\n");
+  // if(JSN) (void)fprintf(fp_out,"{\n");
 
   /* Print variable information for group */
-  if(var_nbr_xtr > 0 && CDL_OR_TRD) (void)fprintf(stdout,"\n%*svariables:\n",prn_flg->ndn,spc_sng);
+  if(var_nbr_xtr > 0 && CDL_OR_TRD) (void)fprintf(fp_out,"\n%*svariables:\n",prn_flg->ndn,spc_sng);
 
   for(var_idx=0;var_idx<var_nbr_xtr;var_idx++){
     trv_sct var_trv=trv_tbl->lst[var_lst[var_idx].id];
@@ -2669,7 +2686,7 @@ nco_grp_prn /* [fnc] Recursively print group contents */
     (void)nco_inq_varid(grp_id,var_trv.nm,&var_id);
 
     /* Print variable full name */
-    if(var_trv.grp_dpt > 0 && prn_flg->fll_pth && TRD) (void)fprintf(stdout,"%*s%s\n",prn_flg->ndn,spc_sng,var_trv.nm_fll);
+    if(var_trv.grp_dpt > 0 && prn_flg->fll_pth && TRD) (void)fprintf(fp_out,"%*s%s\n",prn_flg->ndn,spc_sng,var_trv.nm_fll);
 
     /* NB: CDL and TRD place data in seperate tag, while XML and JSN place data in same tag as metadata */  
    
@@ -2680,28 +2697,25 @@ nco_grp_prn /* [fnc] Recursively print group contents */
       /* nco_prn_att() prints final brace but no return, as we may need to add a comma */ 
       if(prn_flg->PRN_VAR_METADATA) (void)nco_prn_att(grp_id,prn_flg,var_id);
            
-      if((CDL || TRD) && var_idx != var_nbr_xtr-1) (void)fprintf(stdout,"\n"); 
+      if((CDL || TRD) && var_idx != var_nbr_xtr-1) (void)fprintf(fp_out,"\n"); 
     } /* !CDL_OR_TRD */
 
     /* All options can toggle printing of data-  only JSN and XML place data "inside" var markup */ 
     if(XML){
       (void)nco_prn_var_dfn(nc_id,prn_flg,&var_trv); 
       
-      if( prn_flg->PRN_VAR_METADATA )  
-        (void)nco_prn_att(grp_id,prn_flg,var_id);
+      if(prn_flg->PRN_VAR_METADATA) (void)nco_prn_att(grp_id,prn_flg,var_id);
    
-
-      if( prn_flg->PRN_VAR_DATA) 
-        (void)nco_prn_var_val_trv(nc_id,prn_flg,&trv_tbl->lst[var_lst[var_idx].id],trv_tbl);
+      if(prn_flg->PRN_VAR_DATA) (void)nco_prn_var_val_trv(nc_id,prn_flg,&trv_tbl->lst[var_lst[var_idx].id],trv_tbl);
       /* XML close variable tag */
-      (void)fprintf(stdout,"%*s</variable>\n",prn_ndn,spc_sng);
-    }  
+      (void)fprintf(fp_out,"%*s</variable>\n",prn_ndn,spc_sng);
+    } /* !XML */
 
     if(JSN){ 
       /* Deal with first iteration */   
       if(var_idx == 0){ 
-        if(JSN_BLOCK) (void)fprintf(stdout,",\n"); else JSN_BLOCK=True;              
-        (void)fprintf(stdout,"%*s\"variables\": {\n",prn_flg->ndn,spc_sng);
+        if(JSN_BLOCK) (void)fprintf(fp_out,",\n"); else JSN_BLOCK=True;              
+        (void)fprintf(fp_out,"%*s\"variables\": {\n",prn_flg->ndn,spc_sng);
       } /* !var_idx */
         
       /* DOES NOT include a return as we may wanna add a COMMA */
@@ -2710,51 +2724,51 @@ nco_grp_prn /* [fnc] Recursively print group contents */
 
       /* nco_prn_att() prints final brace though not return, as we may need to add a comma */ 
       if(prn_flg->PRN_VAR_METADATA  && nco_att_nbr(grp_id,var_id) > 0){
-        (void)fprintf(stdout,",\n");            
+        (void)fprintf(fp_out,",\n");            
         (void)nco_prn_att(grp_id,prn_flg,var_id);
       } /* !nco_att_nbr */
         
       if(prn_flg->PRN_VAR_DATA){  
-        (void)fprintf(stdout,",\n");  
+        (void)fprintf(fp_out,",\n");  
         (void)nco_prn_var_val_trv(nc_id,prn_flg,&trv_tbl->lst[var_lst[var_idx].id],trv_tbl);      
       }else{
-        (void)fprintf(stdout,"\n");        
+        (void)fprintf(fp_out,"\n");        
       } /* !PRN_VAR_DATA */
 
       /* Close JSON object tag, do not add return as we may need to add comma later */
-      (void)fprintf(stdout,"%*s}%s",prn_flg->ndn,spc_sng,(var_idx<var_nbr_xtr-1) ? ",\n" : "\n");
+      (void)fprintf(fp_out,"%*s}%s",prn_flg->ndn,spc_sng,(var_idx<var_nbr_xtr-1) ? ",\n" : "\n");
       /* special indents for jsn */
       prn_flg->ndn-=prn_flg->sxn_fst;  
     }
    } /* end loop over var_idx */
 
   /* close out json variable tag */
-  if(JSN && var_nbr_xtr > 0) (void)fprintf(stdout,"%*s}",prn_flg->ndn,spc_sng);
+  if(JSN && var_nbr_xtr > 0) (void)fprintf(fp_out,"%*s}",prn_flg->ndn,spc_sng);
 
   /* Print attribute information for group 
-  if((nbr_att > 0 || (prn_flg->hdn && grp_dpt == 0)) && prn_flg->PRN_GLB_METADATA && CDL_OR_TRD) (void)fprintf(stdout,"\n%*s%s%sattributes:\n",prn_flg->ndn,spc_sng,(CDL) ? "// " : "",(grp_dpt == 0) ? "global " : "group ");
+  if((nbr_att > 0 || (prn_flg->hdn && grp_dpt == 0)) && prn_flg->PRN_GLB_METADATA && CDL_OR_TRD) (void)fprintf(fp_out,"\n%*s%s%sattributes:\n",prn_flg->ndn,spc_sng,(CDL) ? "// " : "",(grp_dpt == 0) ? "global " : "group ");
   if((nbr_att > 0 || (prn_flg->hdn && grp_dpt == 0)) && prn_flg->PRN_GLB_METADATA){ 
-     (void)fprintf(stdout,",\n");          
+     (void)fprintf(fp_out,",\n");          
      nco_prn_att(grp_id,prn_flg,NC_GLOBAL);
   }else{
-     (void)fprintf(stdout,"\n");           
+     (void)fprintf(fp_out,"\n");           
      } */
 
   if((nbr_att > 0 || (prn_flg->hdn && grp_dpt == 0)) && prn_flg->PRN_GLB_METADATA){
     if(CDL || TRD){ 
-      (void)fprintf(stdout,"\n%*s%s%sattributes:\n",prn_flg->ndn,spc_sng,(CDL) ? "// " : "",(grp_dpt == 0) ? "global " : "group ");
+      (void)fprintf(fp_out,"\n%*s%s%sattributes:\n",prn_flg->ndn,spc_sng,(CDL) ? "// " : "",(grp_dpt == 0) ? "global " : "group ");
       nco_prn_att(grp_id,prn_flg,NC_GLOBAL);
     }
     if(XML) nco_prn_att(grp_id,prn_flg,NC_GLOBAL);
     if(JSN && nco_att_nbr(grp_id,NC_GLOBAL) > 0){
-      if(JSN_BLOCK) (void)fprintf(stdout,",\n"); else JSN_BLOCK=True;              
+      if(JSN_BLOCK) (void)fprintf(fp_out,",\n"); else JSN_BLOCK=True;              
       nco_prn_att(grp_id,prn_flg,NC_GLOBAL);
     }
   }  
 
   /* Print data for group only CDL and TRD have a separate data block*/
   if( (CDL||TRD) && var_nbr_xtr > 0 && prn_flg->PRN_VAR_DATA){
-    (void)fprintf(stdout,"\n%*sdata:\n",prn_flg->ndn,spc_sng);
+    (void)fprintf(fp_out,"\n%*sdata:\n",prn_flg->ndn,spc_sng);
     for(var_idx=0;var_idx<var_nbr_xtr;var_idx++) (void)nco_prn_var_val_trv(nc_id,prn_flg,&trv_tbl->lst[var_lst[var_idx].id],trv_tbl);
   } /* end if */
 
@@ -2765,7 +2779,7 @@ nco_grp_prn /* [fnc] Recursively print group contents */
   grp_ids=(int *)nco_malloc(nbr_grp*sizeof(int)); 
   rcd+=nco_inq_grps(grp_id,(int *)NULL,grp_ids);
 
-  //if(JSN && prn_flg->PRN_GLB_METADATA) (void)fprintf(stdout,"\"nodes\": [");
+  //if(JSN && prn_flg->PRN_GLB_METADATA) (void)fprintf(fp_out,"\"nodes\": [");
 
   /* Recursive block for evrything else */
   if(!JSN){
@@ -2806,8 +2820,8 @@ nco_grp_prn /* [fnc] Recursively print group contents */
   }else{
     int nbr_grp_xtr=0;   
     if(nbr_grp > 0){  
-      if(JSN_BLOCK) (void)fprintf(stdout,",\n"); 
-      (void)fprintf(stdout,"%*s\"groups\": {\n",prn_ndn,spc_sng);       
+      if(JSN_BLOCK) (void)fprintf(fp_out,",\n"); 
+      (void)fprintf(fp_out,"%*s\"groups\": {\n",prn_ndn,spc_sng);       
       JSN_BLOCK=True; 
     }
 
@@ -2820,9 +2834,9 @@ nco_grp_prn /* [fnc] Recursively print group contents */
       rcd+=nco_inq_grpname(gid,grp_nm);
 
       /* if(grp_idx>0) */
-      /* 	  (void)fprintf(stdout,"\n");  */
+      /* 	  (void)fprintf(fp_out,"\n");  */
       /* else */
-      /* 	(void)fprintf(stdout,"%*s\"%s\":{\n",prn_ndn,spc_sng,grp_nm); */
+      /* 	(void)fprintf(fp_out,"%*s\"%s\":{\n",prn_ndn,spc_sng,grp_nm); */
 
       /* Allocate path buffer including space for trailing NUL */ 
       sub_grp_nm_fll=(char *)nco_malloc(strlen(grp_nm_fll)+strlen(grp_nm)+2L);
@@ -2844,7 +2858,7 @@ nco_grp_prn /* [fnc] Recursively print group contents */
     
       /* Is sub-group to be extracted? If so, recurse */
       if(trv_tbl->lst[obj_idx].flg_xtr){ 
-        if(nbr_grp_xtr++ > 0) (void)fprintf(stdout,",\n"); 
+        if(nbr_grp_xtr++ > 0) (void)fprintf(fp_out,",\n"); 
         rcd+=nco_grp_prn(nc_id,sub_grp_nm_fll,prn_flg,trv_tbl);
       } 
 
@@ -2854,15 +2868,15 @@ nco_grp_prn /* [fnc] Recursively print group contents */
   }
 
   /* if JSN then print closing tag to group */
-  if(JSN && nbr_grp > 0) (void)fprintf(stdout,"\n%*s}",prn_ndn,spc_sng);
+  if(JSN && nbr_grp > 0) (void)fprintf(fp_out,"\n%*s}",prn_ndn,spc_sng);
 
   /* Mark end of output */
-  if(CDL_OR_TRD) (void)fprintf(stdout,"%*s} // group %s\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,(grp_dpt == 0) ? grp_nm_fll : nm2sng_cdl(nco_gpe_evl(prn_flg->gpe,grp_nm_fll)));
-  if(JSN && grp_dpt ==0) (void)fprintf(stdout,"\n}\n"); 
-  // if(JSN && grp_dpt >0) (void)fprintf(stdout,"\n%*s}",prn_ndn,spc_sng); 
-  if(JSN && grp_dpt >0) (void)fprintf(stdout,"\n%*s}", prn_flg->sxn_fst+grp_dpt*prn_flg->spc_per_lvl,spc_sng);
-  if(XML && grp_dpt == 0) (void)fprintf(stdout,"</netcdf>\n"); 
-  if(XML && grp_dpt != 0) (void)fprintf(stdout,"%*s</group>\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng); 
+  if(CDL_OR_TRD) (void)fprintf(fp_out,"%*s} // group %s\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,(grp_dpt == 0) ? grp_nm_fll : nm2sng_cdl(nco_gpe_evl(prn_flg->gpe,grp_nm_fll)));
+  if(JSN && grp_dpt ==0) (void)fprintf(fp_out,"\n}\n"); 
+  // if(JSN && grp_dpt >0) (void)fprintf(fp_out,"\n%*s}",prn_ndn,spc_sng); 
+  if(JSN && grp_dpt >0) (void)fprintf(fp_out,"\n%*s}", prn_flg->sxn_fst+grp_dpt*prn_flg->spc_per_lvl,spc_sng);
+  if(XML && grp_dpt == 0) (void)fprintf(fp_out,"</netcdf>\n"); 
+  if(XML && grp_dpt != 0) (void)fprintf(fp_out,"%*s</group>\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng); 
 
   return rcd;
 } /* end nco_grp_prn() */
@@ -2893,6 +2907,8 @@ nco_prn_cdl_trd /* [fnc] Recursively print group contents */
   char *nm_cdl;
   char *var_nm_fll;                /* [sng] Full path for variable */
 
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   int *grp_ids;                    /* [ID] Sub-group IDs array */  
 
   int dmn_idx_grp[NC_MAX_DIMS];    /* [ID] Dimension indices array for group */ 
@@ -2963,21 +2979,21 @@ nco_prn_cdl_trd /* [fnc] Recursively print group contents */
   if(dmn_nbr > 1) dmn_lst=nco_lst_srt_nm_id(dmn_lst,dmn_nbr,prn_flg->ALPHA_BY_STUB_GROUP);
 
   nm_cdl=nm2sng_cdl(nco_gpe_evl_stb(prn_flg->gpe,trv_tbl->lst[obj_idx].nm_fll));
-  if(grp_dpt == 0 && CDL) (void)fprintf(stdout,"netcdf %s {",prn_flg->fl_stb); else (void)fprintf(stdout,"%*sgroup: %s {",grp_dpt*prn_flg->spc_per_lvl,spc_sng,nm_cdl);
+  if(grp_dpt == 0 && CDL) (void)fprintf(fp_out,"netcdf %s {",prn_flg->fl_stb); else (void)fprintf(fp_out,"%*sgroup: %s {",grp_dpt*prn_flg->spc_per_lvl,spc_sng,nm_cdl);
   nm_cdl=(char *)nco_free(nm_cdl);
-  if(prn_flg->fll_pth) (void)fprintf(stdout," // fullname: %s\n",nco_gpe_evl(prn_flg->gpe,grp_nm_fll)); else (void)fprintf(stdout,"\n");
-  if(grp_dpt == 0 && prn_flg->nfo_xtr && prn_flg->PRN_GLB_METADATA) (void)fprintf(stdout,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
-  if(grp_dpt == 0 && prn_flg->nfo_xtr && prn_flg->PRN_GLB_METADATA && nco_dbg_lvl_get() > nco_dbg_std) (void)fprintf(stdout,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_fl_sz_sng);
-  if(grp_dpt == 0 && prn_flg->nfo_xtr) (void)fprintf(stdout,"%*s// %sncgen -k %s -b -o %s.nc %s.cdl\n",prn_flg->sxn_fst,spc_sng,prn_flg->PRN_GLB_METADATA ? "Generate binary file from this CDL: " : "",nco_fmt_hdn_sng(prn_flg->fl_out_fmt),prn_flg->fl_stb,prn_flg->fl_stb);
+  if(prn_flg->fll_pth) (void)fprintf(fp_out," // fullname: %s\n",nco_gpe_evl(prn_flg->gpe,grp_nm_fll)); else (void)fprintf(fp_out,"\n");
+  if(grp_dpt == 0 && prn_flg->nfo_xtr && prn_flg->PRN_GLB_METADATA) (void)fprintf(fp_out,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
+  if(grp_dpt == 0 && prn_flg->nfo_xtr && prn_flg->PRN_GLB_METADATA && nco_dbg_lvl_get() > nco_dbg_std) (void)fprintf(fp_out,"%*s// %s\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_fl_sz_sng);
+  if(grp_dpt == 0 && prn_flg->nfo_xtr) (void)fprintf(fp_out,"%*s// %sncgen -k %s -b -o %s.nc %s.cdl\n",prn_flg->sxn_fst,spc_sng,prn_flg->PRN_GLB_METADATA ? "Generate binary file from this CDL: " : "",nco_fmt_hdn_sng(prn_flg->fl_out_fmt),prn_flg->fl_stb,prn_flg->fl_stb);
   
   /* Print dimension information for group */
   prn_ndn=prn_flg->ndn=prn_flg->sxn_fst+grp_dpt*prn_flg->spc_per_lvl;
-  if(dmn_nbr > 0 ) (void)fprintf(stdout,"%*sdimensions:\n",prn_flg->ndn,spc_sng); 
+  if(dmn_nbr > 0 ) (void)fprintf(fp_out,"%*sdimensions:\n",prn_flg->ndn,spc_sng); 
   if(CDL) prn_ndn+=prn_flg->var_fst;
 
   for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++){
      nm_cdl=nm2sng_cdl(dmn_lst[dmn_idx].nm);
-     if(trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn) (void)fprintf(stdout,"%*s%s = UNLIMITED%s// (%lu currently)\n",prn_ndn,spc_sng,nm_cdl,(CDL) ? " ; " : " ",(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt); else (void)fprintf(stdout,"%*s%s = %lu%s\n",prn_ndn,spc_sng,nm_cdl,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,(CDL) ? " ;" : "");
+     if(trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn) (void)fprintf(fp_out,"%*s%s = UNLIMITED%s// (%lu currently)\n",prn_ndn,spc_sng,nm_cdl,(CDL) ? " ; " : " ",(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt); else (void)fprintf(fp_out,"%*s%s = %lu%s\n",prn_ndn,spc_sng,nm_cdl,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,(CDL) ? " ;" : "");
       nm_cdl=(char *)nco_free(nm_cdl);
 
 
@@ -3036,7 +3052,7 @@ nco_prn_cdl_trd /* [fnc] Recursively print group contents */
     
 
   /* Print variable information for group */
-  if(var_nbr_xtr > 0 ) (void)fprintf(stdout,"\n%*svariables:\n",prn_flg->ndn,spc_sng);
+  if(var_nbr_xtr > 0 ) (void)fprintf(fp_out,"\n%*svariables:\n",prn_flg->ndn,spc_sng);
 
   for(var_idx=0;var_idx<var_nbr_xtr;var_idx++){
     trv_sct var_trv=trv_tbl->lst[var_lst[var_idx].id];
@@ -3044,7 +3060,7 @@ nco_prn_cdl_trd /* [fnc] Recursively print group contents */
     (void)nco_inq_varid(grp_id,var_trv.nm,&var_id);
 
     /* Print variable full name */
-    if(var_trv.grp_dpt > 0 && prn_flg->fll_pth && TRD) (void)fprintf(stdout,"%*s%s\n",prn_flg->ndn,spc_sng,var_trv.nm_fll);
+    if(var_trv.grp_dpt > 0 && prn_flg->fll_pth && TRD) (void)fprintf(fp_out,"%*s%s\n",prn_flg->ndn,spc_sng,var_trv.nm_fll);
 
     /* NB: CDL and TRD place data in seperate tag, while XML and JSN place data in same tag as metadata */  
     if(CDL || (TRD && prn_flg->PRN_VAR_METADATA)) (void)nco_prn_var_dfn(nc_id,prn_flg,&var_trv);
@@ -3052,17 +3068,17 @@ nco_prn_cdl_trd /* [fnc] Recursively print group contents */
     /* nco_prn_att() prints final brace but no return, as we may need to add a comma */ 
     if(prn_flg->PRN_VAR_METADATA) (void)nco_prn_att(grp_id,prn_flg,var_id);
            
-    if( var_idx != var_nbr_xtr-1) (void)fprintf(stdout,"\n"); 
+    if( var_idx != var_nbr_xtr-1) (void)fprintf(fp_out,"\n"); 
   } /* end loop over var_idx */
 
   if((nbr_att > 0 || (prn_flg->hdn && grp_dpt == 0)) && prn_flg->PRN_GLB_METADATA){
-    (void)fprintf(stdout,"\n%*s%s%sattributes:\n",prn_flg->ndn,spc_sng,(CDL) ? "// " : "",(grp_dpt == 0) ? "global " : "group ");
+    (void)fprintf(fp_out,"\n%*s%s%sattributes:\n",prn_flg->ndn,spc_sng,(CDL) ? "// " : "",(grp_dpt == 0) ? "global " : "group ");
     nco_prn_att(grp_id,prn_flg,NC_GLOBAL);
   }  
 
   /* Print data for group only CDL and TRD have a separate data block*/
   if( var_nbr_xtr > 0 && prn_flg->PRN_VAR_DATA){
-    (void)fprintf(stdout,"\n%*sdata:\n",prn_flg->ndn,spc_sng);
+    (void)fprintf(fp_out,"\n%*sdata:\n",prn_flg->ndn,spc_sng);
     for(var_idx=0;var_idx<var_nbr_xtr;var_idx++) (void)nco_prn_var_val_trv(nc_id,prn_flg,&trv_tbl->lst[var_lst[var_idx].id],trv_tbl);
   } /* end if */
 
@@ -3107,7 +3123,7 @@ nco_prn_cdl_trd /* [fnc] Recursively print group contents */
   } /* end loop over grp_idx */
   
   /* Mark end of output */
-  (void)fprintf(stdout,"%*s} // group %s\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,(grp_dpt == 0) ? grp_nm_fll : nm2sng_cdl(nco_gpe_evl(prn_flg->gpe,grp_nm_fll)));
+  (void)fprintf(fp_out,"%*s} // group %s\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,(grp_dpt == 0) ? grp_nm_fll : nm2sng_cdl(nco_gpe_evl(prn_flg->gpe,grp_nm_fll)));
   return rcd;
 } /* end nco_grp_prn_cdl_trd() */
 
@@ -3135,6 +3151,9 @@ nco_prn_xml /* [fnc] Recursively print group contents */
   char var_nm[NC_MAX_NAME+1L];      /* [sng] Variable name */ 
 
   char *var_nm_fll;                /* [sng] Full path for variable */
+
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   int *grp_ids;                    /* [ID] Sub-group IDs array */  
 
   int dmn_idx_grp[NC_MAX_DIMS];    /* [ID] Dimension indices array for group */ 
@@ -3157,8 +3176,6 @@ nco_prn_xml /* [fnc] Recursively print group contents */
   unsigned int dmn_nbr; /* [nbr] Number of dimensions defined in group */
   unsigned int obj_idx; /* [idx] Index over traversal table */
 
-
-
   /* Initialize */
   dmn_nbr=0; /* [nbr] Number of dimensions defined in group */
   var_nbr_xtr=0; /* [nbr] Number of variables to be extracted in group */
@@ -3204,16 +3221,16 @@ nco_prn_xml /* [fnc] Recursively print group contents */
   if(dmn_nbr > 1) dmn_lst=nco_lst_srt_nm_id(dmn_lst,dmn_nbr,prn_flg->ALPHA_BY_STUB_GROUP);
 
   if(grp_dpt == 0){
-    if(prn_flg->xml_lcn) (void)fprintf(stdout,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\" location=\"%s\">\n",prn_flg->fl_in); else (void)fprintf(stdout,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\">\n");
-    if(prn_flg->nfo_xtr) (void)fprintf(stdout,"%*s<!-- %s -->\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
+    if(prn_flg->xml_lcn) (void)fprintf(fp_out,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\" location=\"%s\">\n",prn_flg->fl_in); else (void)fprintf(fp_out,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\">\n");
+    if(prn_flg->nfo_xtr) (void)fprintf(fp_out,"%*s<!-- %s -->\n",prn_flg->sxn_fst,spc_sng,prn_flg->smr_sng);
   }else{ /* grp_dpt != 0 */
-    (void)fprintf(stdout,"%*s<group name=\"%s\">\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,trv_tbl->lst[obj_idx].nm);
+    (void)fprintf(fp_out,"%*s<group name=\"%s\">\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng,trv_tbl->lst[obj_idx].nm);
   } /* grp_dpt != 0 */
 
   /* Print dimension information for group */
   prn_ndn=prn_flg->ndn=prn_flg->sxn_fst+grp_dpt*prn_flg->spc_per_lvl;
 
-  for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++) (void)fprintf(stdout,"%*s<dimension name=\"%s\" length=\"%lu\" %s/>\n",prn_ndn,spc_sng,dmn_lst[dmn_idx].nm,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn ? "isUnlimited=\"true\" " : "");
+  for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++) (void)fprintf(fp_out,"%*s<dimension name=\"%s\" length=\"%lu\" %s/>\n",prn_ndn,spc_sng,dmn_lst[dmn_idx].nm,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt,trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].is_rec_dmn ? "isUnlimited=\"true\" " : "");
   
   /* Dimension list no longer needed */
   dmn_lst=nco_nm_id_lst_free(dmn_lst,dmn_nbr);
@@ -3271,7 +3288,7 @@ nco_prn_xml /* [fnc] Recursively print group contents */
     (void)nco_inq_varid(grp_id,var_trv.nm,&var_id);
 
     /* Print variable full name */
-    // if(var_trv.grp_dpt > 0 && prn_flg->fll_pth && TRD) (void)fprintf(stdout,"%*s%s\n",prn_flg->ndn,spc_sng,var_trv.nm_fll);
+    // if(var_trv.grp_dpt > 0 && prn_flg->fll_pth && TRD) (void)fprintf(fp_out,"%*s%s\n",prn_flg->ndn,spc_sng,var_trv.nm_fll);
 
     (void)nco_prn_var_dfn(nc_id,prn_flg,&var_trv); 
       
@@ -3280,7 +3297,7 @@ nco_prn_xml /* [fnc] Recursively print group contents */
     if(prn_flg->PRN_VAR_DATA) (void)nco_prn_var_val_trv(nc_id,prn_flg,&trv_tbl->lst[var_lst[var_idx].id],trv_tbl);
 
     /* XML close variable tag */
-    (void)fprintf(stdout,"%*s</variable>\n",prn_ndn,spc_sng);
+    (void)fprintf(fp_out,"%*s</variable>\n",prn_ndn,spc_sng);
   } /* end loop over var_idx */
 
   /* Print global metatdata */
@@ -3327,8 +3344,8 @@ nco_prn_xml /* [fnc] Recursively print group contents */
   } /* end loop over grp_idx */
 
   /* Mark end of output */
-  if(grp_dpt == 0) (void)fprintf(stdout,"</netcdf>\n"); 
-  if(grp_dpt > 0) (void)fprintf(stdout,"%*s</group>\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng); 
+  if(grp_dpt == 0) (void)fprintf(fp_out,"</netcdf>\n"); 
+  if(grp_dpt > 0) (void)fprintf(fp_out,"%*s</group>\n",grp_dpt*prn_flg->spc_per_lvl,spc_sng); 
 
   return rcd;
 } /* end nco_grp_prn_xml() */
@@ -3359,6 +3376,8 @@ nco_prn_jsn /* [fnc] Recursively print group contents */
   char *nm_jsn;
   char *var_nm_fll;                /* [sng] Full path for variable */
 
+  FILE *fp_out=prn_flg->fp_out; /* [fl] Formatted text output file handle */
+
   int *grp_ids;                    /* [ID] Sub-group IDs array */  
 
   int dmn_idx_grp[NC_MAX_DIMS];    /* [ID] Dimension indices array for group */ 
@@ -3429,18 +3448,18 @@ nco_prn_jsn /* [fnc] Recursively print group contents */
      
   nm_jsn=nm2sng_jsn(nco_gpe_evl_stb(prn_flg->gpe,trv_tbl->lst[obj_idx].nm_fll));
  
- if(grp_dpt==0) (void)fprintf(stdout,"{\n"); else (void)fprintf(stdout,"%*s\"%s\": {\n",prn_ndn,spc_sng,nm_jsn);
+ if(grp_dpt==0) (void)fprintf(fp_out,"{\n"); else (void)fprintf(fp_out,"%*s\"%s\": {\n",prn_ndn,spc_sng,nm_jsn);
   nm_jsn=(char *)nco_free(nm_jsn);  
 
   if(dmn_nbr > 0 ) 
-      (void)fprintf(stdout,"%*s\"dimensions\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);
+      (void)fprintf(fp_out,"%*s\"dimensions\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);
  
   for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++){
 
     nm_jsn=nm2sng_jsn(dmn_lst[dmn_idx].nm);
-    (void)fprintf(stdout,"%*s\"%s\": %lu",prn_ndn+2*prn_flg->spc_per_lvl,spc_sng,nm_jsn,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt);   
+    (void)fprintf(fp_out,"%*s\"%s\": %lu",prn_ndn+2*prn_flg->spc_per_lvl,spc_sng,nm_jsn,(unsigned long)trv_tbl->lst_dmn[dmn_lst[dmn_idx].id].lmt_msa.dmn_cnt);   
     /* Add comma and carriage-return unless last element */
-    if(dmn_idx<dmn_nbr-1) (void)printf(",\n"); else (void)printf("\n%*s}",prn_ndn+prn_flg->spc_per_lvl,spc_sng);         
+    if(dmn_idx<dmn_nbr-1) (void)fprintf(fp_out,",\n"); else (void)fprintf(fp_out,"\n%*s}",prn_ndn+prn_flg->spc_per_lvl,spc_sng);         
     nm_jsn=(char *)nco_free(nm_jsn);   
     JSN_BLOCK=True;    
   } /* end loop over dimension */
@@ -3502,8 +3521,8 @@ nco_prn_jsn /* [fnc] Recursively print group contents */
    
     /* Deal with first iteration */   
     if(var_idx == 0){ 
-      if(JSN_BLOCK) (void)fprintf(stdout,",\n"); else JSN_BLOCK=True;              
-      (void)fprintf(stdout,"%*s\"variables\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);   
+      if(JSN_BLOCK) (void)fprintf(fp_out,",\n"); else JSN_BLOCK=True;              
+      (void)fprintf(fp_out,"%*s\"variables\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);   
     } /* !var_idx */
         
     /* DOES NOT include a return as we may wanna add a COMMA */
@@ -3512,28 +3531,28 @@ nco_prn_jsn /* [fnc] Recursively print group contents */
 
     /* nco_prn_att() prints final brace without carriage return since we may need to add a comma */
     if(prn_flg->PRN_VAR_METADATA && nco_att_nbr(grp_id,var_id) > 0){     
-      (void)fprintf(stdout,",\n");            
+      (void)fprintf(fp_out,",\n");            
       //prn_flg->ndn=prn_ndn+2*prn_flg->spc_per_lvl;  
       (void)nco_prn_att(grp_id,prn_flg,var_id);
     } /* !prn_flg */
         
     if( prn_flg->PRN_VAR_DATA){  
-      (void)fprintf(stdout,",\n");  
+      (void)fprintf(fp_out,",\n");  
       // prn_flg->ndn=prn_ndn+2*prn_flg->spc_per_lvl;  
       (void)nco_prn_var_val_trv(nc_id,prn_flg,&trv_tbl->lst[var_lst[var_idx].id],trv_tbl);      
     }else{
-      (void)fprintf(stdout,"\n");        
+      (void)fprintf(fp_out,"\n");        
     }
     /* Close JSON tag without carriage return since we may need to add comma later */
-    (void)fprintf(stdout,"%*s}%s",prn_flg->ndn,spc_sng, (var_idx<var_nbr_xtr-1 ?",\n":"\n"));
+    (void)fprintf(fp_out,"%*s}%s",prn_flg->ndn,spc_sng, (var_idx<var_nbr_xtr-1 ?",\n":"\n"));
     
   } /* end loop over var_idx */
 
   /* Close-out JSON variable tag */
-  if(var_nbr_xtr>0) (void)fprintf(stdout,"%*s}",prn_ndn+prn_flg->spc_per_lvl,spc_sng);   
+  if(var_nbr_xtr>0) (void)fprintf(fp_out,"%*s}",prn_ndn+prn_flg->spc_per_lvl,spc_sng);   
 
   if((nbr_att > 0 || (prn_flg->hdn && grp_dpt == 0)) && prn_flg->PRN_GLB_METADATA){
-    if(JSN_BLOCK) (void)fprintf(stdout,",\n"); else JSN_BLOCK=True;              
+    if(JSN_BLOCK) (void)fprintf(fp_out,",\n"); else JSN_BLOCK=True;              
     prn_flg->ndn=prn_ndn+prn_flg->spc_per_lvl;  
     nco_prn_att(grp_id,prn_flg,NC_GLOBAL);
   }  
@@ -3548,8 +3567,8 @@ nco_prn_jsn /* [fnc] Recursively print group contents */
   /*
   if( nbr_grp > 0) 
   {  
-     if(JSN_BLOCK) (void)fprintf(stdout,",\n"); 
-     (void)fprintf(stdout,"%*s\"groups\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);       
+     if(JSN_BLOCK) (void)fprintf(fp_out,",\n"); 
+     (void)fprintf(fp_out,"%*s\"groups\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);       
      JSN_BLOCK=True; 
   }
   */
@@ -3584,10 +3603,10 @@ nco_prn_jsn /* [fnc] Recursively print group contents */
     if(trv_tbl->lst[obj_idx].flg_xtr){  
       /* print groups tag for first extracted group */ 
       if(nbr_grp_xtr++ == 0){   
-         if(JSN_BLOCK) (void)fprintf(stdout,",\n"); 
-         (void)fprintf(stdout,"%*s\"groups\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);       
+         if(JSN_BLOCK) (void)fprintf(fp_out,",\n"); 
+         (void)fprintf(fp_out,"%*s\"groups\": {\n",prn_ndn+prn_flg->spc_per_lvl,spc_sng);       
       }else{
-         (void)fprintf(stdout,",\n"); 
+         (void)fprintf(fp_out,",\n"); 
       }
       rcd+=nco_prn_jsn(nc_id,sub_grp_nm_fll,prn_flg,trv_tbl);        
     }  
@@ -3597,9 +3616,9 @@ nco_prn_jsn /* [fnc] Recursively print group contents */
   } /* end loop over grp_idx */
 
   /* Print closing tag for group tag */
-  if(nbr_grp > 0 && nbr_grp_xtr > 0) (void)fprintf(stdout,"\n%*s}",prn_ndn+prn_flg->spc_per_lvl,spc_sng);         
-  if(grp_dpt ==0) (void)fprintf(stdout,"\n}\n"); 
-  if(grp_dpt >0) (void)fprintf(stdout,"\n%*s}",prn_ndn,spc_sng);
+  if(nbr_grp > 0 && nbr_grp_xtr > 0) (void)fprintf(fp_out,"\n%*s}",prn_ndn+prn_flg->spc_per_lvl,spc_sng);         
+  if(grp_dpt ==0) (void)fprintf(fp_out,"\n}\n"); 
+  if(grp_dpt >0) (void)fprintf(fp_out,"\n%*s}",prn_ndn,spc_sng);
   
   return rcd;
 } /* end nco_prn_jsn() */
diff --git a/src/nco/nco_rgr.c b/src/nco/nco_rgr.c
index 6deab2c..85eed4f 100644
--- a/src/nco/nco_rgr.c
+++ b/src/nco/nco_rgr.c
@@ -1885,6 +1885,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
     else if((rcd=nco_inq_dimid_flg(in_id,"nlat",&dmn_id_lat)) == NC_NOERR) lat_nm_in=strdup("nlat"); /* POP */
     else if((rcd=nco_inq_dimid_flg(in_id,"nscan",&dmn_id_lat)) == NC_NOERR) lat_nm_in=strdup("nscan"); /* AMSR, TRMM */
     else if((rcd=nco_inq_dimid_flg(in_id,"nTimes",&dmn_id_lat)) == NC_NOERR) lat_nm_in=strdup("nTimes"); /* OMI L2 */
+    else if((rcd=nco_inq_dimid_flg(in_id,"number_of_lines",&dmn_id_lat)) == NC_NOERR) lat_nm_in=strdup("number_of_lines"); /* DSCOVR L2 */
     else if((rcd=nco_inq_dimid_flg(in_id,"GeoTrack",&dmn_id_lat)) == NC_NOERR) lat_nm_in=strdup("GeoTrack"); /* AIRS L2 DAP NC */
     else if((rcd=nco_inq_dimid_flg(in_id,"GeoTrack:L2_Standard_atmospheric&surface_product",&dmn_id_lat)) == NC_NOERR) lat_nm_in=strdup("GeoTrack:L2_Standard_atmospheric&surface_product"); /* AIRS L2 HDF */
     else if((rcd=nco_inq_dimid_flg(in_id,"Cell_Along_Swath:mod04",&dmn_id_lat)) == NC_NOERR) lat_nm_in=strdup("Cell_Along_Swath:mod04"); /* MODIS MOD04 L2 */
@@ -1919,6 +1920,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
     else if((rcd=nco_inq_dimid_flg(in_id,"npixel",&dmn_id_lon)) == NC_NOERR) lon_nm_in=strdup("npixel"); /* TRMM */
     else if((rcd=nco_inq_dimid_flg(in_id,"nxtrack",&dmn_id_lon)) == NC_NOERR) lon_nm_in=strdup("nxtrack"); /* MODIS DeepBlue SeaWiFS L2 */
     else if((rcd=nco_inq_dimid_flg(in_id,"nXtrack",&dmn_id_lon)) == NC_NOERR) lon_nm_in=strdup("nXtrack"); /* OMI L2 */
+    else if((rcd=nco_inq_dimid_flg(in_id,"number_of_pixels",&dmn_id_lon)) == NC_NOERR) lon_nm_in=strdup("number_of_pixels"); /* DSCOVR L2 */
     else if((rcd=nco_inq_dimid_flg(in_id,"GeoXTrack",&dmn_id_lon)) == NC_NOERR) lon_nm_in=strdup("GeoXTrack"); /* AIRS L2 DAP NC */
     else if((rcd=nco_inq_dimid_flg(in_id,"GeoXTrack:L2_Standard_atmospheric&surface_product",&dmn_id_lon)) == NC_NOERR) lon_nm_in=strdup("GeoXTrack:L2_Standard_atmospheric&surface_product"); /* AIRS L2 HDF */
     else if((rcd=nco_inq_dimid_flg(in_id,"Cell_Across_Swath:mod04",&dmn_id_lon)) == NC_NOERR) lon_nm_in=strdup("Cell_Across_Swath:mod04"); /* MODIS MOD04 L2 */
@@ -1949,12 +1951,13 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
      CAM-FV: slon, slat, w_stag (w_stag is weights for slat grid, analagous to gw for lat grid)
      CAM-SE: area
      CICE: latt_bounds, lont_bounds, latu_bounds, lonu_bounds, TLAT, TLON, ULAT, ULON (NB: CICE uses ?LON and POP uses ?LONG) (aice is ice area, tmask is state-variable mask, both not currently excluded, although all binary masks like tmask should be recomputed on new grid)
+     DSCOVR L2: latitude, longitude
      ESMF: gridcell_area
      GPM: S1_Latitude, S1_Longitude
      HIRDLS: Latitude
      MAR/RACMO: LAT, LON
      MLS: CO_Latitude
-     MPAS-O/I: areaCell, latCell, lonCell
+     MPAS-O/I/LI: areaCell, latCell, lonCell
      NCO: lat_vertices, lon_vertices
      NEMO: nav_lat, nav_lon
      OCO2: latitude_bnds, longitude_bnds
@@ -1988,8 +1991,9 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
 
   if(False){
     /* 20160228: MPAS has a host of mysterious grid and extensive variables that should probably not be regridded */
-    const int mpas_xcl_lst_nbr=18;
-    const char *mpas_xcl_lst[]={"cellMask,cellsOnCell,cellsOnEdge,cellsOnVertex,edgeMask,edgesOnCell,edgesOnEdge,edgesOnVertex,indexToCellID,indexToEdgeID,indexToVertexID,maxLevelCell,maxLevelEdgeTop,nEdgesOnCell,nEdgesOnEdge,vertexMask,verticesOnCell,verticesOnEdge"};
+    /* 20180206: Add from MPAS-LI xCell, yCell, zCell, and [xyz]Edge, and [xyz]Vertex */
+    const int mpas_xcl_lst_nbr=27;
+    const char *mpas_xcl_lst[]={"cellMask,cellsOnCell,cellsOnEdge,cellsOnVertex,edgeMask,edgesOnCell,edgesOnEdge,edgesOnVertex,indexToCellID,indexToEdgeID,indexToVertexID,maxLevelCell,maxLevelEdgeTop,nEdgesOnCell,nEdgesOnEdge,vertexMask,verticesOnCell,verticesOnEdge,xCell,yCell,zCell,xEdge,yEdge,zEdge,xVertex,yVertex,zVertex"};
     for(idx=0;idx<mpas_xcl_lst_nbr;idx++){
       for(idx_tbl=0;idx_tbl<trv_nbr;idx_tbl++)
 	if(!strcmp(trv_tbl->lst[idx_tbl].nm_fll,mpas_xcl_lst[idx])) break;
@@ -3833,7 +3837,7 @@ nco_sph_plg_area /* [fnc] Compute area of spherical polygon */
   area_ltr_ttl=0.0;
   area_crc_ttl=0.0;
   area_crc_abs_ttl=0.0;
-  for(unsigned int col_idx=0;col_idx<col_nbr;col_idx++){
+  for(long col_idx=0;col_idx<col_nbr;col_idx++){
     flg_ltr_cll=False;
     ngl_c=double_CEWI; /* Otherwise compiler unsure ngl_c is initialized first use */
     area[col_idx]=0.0;
@@ -3920,7 +3924,7 @@ nco_sph_plg_area /* [fnc] Compute area of spherical polygon */
       if(((float)ngl_a == (float)ngl_b && (float)ngl_a == (float)(0.5*ngl_c)) || /* c is half a and b */
 	 ((float)ngl_b == (float)ngl_c && (float)ngl_b == (float)(0.5*ngl_a)) || /* a is half b and c */
 	 ((float)ngl_c == (float)ngl_a && (float)ngl_c == (float)(0.5*ngl_b))){  /* b is half c and a */
-	(void)fprintf(stdout,"%s: WARNING %s reports col_idx = %u triangle %d is ill-conditioned. Spherical excess and thus cell area are likely inaccurate. Ask Charlie to implement SAS formula...\n",nco_prg_nm_get(),fnc_nm,col_idx,tri_nbr);
+	(void)fprintf(stdout,"%s: WARNING %s reports col_idx = %li triangle %d is ill-conditioned. Spherical excess and thus cell area are likely inaccurate. Ask Charlie to implement SAS formula...\n",nco_prg_nm_get(),fnc_nm,col_idx,tri_nbr);
       } /* !ill */
       /* Semi-perimeter */
       prm_smi=0.5*(ngl_a+ngl_b+ngl_c);
@@ -4022,7 +4026,7 @@ nco_sph_plg_area /* [fnc] Compute area of spherical polygon */
 	  (void)fprintf(stdout,"%s: Latitude-triangle area using series approximation...not implemented yet\n",nco_prg_nm_get());
 	} /* !0 */
 	if(nco_dbg_lvl_get() >= nco_dbg_scl){
-	  (void)fprintf(stdout,"%s: INFO %s col_idx = %u triangle %d spherical area, latitude-triangle area, %% difference: %g, %g, %g\n",nco_prg_nm_get(),fnc_nm,col_idx,tri_nbr,xcs_sph,xcs_sph+area_crc,100.0*area_crc/xcs_sph);
+	  (void)fprintf(stdout,"%s: INFO %s col_idx = %li triangle %d spherical area, latitude-triangle area, %% difference: %g, %g, %g\n",nco_prg_nm_get(),fnc_nm,col_idx,tri_nbr,xcs_sph,xcs_sph+area_crc,100.0*area_crc/xcs_sph);
 	  if(fabs(area_crc/xcs_sph) > 0.1){
 	    (void)fprintf(stdout,"%s: DBG Non-spherical correction exceeds 10%% for current triangle with ABC vertices at lat,lon [dgr] = %g, %g\n%g, %g\n%g, %g\n",nco_prg_nm_get(),lat_bnd[idx_ltr_a],lon_bnd[idx_ltr_a],lat_bnd[idx_ltr_b],lon_bnd[idx_ltr_b],lat_bnd[idx_ltr_c],lon_bnd[idx_ltr_c]);
 	  } /* !fabs */
@@ -4031,7 +4035,7 @@ nco_sph_plg_area /* [fnc] Compute area of spherical polygon */
     } /* !tri_idx */
     if(flg_ltr_cll){
       /* Current gridcell contained at least one latitude-triangle */
-      if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(stdout,"%s: INFO %s col_idx = %u spherical area, latitude-gridcell area, %% difference: %g, %g, %g\n",nco_prg_nm_get(),fnc_nm,col_idx,area[col_idx],area_ltr,100.0*(area_ltr-area[col_idx])/area[col_idx]);
+      if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(stdout,"%s: INFO %s col_idx = %li spherical area, latitude-gridcell area, %% difference: %g, %g, %g\n",nco_prg_nm_get(),fnc_nm,col_idx,area[col_idx],area_ltr,100.0*(area_ltr-area[col_idx])/area[col_idx]);
     } /* !flg_ltr_cll */    
   } /* !col_idx */
   if(nco_dbg_lvl_get() >= nco_dbg_scl) (void)fprintf(stdout,"%s: INFO %s total spherical area, latitude-gridcell area, %% difference, crc_ttl, crc_abs_ttl: %g, %g, %g, %g, %g\n",nco_prg_nm_get(),fnc_nm,area_ttl,area_ltr_ttl,100.0*(area_ltr_ttl-area_ttl)/area_ttl,area_crc_ttl,area_crc_abs_ttl);
@@ -7667,10 +7671,10 @@ nco_grd_nfr /* [fnc] Infer SCRIP-format grid file from input data file */
     const long npf_nbr=grd_crn_nbr; /* [nbr] Number of nodes per face */
 
     long dg_idx; /* [idx] Counting index for edges */
-    long dg_nbr=NC_MIN_INT64; /* [nbr] Number of edges in mesh */
+    long dg_nbr=(long)NC_MIN_INT64; /* [nbr] Number of edges in mesh */
     long fc_idx; /* [idx] Counting index for faces */
     long nd_idx; /* [idx] Counting index for nodes */
-    long nd_nbr=NC_MIN_INT64; /* [nbr] Number of nodes in mesh */
+    long nd_nbr=(long)NC_MIN_INT64; /* [nbr] Number of nodes in mesh */
     long srt_idx=0; /* [idx] start_index (C/Fortran) for edge_nodes, face_nodes */
 
     if(!dgx_nm) dgx_nm=(char *)strdup("mesh_edge_x");
diff --git a/src/nco/nco_sng_utl.c b/src/nco/nco_sng_utl.c
index 8b8cf30..26e03df 100644
--- a/src/nco/nco_sng_utl.c
+++ b/src/nco/nco_sng_utl.c
@@ -62,7 +62,9 @@ strcasecmp /* [fnc] Lexicographical case-insensitive string comparison */
     if(chr_1 == 0)    return 0;
   } /* end while */
 } /* end strcasecmp() */
+#endif /* !NEED_STRCASECMP */
 
+#ifdef NEED_STRNCASECMP
 int /* O [enm] [-1,0,1] sng_1 [<,=,>] sng_2 */
 strncasecmp /* [fnc] Lexicographical case-insensitive string comparison */
 (const char * const sng_1, /* I [sng] First string */
@@ -94,7 +96,7 @@ strncasecmp /* [fnc] Lexicographical case-insensitive string comparison */
   } /* end while */
   return 0;
 } /* end strncasecmp() */
-#endif /* !NEED_STRCASECMP */
+#endif /* !NEED_STRNCASECMP */
 
 #ifdef NEED_ISBLANK
 int /* O [flg] Character is a space or horizontal tab */
@@ -766,3 +768,48 @@ nco_sng2typ /* [fnc] Convert user-supplied string to netCDF type enum */
 
 } /* end nco_sng2typ() */
 
+char * /* O [sng] Sanitized string */
+nco_sng_sntz /* [fnc] Ensure input string contains only white-listed innocuous characters */
+(char * const sng_drt) /* I [sng] String to sanitize */
+{
+  const char fnc_nm[]="nco_sng_sntz()"; /* [sng] Function name */
+    
+  /* Whitelist algorithm based on:
+     https://wiki.sei.cmu.edu/confluence/display/c/STR02-C.+Sanitize+data+passed+to+complex+subsystems 
+     NCO modifications to CMU default whitelist:
+     20180214: White-list colon (WRF filenames sometimes have timestamps with colons, Windows drive labels have colons) 
+     20180214: White-list space (Methinks some Windows people do have data files with spaces)
+     20180214: White-list forward slash on UNIX, backslash on Windows (path separators) 
+     20180222: White-list percent sign (NCO regression test uses, e.g., %tmp_fl_00)
+     20180227: White-list forward slash on Windows so URLs are acceptable (http://...)
+     Crucial characters that are implicitly blacklisted (and could be transformed into underscores) are:
+     ";|<>[](),*&" */
+  static char wht_lst[]="abcdefghijklmnopqrstuvwxyz"
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+    "1234567890_-.@"
+    " :%/"
+#ifdef _MSC_VER
+    "\\"
+#endif /* !_MSC_VER */
+    ;
+  /* ": re-balance syntax highlighting */
+
+  char *usr_dta=sng_drt;
+  char *cp=usr_dta; /* Cursor into string */
+  
+  if(nco_dbg_lvl_get() >= nco_dbg_io) (void)fprintf(stderr,"%s: DEBUG %s reports unsanitized usr_dta = %s\n",nco_prg_nm_get(),fnc_nm,usr_dta);
+
+  const char *sng_end=usr_dta+strlen(usr_dta);
+  for(cp+=strspn(cp,wht_lst);cp!=sng_end;cp+=strspn(cp,wht_lst)){
+    (void)fprintf(stderr,"%s: ERROR %s reports character \'%c\' from unsanitized user-input string \"%s\" is not on whitelist of acceptable characters. For security purposes NCO restricts the set of characters appearing in user input, including filenames, to: \"%s\". NB: This restriction was first imposed in NCO 4.7.3 (February, 2018), and may cause breakage of older workflows. Please contact NCO if you have a real-world use-case that shows why the character \'%c\' should be white-listed [...]
+    /* Uncomment next two lines to sanitize unsafe character with an underscore
+     *cp='_';
+     if(nco_dbg_lvl_get() >= nco_dbg_io) (void)fprintf(stderr,"%s: DEBUG %s reports sanitized usr_dta = %s\n",nco_prg_nm_get(),fnc_nm,usr_dta); */
+
+    /* Provide escape route so newly broken workflows will still work with -D 73
+       Eliminate back-door after a few new versions of NCO, e.g., by version 4.7.5 */
+    if(nco_dbg_lvl_get() != 73) nco_exit(EXIT_FAILURE);
+  } /* !cp */
+
+  return usr_dta;
+} /* !nco_sng_sntz() */
diff --git a/src/nco/nco_sng_utl.h b/src/nco/nco_sng_utl.h
index a6863a8..bacad74 100644
--- a/src/nco/nco_sng_utl.h
+++ b/src/nco/nco_sng_utl.h
@@ -26,13 +26,12 @@
 
 #ifdef _MSC_VER
 # define NEED_STRSEP
-# define NEED_STRCASECMP 
 # define NEED_STRCASESTR
 #endif /* !_MSC_VER */
 
-#if defined(NEED_STRCASECMP) || defined(NEED_STRCASESTR)
+#if (defined NEED_STRCASECMP) || (defined NEED_STRNCASECMP) || (defined NEED_STRDUP)
 # include <ctype.h> /* isalnum(), isdigit(), tolower() */
-#endif /* !NEED_STRCASECMP || !NEED_STRCASESTR */
+#endif /* NEED_STRCASECMP || NEED_STRNCASECMP || NEED_STRDUP */
 
 /* 3rd party vendors */
 
@@ -61,13 +60,15 @@ extern "C" {
   strcasecmp /* [fnc] Lexicographical case-insensitive string comparison */
   (const char * const sng_1, /* I [sng] First string */
    const char * const sng_2); /* I [sng] Second string */
+#endif /* !NEED_STRCASECMP */
   
+#ifdef NEED_STRNCASECMP
   int /* O [enm] [-1,0,1] sng_1 [<,=,>] sng_2 */
   strncasecmp /* [fnc] Lexicographical case-insensitive string comparison */
   (const char * const sng_1, /* I [sng] First string */
    const char * const sng_2, /* I [sng] Second string */
    const size_t chr_nbr); /* I [nbr] Compare at most chr_nbr characters */
-#endif /* !NEED_STRCASECMP */
+#endif /* !NEED_STRNCASECMP */
   
   /* 20161205 GNU since gcc 4.7.3 provides strcasestr() as non-standard extension iff _GNU_SOURCE is defined */
 #if 0
@@ -150,6 +151,10 @@ extern "C" {
   nco_sng2typ /* [fnc] Convert user-supplied string to netCDF type enum */
   (const char * const typ_sng); /* I [sng] String indicating type */
 
+  char * /* O [sng] Sanitized string */
+  nco_sng_sntz /* [fnc] Ensure input string contains only white-listed innocuous characters */
+  (char * const sng_drt); /* I/O [sng] String to sanitize */
+
 #ifdef __cplusplus
 } /* end extern "C" */
 #endif /* __cplusplus */
diff --git a/src/nco/nco_var_lst.c b/src/nco/nco_var_lst.c
index 7a287b7..475aab0 100644
--- a/src/nco/nco_var_lst.c
+++ b/src/nco/nco_var_lst.c
@@ -313,7 +313,7 @@ nco_var_lst_crd_add /* [fnc] Add all coordinates to extraction list */
           /* Yes, get list of specified attributes */
           (void)nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
           if(att_typ != NC_CHAR){
-            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
             return xtr_lst;
           } /* end if */
           att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
@@ -398,7 +398,7 @@ nco_var_lst_crd_add /* [fnc] Add all coordinates to extraction list */
           /* Yes, get list of specified attributes */
           (void)nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
           if(att_typ != NC_CHAR){
-            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
             return xtr_lst;
           } /* end if */
           att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
@@ -539,7 +539,7 @@ nco_var_lst_crd_ass_add /* [fnc] Add to extraction list all coordinates associat
           /* Yes, get list of specified attributes */
           (void)nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
           if(att_typ != NC_CHAR){
-            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
             return xtr_lst;
           } /* end if */
           att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
@@ -620,7 +620,7 @@ nco_var_lst_crd_ass_add /* [fnc] Add to extraction list all coordinates associat
           /* Yes, get list of specified attributes */
           (void)nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
           if(att_typ != NC_CHAR){
-            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+            (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,xtr_lst[idx_var].nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
             return xtr_lst;
           } /* end if */
           att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
diff --git a/src/nco/nco_var_utl.c b/src/nco/nco_var_utl.c
index 967d305..455de6c 100644
--- a/src/nco/nco_var_utl.c
+++ b/src/nco/nco_var_utl.c
@@ -1439,7 +1439,7 @@ nco_is_spc_in_cf_att /* [fnc] Variable is listed in this CF attribute, thereby a
         rcd+=nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
         if(att_typ != NC_CHAR){
           rcd=nco_inq_varname(nc_id,var_id,var_nm);
-          if(FIRST_WARNING) (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute. NB: To avoid excessive noise, NCO prints this WARNING at most once per dataset.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+          if(FIRST_WARNING) (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute. NB: To avoid excessive noise, NCO prints this WARNING at most once per dataset.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
 	  FIRST_WARNING=False;
           return IS_SPC_IN_CF_ATT;
         } /* end if */
@@ -1606,7 +1606,7 @@ nco_is_spc_in_crd_att /* [fnc] Variable is listed in a "coordinates" attribute *
         rcd+=nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
         if(att_typ != NC_CHAR){
           rcd=nco_inq_varname(nc_id,var_id,var_nm);
-          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
           return IS_SPC_IN_CRD_ATT;
         } /* end if */
         att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
@@ -1680,7 +1680,7 @@ nco_is_spc_in_bnd_att /* [fnc] Variable is listed in a "bounds" attribute */
         rcd+=nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
         if(att_typ != NC_CHAR){
           rcd=nco_inq_varname(nc_id,var_id,var_nm);
-          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
           return IS_SPC_IN_BND_ATT;
         } /* end if */
         att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
@@ -1754,7 +1754,7 @@ nco_is_spc_in_clm_att /* [fnc] Variable is listed in a "climatology" attribute *
         rcd+=nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
         if(att_typ != NC_CHAR){
           rcd=nco_inq_varname(nc_id,var_id,var_nm);
-          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
           return IS_SPC_IN_CLM_ATT;
         } /* end if */
         att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
@@ -1828,7 +1828,7 @@ nco_is_spc_in_grd_att /* [fnc] Variable is listed in a "grid_mapping" attribute
         rcd+=nco_inq_att(nc_id,var_id,att_nm,&att_typ,&att_sz);
         if(att_typ != NC_CHAR){
           rcd=nco_inq_varname(nc_id,var_id,var_nm);
-          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for specifying additional attributes. Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
+          (void)fprintf(stderr,"%s: WARNING the \"%s\" attribute for variable %s is type %s, not %s. This violates the CF convention for allowed datatypes (http://cfconventions.org/cf-conventions/cf-conventions.html#_data_types). Therefore %s will skip this attribute.\n",nco_prg_nm_get(),att_nm,var_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),fnc_nm);
           return IS_SPC_IN_GRD_ATT;
         } /* end if */
         att_val=(char *)nco_malloc((att_sz+1L)*sizeof(char));
diff --git a/src/nco/ncpdq.c b/src/nco/ncpdq.c
index 0e77a58..22fc328 100644
--- a/src/nco/ncpdq.c
+++ b/src/nco/ncpdq.c
@@ -290,6 +290,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     {"ppc",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"precision_preserving_compression",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"quantize",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
@@ -439,6 +441,7 @@ main(int argc,char **argv)
 	(void)nco_usg_prn();
 	nco_exit(EXIT_SUCCESS);
       } /* endif "help" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"mrd") || !strcmp(opt_crr,"multiple_record_dimension")) nco_mrd_cnv=nco_mrd_allow; /* [enm] Multiple Record Dimension convention */
       if(!strcmp(opt_crr,"msa_usr_rdr") || !strcmp(opt_crr,"msa_user_order")) MSA_USR_RDR=True; /* [flg] Multi-Slab Algorithm returns hyperslabs in user-specified order */
       if(!strcmp(opt_crr,"ppc") || !strcmp(opt_crr,"precision_preserving_compression") || !strcmp(opt_crr,"quantize")){
@@ -453,6 +456,7 @@ main(int argc,char **argv)
         nco_upk_cnv=(int)strtol(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtol",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
         (void)nco_vrs_prn(CVS_Id,CVS_Revision);
         nco_exit(EXIT_SUCCESS);
@@ -496,7 +500,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -613,7 +616,7 @@ main(int argc,char **argv)
     nco_exit(EXIT_FAILURE);
   } /* endif */
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
 
   /* Initialize thread information */
diff --git a/src/nco/ncra.c b/src/nco/ncra.c
index 118a26e..0de91ef 100644
--- a/src/nco/ncra.c
+++ b/src/nco/ncra.c
@@ -393,6 +393,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     {"ppc",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"precision_preserving_compression",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"quantize",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
@@ -558,6 +560,7 @@ main(int argc,char **argv)
 	(void)nco_usg_prn();
 	nco_exit(EXIT_SUCCESS);
       } /* endif "help" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"md5_dgs") || !strcmp(opt_crr,"md5_digest")){
         if(!md5) md5=nco_md5_ini();
         md5->dgs=True;
@@ -622,7 +625,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -761,7 +763,7 @@ main(int argc,char **argv)
   /* Set/report global chunk cache */
   rcd+=nco_cnk_csh_ini(cnk_csh_byt);
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
 
   /* Initialize thread information */
diff --git a/src/nco/ncrename.c b/src/nco/ncrename.c
index 749c800..61bb24a 100644
--- a/src/nco/ncrename.c
+++ b/src/nco/ncrename.c
@@ -166,10 +166,9 @@ main(int argc,char **argv)
   int prc_nbr=0; /* [nbr] Number of MPI processes */
 #endif /* !ENABLE_MPI */
   
-  static struct option opt_lng[] =
-  { /* Structure ordered by short option key if possible */
+  static struct option opt_lng[]={ /* Structure ordered by short option key if possible */
     /* Long options with no argument, no short option counterpart */
-        {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
+    {"clean",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"mmr_cln",no_argument,0,0}, /* [flg] Clean memory prior to exit */
     {"drt",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
     {"dirty",no_argument,0,0}, /* [flg] Allow dirty memory on exit */
@@ -188,6 +187,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     /* Long options with short counterparts */
     {"attribute",required_argument,0,'a'},
     {"debug",required_argument,0,'D'},
@@ -212,7 +213,7 @@ main(int argc,char **argv)
     {0,0,0,0}
   };
   int opt_idx=0;  /* Index of current long option into opt_lng array */
-
+  
   /* Start timer and save command line */ 
   ddra_info.tmr_flg=nco_tmr_srt;
   rcd+=nco_ddra((char *)NULL,(char *)NULL,&ddra_info);
@@ -255,6 +256,7 @@ main(int argc,char **argv)
         hdr_pad=strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
         if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
       } /* endif "hdr_pad" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ram_all") || !strcmp(opt_crr,"open_ram") || !strcmp(opt_crr,"diskless_all")) RAM_OPEN=True; /* [flg] Create file in RAM */
       if(!strcmp(opt_crr,"vrs") || !strcmp(opt_crr,"version")){
         (void)nco_vrs_prn(CVS_Id,CVS_Revision);
@@ -275,7 +277,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy argument for later processing */
       dmn_rnm_arg[nbr_dmn_rnm]=(char *)strdup(optarg);
@@ -330,7 +331,7 @@ main(int argc,char **argv)
     if(opt_crr) opt_crr=(char *)nco_free(opt_crr);
   } /* end while loop */
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
   if(fl_out) FL_OUT_NEW=True; else fl_out=(char *)strdup(fl_lst_in[0]);
 
diff --git a/src/nco/ncwa.c b/src/nco/ncwa.c
index 7192f27..5f07ac4 100644
--- a/src/nco/ncwa.c
+++ b/src/nco/ncwa.c
@@ -85,7 +85,8 @@
 /* #define MAIN_PROGRAM_FILE MUST precede #include libnco.h */
 #define MAIN_PROGRAM_FILE
 #ifdef HAVE_BISON_FLEX
-# include "ncap.h" /* netCDF arithmetic processor-specific definitions (symbol table, ...) */
+//# include "ncap.h" /* netCDF arithmetic processor-specific definitions (symbol table, ...) */
+  # include "ncap_utl.h" /* netCDF arithmetic processor-specific definitions (symbol table, ...) */
 #endif /* !HAVE_BISON_FLEX */
 #include "libnco.h" /* netCDF Operator (NCO) library */
 
@@ -318,6 +319,8 @@ main(int argc,char **argv)
     {"glb_att_add",required_argument,0,0}, /* [sng] Global attribute add */
     {"hdr_pad",required_argument,0,0},
     {"header_pad",required_argument,0,0},
+    {"log_lvl",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
+    {"log_level",required_argument,0,0}, /* [enm] netCDF library debugging verbosity [0..5] */
     {"ppc",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"precision_preserving_compression",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
     {"quantize",required_argument,0,0}, /* [nbr] Precision-preserving compression, i.e., number of total or decimal significant digits */
@@ -484,6 +487,7 @@ main(int argc,char **argv)
 	(void)nco_usg_prn();
 	nco_exit(EXIT_SUCCESS);
       } /* endif "help" */
+      if(!strcmp(opt_crr,"log_lvl") || !strcmp(opt_crr,"log_level")){nc_set_log_level(optarg);} /* [enm] netCDF library debugging verbosity [0..5] */
       if(!strcmp(opt_crr,"ppc") || !strcmp(opt_crr,"precision_preserving_compression") || !strcmp(opt_crr,"quantize")){
         ppc_arg[ppc_nbr]=(char *)strdup(optarg);
         ppc_nbr++;
@@ -548,7 +552,6 @@ main(int argc,char **argv)
     case 'D': /* Debugging level. Default is 0. */
       nco_dbg_lvl=(unsigned short int)strtoul(optarg,&sng_cnv_rcd,NCO_SNG_CNV_BASE10);
       if(*sng_cnv_rcd) nco_sng_cnv_err(optarg,"strtoul",sng_cnv_rcd);
-      nc_set_log_level(nco_dbg_lvl);
       break;
     case 'd': /* Copy limit argument for later processing */
       lmt_arg[lmt_nbr]=(char *)strdup(optarg);
@@ -704,7 +707,7 @@ main(int argc,char **argv)
   /* Ensure we do not attempt to normalize by non-existent weight */
   if(!wgt_nm) NORMALIZE_BY_WEIGHT=False;
 
-  /* Process positional arguments and fill in filenames */
+  /* 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);
 
   /* Initialize thread information */
diff --git a/src/nco_c++/Makefile.in b/src/nco_c++/Makefile.in
index de7ebf8..9780804 100644
--- a/src/nco_c++/Makefile.in
+++ b/src/nco_c++/Makefile.in
@@ -486,8 +486,6 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 UDUNITS2_PATH = @UDUNITS2_PATH@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@

-- 
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