program read_sst c c Sample program showing read statements used to read in MCSST data. c c The MCSST data is on a 1024 X 512 element grid with the origin at c 90N latitude and 0 degrees longitude. There are 12 monthly data c files for 1989. Note that the 12 months do not entirely correspond c to calender months. The days over which the data was collected are c stored in the files. c c integer*2 sst(1024,512) ! SST data in 1/10s degree C ! -9999 indicates land ! 9999 indicates no data integer*2 yr,mon ! year and month of data integer*2 smon,sday ! month and day of start of defined 'month' integer*2 emon,eday ! month and day of end of defined 'month' real j_to_lat, i_to_lon ! conversion functions integer lat_to_j, lon_to_i open(8,file='sst8901.dat',form='unformatted') read(8) yr,mon write(*,*) yr,mon ! Should be 89, 1 for first data file read(8) smon, sday, emon, eday write(*,*) smon,sday,emon,eday ! should have values of 1,5,1,31 ! for first data file. read(8) sst 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 512 grid cells over 180 degrees and c that latitude varies from -90 to 90. c real lat lat_to_j=int((90.-lat)*2.844444)+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 1024 grid cells over 360 c degrees and that longitude varies from 0 to 360. c real lon lon_to_i=int(lon*2.844444)+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 512 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.844444) 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 1024 grid c cells over 360 degrees and that longitude varies from 0 to 360. c integer i i_to_lon=(float(i)-.5)/2.844444 return end