
This directory: ~foster/tgcmvis/tgcmproc/tgcmproc_f90
This is my CVS working directory for tgcmproc_f90.


!-----------------------------------------------------------------------
11/4/03:
Added field attribute zp_interp to netcdf output files.

Executed cvs tag tgcmproc1-3 to tag this code. This will
be known as tgcmproc1.3:

On file server:
  Source code: /fs/projects/tgcm/tgcmproc1.3
               (linked to /fs/projects/tgcm/tgcmproc/f90/src)

  Executables: 
    /fs/projects/tgcm/bin.AIX/tgcmproc1.3_f90
      (linked to tgcmproc_f90 in same dir)
    /fs/projects/tgcm/bin.IRIX64/tgcmproc1.3_f90
      (linked to tgcmproc_f90 in same dir)

On mss:
  Source code: 
    /TGCM/tgcmproc/tgcmproc_src.tar.Z
    /TGCM/tgcmproc/tgcmproc1.3/tgcmproc_src.tar.Z

  Executables:
    /TGCM/tgcmproc/tgcmproc1.3_aix
    /TGCM/tgcmproc/tgcmproc_aix
    /TGCM/tgcmproc/tgcmproc1.3_o2k
    /TGCM/tgcmproc/tgcmproc_o2k

    /TGCM/tgcmproc/tgcmproc1.3/tgcmproc_aix
    /TGCM/tgcmproc/tgcmproc1.3/tgcmproc_o2k


At hao:
  Source code:
    /home/tgcm/tgcmproc/tgcmproc1.3
      (linked to /home/tgcm/tgcmproc/tgcmproc)
    CVS working directory: ~foster/tgcmproc/tgcmproc_f90
    

!-----------------------------------------------------------------------

1/21/04:
Increased mxhvols (proc.F) from 365 to 400. Did cvs commit on this.
Recompiled on dave and saved the following new executables:

/fs/projects/tgcm/bin.AIX/tgcmproc1.3_aix (linked to tgcmproc_f90 in same dir)
mss:/TGCM/tgcmproc/tgcmproc1.3_aix
mss:/TGCM/tgcmproc/tgcmproc_aix

NOTE: Source code on /fs and mss and hao:/home/tgcm/tgcmproc/tgcmproc1.3
      were *NOT* updated at this time, nor were SGI executables built.

!-----------------------------------------------------------------------

1/27/04:
Fixed Greenline E5577 when ie5577(5) > 0, i.e., lyman-beta source for
greenline. This included using 1.e-20 for O21D if O21D is not available.
Did cvs commit and rewrote IBM executable as in 1/21/04 above.

!-----------------------------------------------------------------------

1/30/04: Another small fix for E5577: removed o21d from dependencies
for all 5 greenline sources. The o21d is checked for in mkderived for
e5577, and if it is not available, 1.e-20 is used for o21d instead.

Also changed SIGAO2(17) from 1.0 to 2.2 in solred.F (Roble request).

3/11/04: Removed redundant sub handle_ncerr from mksatut.F. This was
causing a problem in nc_rdfld (nchist_mod.F) if there was an error
reading a field. Now using sub handle_ncerr in util.F.

3/23-31/04: Added vertical integration of global means to mkxyut.F 
and mkutvert with write to stdout for Ray's dinos study. This was
already in mkxyloc.

======> Change in lower boundary of T,U,V in tag tgcmproc1-4 <======
4/1/04: Changed order of interp_body and setting lbc for t,u,v in
proclat. See comments in proclat.F.

Committing these changes and tagging tgcmproc1-4 on 4/1/04.
Wrote new executables and source to mss as follows:

Mss listing of /TGCM/tgcmproc as of Thu Apr  1 21:07:06 US/Mountain 2004:

-rw----rw-  1 FOSTER  24100004  7962710 Apr  1 20:56 tgcmproc1.4_aix
-rw----rw-  1 FOSTER  93300025  9851096 Apr  1 20:57 tgcmproc1.4_o2k
-rw----rw-  1 FOSTER  24100004  7962710 Apr  1 20:57 tgcmproc_aix
-rw----rw-  1 FOSTER  93300025  9851096 Apr  1 20:58 tgcmproc_o2k
-rw----rw-  1 FOSTER  24100004   636338 Apr  1 20:55 tgcmproc_src.tar.Z

/TGCM/tgcmproc/tgcmproc1.4:
-rw----rw-  1 FOSTER  24100004  7962710 Apr  1 20:48 tgcmproc_aix
tgcmproc1.4 executable built on AIX dave
-rw----rw-  1 FOSTER  93300025  9851096 Apr  1 20:51 tgcmproc_o2k
tgcmproc1.4 executable built on SGI dataproc
-rw----rw-  1 FOSTER  24100004   636338 Apr  1 20:49 tgcmproc_src.tar.Z
tgcmproc1.4 source (cvs tag tgcmproc1-4)

!-----------------------------------------------------------------------

4/9/04: Attempting to compile on hao SunBlade100. Having trouble with
mkv5d.F. The C code v5d.c, etc., compile fine. mkv5d.F also compiles,
but cannot find the C functions unless -ext_names=plain. So added
special rule in Makefile to use this flag. But then mkv5d.o cannot
find certain functions in util.F.

4/30/04: Converted rcp to scp since rcp is not longer allowed between
scd and divisional machines. If the job is run interactively, then
scp prompts for a password at stdout, and it works. The scp fails
if in a batch job, but the local files tgcmproc.cgm, etc can be manually
scp'd after the job has finished. 

Also added iplot to namelist read, i.e.  if user sets iplot=0, no plots 
will be made. The default is iplot=1. Then allowed all sendxxx namelist
reads to be commented out, but still make plots if iplot==1. This way
the scp's are not attempted and the user can do them manually after the
job. 

Also made an attempt to build this on hao Linux machines. The source
does compile with pgf90, but have not gotten a clean load yet -- undefined 
symbols, libraries, etc, so no executable yet.

Updated Makefile to include sections for Sun and Linux (altho they are
not completely working yet), and updated to dcs3.3 from dcs3.2.

Committing these changes to the repository and tagging tgcmproc1-5 (v1.5).
!-----------------------------------------------------------------------

5/12/04:
Added "-i ~/id_dsa" to scp command in sub scpfile in util.F. This enables
unattended scp from the fortran, if the user has set up the private/public
key pair, and put the private key in ~/id_dsa. This is working on the IBMs
but may not be working on dataproc. On dataproc, I get the warning:

Warning: Identity file ~/id_dsa does not exist.

even though it does exist. The transfer is successful anyway because it
must be defaulting to ~/.ssh/id_dsa (which also exists in my case).

If the unattended scp fails, it will still prompt for password interactively,
and if the user is present to give the correct password, the transfer succeeds.

Committed this change to cvs from working dir ~/tgcmvis/tgcmproc/tgcmproc_f90.
Wrote new binaries /TGCM/tgcmproc/tgcmproc_aix and tgcmproc_o2k. Also wrote
new /TGCM/tgcmproc/tgcmproc_src.tar.Z. (Did *not* write a new version 1.6).

!-----------------------------------------------------------------------

6/22/04:
Fixed tmpdir so it can be same as cwd exec dir. See getcwd in util.F
(called from tgcmproc.F), and input.F.

Working w/ Art to verify/correct ion velocities as per ionvel (see mkdrifts.F)

Added read of long_name and units from netcdf file if field is unknown
to the processor (i.e., secondary history fields from addfsech calls in 
the model -- user may have specified long_name and units). See nchist_mod.F.
Then changed mkxxx routines (all plot routines) to show both short and long 
names of unknown fields.

Merged Bougher's mods for special "Bougher format" data output. See new file
mkauxflds.F. This involved mods to input.F, proc.F, tgcmproc.F, mkxyloc.F,
proclat.F. Made a run using Steve's ~bougher/f90tgcmproc/mtgcm.locprt.inp1e.
It looks ok -- sent it to Steve, eve 6/24/04.

6/25-28: Added detection of NaNs and INFs when reading histories. See sub 
check_nans in util.F. It is called from nc_rdfld (nchist_mod.F), and
some of the plot routines. It has option to print warnings, and option 
to replace NaNs w/ spval. The processor should not crash when NaNs are
encountered -- it should print warnings and send a plot file. Some plots
will show -NaNQ in the min,max label, other plots will show zeroes.

6/29: Debugging on Linux sundog (in /suncat/e/foster/tgcmproc_f90).
Code crashes at first executable statement of sub nc_rdfld (nchist_mod.F)
if the call to nf_get_vara_real later in nc_rdfld is not commented out.

A small test program that makes the same call works fine (see ./linux).
Sent mail to support@unidata. PGI debugger pgdbg says it is crashing
in _int_malloc, but gives first exec statement in nc_rdfld as source
code line number. If nf_get_vara_real *is* commented out, everything
works fine, but of course the array is not read from the file.

8/25/04: Fixed some hardwired dimensions in mksatut, and made it work
with interpolation to height surfaces (see mksatut.F).

9/14/04: Some minor changes for "Bougher format", see mkauxflds.F,
mkxyloc.F, and proclat.F.

9/14/04: Changed fixnamelist to recognize 'LT' or 'lt' as local times
(in addition to recognizing 'SLT' or 'slt').

9/14/04: Saving this code as cvs tag tgcmproc1-6 (tgcmproc1.6)

!-----------------------------------------------------------------------

3/4/05: Fix label problem in mkmaps.F to truncate h%mssvol in blabs(2)
if necessary to avoid writing beyond length of blabs(2), and resulting
crash on internal file write. See len0,len1 in mkmaps.F.
Also increased lenhvol from 56 to 80 (proc.F).

5/3-4/05: Added sub smooth (util.F) for height-interpolated difference 
fields in mklons and mkxyloc. This smoothing can be turned off by
setting ismooth=0 in namelist read file.

Update /fis/hao/tgcm/bin.AIX/tgcmproc_f90 only -- source code changed
only in ~/tgcmvis/tgcmproc/tgcmproc_f90.

5/10/05: Commented out a conditional at end of sub pltmxy (pltxy.F).
Noticed this was cutting off RADCOOL glbm diffs near bottom of model
(below zp -4). Not sure why this was in there, but have commented it out.
Updated binary in bin.AIX.

5/24/05: Changed calls to nc_get_var_real to nf_get_var_real (eliminated
nc_get_var_real). The nc_get_var_real function did not have a LINUX
ifdef conditional, so it was defaulting to get_var_double, which does
not work (except formerly on the Crays). So this allows reading from
Linux machines. Processor is now working on serial hao linux boxes.

5/25/05: 
Added getfile.F, with expand_path and other routines in util.F.
This allows env vars to be embedded in histvols path names.

Added "Searching" print to stdout when searching for histories
(prints only when opening a new file for reading). This is
useful for finding out what times are on a file(s).

Merged proclat to include Liying's new sub calchts with latitudinally
varying gravity (called only when modelhts==0).

Put check in input for case where only 1 history is requested (ntimes==1),
but ut plots are requested -- in this case a warning is printed to stdout
and the ut plots (ipltutvert, ipltutlat, ipltutlon, ipltxyut) are turned
off.

5/25-26/05:
Added h%histfile to hist structure. This will be the history diskfile
being read (basically the namelist histvols provided by the user, or 
the current disk file in the histvols list). Using h%histfile for
bottom labels instead of h%mssfile (the global file attribute).

5/26/05: Added delta time (mins) to x-axis ut labels. See
mtime_del_mins in input.F and plt.F.

6/3/05: Added following line to sub pltvec1d doppler wind vector plots 
(plt.F), to avoid conflict when vectors are added to map projections:
      call vvseti('MAP -- Mapping Flag',0)

6/6/05: Added allocation of flds_prev(i)%data in tgcmproc.F for ipltsatut==1.
This cleared up the bug seen by Hanli in the netcdf satellite output files 
(Jen's IDL viewer was reading these netcdf files, and right-hand axis
was coming out wrong, i.e., Z in the netcdf sat output file). Plots from
the processor itself were fine -- only the netcdf file was wrong.

6/7/05: Added flnm_cgm, flnm_ps, etc to namelist input, so alternate
disk output file names can be specified (rather than only the default
tgcmproc.cgm, tgcmproc.ps, etc.

Wrote csh script "systest" to run a binary executable on a group of 
hao linux machines, with output specific to the system name.
The tgcmproc_f90 binary executable built on callisto, appears to
run on all hao linux boxes running Fedora, and probably Enterprise
(crumb is only machine tested so far with Enterprise). It does *not*
run on redhat-9 machines, like sundog and suncat. It has run 
successfully with the default namelist input on the following hao 
linux systems:

		binary	OS	User
- - - - - - - - - - - - - - - - - - - - - - - - - - - 
callisto	ok	Fedora	Cubicle near Peter Fox
crumb		ok	Enterprise Astrid
sundog		ok	Fedora
suncat		ok	Fedora

rhea		ok	Fedora	Liying
miranda		ok		WenBin
dione		ok
atlas		ok
myst		ok
phoebe		ok
tethys		ok

janus		ok
yoda		ok		Jose

Committing this code to CVS repository and tagging as tgcmproc1-7

!-----------------------------------------------------------------------
Begin mods to tgcmproc1.7:

7/11/05:
Changed getfile.F to check for existence of local disk file before
going to mss. (Nozawa had problems w/ this on Linux systems where
he had the local file on the disk but msrcp did not work.
Rewrote linux binary at hao with this change. Did not change
anything at scd.

Also fixed flnm_dat (ascii output disk file) and senddat (asci output
scp file) so that ascii data are generated when either of these are
given in namelist read. Replaced /home/tgcm/bin.Linux/tgcmproc_f90.
Source code changes made in cvs working dir ~/tgcmvis/tgcmproc/tgcmproc_f90. 

8/30/05:
Added flnm_cdf to namelist read as local disk file name for global
field netcdf output. Tested combinations of flnm_xxx and sendxxx:
;
 flnm_cgm = 'testflnm_day21.cgm'
 sendcgm = 'vishnu.hao:/e/foster/tgcmproc/testscp_day21.cgm'
;
 flnm_ps  = 'testflnm_day21.ps'
 sendps  = 'vishnu.hao:/e/foster/tgcmproc/testscp_day21.ps'
;
 flnm_cdf = 'testflnm_day21.nc'
 sendcdf = 'vishnu.hao:/e/foster/tgcmproc/testscp_day21.nc'
 

9/6/05:
Fixed amplitude/phase top label in longitude slices -- lonsli%fname was 
not defined in sub mkampha (mklons.F). Updated executables:
  bluesky:    $TGCMROOT/bin.AIX 
  lightning:  $TGCMROOT/bin.Linux
  tempest:    $TGCMROOT/bin.IRIX64
  hao:        $TGCMROOT/bin.Linux

9/7-9/05:
Added ZP to netcdf output files (mkcdf.F): when height-interpolated fields 
are written to netcdf global output, an additional geopotential height
field ZP is written at the full log-pressure scale. This involved adding
new dimension zplev and coord var zplev(zplev). See sub addzplev (mkcdf.F).
!-----------------------------------------------------------------------

11/28/05: Switched cvs working directory from ~/tgcmvis/tgcmroc/tgcmproc_f90
to ~/tgcm/tgcmproc_f90. This is prior to changing code to read either old
or new (tiegcm-hist-lbc) history file formats. 

11/28-29: Removing old cray (i.e., non-netcdf) read stuff (mostly in gethist.F
and util.F)

12/9/05: Added check for _FillValue NF_FILL_DOUBLE when reading 4d fields,
and if any of the var contains this prefill value, it is replaced by spval.
See comments in nchist_mod.F.

1/4/06: Code now accepts old or new history file format. Added ZG processing,
and modelhts flag for the new format.  See subs proclat_old vs proclat.

1/5/06: Saving this as tgcmproc1.8_f90

2/16/06: Fixed histvols var in xyut netcdf file to use h%histfile instead
of h%mssvols, because the latter can be blank.

3/9/06: Had to add conditional to either cycle or exit fields_loop in
sub mkampha (mklons.F) to avoid the loop continuing with ixf > nf after
cycling when ixf==nf. I could not determine why the loop insisted on
continuing with ixf > nf in this case, and resulting in seg fault, but
the following conditional on the loop index in mklons.F solved the problem.

      fields_loop: do ixf=1,nf
        if (.not.f(ixf)%requested.or..not.associated(f(ixf)%data).or.
     +      f(ixf)%nlev==1.or.trim(f(ixf)%vtype)=='HEIGHT') then
!
! 3/9/06 btf: Had to add this conditional to prevent loop from
!   continuing after cycling when ixf==nf. I have *no* idea why
!   it continued iterations with ixf > nf in this case, but
!   exiting the loop rather than cycling when ixf >= nf as below 
!   solved the problem.
!
          if (ixf < nf) then
            cycle fields_loop 
          else
            exit fields_loop
          endif
        endif

Updated tgcmproc_f90 and tgcmproc_dres_f90 in /fis/hao/tgcm/bin.AIX,
but no change to source code at $TGCMROOT/tgcmproc_f90. Did not
update Linux or SGI executables. 

3/9/06:
Started work on better distinguishing midpoints and interfaces in
tgcmproc_f90. This is fairly involved, including interpolation of
t,u,v from midpoints to interfaces using tlbc, netcdf output files,
etc., using correct vertical coordinate arrays, etc. 

3/10/06: 
Eliminated sendms.F and getms.F in favor of function mssrcp in util.F 
(formerly function my_msrcp). This eliminates the need for ncaru and 
dcs libs. 

Switching Makefile to 64-bit addressing under AIX to allow build on 
both bs and bv.

This is saved in tgcmproc_mssrcp.tar.Z.

3/15/06:
Extensive mods including new proclat.F (old one is now proclat_old.F),
new sub set_zptype in getflds.F, fixed logic in mkmaps.F, new namelist
read parameter grid_levels to specify MIDPOINTS or INTERFACES. When
reading an old history and grid_levels is INTERFACES, this proc gets
same results as tgcmproc1.8_f90. However, when reading new history,
results are different because tgcmproc1.8 is plotting on midpoints
(except for T,U,V). Also added WN as new derived field calculated from
OMEGA (new histories). Retained W for old histories. This version is
saved as tgcmproc_wn.tar.Z. Will start on lon slices next.

Something to consider: the zptype (midpoints or interfaces) of a derived 
field should be the same as its dependencies, but what to do if the 
dependencies themselves are on different zptypes? Presumably the
derived field would have a default zptype, and dependencies that are
different would be converted before calculating the derived field.
This is not being done yet.

Also, consider that interpolation to height surfaces should use Z at
the same zptype as the field being interpolated. This is not being done
yet either.

3/21/06:
WN is now a derived field, calculated from Z and OMEGA in mkderived.F.
(OMEGA is only on new histories, so WN is available only on new histories).  
W is still a known field, but is only found on old histories. Fixed a bug 
in which WN was wrong for double vertical resolution because it assumed 
only 2 grid points per scale height.  So now scale height (pzps(kmx)) is 
calculated as (z(k+1)-z(k-1))/(2.*dlev) before it is multiplied by OMEGA 
to give WN. See WN in mkderived.F.

On Hanli's advice, removed "(DZp/DT)" from OMEGA long_name on the histories,
and added units of S-1.

Added grid_levels(1,1)=='HISTORY', meaning plot fields as on the history
(interfaces or midpoints).

3/22/06: 
Changed function gethist to a subroutine because pgf90 had trouble
allocating h%ilev in sub nc_rdfld (nchist_mod.F).
See ~/tgcm/tgcmproc_f90/consult/pgf90alloc.

HOWEVER, after changing gethist from func to sub, then xlf90 compiled
code had deallocate error!  Frustrating. But, found that xlf90 was ok
when compiled with -g -C, with no apparent loss of performance, so 
for now will use these flags under AIX (see Makefile). See comments
in sub nc_rdflds (nchist_mod.F) where h%lev and h%ilev are allocated.

Fixed out of bounds error in sub calchts_old (proclat_old.F). Also
copied sub calchts_old to sub calchts in proclat.F (the former version
of calchts in proclat.F did not include Liying's latitudinally varying 
gravity). 

Changed dummy dimensions of (1) to (*) in rfft.F to allow bounds
checking -C flag under xlf90.

The call to intrinsic func pack() in func shiftblanks (flist.F) was
core dumping under AIX (xlf90) when compiled w/ -g -C, so wrote my
own loop and eliminated call to pack (see comments near top of flist.F).

4/06:

Now:
!
! Grid levels (interfaces or midpoints in vertical dimension):
!   grid_levels = 'INTERFACES': process all fields on interfaces
!   grid_levels = 'MIDPOINTS' : process all fields on midpoints
!   grid_levels = 'HISTORY'   : fields as on the history
!   grid_levels = 'HIST+TUV'  : fields as on the history, except T,U,V on interfaces
!
!   Default: HIST+TUV: T,U,V are interpolated to interfaces, with TLBC,ULBC,VLBC
!     as the bottom interface boundary. All other fields processed as
!     on the history (lev or ilev).
!   Default can be overriden on a per field basis, e.g.:
!   grid_levels = 'TN','MID', 'O2','INT'...

4/25/06: Doing commit on this version, and tagging as tgcmproc1-9.
This will be installed in $TGCMROOT as tgcmproc1.9_f90:
 
- Improved processing of new tiegcm-hist-lbc histories, including 
  namelist read parameter grid_levels (midpoints vs interfaces).
- Reads vtgcm nc histories
- Output nc files are still in "old" format.

Forgot to set proc_version in proc.F to 1.9, so it is still 1.7
in the new 1.9 version.  

5/11/06: This new version appears to be unstable in some circumstances,
e.g. it is seg faulting with ./proc.mesox.protons.inp. When built for debug,
and run on bluevista, it stops in setflev:

Trace/BPT trap in getflds.__get_flds_NMOD__&&_get_flds.__get_flds_NMOD_setflev at line 644 in file "getflds.F" ($t1)
  644               f(ixf)%zptype_req = flds_known(ixf)%zptype
(dbx) 

Doing this in bv:/ptmp/foster/tgcmproc_mesox/tgcmproc_f90.
This needs to be debugged...

Later 5/11/06:
Fixed above error in getflds.F (f(ix) rather than f(ixf)) in ~/tgcm/tgcmproc_f90
-- this fixed Ray's segfault problem. Wrote new exec in $TGCMROOT/bin.AIX,
but no change to fixed source.

5/19/06:
Added conditionals to check for vtype=='HEIGHT' (height-only fields, i.e.,
OH bands and emissions) in sub set_zptype (getflds.F). 

6/5/06: Passed explicit hts array dimensions in calls to pltlon from mklons.
Before this, pltlons was apparently confused about its hts array arg, and
passing it on to yaxzht. Noticed this when plotting vtgcm history in which
1st dimension of hts was ixlat0:ixlat1, where only part of the latitude
array was passed.

8/2/06:
Commented out the 12-hr ut shift for vtgcm histories (end of sub setvtgcm in
getflds.F). The 12-hr shift was done by cray2nc, when converting from old
cray history files to netcdf. Updated executable in scd:$TGCMROOT/bin.AIX. 

8/15/06:
Passing h to sub nc_rdlbc (nchist_mod.F) so it can use h%nlat rather than nlat.
This is for single-hemisphere vtgcm, where nlat==18 (but also works for nlat==36).

9/6/06:
vtgcm histories will soon have full global latitudes instead of south only,
so no need to call setvtgcmf (getflds.F) (altho setvtgcm *is* still called).
This is now the case for cray2nc when converting old vtgcm files to netcdf.
Will now modify the vtgcm model to read/write with nlat==36 rather than 18.

10/10/06:
Added check in proclat.F of top level UN,VN before converting from cm/s to m/s.
Put new executable in $TGCMROOT/bin.AIX.

10/12/06:
Compiled for double-res with 10/10 fix, and put new tgcmproc_dres_f90
executable in $TGCMROOT/bin.AIX. Also updated proc.sres and proc.dres.

10/16/06:
In difference fields, difftype may not be set if field is a dependency
for a derived field, but has not been requested. Fixed this by adding
another conditional in sub checkdiffs, tgcmproc.F.

10/25/06:
Fix vtgcm N2 so if reading "old" history, then read n2 from external file, and
mirror hemispheres (is derived field), whereas if reading "new" history, 
N2 should be on the file, and is an underived field.  See call to getvtgcm 
(old hist only), and sub setvtgcm in getflds.F.  See also mkderived.F.
Wrote new tgcmproc_f90 (tgcmproc_dres_f90 is unchanged).

10/27/06:
Added subs vcalchts and mvtgcm_lbo1co to proclat.F, for vtgcm.
(see also proclat_old.F).  Waiting to here from Steve before writing 
new binary tgcmproc_f90.

11/7/06:
It was pointed out a few days ago that the tgcmproc_f90 binary built on
bluevista does not execute on bluesky. This is the first time I have seen
incompatible binaries on 2 AIX machines. Maybe this is due to the 5.x OS
upgrade on bv some time ago. Anyway, I rebuilt tgcmproc_f90 on bluesky, and
put it here as $TGCMROOT/bin.AIX/tgcmprocbs_f90

Also rebuilt on bs at dres, and saved $TGCMROOT/bin.AIX/tgcmprocbs_dres_f90.

11/30/06:
Set up flat_censlt to place selected slt in center of longitude axis in
latitude slices. This is at Steve's request for vtgcm, but should work
with any history file.

Ray pointed out that ipltlon with amphase and ht-interp is seg-faulting on
double-res timegcm histories, e.g., timegcm1.3. I found that adding a write
statement just before the getampha call (mklons.F line 1446) alleviated the
problem for now, but it should be looked at more later.

Rewrote tgcmproc_f90 and tgcmproc_dres_f90 in $TGCMROOT/bin.AIX on bluevista.

12/7/06:
Above problem w/ amphase with dres histories (e.g. timegcm1.3) was fixed
by changing dimension of work array W in sub mkampha in mklons.F, from
w(200) to w(2*nlon+nlon/2+15), as per rfft.F doc for sub RFFTI.

Also got tgcmproc_f90 to build on oreo and callisto by changing LIBS in
Makefile, and Vic linked libXext on oreo.

1/16/07: Changed lib32 to lib64 in AIX section of Makefile for -lmss lib.

1/17/07: In mklons.F, where zm zsli is saved, had to transfer f(ixz)%data(:,j,k)
to fislice(nlon) before calculating zm with function fmean, because passing 
f(ixz)%data(:,j,k) directly to fmean no longer works. 

1/19/07: Showed above problem to Sidd. He was able to reproduce the error, and
has submitted a bug report to IBM compilers.  In the meantime, I have changed
all fmean and fglbm calls by using "1" instead of ":" when passing the input
array, whenever it is a pointer, e.g.:

      zsli(j,k) = fmean(f(ixz)%data(:,j,k),nlon,spval,0) is changed to
      zsli(j,k) = fmean(f(ixz)%data(1,j,k),nlon,spval,0)

and, for global mean function fglbm, e.g.:

            utvdat(itime,k,iloc,ixz_utvdat) = 
     +        fglbm(f(ixz)%data(:,:,k),nlon,nlat,gcmlat,dlat,
     +        dlon,spval)

is changed to:

            utvdat(itime,k,iloc,ixz_utvdat) = 
     +        fglbm(f(ixz)%data(1,1,k),nlon,nlat,gcmlat,dlat,
     +        dlon,spval)

Made this change to all calls to fmean and fglbm. This was in several files.

1/23/07: Changed line length in rmcomments from 120 to 6400.

2/15/07 btf: New CVS mtgcm no longer requires ut rotation. Commented out
  rotation in sub setmtgcm (getflds.F).  This will incorrectly not rotate 
  old mtgcm16 histories, but for now Steve Bougher can use his old processor
  to read his old histories. If necessary later, we could rotate conditionally,
  based on the model version global attribute on the histories (e.g., rotate
  only for mtgcm15 or mtgcm16 histories).

2/23/07:
Preparing to commit changes that have been made in working dir since the last 
commit on 4/25/06 (the code was tagged as tgcmproc1-9 at that time). This will
be tagged as tgcmproc2-0, and source saved on $TGCMROOT/tgcmproc2.0_f90. 
(have set proc_version = 2.0 in proc.F).

3/7/07:
If old mtgcm15 or mtgcm16 histories are read, then rotate ut by 12 hours, 
see sub setmtgcm in getflds.F. Did cvs commit.

3/8/07:
Add conditional on h%isnew in sub setflev (getflds.F) to force fields on "old" 
history files (e.g., mtgcm15,16) to be on INTERFACES (f(ix)%zptype) by default
(i.e., when grid_levels is not provided, or is HISTORY or HISTORY+TUV).
The user can still request an override, e.g., INTERFACES or MIDPOINTS.

3/9/07:
Doing commit and retag tgcmproc2-0, for 3/8 change above.

But after doing this commit, I realize that this fix will change results for
certain fields from "old" history format files, because where they were
formerly (incorrectly) plotted on midpoints (e.g., most species densities), 
they are now plotted on interfaces. This could cause problems for people who need
to reproduce results exactly from "old" formatted files. So, I am rebuilding
w/o the 3/8/07 fix to sub setflev, and retagging as tgcmproc2-0. Then I will
make the change, recommit, and save new tag tgcmproc2-1.

5/31/07:
Added sub interp_lonslice to mkutlat to interpolate to exact longitude.
This was requested by Gang, esp for when an slt is specified. This cleared
up jagged lines she was getting when plotting at short time intervals.

6/11/07:
Gang was getting seg fault when trying to write difference fields to
netcdf output file, with cdf_zprange=-3.,7. It was seg faulting on both
AIX and Linux, albeit in slightly different places. Finally tracked this
down to allocate of fdiffs in mkcdf.F (see "allocate fdiffs"), where it
was being allocated only at the cdf_zprange dimension, whereas mkdiffs
was outputting it with fdata-fcdata, where these were dimensioned the
full npress.  Changing the allocation of fdiffs to npress solved this
problem under AIX (blueice), HOWEVER, it still seg faults under hao Linux (oreo).

6/26/07:
There is a problem w/ setting zptype in sub setflev and/or sub set_zptype
(getflds.F). See bl:/ptmp/foster/ganglu-mkcdf (see also tgcmproc_f90 in this dir).
This was a difference fields run, and in the second read, set_zptype was
trying to switch zplev in which zplev_req was corrupted. Did not find out
why, but the problem fixed itself after adding grid_levels='INTERFACES' in
the namelist read file. At least now Gang can get her work done, but this
should be checked out..

7/07: Have been trying to validate and debug on hao linux machines. Fixed
mke5577 call (mkderived.F) to avoid passing 0 index to fields, even if they
are not used in sub mke5577 because hao linux was seg faulting on the call. 

7/16/07: Added flnm_cdf_xyut to namelist input so jobs saving xyut nc files
can be run simultaeneously w/ different file names (e.g., Joei processor,
see proc.xxx.job under /home/foster/usr/mendillo.

7/24/07: Downloaded precompiled netcdf-3.6.2 for hao linux to avoid
  "File too large" error from 3.6.0 for files larger than 2 GB. The new 
  lib is temporarilly in /oreo/d/foster/netcdf-3.6.2. At some point it
  will be copied to /opt/local/lib.  See the Makefile under hao linux section.

8/3/07:
Added utlat_latminmax(2) to namelist read (see input.F and mkutlat.F). These
are min,max latitudes to plot on y-axis for utlat contours. Saved tgcmproc_f90new
and tgcmproc_dres_f90new in $TGCMROOT/bin.AIX for IBMs.  Also a fix to interp_lon 
call for Z in mkutlat.F.  Saved source as 
/oreo/d/foster/tgcmproc_f90/tgcmproc_f90_utlatminmax.tar

Under hao linux (pgf90), however, this code is still having deallocation 
problems in pointers (e.g., associated func returns true, but subsequent
deallocation gets an error). This problem does not occur on the IBMs.

Adding nullify(f%lev) at end of sub fldinit (fields.F) helped the above
situation considerably: f%lev was left undefined if it is not available
on the history and not an underived field, which caused problems later
when associated func was called to test the pointer.

8/7/07: Adding lonslice time-averaging for ht-only fields, see mklons.F.
(search for "adding timeave"). Rewrote tgcmproc_f90new on bin.AIX.

8/9/07: Added global mean line plots of time-averaged longitude slices, 
see sub timeav_glbm in mklons.F.

8/9/07: Now initializing pointers to NULL, e.g.: 
     real,pointer :: p(:)=>NULL()
This can also be done in type definitions, see mklons, mklats, mkmaps, etc.
Several files modified for this. It is important that pointers are
not left undefined, because the "associated" inquiry function does
not work on an undefined pointer (this esp causes problems under Linux,
but was not a problem under AIX). See also 8/3 comment above.

8/9/07:
Updated tgcmproc_f90new to bin.AIX and bin.Linux.

8/17/07:
Added sub deallocfdat in tgcmproc.F to deallocate f(i)%data at end
of time loop. This prevents memory from accumulating during the run.

8/30/07: Added checks on xyut%cnames prior to calling pltxmy from pltxyut
(mkxyut.F) to avoid seg fault if cnames pointer is not associated.   
Also set multiy==0 if xyut%nycurve==1. 

9/13/07: Updated the double-res processor $TGCMROOT/bin.AIX/tgcmproc_dres_f90new 
on blueice with the above checks on xyut.

10/4/07: Gang has corrected ion drift velocities wrt the ionvel options.
She also added ionvel=5 for an option of WI. See mkdrifts.F. I've added
a few more related mods, e.g., deallocations, and additional dependencies
in fset_known.F.

10/10/07: Updated tgcmproc_dres_f90new at hao $TGCMROOT/bin.Linux, after
rebuilding on oreo in /oreo/d/foster/tgcmproc_f90/tgcmproc_f90. This apparently
solved problem Hanli was having reading double-res timegcm histories and saving
cdf output.

Fixed call to wrcdf_xyut from wrout_xyut in mkxyut.F to work when flnm_cdf_xyut
is set and sendcdf_xyut is not set (see conditional near beginning of
sub wrout_xyut).

In mkutvert.F, added vtype to conditional at top of fields_loop to prevent
attempt to plot ht-independent fof2 and hmf2. 

Updated binaries tgcmproc_f90new and tgcmproc_dres_f90new in $TGCMROOT/bin.Linux 
(hao), and $TGCMROOT/bin.AIX (IBM's).

10/11/07:
Bunny has updated the netcdf lib from 3.6.0 to 3.6.2. The latter has large file
support. I had downloaded 3.6.2 myself to /oreo/d in July (see above), but this
has been removed, and the Makefile uses 3.6.2 is in /opt/local/lib

Increased mxtms from 5000 to 10000 in proc.F (and in proc.sres and proc.dres).
This is so a full year of hourly histories can be processed (8761 times).

10/15/07:
Added several namelist read files for testing purposes, see scripts/testsuite.

!-----------------------------------------------------------------------

10/16/07:
Am now preparing for cvs commit and release of tgcmproc2.2_f90. This will be
cvs tag tgcmproc2-2

10/16/07: 
Did cvs commit of tgcmproc2.2_f90, cvs tag tgcmproc2-2.
Saved source in $TGCMROOT/tgcmproc2.2_f90 at both hao and scd. 
The executables tgcmproc2.2_f90 and tgcmproc2.2_dres_f90 were put
in $TGCMROOT (in bin.Linux for hao Linux, bin.AIX for scd AIX bluevista
and blueice, and bin.IRIX64 for scd IRIX tempest). These were linked to 
tgcmproc_f90 and tgcmproc_dres_f90 respectively.  For some time, the 
binaries tgcmproc_f90new and tgcmproc_dres_f90new were available for 
testing. These are now short csh scripts that echo a message saying 
to use tgcmproc_f90 and tgcmproc_dres_f90 commands instead. Sent
message to tgcmgroup.

11/16/07:
Added global interpolation of zp fields to hmf2 heights in maps.
This takes effect if user has ipltmaps=1 and fmap_zpht='hmf2',
i.e., 'hmf2' is included in fmap_zpht list. See mkmaps.F and
fixnamelist.F.

11/29/07:
Fixed wrdat so that flnm_dat will be overwritten if it pre-exists.
Moved open of flnm_dat to input.F, and the close is in tgcmproc.F.
Now sub wrdat only writes to the file (does not open or close).
Removed the iwrdat=2 option (append to flnm_dat). Now iwrdat is
either 0 (no action) or 1 (write). The call to wrdat was not changed.
Changes to input.F, tgcmproc.F, and util.F. Updating binaries at
hao and scd.

1/4/08:
Use vols(iv) for both vols and dskfile in call to nc_rdhist (gethist.F),
for diffs case (wrong file name was being printed in diffs case) 
          call nc_rdhist(ncid(luin),vols(iv),vols(iv),mtime,itime,
     |      h,ier,iprintnewvol)

Also increased length of blabs,tlabs in mklats.F.

1/21/08:
Now defining global 3d geopotential z_ifaces at interfaces and
z_midpts at midpoints (also zcntr_ifaces and zcntr_midpts) for
use throughout the processor consistently with the vertical coord
(interfaces or midpoints) of each field being processed. The global
geopotentials are calculated by sub mkgeopot (getflds.F), which is
called after f(ixz) has been processed. Am now using these in mkmaps,
but not yet in vertical slices or line plots.

2/12/08:
Added interpolation/extrapolation from midpoints to interfaces
on a per field basis as needed. See select case statement in sub 
set_zptype (getflds.F).

2/14/08: Changed some vtgcm parameters as per Bougher's correspondence,
         see comments in proclat:
proclat.F:! 2/14/08 btf: change lower bound of venus Z as per Bougher:
proclat.F:! 2/14/08 btf: changed cmbot_vtgcm (zcmbot) and g0 as per Bougher
proclat.F:! 2/14/08 btf: change g0 as per Bougher:
proclat.F:! 2/14/08 btf: change co1,cco according to correspondence from Bougher

2/26/08: Built tgcmproc_f90 on DASG machine "gale". The compiler is ifort.
Added a new section in Makefile based on the name "gale", but need something
more generic to distinguish different Linux machines such as lightning,
gale (and other DASG machines), and hao linux systems. Also, conditional
clause "else ifeq(..)" is not working as it should according to online gnu
docs. Have asked Sid about this and he is working on it. In the meantime,
the code did build on gale, albeit w/ several warnings, notes about vectorization,
etc. The compiler is slow, but execution is fast. Put executable in $TGCMROOT/bin.Linux,
where $TGCMROOT is /hao/tgcm/tgcm. Also put tgcmproc_dres_f90 on bin.Linux.

4/8/08:
Removed interpolation to midpoints/interfaces of several fields in proclat.F, 
because this is done in set_zptype (called from getflds -- in previous version
of getflds, the set_zptype call was commented out, not sure why). 

vtgcm: In the "old" vtgcm history case, vtgcm_n2 was read from an external
file, whereas in "new" vtgcm history, it is read from the source history.
Fixed this so vtgcm_n2 is used only in the old history case (code was seg-faulting
on Amanda Brecht).

Added NMF2 derived field for Ray, even tho it should be the same as when global
maps of NE are requested at HMF2 heights.

Saving executable as tgcmproc_f90test for now.

4/23-24/08: 
Realized that in mkderived.F, derived field WN (new histories) was using
Z that had already been converted from cm to km to calc vertical velocity
from OMEGA, so WN magnitudes were too small. Added local var zcm(kmx) for 
use in calc scale ht pzps, which is multiplied by omega to get WN. This 
bug was reported by Ray.

Increased work array space in plt module (plt.F), lrwrk,liama, etc.
This was prompted by area map overflows when plotting WN at bottom
boundary from a double-res ECMWF timegcm run.

Added initial value for flnm_cdf_xyut = "xyut.nc" in input.F. This was
pointed out by Joe.

4/24/08:
Now preparing for release of tgcmproc2.3_f90. This will be cvs tag
tgcmproc2-3.

!-----------------------------------------------------------------------

4/30/08:
Restore 2/14/08 changes to vtgcm lbc in proclat.F, as per Steve Bougher.
Commit and retag tgcmproc2-3. Updated tgcmproc2.3_f90 and tgcmproc2.3_dres_f90
in $TGCMROOT executables at hao, and scd (including gale).

1/21/09:
Add logical istimeave to mklons module data, to let mklonlabs know
if current plot is time-averaged or not. If it is, the middle bottom label 
of lonslice contour indicates "TIME-AVERAGED FROM xxx to xxx (dt=xxx)". 
