SUBROUTINE FILECONSTX( ik, nprb, nyc, nyc2, nt, csea, * statpath, nfile, nomal, nomaly, iylook, nsucy, sgrid, * ifive) C FILECONST CONSTRUCTS CONVENTIONAL FILE NAMES FROM INPUT C INFORMATION. c******************************************************** c c Conventional file name consists of: c c Directory pathname (statpath) + /grid size (sgrid)/ + c /field type (nt) (no field type for analyzed data)/ + c file name c c File name consists of: c one to three letter parameter code (mtype) + c one character probe codes of all probe types involved (tcar) or c zero if all probes which measure the parameter in question c are involved + c [ 'y' of 'm' if specific years or months only are involved] + c [ two digit beginning year or month (01 -99)] + c [ two digit ending year or month (01-99)] + c two digit time period (00 - 16): 00 is annual, 01 to 12 are c the months, 13-16 are the seasons + c [ an A if anomalies are being investigated] + c [ a Y, S, or M depending if yearly, seasonal, or monthly c analyses are being investigated ] c c [] brackets denote additions used only in the specific c special situation listed. c c******************************************************** c******************************************************** c c Passed Variables: c ik - parameter number c nprb - number of probes c nyc, nyc2 - starting and ending years (months) c nt - type of field: c 0 - unnamed (analyzed) c 1 - means c 2 - number of observations c 3 - standard deviations c 4 - standard error of the mean c 5 - observed minus annual c 6 - field minus annual c csea - character representation of time period c statpath - pathname to file c nfile - constructed file name c nomal - denotes anomaly value if set to one c nomaly -type of anomaly: c 0 - not an anomaly c 1 - yearly c 2 - seasonal c 3 - monthly c iylook - look at specific years if set to one c nsucy - successive year marker if set to one, c a shell is being run on successive years c sgrid - grid size c ifive - set to one if this is five-degree statistics c set to two if this is a standard deviation c analysis c c******************************************************* c******************************************************* c c Parameters: c c maxparm - maximum number of parameters in system c maxcalc - maximum number of measured and calculated c parameters in system c maxprobe - maximum number of probes in system c maxlevel - maximum number of levels c c****************************************************** parameter (maxparm=100, maxcalc=200, maxprobe=100) parameter (maxlevel=6000) c******************************************************* c c Character Variables: c c tcar - single character representation for probe type c The first 9 are the numbers one through nine. c The next 26 are the capital letters of the c alphabet c csea - character representation of the time period: c 00 - annual c 01-12 - months (Jan-Dec) c 13-16 - seasons (Winter-Fall) c 17-40 - semi- monthly c mtype - one to three character representation of the c parameter c sgrid - character representation of the grid size: c '1.00','0.50','0.25', etc. c outfile - constructed file name without directory path c c************************************************************* character*1 tcar(35) character*2 csea character*3 mtype character*4 sgrid character*80 statpath, outfile, nfile, cmixname data tcar/9*'0','A','B','C','D','E','F','G','H','I', * 'J','K','L','M','N','O','P','Q','R','S','T','U','V', * 'W','X','Y','Z'/ c************************************************************ c c Common Blocks: c parname1 - contains mtype, one to three letter c character codes c reqprobe - contains jp, probe type codes for requested c probes c totalparms - contains npatot, the number of probe types c which measure each parameter c c surrogate - contains isur, the surrogate for calculated c parameters. A surrogate is a measured parameter c whose record numbers are used to store the c data of the calculated parameter c c*********************************************************** common /parname1/ mtype(maxlevel) common /reqprobe/ jp(0:maxprobe) common /totalparms/ npatot(maxparm) common /surrogate/ isur(maxcalc) common /fracta/ numsuc,nsub common /geop/ igeot,jlev,dsurf c*********************************************************** c c Special common: c c pstcom - common to hold information for graphics file c c ipst - set to one if POST file requested c two if JPEG file requested c three if GIF file requested c -1 if a .dat file (data file) c kx - depth represented in graphic c c********************************************************** common /pstcom/ ipst,kx c********************************************************** c c Clear full file name c c********************************************************** call clearstring(nfile,80) c********************************************************** c c find length of input file pathname c c Set ntit to this length c c********************************************************** ntit=0 ntit2=0 do 901 n=1,80 901 if (statpath(n:n).eq.' '.and.ntit.eq.0) ntit = n - 1 c********************************************************** c c put grid spacing in filename c c ntit2 is the length of the file name without the c full directory path c c********************************************************** outfile(1:4) = sgrid outfile(5:5)='/' ntit2=5 c********************************************************** c c put file type in file name: c nt=1 for mean fields c nt=2 for data distributions c nt=3 for standard deviation fields c c********************************************************** if ( nt .eq. 2 ) then outfile(ntit2+1:ntit2+4) = 'num/' ntit2 = ntit2+4 elseif ( nt .eq. 1 .or. nt .eq. 5 .or. nt .eq. -2) then outfile(ntit2+1:ntit2+5) = 'mean/' ntit2 = ntit2+5 elseif (nt .eq. 3 .or. nt .eq. 4 ) then outfile(ntit2+1:ntit2+3) = 'sd/' ntit2= ntit2+3 endif c******************************************************** c c put one letter parameter abbreviation in file name c c******************************************************* if ( igeot .ne. 1 .and. igeot .ne. 2 ) then call findlastchar(ne,mtype(ik),3) outfile(ntit2+1:ntit2+ne) = mtype(ik)(1:ne) ntit2= ntit2+ne if ( igeot .eq. 3 ) then outfile(ntit2+1:ntit2+1) = 'g' ntit2=ntit2+1 endif elseif ( igeot .eq. 1 ) then outfile(ntit2+1:ntit2+1) = 'G' ntit2= ntit2+1 elseif ( igeot .eq. 2 ) then call mixedlayerchoice(ivar,xmixed,del0,del3, * cmixname,nspmix) outfile(ntit2+1:ntit2+nspmix)=cmixname(1:nspmix) ntit2=ntit2+nspmix endif c***************************************************** c c write in probe types c c If all probes which measure a parameter are involved, c place a zero '0' instead of the probe types c c Otherwise, place the one character code for each c involved probe type in the file name. c c***************************************************** if (nprb.ge.npatot(ik)) then outfile(ntit2+1:ntit2+1)='0' ntit2=ntit2+1 else do 86 n=1,nprb ntit2=ntit2+1 if (jp(n).lt.10) then write(outfile(ntit2:ntit2),'(i1)') jp(n) else outfile(ntit2:ntit2)=tcar(jp(n)) endif 86 continue endif c******************************************************* c c Designate reference level for density surface c c******************************************************* if ( igeot .eq. -1 ) then outfile(ntit2+1:ntit2+1)='d' ntit2=ntit2+1 if ( jlev .lt. 0 ) then outfile(ntit2+1:ntit2+6)='insitu' ntit2=ntit2+6 elseif ( jlev .lt. 1 ) then outfile(ntit2+1:ntit2+4)='surf' ntit2=ntit2+4 elseif ( jlev .lt. 1000 ) then write(outfile(ntit2+1:ntit2+3),'(i3)') jlev ntit2=ntit2+3 else write(outfile(ntit2+1:ntit2+4),'(i4)') jlev ntit2=ntit2+4 endif endif c******************************************************* c c put years or months in file name c c If this is a year or month specific file, place the c starting and ending year (or month) in the file name. c c******************************************************* if (iylook.gt.0.or.nsucy.gt.0) then if (iylook.eq.1.or.nsucy.eq.1) then outfile(ntit2+1:ntit2+1)='m' else outfile(ntit2+1:ntit2+1)='y' endif nycx=nyc if ( nyc .ge. 1900 ) nycx=nyc-1900 if (nycx.lt.10) then outfile(ntit2+2:ntit2+2)='0' write(outfile(ntit2+3:ntit2+3),'(i1)') nycx elseif ( nycx .lt. 100 ) then write(outfile(ntit2+2:ntit2+3),'(i2)') nycx elseif ( nycx .lt. 110 ) then outfile(ntit2+2:ntit2+2)='A' write(outfile(ntit2+3:ntit2+3),'(i1)') nycx-100 elseif ( nycx .lt. 120 ) then outfile(ntit2+2:ntit2+2)='B' write(outfile(ntit2+3:ntit2+3),'(i1)') nycx-110 endif nycx=nyc2 if ( nyc2 .ge. 1900 ) nycx=nyc2-1900 if (nycx.lt.10) then outfile(ntit2+4:ntit2+4)='0' write(outfile(ntit2+5:ntit2+5),'(i1)') nycx elseif ( nycx .lt. 100 ) then write(outfile(ntit2+4:ntit2+5),'(i2)') nycx elseif ( nycx .lt. 110 ) then outfile(ntit2+4:ntit2+4)='A' write(outfile(ntit2+5:ntit2+5),'(i1)') nycx-100 elseif ( nycx .lt. 120 ) then outfile(ntit2+4:ntit2+4)='B' write(outfile(ntit2+5:ntit2+5),'(i1)') nycx-110 endif ntit2 = ntit2 + 5 c Deal with fractions of year if ( numsuc .lt. 0 ) then nsuc1 = -numsuc*(nsub-1)+1 nsuc2 = -numsuc*nsub if ( nsuc1 .ge. 10 ) then write(outfile(ntit2+1:ntit2+2),'(i2)') nsuc1 ntit2=ntit2+2 else write(outfile(ntit2+1:ntit2+1),'(i1)') nsuc1 ntit2=ntit2+1 endif outfile(ntit2+1:ntit2+1)='-' ntit2=ntit2+1 if ( nsuc2 .ge. 10 ) then write(outfile(ntit2+1:ntit2+2),'(i2)') nsuc2 ntit2=ntit2+2 else write(outfile(ntit2+1:ntit2+1),'(i1)') nsuc2 ntit2=ntit2+1 endif endif endif c******************************************************* c c add time period to output file c c******************************************************* outfile(ntit2+1:ntit2+2)=csea ntit2=ntit2+2 c******************************************************* c c add A for anomalies c also add type of anomalies: c Y for yearly c S for seasonal c M for monthly c c******************************************************* if (nomal.gt.0) then outfile(ntit2+1:ntit2+1)='A' if (nomaly .eq. 1) then outfile(ntit2+2:ntit2+2)='Y' elseif (nomaly .eq. 2) then outfile(ntit2+2:ntit2+2)='S' else outfile(ntit2+2:ntit2+2)='M' endif ntit2=ntit2+2 endif c****************************************************** c c Set standard error of the mean (SE) or c difference between observed values and analyzed values (OA) c or field minus annual (MA) c c***************************************************** if ( nt .eq. 4 ) then outfile(ntit2+1:ntit2+2)='SE' ntit2=ntit2+2 elseif ( nt .eq. 5 ) then outfile(ntit2+1:ntit2+2)='OA' ntit2=ntit2+2 elseif ( nt .eq. 6 ) then outfile(ntit2+1:ntit2+2)='MA' ntit2=ntit2+2 elseif ( nt .eq. -1 .or. nt .eq. -2 .or. nt .eq. 7) then outfile(ntit2+1:ntit2+2)='AV' ntit2=ntit2+2 elseif ( nt .eq. -3 ) then outfile(ntit2+1:ntit2+2)='OI' ntit2=ntit2+2 endif c******************************************************* c c Graphics output file depth c c******************************************************* if ( ipst .gt. 0 ) then if ( kx .le. 9 ) then outfile(ntit2+1:ntit2+1)='0' write(outfile(ntit2+2:ntit2+2),'(i1)') kx else write(outfile(ntit2+1:ntit2+2),'(i2)') kx endif ntit2=ntit2+2 endif if ( ipst .ne. 0 .and. nt .eq. 1 ) then outfile(ntit2+1:ntit2+1)='N' endif c******************************************************* c c add .5 for five-grid square statistics c c******************************************************* if ( ifive .eq. 1 ) then outfile(ntit2+1:ntit2+2)='.5' ntit2=ntit2+2 elseif ( ifive .eq. 2 ) then outfile(ntit2+1:ntit2+3)='.sd' ntit2=ntit2+3 endif c******************************************************* c c Graphics output file type c c******************************************************* if ( ipst .eq. 1 ) then outfile(ntit2+1:ntit2+3)='.ps' ntit2=ntit2+3 elseif (ipst .eq. 2 ) then outfile(ntit2+1:ntit2+3)='.jp' ntit2=ntit2+3 elseif (ipst .eq. 3 ) then outfile(ntit2+1:ntit2+3)='.gf' ntit2=ntit2+3 elseif (ipst .eq. 4 ) then outfile(ntit2+1:ntit2+4)='.eps' ntit2=ntit2+4 endif c******************************************************* c c add pathname and file name together for full file name c c******************************************************* nfile=statpath(1:ntit)//'/'//outfile(1:ntit2) c******************************************************* c c Reinitialize outfile c c******************************************************* call clearstring(outfile,80) return end