SUBROUTINE XBTBIASant(itsprobe,temp,maxlevel,maxcalc, * numlevels,iyearx,levelmaxbias,depth,isoor,nsecond) C XBTBIASANT CORRECTS XBT BIAS BASED ON INFORMATION FROM C ANTONOV. THE CORRECTIONS ARE ON STANDARD LEVELS c levelmaxbias is the maximum standard level at which c bias correction should be applied. levelmaxbias c should correspond to 1000. meters depth parameter (maxyear=3000,maxset=137,maxlayer=137) character*4 cdepthset character*7 firsttime character*80 filename,infile dimension xbias(maxyear,maxset) dimension depth(maxlevel),temp(maxlevel,maxcalc) dimension xlayer(maxlayer,2) common /extra/ ir2,ireqsecond,ireqbio save firsttime save xbias,iyearmin,iyearmax,nlayers,xlayer if ( firsttime .ne. 'xbtbias' ) then firsttime = 'xbtbias' c set layers call setlayers(nlayers,xlayer,maxlayer) call clearstring(filename,80) call checkwhichdepthfile(cdepthset) if ( cdepthset .eq. 'orig' ) then call extraname('sys.inf'//CHAR(0), * 'antonov_xbtbias'//CHAR(0),filename) else open(9,file='other_xbtbias',status='old', * iostat=ios) if ( ios .ne. 0 ) then infile='antonov_xbtbias_'//cdepthset//CHAR(0) call extraname('sys.inf'//CHAR(0),infile,filename) else call clearstring(filename,80) read(9,'(a)') filename close(9) write(6,*) 'infile:',filename call addCend(filename,80,0) endif endif open(9,file=filename,status='old') xyear0=0.0 iyear=0 inumset=0 iyearmax=0.0 iyearmin=5000 do 55 n=1,maxyear read(9,*,end=44) xyear,xdep,xbias0,inum if ( xyear0 .ne. xyear ) then iyear=xyear if ( iyear .gt. iyearmax ) iyearmax=iyear if ( iyear .lt. iyearmin ) iyearmin=iyear xyear0=xyear inumset=0 endif inumset=inumset+1 if ( inum .ge. 30 ) then xbias(iyear,inumset)=xbias0 else xbias(iyear,inumset)=0.0 endif 55 continue 44 continue close(9) endif iyearb=iyearx if ( iyearx .lt. iyearmin ) iyearb=iyearmin if ( iyearx .gt. iyearmax ) iyearb=iyearmax if ( itsprobe .eq. 2 ) then do 60 n0=1,numlevels if ( isoor .eq. 1 ) then n=n0 ic=n0 np=0 else if ( n0 .le. maxlevel ) then ic=n0 np=0 dpt=depth(n0) else call overmax(maxlevel,nsecond,n0,0,ic,np) dpt=temp(ic,np) endif n=0 do 65 n2=1,nlayers if ( dpt .ge. xlayer(n2,1) .and. * dpt .lt. xlayer(n2,2) ) then n=n2 endif 65 continue endif if ( n .eq. 0 .or. n .gt. levelmaxbias ) return temp(ic,np+1)=temp(ic,np+1)-xbias(iyearb,n) 60 continue endif return end