
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.

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