1 | C |
---|
2 | C $Header$ |
---|
3 | C |
---|
4 | SUBROUTINE limit_netcdf(interbar, extrap, oldice, masque, pctsrf) |
---|
5 | c |
---|
6 | IMPLICIT none |
---|
7 | c |
---|
8 | c------------------------------------------------------------- |
---|
9 | C Author : L. Fairhead |
---|
10 | C Date : 27/01/94 |
---|
11 | C Objet : Construction des fichiers de conditions aux limites |
---|
12 | C pour le nouveau |
---|
13 | C modele a partir de fichiers de climatologie. Les deux |
---|
14 | C grilles doivent etre regulieres |
---|
15 | c |
---|
16 | c Modifie par z.x.li (le23mars1994) |
---|
17 | c Modifie par L. Fairhead (fairhead@lmd.jussieu.fr) septembre 1999 |
---|
18 | c pour lecture netcdf dans LMDZ.3.3 |
---|
19 | c Modifie par P;Le Van , juillet 2001 |
---|
20 | c------------------------------------------------------------- |
---|
21 | c |
---|
22 | #include "dimensions.h" |
---|
23 | #include "paramet.h" |
---|
24 | #include "control.h" |
---|
25 | #include "logic.h" |
---|
26 | #include "netcdf.inc" |
---|
27 | #include "comvert.h" |
---|
28 | #include "comgeom2.h" |
---|
29 | #include "comconst.h" |
---|
30 | #include "dimphy.h" |
---|
31 | #include "indicesol.h" |
---|
32 | c |
---|
33 | c----------------------------------------------------------------------- |
---|
34 | LOGICAL interbar, extrap, oldice |
---|
35 | |
---|
36 | REAL phy_nat(klon,360), phy_nat0(klon) |
---|
37 | REAL phy_alb(klon,360) |
---|
38 | REAL phy_sst(klon,360) |
---|
39 | REAL phy_bil(klon,360) |
---|
40 | REAL phy_rug(klon,360) |
---|
41 | REAL phy_ice(klon) |
---|
42 | c |
---|
43 | real pctsrf_t(klon,nbsrf,360) |
---|
44 | real pctsrf(klon,nbsrf) |
---|
45 | REAL verif |
---|
46 | |
---|
47 | REAL masque(iip1,jjp1) |
---|
48 | REAL mask(iim,jjp1) |
---|
49 | CPB |
---|
50 | C newlmt indique l'utilisation de la sous-maille fractionnelle |
---|
51 | C tandis que l'ancien codage utilise l'indicateur du sol (0,1,2,3) |
---|
52 | LOGICAL newlmt, fracterre |
---|
53 | PARAMETER(newlmt=.TRUE.) |
---|
54 | PARAMETER(fracterre = .TRUE.) |
---|
55 | |
---|
56 | C Declarations pour le champ de depart |
---|
57 | INTEGER imdep, jmdep,lmdep |
---|
58 | INTEGER tbid |
---|
59 | PARAMETER ( tbid = 60 ) ! >52 semaines |
---|
60 | REAL timecoord(tbid) |
---|
61 | c |
---|
62 | REAL , ALLOCATABLE :: dlon_msk(:), dlat_msk(:) |
---|
63 | REAL , ALLOCATABLE :: lonmsk_ini(:), latmsk_ini(:) |
---|
64 | REAL , ALLOCATABLE :: dlon(:), dlat(:) |
---|
65 | REAL , ALLOCATABLE :: dlon_ini(:), dlat_ini(:) |
---|
66 | REAL , ALLOCATABLE :: champ_msk(:), champ(:) |
---|
67 | REAL , ALLOCATABLE :: work(:,:) |
---|
68 | |
---|
69 | CHARACTER*25 title |
---|
70 | |
---|
71 | C Declarations pour le champ interpole 2D |
---|
72 | REAL champint(iim,jjp1) |
---|
73 | real chmin,chmax |
---|
74 | |
---|
75 | C Declarations pour le champ interpole 3D |
---|
76 | REAL champtime(iim,jjp1,tbid) |
---|
77 | REAL timeyear(tbid) |
---|
78 | REAL champan(iip1,jjp1,366) |
---|
79 | |
---|
80 | C Declarations pour l'inteprolation verticale |
---|
81 | REAL ax(tbid), ay(tbid) |
---|
82 | REAL by |
---|
83 | REAL yder(tbid) |
---|
84 | |
---|
85 | |
---|
86 | INTEGER ierr |
---|
87 | INTEGER dimfirst(3) |
---|
88 | INTEGER dimlast(3) |
---|
89 | c |
---|
90 | INTEGER nid, ndim, ntim |
---|
91 | INTEGER dims(2), debut(2), epais(2) |
---|
92 | INTEGER id_tim |
---|
93 | INTEGER id_NAT, id_SST, id_BILS, id_RUG, id_ALB |
---|
94 | CPB |
---|
95 | INTEGER id_FOCE, id_FSIC, id_FTER, id_FLIC |
---|
96 | |
---|
97 | INTEGER i, j, k, l, ji |
---|
98 | c declarations pour lecture glace de mer |
---|
99 | INTEGER :: iml_lic, jml_lic, llm_tmp, ttm_tmp, iret |
---|
100 | INTEGER :: itaul(1), fid |
---|
101 | REAL :: lev(1), date, dt |
---|
102 | REAL, ALLOCATABLE, DIMENSION(:,:) :: lon_lic, lat_lic |
---|
103 | REAL, ALLOCATABLE, DIMENSION(:) :: dlon_lic, dlat_lic |
---|
104 | REAL, ALLOCATABLE, DIMENSION (:,:) :: fraclic |
---|
105 | REAL :: flic_tmp(iip1, jjp1) |
---|
106 | |
---|
107 | c Diverses variables locales |
---|
108 | REAL time |
---|
109 | ! pour la lecture du fichier masque ocean |
---|
110 | integer :: nid_o2a |
---|
111 | logical :: couple = .false. |
---|
112 | INTEGER :: iml_omask, jml_omask |
---|
113 | REAL, ALLOCATABLE, DIMENSION(:,:) :: lon_omask, lat_omask |
---|
114 | REAL, ALLOCATABLE, DIMENSION(:) :: dlon_omask, dlat_omask |
---|
115 | REAL, ALLOCATABLE, DIMENSION (:,:) :: ocemask, ocetmp |
---|
116 | real, dimension(klon) :: ocemask_fi |
---|
117 | |
---|
118 | INTEGER longcles |
---|
119 | PARAMETER ( longcles = 20 ) |
---|
120 | REAL clesphy0 ( longcles ) |
---|
121 | #include "serre.h" |
---|
122 | INTEGER ncid,varid,ndimid(4),dimid |
---|
123 | character*30 namedim |
---|
124 | CHARACTER*80 :: varname |
---|
125 | |
---|
126 | cIM28/02/2002 <== PM |
---|
127 | REAL tmidmonth(12) |
---|
128 | SAVE tmidmonth |
---|
129 | DATA tmidmonth/15,45,75,105,135,165,195,225,255,285,315,345/ |
---|
130 | |
---|
131 | c initialisations: |
---|
132 | CALL conf_gcm( 99, .TRUE. , clesphy0 ) |
---|
133 | |
---|
134 | |
---|
135 | pi = 4. * ATAN(1.) |
---|
136 | rad = 6 371 229. |
---|
137 | omeg = 4.* ASIN(1.)/(24.*3600.) |
---|
138 | g = 9.8 |
---|
139 | daysec = 86400. |
---|
140 | kappa = 0.2857143 |
---|
141 | cpp = 1004.70885 |
---|
142 | dtvr = daysec/FLOAT(day_step) |
---|
143 | CALL inigeom |
---|
144 | c |
---|
145 | C Traitement du relief au sol |
---|
146 | c |
---|
147 | write(*,*) 'Traitement du relief au sol pour fabriquer masque' |
---|
148 | ierr = NF_OPEN('Relief.nc', NF_NOWRITE, ncid) |
---|
149 | |
---|
150 | if (ierr.ne.0) then |
---|
151 | print *, NF_STRERROR(ierr) |
---|
152 | STOP |
---|
153 | ENDIF |
---|
154 | |
---|
155 | ierr = NF_INQ_VARID(ncid,'RELIEF',varid) |
---|
156 | if (ierr.ne.0) then |
---|
157 | print *, NF_STRERROR(ierr) |
---|
158 | STOP |
---|
159 | ENDIF |
---|
160 | ierr = NF_INQ_VARDIMID (ncid,varid,ndimid) |
---|
161 | if (ierr.ne.0) then |
---|
162 | print *, NF_STRERROR(ierr) |
---|
163 | STOP |
---|
164 | ENDIF |
---|
165 | ierr = NF_INQ_DIM(ncid,ndimid(1), namedim, imdep) |
---|
166 | if (ierr.ne.0) then |
---|
167 | print *, NF_STRERROR(ierr) |
---|
168 | STOP |
---|
169 | ENDIF |
---|
170 | print*,'variable ', namedim, 'dimension ', imdep |
---|
171 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
172 | if (ierr.ne.0) then |
---|
173 | print *, NF_STRERROR(ierr) |
---|
174 | STOP |
---|
175 | ENDIF |
---|
176 | |
---|
177 | ALLOCATE( lonmsk_ini(imdep) ) |
---|
178 | ALLOCATE( dlon_msk(imdep) ) |
---|
179 | |
---|
180 | #ifdef NC_DOUBLE |
---|
181 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,lonmsk_ini) |
---|
182 | #else |
---|
183 | ierr = NF_GET_VAR_REAL(ncid,dimid,lonmsk_ini) |
---|
184 | #endif |
---|
185 | |
---|
186 | c |
---|
187 | if (ierr.ne.0) then |
---|
188 | print *, NF_STRERROR(ierr) |
---|
189 | STOP |
---|
190 | ENDIF |
---|
191 | ierr = NF_INQ_DIM(ncid,ndimid(2), namedim, jmdep) |
---|
192 | if (ierr.ne.0) then |
---|
193 | print *, NF_STRERROR(ierr) |
---|
194 | STOP |
---|
195 | ENDIF |
---|
196 | print*,'variable ', namedim, 'dimension ', jmdep |
---|
197 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
198 | if (ierr.ne.0) then |
---|
199 | print *, NF_STRERROR(ierr) |
---|
200 | STOP |
---|
201 | ENDIF |
---|
202 | |
---|
203 | ALLOCATE( latmsk_ini(jmdep) ) |
---|
204 | ALLOCATE( dlat_msk(jmdep) ) |
---|
205 | ALLOCATE( champ_msk(imdep*jmdep) ) |
---|
206 | |
---|
207 | #ifdef NC_DOUBLE |
---|
208 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,latmsk_ini) |
---|
209 | #else |
---|
210 | ierr = NF_GET_VAR_REAL(ncid,dimid,latmsk_ini) |
---|
211 | #endif |
---|
212 | c |
---|
213 | if (ierr.ne.0) then |
---|
214 | print *, NF_STRERROR(ierr) |
---|
215 | STOP |
---|
216 | ENDIF |
---|
217 | #ifdef NC_DOUBLE |
---|
218 | ierr = NF_GET_VAR_DOUBLE(ncid,varid,champ_msk) |
---|
219 | #else |
---|
220 | ierr = NF_GET_VAR_REAL(ncid,varid,champ_msk) |
---|
221 | #endif |
---|
222 | c |
---|
223 | if (ierr.ne.0) then |
---|
224 | print *, NF_STRERROR(ierr) |
---|
225 | STOP |
---|
226 | ENDIF |
---|
227 | c |
---|
228 | title='RELIEF' |
---|
229 | |
---|
230 | CALL conf_dat2d(title,imdep, jmdep, lonmsk_ini, latmsk_ini, |
---|
231 | . dlon_msk, dlat_msk, champ_msk, interbar ) |
---|
232 | |
---|
233 | DO i = 1, iim |
---|
234 | DO j = 1, jjp1 |
---|
235 | mask(i,j) = masque(i,j) |
---|
236 | ENDDO |
---|
237 | ENDDO |
---|
238 | WRITE(*,*) 'MASK:' |
---|
239 | WRITE(*,'(96i1)')INT(mask) |
---|
240 | ierr = NF_CLOSE(ncid) |
---|
241 | c |
---|
242 | c |
---|
243 | C Traitement de la rugosite |
---|
244 | c |
---|
245 | PRINT*, 'Traitement de la rugosite' |
---|
246 | ierr = NF_OPEN('Rugos.nc', NF_NOWRITE, ncid) |
---|
247 | if (ierr.ne.0) then |
---|
248 | print *, NF_STRERROR(ierr) |
---|
249 | STOP |
---|
250 | ENDIF |
---|
251 | |
---|
252 | ierr = NF_INQ_VARID(ncid,'RUGOS',varid) |
---|
253 | if (ierr.ne.0) then |
---|
254 | print *, NF_STRERROR(ierr) |
---|
255 | STOP |
---|
256 | ENDIF |
---|
257 | ierr = NF_INQ_VARDIMID (ncid,varid,ndimid) |
---|
258 | if (ierr.ne.0) then |
---|
259 | print *, NF_STRERROR(ierr) |
---|
260 | STOP |
---|
261 | ENDIF |
---|
262 | ierr = NF_INQ_DIM(ncid,ndimid(1), namedim, imdep) |
---|
263 | if (ierr.ne.0) then |
---|
264 | print *, NF_STRERROR(ierr) |
---|
265 | STOP |
---|
266 | ENDIF |
---|
267 | print*,'variable ', namedim, 'dimension ', imdep |
---|
268 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
269 | if (ierr.ne.0) then |
---|
270 | print *, NF_STRERROR(ierr) |
---|
271 | STOP |
---|
272 | ENDIF |
---|
273 | |
---|
274 | ALLOCATE( dlon_ini(imdep) ) |
---|
275 | ALLOCATE( dlon(imdep) ) |
---|
276 | |
---|
277 | #ifdef NC_DOUBLE |
---|
278 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlon_ini) |
---|
279 | #else |
---|
280 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlon_ini) |
---|
281 | #endif |
---|
282 | if (ierr.ne.0) then |
---|
283 | print *, NF_STRERROR(ierr) |
---|
284 | STOP |
---|
285 | ENDIF |
---|
286 | ierr = NF_INQ_DIM(ncid,ndimid(2), namedim, jmdep) |
---|
287 | if (ierr.ne.0) then |
---|
288 | print *, NF_STRERROR(ierr) |
---|
289 | STOP |
---|
290 | ENDIF |
---|
291 | print*,'variable ', namedim, 'dimension ', jmdep |
---|
292 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
293 | if (ierr.ne.0) then |
---|
294 | print *, NF_STRERROR(ierr) |
---|
295 | STOP |
---|
296 | ENDIF |
---|
297 | |
---|
298 | ALLOCATE( dlat_ini(jmdep) ) |
---|
299 | ALLOCATE( dlat(jmdep) ) |
---|
300 | |
---|
301 | #ifdef NC_DOUBLE |
---|
302 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlat_ini) |
---|
303 | #else |
---|
304 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlat_ini) |
---|
305 | #endif |
---|
306 | if (ierr.ne.0) then |
---|
307 | print *, NF_STRERROR(ierr) |
---|
308 | STOP |
---|
309 | ENDIF |
---|
310 | ierr = NF_INQ_DIM(ncid,ndimid(3), namedim, lmdep) |
---|
311 | if (ierr.ne.0) then |
---|
312 | print *, NF_STRERROR(ierr) |
---|
313 | STOP |
---|
314 | ENDIF |
---|
315 | print*,'variable ', namedim, 'dimension ', lmdep |
---|
316 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
317 | if (ierr.ne.0) then |
---|
318 | print *, NF_STRERROR(ierr) |
---|
319 | STOP |
---|
320 | ENDIF |
---|
321 | #ifdef NC_DOUBLE |
---|
322 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,timecoord) |
---|
323 | #else |
---|
324 | ierr = NF_GET_VAR_REAL(ncid,dimid,timecoord) |
---|
325 | #endif |
---|
326 | if (ierr.ne.0) then |
---|
327 | print *, NF_STRERROR(ierr) |
---|
328 | STOP |
---|
329 | ENDIF |
---|
330 | c |
---|
331 | ALLOCATE( champ(imdep*jmdep) ) |
---|
332 | |
---|
333 | DO 200 l = 1, lmdep |
---|
334 | dimfirst(1) = 1 |
---|
335 | dimfirst(2) = 1 |
---|
336 | dimfirst(3) = l |
---|
337 | c |
---|
338 | dimlast(1) = imdep |
---|
339 | dimlast(2) = jmdep |
---|
340 | dimlast(3) = 1 |
---|
341 | c |
---|
342 | PRINT*,'Lecture temporelle et int. horizontale ',l,timecoord(l) |
---|
343 | print*,dimfirst,dimlast |
---|
344 | #ifdef NC_DOUBLE |
---|
345 | ierr = NF_GET_VARA_DOUBLE(ncid,varid,dimfirst,dimlast,champ) |
---|
346 | #else |
---|
347 | ierr = NF_GET_VARA_REAL(ncid,varid,dimfirst,dimlast,champ) |
---|
348 | #endif |
---|
349 | if (ierr.ne.0) then |
---|
350 | print *, NF_STRERROR(ierr) |
---|
351 | STOP |
---|
352 | ENDIF |
---|
353 | |
---|
354 | title = 'Rugosite Amip ' |
---|
355 | c |
---|
356 | CALL conf_dat2d(title,imdep, jmdep, dlon_ini, dlat_ini, |
---|
357 | . dlon, dlat, champ, interbar ) |
---|
358 | |
---|
359 | IF ( interbar ) THEN |
---|
360 | DO j = 1, imdep * jmdep |
---|
361 | champ(j) = LOG(champ(j)) |
---|
362 | ENDDO |
---|
363 | |
---|
364 | IF( l.EQ.1 ) THEN |
---|
365 | WRITE(6,*) '-------------------------------------------------', |
---|
366 | ,'------------------------' |
---|
367 | WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ', |
---|
368 | , ' pour la rugosite $$$ ' |
---|
369 | WRITE(6,*) '-------------------------------------------------', |
---|
370 | ,'------------------------' |
---|
371 | ENDIF |
---|
372 | CALL inter_barxy ( imdep,jmdep -1,dlon,dlat,champ , |
---|
373 | , iim,jjm,rlonu,rlatv, jjp1,champint ) |
---|
374 | DO j=1,jjp1 |
---|
375 | DO i=1,iim |
---|
376 | champint(i,j)=EXP(champint(i,j)) |
---|
377 | ENDDO |
---|
378 | ENDDO |
---|
379 | |
---|
380 | DO j = 1, jjp1 |
---|
381 | DO i = 1, iim |
---|
382 | IF(NINT(mask(i,j)).NE.1) THEN |
---|
383 | champint( i,j ) = 0.001 |
---|
384 | ENDIF |
---|
385 | ENDDO |
---|
386 | ENDDO |
---|
387 | ELSE |
---|
388 | CALL rugosite(imdep, jmdep, dlon, dlat, champ, |
---|
389 | . iim, jjp1, rlonv, rlatu, champint, mask) |
---|
390 | ENDIF |
---|
391 | DO j = 1,jjp1 |
---|
392 | DO i = 1, iim |
---|
393 | champtime (i,j,l) = champint(i,j) |
---|
394 | ENDDO |
---|
395 | ENDDO |
---|
396 | 200 CONTINUE |
---|
397 | c |
---|
398 | DO l = 1, lmdep |
---|
399 | timeyear(l) = timecoord(l) |
---|
400 | ENDDO |
---|
401 | |
---|
402 | PRINT 222, timeyear |
---|
403 | 222 FORMAT(2x,' Time year ',10f6.1) |
---|
404 | c |
---|
405 | |
---|
406 | PRINT*, 'Interpolation temporelle dans l annee' |
---|
407 | |
---|
408 | DO j = 1, jjp1 |
---|
409 | DO i = 1, iim |
---|
410 | DO l = 1, lmdep |
---|
411 | ax(l) = timeyear(l) |
---|
412 | ay(l) = champtime (i,j,l) |
---|
413 | ENDDO |
---|
414 | CALL SPLINE(ax,ay,lmdep,1.e30,1.e30,yder) |
---|
415 | DO k = 1, 360 |
---|
416 | time = FLOAT(k-1) |
---|
417 | CALL SPLINT(ax,ay,yder,lmdep,time,by) |
---|
418 | champan(i,j,k) = by |
---|
419 | ENDDO |
---|
420 | ENDDO |
---|
421 | ENDDO |
---|
422 | DO k = 1, 360 |
---|
423 | DO j = 1, jjp1 |
---|
424 | champan(iip1,j,k) = champan(1,j,k) |
---|
425 | ENDDO |
---|
426 | IF ( k.EQ.10 ) THEN |
---|
427 | DO j = 1, jjp1 |
---|
428 | CALL minmax( iip1,champan(1,j,10),chmin,chmax ) |
---|
429 | PRINT *,' Rugosite au temps 10 ', chmin,chmax,j |
---|
430 | ENDDO |
---|
431 | ENDIF |
---|
432 | ENDDO |
---|
433 | c |
---|
434 | DO k = 1, 360 |
---|
435 | CALL gr_dyn_fi(1,iip1,jjp1,klon,champan(1,1,k), phy_rug(1,k)) |
---|
436 | ENDDO |
---|
437 | c |
---|
438 | ierr = NF_CLOSE(ncid) |
---|
439 | |
---|
440 | DEALLOCATE( dlon ) |
---|
441 | DEALLOCATE( dlon_ini ) |
---|
442 | DEALLOCATE( dlat ) |
---|
443 | DEALLOCATE( dlat_ini ) |
---|
444 | DEALLOCATE( champ ) |
---|
445 | c |
---|
446 | c |
---|
447 | C Traitement de la glace oceanique |
---|
448 | c |
---|
449 | PRINT*, 'Traitement de la glace oceanique' |
---|
450 | c |
---|
451 | |
---|
452 | cccIM#define cond_climato |
---|
453 | |
---|
454 | #ifdef cond_climato |
---|
455 | |
---|
456 | cIM22/02/2002 |
---|
457 | cIM ierr = NF_OPEN('AMIP.nc', NF_NOWRITE, ncid) |
---|
458 | cIM ierr = NF_OPEN('amip79to95.nc', NF_NOWRITE, ncid) |
---|
459 | ierr = NF_OPEN('amipbc_sic_1x1_clim.nc', NF_NOWRITE, ncid) |
---|
460 | #else |
---|
461 | ierr = NF_OPEN('amipbc_sic_1x1.nc', NF_NOWRITE, ncid) |
---|
462 | #endif |
---|
463 | |
---|
464 | cIM22/02/2002 |
---|
465 | if (ierr.ne.0) then |
---|
466 | print *, NF_STRERROR(ierr) |
---|
467 | STOP |
---|
468 | ENDIF |
---|
469 | |
---|
470 | cIM22/02/2002 |
---|
471 | cIM07/03/2002 AMIP.nc & amip79to95.nc |
---|
472 | cIM ierr = NF_INQ_VARID(ncid,'SEA_ICE',varid) |
---|
473 | cIM07/03/2002 amipbc_sic_1x1_clim.nc & amipbc_sic_1x1.nc |
---|
474 | ierr = NF_INQ_VARID(ncid,'sicbcs',varid) |
---|
475 | cIM22/02/2002 |
---|
476 | if (ierr.ne.0) then |
---|
477 | print *, NF_STRERROR(ierr) |
---|
478 | STOP |
---|
479 | ENDIF |
---|
480 | ierr = NF_INQ_VARDIMID (ncid,varid,ndimid) |
---|
481 | if (ierr.ne.0) then |
---|
482 | print *, NF_STRERROR(ierr) |
---|
483 | STOP |
---|
484 | ENDIF |
---|
485 | ierr = NF_INQ_DIM(ncid,ndimid(1), namedim, imdep) |
---|
486 | if (ierr.ne.0) then |
---|
487 | print *, NF_STRERROR(ierr) |
---|
488 | STOP |
---|
489 | ENDIF |
---|
490 | print*,'variable ', namedim, 'dimension ', imdep |
---|
491 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
492 | if (ierr.ne.0) then |
---|
493 | print *, NF_STRERROR(ierr) |
---|
494 | STOP |
---|
495 | ENDIF |
---|
496 | |
---|
497 | ALLOCATE ( dlon_ini(imdep) ) |
---|
498 | ALLOCATE ( dlon(imdep) ) |
---|
499 | |
---|
500 | #ifdef NC_DOUBLE |
---|
501 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlon_ini) |
---|
502 | #else |
---|
503 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlon_ini) |
---|
504 | #endif |
---|
505 | if (ierr.ne.0) then |
---|
506 | print *, NF_STRERROR(ierr) |
---|
507 | STOP |
---|
508 | ENDIF |
---|
509 | ierr = NF_INQ_DIM(ncid,ndimid(2), namedim, jmdep) |
---|
510 | if (ierr.ne.0) then |
---|
511 | print *, NF_STRERROR(ierr) |
---|
512 | STOP |
---|
513 | ENDIF |
---|
514 | print*,'variable ', namedim, jmdep |
---|
515 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
516 | if (ierr.ne.0) then |
---|
517 | print *, NF_STRERROR(ierr) |
---|
518 | STOP |
---|
519 | ENDIF |
---|
520 | |
---|
521 | ALLOCATE ( dlat_ini(jmdep) ) |
---|
522 | ALLOCATE ( dlat(jmdep) ) |
---|
523 | |
---|
524 | #ifdef NC_DOUBLE |
---|
525 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlat_ini) |
---|
526 | #else |
---|
527 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlat_ini) |
---|
528 | #endif |
---|
529 | if (ierr.ne.0) then |
---|
530 | print *, NF_STRERROR(ierr) |
---|
531 | STOP |
---|
532 | ENDIF |
---|
533 | ierr = NF_INQ_DIM(ncid,ndimid(3), namedim, lmdep) |
---|
534 | if (ierr.ne.0) then |
---|
535 | print *, NF_STRERROR(ierr) |
---|
536 | STOP |
---|
537 | ENDIF |
---|
538 | print*,'variable ', namedim, lmdep |
---|
539 | cIM28/02/2002 |
---|
540 | cPM28/02/2002 : nouvelle coord temporelle fichiers AMIP pas en jours |
---|
541 | c Ici on suppose qu'on a 12 mois (de 30 jours). |
---|
542 | IF (lmdep.NE.12) THEN |
---|
543 | print *, 'Unknown AMIP file: not 12 months ?' |
---|
544 | STOP |
---|
545 | ENDIF |
---|
546 | cIM28/02/2002 |
---|
547 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
548 | if (ierr.ne.0) then |
---|
549 | print *, NF_STRERROR(ierr) |
---|
550 | STOP |
---|
551 | ENDIF |
---|
552 | #ifdef NC_DOUBLE |
---|
553 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,timecoord) |
---|
554 | #else |
---|
555 | ierr = NF_GET_VAR_REAL(ncid,dimid,timecoord) |
---|
556 | #endif |
---|
557 | if (ierr.ne.0) then |
---|
558 | print *, NF_STRERROR(ierr) |
---|
559 | STOP |
---|
560 | ENDIF |
---|
561 | c |
---|
562 | ALLOCATE ( champ(imdep*jmdep) ) |
---|
563 | |
---|
564 | DO l = 1, lmdep |
---|
565 | dimfirst(1) = 1 |
---|
566 | dimfirst(2) = 1 |
---|
567 | dimfirst(3) = l |
---|
568 | c |
---|
569 | dimlast(1) = imdep |
---|
570 | dimlast(2) = jmdep |
---|
571 | dimlast(3) = 1 |
---|
572 | c |
---|
573 | PRINT*,'Lecture temporelle et int. horizontale ',l,timecoord(l) |
---|
574 | #ifdef NC_DOUBLE |
---|
575 | ierr = NF_GET_VARA_DOUBLE(ncid,varid,dimfirst,dimlast,champ) |
---|
576 | #else |
---|
577 | ierr = NF_GET_VARA_REAL(ncid,varid,dimfirst,dimlast,champ) |
---|
578 | #endif |
---|
579 | if (ierr.ne.0) then |
---|
580 | print *, NF_STRERROR(ierr) |
---|
581 | STOP |
---|
582 | ENDIF |
---|
583 | |
---|
584 | title = 'Sea-ice Amip ' |
---|
585 | c |
---|
586 | CALL conf_dat2d(title,imdep, jmdep, dlon_ini, dlat_ini, |
---|
587 | . dlon, dlat, champ, interbar ) |
---|
588 | c |
---|
589 | IF( oldice ) THEN |
---|
590 | CALL sea_ice(imdep, jmdep, dlon, dlat, champ, |
---|
591 | . iim, jjp1, rlonv, rlatu, champint ) |
---|
592 | ELSEIF ( interbar ) THEN |
---|
593 | IF( l.EQ.1 ) THEN |
---|
594 | WRITE(6,*) '-------------------------------------------------', |
---|
595 | ,'------------------------' |
---|
596 | WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ', |
---|
597 | , ' pour Sea-ice Amip $$$ ' |
---|
598 | WRITE(6,*) '-------------------------------------------------', |
---|
599 | ,'------------------------' |
---|
600 | ENDIF |
---|
601 | cIM07/03/2002 |
---|
602 | cIM22/02/2002 : Sea-ice Amip entre 0. et 1. |
---|
603 | cIM PRINT*,'SUB. limit_netcdf.F IM : Sea-ice et SST Amip_new clim' |
---|
604 | cIM DO j = 1, imdep * jmdep |
---|
605 | cIM28/02/2002 <==PM champ(j) = champ(j)/100. |
---|
606 | cIM14/03/2002 champ(j) = max(0.0,(min(1.0, (champ(j)/100.) ))) |
---|
607 | cIM champ(j) = amax1(0.0,(amin1(1.0, (champ(j)/100.) ))) |
---|
608 | cIM ENDDO |
---|
609 | cIM22/02/2002 |
---|
610 | CALL inter_barxy ( imdep,jmdep -1,dlon, dlat , |
---|
611 | , champ, iim, jjm, rlonu, rlatv, jjp1, champint ) |
---|
612 | ELSE |
---|
613 | CALL sea_ice(imdep, jmdep, dlon, dlat, champ, |
---|
614 | . iim, jjp1, rlonv, rlatu, champint ) |
---|
615 | ENDIF |
---|
616 | DO j = 1,jjp1 |
---|
617 | DO i = 1, iim |
---|
618 | champtime (i,j,l) = champint(i,j) |
---|
619 | ENDDO |
---|
620 | ENDDO |
---|
621 | ENDDO |
---|
622 | c |
---|
623 | DO l = 1, lmdep |
---|
624 | cIM28/02/2002 <== PM timeyear(l) = timecoord(l) |
---|
625 | cIM timeyear(l) = timecoord(l) |
---|
626 | cIM07/03/2002 |
---|
627 | timeyear(l) = tmidmonth(l) |
---|
628 | ENDDO |
---|
629 | PRINT 222, timeyear |
---|
630 | c |
---|
631 | PRINT*, 'Interpolation temporelle' |
---|
632 | DO j = 1, jjp1 |
---|
633 | DO i = 1, iim |
---|
634 | DO l = 1, lmdep |
---|
635 | ax(l) = timeyear(l) |
---|
636 | ay(l) = champtime (i,j,l) |
---|
637 | ENDDO |
---|
638 | CALL SPLINE(ax,ay,lmdep,1.e30,1.e30,yder) |
---|
639 | DO k = 1, 360 |
---|
640 | time = FLOAT(k-1) |
---|
641 | CALL SPLINT(ax,ay,yder,lmdep,time,by) |
---|
642 | champan(i,j,k) = by |
---|
643 | ENDDO |
---|
644 | ENDDO |
---|
645 | ENDDO |
---|
646 | DO k = 1, 360 |
---|
647 | DO j = 1, jjp1 |
---|
648 | champan(iip1, j, k) = champan(1, j, k) |
---|
649 | ENDDO |
---|
650 | IF ( k.EQ.10 ) THEN |
---|
651 | DO j = 1, jjp1 |
---|
652 | CALL minmax( iip1,champan(1,j,10),chmin,chmax ) |
---|
653 | PRINT *,' Sea ice au temps 10 ', chmin,chmax,j |
---|
654 | ENDDO |
---|
655 | ENDIF |
---|
656 | ENDDO |
---|
657 | c |
---|
658 | cIM14/03/2002 : Sea-ice Amip entre 0. et 1. |
---|
659 | PRINT*,'SUB. limit_netcdf.F IM : Sea-ice Amipbc ' |
---|
660 | DO k = 1, 360 |
---|
661 | DO j = 1, jjp1 |
---|
662 | DO i = 1, iim |
---|
663 | champan(i, j, k) = |
---|
664 | $ amax1(0.0,(amin1(1.0,(champan(i, j, k)/100.)))) |
---|
665 | ENDDO |
---|
666 | champan(iip1, j, k) = champan(1, j, k) |
---|
667 | ENDDO |
---|
668 | ENDDO |
---|
669 | cIM14/03/2002 |
---|
670 | |
---|
671 | DO k = 1, 360 |
---|
672 | CALL gr_dyn_fi(1, iip1, jjp1, klon, |
---|
673 | . champan(1,1,k), phy_ice) |
---|
674 | IF ( newlmt) THEN |
---|
675 | |
---|
676 | CPB en attendant de mettre fraction de terre |
---|
677 | c |
---|
678 | WHERE(phy_ice(1:klon) .GE. 1.) phy_ice(1 : klon) = 1. |
---|
679 | WHERE(phy_ice(1:klon) .LT. EPSFRA) phy_ice(1 : klon) = 0. |
---|
680 | c |
---|
681 | IF (fracterre ) THEN |
---|
682 | c WRITE(*,*) 'passe dans cas fracterre' |
---|
683 | pctsrf_t(:,is_ter,k) = pctsrf(:,is_ter) |
---|
684 | pctsrf_t(:,is_lic,k) = pctsrf(:,is_lic) |
---|
685 | pctsrf_t(1:klon,is_sic,k) = phy_ice(1:klon) |
---|
686 | $ - pctsrf_t(1:klon,is_lic,k) |
---|
687 | c Il y a des cas ou il y a de la glace dans landiceref et pas dans AMIP |
---|
688 | WHERE (pctsrf_t(1:klon,is_sic,k) .LE. 0) |
---|
689 | pctsrf_t(1:klon,is_sic,k) = 0. |
---|
690 | END WHERE |
---|
691 | WHERE( 1. - zmasq(1:klon) .LT. EPSFRA) |
---|
692 | pctsrf_t(1:klon,is_sic,k) = 0. |
---|
693 | pctsrf_t(1:klon,is_oce,k) = 0. |
---|
694 | END WHERE |
---|
695 | DO i = 1, klon |
---|
696 | IF ( 1. - zmasq(i) .GT. EPSFRA) THEN |
---|
697 | IF ( pctsrf_t(i,is_sic,k) .GE. 1 - zmasq(i)) THEN |
---|
698 | pctsrf_t(i,is_sic,k) = 1 - zmasq(i) |
---|
699 | pctsrf_t(i,is_oce,k) = 0. |
---|
700 | ELSE |
---|
701 | pctsrf_t(i,is_oce,k) = 1 - zmasq(i) |
---|
702 | $ - pctsrf_t(i,is_sic,k) |
---|
703 | IF (pctsrf_t(i,is_oce,k) .LT. EPSFRA) THEN |
---|
704 | pctsrf_t(i,is_oce,k) = 0. |
---|
705 | pctsrf_t(i,is_sic,k) = 1 - zmasq(i) |
---|
706 | ENDIF |
---|
707 | ENDIF |
---|
708 | ENDIF |
---|
709 | if (pctsrf_t(i,is_oce,k) .lt. 0.) then |
---|
710 | WRITE(*,*) 'pb sous maille au point : i,k ' |
---|
711 | $ , i,k,pctsrf_t(:,is_oce,k) |
---|
712 | ENDIF |
---|
713 | IF ( abs( pctsrf_t(i, is_ter,k) + pctsrf_t(i, is_lic,k) + |
---|
714 | $ pctsrf_t(i, is_oce,k) + pctsrf_t(i, is_sic,k) - 1.) |
---|
715 | $ .GT. EPSFRA) THEN |
---|
716 | WRITE(*,*) 'physiq : pb sous surface au point ', i, |
---|
717 | $ pctsrf_t(i, 1 : nbsrf,k), phy_ice(i) |
---|
718 | ENDIF |
---|
719 | END DO |
---|
720 | ELSE |
---|
721 | DO i = 1, klon |
---|
722 | pctsrf_t(i,is_ter,k) = pctsrf(i,is_ter) |
---|
723 | IF (NINT(pctsrf(i,is_ter)).EQ.1 ) THEN |
---|
724 | pctsrf_t(i,is_sic,k) = 0. |
---|
725 | pctsrf_t(i,is_oce,k) = 0. |
---|
726 | IF(phy_ice(i) .GE. 1.e-5) THEN |
---|
727 | pctsrf_t(i,is_lic,k) = phy_ice(i) |
---|
728 | pctsrf_t(i,is_ter,k) = pctsrf_t(i,is_ter,k) |
---|
729 | . - pctsrf_t(i,is_lic,k) |
---|
730 | ELSE |
---|
731 | pctsrf_t(i,is_lic,k) = 0. |
---|
732 | ENDIF |
---|
733 | ELSE |
---|
734 | pctsrf_t(i,is_lic,k) = 0. |
---|
735 | IF(phy_ice(i) .GE. 1.e-5) THEN |
---|
736 | pctsrf_t(i,is_ter,k) = 0. |
---|
737 | pctsrf_t(i,is_sic,k) = phy_ice(i) |
---|
738 | pctsrf_t(i,is_oce,k) = 1. - pctsrf_t(i,is_sic,k) |
---|
739 | ELSE |
---|
740 | pctsrf_t(i,is_sic,k) = 0. |
---|
741 | pctsrf_t(i,is_oce,k) = 1. |
---|
742 | ENDIF |
---|
743 | ENDIF |
---|
744 | verif = pctsrf_t(i,is_ter,k) + |
---|
745 | . pctsrf_t(i,is_oce,k) + |
---|
746 | . pctsrf_t(i,is_sic,k) + |
---|
747 | . pctsrf_t(i,is_lic,k) |
---|
748 | IF ( verif .LT. 1. - 1.e-5 .OR. |
---|
749 | $ verif .GT. 1 + 1.e-5) THEN |
---|
750 | WRITE(*,*) 'pb sous maille au point : i,k,verif ' |
---|
751 | $ , i,k,verif |
---|
752 | ENDIF |
---|
753 | END DO |
---|
754 | ENDIF |
---|
755 | ELSE |
---|
756 | DO i = 1, klon |
---|
757 | phy_nat(i,k) = phy_nat0(i) |
---|
758 | IF ( (phy_ice(i) - 0.5).GE.1.e-5 ) THEN |
---|
759 | IF (NINT(phy_nat0(i)).EQ.0) THEN |
---|
760 | phy_nat(i,k) = 3.0 |
---|
761 | ELSE |
---|
762 | phy_nat(i,k) = 2.0 |
---|
763 | ENDIF |
---|
764 | ENDIF |
---|
765 | IF( NINT(phy_nat(i,k)).EQ.0 ) THEN |
---|
766 | IF ( phy_rug(i,k).NE.0.001 ) phy_rug(i,k) = 0.001 |
---|
767 | ENDIF |
---|
768 | END DO |
---|
769 | ENDIF |
---|
770 | ENDDO |
---|
771 | c |
---|
772 | |
---|
773 | ierr = NF_CLOSE(ncid) |
---|
774 | c |
---|
775 | DEALLOCATE( dlon ) |
---|
776 | DEALLOCATE( dlon_ini ) |
---|
777 | DEALLOCATE( dlat ) |
---|
778 | DEALLOCATE( dlat_ini ) |
---|
779 | DEALLOCATE( champ ) |
---|
780 | |
---|
781 | 477 continue |
---|
782 | c |
---|
783 | C Traitement de la sst |
---|
784 | c |
---|
785 | PRINT*, 'Traitement de la sst' |
---|
786 | #ifdef cond_climato |
---|
787 | cIM22/02/2002 |
---|
788 | cIM ierr = NF_OPEN('AMIP.nc', NF_NOWRITE, ncid) |
---|
789 | cIM ierr = NF_OPEN('amip79to95.nc', NF_NOWRITE, ncid) |
---|
790 | ierr = NF_OPEN('amipbc_sst_1x1_clim.nc', NF_NOWRITE, ncid) |
---|
791 | #else |
---|
792 | ierr = NF_OPEN('amipbc_sst_1x1.nc', NF_NOWRITE, ncid) |
---|
793 | #endif |
---|
794 | cIM22/02/2002 |
---|
795 | if (ierr.ne.0) then |
---|
796 | print *, NF_STRERROR(ierr) |
---|
797 | STOP |
---|
798 | ENDIF |
---|
799 | |
---|
800 | cIM22/02/2002 |
---|
801 | cIM ierr = NF_INQ_VARID(ncid,'SST',varid) |
---|
802 | ierr = NF_INQ_VARID(ncid,'tosbcs',varid) |
---|
803 | cIM22/02/2002 |
---|
804 | if (ierr.ne.0) then |
---|
805 | print *, NF_STRERROR(ierr) |
---|
806 | STOP |
---|
807 | ENDIF |
---|
808 | ierr = NF_INQ_VARDIMID (ncid,varid,ndimid) |
---|
809 | if (ierr.ne.0) then |
---|
810 | print *, NF_STRERROR(ierr) |
---|
811 | STOP |
---|
812 | ENDIF |
---|
813 | ierr = NF_INQ_DIM(ncid,ndimid(1), namedim, imdep) |
---|
814 | if (ierr.ne.0) then |
---|
815 | print *, NF_STRERROR(ierr) |
---|
816 | STOP |
---|
817 | ENDIF |
---|
818 | print*,'variable SST ', namedim,'dimension ', imdep |
---|
819 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
820 | if (ierr.ne.0) then |
---|
821 | print *, NF_STRERROR(ierr) |
---|
822 | STOP |
---|
823 | ENDIF |
---|
824 | |
---|
825 | ALLOCATE( dlon_ini(imdep) ) |
---|
826 | ALLOCATE( dlon(imdep) ) |
---|
827 | |
---|
828 | #ifdef NC_DOUBLE |
---|
829 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlon_ini) |
---|
830 | #else |
---|
831 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlon_ini) |
---|
832 | #endif |
---|
833 | |
---|
834 | if (ierr.ne.0) then |
---|
835 | print *, NF_STRERROR(ierr) |
---|
836 | STOP |
---|
837 | ENDIF |
---|
838 | ierr = NF_INQ_DIM(ncid,ndimid(2), namedim, jmdep) |
---|
839 | if (ierr.ne.0) then |
---|
840 | print *, NF_STRERROR(ierr) |
---|
841 | STOP |
---|
842 | ENDIF |
---|
843 | print*,'variable SST ', namedim, 'dimension ', jmdep |
---|
844 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
845 | if (ierr.ne.0) then |
---|
846 | print *, NF_STRERROR(ierr) |
---|
847 | STOP |
---|
848 | ENDIF |
---|
849 | |
---|
850 | ALLOCATE( dlat_ini(jmdep) ) |
---|
851 | ALLOCATE( dlat(jmdep) ) |
---|
852 | |
---|
853 | #ifdef NC_DOUBLE |
---|
854 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlat_ini) |
---|
855 | #else |
---|
856 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlat_ini) |
---|
857 | #endif |
---|
858 | if (ierr.ne.0) then |
---|
859 | print *, NF_STRERROR(ierr) |
---|
860 | STOP |
---|
861 | ENDIF |
---|
862 | ierr = NF_INQ_DIM(ncid,ndimid(3), namedim, lmdep) |
---|
863 | if (ierr.ne.0) then |
---|
864 | print *, NF_STRERROR(ierr) |
---|
865 | STOP |
---|
866 | ENDIF |
---|
867 | print*,'variable ', namedim, 'dimension ', lmdep |
---|
868 | cIM28/02/2002 |
---|
869 | cPM28/02/2002 : nouvelle coord temporelle fichiers AMIP pas en jours |
---|
870 | c Ici on suppose qu'on a 12 mois (de 30 jours). |
---|
871 | IF (lmdep.NE.12) THEN |
---|
872 | print *, 'Unknown AMIP file: not 12 months ?' |
---|
873 | STOP |
---|
874 | ENDIF |
---|
875 | cIM28/02/2002 |
---|
876 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
877 | if (ierr.ne.0) then |
---|
878 | print *, NF_STRERROR(ierr) |
---|
879 | STOP |
---|
880 | ENDIF |
---|
881 | #ifdef NC_DOUBLE |
---|
882 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,timecoord) |
---|
883 | #else |
---|
884 | ierr = NF_GET_VAR_REAL(ncid,dimid,timecoord) |
---|
885 | #endif |
---|
886 | if (ierr.ne.0) then |
---|
887 | print *, NF_STRERROR(ierr) |
---|
888 | STOP |
---|
889 | ENDIF |
---|
890 | |
---|
891 | ALLOCATE( champ(imdep*jmdep) ) |
---|
892 | IF( extrap ) THEN |
---|
893 | ALLOCATE ( work(imdep,jmdep) ) |
---|
894 | ENDIF |
---|
895 | c |
---|
896 | DO l = 1, lmdep |
---|
897 | dimfirst(1) = 1 |
---|
898 | dimfirst(2) = 1 |
---|
899 | dimfirst(3) = l |
---|
900 | c |
---|
901 | dimlast(1) = imdep |
---|
902 | dimlast(2) = jmdep |
---|
903 | dimlast(3) = 1 |
---|
904 | c |
---|
905 | PRINT*,'Lecture temporelle et int. horizontale ',l,timecoord(l) |
---|
906 | #ifdef NC_DOUBLE |
---|
907 | ierr = NF_GET_VARA_DOUBLE(ncid,varid,dimfirst,dimlast,champ) |
---|
908 | #else |
---|
909 | ierr = NF_GET_VARA_REAL(ncid,varid,dimfirst,dimlast,champ) |
---|
910 | #endif |
---|
911 | if (ierr.ne.0) then |
---|
912 | print *, NF_STRERROR(ierr) |
---|
913 | STOP |
---|
914 | ENDIF |
---|
915 | |
---|
916 | title='Sst Amip' |
---|
917 | c |
---|
918 | CALL conf_dat2d(title,imdep, jmdep, dlon_ini, dlat_ini, |
---|
919 | . dlon, dlat, champ, interbar ) |
---|
920 | IF ( extrap ) THEN |
---|
921 | CALL extrapol(champ, imdep, jmdep, 999999.,.TRUE.,.TRUE.,2,work) |
---|
922 | ENDIF |
---|
923 | c |
---|
924 | |
---|
925 | IF ( interbar ) THEN |
---|
926 | IF( l.EQ.1 ) THEN |
---|
927 | WRITE(6,*) '-------------------------------------------------', |
---|
928 | ,'------------------------' |
---|
929 | WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ', |
---|
930 | , ' pour la Sst Amip $$$ ' |
---|
931 | WRITE(6,*) '-------------------------------------------------', |
---|
932 | ,'------------------------' |
---|
933 | ENDIF |
---|
934 | CALL inter_barxy ( imdep,jmdep -1,dlon, dlat , |
---|
935 | , champ, iim, jjm, rlonu, rlatv, jjp1, champint ) |
---|
936 | ELSE |
---|
937 | CALL grille_m(imdep, jmdep, dlon, dlat, champ, |
---|
938 | . iim, jjp1, rlonv, rlatu, champint ) |
---|
939 | ENDIF |
---|
940 | |
---|
941 | DO j = 1,jjp1 |
---|
942 | DO i = 1, iim |
---|
943 | champtime (i,j,l) = champint(i,j) |
---|
944 | ENDDO |
---|
945 | ENDDO |
---|
946 | ENDDO |
---|
947 | c |
---|
948 | DO l = 1, lmdep |
---|
949 | cIM28/02/2002 <==PM timeyear(l) = timecoord(l) |
---|
950 | timeyear(l) = tmidmonth(l) |
---|
951 | ENDDO |
---|
952 | print 222, timeyear |
---|
953 | c |
---|
954 | C interpolation temporelle |
---|
955 | DO j = 1, jjp1 |
---|
956 | DO i = 1, iim |
---|
957 | DO l = 1, lmdep |
---|
958 | ax(l) = timeyear(l) |
---|
959 | ay(l) = champtime (i,j,l) |
---|
960 | ENDDO |
---|
961 | CALL SPLINE(ax,ay,lmdep,1.e30,1.e30,yder) |
---|
962 | DO k = 1, 360 |
---|
963 | time = FLOAT(k-1) |
---|
964 | CALL SPLINT(ax,ay,yder,lmdep,time,by) |
---|
965 | champan(i,j,k) = by |
---|
966 | ENDDO |
---|
967 | ENDDO |
---|
968 | ENDDO |
---|
969 | DO k = 1, 360 |
---|
970 | DO j = 1, jjp1 |
---|
971 | champan(iip1,j,k) = champan(1,j,k) |
---|
972 | ENDDO |
---|
973 | IF ( k.EQ.10 ) THEN |
---|
974 | DO j = 1, jjp1 |
---|
975 | CALL minmax( iip1,champan(1,j,10),chmin,chmax ) |
---|
976 | PRINT *,' SST au temps 10 ', chmin,chmax,j |
---|
977 | ENDDO |
---|
978 | ENDIF |
---|
979 | ENDDO |
---|
980 | c |
---|
981 | cIM14/03/2002 : SST amipbc greater then 271.38 |
---|
982 | PRINT*,'SUB. limit_netcdf.F IM : SST Amipbc >= 271.38 ' |
---|
983 | DO k = 1, 360 |
---|
984 | DO j = 1, jjp1 |
---|
985 | DO i = 1, iim |
---|
986 | champan(i, j, k) = amax1(champan(i, j, k), 271.38) |
---|
987 | ENDDO |
---|
988 | champan(iip1, j, k) = champan(1, j, k) |
---|
989 | ENDDO |
---|
990 | ENDDO |
---|
991 | cIM14/03/2002 |
---|
992 | DO k = 1, 360 |
---|
993 | CALL gr_dyn_fi(1, iip1, jjp1, klon, |
---|
994 | . champan(1,1,k), phy_sst(1,k)) |
---|
995 | ENDDO |
---|
996 | c |
---|
997 | ierr = NF_CLOSE(ncid) |
---|
998 | c |
---|
999 | DEALLOCATE( dlon ) |
---|
1000 | DEALLOCATE( dlon_ini ) |
---|
1001 | DEALLOCATE( dlat ) |
---|
1002 | DEALLOCATE( dlat_ini ) |
---|
1003 | DEALLOCATE( champ ) |
---|
1004 | c |
---|
1005 | C Traitement de l'albedo |
---|
1006 | c |
---|
1007 | PRINT*, 'Traitement de l albedo' |
---|
1008 | ierr = NF_OPEN('Albedo.nc', NF_NOWRITE, ncid) |
---|
1009 | if (ierr.ne.0) then |
---|
1010 | print *, NF_STRERROR(ierr) |
---|
1011 | STOP |
---|
1012 | ENDIF |
---|
1013 | ierr = NF_INQ_VARID(ncid,'ALBEDO',varid) |
---|
1014 | if (ierr.ne.0) then |
---|
1015 | print *, NF_STRERROR(ierr) |
---|
1016 | STOP |
---|
1017 | ENDIF |
---|
1018 | ierr = NF_INQ_VARDIMID (ncid,varid,ndimid) |
---|
1019 | if (ierr.ne.0) then |
---|
1020 | print *, NF_STRERROR(ierr) |
---|
1021 | STOP |
---|
1022 | ENDIF |
---|
1023 | ierr = NF_INQ_DIM(ncid,ndimid(1), namedim, imdep) |
---|
1024 | if (ierr.ne.0) then |
---|
1025 | print *, NF_STRERROR(ierr) |
---|
1026 | STOP |
---|
1027 | ENDIF |
---|
1028 | print*,'variable ', namedim, 'dimension ', imdep |
---|
1029 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
1030 | if (ierr.ne.0) then |
---|
1031 | print *, NF_STRERROR(ierr) |
---|
1032 | STOP |
---|
1033 | ENDIF |
---|
1034 | |
---|
1035 | ALLOCATE ( dlon_ini(imdep) ) |
---|
1036 | ALLOCATE ( dlon(imdep) ) |
---|
1037 | |
---|
1038 | #ifdef NC_DOUBLE |
---|
1039 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlon_ini) |
---|
1040 | #else |
---|
1041 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlon_ini) |
---|
1042 | #endif |
---|
1043 | if (ierr.ne.0) then |
---|
1044 | print *, NF_STRERROR(ierr) |
---|
1045 | STOP |
---|
1046 | ENDIF |
---|
1047 | ierr = NF_INQ_DIM(ncid,ndimid(2), namedim, jmdep) |
---|
1048 | if (ierr.ne.0) then |
---|
1049 | print *, NF_STRERROR(ierr) |
---|
1050 | STOP |
---|
1051 | ENDIF |
---|
1052 | print*,'variable ', namedim, 'dimension ', jmdep |
---|
1053 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
1054 | if (ierr.ne.0) then |
---|
1055 | print *, NF_STRERROR(ierr) |
---|
1056 | STOP |
---|
1057 | ENDIF |
---|
1058 | |
---|
1059 | ALLOCATE ( dlat_ini(jmdep) ) |
---|
1060 | ALLOCATE ( dlat(jmdep) ) |
---|
1061 | |
---|
1062 | #ifdef NC_DOUBLE |
---|
1063 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,dlat_ini) |
---|
1064 | #else |
---|
1065 | ierr = NF_GET_VAR_REAL(ncid,dimid,dlat_ini) |
---|
1066 | #endif |
---|
1067 | if (ierr.ne.0) then |
---|
1068 | print *, NF_STRERROR(ierr) |
---|
1069 | STOP |
---|
1070 | ENDIF |
---|
1071 | ierr = NF_INQ_DIM(ncid,ndimid(3), namedim, lmdep) |
---|
1072 | if (ierr.ne.0) then |
---|
1073 | print *, NF_STRERROR(ierr) |
---|
1074 | STOP |
---|
1075 | ENDIF |
---|
1076 | print*,'variable ', namedim, 'dimension ', lmdep |
---|
1077 | ierr = NF_INQ_VARID(ncid,namedim,dimid) |
---|
1078 | if (ierr.ne.0) then |
---|
1079 | print *, NF_STRERROR(ierr) |
---|
1080 | STOP |
---|
1081 | ENDIF |
---|
1082 | #ifdef NC_DOUBLE |
---|
1083 | ierr = NF_GET_VAR_DOUBLE(ncid,dimid,timecoord) |
---|
1084 | #else |
---|
1085 | ierr = NF_GET_VAR_REAL(ncid,dimid,timecoord) |
---|
1086 | #endif |
---|
1087 | if (ierr.ne.0) then |
---|
1088 | print *, NF_STRERROR(ierr) |
---|
1089 | STOP |
---|
1090 | ENDIF |
---|
1091 | c |
---|
1092 | ALLOCATE ( champ(imdep*jmdep) ) |
---|
1093 | |
---|
1094 | DO l = 1, lmdep |
---|
1095 | dimfirst(1) = 1 |
---|
1096 | dimfirst(2) = 1 |
---|
1097 | dimfirst(3) = l |
---|
1098 | c |
---|
1099 | dimlast(1) = imdep |
---|
1100 | dimlast(2) = jmdep |
---|
1101 | dimlast(3) = 1 |
---|
1102 | c |
---|
1103 | PRINT*,'Lecture temporelle et int. horizontale ',l,timecoord(l) |
---|
1104 | #ifdef NC_DOUBLE |
---|
1105 | ierr = NF_GET_VARA_DOUBLE(ncid,varid,dimfirst,dimlast,champ) |
---|
1106 | #else |
---|
1107 | ierr = NF_GET_VARA_REAL(ncid,varid,dimfirst,dimlast,champ) |
---|
1108 | #endif |
---|
1109 | if (ierr.ne.0) then |
---|
1110 | print *, NF_STRERROR(ierr) |
---|
1111 | STOP |
---|
1112 | ENDIF |
---|
1113 | |
---|
1114 | title='Albedo Amip' |
---|
1115 | c |
---|
1116 | CALL conf_dat2d(title,imdep, jmdep, dlon_ini, dlat_ini, |
---|
1117 | . dlon, dlat, champ, interbar ) |
---|
1118 | c |
---|
1119 | c |
---|
1120 | IF ( interbar ) THEN |
---|
1121 | IF( l.EQ.1 ) THEN |
---|
1122 | WRITE(6,*) '-------------------------------------------------', |
---|
1123 | ,'------------------------' |
---|
1124 | WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ', |
---|
1125 | , ' pour l Albedo Amip $$$ ' |
---|
1126 | WRITE(6,*) '-------------------------------------------------', |
---|
1127 | ,'------------------------' |
---|
1128 | ENDIF |
---|
1129 | |
---|
1130 | CALL inter_barxy ( imdep,jmdep -1,dlon, dlat , |
---|
1131 | , champ, iim, jjm, rlonu, rlatv, jjp1, champint ) |
---|
1132 | ELSE |
---|
1133 | CALL grille_m(imdep, jmdep, dlon, dlat, champ, |
---|
1134 | . iim, jjp1, rlonv, rlatu, champint ) |
---|
1135 | ENDIF |
---|
1136 | c |
---|
1137 | DO j = 1,jjp1 |
---|
1138 | DO i = 1, iim |
---|
1139 | champtime (i, j, l) = champint(i, j) |
---|
1140 | ENDDO |
---|
1141 | ENDDO |
---|
1142 | ENDDO |
---|
1143 | c |
---|
1144 | DO l = 1, lmdep |
---|
1145 | timeyear(l) = timecoord(l) |
---|
1146 | ENDDO |
---|
1147 | print 222, timeyear |
---|
1148 | c |
---|
1149 | C interpolation temporelle |
---|
1150 | DO j = 1, jjp1 |
---|
1151 | DO i = 1, iim |
---|
1152 | DO l = 1, lmdep |
---|
1153 | ax(l) = timeyear(l) |
---|
1154 | ay(l) = champtime (i, j, l) |
---|
1155 | ENDDO |
---|
1156 | CALL SPLINE(ax,ay,lmdep,1.e30,1.e30,yder) |
---|
1157 | DO k = 1, 360 |
---|
1158 | time = FLOAT(k-1) |
---|
1159 | CALL SPLINT(ax,ay,yder,lmdep,time,by) |
---|
1160 | champan(i,j,k) = by |
---|
1161 | ENDDO |
---|
1162 | ENDDO |
---|
1163 | ENDDO |
---|
1164 | DO k = 1, 360 |
---|
1165 | DO j = 1, jjp1 |
---|
1166 | champan(iip1, j, k) = champan(1, j, k) |
---|
1167 | ENDDO |
---|
1168 | IF ( k.EQ.10 ) THEN |
---|
1169 | DO j = 1, jjp1 |
---|
1170 | CALL minmax( iip1,champan(1,j,10),chmin,chmax ) |
---|
1171 | PRINT *,' Albedo au temps 10 ', chmin,chmax,j |
---|
1172 | ENDDO |
---|
1173 | ENDIF |
---|
1174 | ENDDO |
---|
1175 | c |
---|
1176 | DO k = 1, 360 |
---|
1177 | CALL gr_dyn_fi(1, iip1, jjp1, klon, |
---|
1178 | . champan(1,1,k), phy_alb(1,k)) |
---|
1179 | ENDDO |
---|
1180 | c |
---|
1181 | ierr = NF_CLOSE(ncid) |
---|
1182 | c |
---|
1183 | c |
---|
1184 | DO k = 1, 360 |
---|
1185 | DO i = 1, klon |
---|
1186 | phy_bil(i,k) = 0.0 |
---|
1187 | ENDDO |
---|
1188 | ENDDO |
---|
1189 | c |
---|
1190 | PRINT*, 'Ecriture du fichier limit' |
---|
1191 | c |
---|
1192 | ierr = NF_CREATE ("limit.nc", NF_CLOBBER, nid) |
---|
1193 | c |
---|
1194 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 30, |
---|
1195 | . "Fichier conditions aux limites") |
---|
1196 | ierr = NF_DEF_DIM (nid, "points_physiques", klon, ndim) |
---|
1197 | ierr = NF_DEF_DIM (nid, "time", NF_UNLIMITED, ntim) |
---|
1198 | c |
---|
1199 | dims(1) = ndim |
---|
1200 | dims(2) = ntim |
---|
1201 | c |
---|
1202 | ierr = NF_DEF_VAR (nid, "TEMPS", NF_FLOAT, 1,ntim, id_tim) |
---|
1203 | ierr = NF_PUT_ATT_TEXT (nid, id_tim, "title", 17, |
---|
1204 | . "Jour dans l annee") |
---|
1205 | IF (newlmt) THEN |
---|
1206 | c |
---|
1207 | ierr = NF_DEF_VAR (nid, "FOCE", NF_FLOAT, 2,dims, id_FOCE) |
---|
1208 | ierr = NF_PUT_ATT_TEXT (nid, id_FOCE, "title", 14, |
---|
1209 | . "Fraction ocean") |
---|
1210 | c |
---|
1211 | ierr = NF_DEF_VAR (nid, "FSIC", NF_FLOAT, 2,dims, id_FSIC) |
---|
1212 | ierr = NF_PUT_ATT_TEXT (nid, id_FSIC, "title", 21, |
---|
1213 | . "Fraction glace de mer") |
---|
1214 | c |
---|
1215 | ierr = NF_DEF_VAR (nid, "FTER", NF_FLOAT, 2,dims, id_FTER) |
---|
1216 | ierr = NF_PUT_ATT_TEXT (nid, id_FTER, "title", 14, |
---|
1217 | . "Fraction terre") |
---|
1218 | c |
---|
1219 | ierr = NF_DEF_VAR (nid, "FLIC", NF_FLOAT, 2,dims, id_FLIC) |
---|
1220 | ierr = NF_PUT_ATT_TEXT (nid, id_FLIC, "title", 17, |
---|
1221 | . "Fraction land ice") |
---|
1222 | c |
---|
1223 | ELSE |
---|
1224 | ierr = NF_DEF_VAR (nid, "NAT", NF_FLOAT, 2,dims, id_NAT) |
---|
1225 | ierr = NF_PUT_ATT_TEXT (nid, id_NAT, "title", 23, |
---|
1226 | . "Nature du sol (0,1,2,3)") |
---|
1227 | ENDIF |
---|
1228 | ierr = NF_DEF_VAR (nid, "SST", NF_FLOAT, 2,dims, id_SST) |
---|
1229 | ierr = NF_PUT_ATT_TEXT (nid, id_SST, "title", 35, |
---|
1230 | . "Temperature superficielle de la mer") |
---|
1231 | ierr = NF_DEF_VAR (nid, "BILS", NF_FLOAT, 2,dims, id_BILS) |
---|
1232 | ierr = NF_PUT_ATT_TEXT (nid, id_BILS, "title", 32, |
---|
1233 | . "Reference flux de chaleur au sol") |
---|
1234 | ierr = NF_DEF_VAR (nid, "ALB", NF_FLOAT, 2,dims, id_ALB) |
---|
1235 | ierr = NF_PUT_ATT_TEXT (nid, id_ALB, "title", 19, |
---|
1236 | . "Albedo a la surface") |
---|
1237 | ierr = NF_DEF_VAR (nid, "RUG", NF_FLOAT, 2,dims, id_RUG) |
---|
1238 | ierr = NF_PUT_ATT_TEXT (nid, id_RUG, "title", 8, |
---|
1239 | . "Rugosite") |
---|
1240 | c |
---|
1241 | ierr = NF_ENDDEF(nid) |
---|
1242 | c |
---|
1243 | DO k = 1, 360 |
---|
1244 | c |
---|
1245 | debut(1) = 1 |
---|
1246 | debut(2) = k |
---|
1247 | epais(1) = klon |
---|
1248 | epais(2) = 1 |
---|
1249 | c |
---|
1250 | #ifdef NC_DOUBLE |
---|
1251 | ierr = NF_PUT_VAR1_DOUBLE (nid,id_tim,k,DBLE(k)) |
---|
1252 | c |
---|
1253 | IF (newlmt ) THEN |
---|
1254 | ierr = NF_PUT_VARA_DOUBLE (nid,id_FOCE,debut,epais |
---|
1255 | $ ,pctsrf_t(1,is_oce,k)) |
---|
1256 | ierr = NF_PUT_VARA_DOUBLE (nid,id_FSIC,debut,epais |
---|
1257 | $ ,pctsrf_t(1,is_sic,k)) |
---|
1258 | ierr = NF_PUT_VARA_DOUBLE (nid,id_FTER,debut,epais |
---|
1259 | $ ,pctsrf_t(1,is_ter,k)) |
---|
1260 | ierr = NF_PUT_VARA_DOUBLE (nid,id_FLIC,debut,epais |
---|
1261 | $ ,pctsrf_t(1,is_lic,k)) |
---|
1262 | ELSE |
---|
1263 | ierr = NF_PUT_VARA_DOUBLE (nid,id_NAT,debut,epais |
---|
1264 | $ ,phy_nat(1,k)) |
---|
1265 | ENDIF |
---|
1266 | c |
---|
1267 | ierr = NF_PUT_VARA_DOUBLE (nid,id_SST,debut,epais,phy_sst(1,k)) |
---|
1268 | ierr = NF_PUT_VARA_DOUBLE (nid,id_BILS,debut,epais,phy_bil(1,k)) |
---|
1269 | ierr = NF_PUT_VARA_DOUBLE (nid,id_ALB,debut,epais,phy_alb(1,k)) |
---|
1270 | ierr = NF_PUT_VARA_DOUBLE (nid,id_RUG,debut,epais,phy_rug(1,k)) |
---|
1271 | #else |
---|
1272 | ierr = NF_PUT_VAR1_REAL (nid,id_tim,k,FLOAT(k)) |
---|
1273 | IF (newlmt ) THEN |
---|
1274 | ierr = NF_PUT_VARA_REAL (nid,id_FOCE,debut,epais |
---|
1275 | $ ,pctsrf_t(1,is_oce,k)) |
---|
1276 | ierr = NF_PUT_VARA_REAL (nid,id_FSIC,debut,epais |
---|
1277 | $ ,pctsrf_t(1,is_sic,k)) |
---|
1278 | ierr = NF_PUT_VARA_REAL (nid,id_FTER,debut,epais |
---|
1279 | $ ,pctsrf_t(1,is_ter,k)) |
---|
1280 | ierr = NF_PUT_VARA_REAL (nid,id_FLIC,debut,epais |
---|
1281 | $ ,pctsrf_t(1,is_lic,k)) |
---|
1282 | ELSE |
---|
1283 | ierr = NF_PUT_VARA_REAL (nid,id_NAT,debut,epais |
---|
1284 | $ ,phy_nat(1,k)) |
---|
1285 | ENDIF |
---|
1286 | ierr = NF_PUT_VARA_REAL (nid,id_SST,debut,epais,phy_sst(1,k)) |
---|
1287 | ierr = NF_PUT_VARA_REAL (nid,id_BILS,debut,epais,phy_bil(1,k)) |
---|
1288 | ierr = NF_PUT_VARA_REAL (nid,id_ALB,debut,epais,phy_alb(1,k)) |
---|
1289 | ierr = NF_PUT_VARA_REAL (nid,id_RUG,debut,epais,phy_rug(1,k)) |
---|
1290 | #endif |
---|
1291 | c |
---|
1292 | ENDDO |
---|
1293 | c |
---|
1294 | ierr = NF_CLOSE(nid) |
---|
1295 | c |
---|
1296 | STOP |
---|
1297 | END |
---|