14 SUBROUTINE conf_dat2d(title, xd, yd, xf, yf, champd, interbar)
30 CHARACTER(LEN=*),
INTENT(IN) :: title
31 REAL,
INTENT(IN) :: xd(:), yd(:)
32 REAL,
INTENT(INOUT) :: xf(:), yf(:)
33 REAL,
INTENT(INOUT) :: champd(:,:)
34 LOGICAL,
INTENT(IN) :: interbar
37 CHARACTER(LEN=256) :: modname=
"conf_dat2d"
38 INTEGER :: i, j, ip180, ind, lons, lats
39 LOGICAL :: radlon, invlon ,radlat, invlat
40 REAL :: pi, pis2, depi, rlatmin, rlatmax, oldxd1
41 REAL,
ALLOCATABLE :: xtemp(:) , ytemp(:), champf(:,:)
43 lons=
assert_eq(
SIZE(xd),
SIZE(xf),
SIZE(champd,1),trim(modname)//
" lons")
44 lats=
assert_eq(
SIZE(yd),
SIZE(yf),
SIZE(champd,2),trim(modname)//
" lats")
45 ALLOCATE(xtemp(lons),ytemp(lats)); xtemp(:)=xd(:); ytemp(:)=yd(:)
46 ALLOCATE(champf(lons,lats))
51 IF (xtemp(1)>=-pi-0.5.AND.xtemp(lons)<= pi+0.5)
THEN
53 ELSE IF(xtemp(1)>= -0.5.AND.xtemp(lons)<=depi+0.5)
THEN
55 ELSE IF(xtemp(1)>= -180.5.AND.xtemp(lons)<= 180.5)
THEN
57 ELSE IF(xtemp(1)>= -0.5.AND.xtemp(lons)<= 360.5)
THEN
59 else;
WRITE(6,*)
'Problems with data longitudes for file '//trim(title)
61 invlat = ytemp(1)<ytemp(lats)
62 rlatmin = min( ytemp(1), ytemp(lats) )
63 rlatmax = max( ytemp(1), ytemp(lats) )
65 IF (rlatmin>=-pis2-0.5.AND.rlatmax<=pis2+0.5) then; radlat = .
true.
66 ELSE IF(rlatmin>= -90.-0.5.AND.rlatmax<= 90.+0.5) then; radlat = .
false.
67 else;
WRITE(6,*)
'Problems with data latitudes for file '//trim(title)
70 IF(.NOT.radlon) xtemp(:)=xtemp(:)*pi/180.
71 IF(.NOT.radlat) ytemp(:)=ytemp(:)*pi/180.
75 champf(:,:)=champd(:,:); xf(:)=xtemp(:)
78 DO i=1,lons;
IF(xf(i)>pi) exit; end do; ip180 = i
79 DO i=1,lons;
IF(xf(i)>pi) xf(i)=xf(i)-depi;
END DO
80 DO i= ip180,lons; ind=i-ip180+1; xtemp(ind)=xf(i);
END DO
81 DO i= ind+1,lons; xtemp(i )=xf(i-ind);
END DO
85 DO i=ip180,lons; ind=i-ip180+1; champd(ind,j)=champf(i ,j);
END DO
86 DO i=ind+1,lons; champd(i ,j)=champf(i-ind,j);
END DO
93 champf(:,:)=champd(:,:)
94 ytemp(lats:1:-1)=yf(:)
95 DO j=1,lats; champd(:,lats-j+1)=champf(:,j);
END DO
101 xtemp(1:lons-1)=0.5*(xtemp(1:lons-1)+xtemp(2:lons))
102 xtemp( lons )=0.5*(xtemp( lons )+oldxd1+depi)
103 ytemp(1:lats-1)=0.5*(ytemp(1:lats-1)+ytemp(2:lats))
106 xf(:)=xtemp(:);
DEALLOCATE(xtemp)
107 yf(:)=ytemp(:);
DEALLOCATE(ytemp)
116 SUBROUTINE conf_dat3d(title, xd, yd, zd, xf, yf, zf, champd, interbar)
134 CHARACTER(LEN=*),
INTENT(IN) :: title
135 REAL,
INTENT(IN) :: xd(:), yd(:), zd(:)
136 REAL,
INTENT(INOUT) :: xf(:), yf(:), zf(:)
137 REAL,
INTENT(INOUT) :: champd(:,:,:)
138 LOGICAL,
INTENT(IN) :: interbar
141 CHARACTER(LEN=256) :: modname=
"conf_dat3d"
142 INTEGER :: i, j, l, ip180, ind, lons, lats, levs
143 LOGICAL :: radlon, invlon ,radlat, invlat, invlev
144 REAL :: pi, pis2, depi, presmax, rlatmin, rlatmax, oldxd1
145 REAL,
ALLOCATABLE :: xtemp(:) , ytemp(:), ztemp(:), champf(:,:,:)
147 lons=
assert_eq(
SIZE(xd),
SIZE(xf),
SIZE(champd,1),trim(modname)//
" lons")
148 lats=
assert_eq(
SIZE(yd),
SIZE(yf),
SIZE(champd,2),trim(modname)//
" lats")
149 levs=
assert_eq(
SIZE(zd),
SIZE(zf),
SIZE(champd,3),trim(modname)//
" levs")
150 ALLOCATE(xtemp(lons),ytemp(lats),ztemp(levs),champf(lons,lats,levs))
151 xtemp(:)=xd(:); ytemp(:)=yd(:); ztemp(:)=zd(:)
156 IF (xtemp(1)>=-pi-0.5.AND.xtemp(lons)<= pi+0.5)
THEN
158 ELSE IF(xtemp(1)>= -0.5.AND.xtemp(lons)<=depi+0.5)
THEN
160 ELSE IF(xtemp(1)>= -180.5.AND.xtemp(lons)<= 180.5)
THEN
162 ELSE IF(xtemp(1)>= -0.5.AND.xtemp(lons)<= 360.5)
THEN
164 else;
WRITE(6,*)
'Problems with data longitudes for file '//trim(title)
166 invlat = ytemp(1)<ytemp(lats)
167 rlatmin = min( ytemp(1), ytemp(lats) )
168 rlatmax = max( ytemp(1), ytemp(lats) )
170 IF (rlatmin>=-pis2-0.5.AND.rlatmax<=pis2+0.5) then; radlat = .
true.
171 ELSE IF(rlatmin>= -90.-0.5.AND.rlatmax<= 90.+0.5) then; radlat = .
false.
172 else;
WRITE(6,*)
'Problems with data latitudes for file '//trim(title)
175 IF(.NOT.radlon) xtemp(:)=xtemp(:)*pi/180.
176 IF(.NOT.radlat) ytemp(:)=ytemp(:)*pi/180.
180 champf(:,:,:)=champd(:,:,:); xf(:)=xtemp(:)
183 DO i=1,lons;
IF(xf(i)>pi) exit; end do; ip180 = i
184 DO i=1,lons;
IF(xf(i)>pi) xf(i)=xf(i)-depi;
END DO
185 DO i= ip180,lons; ind=i-ip180+1; xtemp(ind)=xf(i);
END DO
186 DO i= ind+1,lons; xtemp(i )=xf(i-ind);
END DO
191 DO i=ip180,lons; ind=i-ip180+1; champd(ind,j,l)=champf(i ,j,l);
END DO
192 DO i=ind+1,lons; champd(i ,j,l)=champf(i-ind,j,l);
END DO
200 champf(:,:,:)=champd(:,:,:)
201 ytemp(lats:1:-1)=yf(:)
203 DO j=1,lats; champd(:,lats-j+1,l)=champf(:,j,l);
END DO
210 xtemp(1:lons-1)=0.5*(xtemp(1:lons-1)+xtemp(2:lons))
211 xtemp( lons )=0.5*(xtemp( lons )+oldxd1+depi)
212 ytemp(1:lats-1)=0.5*(ytemp(1:lats-1)+ytemp(2:lats))
216 invlev=ztemp(1)<ztemp(levs)
217 IF(max(ztemp(1),ztemp(levs))<1200.) ztemp(:)=ztemp(:)*100.
220 champf(:,:,:)=champd(:,:,:)
221 ztemp(levs:1:-1)=zf(:)
222 DO l=1,levs; champd(:,:,levs+1-l)=champf(:,:,l);
END DO
226 xf(:)=xtemp(:);
DEALLOCATE(xtemp)
227 yf(:)=ytemp(:);
DEALLOCATE(ytemp)
228 zf(:)=ztemp(:);
DEALLOCATE(ztemp)
subroutine, public conf_dat2d(title, xd, yd, xf, yf, champd, interbar)
subroutine, public conf_dat3d(title, xd, yd, zd, xf, yf, zf, champd, interbar)
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL false
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL ulevSTD CALL &zphi philevSTD CALL &zx_rh rhlevSTD!DO klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon du jour ou toutes les read_climoz CALL true