38 SUBROUTINE remap_coef( is, ie, js, je,&
39 im, jm, lon, lat, id1, id2, jdc, s2c, agrid )
42 integer,
intent(in):: is, ie, js, je
43 integer,
intent(in):: im, jm
44 real,
intent(in):: lon(im), lat(jm)
45 real,
intent(out):: s2c(is:ie,js:je,4)
46 integer,
intent(out),
dimension(is:ie,js:je):: id1, id2, jdc
47 real,
intent(in):: agrid(is:ie,js:je,2)
52 real,
parameter :: pi = 3.1415926
53 integer i,j, i1, i2, jc, i0, j0
55 rdlon(i) = 1. / (lon(i+1) - lon(i))
57 rdlon(im) = 1. / (lon(1) + 2.*pi - lon(im))
60 rdlat(j) = 1. / (lat(j+1) - lat(j))
68 if ( agrid(i,j,1)>lon(im) )
then 70 a1 = (agrid(i,j,1)-lon(im)) * rdlon(im)
71 elseif ( agrid(i,j,1)<lon(1) )
then 73 a1 = (agrid(i,j,1)+2.*pi-lon(im)) * rdlon(im)
76 if ( agrid(i,j,1)>=lon(i0) .and. agrid(i,j,1)<=lon(i0+1) )
then 78 a1 = (agrid(i,j,1)-lon(i1)) * rdlon(i0)
85 if ( agrid(i,j,2)<lat(1) )
then 88 elseif ( agrid(i,j,2)>lat(jm) )
then 93 if ( agrid(i,j,2)>=lat(j0) .and. agrid(i,j,2)<=lat(j0+1) )
then 95 b1 = (agrid(i,j,2)-lat(jc)) * rdlat(jc)
102 if ( a1<0.0 .or. a1>1.0 .or. b1<0.0 .or. b1>1.0 )
then 103 write(*,*)
'gid=', i,j,a1, b1
106 s2c(i,j,1) = (1.-a1) * (1.-b1)
107 s2c(i,j,2) = a1 * (1.-b1)
109 s2c(i,j,4) = (1.-a1) * b1
116 END SUBROUTINE remap_coef
Module containing utility routines.