[Git][debian-gis-team/nco][master] 4 commits: New upstream version 5.2.8
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Tue Sep 3 04:52:02 BST 2024
Bas Couwenberg pushed to branch master at Debian GIS Project / nco
Commits:
81c14c65 by Bas Couwenberg at 2024-09-03T05:37:12+02:00
New upstream version 5.2.8
- - - - -
6819566a by Bas Couwenberg at 2024-09-03T05:37:34+02:00
Update upstream source from tag 'upstream/5.2.8'
Update to upstream version '5.2.8'
with Debian dir d08cfb49c946c50c8ca9236818bfdc797a30206f
- - - - -
07193d84 by Bas Couwenberg at 2024-09-03T05:38:00+02:00
New upstream release.
- - - - -
cce52fb1 by Bas Couwenberg at 2024-09-03T05:38:38+02:00
Set distribution to unstable.
- - - - -
26 changed files:
- bld/nco.spec
- configure
- configure.ac
- configure.eg
- data/ncclimo
- data/ncremap
- debian/changelog
- doc/ANNOUNCE
- doc/ChangeLog
- doc/VERSION
- doc/debian.txt
- doc/index.shtml
- doc/nco.texi
- man/ncclimo.1
- src/nco/ncatted.c
- src/nco/ncks.c
- src/nco/nco.h
- src/nco/nco_att_utl.c
- src/nco/nco_cnk.c
- src/nco/nco_map.c
- src/nco/nco_netcdf.c
- src/nco/nco_netcdf.h
- src/nco/nco_rgr.c
- src/nco/nco_scm.c
- src/nco/ncrename.c
- src/nco_c++/nco_att.hh
Changes:
=====================================
bld/nco.spec
=====================================
@@ -108,7 +108,10 @@ fi
# %{_libdir}/libnco++.so
%changelog
-* Wed Aug 28 2024 Charlie Zender <zender at uci.edu> - 5.2.7-1
+* Tue Aug 23 2024 Charlie Zender <zender at uci.edu> - 5.2.8-1
+- new upstream 5.2.8
+
+* Tue Jul 23 2024 Charlie Zender <zender at uci.edu> - 5.2.7-1
- new upstream 5.2.7
* Thu Jun 20 2024 Charlie Zender <zender at uci.edu> - 5.2.6-1
=====================================
configure
=====================================
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for NCO netCDF Operators 5.2.7.
+# Generated by GNU Autoconf 2.72 for NCO netCDF Operators 5.2.8.
#
# Report bugs to <nco-bugs at lists.sourceforge.net>.
#
@@ -616,8 +616,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='NCO netCDF Operators'
PACKAGE_TARNAME='nco'
-PACKAGE_VERSION='5.2.7'
-PACKAGE_STRING='NCO netCDF Operators 5.2.7'
+PACKAGE_VERSION='5.2.8'
+PACKAGE_STRING='NCO netCDF Operators 5.2.8'
PACKAGE_BUGREPORT='nco-bugs at lists.sourceforge.net'
PACKAGE_URL=''
@@ -1426,7 +1426,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 5.2.7 to adapt to many kinds of systems.
+'configure' configures NCO netCDF Operators 5.2.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1498,7 +1498,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of NCO netCDF Operators 5.2.7:";;
+ short | recursive ) echo "Configuration of NCO netCDF Operators 5.2.8:";;
esac
cat <<\_ACEOF
@@ -1670,7 +1670,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-NCO netCDF Operators configure 5.2.7
+NCO netCDF Operators configure 5.2.8
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2449,7 +2449,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 5.2.7, which was
+It was created by NCO netCDF Operators $as_me 5.2.8, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -4549,7 +4549,7 @@ fi
# Define the identity of the package.
PACKAGE='nco'
- VERSION='5.2.7'
+ VERSION='5.2.8'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -23047,7 +23047,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 5.2.7, which was
+This file was extended by NCO netCDF Operators $as_me 5.2.8, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23115,7 +23115,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-NCO netCDF Operators config.status 5.2.7
+NCO netCDF Operators config.status 5.2.8
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
=====================================
configure.ac
=====================================
@@ -56,7 +56,7 @@
# 20170808: Choose between traditional version and Git-based version
# If Git, consider that Linux dynamic libraries will have full messy name, MacOS will not
# https://stackoverflow.com/questions/43526939/how-to-insert-git-based-version-in-autoconf-managed-project
-AC_INIT([NCO netCDF Operators],[5.2.7],[nco-bugs at lists.sourceforge.net],[nco])
+AC_INIT([NCO netCDF Operators],[5.2.8],[nco-bugs at lists.sourceforge.net],[nco])
# Print GNU copyright in configure script
AC_COPYRIGHT
=====================================
configure.eg
=====================================
@@ -743,6 +743,8 @@ ANTLR_ROOT=${HOME} CC=${LINUX_CC} CFLAGS='-g -Wall -UNCO_ABORT_ON_ERROR' CXX=${L
ANTLR_ROOT=${HOME} CC=${LINUX_CC} CFLAGS='' CXX=${LINUX_CXX} CXXFLAGS='' ./configure --prefix=${HOME} --bindir=${MY_BIN_DIR} --datadir=${HOME}/nco/data --libdir=${MY_LIB_DIR} --mandir=${HOME}/nco/man > nco.configure.foo 2>&1
# Imua 20230509
CC='gcc' CFLAGS='-I/usr/include/udunits2' CXX='g++' CXXFLAGS='-I/usr/include/udunits2' ./configure --prefix=${HOME} --bindir=${MY_BIN_DIR} --datadir=${HOME}/nco/data --libdir=${MY_LIB_DIR} --mandir=${HOME}/nco/man > nco.configure.foo 2>&1
+# Imua debug 20240809
+CC='gcc' CFLAGS='-I/usr/include/udunits2' CXX='g++' CXXFLAGS='-I/usr/include/udunits2' ./configure --enable-debug-symbols --prefix=${HOME} --bindir=${MY_BIN_DIR} --datadir=${HOME}/nco/data --libdir=${MY_LIB_DIR} --mandir=${HOME}/nco/man > nco.configure.foo 2>&1
/bin/cp -f config.log nco.config.log.foo
/bin/cp -f libtool nco.libtool.foo
=====================================
data/ncclimo
=====================================
@@ -297,9 +297,9 @@ fi # !hrd_pth && !NCO_PATH_OVERRIDE
# Split directory:
# ncclimo --dbg=1 --ypf=50 -s 1 -e 2 --var=FSNT,AODVIS --map=${DATA}/maps/map_ne30np4_to_cmip6_180x360_nco.20190601.nc --drc_in=${DATA}/ne30/raw --drc_out=${DATA}/ne30/clm
# Split global mean
-# cd ${DATA}/ne30/raw;ls 2018*000[12]-??*.nc | ncclimo --split --dbg=1 --glb_avg -s 1 -e 2 --var=FSNT,AODVIS,TREFHT --drc_out=${DATA}/ne30/clm
-# Split regional mean
# cd ${DATA}/ne30/raw;ls 2018*000[12]-??*.nc | ncclimo --split --dbg=1 --rgn_avg -s 1 -e 2 --var=FSNT,AODVIS,TREFHT --drc_out=${DATA}/ne30/clm
+# Split global sum
+# ncclimo -P elm --split --rgn_stt=sum --sum_scl=1.0e6*3600*24*365/1.0e12 -v GPP -c v3.LR.piControl -s 460 -e 461 --var=GPP --drc_in=${DATA}/ne30/raw --drc_out=${DATA}/ne30/clm
# Split all:
# cd ${DATA}/ne30/raw;ls *000[12]-??*.nc | ncclimo --split --dbg=1 -s 1 -e 2 --map=${DATA}/maps/map_ne30np4_to_cmip6_180x360_nco.20190601.nc --drc_out=${DATA}/ne30/clm
# Split ELM:
@@ -571,13 +571,15 @@ par_opt='' # [sng] Parallel options to shell
par_typ="${par_bck}" # [sng] Parallelism type
prc_typ='' # [sng] Procedure type (e.g., 'cam', 'cam2', 'cice', 'cism', 'clm', 'clm2', 'cpl', 'eam', 'eamxx', 'elm', 'mali', 'mpas', 'mpasa', 'mpasatmosphere', 'mpaso', 'mpasocean', 'mpascice', 'mpasseaice', 'mpassi')
qnt_prc='' # [nbr] Quantization precision
-rgn_avg='No' # [sng] Regional and global average timeseries
+rgn_avg='No' # [sng] Regional/global average timeseries
+rgn_stt='No' # [sng] Regional/global statistics
rgr_map='' # [sng] Regridding (horizontal) map
rgr_opt='' # [sng] Regridding options (e.g., '--rgr col_nm=lndgrid', '--rgr col_nm=nCells')
spl_opt='' # [sng] Splitter options (non-MPAS only) (e.g., '--no_cll_msr')
spl_rgr_opt='--no_stagger' # [sng] Splitter regridding options
sgs_frc='' # [sng] Sub-grid fraction variable
std_chk='Yes' # [sng] Check stdin for input file list
+sum_scl='1.0f' # Factor to convert area, time units ([sr], [km2], [s]) to desired units (e.g., [m2], [yr]) in sums
thr_nbr=2 # [nbr] Thread number for regridder
tms_flg='No' # [sng] Split (subset into timeseries) climatologies
tpd_out=1 # [nbr] Timesteps-per-day in output
@@ -643,12 +645,14 @@ function fnc_usg_prn { # NB: dash supports fnc_nm (){} syntax, not function fnc_
echo " ${fnt_bld}--qnt_prc${fnt_nrm} Quantization precision (empty means none) (default ${fnt_bld}${qnt_prc}${fnt_nrm}) [${fnt_tlc}qnt, qnt_prc, ppc, ppc_prc, precision, quantize${fnt_nrm}]"
echo "${fnt_rvr}-R${fnt_nrm} ${fnt_bld}rgr_opt${fnt_nrm} Regrid options (empty means none) (default ${fnt_bld}${rgr_opt}${fnt_nrm}) [${fnt_tlc}rgr_opt, regrid_options${fnt_nrm}]"
echo "${fnt_rvr}-r${fnt_nrm} ${fnt_bld}rgr_map${fnt_nrm} Regrid map-file (horizontal) (empty means none) (default ${fnt_bld}${rgr_map}${fnt_nrm}) [${fnt_tlc}rgr_map, regrid_map, map, map_file, map_fl${fnt_nrm}]"
- echo " ${fnt_bld}--rgn_avg${fnt_nrm} Regional and global average timeseries (default ${fnt_bld}${rgn_avg}${fnt_nrm}) [${fnt_tlc}rgn_avg, glb_avg, hms_avg, regional_average${fnt_nrm}]"
+ echo " ${fnt_bld}--rgn_avg${fnt_nrm} Regional/global average timeseries (default ${fnt_bld}${rgn_avg}${fnt_nrm}) [${fnt_tlc}rgn_avg, glb_avg, hms_avg, regional_average${fnt_nrm}]"
+ echo " ${fnt_bld}--rgn_stt${fnt_nrm} Regional/global statistical timeseries (default ${fnt_bld}${rgn_stt}${fnt_nrm}) [${fnt_tlc}rgn_stt, glb_stt, hms_stt, regional_statistic, global_statistic${fnt_nrm}] (avg|sum)"
echo "${fnt_rvr}-S${fnt_nrm} ${fnt_bld}yr_srt${fnt_nrm} Start year previous climo (empty means none) (default ${fnt_bld}${yr_srt_prv}${fnt_nrm}) [${fnt_tlc}yr_srt_prv, prv_yr_srt, previous_start${fnt_nrm}]"
echo "${fnt_rvr}-s${fnt_nrm} ${fnt_bld}yr_srt${fnt_nrm} Start year (default ${fnt_bld}${yr_srt}${fnt_nrm}) [${fnt_tlc}yr_srt, start_yr, year_start, start_year, start${fnt_nrm}]"
echo " ${fnt_bld}--seasons${fnt_nrm} Seasons to output ('none' means none) (default ${fnt_bld}${csn_lst}${fnt_nrm}, also available: jfm,amj,jas,ond,on,fm) [${fnt_tlc}csn_lst, csn, seasons${fnt_nrm}]"
echo " ${fnt_bld}--sgs_frc${fnt_nrm} Sub-grid fraction variable (empty means none) (default ${fnt_bld}${sgs_frc}${fnt_nrm}) [${fnt_tlc}sgs_frc, ice_frc, lnd_frc, ocn_frc, subgrid_fraction${fnt_nrm}]"
echo " ${fnt_bld}--split${fnt_nrm} Split input files into single-variable timeseries (default ${fnt_bld}${tms_flg}${fnt_nrm} [${fnt_tlc}splitter, tms_flg, timeseries${fnt_nrm}]"
+ echo " ${fnt_bld}--sum_scl${fnt_nrm} Scale factor to convert global sum timeseries to desired area units, timescale (empty means none) (default ${fnt_bld}${sum_scl}${fnt_nrm}) [${fnt_tlc}sum_scl, scl_fct, sum_scale, scale_factor${fnt_nrm}]"
echo "${fnt_rvr}-t${fnt_nrm} ${fnt_bld}thr_nbr${fnt_nrm} Thread number for regridder (default ${fnt_bld}${thr_nbr}${fnt_nrm}) [${fnt_tlc}thr_nbr, thr, thread_number, thread, threads${fnt_nrm}]"
echo " ${fnt_bld}--tpd_out${fnt_nrm} Timesteps-per-day in output (default ${fnt_bld}${tpd_out}${fnt_nrm}) [${fnt_tlc}tpd_out, tpd, timesteps_per_day${fnt_nrm}]"
echo " ${fnt_bld}--uio${fnt_nrm} Unbuffered I/O (NC_SHARE) for netCDF3 files [${fnt_tlc}uio, unbuffered, share${fnt_nrm}]"
@@ -812,8 +816,9 @@ while getopts :34567a:C:c:d:E:e:f:h:i:j:L:l:m:n:O:o:P:p:R:r:S:s:t:v:X:x:Y:y:-: O
prc_typ=?* | procedure=?* ) prc_typ="${LONG_OPTARG}" ;; # -P # Procedure type
par_typ=?* | par_md=?* | parallel_type=?* | parallel_mode=?* | parallel=?* ) par_typ="${LONG_OPTARG}" ;; # -p # Parallelism type
qnt=?* | qnt_prc=?* | precision=?* | ppc=?* | ppc_prc=?* | quantize=?* ) qnt_prc="${LONG_OPTARG}" ;; # # Quantization precision
- rgn_avg | glb_avg | hms_avg | regional_average ) rgn_avg='Yes' ;; # # Regional and global average timeseries
+ rgn_avg | glb_avg | hms_avg | regional_average ) rgn_avg='Yes'; rgn_stt='avg' ;; # # Regional/global average timeseries
rgn_avg=?* | glb_avg=?* | hms_avg=?* | regional_average=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # # Regional average timeseries
+ rgn_stt=?* | glb_stt=?* | hms_stt=?* | global_statistic=?* | regional_statistic=?* ) rgn_stt="${LONG_OPTARG}" ;; # # Regional/global statistical timeseries
rgr_opt=?* | regrid_options=?* ) rgr_opt_usr="${LONG_OPTARG}" ;; # -R # Regridding options
rgr_map=?* | regrid_map=?* | map=?* ) rgr_map="${LONG_OPTARG}" ;; # -r # Regridding map (horizontal)
yr_srt_prv=?* | prv_yr_srt=?* | previous_start=?* ) yr_srt_prv="${LONG_OPTARG}" ;; # -S # Start year previous
@@ -822,6 +827,7 @@ while getopts :34567a:C:c:d:E:e:f:h:i:j:L:l:m:n:O:o:P:p:R:r:S:s:t:v:X:x:Y:y:-: O
sgs_frc=?* | ice_frc=?* | lnd_frc=?* | ocn_frc=?* | subgrid_fraction=?* ) sgs_frc="${LONG_OPTARG}" ;; # # Sub-grid fraction variable
split | splitter | tms_flg | timeseries ) tms_flg='Yes' ;; # # Split input files into single-variable timeseries
split=?* | splitter=?* | tms_flg=?* | timeseries=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # # Split input files into single-variable timeseries
+ sum_scl=?* | scl_fct=?* | sum_scale=?* | scale_factor=?* ) sum_scl="${LONG_OPTARG}" ;; # # Factor to convert area, time units ([sr], [km2], [s]) to desired units (e.g., [m2], [yr]) in sums
stdin | inp_std | std_flg | redirect | standard_input ) printf "ERROR: ncclimo deprecated --stdin in version 5.0.4.\nHINT: Use --split to unambiguously invoke the splitter. This supercedes the old use for --stdin in ncclimo." ; exit 1 ;; # # Input file list from stdin
no_stdin | no_inp_std | no_redirect | no_standard_input ) std_chk='No' ;; # # Do not check stdin for input file list
no_stdin=?* | no_inp_std=?* | no_redirect=?* | no_standard_input=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # # Do not check stdin for input file list
@@ -1498,7 +1504,7 @@ if [ ${fl_nbr} -eq 0 ] || [ -z ${fl_in[0]} ]; then
fi # !fl_nbr
# Prepend drc_in to fl_in in MFOs (ncra, ncrcat)
-# 20240401 Also prepend drc_in to fl_in in SFOs (ncks, ncap2) used in hfc/hfs modes and in rgn_avg
+# 20240401 Also prepend drc_in to fl_in in SFOs (ncks, ncap2) used in hfc/hfs modes and in rgn_stt
# Otherwise operators will fail to find input files when cwd != drc_in
ppn_opt="-p ${drc_in}"
# 20220111 If input files include absolute path, then use fl_in as-is later on
@@ -1729,14 +1735,28 @@ if [ "${tms_flg}" = 'Yes' ]; then
fi # !mth_flg
let sgm_nbrm1=${sgm_nbr}-1
- if [ "${rgn_avg}" = 'Yes' ]; then
+ if [ "${rgn_stt}" != 'No' ]; then
+ # Export timeseries of regional/global statistics
+
+ # MUST pass rgn_stt to cmd_rgn script as an enum/flag (i.e., flg_sum) not a string. Sigh...
+ if [ "${rgn_stt}" = 'sum' ] || [ "${rgn_stt}" = 'ttl' ] || [ "${rgn_stt}" = 'total' ] || [ "${rgn_stt}" = 'integral' ]; then
+ rgn_stt='sum'
+ flg_sum=1
+ elif [ "${rgn_stt}" = 'avg' ] || [ "${rgn_stt}" = 'average' ] || [ "${rgn_stt}" = 'mean' ]; then
+ rgn_stt='avg'
+ flg_sum=0
+ else
+ echo "${spt_nm}: ERROR \"${rgn_stt}\" is an invalid value for regional_statistic"
+ echo "${spt_nm}: HINT The valid values for regional_statistic are \"avg\" (or synonyms \"average\", and \"mean\") and \"sum\" (or synonyms \"ttl\", \"total\", and \"integral\")"
+ exit 1
+ fi # !rgn_stt
if [ "${prc_mpas}" = 'Yes' ]; then
# 20240619
# MPAS-LI, MPAS-O, MPAS-SI v2+ datasets omit latitude variable
lat_nm='latCell' # Generic MPAS latitude variable
# MPAS-A, MPAS-LI, MPAS-O, MPAS-SI v2+ datasets omit (time-constant) area variable
- # NB: areaCell is full gridcell area on MPAS mesh, and does not account for landfrac
+ # NB: areaCell is full gridcell area on MPAS mesh, and does not account for landfrac/ocnfrac
# Hence, area_wgt variable diagnosed below will be inaccurate for MPAS-O unless 'ocnfrac' is given and applied as sgs_frc
area_nm='areaCell' # Generic MPAS fixed grid area variable
if [ "${prc_mpasseaice}" = 'Yes' ]; then
@@ -1769,7 +1789,7 @@ if [ "${tms_flg}" = 'Yes' ]; then
# 20240329 Prepend string literal '$' to each horizontal dimension for use in argument to ncap2 avg() function (e.g., 'lat,lon' -> '$lat,$lon')
hrz_arg="\$${hrz_dmn/,/,\$}"
fi # !hrz_dmn
- fi # !rgn_avg
+ fi # !rgn_stt
else # !tms_flg
@@ -1778,12 +1798,12 @@ else # !tms_flg
exit 1
fi # !mth_flg
- if [ "${rgn_avg}" = 'Yes' ]; then
- echo "${spt_nm}: ERROR Regional and global average timeseries functionality is supported for time-series (splitting) mode only. If you would like ${spt_nm} to provide global and regional mean output for other types of climatologies, please talk to Charlie."
- echo "${spt_nm}: HINT Create global means of climos with, e.g., \"ncwa -w ${area_nm} in.nc out.nc\""
+ if [ "${rgn_stt}" != 'No' ]; then
+ echo "${spt_nm}: ERROR Regional/global statistical timeseries functionality is supported for time-series (splitting) mode only. If you would like ${spt_nm} to provide global and regional statistical output for other types of climatologies, please talk to Charlie."
+ echo "${spt_nm}: HINT Create global statistics of climos with, e.g., \"ncwa -w ${area_nm} in.nc out.nc\""
echo "${spt_nm}: HINT See averaging documentation at http://nco.sf.net/nco.html#ncwa"
exit 1
- fi # !rgn_avg
+ fi # !rgn_stt
if [ -z "${out_nm}" ]; then
echo "${spt_nm}: ERROR Missing information needed to generate output filenames"
@@ -2120,6 +2140,7 @@ if [ ${dbg_lvl} -ge 2 ]; then
printf "dbg: drc_xtn = ${drc_xtn}\n"
printf "dbg: fl_fmt = ${fl_fmt}\n"
printf "dbg: fl_nbr = ${fl_nbr}\n"
+ printf "dbg: flg_sum = ${flg_sum}\n"
printf "dbg: fml_nm = ${fml_nm}\n"
printf "dbg: gaa_sng = ${gaa_sng}\n"
printf "dbg: hdr_pad = ${hdr_pad}\n"
@@ -2152,12 +2173,14 @@ if [ ${dbg_lvl} -ge 2 ]; then
printf "dbg: prc_typ = ${prc_typ}\n"
printf "dbg: qnt_prc = ${qnt_prc}\n"
printf "dbg: rgn_avg = ${rgn_avg}\n"
+ printf "dbg: rgn_stt = ${rgn_stt}\n"
printf "dbg: rgr_map = ${rgr_map}\n"
printf "dbg: rgr_opt = ${rgr_opt}\n"
printf "dbg: rgr_sfx = ${rgr_sfx}\n"
printf "dbg: sgm_nbr = ${sgm_nbr}\n"
printf "dbg: sgm_rmd = ${sgm_rmd}\n"
printf "dbg: sgs_frc = ${sgs_frc}\n"
+ printf "dbg: sum_scl = ${sum_scl}\n"
printf "dbg: thr_nbr = ${thr_nbr}\n"
printf "dbg: tms_flg = ${tms_flg}\n"
printf "dbg: tpd_out = ${tpd_out}\n"
@@ -2294,11 +2317,15 @@ if [ "${tms_flg}" = 'Yes' ]; then
elif [ ${clm_md} = 'mth' ]; then
printf "Each input file assumed to contain statistics for one month\n"
fi # !mth
- if [ "${rgn_avg}" = 'Yes' ]; then
- printf "Hemispherically and globally averaged timeseries files to be saved to directory ${drc_out}\n"
+ if [ "${rgn_stt}" != 'No' ]; then
+ if [ "${rgn_stt}" = 'avg' ]; then
+ printf "Hemispherically and globally averaged timeseries files to be saved to directory ${drc_out}\n"
+ elif [ "${rgn_stt}" = 'sum' ]; then
+ printf "Hemispherically and globally integrated (summed) timeseries files to be saved to directory ${drc_out}\n"
+ fi # !rgn_stt
else
printf "Native-grid timeseries files to be saved to directory ${drc_out}\n"
- fi # !rgn_avg
+ fi # !rgn_stt
if [ -n "${rgr_opt}" ]; then
printf "Regridded split files to directory ${drc_rgr}\n"
if [ "${thr_nbr}" -ne 1 ]; then
@@ -2956,31 +2983,32 @@ if [ "${tms_flg}" = 'Yes' ]; then
done # !var_idx
fi # !par_opt
- if [ "${rgn_avg}" = 'Yes' ]; then
+ if [ "${rgn_stt}" != 'No' ]; then
for ((var_idx=var_idx_srt;var_idx<=var_idx_end;var_idx++)); do
- cmd_rgn="*rgn_nbr=3;defdim(\"rgn\",rgn_nbr);*${var_sbs[${var_idx}]}_tmp=0.0f*${var_sbs[${var_idx}]}.avg(${hrz_arg});*${var_sbs[${var_idx}]}_rgn[time,rgn]=${var_sbs[${var_idx}]}_tmp;${var_sbs[${var_idx}]}_rgn at coordinates=\"region_name\";*${lat_nm}_area=${lat_nm}+0.0*${area_nm};*msk_sth=0*${lat_nm}_area.int();delete_miss(msk_sth);*msk_nrt=0*${lat_nm}_area.int();delete_miss(msk_nrt);*idx_glb=0;*idx_nrt=1;*idx_sth=2;*rgn_len=19;defdim(\"rgn_len\",rgn_len);region_name[rgn,rgn_len]=\" \";region_name(idx_glb,0:5)=\"Global\";region_name(idx_nrt,:)=\"Northern Hemisphere\";region_name(idx_sth,:)=\"Southern Hemisphere\";region_name at long_name=\"${var_sbs[${var_idx}]} timeseries array contains area-weighted averages over these regions\";${var_sbs[${var_idx}]}_rgn(:,idx_glb)=((${var_sbs[${var_idx}]}*${area_wgt}).avg(${hrz_arg})/(${area_wgt}).avg(${hrz_arg})).float();where(${lat_nm}_area < 0.0) msk_sth=1; elsewhere msk_nrt=1;${var_sbs[${var_idx}]}_rgn(:,idx_nrt)=((${var_sbs[${var_idx}]}*${area_wgt}*msk_nrt).avg(${hrz_arg})/(${area_wgt}*msk_nrt).avg(${hrz_arg})).float();${var_sbs[${var_idx}]}_rgn(:,idx_sth)=((${var_sbs[${var_idx}]}*${area_wgt}*msk_sth).avg(${hrz_arg})/(${area_wgt}*msk_sth).avg(${hrz_arg})).float();${var_sbs[${var_idx}]}=${var_sbs[${var_idx}]}_rgn;push(&${var_sbs[${var_idx}]}@cell_methods,\" area: mean\");if(exists(time_bnds)) time_bnds=time_bnds;if(exists(time_bounds)) time_bounds=time_bounds;"
+ cmd_rgn="*rgn_nbr=3;defdim(\"rgn\",rgn_nbr);*${var_sbs[${var_idx}]}_tmp=0.0f*${var_sbs[${var_idx}]}.avg(${hrz_arg});*${var_sbs[${var_idx}]}_rgn[time,rgn]=${var_sbs[${var_idx}]}_tmp;${var_sbs[${var_idx}]}_rgn at coordinates=\"region_name\";*${lat_nm}_area=${lat_nm}+0.0*${area_nm};*msk_sth=0*${lat_nm}_area.int();delete_miss(msk_sth);*msk_nrt=0*${lat_nm}_area.int();delete_miss(msk_nrt);*idx_glb=0;*idx_nrt=1;*idx_sth=2;*rgn_len=19;defdim(\"rgn_len\",rgn_len);region_name[rgn,rgn_len]=\" \";region_name(idx_glb,0:5)=\"Global\";region_name(idx_nrt,:)=\"Northern Hemisphere\";region_name(idx_sth,:)=\"Southern Hemisphere\";region_name at long_name=\"${var_sbs[${var_idx}]} timeseries array contains area-weighted averages over these regions\";where(${lat_nm}_area < 0.0) msk_sth=1; elsewhere msk_nrt=1;${var_sbs[${var_idx}]}_rgn(:,idx_glb)=((${var_sbs[${var_idx}]}*${area_wgt}).avg(${hrz_arg})/(${area_wgt}).avg(${hrz_arg})).float();${var_sbs[${var_idx}]}_rgn(:,idx_nrt)=((${var_sbs[${var_idx}]}*${area_wgt}*msk_nrt).avg(${hrz_arg})/(${area_wgt}*msk_nrt).avg(${hrz_arg})).float();${var_sbs[${var_idx}]}_rgn(:,idx_sth)=((${var_sbs[${var_idx}]}*${area_wgt}*msk_sth).avg(${hrz_arg})/(${area_wgt}*msk_sth).avg(${hrz_arg})).float();if(${flg_sum}){${var_sbs[${var_idx}]}_rgn(:,idx_glb)=${var_sbs[${var_idx}]}_rgn(:,idx_glb)*(${area_wgt}).total(${hrz_arg}).float()*${sum_scl};${var_sbs[${var_idx}]}_rgn(:,idx_nrt)=${var_sbs[${var_idx}]}_rgn(:,idx_nrt)*(${area_wgt}*msk_nrt).total(${hrz_arg}).float()*${sum_scl};${var_sbs[${var_idx}]}_rgn(:,idx_sth)=${var_sbs[${var_idx}]}_rgn(:,idx_sth)*(${area_wgt}*msk_sth).total(${hrz_arg}).float()*${sum_scl};}${var_sbs[${var_idx}]}=${var_sbs[${var_idx}]}_rgn;push(&${var_sbs[${var_idx}]}@cell_methods,\" area: mean\");if(exists(time_bnds)) time_bnds=time_bnds;if(exists(time_bounds)) time_bounds=time_bounds;"
# NB: We do not pass nco_opt to ncap2 here. nco_opt might contain switches like -x that have different meanings in ncap2
# File format is inherited from timeseries file, so no need to pass that
# One option to consider passing by default here is --no_tmp_fl
- # 20240411: Do not append history for rgn_avg computation---too much like encoding a program in a dataset
- cmd_avg[${var_idx}]="${cmd_mpi[${var_idx}]} OMP_PROC_BIND=false ncap2 -h -O -v -s '${cmd_rgn}' ${fl_out[${var_idx}]} ${fl_out[${var_idx}]}"
+ # 20240411: Do not append history for rgn_stt computation---too much like encoding a program in a dataset
+ cmd_stt[${var_idx}]="${cmd_mpi[${var_idx}]} OMP_PROC_BIND=false ncap2 -h -O -v -s '${cmd_rgn}' ${fl_out[${var_idx}]} ${fl_out[${var_idx}]}"
# 20220817: Prior to today, --glb_avg used ncwa for global average
# As of NCO 5.1.1, --glb_avg is a deprecated synonym for --rgn_avg
+ # As of NCO 5.2.8, --rgn_avg is a synonym for --rgn_stt=avg
# Both produce (currently three) regional timeseries
- # The original --glb_avg implementation is:
- # cmd_avg[${var_idx}]="${cmd_mpi[${var_idx}]} OMP_PROC_BIND=false ncwa -O -w ${area_nm} -a ${hrz_dmn} ${fl_out[${var_idx}]} ${fl_out[${var_idx}]}"
+ # The original --glb_avg implementation was:
+ # cmd_stt[${var_idx}]="${cmd_mpi[${var_idx}]} OMP_PROC_BIND=false ncwa -O -w ${area_nm} -a ${hrz_dmn} ${fl_out[${var_idx}]} ${fl_out[${var_idx}]}"
if [ ${dbg_lvl} -ge 1 ]; then
- echo ${cmd_avg[${var_idx}]}
+ echo ${cmd_stt[${var_idx}]}
fi # !dbg
if [ ${dbg_lvl} -le 1 ]; then
if [ -z "${par_opt}" ]; then
- eval ${cmd_avg[${var_idx}]}
+ eval ${cmd_stt[${var_idx}]}
if [ "$?" -ne 0 ]; then
- printf "${spt_nm}: ERROR global and regional average cmd_avg[${var_idx}] failed. Debug this:\n${cmd_avg[${var_idx}]}\n"
+ printf "${spt_nm}: ERROR global and regional statistics cmd_stt[${var_idx}] failed. Debug this:\n${cmd_stt[${var_idx}]}\n"
exit 1
fi # !err
else # !par_opt
- eval ${cmd_avg[${var_idx}]} ${par_opt} # eval always returns 0 on backgrounded processes
+ eval ${cmd_stt[${var_idx}]} ${par_opt} # eval always returns 0 on backgrounded processes
avg_pid[${var_idx}]=$!
fi # !par_opt
fi # !dbg
@@ -2991,9 +3019,9 @@ if [ "${tms_flg}" = 'Yes' ]; then
for ((var_idx=var_idx_srt;var_idx<=var_idx_end;var_idx++)); do
wait ${avg_pid[${var_idx}]}
if [ "$?" -eq 0 ]; then
- printf "`date`: Globally and regionally averaged ${cmd_avg[${var_idx}]##* }\n"
+ printf "`date`: Globally and regional statistics ${cmd_stt[${var_idx}]##* }\n"
else
- printf "${spt_nm}: ERROR Failed to globally and regionally average. cmd_avg[${var_idx}] failed. Debug this:\n${cmd_avg[${var_idx}]}\n"
+ printf "${spt_nm}: ERROR Failed in global and regional statistics. cmd_stt[${var_idx}] failed. Debug this:\n${cmd_stt[${var_idx}]}\n"
# 20190323: exiting parent here creates orphans, kill live children then exit
for ((kid_idx=var_idx+1;kid_idx<=var_idx_end;kid_idx++)); do
kill -9 ${avg_pid[${kid_idx}]}
@@ -3003,7 +3031,7 @@ if [ "${tms_flg}" = 'Yes' ]; then
done # !var_idx
fi # !par_opt
- fi # !rgn_avg
+ fi # !rgn_stt
done # !bch_idx
=====================================
data/ncremap
=====================================
@@ -294,16 +294,18 @@ fi # !hrd_pth && !NCO_PATH_OVERRIDE
# ncks -O --dbg=5 --thr_nbr=6 --grd_src=${DATA}/grids/ne30np4_pentagons.20190501.nc --grd_dst=${DATA}/grids/cmip6_180x360_scrip.20181001.nc --map=${HOME}/map.nc ~/nco/data/in.nc ~/foo.nc
# ncremap --dbg=1 --vrb=3 --devnull=No --nco='--dbg=1' --alg_typ=ncoidw --xtr_nsp=8 --xtr_xpn=2.0 --grd_src=${DATA}/grids/ne30np4_pentagons.20190501.nc --grd_dst=${DATA}/grids/cmip6_180x360_scrip.20181001.nc --map=${HOME}/map.nc
# ncremap --dbg=1 --alg_typ=bilin --grd_src=${DATA}/grids/oEC60to30.SCRIP.150729.nc --grd_dst=${DATA}/grids/t62_scrip.20181001.nc --map=${HOME}/map.nc
-# ncremap --dbg=1 --alg_typ=tempest --grd_src=${DATA}/grids/oEC60to30.SCRIP.150729.nc --grd_dst=${DATA}/grids/t62_scrip.20181001.nc --map=${HOME}/map.nc
-# ncremap --dbg=1 --alg_typ=tempest --grd_src=${DATA}/grids/oEC60to30.SCRIP.150729.nc --tpl=${DATA}/dstmch90/dstmch90_clm.nc --map=${HOME}/map.nc
-# ncremap --dbg=1 --alg_typ=tempest --grd_src=${DATA}/grids/128x256_SCRIP.20160301.nc --tpl=${DATA}/dstmch90/dstmch90_clm.nc --map=${HOME}/map.nc
+# ncremap --dbg=1 --alg_typ=traave --grd_src=${DATA}/grids/oEC60to30.SCRIP.150729.nc --grd_dst=${DATA}/grids/t62_scrip.20181001.nc --map=${HOME}/map.nc
+# ncremap --dbg=1 --alg_typ=traave --grd_src=${DATA}/grids/oEC60to30.SCRIP.150729.nc --tpl=${DATA}/dstmch90/dstmch90_clm.nc --map=${HOME}/map.nc
+# ncremap --dbg=1 --alg_typ=traave --grd_src=${DATA}/grids/128x256_SCRIP.20160301.nc --tpl=${DATA}/dstmch90/dstmch90_clm.nc --map=${HOME}/map.nc
# Regression:
# ncremap -P eam -7 -L 1 -m ${DATA}/maps/map_ne30np4_to_cmip6_180x360_aave.20181001.nc ${DATA}/bm/eamv1_ne30np4l72.nc ~/foo_eamv1.nc
# ncremap -P eam -7 -L 1 -m ${DATA}/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc ${DATA}/bm/eamv2_ne30pg2l72.nc ~/foo_eamv2.nc
# ncremap -P elm -7 -L 1 -m ${DATA}/maps/map_ne30np4_to_cmip6_180x360_aave.20181001.nc ${DATA}/bm/elmv1_ne30np4l15.nc ~/foo_elmv1.nc
# ncremap -P elm -7 -L 1 -m ${DATA}/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc ${DATA}/bm/elmv2_ne30pg2l15.nc ~/foo_elmv2.nc
+# ncremap -P elm -7 -L 1 -m ${DATA}/maps/map_r05_to_cmip6_180x360_traave.20240901.nc ${DATA}/bm/elmv3_r05l15.nc ~/foo_elmv3.nc
# ncremap -P mpasseaice -7 -L 1 -m ${DATA}/maps/map_oEC60to30v3_to_cmip6_180x360_aave.20181001.nc ${DATA}/bm/msiv1_oEC60to30v3.nc ~/foo_msiv1.nc
# ncremap -P mpasseaice -7 -L 1 -m ${DATA}/maps/map_EC30to60E2r2_to_cmip6_180x360_aave.20220301.nc ${DATA}/bm/msiv2_EC30to60E2r2l5.nc ~/foo_msiv2.nc
+# ncremap -P mpasseaice -7 -L 1 -m ${DATA}/maps/map_IcoswISC30E3r5_to_cmip6_180x360_traave.20231201.nc ${DATA}/bm/msiv3_IcoswISC30E3r5l5.nc ~/foo_msiv3.nc
# ncremap -P mpasocean -7 -L 1 -m ${DATA}/maps/map_oEC60to30v3_to_cmip6_180x360_aave.20181001.nc ${DATA}/bm/mpov1_oEC60to30v3l60.nc ~/foo_mpov1.nc
# ncremap -P mpasocean -7 -L 1 -m ${DATA}/maps/map_EC30to60E2r2_to_cmip6_180x360_aave.20220301.nc ${DATA}/bm/mpov2_EC30to60E2r2l60.nc ~/foo_mpov2.nc
# ncremap -P mpasocean -7 -L 1 -m ${DATA}/maps/map_IcoswISC30E3r5_to_cmip6_180x360_traave.20231201.nc ${DATA}/bm/mpov3_IcoswISC30E3r5l64.nc ~/foo_mpov3.nc
@@ -565,7 +567,7 @@ mlt_map_flg='Yes' # [sng] Multi-map flag
mpaso_var_zmid='timeMonthly_avg_zMid' # [sng] Name of MPAS-O 3D depth variable
mpi_flg='No' # [sng] Parallelize over nodes
mpi_nbr=1 # [sng] Number of tasks-per-node that MPI-enabled weight generators will request (should be factor of prt_nbr)
-mpt_mss='No' # [flg] Set empty (sgs_frc=0.0) SGS cells to missing value
+mpt_mss='No' # [flg] Set empty (sgs_frc==0.0) SGS cells to missing value
msh_exe_tps='GenerateOverlapMesh' # [sng] TempestRemap mesh-generation executable
msh_fl='' # [sng] Mesh-file (for Tempest)
msk_apl='No' # [flg] Apply msk_out to variables after regridding
@@ -694,7 +696,7 @@ function fnc_usg_prn { # NB: dash supports fnc_nm (){} syntax, not function fnc_
echo "${fnt_rvr}-m${fnt_nrm} ${fnt_bld}map_fl${fnt_nrm} Map-file (empty means generate internally) (default ${fnt_bld}${map_fl}${fnt_nrm}) [${fnt_tlc}map_fl, map, map_file, rgr_map, regrid_map${fnt_nrm}]"
echo " ${fnt_bld}--mpi_nbr${fnt_nrm} Number of tasks-per-node that MPI-enabled weight generators will request (default ${fnt_bld}${mpi_nbr}${fnt_nrm}) [${fnt_tlc}mpi_nbr, mpi_number, tsk_nbr, task_number${fnt_nrm}]"
echo " ${fnt_bld}--mpi_pfx${fnt_nrm} Prefix for MPI-enabled weight generators (empty means weight generator is not MPI-enabled) (default ${fnt_bld}${mpi_pfx}${fnt_nrm}) [${fnt_tlc}mpi_pfx, mpi_prefix, srun_cmd, srun_command${fnt_nrm}]"
- echo " ${fnt_bld}--mpt_mss${fnt_nrm} Set empty (sgs_frc=0.0) SGS cells to missing value (default ${fnt_bld}${mpt_mss}${fnt_nrm}) [${fnt_tlc}mpt_mss, sgs_zro_mss$, empty_missing{fnt_nrm}]"
+ echo " ${fnt_bld}--mpt_mss${fnt_nrm} Set empty (sgs_frc==0.0) SGS cells to missing value (default ${fnt_bld}${mpt_mss}${fnt_nrm}) [${fnt_tlc}mpt_mss, sgs_zro_mss$, empty_missing{fnt_nrm}]"
echo " ${fnt_bld}--msh_fl${fnt_nrm} Mesh-file for grid intersection (empty means generate internally or not at all) (default ${fnt_bld}${msh_fl}${fnt_nrm}) [${fnt_tlc}msh_fl, msh, mesh, mesh_file${fnt_nrm}]"
echo " ${fnt_bld}--msk_apl${fnt_nrm} Apply msk_out to variables after regridding (default ${fnt_bld}${msk_apl}${fnt_nrm}) [${fnt_tlc}msk_apl, mask_apply, msk_app${fnt_nrm}]"
echo " ${fnt_bld}--msk_dst${fnt_nrm} Mask-template variable in destination file (empty means none) (default ${fnt_bld}${msk_dst}${fnt_nrm}) [${fnt_tlc}msk_dst, dst_msk, mask_destination, mask_dst${fnt_nrm}]"
@@ -893,8 +895,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:-
mlt_map=?* | multimap=?* | no_multimap=?* | nomultimap=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # -M # Multi-map flag
mpi_nbr=?* | mpi_number=?* | tsk_nbr=?* | task_number=?* ) mpi_nbr_usr="${LONG_OPTARG}" ;; # # Number of tasks-per-node that MPI-enabled weight generators will request
mpi_pfx=?* | mpi_prefix=?* | srun_cmd=?* | srun_command=?* ) mpi_pfx_usr="${LONG_OPTARG}" ;; # # Prefix for MPI-enabled weight generators
- mpt_mss | sgs_zro_mss | empty_missing ) mpt_mss='Yes' ;; # # Set empty (sgs_frc=0.0) SGS cells to missing value
- mpt_mss=?* | sgs_zro_mss=?* | empty_missing=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # # Set empty (sgs_frc=0.0) SGS cells to missing value
+ mpt_mss | sgs_zro_mss | empty_missing ) mpt_mss='Yes' ;; # # Set empty (sgs_frc==0.0) SGS cells to missing value
+ mpt_mss=?* | sgs_zro_mss=?* | empty_missing=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # # Set empty (sgs_frc==0.0) SGS cells to missing value
msh_fl=?* | msh=?* | mesh=?* | mesh_file=?* ) msh_fl="${LONG_OPTARG}" ;; # # Mesh file
msk_apl | mask_apply | msk_app ) msk_apl='Yes' ;; # # Apply msk_out to variables after regridding
msk_apl=?* | mask_apply=?* | msk_app=?* ) echo "No argument allowed for --${OPTARG switch}" >&2; exit 1 ;; # # Apply msk_out to variables after regridding
=====================================
debian/changelog
=====================================
@@ -1,8 +1,9 @@
-nco (5.2.7-2) UNRELEASED; urgency=medium
+nco (5.2.8-1) unstable; urgency=medium
+ * New upstream release.
* Bump Standards-Version to 4.7.0, no changes.
- -- Bas Couwenberg <sebastic at debian.org> Sun, 28 Jul 2024 19:46:18 +0200
+ -- Bas Couwenberg <sebastic at debian.org> Tue, 03 Sep 2024 05:38:29 +0200
nco (5.2.7-1) unstable; urgency=medium
=====================================
doc/ANNOUNCE
=====================================
@@ -1,87 +1,70 @@
$Header$ -*-text-*-
-netCDF Operators NCO version 5.2.7 march into history
+netCDF Operators NCO version 5.2.8 topple the technocracy
http://nco.sf.net (Homepage, Mailing lists, Help)
http://github.com/nco/nco (Source Code, Issues, Releases)
What's new?
-Version 5.2.7 contains updates to quantization metadata,
-enhanced grid area diagnostics for check_map, and bug-fixes
-for ncremap.
-
-Work on NCO 5.2.8 has commenced and will add support for Zarr S3
-stores, and will enhance the vertical regridder.
+Version 5.2.8 mostly contains features and fixes for regridding
+and climatology generation. Climatologies now allow the choice
+between two statistics (sums and means) to output as regional/global
+timeseries. The regridder fixes corner case behavior when the
+sub-gridscale (SGS) fraction is a missing value (as in ELM/CLM).
+Many improvements to the robustness and helpfulness of WARNINGs
+and ERRORs are included. Upgrades are encouraged for everyone
+who uses the regridder on ELM/CLM/CTSM datasets.
Enjoy,
Charlie
NEW FEATURES (full details always in ChangeLog):
-A. Version 5.2.7 implements the final (we think) CF quantization
-metadata convention. The main change is that the keywords and
-container variable are now "quantization" instead of
-"lossy_compression".
-ncks -7 -v ps,ts --qnt_alg=btr --qnt default=9 --qnt ps=13 --cmp='shf|zst' in.nc out.nc
-ncks -m -C -v ps,ts,quantization_info out.nc
-netcdf out {
-...
- float ps(time,lat,lon) ;
- ps:standard_name = "surface_air_pressure" ;
- ps:units = "Pa" ;
- ps:quantization = "quantization_info" ;
- ps:quantization_nsb = 13 ;
- ps:quantization_maximum_relative_error = 6.103516e-05f ;
-
- char quantization_info ;
- quantization_info:algorithm = "bitround" ;
- quantization_info:implementation = "NCO version 5.2.7" ;
-
- float ts(time) ;
- ts:standard_name = "surface_temperature" ;
- ts:units = "K" ;
- ts:quantization = "quantization_info" ;
- ts:quantization_nsb = 9 ;
- ts:quantization_maximum_relative_error = 0.0009765625f ;
-} // group /
-http://nco.sf.net/nco.html#qnt_alg
-http://nco.sf.net/nco.html#qnt
-
-B. ncks --chk_map now produces additional diagnostics about the
-source and destination grids. Then new diagnostics are values and
-locations (index, latitude, longitude) of the minimum and maximum
-gridcell areas (usually in sterradians), together with the effective
-quadrilateral size on Earth of the gridcell (assuming a square shaped
-cell of equivalent area):
-ncks --chk_map map_ne30pg2_to_cmip6_180x360_nco.20200901.nc
-...
-area_a min, ~dx: 4.9093515660647374e-04 sr, 141.14 km in grid A cell [21544,+45.7267,+177.69]
-area_a max, ~dx: 6.8523331840188574e-04 sr, 166.75 km in grid A cell [9061,+0.749936,+180.75]
-...
-area_b min, ~dx: 2.6580860638549120e-06 sr, 10.39 km in grid A cell [60,-42.7476,+359.25]
-area_b max, ~dx: 3.0460968486221404e-04 sr, 111.18 km in grid A cell [32272,-68.5,+135.5]
-These diagnostics can be useful in identifying grid-related dynamics
-issues, e.g., due to CFL conditions. This feature was inspired by
-map diagnostic software from Mark Taylor (SNL).
-http://nco.sf.net/nco.html#chk_map
+A. ncclimo has two new options to control global/regional timeseries:
+--rgn_stt=avg|sum and --sum_scl=sum_scl. These options allow the user
+to choose which statistic, sums or averages, to output with
+global/regional timeseries for all variables. The option --rgn_stt=avg
+is identical to the current timeseries output by the --rgn_avg switch
+(which will be deprecated eventually). When invoked with --rgn_stt=sum
+the averaged field is multiplied by the sum of the area variable.
+For fields that are area-intensive (e.g., fluxes per unit area) this
+results in the total net flux over the area. However, the field must
+employ the same area units as the Area variable for this to be true.
+For example, fields given in m-2 would need to employ an Area variable
+in m2. Unfortunately, many people love non-SI units so that is rarely
+the case! For example, ELM and CLM archive Area in km2, so a scale
+factor of one million is needed to correct the sum for many variables.
+EAM and CAM use sr-1 for Area so it needs a different scale factor.
+That is why ncclimo accepts a second new option --sum_scl=sum_scl.
+This scale factor multiplies the integrated field value, and allows
+the user to generate timeseries in the desired units for any field.
+The whole procedure is model and variable-specific and we are open
+to suggestions to make it more useful. Example usage is:
+
+# Timeseries of global GPP in grams/s for ELM/CLM:
+ncclimo -P elm --split --rgn_stt=sum --sum_scl=1.0e6 -v GPP ...
+# Timeseries of global GPP in GT C/yr for ELM/CLM:
+ncclimo -P elm --split --rgn_stt=sum --sum_scl=1.0e6*3600*24*365/1.0e12 -v GPP ...
+# Timeseries of global column vapor in kg for EAM/CAM:
+ncclimo -P eam --split --rgn_stt=sum --sum_scl=6.37122e6^2 -v TMQ ...
+http://nco.sf.net/nco.html#ncclimo
+http://nco.sf.net/nco.html#rgn_stt
+http://nco.sf.net/nco.html#sum_scl
BUG FIXES:
-A. ncremap: A bug that crept into version 5.2.6 has been fixed.
-Namely, the detection of empty destination gridcells was broken.
-This prevented correctly adding the _FillValue attribute to some
-fields with missing values. The workaround is to use version 5.2.4.
-The solution is to upgrade. Thanks to Xylar Asay-Davis (LANL) for
-reporting resultant problems.
-
-B. ncclimo: A bug that crept into version 5.2.6 has been fixed.
-ncclimo had stopped passing the specified processing type (-P mdl)
-to internal calls to ncremap. This prevented ncremap from
-automagically weighting fields from surface models by the appropriate
-sub-gridscale fraction variable (landfrac for ELM+CLM, aice for CICE,
-timeMonthly_avg_iceAreaCell for MPAS-Seaice). The workaround is to use
-version 5.2.4. The solution is to upgrade. Thanks to Tony Bartoletti
-(LLNL) for noticing resultant problems.
+A. ncks --chk_map fixes a mix-up introduced in 5.2.7 where the new
+area_b diagnostics were mis-labeled and show the location of min/max
+on the area_a grid instead of the area_b grid. The workaround is to
+use 5.2.6 or earlier. The solution is to upgrade.
+
+B. ncremap fixes a problem where portions of missing values (aka
+_FillValue) could infect destination cells whose sub-gridscale (SGS)
+fractions equal _FillValue. This problem can arise in ELM/CLM
+datasets because their 'landfrac' variable sets non-land areas to the
+missing value (a practice of questionable value). Thanks to Chloe
+Whicker-Clarke for reporting this issue. There is no workaround. The
+solution is to upgrade.
Full release statement at http://nco.sf.net/ANNOUNCE
@@ -90,8 +73,8 @@ 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 5.2.7 built/tested under
-MacOS 14.5 with netCDF 4.9.3-dev on HDF5 1.14.3 and with
-Linux FC38 with netCDF 4.9.2 on HDF5 1.14.1.
+MacOS 14.6.1 with netCDF 4.9.3-RC1 on HDF5 1.14.3 and with
+Linux FC40 with netCDF 4.9.2 on HDF5 1.14.1.
A. NOT YET FIXED (NCO problem)
Correctly read arrays of NC_STRING with embedded delimiters in ncatted arguments
=====================================
doc/ChangeLog
=====================================
@@ -1,3 +1,81 @@
+2024-09-02 Charlie Zender <zender at uci.edu>
+
+ * NCO 5.2.8 release procedure:
+ cd ~/nco;git commit -a -m 'Version 5.2.8: Sitton Peak';git push
+ git tag -a 5.2.8 -m 'ncremap: fix sub-SGS algorithm, sum_scl, rgn_stt=sum, chk_map dgn area_b, cnk max WARNING; ncatted/ncrename: hst_att_cat NC_STRING WARNING';git push --tags
+
+ * Document --glb_stt/--sum_scl options
+
+2024-08-31 Charlie Zender <zender at uci.edu>
+
+ * NCO 5.2.8-alpha03 release procedure:
+ cd ~/nco;git commit -a -m 'Version 5.2.8-alpha03: Swim, Rick, Swim!';git push
+ git tag -a 5.2.8-alpha03 -m 'ncremap: fix sub-SGS algorithm, NC_ERANGE dgn, --sum_scl';git push --tags
+
+ * ncremap: Yesterday's SGS fix also removed need for sub_sgs_frc_out_thr so remove it
+ Verify threshold-free sub-SGS regridding handles all ELM problems from the past (see 20220615)
+ Eliminates last kludge in SGS regridder!
+
+2024-08-30 Charlie Zender <zender at uci.edu>
+
+ * ncremap: Stop weighting accumulation to SGS values where sgs_frc_in is missing value
+ Potentially serious bug most likely to affect ELM datasets whose sgs_frc = landfrac contains missing values
+ Also crops-up when applying new SGS variable (e.g., Icemask) in regions where ELM may not have valid input
+
+ * ncremap: Further improve flag and ERANGE diagnostics
+
+2024-08-29 Charlie Zender <zender at uci.edu>
+
+ * nco_put_vara(): Add diagnostics for NC_ERANGE errors
+
+ * ncremap: Add v3 regression commands
+
+2024-08-24 Charlie Zender <zender at uci.edu>
+
+ * ncclimo: Add --sum_scl option for global sum timeseries
+
+2024-08-23 Charlie Zender <zender at uci.edu>
+
+ * NCO 5.2.8-alpha02 release procedure:
+ cd ~/nco;git commit -a -m 'Version 5.2.8-alpha02: Clean Subaru';git push
+ git tag -a 5.2.8-alpha02 -m 'all: NCO_MAX_CHUNK_SIZE HINT, WARNING; ncatted/ncrename: fl_fmt msg, NC_STRING; ncclimo: --rgn_stt=sum; ncks --chk_map fix area_b dgn';git push --tags
+
+ * ncclimo: Pass flg_sum not rgn_stt to cmd_rgn. Workaround ncap2 syntax errors. Confirm BFB with old avg procedure.
+
+ * ncclimo: Implement --rgn_stt. Make --rgn_avg a synonym for --rgn_stt=avg. Implement --rgn_avg=ttl.
+
+2024-08-21 Charlie Zender <zender at uci.edu>
+
+ * nco_cnk_sz_set_trv(): Kludgy adjustment to maximum chunk length, add WARNING
+
+ * nco_def_var_chunking(): Add HINT
+
+2024-08-11 Charlie Zender <zender at uci.edu>
+
+ * ncatted and ncrename now explain (then exit) when user specifies output file type
+
+ * Improve WARNING when ncatted and ncrename will not modify NC_STRING history attributes
+
+2024-08-09 Charlie Zender <zender at uci.edu>
+
+ * Revert nco_hst_att_cat() NC_STRING feature for ncatted/ncrename (fail at nc_enddef()/nc_close() stage)
+
+ * Print correct label and location for new grid diagnostics for area_b in nco_map_chk()
+
+ * NCO 5.2.8-alpha01 release procedure:
+ cd ~/nco;git commit -a -m 'Version 5.2.8-alpha01: Kia';git push
+ git tag -a 5.2.8-alpha01 -m 'Functionally identical to 5.2.7 and supports NC_STRING history attribute';git push --tags
+
+ * Modify nco_hst_att_cat() to write/append an NC_STRING history attribute
+
+2024-08-08 Charlie Zender <zender at uci.edu>
+
+ * nco_c++ nco_att.hh address two CEWI warnings
+
+2024-07-24 Charlie Zender <zender at uci.edu>
+
+ * Rudimentary version of CAAS algorithm primitives works with CAAS arrays
+
2024-07-23 Charlie Zender <zender at uci.edu>
* NCO 5.2.7 release procedure:
@@ -51,7 +129,7 @@
cd ~/nco;git commit -a -m 'Version 5.2.7-alpha02: Stroker';git push
git tag -a 5.2.7-alpha02 -m 'all: qnt lossy_compresion->quantization, dpr family; ncremap wrn->nfo, CAAS stb';git push --tags
- * Open nonlinear map when present
+ * Open nonlinear map when present on command line
* Add stubs to pass/free non-linear map name for CAAS to regridder with --rgr_nlm
=====================================
doc/VERSION
=====================================
@@ -1 +1 @@
-5.2.7
+5.2.8
=====================================
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-5.2.7
- First we create a clean source distribution of nco and place it in nco-5.2.7
+ For starters, we wish to create .debs of tagged releases, e.g., nco-5.2.8
+ First we create a clean source distribution of nco and place it in nco-5.2.8
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-5.2.7
-/bin/rm nco.tar.gz;tar cvzf nco-5.2.7.tar.gz ./nco-5.2.7/*
-cd ~/nco/nco-5.2.7
-dh_make -e zender at uci.edu -f ../nco-5.2.7.tar.gz
+cd ~/nco;tar xvzf nco.tar.gz;mv nco nco-5.2.8
+/bin/rm nco.tar.gz;tar cvzf nco-5.2.8.tar.gz ./nco-5.2.8/*
+cd ~/nco/nco-5.2.8
+dh_make -e zender at uci.edu -f ../nco-5.2.8.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-5.2.7.tar.gz
from previous build
cd ~/nco;/bin/rm *.gz
- cd ~/nco/nco-5.2.7
+ cd ~/nco/nco-5.2.8
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 5.2.7 with X.Y.Z+1
+# tags-query replace 5.2.8 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 5.2.7-1 # Update changelog (-b forces this version number)
+ cd ~/nco/debian;dch -b --force-distribution --distribution=unstable -v 5.2.8-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-5.2.7
+ ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-5.2.8
# Upload tarball to SF https://sourceforge.net/projects/nco/files
- cd;scp dust.ess.uci.edu:/var/www/html/nco/src/nco-5.2.7.tar.gz .
+ cd;scp dust.ess.uci.edu:/var/www/html/nco/src/nco-5.2.8.tar.gz .
7. Ubuntu PPA
https://help.launchpad.net/Packaging/PPA
-dput NCO nco_5.2.7-2~ppa1_source.changes
+dput NCO nco_5.2.8-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_5.2.7-1.dpkg-buildpackage.txt
-http://dust.ess.uci.edu/nco/src/nco_5.2.7-1.dsc
-http://dust.ess.uci.edu/nco/src/nco_5.2.7-1_i386.changes
-http://dust.ess.uci.edu/nco/src/nco_5.2.7-1_i386.deb
-http://dust.ess.uci.edu/nco/src/nco_5.2.7.orig.tar.gz
+http://dust.ess.uci.edu/nco/src/nco_5.2.8-1.dpkg-buildpackage.txt
+http://dust.ess.uci.edu/nco/src/nco_5.2.8-1.dsc
+http://dust.ess.uci.edu/nco/src/nco_5.2.8-1_i386.changes
+http://dust.ess.uci.edu/nco/src/nco_5.2.8-1_i386.deb
+http://dust.ess.uci.edu/nco/src/nco_5.2.8.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-5.2.7 ${DATA}/nco_5.2.7* ${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-5.2.7-1 -d nco-5.2.7 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-5.2.7 nco # Export most recent
-tar cvzf ./nco_5.2.7.orig.tar.gz --exclude='nco-5.2.7/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-5.2.7
-/bin/rm -rf ${DATA}/nco-5.2.7 # Remove cvs-exported directory
-tar xvzf ./nco_5.2.7.orig.tar.gz # Untar to get directory without excluded files
-mkdir -p ${DATA}/nco-5.2.7/debian/source;cd ~/nco/debian;/bin/cp changelog compat control convert copyright doc-base files info rules ${DATA}/nco-5.2.7/debian;cd ~/nco/debian/source;/bin/cp format ${DATA}/nco-5.2.7/debian/source # Replace debian directory with _CURRENT_ (main trunk) settings
+sudo /bin/rm -rf ${DATA}/nco-5.2.8 ${DATA}/nco_5.2.8* ${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-5.2.8-1 -d nco-5.2.8 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-5.2.8 nco # Export most recent
+tar cvzf ./nco_5.2.8.orig.tar.gz --exclude='nco-5.2.8/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-5.2.8
+/bin/rm -rf ${DATA}/nco-5.2.8 # Remove cvs-exported directory
+tar xvzf ./nco_5.2.8.orig.tar.gz # Untar to get directory without excluded files
+mkdir -p ${DATA}/nco-5.2.8/debian/source;cd ~/nco/debian;/bin/cp changelog compat control convert copyright doc-base files info rules ${DATA}/nco-5.2.8/debian;cd ~/nco/debian/source;/bin/cp format ${DATA}/nco-5.2.8/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-5.2.7;dpkg-buildpackage -rsudo -uc -us > ~/foo.nco 2>&1 # -uc -us: Do not sign changes or source files
-#cd ${DATA}/nco-5.2.7;dpkg-buildpackage -rsudo -sa > ~/foo.nco 2>&1 # -sa: Include _orig.tar.gz in .changes
-cd ${DATA}/nco-5.2.7;dpkg-buildpackage -rsudo > ~/foo.nco 2>&1
+#cd ${DATA}/nco-5.2.8;dpkg-buildpackage -rsudo -uc -us > ~/foo.nco 2>&1 # -uc -us: Do not sign changes or source files
+#cd ${DATA}/nco-5.2.8;dpkg-buildpackage -rsudo -sa > ~/foo.nco 2>&1 # -sa: Include _orig.tar.gz in .changes
+cd ${DATA}/nco-5.2.8;dpkg-buildpackage -rsudo > ~/foo.nco 2>&1
sudo dpkg --remove nco
-sudo dpkg --install ${DATA}/nco_5.2.7-1_*.deb
+sudo dpkg --install ${DATA}/nco_5.2.8-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_5.2.7-1_*.deb
-ls -l ${DATA}/nco_5.2.7*
+lintian ${DATA}/nco_5.2.8-1_*.deb
+ls -l ${DATA}/nco_5.2.8*
m ~/foo.nco
# Upload Ubuntu (rather than Debian) packages to websites
-scp ${DATA}/nco_5.2.7* dust.ess.uci.edu:/var/www/html/nco/src
-scp ${DATA}/nco_5.2.7* zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
+scp ${DATA}/nco_5.2.8* dust.ess.uci.edu:/var/www/html/nco/src
+scp ${DATA}/nco_5.2.8* 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_5.2.7-1_*.changes
+# cd ${DATA};dupload -t mentors nco_5.2.8-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_5.2.7* # Cleanup prior build
+sudo /bin/rm /var/cache/pbuilder/result/nco_5.2.8* # 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_5.2.7-1.dsc > ~/foo.nco.pbuilder 2>&1
-cd /var/cache/pbuilder/result;debsign -k6F635D10 nco_5.2.7-1_*.changes
-lintian /var/cache/pbuilder/result/nco_5.2.7-1_*.deb
+cd ${DATA};DIST=sid sudo pbuilder build nco_5.2.8-1.dsc > ~/foo.nco.pbuilder 2>&1
+cd /var/cache/pbuilder/result;debsign -k6F635D10 nco_5.2.8-1_*.changes
+lintian /var/cache/pbuilder/result/nco_5.2.8-1_*.deb
sudo dpkg --remove nco
-sudo dpkg --install /var/cache/pbuilder/result/nco_5.2.7-1_*.deb
+sudo dpkg --install /var/cache/pbuilder/result/nco_5.2.8-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_5.2.7-1_*.changes
+cd /var/cache/pbuilder/result;dupload -t mentors nco_5.2.8-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-5.2.7 ${DATA}/nco-5.2.7* # Cleanup last build
+/bin/rm -rf ${DATA}/nco-5.2.8 ${DATA}/nco-5.2.8* # Cleanup last build
${sudo_sng} /bin/rm -r -f \
-${rpm_root}/BUILD/nco-5.2.7 \
-${rpm_root}/RPMS/i386/nco-5.2.7-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-5.2.7-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-5.2.7-?.i386.rpm \
-${rpm_root}/SOURCES/nco-5.2.7.tar.gz \
-${rpm_root}/SPECS/nco-5.2.7.spec \
-${rpm_root}/SRPMS/nco-5.2.7-?.src.rpm
-cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-5.2.7-1 -d nco-5.2.7 nco # Export based on tag
-${sudo_sng} ln -s ${HOME}/nco/bld/nco.spec ${rpm_root}/SPECS/nco-5.2.7.spec
-tar cvzf ./nco-5.2.7.tar.gz --exclude='nco-5.2.7/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-5.2.7
-${sudo_sng} /bin/cp ${DATA}/nco-5.2.7.tar.gz ${rpm_root}/SOURCES
+${rpm_root}/BUILD/nco-5.2.8 \
+${rpm_root}/RPMS/i386/nco-5.2.8-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-5.2.8-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-5.2.8-?.i386.rpm \
+${rpm_root}/SOURCES/nco-5.2.8.tar.gz \
+${rpm_root}/SPECS/nco-5.2.8.spec \
+${rpm_root}/SRPMS/nco-5.2.8-?.src.rpm
+cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-5.2.8-1 -d nco-5.2.8 nco # Export based on tag
+${sudo_sng} ln -s ${HOME}/nco/bld/nco.spec ${rpm_root}/SPECS/nco-5.2.8.spec
+tar cvzf ./nco-5.2.8.tar.gz --exclude='nco-5.2.8/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-5.2.8
+${sudo_sng} /bin/cp ${DATA}/nco-5.2.8.tar.gz ${rpm_root}/SOURCES
cd ${rpm_root}/SPECS
-${sudo_sng} rpmbuild -ba --sign nco-5.2.7.spec > ~/foo.nco 2>&1
+${sudo_sng} rpmbuild -ba --sign nco-5.2.8.spec > ~/foo.nco 2>&1
scp \
-${rpm_root}/RPMS/i386/nco-5.2.7-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-5.2.7-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-5.2.7-?.i386.rpm \
-${rpm_root}/SRPMS/nco-5.2.7-?.src.rpm \
+${rpm_root}/RPMS/i386/nco-5.2.8-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-5.2.8-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-5.2.8-?.i386.rpm \
+${rpm_root}/SRPMS/nco-5.2.8-?.src.rpm \
dust.ess.uci.edu:/var/www/html/nco/src
scp \
-${rpm_root}/RPMS/i386/nco-5.2.7-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-debuginfo-5.2.7-?.i386.rpm \
-${rpm_root}/RPMS/i386/nco-devel-5.2.7-?.i386.rpm \
-${rpm_root}/SRPMS/nco-5.2.7-?.src.rpm \
+${rpm_root}/RPMS/i386/nco-5.2.8-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-debuginfo-5.2.8-?.i386.rpm \
+${rpm_root}/RPMS/i386/nco-devel-5.2.8-?.i386.rpm \
+${rpm_root}/SRPMS/nco-5.2.8-?.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-5.2.7 ${DATA}/nco-5.2.7* # Cleanup last build
+/bin/rm -rf ${DATA}/nco-5.2.8 ${DATA}/nco-5.2.8* # Cleanup last build
/bin/rm -r -f \
-${rpm_root}/nco-5.2.7-?.src.rpm \
-${rpm_root}/nco-5.2.7.spec \
-${rpm_root}/nco-5.2.7.tar.gz \
-${rpm_root}/*/nco-5.2.7-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-5.2.7-?.*.rpm \
-${rpm_root}/*/nco-devel-5.2.7-?.*.rpm
-# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-5.2.7-1 -d nco-5.2.7 nco # Export based on tag
-cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -D "1 second ago" -dnco-5.2.7 nco # Export most recent and build as 5.2.7-1
-tar cvzf ./nco-5.2.7.tar.gz --exclude='nco-5.2.7/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-5.2.7
-/bin/cp ${DATA}/nco-5.2.7.tar.gz ${rpm_root}
+${rpm_root}/nco-5.2.8-?.src.rpm \
+${rpm_root}/nco-5.2.8.spec \
+${rpm_root}/nco-5.2.8.tar.gz \
+${rpm_root}/*/nco-5.2.8-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-5.2.8-?.*.rpm \
+${rpm_root}/*/nco-devel-5.2.8-?.*.rpm
+# cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -r nco-5.2.8-1 -d nco-5.2.8 nco # Export based on tag
+cd ${DATA};cvs -d zender at nco.cvs.sf.net:/cvsroot/nco export -kkv -D "1 second ago" -dnco-5.2.8 nco # Export most recent and build as 5.2.8-1
+tar cvzf ./nco-5.2.8.tar.gz --exclude='nco-5.2.8/debian*' --exclude='.cvsignore' --exclude='ncap_lex.c' --exclude='ncap_yacc.[ch]' ./nco-5.2.8
+/bin/cp ${DATA}/nco-5.2.8.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-5.2.7-?.*.rpm
+rpmlint ${rpm_root}/*/nco-5.2.8-?.*.rpm
sudo yum remove nco
-sudo yum install ${rpm_root}/*/nco-5.2.7-?.*.rpm
+sudo yum install ${rpm_root}/*/nco-5.2.8-?.*.rpm
scp \
-${rpm_root}/*/nco-5.2.7-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-5.2.7-?.*.rpm \
-${rpm_root}/*/nco-devel-5.2.7-?.*.rpm \
-${rpm_root}/nco-5.2.7-?.*.src.rpm \
+${rpm_root}/*/nco-5.2.8-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-5.2.8-?.*.rpm \
+${rpm_root}/*/nco-devel-5.2.8-?.*.rpm \
+${rpm_root}/nco-5.2.8-?.*.src.rpm \
dust.ess.uci.edu:/var/www/html/nco/src
scp \
-${rpm_root}/*/nco-5.2.7-?.*.rpm \
-${rpm_root}/*/nco-debuginfo-5.2.7-?.*.rpm \
-${rpm_root}/*/nco-devel-5.2.7-?.*.rpm \
-${rpm_root}/nco-5.2.7-?.*.src.rpm \
+${rpm_root}/*/nco-5.2.8-?.*.rpm \
+${rpm_root}/*/nco-debuginfo-5.2.8-?.*.rpm \
+${rpm_root}/*/nco-devel-5.2.8-?.*.rpm \
+${rpm_root}/nco-5.2.8-?.*.src.rpm \
zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
=====================================
doc/index.shtml
=====================================
@@ -71,7 +71,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 5.2.7 released <!--#flastmod file="src/nco-5.2.7.tar.gz"-->
+Current stable NCO version is 5.2.8 released <!--#flastmod file="src/nco-5.2.8.tar.gz"-->
</h2>
<table border=0 width=100%>
@@ -155,7 +155,8 @@ and
<h2>Recent Releases & Milestones</h2>
<ul>
-<li>2024 Aug ??: 5.2.8 <i>In Progress...</i>
+<li>2024 Oct ??: 5.2.9 <i>In Progress...</i>
+<li>2024 Sep 02: 5.2.8 ncclimo --rgn_stt
<li>2024 Jul 22: 5.2.7 ncclimo/ncremap fixes
<li>2024 Jun 20: 5.2.6 Fix 5.2.5 ncremap
<li>2024 Jun 19: 5.2.5 MPAS-A, --qnt
@@ -658,16 +659,20 @@ 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 5.2.7 http://github.com/nco/nco.git nco-5.2.7</tt></a>.
+<tt>git clone -b 5.2.8 http://github.com/nco/nco.git nco-5.2.8</tt></a>.
<ul>
-<li><b>NCO 5.2.9</b>: (<i>Future</i>)
+<li><b>NCO 5.3.0</b>: (<i>Future</i>)
netCDF4 user-defined types support;
<tt>ncks --xtn</tt> better extensive variable treatment?;
<tt>ncks --bsa</tt> Byte-swap algoritm;
<tt>ncremap</tt> small-circle weights;</li>
-<li><b>NCO 5.2.8</b>: (<i>In Progress, features in-progress or complete include</i>)
+<li><b>NCO 5.2.9</b>: (<i>In Progress, features in-progress or complete include</i>)
<tt>ncremap</tt> CF Convention for longitude vertices in map-files</li>
-<li><b>NCO 5.2.7</b>: (<i>Current Stable Release</i>)
+<li><b>NCO 5.2.8</b>: (<i>Current Stable Release</i>)
+<tt>ncclimo --rgn_stt, --sum_scl</tt>;
+<tt>ncks --chk_map area_b</tt> fix;
+<tt>ncremap</tt> fix sub-SGS issue</li>
+<li><b>NCO 5.2.7</b>:
<tt>all</tt> Finalize CF quantization metadata;
<tt>ncks --chk_map</tt> area diagnostics;
<tt>ncremap</tt> fix SGS issue from 5.2.6</li>
@@ -837,7 +842,7 @@ Or, alternatively, permanently add conda-forge (which teems with goodies besides
‘<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-5.2.7</a> Executables Anaconda-compatible. Maintained by Filipe Fernandes.</li>
+<li><a href="https://github.com/conda-forge/nco-feedstock">nco-5.2.8</a> Executables Anaconda-compatible. Maintained by Filipe Fernandes.</li>
Thanks to Rich Signell, Filipe Fernandes, Pedro Vicente, Xylar Asay-Davis and others for developing and maintaining the NCO package for conda.
</ul>
@@ -846,7 +851,7 @@ Thanks to Rich Signell, Filipe Fernandes, Pedro Vicente, Xylar Asay-Davis and ot
<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-5.2.7</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-5.2.8</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.
@@ -854,8 +859,8 @@ Thanks to Rich Signell, Filipe Fernandes, Pedro Vicente, Xylar Asay-Davis and ot
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_5.2.7-1_i386.deb</tt>’):</dt>
-<li><a href="https://launchpad.net/ubuntu/+source/nco/5.2.7-1">nco_5.2.7-1_amd64.deb</a> : Executables AMD64-compatible</li>
+<dt>Debian package for most recent NCO release (install with, e.g., ‘<tt>dpkg --install nco_5.2.8-1_i386.deb</tt>’):</dt>
+<li><a href="https://launchpad.net/ubuntu/+source/nco/5.2.8-1">nco_5.2.8-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.
@@ -899,10 +904,10 @@ Thanks to Gavin Burris and Kyle Wilcox for documenting build procedures for RHEL
<!--
# MacOS 14.5 (Ventura) systems (firn, sastrugi, spectral):
/usr/bin/scp ~/nco/doc/index.shtml zender,nco at web.sf.net:/home/project-web/nco/htdocs
-cd ~/bin;tar cvzf ${DATA}/nco-5.2.7.macos.14.5.tar.gz nc*;scp ${DATA}/nco-5.2.7.macos.14.5.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src
+cd ~/bin;tar cvzf ${DATA}/nco-5.2.8.macos.14.5.tar.gz nc*;scp ${DATA}/nco-5.2.8.macos.14.5.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-5.2.7.macos.14.5.tar.gz">nco-5.2.7.macos.14.5.tar.gz</a> (<!--#fsize file="src/nco-5.2.7.macos.14.5.tar.gz"-->): Executables MacOS 14.5-compatible (last updated <!--#flastmod file="src/nco-5.2.7.macos.14.5.tar.gz"-->). Maintained by NCO Project.</li>
+<li><a href="src/nco-5.2.8.macos.14.5.tar.gz">nco-5.2.8.macos.14.5.tar.gz</a> (<!--#fsize file="src/nco-5.2.8.macos.14.5.tar.gz"-->): Executables MacOS 14.5-compatible (last updated <!--#flastmod file="src/nco-5.2.8.macos.14.5.tar.gz"-->). Maintained by NCO Project.</li>
<li><a href="http://fink.sf.net">Fink</a> packages for <a href="http://fink.sf.net/pdb/package.php/nco">NCO</a>: Currently NCO 4.9.5. Maintained by Alexander Hansen.</li>
<li><a href="http://brew.sh">Homebrew</a> packages for <a href="https://formulae.brew.sh/formula/nco">NCO</a>: Currently NCO 5.1.5. Install with ‘<tt>brew install nco</tt>’. Maintained by Carlo Cabrera, Ian Lancaster, Alejandro Soto, and others over the years.</li>
<li><a href="http://trac.macosforge.org/projects/macports/wiki">MacPorts</a> infrastructure for <a href="https://ports.macports.org/port/nco">NCO</a>: <a href="https://ports.macports.org/port/nco">Portfile</a>: Currently NCO 5.1.1. Install with ‘<tt>sudo port install nco</tt>’. Maintained by Takeshi Enomoto.</li>
@@ -1105,12 +1110,12 @@ On the <a href="https://sourceforge.net/p/nco/bugs">Bug Tickets</a> site.</li>
The simplest way to acquire the source is to download the compressed tarball:
<ul>
<li>
-<!-- scp ${DATA}/nco-5.2.7.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src -->
-<a href="https://github.com/nco/nco/archive/5.2.7.tar.gz">nco-5.2.7.tar.gz</a>
-(<!--#fsize file="src/nco-5.2.7.tar.gz"--> compressed tar-file)<br>
-<!--#exec cmd="openssl dgst -md5 src/nco-5.2.7.tar.gz"--><br>
-<!--#exec cmd="openssl dgst -sha1 src/nco-5.2.7.tar.gz"--><br>
-<!--#exec cmd="openssl dgst -sha256 src/nco-5.2.7.tar.gz"-->
+<!-- scp ${DATA}/nco-5.2.8.tar.gz zender,nco at web.sf.net:/home/project-web/nco/htdocs/src -->
+<a href="https://github.com/nco/nco/archive/5.2.8.tar.gz">nco-5.2.8.tar.gz</a>
+(<!--#fsize file="src/nco-5.2.8.tar.gz"--> compressed tar-file)<br>
+<!--#exec cmd="openssl dgst -md5 src/nco-5.2.8.tar.gz"--><br>
+<!--#exec cmd="openssl dgst -sha1 src/nco-5.2.8.tar.gz"--><br>
+<!--#exec cmd="openssl dgst -sha256 src/nco-5.2.8.tar.gz"-->
</li>
</ul>
@@ -1131,8 +1136,8 @@ To avoid the churn that comes with using the latest snapshot,
potential contributors may wish to retrieve a recent tagged (i.e.,
stable and released) version,
This command retrieves the entire NCO repository (< 20 MB) and
-then checks out NCO version <tt>5.2.7</tt>:
-<p><tt>git clone https://github.com/nco/nco.git;cd nco;git checkout 5.2.7</tt></p>
+then checks out NCO version <tt>5.2.8</tt>:
+<p><tt>git clone https://github.com/nco/nco.git;cd nco;git checkout 5.2.8</tt></p>
However, the most efficient way to actively track and develop NCO is to
retrieve the current (“bleeding edge”) NCO snapshot.
This command retrieves the latest NCO master branch into a local
@@ -1142,12 +1147,12 @@ 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>5.2.7</tt>) and the development version is that the
+(e.g., <tt>5.2.8</tt>) and the development version is that the
tagged release operators will print a valid version number (e.g.,
-<tt>5.2.7</tt>) when asked to do so with the <tt>-r</tt> flag
+<tt>5.2.8</tt>) when asked to do so with the <tt>-r</tt> flag
(e.g., <tt>ncks -r</tt>).
Snapshots will include the sub-version and patch-level in the version
-information (e.g., <tt>5.2.7-alpha06</tt>).
+information (e.g., <tt>5.2.8-alpha06</tt>).
<!--
<a name="doxy"></a>
@@ -1330,9 +1335,9 @@ As of 20131101 there is no Cygwin package for ANTLR, and the Cygwin netCDF packa
<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/5.2.7.tar.gz</dt>
-<dt>tar xvzf 5.2.7.tar.gz</dt>
-<dt>cd nco-5.2.7</dt>
+<dt>wget https://github.com/nco/nco/archive/5.2.8.tar.gz</dt>
+<dt>tar xvzf 5.2.8.tar.gz</dt>
+<dt>cd nco-5.2.8</dt>
<dt>./configure --prefix=/usr/local</dt>
<dt>make</dt>
<dt>sudo make install</dt>
=====================================
doc/nco.texi
=====================================
@@ -128,12 +128,12 @@ Octave TeXInfo manual shows clean TeXInfo structure
@setfilename nco.info
@c Define edition, date, ...
- at set nco-edition 5.2.7
- at set doc-edition 5.2.7
+ at set nco-edition 5.2.8
+ at set doc-edition 5.2.8
@set copyright-years 1995--2024
@set update-year 2024
- at set update-date 23 July 2024
- at set update-month July 2024
+ at set update-date 2 September 2024
+ at set update-month September 2024
@settitle @acronym{NCO} @value{nco-edition} User Guide
@@ -7117,15 +7117,18 @@ Generating common grids:
@verbatim
# Through version 4.7.5 (August, 2018), ncks performed grid-generation
# 180x360 (1x1 degree) Equi-Angular grid, first longitude centered at Greenwich
+# This is NOT the CMIP6 1x1 grid
ncks --rgr 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
# As of version 4.7.6 (August, 2018), ncremap supports more concise commands
+# This is NOT the CMIP6 1x1 grid
ncremap -G ttl='Equi-Angular grid 180x360'#latlon=180,360#lat_typ=uni#lon_typ=grn_ctr \
-g ${DATA}/grids/180x360_SCRIP.20180901.nc
# 180x360 (1x1 degree) Equi-Angular grid, first longitude west edge at Greenwich
+# This IS the CMIP6 1x1 grid
ncremap -G ttl='Equi-Angular grid 180x360'#latlon=180,360#lat_typ=uni#lon_typ=grn_wst \
-g ${DATA}/grids/180x360wst_SCRIP.20180301.nc
@@ -15090,8 +15093,11 @@ lat_1D_rct at long_name = sprint4(lat_1D_rct at long_name)
@end example
@noindent @strong{hyperslab a netCDF string @*@*}
-Its possible to index-into a NC_CHAR string. Just like a C-String. Remember an NC_CHAR string is has no terminating null.
-You CANNOT index into a NC_STRING. You have to convert to an NC_CHAR first.
+It is possible to index-into an NC_CHAR string, similar to a C-String.
+Unlike a C-String, however, an NC_CHAR string has no null-character to
+mark its termination.
+One CANNOT index into an NC_STRING string.
+One must must convert to an NC_CHAR first.
@example
@verbatim
global at greeting="hello world!!!"
@@ -15704,7 +15710,7 @@ where @file{narr.nco} is an @command{ncap2} script like this:
NCO does not write RAM variable to output
Masks are often unwanted, and can be big, so this speeds execution
3. Example could be extended to preserve mean lat and lon of sub-region
- Follow uwnd example to do this: lat_msk=0.0*lat ... lat_avg=lat.avg($y,$x) */
+ Follow uwnd example to do this: lat_sk=0.0*lat ... lat_avg=lat.avg($y,$x) */
*uwnd_msk=0.0*uwnd;
where((lat >= 35.6 && lat <= 37.0) && (lon >= -100.5 && lon <= -99.0))
uwnd_msk=uwnd;
@@ -17617,7 +17623,7 @@ A dimension of size one is said to be @emph{degenerate}.
Whether a degenerate record dimension is desirable or not
depends on the application.
Often a degenerate @var{time} dimension is useful, e.g., for
-concatentating, but it may cause problems with arithmetic.
+concatenating, though it may cause problems with arithmetic.
Such is the case in the above example, where the first step employs
@command{ncwa} rather than @command{ncra} for the time-averaging.
Of course the numerical results are the same with both operators.
@@ -18859,6 +18865,11 @@ variables whose first three characters are @samp{H2O}:
ncatted -a units,'^H2O',c,c,'kilogram kilogram-1' in.nc
@end example
+Remove the @code{_FillValue} attribute from @code{lat} and @code{lon} variables.
+ at example
+ncatted -O -a _FillValue,'[lat]|[lon]',d,, in.nc
+ at end example
+
Overwrite the @code{quanta} attribute of variable
@code{energy} to an array of four integers.
@example
@@ -19502,13 +19513,13 @@ SYNTAX
ncclimo [-3] [-4] [-5] [-6] [-7]
[-a @var{wnt_md}] [-C @var{clm_md}] [-c @var{caseid}] [--cmp @var{cmp_sng}]
[-d @var{dbg_lvl}] [--d2f] [--dpf=@var{dpf}] [--dpt_fl=@var{dpt_fl}] [-E @var{yr_prv}] [-e @var{yr_end}]
-[-f @var{fml_nm}] [--fl_fmt=@var{fl_fmt}] [--glb_avg] [-h @var{hst_nm}] [-i @var{drc_in}]
-[-j @var{job_nbr}] [-L @var{dfl_lvl}] [-l @var{lnk_flg}]
+[-f @var{fml_nm}] [--fl_fmt=@var{fl_fmt}] [--glb_avg] [--glb_stt=@var{glb_stt}]
+[-h @var{hst_nm}] [-i @var{drc_in}] [-j @var{job_nbr}] [-L @var{dfl_lvl}] [-l @var{lnk_flg}]
[-m @var{mdl_nm}] [--mth_end=@var{mth_end}] [--mth_srt=@var{mth_srt}]
[-n @var{nco_opt}] [--no_cll_msr] [--no_frm_trm] [--no_ntv_tms] [--no_stg_grd] [--no_stdin]
[-O @var{drc_rgr}] [-o @var{drc_out}] [-P @var{prc_typ}] [-p @var{par_typ}] [--qnt=@var{qnt_prc}]
-[-R @var{rgr_opt}] [-r @var{rgr_map}]
-[-S @var{yr_prv}] [-s @var{yr_srt}] [--seasons=@var{csn_lst}] [--sgs_frc=@var{sgs_frc}] [--split]
+[-R @var{rgr_opt}] [-r @var{rgr_map}] [-S @var{yr_prv}] [-s @var{yr_srt}]
+[--seasons=@var{csn_lst}] [--sgs_frc=@var{sgs_frc}] [--split] [--sum_scl=@var{sum_scl}]
[-t @var{thr_nbr}] [--tpd=@var{tpd}] [--uio] [-v @var{var_lst}] [--var_xtr=@var{var_xtr}] [--version]
[--vrt_out=@var{vrt_fl}] [--vrt_xtr=@var{vrt_xtr}]
[-X @var{drc_xtn}] [-x @var{drc_prv}] [--xcl_var]
@@ -20174,7 +20185,7 @@ See @ref{CF Conventions} for a detailed description.
@cindex global average
@cindex regional average
@cindex hemispheric average
- at item --glb_avg (@code{--glb_avg}, @code{--global_average}) (deprecated)
+ at item --glb_avg (@code{--glb_avg}, @code{--global_average}) (deprecated)
@item --rgn_avg (@code{--rgn_avg}, @code{--region_average})
When introduced in @acronym{NCO} version 4.9.1 (released December,
2019), this switch (which takes no argument) caused the splitter to
@@ -20210,6 +20221,110 @@ the full regridded timeseries, if requested, at the same time.
Because the switch now outputs global and regional averages, the best
practice is to invoke with @samp{--rgn_avg} instead of
@samp{--glb_avg}.
+ at acronym{NCO} version 5.2.8 (released September, 2024) superseded this
+switch by introducing support for more general global/regional
+statistics timeseries output via the @code{--glb_stt}/@code{--rgn_stt}
+options.
+
+ at html
+<a name="hms_stt"></a> <!-- http://nco.sf.net/nco.html#hms_stt -->
+<a name="rgn_stt"></a> <!-- http://nco.sf.net/nco.html#rgn_stt -->
+<a name="glb_stt"></a> <!-- http://nco.sf.net/nco.html#glb_stt -->
+<a name="global_statistic"></a> <!-- http://nco.sf.net/nco.html#global_statistic -->
+<a name="regional_statistic"></a> <!-- http://nco.sf.net/nco.html#regional_statistic -->
+<a name="foo"></a> <!-- http://nco.sf.net/nco.html#foo -->
+<a name="foo"></a> <!-- http://nco.sf.net/nco.html#foo -->
+<a name="foo"></a> <!-- http://nco.sf.net/nco.html#foo -->
+<a name="foo"></a> <!-- http://nco.sf.net/nco.html#foo -->
+ at end html
+ at cindex @code{--sum_scl}
+ at cindex @code{--sum_scale}
+ at cindex @code{--scl_fct}
+ at cindex @code{--scale_factor}
+ at cindex @code{--sum_scl}
+ at cindex @code{--glb_stt}
+ at cindex @code{--global_statistic}
+ at cindex @code{--rgn_stt}
+ at cindex @code{--regional_statistic}
+ at cindex @code{--hms_stt}
+ at cindex global statistic
+ at cindex regional statistic
+ at cindex hemispheric statistic
+ at cindex sum scale
+ at cindex scale factor
+ at cindex @code{--sum_scl}
+ at item --glb_stt (@code{--glb_stt}, @code{--global_statistic})
+ at item --rgn_stt (@code{--rgn_stt}, @code{--region_statistic})
+ at acronym{NCO} version 5.2.8 (released September, 2024) introduced the
+ at code{--glb_stt}/@code{--rgn_stt} options (or long options
+equivalents @code{--hms_stt}, @code{--regional_statistic}, and
+ at code{--global_statistic}) to support more general global/regional
+statistics timeseries output.
+These options allow the user to choose which statistic, sums or
+averages, to output with global/regional timeseries for all
+variables.
+Set @var{rgn_stt} to @code{avg}, @code{average}, or @code{mean}
+to output timeseries of the global/regional mean statistic.
+Set @var{rgn_stt} to @code{sum}, @code{total}, @code{ttl}, or
+ at code{integral} to output timeseries of the global/regional sum.
+The option @samp{--rgn_stt=avg} is equivalent setting the
+ at code{--rgn_avg} switch (which may eventually be deprecated).
+When invoked with @samp{--rgn_stt=sum} the averaged field is
+multiplied by the sum of the @var{area} variable.
+For area-intensive fields (e.g., fluxes per unit area) this results in
+the total net flux over the area.
+However, the field must employ the same areal units as the @var{area}
+variable for this to be true.
+For example, fields given in inverse square meters would need to
+employ an @var{area} variable in square meters.
+Unfortunately, many people love non-SI units so that is rarely
+the case!
+For example, ELM and CLM archive @var{area} in a field named
+ at code{area} whose units are square kilometers, so a scale factor of
+one million is needed to correct the sum for many variables.
+EAM and CAM also archive @var{area} in a field named @code{area},
+though in unis of inverse steradians, which would require a
+different scale factor to match the sums of area-intensive fields.
+
+That is why @command{ncclimo} introduced a second new option
+ at samp{--sum_scl=@var{sum_scl}}, in @acronym{NCO} version 5.2.8
+(released September, 2024).
+The long option equivalents are @code{--scl_fct}, @code{--sum_scale},
+and @code{--scale_factor}.
+When @var{rgn_stt} is @code{sum}, the @var{sum_scl} scale factor
+multiplies the integrated field value, which allows the user to
+generate timeseries in the desired units for any field.
+Consider these prototypical examples to generate global timeseries
+of common geophysical statistics from @acronym{ESM} output:
+ at example
+ at verbatim
+# Timeseries of global GPP in grams/s for ELM/CLM:
+ncclimo -P elm --split --rgn_stt=sum --sum_scl=1.0e6 -v GPP ...
+# Timeseries of global GPP in GT C/yr for ELM/CLM:
+ncclimo -P elm --split --rgn_stt=sum --sum_scl=1.0e6*3600*24*365/1.0e12 -v GPP ...
+# Timeseries of global column vapor in kg for EAM/CAM:
+ncclimo -P eam --split --rgn_stt=sum --sum_scl=6.37122e6^2 -v TMQ ...
+ at end verbatim
+ at end example
+All three examples set @var{rgn_stt} to @code{sum} in order to
+activate the @var{sum_scl} factor.
+The first example scales (multiplies) the mean of all global
+timeseries (here, @code{GPP} for concreteness) by one million.
+This factor converts the @acronym{ELM} or @acronym{CLM} @code{area}
+variable from square kilometers to square meters, appropriate to
+to integrating fields like @code{GPP} whose fluxes are per square
+meter.
+The output timeseries of @code{GPP} would then be in @w{gC s-1}.
+The second example sets the scale factor to convert the global
+ at code{GPP} statistic to units of @w{GT C yr-1}.
+The third example shows how to convert areal sums in sterradians
+(which @acronym{EAM} and @acronym{CAM} use for @code{area}) to
+square meters.
+This factor converts atmospheric variables from global mean mass per
+square meter to global total mass.
+The @code{--glb_stt=sum}/@code{--sum_scl} procedure is model- and
+variable-specific and we are open to suggestions to make it more
+useful.
@html
<a name="no_ntv_tms"></a> <!-- http://nco.sf.net/nco.html#no_ntv_tms -->
@@ -26599,7 +26714,7 @@ invoking the @samp{--atm2ocn} switch:
@example
# Use --a2o to generate weights for "big" to "little" remaps:
ncremap --a2o -a se2fv_flx --src_grd=atm_se_grd.nc \
- --dst_grd=ocn_fv_grd.nc -m map.nc
+ --dst_grd=ocn_fv_grd.nc -m atm2ocn.nc
# Otherwise, omit it:
ncremap -a fv2se_flx --src_grd=ocn_fv_grd.nc \
--dst_grd=atm_se_grd.nc -m map.nc
=====================================
man/ncclimo.1
=====================================
@@ -35,7 +35,9 @@ ncclimo
.IR fml_nm ]
[\-\-fl_fmt=
.IR fmt ]
-[\--glb_avg]
+[\-\-glb_avg]
+[\-\-glb_stt]
+.IR avg|sum ]
[\-h
.IR hst_nm ]
[\-i
@@ -81,6 +83,8 @@ ncclimo
[\--sgs_frc=
.IR sgs_frc ]
[\--split]
+[\-\-sum_scl=
+.IR sum_scl ]
[\-t
.IR thr_nbr ]
[\--tpd_out=
=====================================
src/nco/ncatted.c
=====================================
@@ -166,7 +166,7 @@ main(int argc,char **argv)
const char * const CVS_Id="$Id$";
const char * const CVS_Revision="$Revision$";
- const char * const opt_sht_lst="a:D:Hhl:Oo:p:Rrt-:";
+ const char * const opt_sht_lst="34567a:D:Hhl:Oo:p:Rrt-:";
#if defined(__cplusplus) || defined(PGI_CC)
ddra_info_sct ddra_info;
@@ -238,6 +238,8 @@ main(int argc,char **argv)
/* 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 */
+ {"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},
@@ -304,6 +306,16 @@ main(int argc,char **argv)
} /* endif cnk */
if(!strcmp(opt_crr,"mmr_cln") || !strcmp(opt_crr,"clean")) flg_mmr_cln=True; /* [flg] Clean memory prior to exit */
if(!strcmp(opt_crr,"drt") || !strcmp(opt_crr,"mmr_drt") || !strcmp(opt_crr,"dirty")) flg_mmr_cln=False; /* [flg] Clean memory prior to exit */
+ if(!strcmp(opt_crr,"fl_fmt") || !strcmp(opt_crr,"file_format")){
+ (void)fprintf(stdout,"%s: ERROR Operators ncatted and ncrename always copy the output file type from the input file type. Specification of output file type using any of the switches (-3, -4, -5, -6, -7) or options (--fl_fmt=<output-type>) is not allowed. HINT: Change the input file type with, e.g., ncks --fl_fmt=<output-type> in.nc out.nc prior to invoking %s\n",nco_prg_nm,nco_prg_nm);
+ (void)nco_usg_prn();
+ nco_exit(EXIT_FAILURE);
+ } /* !fl_fmt */
+ if(!strcmp(opt_crr,"fl_fmt") || !strcmp(opt_crr,"file_format")){
+ (void)fprintf(stdout,"%s: ERROR Operators ncatted and ncrename always copy the output file type from the input file type. Specification of output file type using any of the switches (-3, -4, -5, -6, -7) or options (--fl_fmt=<output-type>) is not allowed. HINT: Change the input file type with, e.g., ncks --fl_fmt=<output-type> in.nc out.nc prior to invoking %s\n",nco_prg_nm,nco_prg_nm);
+ (void)nco_usg_prn();
+ nco_exit(EXIT_FAILURE);
+ } /* !fl_fmt */
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);
@@ -329,6 +341,15 @@ main(int argc,char **argv)
switch(opt){
case 0: /* Long options have already been processed, return */
break;
+ case '3': /* Request netCDF3 output storage format */
+ case '4': /* Request netCDF4 output storage format */
+ case '5': /* Request netCDF3 64-bit offset+data storage (i.e., pnetCDF) format */
+ case '6': /* Request netCDF3 64-bit offset output storage format */
+ case '7': /* Request netCDF4-classic output storage format */
+ (void)fprintf(stdout,"%s: ERROR Operators ncatted and ncrename always copy the output file type from the input file type. Specification of output file type using any of the switches (-3, -4, -5, -6, -7) or options (--fl_fmt=<output-type>) is not allowed. HINT: Change the input file type with, e.g., ncks --fl_fmt=<output-type> in.nc out.nc prior to invoking %s\n",nco_prg_nm,nco_prg_nm);
+ (void)nco_usg_prn();
+ nco_exit(EXIT_FAILURE);
+ break;
case 'a': /* Copy argument for later processing */
aed_arg[nbr_aed]=(char *)strdup(optarg);
nbr_aed++;
=====================================
src/nco/ncks.c
=====================================
@@ -898,7 +898,8 @@ main(int argc,char **argv)
ncks --tst_udunits='0 days since 1918-11-11','days since 1939-09-09',standard ~/nco/data/in.nc
ncks --tst_udunits='0 days since 1918-11-11','days since 1939-09-09',360_day ~/nco/data/in.nc
ncks --tst_udunits='0 days since 1918-11-11','days since 1939-09-09',365_day ~/nco/data/in.nc
- ncks --tst_udunits='0 days since 1918-11-11','days since 1939-09-09',366_day ~/nco/data/in.nc */
+ ncks --tst_udunits='0 days since 1918-11-11','days since 1939-09-09',366_day ~/nco/data/in.nc
+ ncks --tst_udunits='0 days since 1918-11-11','days since -4712-01-01 12:00:00',julian ~/nco/data/in.nc */
char *cp;
char **args;
double crr_val;
=====================================
src/nco/nco.h
=====================================
@@ -373,7 +373,7 @@ extern "C" {
# define NCO_VERSION_MINOR 2
#endif /* !NCO_VERSION_MINOR */
#ifndef NCO_VERSION_PATCH
-# define NCO_VERSION_PATCH 7
+# define NCO_VERSION_PATCH 8
#endif /* !NCO_VERSION_PATCH */
#ifndef NCO_VERSION_NOTE
# define NCO_VERSION_NOTE "" /* Blank for final versions, non-blank (e.g., "-beta73") for pre-release versions */
@@ -383,7 +383,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 "5.2.7"
+# define NCO_VERSION "5.2.8"
#endif /* !NCO_VERSION */
/* Compatibility tokens new to netCDF4 netcdf.h: */
@@ -1278,7 +1278,7 @@ typedef enum nco_xtr_typ_enm
nco_bool flg_grd; /* [flg] Create SCRIP-format grid file */
nco_bool flg_grd_dst; /* [flg] User-specified destination grid */
nco_bool flg_grd_src; /* [flg] User-specified input grid */
- nco_bool flg_mpt_mss; /* [flg] Set empty (sgs_frc=0.0) SGS cells to missing value */
+ nco_bool flg_mpt_mss; /* [flg] Set empty (sgs_frc==0.0) SGS cells to missing value */
nco_bool flg_msk_apl; /* [flg] Apply msk_out to variables after regridding */
nco_bool flg_msk_out; /* [flg] Add mask to output */
nco_bool flg_nfr; /* [flg] Infer SCRIP-format grid file */
=====================================
src/nco/nco_att_utl.c
=====================================
@@ -1081,10 +1081,14 @@ nco_hst_att_cat /* [fnc] Add command line, date stamp to history attribute */
/* Length of string + NUL required to hold output of ctime() */
#define TIME_STAMP_SNG_LNG 25
+ const char fnc_nm[]="nco_hst_att_cat()"; /* [sng] Function name */
+
char att_nm[NC_MAX_NAME+1L];
char *ctime_sng;
char *hst_crr=NULL;
+ nco_string *hst_crr_sngp=&hst_crr;
char *hst_new;
+ nco_string *hst_new_sngp=&hst_new;
char time_stamp_sng[TIME_STAMP_SNG_LNG];
const char att_nm_hst[]="history"; /* [sng] Lowercase name of history attribute */
@@ -1095,7 +1099,7 @@ nco_hst_att_cat /* [fnc] Add command line, date stamp to history attribute */
long att_sz=0L;
- nc_type att_typ;
+ nc_type att_typ=NC_CHAR; /* [enm] Declare history as NC_CHAR by default (used if history does not yet exist */
time_t time_crr_time_t;
@@ -1131,25 +1135,45 @@ nco_hst_att_cat /* [fnc] Add command line, date stamp to history attribute */
/* NB: ncattinq(), unlike strlen(), counts terminating NUL for stored NC_CHAR arrays */
rcd+=nco_inq_att(out_id,NC_GLOBAL,att_nm,&att_typ,&att_sz);
if(att_typ != NC_CHAR){
- if(nco_dbg_lvl_get() >= nco_dbg_std) (void)fprintf(stderr,"%s: WARNING the \"%s\" global attribute is type %s, not %s. Therefore current command line will not be appended to %s in output file.\n",nco_prg_nm_get(),att_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),att_nm);
- return;
- } /* end if */
-
- /* Allocate and NUL-terminate space for current history attribute
- If history attribute is of size zero then ensure strlen(hst_crr) = 0 */
- hst_crr=(char *)nco_malloc((att_sz+1L)*sizeof(char));
- hst_crr[att_sz]='\0';
- if(att_sz > 0) rcd+=nco_get_att(out_id,NC_GLOBAL,att_nm,(void *)hst_crr,NC_CHAR);
+ /* 20240809: NC_STRING patch currently fails with ncatted, ncrename */
+ if(att_typ == NC_STRING && nco_prg_id_get() != ncatted && nco_prg_id_get() != ncrename){
+ // if(att_typ == NC_STRING && nco_prg_id_get() != ncrename){ // 20240811
+ //if(att_typ == NC_STRING){ // NC_STRING type history attribute is supported
+ ;
+ }else{
+ if(att_typ == NC_STRING && (nco_prg_id_get() == ncatted || nco_prg_id_get() == ncrename)) (void)fprintf(stderr,"%s: WARNING the \"%s\" global attribute is type %s. Command will proceed normally except current command line will not be appended to \"%s\" attribute in output file because of a bug (that we are trying to solve) in the implementation of modifying NC_STRING \"%s\" attributes for ncatted and ncrename.\n",nco_prg_nm_get(),att_nm,nco_typ_sng(att_typ),att_nm,att_nm); else (void)fprintf(stderr,"%s: WARNING the \"%s\" global attribute is type %s, not %s or %s, in violation of NUG and CF conventions. Therefore current command line will not be appended to \"%s\" attribute in output file.\n",nco_prg_nm_get(),att_nm,nco_typ_sng(att_typ),nco_typ_sng(NC_CHAR),nco_typ_sng(NC_STRING),att_nm);
+ return;
+ } /* !att_typ */
+ } /* !att_typ */
+
+ if(att_typ == NC_CHAR){
+ /* Allocate and NUL-terminate space for current history attribute
+ If history attribute is of size zero then ensure strlen(hst_crr) = 0 */
+ hst_crr=(char *)nco_malloc((att_sz+1L)*sizeof(char));
+ hst_crr[att_sz]='\0';
+ if(att_sz > 0) rcd+=nco_get_att(out_id,NC_GLOBAL,att_nm,(void *)hst_crr,att_typ);
+ }else if(att_typ == NC_STRING){
+ if(att_sz != 1L){
+ (void)fprintf(stderr,"%s: WARNING %s reports \"%s\" attribute is an %s array of size %ld. This violates the CF Conventions which requires a single string for this attribute. Therefore current command line will not be appended to \"%s\" attribute in output file.\n",nco_prg_nm_get(),fnc_nm,att_nm,nco_typ_sng(att_typ),att_sz,att_nm);
+ return;
+ } /* !att_sz */
+ rcd+=nco_get_att(out_id,NC_GLOBAL,att_nm,(void *)hst_crr_sngp,att_typ);
+ /* De-reference the char ** NC_STRING array, a list now known to be of size one, into a normal char * string */
+ hst_crr=hst_crr_sngp[0];
+ } /* !att_typ */
/* Add 4 for formatting characters */
hst_new=(char *)nco_malloc((strlen(hst_crr)+strlen(hst_sng)+strlen(time_stamp_sng)+4UL)*sizeof(char));
(void)sprintf(hst_new,"%s: %s\n%s",time_stamp_sng,hst_sng,hst_crr);
} /* endif history global attribute currently exists */
- rcd+=nco_put_att(out_id,NC_GLOBAL,att_nm,NC_CHAR,(long int)(strlen(hst_new)+1UL),(void *)hst_new);
+ if(att_typ == NC_CHAR) rcd+=nco_put_att(out_id,NC_GLOBAL,att_nm,att_typ,(long int)(strlen(hst_new)+1UL),(void *)hst_new);
+ if(att_typ == NC_STRING) rcd+=nco_put_att(out_id,NC_GLOBAL,att_nm,att_typ,(long int)att_sz,(void *)hst_new_sngp);
- hst_crr=(char *)nco_free(hst_crr);
- hst_new=(char *)nco_free(hst_new);
+ if(att_typ == NC_CHAR) hst_crr=(char *)nco_free(hst_crr);
+ if(att_typ == NC_STRING) rcd+=nco_free_string(att_sz,hst_crr_sngp);
+ if(att_typ == NC_CHAR) hst_new=(char *)nco_free(hst_new);
+ if(att_typ == NC_STRING) rcd+=nco_free_string(att_sz,hst_new_sngp);
if(rcd != NC_NOERR) nco_err_exit(rcd,"nco_hst_att_cat"); /* CEWI */
=====================================
src/nco/nco_cnk.c
=====================================
@@ -1109,7 +1109,7 @@ nco_cnk_sz_set_trv /* [fnc] Set chunksize parameters (GTT version of nco_cnk_sz_
cnk_sz[dmn_idx]=cnk_in[dmn_idx_in];
break;
} /* endif */
- } /* end loop over dmn_idx_in */
+ } /* !dmn_idx_in */
if(dmn_idx_in == dmn_nbr_in){
/* Output file dimension not found in input file */
assert(nco_prg_id_get() == ncecat || nco_prg_id_get() == ncap );
@@ -1119,8 +1119,8 @@ nco_cnk_sz_set_trv /* [fnc] Set chunksize parameters (GTT version of nco_cnk_sz_
cnk_sz[dmn_idx]=dmn_cmn[dmn_idx].dmn_cnt;
} /* !NON_HYP_DMN */
if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(stdout,"%s: INFO %s reports variable %s output dimension %s not found in input file. Setting default chunksize for this dimension to = %lu\n",nco_prg_nm_get(),fnc_nm,var_nm,dmn_cmn[dmn_idx].nm,(unsigned long)cnk_sz[dmn_idx]);
- } /* endif dimension not in input file */
- } /* end loop over dmn_idx */
+ } /* !dmn_idx_in (dimension not in input file) */
+ } /* !dmn_idx */
/* Memory management */
if(cnk_in) cnk_in=(size_t *)nco_free(cnk_in);
@@ -1174,12 +1174,18 @@ nco_cnk_sz_set_trv /* [fnc] Set chunksize parameters (GTT version of nco_cnk_sz_
cnk_sz[dmn_idx]=dmn_cmn[dmn_idx].dmn_cnt;
} /* !NON_HYP_DMN */
}else{ /* !record dimension */
- /* Set non-record dimensions to default, possibly override later */
+ /* Set chunk sizes of non-record dimensions to dimension sizes, so long as they are small enough, possibly override later */
cnk_sz[dmn_idx]=dmn_cmn[dmn_idx].sz;
+ if(cnk_sz[dmn_idx]*4 > NCO_MAX_CHUNK_SIZE){
+ /* 20240821 Necessary, though not sufficient, that chunk length along each dimension,
+ times four bytes (minimum size per float or double, in B), be less than maximum total chunksize in [B].
+ Yes, this is kludgy */
+ cnk_sz[dmn_idx]/=10;
+ } /* !cnk_sz[dmn_idx] */
if(dmn_cmn[dmn_idx].sz == 0L) (void)fprintf(stdout,"%s: ERROR %s reports variable %s has dim_sz == 0L for non-record dimension %s. This should not occur and it will cause chunking to fail...\n",nco_prg_nm_get(),fnc_nm,var_nm,dmn_cmn[dmn_idx].nm);
} /* !record dimension */
- } /* end loop over dimensions */
+ } /* !dmn_idx */
if(cnk_map == nco_cnk_map_lfp ||
(cnk_plc == nco_cnk_plc_nco && dmn_nbr != 3) ||
@@ -1448,19 +1454,18 @@ nco_cnk_sz_set_trv /* [fnc] Set chunksize parameters (GTT version of nco_cnk_sz_
} /* !dmn_idx */
/* Final Safety Check */
- cnk_sft_chk: /* end goto */
+ cnk_sft_chk: /* !goto */
/* Status: Previous loop implemented per-dimension checks on user-requested chunksizes only
Loop below implements similar final safety check for ALL dimensions and ALL chunking maps
Check trims fixed (not record) dimension chunksize to never be larger than dimension size */
for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++){
- if(cnk_sz[dmn_idx] > (size_t)dmn_cmn[dmn_idx].sz) {
- if (dmn_cmn[dmn_idx].is_rec_dmn){
+ if(cnk_sz[dmn_idx] > (size_t)dmn_cmn[dmn_idx].sz){
+ if(dmn_cmn[dmn_idx].is_rec_dmn){
/* rec dmn size 0 then we can apply any cnk_sz - else cnk_sz <= dmn_sz */
long lcl_dmn_sz=0ll;
- if( nco_inq_dim_flg(grp_id_out, dmn_cmn[dmn_idx].id, (char*)NULL, &lcl_dmn_sz)==NC_NOERR && lcl_dmn_sz>0)
+ if(nco_inq_dim_flg(grp_id_out, dmn_cmn[dmn_idx].id, (char*)NULL, &lcl_dmn_sz)==NC_NOERR && lcl_dmn_sz>0)
cnk_sz[dmn_idx]=(size_t)dmn_cmn[dmn_idx].sz;
-
}else{
/* non-record dimensions must have cnk_sz <= dmn_sz */
if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(stderr,"%s: INFO %s final check trimming chunksize of \"%s\" dimension from %lu to %lu\n",nco_prg_nm_get(),fnc_nm,dmn_cmn[dmn_idx].nm,(unsigned long)cnk_sz[dmn_idx],(unsigned long)dmn_cmn[dmn_idx].sz);
@@ -1475,6 +1480,17 @@ nco_cnk_sz_set_trv /* [fnc] Set chunksize parameters (GTT version of nco_cnk_sz_
} /* !cnk_sz */
} /* !dmn_idx */
+ /* 20240821 Check that total chunksize does not exceed NCO_MAX_CHUNK_SIZE = 4 GB */
+ size_t cnk_sz_prd=1L;
+ for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++) cnk_sz_prd*=cnk_sz[dmn_idx];
+ if(cnk_sz_prd > NCO_MAX_CHUNK_SIZE){
+ if(nco_dbg_lvl_get() >= nco_dbg_quiet) (void)fprintf(stderr,"%s: WARNING %s final safety check reports variable %s chunksize of %lu B exceeds netCDF4 maximum allowed chunksize of %lu B. Expect nco_def_var_chunking() call to fail...\n",nco_prg_nm_get(),fnc_nm,var_nm,(unsigned long)cnk_sz_prd,(unsigned long)NCO_MAX_CHUNK_SIZE);
+ /* fxm: implement automatic fix, e.g., set chunk length of longest dimensions to value selected from prime number factorization of dimension size? */
+ for(dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++){
+ ;
+ } /* !dmn_idx */
+ } /* !cnk_sz_prd */
+
if(nco_dbg_lvl_get() >= nco_dbg_var && nco_dbg_lvl_get() != nco_dbg_dev){
/* Dimensions and chunksizes used by variable in output file */
(void)fprintf(stdout,"idx dmn_nm\tdmn_sz\tcnk_sz:\n");
=====================================
src/nco/nco_map.c
=====================================
@@ -2488,8 +2488,8 @@ nco_map_chk /* Map-file evaluation */
if(var_mask_b) fprintf(stdout,"mask_b S errors: %lu%s\n",mask_b_err,mask_b_err ? " <--- # of weights that, in violation of mask_b, contribute from source gridcells to masked destination gridcells WARNING WARNING WARNING" : ""); else fprintf(stdout,"mask_b S errors: map-file omits mask_b\n");
if(has_area_b){
fprintf(stdout,"area_b sum/4*pi: %0.16f = 1.0%s%0.1e // Perfect is 1.0 for global Grid B\n",area_b_ttl/4.0/M_PI,area_b_ttl/4.0/M_PI > 1 ? "+" : "-",fabs(1.0-area_b_ttl/4.0/M_PI));
- fprintf(stdout,"area_b min, ~dx: %0.16e sr, %0.2f km in grid A cell [%lu,%+g,%+g]\n",area_b_min,rds_earth*sqrt(area_b_min)/1000.0,idx_min_area_b+1UL,var_yc_a->val.dp[idx_min_area_b],var_xc_a->val.dp[idx_min_area_b]);
- fprintf(stdout,"area_b max, ~dx: %0.16e sr, %0.2f km in grid A cell [%lu,%+g,%+g]\n",area_b_max,rds_earth*sqrt(area_b_max)/1000.0,idx_max_area_b+1UL,var_yc_a->val.dp[idx_max_area_b],var_xc_a->val.dp[idx_max_area_b]);
+ fprintf(stdout,"area_b min, ~dx: %0.16e sr, %0.2f km in grid B cell [%lu,%+g,%+g]\n",area_b_min,rds_earth*sqrt(area_b_min)/1000.0,idx_min_area_b+1UL,var_yc_b->val.dp[idx_min_area_b],var_xc_b->val.dp[idx_min_area_b]);
+ fprintf(stdout,"area_b max, ~dx: %0.16e sr, %0.2f km in grid B cell [%lu,%+g,%+g]\n",area_b_max,rds_earth*sqrt(area_b_max)/1000.0,idx_max_area_b+1UL,var_yc_b->val.dp[idx_max_area_b],var_xc_b->val.dp[idx_max_area_b]);
if(fabs(1.0-area_b_ttl/4.0/M_PI) < 1.0e-2) grid_b_tiles_sphere=True;
}else{
fprintf(stdout,"area_b sum/4*pi: map-file does not provide completely non-zero area_b\n");
=====================================
src/nco/nco_netcdf.c
=====================================
@@ -112,7 +112,7 @@ nco_err_exit /* [fnc] Print netCDF error message, routine name, then exit */
#endif /* !ENABLE_NETCDF4 */
(void)fprintf(stdout,"3. NCO attempts to read other filetypes (HDF4, HDF-EOS2, PnetCDF/CDF5) for which support must be (but was not) enabled at netCDF build-time. NCO can access HDF4 files if NCO is first re-linked to a version of netCDF configured with the --enable-hdf4 option. This is a non-standard netCDF build option described here: http://www.unidata.ucar.edu/software/netcdf/docs/build_hdf4.html. NCO can access PnetCDF/CDF5 files if NCO is first re-linked to netCDF version 4.4.0 or later.\n4. NCO attempts to utilize diskless (i.e., RAM) files. In this case remove the diskless switches (e.g., --ram or --diskless) and then re-issue the command.\n5. Access to a DAP URL fails, and the backup method of downloading the URL using wget obtains a data aggregation file (e.g., a .ncml file) instead of an actual netCDF file. In this case the problem is with the DAP server or URL.\n"); break;
case NC_ERANGE: /* (-60) */
- (void)fprintf(stdout,"ERROR NC_ERANGE Result not representable in output file\nHINT: NC_ERANGE errors typically occur after an arithmetic operation results in a value not representible by the output variable type when NCO attempts to write those values to an output file. Possible workaround for cases when the correct values fall outside the range of the storage type: Promote the variable to higher precision before attempting arithmetic. For example,\nncap2 -O -s \'foo=double(foo);\' in.nc in.nc\nFor more details, see http://nco.sf.net/nco.html#typ_cnv\n"); break;
+ (void)fprintf(stdout,"ERROR NC_ERANGE Result not representable in output file\nHINT: NC_ERANGE errors occur when NCO attempts to write those values to an output file. Typically this means an arithmetic operation created an extreme value not representable by the output variable type, e.g., an NC_FLOAT can only store floating point numbers in the range 1.17549e-38 <= |value| <= 3.40282e+38, and an NC_UINT can only store integers 0 <= value <= 2^16-1 = 4294967295. Possible workaround for cases when the correct values fall outside the representable range of the output storage type: Promote the variable to higher precision before attempting arithmetic. For example,\nncap2 -O -s \'foo=double(foo);\' in.nc in.nc\nFor more details, see http://nco.sf.net/nco.html#typ_cnv\n"); break;
case NC_EUNLIMIT: /* (-54) */
(void)fprintf(stdout,"ERROR NC_UNLIMIT NC_UNLIMITED size already in use\nHINT: NC_EUNLIMIT errors can occur when attempting to convert netCDF4 classic files that contain multiple record dimensions into a netCDF3 file that allows only one record dimension. In this case, try first fixing the excess record dimension(s) (with, e.g., ncks --fix_rec_dmn) and then convert to netCDF3. For more details, see http://nco.sf.net/nco.html#fix_rec_dmn\n"); break;
case NC_EVARSIZE: /* (-62) */
@@ -2116,13 +2116,14 @@ int nco_def_var_chunking
rcd=nc_def_var_chunking(nc_id,var_id,srg_typ,(size_t *)cnk_sz);
if(rcd == NC_EBADCHUNK){
+ char var_nm[NC_MAX_NAME+1L];
int idx;
int dmn_nbr;
nc_type var_typ;
size_t sz;
-
(void)nco_inq_varndims(nc_id,var_id,&dmn_nbr);
(void)nco_inq_vartype(nc_id,var_id,&var_typ);
+ (void)nco_inq_varname(nc_id,var_id,var_nm);
sz=nco_typ_lng(var_typ);
for(idx=0;idx<dmn_nbr;idx++){
@@ -2130,7 +2131,7 @@ int nco_def_var_chunking
sz*=cnk_sz[idx];
} /* !idx */
- if(sz > NCO_MAX_CHUNK_SIZE) (void)fprintf(stderr, "%s: ERROR Total requested chunk size = %lu exceeds netCDF maximium-supported chunk size = %u\n",fnc_nm,sz,NCO_MAX_CHUNK_SIZE);
+ if(sz > NCO_MAX_CHUNK_SIZE) (void)fprintf(stderr, "%s: ERROR Total requested chunk size = %lu exceeds netCDF maximium-supported chunk size = %u for variable %s\nHINT: Restrict chunk sizes to fall below this limit by using NCO chunking options explicitly reduce chunk size on the largest dimension(s), e.g., --cnk_dmn dim_name,chunk_size\n",fnc_nm,sz,NCO_MAX_CHUNK_SIZE,var_nm);
} /* !rcd */
if(rcd == NC_EINVAL){
char var_nm[NC_MAX_NAME+1L];
@@ -2614,11 +2615,10 @@ nco_get_var(const int nc_id,const int var_id,void * const vp,const nc_type var_t
if(rcd != NC_NOERR){
char var_nm[NC_MAX_NAME+1L];
char *path=NULL;
- int rcd2;
size_t pathlen;
- rcd2=nc_inq_path(nc_id,&pathlen,NULL);
+ nc_inq_path(nc_id,&pathlen,NULL);
path=(char *)malloc(pathlen*sizeof(char));
- rcd2=nc_inq_path(nc_id,NULL,path);
+ nc_inq_path(nc_id,NULL,path);
(void)nco_inq_varname(nc_id,var_id,var_nm);
(void)fprintf(stdout,"ERROR: %s failed to nc_get_var() variable \"%s\" from %s\n",fnc_nm,var_nm,path);
if(path) free(path);
@@ -2842,11 +2842,10 @@ nco_get_vara(const int nc_id,const int var_id,const long * const srt,const long
if(rcd != NC_NOERR){
char var_nm[NC_MAX_NAME+1L];
char *path=NULL;
- int rcd2;
size_t pathlen;
- rcd2=nc_inq_path(nc_id,&pathlen,NULL);
+ nc_inq_path(nc_id,&pathlen,NULL);
path=(char *)malloc(pathlen*sizeof(char));
- rcd2=nc_inq_path(nc_id,NULL,path);
+ nc_inq_path(nc_id,NULL,path);
(void)nco_inq_varname(nc_id,var_id,var_nm);
(void)fprintf(stdout,"ERROR: %s failed to nc_get_vara() variable \"%s\" from %s\n",fnc_nm,var_nm,path);
if(path) free(path);
@@ -2905,6 +2904,30 @@ nco_put_vara(const int nc_id,const int var_id,const long * const srt,const long
(void)fprintf(stdout,"%d\t%lu\n",dmn_idx,dmn_sz[dmn_idx]);
} /* !dmn_idx */
} /* !rcd */
+ if(rcd == NC_ERANGE){
+ nc_type var_typ_out;
+ (void)nco_inq_vartype(nc_id,var_id,&var_typ_out);
+ (void)fprintf(stdout,"NC_ERANGE Error Diagnostics for variable %s:\n",var_nm);
+ (void)fprintf(stdout,"%s attempted to write data array that user specified as type %s to output variable %s with output file-defined type %s\n",fnc_nm,nco_typ_sng(var_typ),var_nm,nco_typ_sng(var_typ_out));
+ if(var_typ == NC_DOUBLE){
+ double *var_dbl;
+ double var_min;
+ double var_max;
+ size_t idx;
+ size_t var_sz=1UL;
+ for(int dmn_idx=0;dmn_idx<dmn_nbr;dmn_idx++) var_sz*=cnt_sz_t[dmn_idx];
+ var_dbl=(double *)malloc(var_sz*sizeof(double));
+ (void)memcpy((void *)var_dbl,(void *)vp,var_sz*sizeof(double));
+ var_max=var_min=var_dbl[0];
+ for(idx=1;idx<var_sz;idx++){ /* NB: idx starts from 1 */
+ if(var_dbl[idx] < var_min) var_min=var_dbl[idx];
+ if(var_dbl[idx] > var_max) var_max=var_dbl[idx];
+ } /* !idx */
+ if(var_dbl) (void)free((void *)var_dbl);
+ (void)fprintf(stdout,"%s ERROR: Range of input data array values (possibly including _FillValue) is %g <= %s <= %g\n",fnc_nm,var_min,var_nm,var_max);
+ if(var_typ_out == NC_FLOAT) (void)fprintf(stdout,"%s INFO: Representable non-zero values of type NC_FLOAT are 1.17549e-38 <= |value| <= 3.40282e+38\n",fnc_nm);
+ } /* !var_typ */
+ } /* !rcd */
} /* !rcd */
if(rcd != NC_NOERR) nco_err_exit(rcd,"nco_put_vara()");
return rcd;
=====================================
src/nco/nco_netcdf.h
=====================================
@@ -305,7 +305,7 @@
# define H5Z_FILTER_BLOSC 32001
#endif
-/* define MAX CHUNK SIZE here as its not present in netcdf.h */
+/* Define MAX CHUNK SIZE here since it is not present in netcdf.h */
#define NCO_MAX_CHUNK_SIZE (0xFFFFFFFF)
#ifdef __cplusplus
=====================================
src/nco/nco_rgr.c
=====================================
@@ -336,7 +336,7 @@ nco_rgr_ini /* [fnc] Initialize regridding structure */
rgr->flg_dgn_bnd=False; /* [flg] Diagnose rather than copy inferred bounds */
rgr->flg_erwg_units=True; /* [flg] Generate ERWG 7.1.0r-compliant SCRIP-format grid files */
rgr->flg_grd=False; /* [flg] Create SCRIP-format grid file */
- rgr->flg_mpt_mss=False; /* [flg] Apply msk_out to variables after regridding */
+ rgr->flg_mpt_mss=False; /* [flg] Set empty (sgs_frc==0.0) SGS cells to missing value */
rgr->flg_msk_apl=False; /* [flg] Apply msk_out to variables after regridding */
rgr->flg_msk_out=False; /* [flg] Add mask to output */
rgr->flg_nfr=False; /* [flg] Infer SCRIP-format grid file */
@@ -5873,7 +5873,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
/* Add _FillValue to empty destination cells, if requested */
nco_bool flg_add_fll=rgr->flg_add_fll; /* [flg] Add _FillValue to fields with empty destination cells */
nco_bool flg_dst_mpt=False; /* [flg] At least one destination cell is empty */
- nco_bool flg_mpt_mss=rgr->flg_mpt_mss; /* [flg] Set empty (sgs_frc=0.0) SGS cells to missing value */
+ nco_bool flg_mpt_mss=rgr->flg_mpt_mss; /* [flg] Set empty (sgs_frc==0.0) SGS cells to missing value */
size_t dst_idx; /* [idx] Index on destination grid */
size_t src_idx; /* [idx] Index on source grid */
/* Determine whether any destination cells are, in fact, empty */
@@ -6493,15 +6493,16 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
double *caas_sgs_frc_in=NULL;
double *caas_sgs_frc_out=NULL;
+ double *caas_wgt_vld_out=NULL;
+ int *caas_tally=NULL;
if(nlwgt_raw){
- /* 20240714 fxm Allocate caas_tally and caas_wgt_vld_out ... when not already allocated */
/* If sgs_frc_* is used in conservative regridding... */
if(sgs_frc_out){
- /* Then copy those into analogous CAAS variables */
+ /* ...then copy those into analogous CAAS variables... */
caas_sgs_frc_in=sgs_frc_in;
caas_sgs_frc_out=sgs_frc_out;
- }else{
- /* Otherwise, must allocate caas_sgs_frc_* since sgs_frc_* DNE */
+ }else{ /* !sgs_frc_out */
+ /* ...otherwise, must allocate caas_sgs_frc_* since sgs_frc_* DNE */
caas_sgs_frc_in=(double *)nco_malloc_dbg(grd_sz_in*nco_typ_lng(var_typ_rgr),fnc_nm,"Unable to malloc() caas_sgs_frc_in value buffer");
caas_sgs_frc_out=(double *)nco_malloc_dbg(grd_sz_out*nco_typ_lng(var_typ_rgr),fnc_nm,"Unable to malloc() caas_sgs_frc_out value buffer");
/* 20240709: Baby steps to begin, assume fields are 2D and global */
@@ -6559,27 +6560,27 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
#endif /* !__GNUG__ */
#if defined( __clang__ ) && !defined(NCO_OPENMP_DEFINED)
/* OpenMP clause to build NCO with Clang compilers */
-# pragma omp parallel for firstprivate(dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,fnc_nm,frc_out,lnk_nbr,msk_out,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw,wgt_vld_thr)
+# pragma omp parallel for firstprivate(caas_tally,caas_wgt_vld_out,dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,fnc_nm,frc_out,lnk_nbr,msk_out,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw,wgt_vld_thr)
# define NCO_OPENMP_DEFINED
#endif /* !__clang__ */
#if defined( __INTEL_COMPILER ) && !defined(NCO_OPENMP_DEFINED)
/* OpenMP clause to build NCO with Intel compilers */
-# pragma omp parallel for default(none) firstprivate(dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,fnc_nm,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw,wgt_vld_thr)
+# pragma omp parallel for default(none) firstprivate(caas_tally,caas_wgt_vld_out,dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,fnc_nm,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw,wgt_vld_thr)
# define NCO_OPENMP_DEFINED
#endif /* !__INTEL_COMPILER */
#if defined(GCC_LIB_VERSION) && (GCC_LIB_VERSION < 490) && !defined(NCO_OPENMP_DEFINED)
/* Old OpenMP clause to build NCO with GCC compiler versions < 4.9.0 */
-# pragma omp parallel for default(none) firstprivate(dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,fnc_nm,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw)
+# pragma omp parallel for default(none) firstprivate(caas_tally,caas_wgt_vld_out,dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,fnc_nm,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw)
# define NCO_OPENMP_DEFINED
#endif /* !GCC < 490 */
#if defined(GCC_LIB_VERSION) && (GCC_LIB_VERSION >= 900) && !defined(NCO_OPENMP_DEFINED) && 0
/* Experimental OpenMP clause to build NCO with modern OpenMP5 GPU options */
-# pragma omp target teams distribute parallel for firstprivate(dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw)
+# pragma omp target teams distribute parallel for firstprivate(caas_tally,caas_wgt_vld_out,dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,flg_rnr,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw)
# define NCO_OPENMP_DEFINED
#endif /* !GCC with experimental GPU_SUPPORT */
#if defined(GCC_LIB_VERSION) && (GCC_LIB_VERSION >= 490) && !defined(NCO_OPENMP_DEFINED)
/* Standard OpenMP clause to build NCO on modern GCC versions >= 4.9.0 */
-# pragma omp parallel for firstprivate(dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw)
+# pragma omp parallel for firstprivate(caas_tally,caas_wgt_vld_out,dmn_cnt_in,dmn_cnt_out,dmn_srt,dmn_id_in,dmn_id_out,tally,var_val_dbl_in,var_val_dbl_out,wgt_vld_out) private(dmn_idx,dmn_nbr_in,dmn_nbr_out,dmn_nbr_max,dst_idx,has_mss_val,idx,idx_in,idx_out,idx_tbl,in_id,lnk_idx,lvl_idx,lvl_nbr,mss_val_cmp_dbl,mss_val_dbl,nllnk_idx,rcd,thr_idx,trv,val_in_fst,val_out_fst,var_id_in,var_id_out,var_nm,var_sz_in,var_sz_out,var_typ_out,var_typ_rgr,var_val_crr) shared(caas_sgs_frc_in,caas_sgs_frc_out,col_src_adr,dmn_nbr_hrz_crd,flg_add_fll,flg_frc_nrm,flg_mpt_mss,flg_msk_apl,flg_msk_out,frc_out,lnk_nbr,msk_out,nlcol_src_adr,nllnk_nbr,nlrow_dst_adr,nlwgt_raw,out_id,row_dst_adr,sgs_frc_nm,sgs_frc_in,sgs_frc_out,sgs_msk_nm,wgt_raw)
# define NCO_OPENMP_DEFINED
#endif /* !GCC >= 490 */
for(idx_tbl=0;idx_tbl<trv_nbr;idx_tbl++){
@@ -6719,7 +6720,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
float tm_drn; /* [s] Seconds elapsed */
if(nco_dbg_lvl_get() >= nco_dbg_var) tm_srt=clock();
- if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(fp_stdout,"%s: DEBUG renormalization configuration for %s: sgs_frc_out = %s, flg_frc_nrm = %d, has_mss_val = %d, flg_rnr = %d, wgt_vld_thr = %g\n",nco_prg_nm_get(),var_nm,sgs_frc_out ? "Yes" : "No",flg_frc_nrm,has_mss_val,flg_rnr,wgt_vld_thr);
+ if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(fp_stdout,"%s: DEBUG renormalization configuration for %s: sgs_frc_out = %s, flg_frc_nrm = %d, has_mss_val = %d, flg_rnr = %d, wgt_vld_thr = %g, flg_add_fll = %d, flg_mpt_mss = %d, flg_msk_apl = %d\n",nco_prg_nm_get(),var_nm,sgs_frc_out ? "Yes" : "No",flg_frc_nrm,has_mss_val,flg_rnr,wgt_vld_thr,flg_add_fll,flg_mpt_mss,flg_msk_apl);
/* This first block is for "normal" variables without sub-gridscale fractions */
if(!sgs_frc_out){
@@ -6876,7 +6877,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
/* Variables with sub-gridscale fractions require "double-weighting" and normalization */
if(sgs_frc_out){
if(!strcmp(var_nm,sgs_frc_nm)){
- /* Copy shared variable sgs_frc_out that was regridded before OpenMP loop
+ /* Copy shared variable sgs_frc_out (that was regridded before OpenMP loop) into output buffer for sgs_frc_nm
20190911: Reasons to copy sgs_frc_out into sgs_frc_nm data include speed, consistency, and well-definedness of sgs_frc_out. One reason to regrid sgs_frc_nm here is consistency with original, raw dataset: ELM landfrac is masked so regridding it here (rather than using sgs_frc_out) would produce a regridded dataset more identical to raw ELM output. The same can be said for CICE (I think). MPAS cellMask and timeMonthly_avg_iceAreaCell are not masked, and so should produce the same values as sgs_frc_out if regridded here. */
memcpy(var_val_dbl_out,sgs_frc_out,grd_sz_out*nco_typ_lng(var_typ_rgr));
}else if(sgs_msk_nm && !strcmp(var_nm,sgs_msk_nm)){
@@ -6914,10 +6915,12 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
/* 20220417 SGS regridding with missing values presents additional complexity
Original SGS implementation assumed field and sgs_frc valid at same points
However, ELM landunit-specific values are missing in gridcells that lack those landunits
+ Hence valid field values imply valid sgs_frc, yet valid sgs_frc sometime occurs with missing field values
+
For example:
TSOI is missing in land gridcells that are entirely glacier,
- TSOIICE is missing in land gridcells that are vegetated,
- TLAKE and LAKEICETHICK are missing in land gridcells have no lakes
+ TSOIICE is missing in land gridcells that are entirely vegetated,
+ TLAKE and LAKEICETHICK are missing in lake-free land gridcells
Recently noticed that ELM archives (by default) a dozen or so such fields
Such fields are means over the fractional landunit of the fractional land
We call these fields sub-SGS
@@ -6930,13 +6933,10 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
Workaround algorithm:
Copy sgs_frc_out into volatile sub_sgs_frc_out iff sgs_frc and has_mss_val
Remove contributions of missing landunit area from sub_sgs_frc_out
- Normalize by sub_sgs_frc_out instead of sgs_frc_out
- Delete sub_sgs_frc_out
- Procedure works fine in theory and with sgs_frc that originates with double precision
- However, rounding errors can accumulate with single precision landfrac (as in CLM/ELM)
- These cause 2 bad temperatures for ne30pg2->180x360 regridding of vegetated-only gridcells
- Solution is to threshold normalization by sub_sgs_frc_out, accounting for sgs_frc units */
- const double sub_sgs_frc_out_thr=sgs_nrm*1.0e-15; /* [frc] Threshold sub-SGS fraction for validity/normalization */
+ Remember to check that contributions come from source cells where sgs_frc_in is valid value
+ Although sgs_frc_out is construced to be valid value, sgs_frc_in might be missing value
+ After deducting areal contributions from invalid input cells, normalize by sub_sgs_frc_out instead of sgs_frc_out
+ Delete sub_sgs_frc_out */
double *sub_sgs_frc_out=NULL;
double sgs_frc_in_crr; /* [frc] SGS fraction of current input (source) gridcell */
double sub_sgs_frc_out_crr; /* [frc] SGS fraction of current output (destination) gridcell */
@@ -6949,25 +6949,25 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
for(lnk_idx=0;lnk_idx<lnk_nbr;lnk_idx++){
idx_in=col_src_adr[lnk_idx];
idx_out=row_dst_adr[lnk_idx];
- if((var_val_crr=var_val_dbl_in[idx_in]) != mss_val_cmp_dbl){
- var_val_dbl_out[idx_out]+=var_val_crr*wgt_raw[lnk_idx]*sgs_frc_in[idx_in];
+ sgs_frc_in_crr=sgs_frc_in[idx_in];
+ if((var_val_crr=var_val_dbl_in[idx_in]) != mss_val_cmp_dbl && sgs_frc_in_crr != mss_val_cmp_dbl){
+ var_val_dbl_out[idx_out]+=var_val_crr*wgt_raw[lnk_idx]*sgs_frc_in_crr;
tally[idx_out]++;
}else{ /* !mss_val_cmp_dbl */
/* If input field value is missing in a gridcell with positive-definite area,
then input field has sub-sub-gridscale missing value in gridcell.
Reduce effective area used for normalization appropriately */
- if((sgs_frc_in_crr=sgs_frc_in[idx_in]) != mss_val_cmp_dbl)
+ if(sgs_frc_in_crr != mss_val_cmp_dbl)
if(sgs_frc_in_crr > 0.0)
sub_sgs_frc_out[idx_out]-=sgs_frc_in_crr*wgt_raw[lnk_idx];
} /* !mss_val_cmp_dbl */
} /* !lnk_idx */
- /* NB: Normalization clause is complex to support sgs_frc_out from both ELM and MPAS-Seaice
- 20220615: Old normalization command fails (though rarely) if input sgs_frc is single-precision
- Solution is to use use precision-dependent thresholds for normalization
- if(!tally[dst_idx]){var_val_dbl_out[dst_idx]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out[dst_idx] > 0.0) var_val_dbl_out[dst_idx]/=sub_sgs_frc_out[dst_idx];} <--old (pre-20220615) normalization */
+ /* NB: Normalization clause is complex to support sgs_frc_out from both ELM and MPAS-Seaice */
for(dst_idx=0;dst_idx<grd_sz_out;dst_idx++){
+ /* If output cell is not already missing value, then set it to missing value if it has no contributing cells
+ Otherwise normalize the output value by the sub-SGS area fraction */
sub_sgs_frc_out_crr=sub_sgs_frc_out[dst_idx];
- if(!tally[dst_idx] || sub_sgs_frc_out_crr < sub_sgs_frc_out_thr){var_val_dbl_out[dst_idx]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out_crr > 0.0) var_val_dbl_out[dst_idx]/=sub_sgs_frc_out_crr;}
+ if(!tally[dst_idx]){var_val_dbl_out[dst_idx]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out[dst_idx] > 0.0) var_val_dbl_out[dst_idx]/=sub_sgs_frc_out_crr;}
} /* !dst_idx */
}else{ /* lvl_nbr > 1 */
/* SGS-regrid multi-level fields with missing values */
@@ -6977,8 +6977,9 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
for(lnk_idx=0;lnk_idx<lnk_nbr;lnk_idx++){
idx_in=col_src_adr[lnk_idx]+val_in_fst;
idx_out=row_dst_adr[lnk_idx]+val_out_fst;
- if((var_val_crr=var_val_dbl_in[idx_in]) != mss_val_cmp_dbl){
- var_val_dbl_out[idx_out]+=var_val_crr*wgt_raw[lnk_idx]*sgs_frc_in[col_src_adr[lnk_idx]];
+ sgs_frc_in_crr=sgs_frc_in[col_src_adr[lnk_idx]];
+ if((var_val_crr=var_val_dbl_in[idx_in]) != mss_val_cmp_dbl && sgs_frc_in_crr != mss_val_cmp_dbl){
+ var_val_dbl_out[idx_out]+=var_val_crr*wgt_raw[lnk_idx]*sgs_frc_in_crr;
tally[idx_out]++;
}else{ /* !mss_val_cmp_dbl */
/* Same sub-sub-gridcell procedure as for single-level fields except...
@@ -6987,7 +6988,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
Use sub-SGS-adjusted normalization factor computed in level 0 for all remaining levels
Otherwise would need to re-copy/compute sgs_frc_out for every level */
if(lvl_idx == 0)
- if((sgs_frc_in_crr=sgs_frc_in[idx_in]) != mss_val_cmp_dbl)
+ if(sgs_frc_in_crr != mss_val_cmp_dbl)
if(sgs_frc_in_crr > 0.0)
sub_sgs_frc_out[idx_out]-=sgs_frc_in_crr*wgt_raw[lnk_idx];
} /* !mss_val_cmp_dbl */
@@ -6996,8 +6997,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
for(dst_idx=0;dst_idx<grd_sz_out;dst_idx++){
idx_out=dst_idx+val_out_fst;
sub_sgs_frc_out_crr=sub_sgs_frc_out[dst_idx];
- //if(!tally[idx_out]){var_val_dbl_out[idx_out]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out[dst_idx] > 0.0) var_val_dbl_out[idx_out]/=sub_sgs_frc_out[dst_idx];}
- if(!tally[idx_out] || sub_sgs_frc_out_crr < sub_sgs_frc_out_thr){var_val_dbl_out[idx_out]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out_crr > 0.0) var_val_dbl_out[idx_out]/=sub_sgs_frc_out_crr;}
+ if(!tally[idx_out]){var_val_dbl_out[idx_out]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out_crr > 0.0) var_val_dbl_out[idx_out]/=sub_sgs_frc_out_crr;}
} /* !dst_idx */
val_in_fst+=grd_sz_in;
val_out_fst+=grd_sz_out;
@@ -7050,7 +7050,7 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
Once sgs_msk if fully supported following clause will likely be redundant with --msk_apl in datasets with sgs_msk */
if(sgs_frc_out){
- /* 20231019: Set empty (sgs_frc=0.0) SGS cells to missing value
+ /* 20231019: Set empty (sgs_frc==0.0) SGS cells to missing value
When triggered, this sets, e.g., open-ocean areas in MPAS-Seaice data to missing values */
if(flg_mpt_mss){
for(dst_idx=0;dst_idx<grd_sz_out;dst_idx++){
@@ -7100,8 +7100,21 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
/* Initialize output */
(void)memset(caas_gym,0,var_sz_out*nco_typ_lng(var_typ_rgr));
+ /* 20240724 fxm Allocate caas_tally and caas_wgt_vld_out ... when not already allocated */
+ if(tally){
+ caas_tally=tally;
+ }else{ /* !sgs_frc_out */
+ caas_tally=(int *)nco_malloc_dbg(var_sz_out*nco_typ_lng(NC_INT),fnc_nm,"Unable to malloc() caas_tally buffer");
+ } /* !sgs_frc_out */
+ (void)memset(caas_tally,0,var_sz_out*nco_typ_lng(NC_INT));
+ if(wgt_vld_out){
+ caas_wgt_vld_out=wgt_vld_out;
+ }else{ /* !sgs_frc_out */
+ caas_wgt_vld_out=(double *)nco_malloc_dbg(var_sz_out*nco_typ_lng(var_typ_rgr),fnc_nm,"Unable to malloc() caas_wgt_vld_out buffer");
+ } /* !sgs_frc_out */
+ (void)memset(caas_wgt_vld_out,0,var_sz_out*nco_typ_lng(var_typ_rgr));
+
/* Handle Sub-SGS normalization */
- const double sub_sgs_frc_out_thr=sgs_nrm*1.0e-15; /* [frc] Threshold sub-SGS fraction for validity/normalization */
double *sub_sgs_frc_out=NULL;
double sgs_frc_in_crr; /* [frc] SGS fraction of current input (source) gridcell */
double sub_sgs_frc_out_crr; /* [frc] SGS fraction of current output (destination) gridcell */
@@ -7113,29 +7126,33 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
for(lnk_idx=0;lnk_idx<lnk_nbr;lnk_idx++){
idx_in=col_src_adr[lnk_idx];
idx_out=row_dst_adr[lnk_idx];
- if((var_val_crr=var_val_dbl_in[idx_in]) != mss_val_cmp_dbl){
- var_val_dbl_out[idx_out]+=var_val_crr*wgt_raw[lnk_idx]*caas_sgs_frc_in[idx_in];
- tally[idx_out]++;
+ sgs_frc_in_crr=caas_sgs_frc_in[idx_in];
+ if((var_val_crr=var_val_dbl_in[idx_in]) != mss_val_cmp_dbl && sgs_frc_in_crr != mss_val_cmp_dbl){
+ var_val_dbl_out[idx_out]+=var_val_crr*wgt_raw[lnk_idx]*sgs_frc_in_crr;
+ caas_tally[idx_out]++;
}else{ /* !mss_val_cmp_dbl */
/* If input field value is missing in a gridcell with positive-definite area,
then input field has sub-sub-gridscale missing value in gridcell.
Reduce effective area used for normalization appropriately */
- if((sgs_frc_in_crr=caas_sgs_frc_in[idx_in]) != mss_val_cmp_dbl)
+ if(sgs_frc_in_crr != mss_val_cmp_dbl)
if(sgs_frc_in_crr > 0.0)
sub_sgs_frc_out[idx_out]-=sgs_frc_in_crr*wgt_raw[lnk_idx];
} /* !mss_val_cmp_dbl */
} /* !lnk_idx */
- /* NB: Normalization clause is complex to support sgs_frc_out from both ELM and MPAS-Seaice
- 20220615: Old normalization command fails (though rarely) if input sgs_frc is single-precision
- Solution is to use use precision-dependent thresholds for normalization
- if(!tally[dst_idx]){var_val_dbl_out[dst_idx]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out[dst_idx] > 0.0) var_val_dbl_out[dst_idx]/=sub_sgs_frc_out[dst_idx];} <--old (pre-20220615) normalization */
+ /* NB: Normalization clause is complex to support sgs_frc_out from both ELM and MPAS-Seaice */
for(dst_idx=0;dst_idx<grd_sz_out;dst_idx++){
sub_sgs_frc_out_crr=sub_sgs_frc_out[dst_idx];
- if(!tally[dst_idx] || sub_sgs_frc_out_crr < sub_sgs_frc_out_thr){var_val_dbl_out[dst_idx]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out_crr > 0.0) var_val_dbl_out[dst_idx]/=sub_sgs_frc_out_crr;}
+ if(!caas_tally[dst_idx]){var_val_dbl_out[dst_idx]=mss_val_cmp_dbl;}else{if(sub_sgs_frc_out_crr > 0.0) var_val_dbl_out[dst_idx]/=sub_sgs_frc_out_crr;}
} /* !dst_idx */
if(caas_gym) caas_gym=(double *)nco_free(caas_gym);
if(sub_sgs_frc_out) sub_sgs_frc_out=(double *)nco_free(sub_sgs_frc_out);
+
+ /* Order matters for these free's---must occur before free(tally, wgt_vld_out)
+ "else" clause prevents dangling pointers when CAAS arrays are copies of original arrays */
+ if(caas_tally && !tally) caas_tally=(int *)nco_free(caas_tally); else caas_tally=NULL;
+ if(caas_wgt_vld_out && !wgt_vld_out) caas_wgt_vld_out=(double *)nco_free(caas_wgt_vld_out); else caas_wgt_vld_out=NULL;
+
} /* !nlwgt_raw */
if(nco_dbg_lvl_get() >= nco_dbg_var){
@@ -7171,9 +7188,10 @@ nco_rgr_wgt /* [fnc] Regrid with external weights */
if(nco_dbg_lvl_get() >= nco_dbg_var) (void)fprintf(stdout,"\n");
if(nco_dbg_lvl_get() >= nco_dbg_fl) (void)fprintf(stdout,"%s: INFO %s completion report: Variables regridded = %d (%d extensive), copied unmodified = %d, omitted = %d, created = %d\n",nco_prg_nm_get(),fnc_nm,var_rgr_nbr,var_xtn_nbr,var_cpy_nbr,var_xcl_nbr,var_crt_nbr);
- /* Order matters for these free's---must occur before free(sgs_frc_*) */
- if(caas_sgs_frc_in && !sgs_frc_in) caas_sgs_frc_in=(double *)nco_free(caas_sgs_frc_in);
- if(caas_sgs_frc_out && !sgs_frc_out) caas_sgs_frc_out=(double *)nco_free(caas_sgs_frc_out);
+ /* Order matters for these free's---must occur before free(sgs_frc_*)
+ "else" clause prevents dangling pointers when CAAS arrays are copies of original arrays */
+ if(caas_sgs_frc_in && !sgs_frc_in) caas_sgs_frc_in=(double *)nco_free(caas_sgs_frc_in); else caas_sgs_frc_in=NULL;
+ if(caas_sgs_frc_out && !sgs_frc_out) caas_sgs_frc_out=(double *)nco_free(caas_sgs_frc_out); else caas_sgs_frc_out=NULL;
/* Free memory allocated for grid reading/writing */
if(area_out) area_out=(double *)nco_free(area_out);
=====================================
src/nco/nco_scm.c
=====================================
@@ -210,7 +210,7 @@ nco_nmn_get(void) /* [fnc] Return mnemonic that describes current NCO version */
/* Purpose: Return mnemonic describing current NCO version
20191221: ncremap/ncclimo print left quote and first word of this string, so one-word strings look best
20200117: fixed this limitation, multi-word versions work fine */
- return "Kealakekua";
+ return "Sitton Peak";
} /* !nco_nmn_get() */
void
=====================================
src/nco/ncrename.c
=====================================
@@ -107,7 +107,7 @@ main(int argc,char **argv)
const char * const CVS_Id="$Id$";
const char * const CVS_Revision="$Revision$";
- const char * const opt_sht_lst="a:D:d:g:Hhl:Oo:p:rv:-:";
+ const char * const opt_sht_lst="34567a:D:d:g:Hhl:Oo:p:rv:-:";
const char dlm_chr='@'; /* Character delimiting variable from attribute name */
const char opt_chr='.'; /* Character indicating presence of following variable/dimension/attribute/group in file is optional */
@@ -192,6 +192,8 @@ main(int argc,char **argv)
/* 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 */
+ {"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},
@@ -260,6 +262,11 @@ main(int argc,char **argv)
} /* endif cnk */
if(!strcmp(opt_crr,"mmr_cln") || !strcmp(opt_crr,"clean")) flg_mmr_cln=True; /* [flg] Clean memory prior to exit */
if(!strcmp(opt_crr,"drt") || !strcmp(opt_crr,"mmr_drt") || !strcmp(opt_crr,"dirty")) flg_mmr_cln=False; /* [flg] Clean memory prior to exit */
+ if(!strcmp(opt_crr,"fl_fmt") || !strcmp(opt_crr,"file_format")){
+ (void)fprintf(stdout,"%s: ERROR Operators ncatted and ncrename always copy the output file type from the input file type. Specification of output file type using any of the switches (-3, -4, -5, -6, -7) or options (--fl_fmt=<output-type>) is not allowed. HINT: Change the input file type with, e.g., ncks --fl_fmt=<output-type> in.nc out.nc prior to invoking %s\n",nco_prg_nm,nco_prg_nm);
+ (void)nco_usg_prn();
+ nco_exit(EXIT_FAILURE);
+ } /* !fl_fmt */
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);
@@ -285,6 +292,15 @@ main(int argc,char **argv)
switch(opt){
case 0: /* Long options have already been processed, return */
break;
+ case '3': /* Request netCDF3 output storage format */
+ case '4': /* Request netCDF4 output storage format */
+ case '5': /* Request netCDF3 64-bit offset+data storage (i.e., pnetCDF) format */
+ case '6': /* Request netCDF3 64-bit offset output storage format */
+ case '7': /* Request netCDF4-classic output storage format */
+ (void)fprintf(stdout,"%s: ERROR Operators ncatted and ncrename always copy the output file type from the input file type. Specification of output file type using any of the switches (-3, -4, -5, -6, -7) or options (--fl_fmt=<output-type>) is not allowed. HINT: Change the input file type with, e.g., ncks --fl_fmt=<output-type> in.nc out.nc prior to invoking %s\n",nco_prg_nm,nco_prg_nm);
+ (void)nco_usg_prn();
+ nco_exit(EXIT_FAILURE);
+ break;
case 'a': /* Copy argument for later processing */
att_rnm_arg[nbr_att_rnm]=(char *)strdup(optarg);
nbr_att_rnm++;
=====================================
src/nco_c++/nco_att.hh
=====================================
@@ -364,7 +364,7 @@ nco_get_att // [fnc] Get attribute value
// Purpose: Wrapper for nco_get_att()
typ_ntr att_val; // O [frc] Attribute value
int rcd=nco_get_att(nc_id,var_id,att_nm,att_val);
- rcd+=0; // 20140531 CEWI to prevent -Wunused-variable
+ rcd=rcd+0; // 20140531 CEWI to prevent -Wunused-variable
return att_val;
} // end nco_get_att<typ_ntr>()
@@ -392,7 +392,7 @@ nco_get_att // [fnc] Get attribute value
typ_ntr att_val; // O [frc] Attribute value
int rcd=nco_get_att(nc_id,nco_inq_varid(nc_id,var_nm),att_nm,att_val);
- rcd+=0; // 20140531 CEWI to prevent -Wunused-variable
+ rcd=rcd+0; // 20140531 CEWI to prevent -Wunused-variable
return att_val;
} // end nco_get_att<typ_ntr>()
View it on GitLab: https://salsa.debian.org/debian-gis-team/nco/-/compare/03cceb66aacbdfc5f1742f39e0f410ff406ab1b0...cce52fb1e803f545eb9aa92566e5add513445705
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/nco/-/compare/03cceb66aacbdfc5f1742f39e0f410ff406ab1b0...cce52fb1e803f545eb9aa92566e5add513445705
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240903/2329d933/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list