10 real(8),
parameter :: re=6378.137d3
11 real(8),
parameter :: rp=6356.752d3
12 real(8),
parameter :: ffac=(rp/re)*(rp/re)
14 integer(4),
parameter :: nlat=2160, nlon=4320
16 character(1),
intent(in) :: char_ice(nlon,nlat)
17 real(4),
intent(out) :: frac_ice_smoothed(720,360)
20 integer(4) ilat,ilon,jlat,jlon,klat,klon,kklon
22 real(4) xlat,xlatg,xlon
23 real(4) sinlat0,coslat0
24 real(4) cel0(3),dif(3),rsq,rsq_max,wt
26 real(4) coslat(nlat),cel(3,nlon,nlat)
27 integer(4) nstep(nlat)
29 real(4) frac_ice(nlon,nlat), dummy_lat(nlon)
32 real(4) cosd, sind, tand
40 rsq_max=(2*sind(0.5*0.45d0))**2
43 xlat=(ilat-1)/12.-89.95833
44 xlatg=datand(ffac*tand(xlat))
50 nstep(ilat)=nint(6./coslat0) + 1
51 if(nstep(ilat).ge.nlon/2) nstep(ilat)=nlon/2 -1
52 if(ilat.le.12 .or.ilat.ge.nlat-11) nstep(ilat)=nlon/2 -1
55 xlon=(ilon-1)/12.+ 0.04167
56 cel(1,ilon,ilat)=cosd(xlon)*coslat0
57 cel(2,ilon,ilat)=sind(xlon)*coslat0
58 cel(3,ilon,ilat)=sinlat0
63 frac_ice=ichar(char_ice)*0.01
69 xlat=(ilat-1)/12.-89.95833
70 xlatg=datand(ffac*tand(xlat))
78 xlon=(ilon-1)/12.+ 0.04167
80 cel0(1)=cosd(xlon)*coslat0
81 cel0(2)=sind(xlon)*coslat0
87 if(klat.lt.1 .or. klat.gt.nlat) cycle
90 do klon=ilon-nstep(klat),ilon+nstep(klat)+1
92 if(kklon.lt. 1) kklon=kklon+nlon
93 if(kklon.gt.nlon) kklon=kklon-nlon
95 dif=cel(:,kklon,klat)-cel0
97 rsq=dif(1)*dif(1) + dif(2)*dif(2) + dif(3)*dif(3)
99 if(rsq.gt.rsq_max) cycle
102 tsum(1)=tsum(1) + wt*frac_ice(kklon,klat)
107 jlat=1 + int(2*(xlat+90))
109 if(jlat.lt.1 .or. jlat.gt.360) stop
'error1'
110 if(jlon.lt.1 .or. jlon.gt.720) stop
'error2'
112 frac_ice_smoothed(jlon,jlat)=tsum(1)/tsum(0)
117 if(minval(frac_ice_smoothed).lt.0 .or. minval(frac_ice_smoothed).gt.
'frac_ice_smooth oob, pgm stopped'