program test_ofc

! Author: Hans-Peter Plag, 20 March 2006
!
! This program is used to test the routine ocean_function. The program creates
! a file with an ocean function of resolution degree_step. For a resolution
! of 2.5 degrees, this function should be identical
! (except for the header) to the file OF_2_5d2_5d_V1_0.dat
!
real degree_step
integer nx,ny
parameter (degree_step=2.5,nx=360.00001/degree_step,ny=180.00001/degree_step)
integer ocean_function,record(nx)
real y
integer i,j
character*10 form

write (form,1000) nx
1000 format ('(',i4,'I1)')

open (unit=1,file='test_ofc.dat',status='unknown')
y=90-degree_step/2.
do j=ny,1,-1
   do i=1,nx
      record(i) = ocean_function(degree_step/2.+float(i-1)*degree_step,y,degree_step,degree_step)
   end do
   write (1,form) record
   print form,record
   y = y - degree_step
end do
print *,'Oceanfunction write with grid size = ',nx,ny
end
