﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
952	VERY IMPORTANT:  CMake build scripts and OUTPUT_STATS	arango		"* The **CMake** build scripts (**cbuild_roms.csh** and **cbuild_roms.sh**) were cleaned and made more compact: [[br]] [[br]]
 * Several macro definitions were moved from the build scripts to the main **CMakeLists.txt** configuration file for simplicity [[br]] [[br]]
 * The ROMS executable is now **copied** to the project directory instead of making a **symbolic** link. It should work even if ROMS were linked to the shared library (**libROMS.{so|dylib}**) because **CMAKE_BUILD_WITH_INSTALL_RPATH** is set to **FALSE** so that **RPATH/RUNPATH** are set correctly for both the build tree and installed locations of the ROMS executable. [[br]] [[br]]
 * The macro definitions in **Compilers/roms_compiler_flags.cmake** and **Compilers/roms_config.cmake** were also updated.

* The **OUTPUT_STATS** option is introduced to report the statistics of every output variable into standard output to facilitate debugging. For example, we can have the following report:
 {{{
  WRT_HIS_NF90     - writing history     fields (Index=1,1) in record = 33
    - zeta:                       Min = -2.53787051E-01,  Max =  2.21499656E-01,  CheckSum = 8935
    - ubar:                       Min = -1.34311554E-01,  Max =  1.93256921E-01,  CheckSum = 8568
    - DU_avg1:                    Min = -2.07583251E+07,  Max =  3.32353876E+07,  CheckSum = 7365
    - DU_avg2:                    Min = -2.07602196E+07,  Max =  3.32406785E+07,  CheckSum = 7461
    - vbar:                       Min = -2.15736568E-01,  Max =  1.94236573E-01,  CheckSum = 8406
    - DV_avg1:                    Min = -3.37735448E+07,  Max =  1.84199170E+07,  CheckSum = 7265
    - DV_avg2:                    Min = -3.37768757E+07,  Max =  1.84168047E+07,  CheckSum = 7277
    - u:                          Min = -3.54280363E-01,  Max =  5.53737927E-01,  CheckSum = 257209
    - v:                          Min = -5.36308150E-01,  Max =  4.26453121E-01,  CheckSum = 251702
    - omega:                      Min = -1.60468150E-03,  Max =  1.36090242E-03,  CheckSum = 255075
    - w:                          Min = -2.31089520E-03,  Max =  1.50154444E-03,  CheckSum = 271803
    - temp:                       Min =  1.11330213E+00,  Max =  1.83344385E+01,  CheckSum = 241650
    - salt:                       Min =  3.19036203E+01,  Max =  3.46896641E+01,  CheckSum = 211601
    - AKv:                        Min =  2.23812185E-05,  Max =  8.12660236E-01,  CheckSum = 272259
    - AKt:                        Min =  1.00000000E-05,  Max =  9.92734690E-01,  CheckSum = 273723
    - AKs:                        Min =  1.00000000E-05,  Max =  9.92734690E-01,  CheckSum = 273723
    - Pair:                       Min =  1.00743285E+03,  Max =  1.02769252E+03,  CheckSum = 6863
    - Tair:                       Min = -2.08358809E+00,  Max =  1.77220951E+01,  CheckSum = 6496
    - Uwind:                      Min = -1.45947707E+01,  Max =  3.82034782E+00,  CheckSum = 8050
    - Vwind:                      Min = -7.43046612E+00,  Max =  1.32450908E+01,  CheckSum = 6425
    - shflux:                     Min = -1.26168950E-04,  Max =  1.21942551E-05,  CheckSum = 8438
    - ssflux:                     Min = -1.55420481E-05,  Max =  2.02108689E-06,  CheckSum = 8850
    - latent:                     Min = -5.21229738E-05,  Max =  5.96354770E-06,  CheckSum = 9261
    - sensible:                   Min = -4.84698719E-05,  Max =  7.84890317E-06,  CheckSum = 8970
    - lwrad:                      Min = -3.46309283E-05,  Max = -1.61819579E-06,  CheckSum = 9208
    - evaporation:                Min = -9.84070050E-06,  Max =  8.59023387E-05,  CheckSum = 8691
    - rain:                       Min = -7.05555578E-07,  Max =  4.68687525E-04,  CheckSum = 8526
    - EminusP:                    Min = -4.72947771E-07,  Max =  6.06640234E-08,  CheckSum = 8707
    - swrad:                      Min =  0.00000000E+00,  Max =  6.02349409E-05,  CheckSum = 8724
    - sustr:                      Min = -5.49541550E-04,  Max =  3.78055345E-05,  CheckSum = 8639
    - svstr:                      Min = -9.05397457E-05,  Max =  3.54286819E-04,  CheckSum = 8133
}}}
 As a consequence, all the calls to **nf_fwrite2d**, **nfwrite3d**, and **nf_fwrite4d** were modified to include the variable metadata index in its **fourth** argument:
 {{{
!
!  Write out tracer type variables.
!
      DO itrc=1,NT(ng)
        IF (Hout(idTvar(itrc),ng)) THEN
          scale=1.0_dp
          gtype=gfactor*r3dvar
          status=nf_fwrite3d(ng, model, HIS(ng)%ncid, idTvar(itrc),     &
     &                       HIS(ng)%Tid(itrc),                         &
     &                       HIS(ng)%Rindex, gtype,                     &
     &                       LBi, UBi, LBj, UBj, 1, N(ng), scale,       &
# ifdef MASKING
     &                       GRID(ng) % rmask,                          &
# endif
     &                       OCEAN(ng) % t(:,:,:,NOUT,itrc))
          IF (FoundError(status, nf90_noerr, __LINE__, MyFile)) THEN
            IF (Master) THEN
              WRITE (stdout,20) TRIM(Vname(1,idTvar(itrc))),            &
     &                          HIS(ng)%Rindex
            END IF
            exit_flag=3
            ioerror=status
            RETURN
          END IF
        END IF
      END DO
}}}
  [[span(style=color: #FF0000, **WARNING:** )]] Notice the additional fourth argument [[span(style=color: #0000FF, **idTvar(itrc)** )]] to **nf_fwrite3d**.

* The metadata file **varinfo.yaml** was updated to include ROMS geometry variables used in **def_info.F** and **wrt_info.F**. I should have done this a long time ago. For example, when the file is created, it reports its statistics when **OUTPUT_STATS** is activated:
 {{{
 DEF_HIS_NF90     - creating history file,            Grid 01: wc13_fwd_20040103_outer0.nc
    - h:                          Min =  7.80292502E+01,  Max =  5.19952300E+03,  CheckSum = 7704
    - f:                          Min =  7.27220522E-05,  Max =  1.08086034E-04,  CheckSum = 8151
    - pm:                         Min =  3.11708295E-05,  Max =  4.03430084E-05,  CheckSum = 7924
    - pn:                         Min =  2.69947206E-05,  Max =  2.69947206E-05,  CheckSum = 9405
    - lon_rho:                    Min = -1.34000000E+02,  Max = -1.16000000E+02,  CheckSum = 4984
    - lat_rho:                    Min =  3.00000000E+01,  Max =  4.80000000E+01,  CheckSum = 5282
    - lon_u:                      Min = -1.33833333E+02,  Max = -1.16166667E+02,  CheckSum = 4914
    - lat_u:                      Min =  3.00000000E+01,  Max =  4.80000000E+01,  CheckSum = 5004
    - lon_v:                      Min = -1.34000000E+02,  Max = -1.16000000E+02,  CheckSum = 4628
    - lat_v:                      Min =  3.01666667E+01,  Max =  4.78333333E+01,  CheckSum = 5206
    - lon_psi:                    Min = -1.33833333E+02,  Max = -1.15833333E+02,  CheckSum = 4563
    - lat_psi:                    Min =  3.01666667E+01,  Max =  4.78333333E+01,  CheckSum = 4932
    - angle:                      Min =  1.45444412E-03,  Max =  2.16172340E-03,  CheckSum = 7606
    - mask_rho:                   Min =  1.00000000E+00,  Max =  1.00000000E+00,  CheckSum = 2660
    - mask_u:                     Min =  1.00000000E+00,  Max =  1.00000000E+00,  CheckSum = 2520
    - mask_v:                     Min =  1.00000000E+00,  Max =  1.00000000E+00,  CheckSum = 2470
    - mask_psi:                   Min =  1.00000000E+00,  Max =  2.00000000E+00,  CheckSum = 2340
}}}

----

[[span(style=color: #FF0000, **__WARNING__:** )]]

* All the ROMS test repository's **CMake** build scripts were updated.

* The metadata file **varinfo.yaml** was updated, and the changes are required for this and future versions of ROMS.
"	upgrade	closed	major	Release ROMS/TOMS 4.2	Nonlinear	4.1	Done		
