PROGRAM ANALYSIS c------------------------------------------------------------------------------ c c . INSTRUCTIONS FOR READING MEAN PARAMETER DATA c . ON A LATITUDE-LONGITUDE GRID c c . Ocean Climate Laboratory c . National Oceanographic Data Center c c------------------------------------------------------------------------------ c c . FORMAT FOR READING DATA c c------------------------------------------------------------------------------ c c Program will print a five grid square radius box (an 11x11 grid square) c based of user specified longitude, latitude, and depth level. The c latitude and longitude entered will be the center grid point in the box. c This program works for one-degree and five-degree data c c Parameter descriptions c . idim=longitude c . jdim=latitude c . kdim=standard depth levels c c 33 Standard level depths (in meters): c c 0,10,20,30,50,75,100,125,150,200,250,300,400,500,600,700,800,900,1000, c 1100,1200,1300,1400,1500,1750,2000,2500,3000,3500,4000,4500,5000,5500 c c Annual and seasonal analyzed fields contain 33 levels (0-5500 m) c Monthly analyzed fields contain 24 levels (0-1500 m) c c Units: degrees celsius for temperature (temperature is IN-SITU temp!) c practical salinity scale for salinity c milliliters/liter for oxygen c micromoles per liter for nutrients c micrograms per liter for chlorophyll c c Land value= -99.9999 for f8.4 read files c = -100. for f8.0 read files c c------------------------------------------------------------------------------ parameter (idim=360, jdim=180, kdim=33) character*70 filename real data(idim,jdim) c Read input data file from screen write(6,*)' ' write(6,*)'-----------------------------' write(6,*)' WOA Example Program ' write(6,*)'-----------------------------' write(6,*)' ' write(6,*)' This program will print out a single 10x10 degree' write(6,*)' grid box of WOA data values from a specified' write(6,*)' WOA data file. The box is drawn centered ' write(6,*)' around a user-specified latitude and longitude,' write(6,*)' for a user-specified depth level.' write(6,*)' ' write(6,*) *'Please input the WOA data file name (e.g. t00an1)' read(5,'(a70)')filename c Check to see if file is still "gzip" compressed (*.gz) iGZflag = 0 do iGZlp = 1,70 if ( * (filename(iGZlp:iGZlp+2) .eq. ".gz") .or. * (filename(iGZlp:iGZlp+2) .eq. ".GZ") * ) then iGZflag = 1 exit !- exit this loop elseif (filename(iGZlp:iGZlp) .eq. " ") then exit !- exit this loop endif enddo if (iGZflag .gt. 0) then write(6,*)' ' write(6,*) *'-------------------------------------------------------' write(6,*)' ' write(6,*) *'This data file still has the ".gz" extension.' write(6,*) *'This indicates that the data file is still compressed.' write(6,*)' ' write(6,*) *'The data file must be uncompressed for this program.' write(6,*)' ' write(6,*) *'-------------------------------------------------------' stop endif write(6,*)' ' write(6,*)'Enter file type: ' write(6,*)' ' write(6,*)' 0: analyzed field (an1,_obj)' write(6,*) * ' 1: points within radius of influence field (gp1,_pts)' write(6,*)' 2: data distribution (dd1,dd5)' write(6,*)' 3: raw (unanalyzed) mean fields (mn1,mn5)' write(6,*)' 4: standard deviation field (sd1,sd5)' write(6,*)' 5: standard error of the mean field (se1,se5)' write(6,*)' 6: minus annual field (ma1)' write(6,*)' 7: observed minus annual field (oa1)' write(6,*)' 8: basin mask or landsea mask (msk)' write(6,*)' ' read(5,*)ifield c Fields 2, 3, 4 & 5 can be one-degree or five-degree files c Fields 1, 2 & 8 values are stored as f8.0, land=-100. (if applicable) c Fields 0,3,4,5,6, & 7 are stored as f8.4, land=-99.9999 if ( ifield .ge. 2 .and. ifield .le. 5) then write(6,*) *'Enter (1) for one-degree grid, (5) for five-degree grid' read(5,*) ispace else ispace=1 endif if ( ispace .eq. 5 ) then idimx=idim/5 jdimx=jdim/5 space=5. else idimx=idim jdimx=jdim space=1. endif if ( ifield .eq. 1 .or. ifield .eq. 2 * .or. ifield .eq. 8 ) then itype=0 else itype=1 endif write(6,*) 'Depth Level (1-33) ?' read(5,*) kx write(6,*)'Enter latitude center for area to print (-90 to 90)' read(5,*)rlat write(6,*)'Enter longitude center for area to print (-180 to 180)' read(5,*)rlon c Call grid to calculate grid numbers from latitude and longitude c 1-degree: -180 - 180 >> 1 to 360 and -90 - 90 >> 1 - 180 c 5-degree: -180 - 180 >> 1 to 72 and -90 - 90 >> 1 - 36 call grid(rlat,rlon,lat1,lon1,space) write(6,*)' ' write(6,*)' Longitude: ',rlon,' equals grid: ',lon1 write(6,*)' Latitude: ',rlat,' equals grid: ',lat1 write(6,*)' ' c Read in data open(2,file=filename,status='old',form='formatted') c IF UNABLE TO OPEN CD-ROM DATA, INCLUDE 'readonly' IN THE OPEN STATEMENT write(6,'(/)') write(6,*)'Reading data ...' do 15 k=1,kx if (itype .eq. 1)then read(2,100,end=16) ((data(i,j),i=1,idimx),j=1,jdimx) else read(2,200,end=16) ((data(i,j),i=1,idimx),j=1,jdimx) endif 15 continue goto 17 c End-of-file Handling 16 write(6,*)' ' write(6,*)' ' if (k-1 .gt. 0) then write(6,*)'An End-Of-File was reached after depth level = ',k-1 write(6,*)' ' write(6,*)' (See documentation for maximum data depths.)' else write(6,*)'An error occured when trying to acces the file.' write(6,*)' ' write(6,*)' Make sure file types (e.g., dd, mn, sd, oa, an)' write(6,*)' and grid sizes (1 or 5) match the menu choice.' endif write(6,*)' ' stop c Display area in question 17 jstart = lat1-4 jend = lat1+5 istart1 = lon1-4 iend1 = lon1+5 write(6,'(/,a34,1x,i2)') ' Values for depth level', kx write(6,*)' ' if ( iend1.lt.istart1) then write(6,800) 'GRID ', * (i,i=istart1,idimx),(i2,i2=1,iend1) write(6,*)' ' do 700 j=jend,jstart,-1 do iMlp = istart1,idimx !- turn any "-99.9999" to "-99.9990" if (data(iMlp,j) .lt. -99.) data(iMlp,j) = -99.9990 enddo !- iMlp write(6,801) j,(data(i,j),i=istart1,idimx), * (data(i2,j),i2=1,iend1) 700 continue else write(6,800) ' GRID ',(i,i=istart1,iend1) write(6,*)' ' do 701 j=jend,jstart,-1 do iMlp = istart1,iend1 !- turn any "-99.9999" to "-99.9990" if (data(iMlp,j) .lt. -99.) data(iMlp,j) = -99.9990 enddo !- iMlp write(6,801) j,(data(i,j),i=istart1,iend1) 701 continue write(6,*)' ' 800 format(a8,10(i8)) 801 format(1x,i4,3x,10(f8.3)) endif 100 format(10f8.4) 200 format(10f8.0) close(2) stop end c--------------------------------------------------------------------------- c--------------------------------------------------------------------------- c--------------------------------------------------------------------------- SUBROUTINE GRID(rlat,rlon,lat,lon,space) C CALCULATES GRID NUMBERS FROM INPUT LATITUDE AND LONGITUDE c------------------------------------------------------------ c c Passed Variables: c c rlat,rlon - actual latitude and longitude c lat,lon - calculated grid box numbers c space - grid spacing (1.0 is a 1 degree latitude c by one degree longitude grid box) c c--------------------------------------------------------- c--------------------------------------------------------- c c Calculate latitude grid number: c c 1. add 90 to actual latitude, since actual latitudes c run from -90 to 90, and grid numbers run from c 1 to 180. c c 2. Divide by spacing. The additional 1E-6 is to c insure that any latitude right on the line between c two grid boxes will be included in the smaller c number grid box. c c 3. Add one, since a grid number for actual latitude c -90 would be 0 otherwise. c c--------------------------------------------------------- lat=int((rlat+90.)/(space+1.E-7))+1 c--------------------------------------------------------- c c Calculate longitude grid number c c 1. Longitude grid numbers run from 1 to 360 while c actual longitudes run from -180 to 180. The difference c from latitude is that negative values are converted c to the larger end of longitude grid numbers. c They are converted to the values 181 to 360. c c--------------------------------------------------------- if (rlon.le.0) then lon=int((rlon+360.)/(space+1.E-7))+1 else lon=int(rlon/(space+1.E-7))+1 endif return end