!   v1.0 April 20, 2018   Jun Wang, Wesley Ebisuzaki
!   v1.1 July 26, 2018    Wesley Ebisuzaki, more fields converted to grib, timing added
!   v1.2 Aug 21, 2018     Wesley Ebisuzaki, better timing information in grib files
!   v1.3 Aug 23, 2018     Wesley Ebisuzaki, added my_option for climate reanalysis
!                                           fix problem in precip, enkf analyses are started from
!                                           fhr=-3, and the bucket is emptied at fhr=0
!   v1.4 Sep 5, 2018      Wesley Ebisuzaki, climate reanalysis: add wind speed at 10m
!   v1.4.1 Sep 21, 2018   Wesley Ebisuzaki, compatible with gfortran version
!   v1.5                  Wesley Ebisuzaki, use hybrid pressure level
!                                           calc. P and Z for hybrid levels (sfg/atm)
!   v1.6 Nov 20, 2018     Wesley Ebisuzaki, turn off generation of PRES of model levels
!   v1.7 Dec 29, 2018     Wesley Ebisuzaki, close template, add fast and  prate_adjust
!                             fast: no ctl file, packing=aec instead of c2,
!                                        less text
!   v1.8 jan 13, 2019     Wesley Ebisuzaki, fix prate_adjust, extra_var
!   v1.9 mar, 2019        Wesley Ebisuzaki, look for land mask, apply mask to certain fields
!                                           grib: use undefined instead of special value
!                                            landmask=  1 land
!                                                       0 open water
!                                                       2 ice covered water
!                                            look for template in template_512.grb,  $TEMPLATE,
!                                            and $HOME/bin_data/template_512.grb
!                                            added CDCA (cloud amount)
!   v2.0 April, 2019      Wesley Ebisuzaki, add A option, use aec compression
!                                           add S option for simple packing
!                                           public release
!   v2.1 Sep 25, 2019     Wesley Ebisuzaki, apply land mask to more fields, TRANS, FLDCP, EVBS,
!                                           EVCW, WATR, PEVPR, SLTYP, SSRUN
!                                           saved more data in the CORe nemsio file that mask
!                                           option a: TSOIL instead of TMP
!   v2.2 Dec 20, 2019     Wesley Ebisuzaki, option p: hydrostatic surface pressure
!                                           delz -> THICKNESS (old: hgt)
!                                           dpres -> nothing (no grib equivalent, old PRES)
!   v2.3 Feb 20, 2020     Wesley Ebisuzaki, add -o (output file), work with wgrib2 v2.0.9 if template is U/V
!   V2.4 March 13, 2020   Wesley Ebisuzaki, do not write DPRES,PRATEB,CPRATB,TI, TG3,F10M, FFHH, FFMM, F10
!   v2.5 April 27, 2020   Wesley Ebisuzaki, SNOHF and Clear Sky Fluxes are time aveages add
!                                           option F to fix, also "a" fixes it too
!   v2.6 Nev, 2021                          Public Release version
!   v2.7 May, 2024        Wesley Ebisuzaki, cloud TMP and PRES can have unrealistic values (CORe)
!                                           x.xxe20 which is similar to undefined 9.99e20
!                                           so likely that an interpolation to Gaussian grid
!                                           did not check for undefined values.  This code will take
!                                           PRES and TMP that are unphysical (5*large values) and
!                                           make them undefined.
!   v2.8 Apr, 2025        Wesley Ebisuzaki  string(strlen-n:b) -> string(max0(1,strlen-n),b)