7 PXOUT,PYOUT,OINTERP,OGLOBLON,OGLOBN,OGLOBS,&
8 KO,KINLO_OUT,POLA,POLO,PILO1_OUT,&
9 PILO2_OUT,PLA,PILATARRAY )
114 REAL,
INTENT(IN) :: PILA1
115 REAL,
INTENT(IN) :: PILO1
116 REAL,
INTENT(IN) :: PILA2
117 REAL,
INTENT(IN) :: PILO2
118 INTEGER,
INTENT(IN) :: KINLA
119 INTEGER,
DIMENSION(:),
INTENT(IN) :: KINLO
120 INTEGER,
INTENT(IN) :: KOLEN
121 REAL,
DIMENSION(:),
INTENT(IN) :: PXOUT
122 REAL,
DIMENSION(:),
INTENT(IN) :: PYOUT
123 LOGICAL,
DIMENSION(:),
INTENT(IN) :: OINTERP
125 LOGICAL,
INTENT(OUT) :: OGLOBLON
126 LOGICAL,
INTENT(OUT) :: OGLOBN
127 LOGICAL,
INTENT(OUT) :: OGLOBS
129 INTEGER,
DIMENSION(:,:),
INTENT(OUT) :: KO
130 INTEGER,
DIMENSION(:),
INTENT(OUT) :: KINLO_OUT
131 REAL,
INTENT(OUT) :: PILO1_OUT
132 REAL,
INTENT(OUT) :: PILO2_OUT
134 REAL,
DIMENSION(:),
INTENT(OUT) :: POLA
135 REAL,
DIMENSION(:),
INTENT(OUT) :: POLO
137 REAL,
DIMENSION(:,:),
INTENT(OUT) :: PLA
138 REAL,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: PILATARRAY
142 REAL,
DIMENSION(:),
ALLOCATABLE :: ZIDLAT
155 REAL(KIND=JPRB) :: ZHOOK_HANDLE
161 IF (
lhook)
CALL dr_hook(
'HORIBL_SURF_INIT',0,zhook_handle)
183 IF (pilo2_out < 0.) pilo2_out = pilo2_out + 360.
184 IF (pilo1_out < 0.) pilo1_out = pilo1_out + 360.
185 IF (pilo2_out < pilo1_out) pilo1_out = pilo1_out - 360.
206 jopos = maxval(kinlo(1:kinla))
207 pilo2_out = pilo1_out + (pilo2_out - pilo1_out) * jopos / (jopos - 1.)
215 IF (pilo2_out-360.>pilo1_out-1.e-3) ogloblon = .true.
216 zidla = (pila2 - pila1) / (kinla - 1)
217 IF (
PRESENT(pilatarray))
THEN 218 ALLOCATE(zidlat(kinla+1))
220 zidlat(jl) = pilatarray(jl)-pilatarray(jl-1)
223 zidlat(kinla+1) = zidlat(kinla)
225 IF ((pila1-zidla>= 90.) .OR. (pila1-zidla<=-90.)) oglobs=ogloblon
226 IF ((pila2+zidla>= 90.) .OR. (pila2+zidla<=-90.)) oglobn=ogloblon
228 IF ( pila2 > 100. )
THEN 238 IF (oglobs) iinla = iinla + 2
239 IF (oglobn) iinla = iinla + 2
243 kinlo_out(ioffset+1) = kinlo(2)
244 kinlo_out(ioffset+2) = kinlo(1)
245 ioffset = ioffset + 2
247 kinlo_out(ioffset+1:ioffset+kinla) = kinlo(1:kinla)
248 ioffset = ioffset + kinla
250 kinlo_out(ioffset+1) = kinlo(kinla)
251 kinlo_out(ioffset+2) = kinlo(kinla-1)
252 ioffset = ioffset + 2
265 IF (.NOT. ointerp(jl)) cycle
270 IF (polo(jl) < pilo1_out) polo(jl) = polo(jl) + 360.
271 IF (polo(jl) > pilo2_out) polo(jl) = polo(jl) - 360.
274 IF (
PRESENT(pilatarray))
THEN 277 IF((pola(jl)>=pilatarray(jl2)-zidlat(jl2)/2..AND.pola(jl)<pilatarray(jl2)+zidlat(jl2+1)/2.).OR.&
278 (pola(jl)<=pilatarray(jl2)-zidlat(jl2)/2..AND.pola(jl)>pilatarray(jl2)+zidlat(jl2+1)/2.))
THEN 281 ELSEIF (pola(jl)>maxval(pilatarray(:)))
THEN 282 ko(jl,3) =
maxloc(pilatarray,1)
283 ELSEIF (pola(jl)<minval(pilatarray(:)))
THEN 284 ko(jl,3) = minloc(pilatarray,1)
287 pla(jl,3) = pilatarray(ko(jl,3))
291 ko(jl,3) = nint( (pola(jl)-pila1)/zidla - 0.5 )
292 IF ( ko(jl,3)<-1)
CALL abor1_sfx(
'HORIBLE_SURF_INIT: INPUT DOMAIN SMALLER THAN OUTPUT ONE - LATITUDE')
294 pla(jl,3) = pila1 + ko(jl,3) * zidla
296 ko(jl,3) = ko(jl,3) + 1
300 IF (
PRESENT(pilatarray))
THEN 302 IF (ko(jl,3)==1)
THEN 303 pla(jl,4) = pilatarray(1) - zidlat(1)
305 pla(jl,4) = pilatarray(ko(jl,3)-1)
307 IF (ko(jl,3)>=kinla)
THEN 308 pla(jl,2) = pilatarray(kinla) + zidlat(kinla)
310 pla(jl,2) = pilatarray(ko(jl,3)+1)
312 IF (ko(jl,3)>=kinla)
THEN 313 pla(jl,1) = pilatarray(kinla) + 2.*zidlat(kinla)
315 pla(jl,1) = pilatarray(ko(jl,3)+2)
320 pla(jl,1) = pla(jl,3) + 2*zidla
321 pla(jl,2) = pla(jl,3) + zidla
322 pla(jl,4) = pla(jl,3) - zidla
326 IF (oglobs) ko(jl,3) = ko(jl,3) + 2
328 ko(jl,1) = ko(jl,3) + 2
329 ko(jl,2) = ko(jl,3) + 1
330 ko(jl,4) = ko(jl,3) - 1
332 IF (.NOT.oglobs)
THEN 333 ko(jl,1:2) = min(ko(jl,1:2),iinla)
334 ko(jl,3:4) = max(ko(jl,3:4),1)
340 IF (ko(jl,3)==2)
THEN 341 pla(jl,4) = 2. * zsouthpole - pla(jl,1)
342 pla(jl,3) = 2. * zsouthpole - pla(jl,2)
343 ELSEIF (ko(jl,3)==3)
THEN 344 pla(jl,4) = 2. * zsouthpole - pla(jl,3)
348 IF (ko(jl,3)==iinla-2)
THEN 349 pla(jl,1) = 2. * znorthpole - pla(jl,4)
350 pla(jl,2) = 2. * znorthpole - pla(jl,3)
351 ELSEIF (ko(jl,3)==iinla-3)
THEN 352 pla(jl,1) = 2. * znorthpole - pla(jl,2)
356 IF ((ko(jl,4)<1).OR.any((ko(jl,:)>iinla)))
THEN 357 CALL abor1_sfx(
'HORIBLE_SURF_INIT: INPUT DOMAIN SMALLER THAN OUTPUT ONE - LATITUDE')
362 IF (
lhook)
CALL dr_hook(
'HORIBL_SURF_INIT',1,zhook_handle)
subroutine abor1_sfx(YTEXT)
subroutine horibl_surf_init(PILA1, PILO1, PILA2, PILO2, KINLA, KINLO, KOLEN, PXOUT, PYOUT, OINTERP, OGLOBLON, OGLOBN, OGLOBS, KO, KINLO_OUT, POLA, POLO, PILO1_OUT, PILO2_OUT, PLA, PILATARRAY)