c23456789012345678901234567890123456789012345678901234567890123456789012 implicit none integer ni,nj parameter(ni=361,nj=181) character*20 myLonStr, myLatStr integer iargc, i, j real lat(nj),lon(ni),val(ni,nj) real interp_lat, interp_lon, interp_val real dlat,dlon c c check the 2 input arugments for longitude and latitude c if (iargc() .ne. 2) then print *, 'Usage: nameOfExecutable interp_lon interp_lat' stop endif c c read the input arguments as strings c call getarg(1,myLonStr) call getarg(2,myLatStr) c c convert the strings to real numbers c read(myLonStr, *) interp_lon read(myLatStr, *) interp_lat c c define latitude and longitude grid in 0.5-deg spacing c dlat=0.5 dlon=0.5 do j=1,nj lat(j)=(j-1)*dlat enddo do i=1,ni lon(i)=(i-1)*dlon enddo c c define 2d value being interpolated c do j=1,nj do i=1,ni val(i,j)=(i-1)*(j-1) enddo enddo c c call the bilinear subroutine c call bilinear_sub(ni, nj, dlon, dlat, lon, lat, val, & interp_lon, interp_lat, interp_val) print*,'interpolated value from bilinear_sub = ', interp_val end