program read_ssh c c Sample program showing read statements used to read in Topex data. c c The Topex data is on a 540 X 270 element grid with the origin at c 90N latitude and 0 degrees longitude. There are 12 monthly data c files for 1993 c c real*4 ssh(540,270) ! Topex data in cm. ! -9999 indicates land ! 9999 indicates no data integer*2 iyr,imon ! year and month of data set real j_to_lat, i_to_lon ! conversion functions integer lat_to_j, lon_to_i open(8,file='ssh9301.dat',form='unformatted') read(8) iyr,imon write(*,*) iyr,imon ! should be 93 and 1 for first Topex file read(8) ssh close(8) stop end c c c The following four functions can be used convert grid <----> lat/lon. c c integer function lat_to_j(lat) c c Function takes a latitude and returns the index of the grid row that c latitude falls in. NOTE: assumes 270 grid cells over 180 degrees and c that latitude varies from -90 to 90. c real lat lat_to_j=int((90.-lat)*3.0/2.0)+1 return end integer function lon_to_i(lon) c c Function takes a longitude and returns the index of the grid column c that the longitude falls in. NOTE: assumes 540 grid cells over 360 c degrees and that longitude varies from 0 to 360. c real lon lon_to_i=int(lon*3.0/2.0)+1 return end real function j_to_lat(j) c c Function takes the index of a grid row and returns the latitude of the c center of the grid cells in that row. NOTE: assumes 270 grid cells c over 180 degrees and that latitude varies from -90 to 90. c integer j j_to_lat=90.-((float(j)-.5)*2.0/3.0) return end real function i_to_lon(i) c c Function takes the index of a grid column and returns the longitude of c the center of the grid cells in that column. NOTE: assumes 1080 grid c cells over 360 degrees and that longitude varies from 0 to 360. c integer i i_to_lon=(float(i)-.5)*2.0/3.0 return end