module m_bilin_ncep_gauss contains subroutine bilin_ncep_gauss(old,onx,ony,olon,olat,new,newlon,newlat) use mod_xc implicit none integer, intent(in) :: onx ! x-dimension of old field integer, intent(in) :: ony ! y-dimension of old field real, intent(in) :: old(onx,ony)! old grid real, intent(in) :: olon(onx)! old grid real, intent(in) :: olat(ony)! old grid real, intent(out) :: new (idm,jdm) ! New interpolated field real, intent(in) :: newlon(idm,jdm) ! Longitudes for new grid real, intent(in) :: newlat(idm,jdm) ! Latitudes for new grid integer i,j,ia,ib,ja,jb,ifalse,io,numerr,allerr integer ipos ! index of i-pivot grid point in old grid integer jpos ! index of j-pivot grid point in old grid real aa,bb,a1,a2,a3,a4,maxlat,lon,minlat,olonref,odlon,odlat character(len=2) tag2 real :: valvec(4),mskvec(4) integer :: nsea maxlat=maxval(olat) minlat=minval(olat) olonref= minval(olon) odlon = (olon(2)-olon(1)) numerr=0 ! Start interpolation do j=1,jdm do i=1,idm ipos=int((newlon(i,j)-olonref)/odlon+1.0) ! Substitute formula for "gaussian" grid here jpos=1 do io=ony,1,-1 if (olat(io)0) then if (mnproc==1) then write(lp,*) 'An error occured in bilin_ncep_gauss..' write(lp,'(a,i6,a)') 'An error occured in bilin_ncep_gauss..', allerr,'errors' call flush(lp) end if call xcstop('(m_bilin_ncep_gauss.F90)') stop '(m_bilin_ncep_gauss.F90)' end if end subroutine end module m_bilin_ncep_gauss