1 | program readmeteo |
---|
2 | |
---|
3 | implicit none |
---|
4 | include "netcdf.inc" |
---|
5 | |
---|
6 | !------------------------------------------------------------------------! |
---|
7 | ! Readmeteo prepares an initial state for the WPS pre-processor of WRF ! |
---|
8 | ! ! |
---|
9 | ! Input is a diagfi.nc NETCDF file from a LMD/GCM simulation ! |
---|
10 | ! ! |
---|
11 | ! Outputs are WRFSI intermediate format files ready for metgrid.exe ! |
---|
12 | ! http://www.mmm.ucar.edu/wrf/OnLineTutorial/WPS/IM_si.htm ! |
---|
13 | ! ! |
---|
14 | ! **** Please create a WPSFEED folder (or a symbolic link) **** ! |
---|
15 | ! ! |
---|
16 | ! A. Spiga - 16/04/2007 ! |
---|
17 | ! 22/05/2007 : need to run zrecast as a preliminary ! |
---|
18 | ! 07/06/2007 : external parameter file 'readmeteo.def ! |
---|
19 | ! 30/07/2007 : manage additional variables (tsoil, emiss,...) ! |
---|
20 | ! 19/10/2007 : no need to run zrecast at all (eta levels) ! |
---|
21 | ! 12/2007 : include co2ice and emissivity ! |
---|
22 | ! 02/2008 : include water vapor and ice ! |
---|
23 | ! 01/2010 : possible use of diagsoil for new physics ! |
---|
24 | ! 02/2011 : add dust tracers, correct surface ! |
---|
25 | ! ! |
---|
26 | ! spiga@lmd.jussieu.fr ! |
---|
27 | !------------------------------------------------------------------------! |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | !*************************************************************************** |
---|
32 | !*************************************************************************** |
---|
33 | REAL, PARAMETER :: emiss_prescribed=0.95 |
---|
34 | REAL, PARAMETER :: co2ice_prescribed=0. |
---|
35 | CHARACTER (LEN=3), PARAMETER :: ident='LMD' |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | !*************************************************************************** |
---|
40 | !*************************************************************************** |
---|
41 | |
---|
42 | REAL :: ptop |
---|
43 | REAL, PARAMETER :: grav=3.72 |
---|
44 | LOGICAL, PARAMETER :: blank=.false. |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | !! Variables to be written in the output file |
---|
49 | !! *** NB: conformity with metgrid/src/read_met_module.F90 |
---|
50 | CHARACTER (LEN=33) :: output |
---|
51 | INTEGER :: IFV |
---|
52 | CHARACTER (LEN=24) :: HDATE |
---|
53 | REAL :: XFCST |
---|
54 | CHARACTER (LEN=32) :: SOURCE |
---|
55 | CHARACTER (LEN=9) :: FIELD |
---|
56 | CHARACTER (LEN=25) :: UNITS |
---|
57 | CHARACTER (LEN=46) :: DESC |
---|
58 | REAL :: XLVL |
---|
59 | INTEGER :: NX,NY,IPROJ |
---|
60 | CHARACTER (LEN=8) :: STARTLOC |
---|
61 | REAL :: STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
62 | REAL, POINTER, DIMENSION(:,:) :: SLAB |
---|
63 | |
---|
64 | !! Variables related to NETCDF format |
---|
65 | integer :: nid,nid2,nid3,nvarid,ierr,ierr2 |
---|
66 | integer :: timedim,londim,latdim,altdim,altdim2 |
---|
67 | integer :: rlatvdim,rlonudim |
---|
68 | integer :: timelen,lonlen,latlen,altlen,altlen2 |
---|
69 | integer :: rlatvlen,rlonulen |
---|
70 | integer :: soillen,soildim |
---|
71 | integer :: nphys |
---|
72 | integer, dimension(4) :: corner,edges |
---|
73 | |
---|
74 | !! Intermediate data arrays |
---|
75 | integer :: k,l,m,n,p |
---|
76 | real, dimension(:), allocatable :: lat,lon,time,alt,aps,bps,levels,vertdsoil |
---|
77 | real, dimension(:,:), allocatable :: vide,ones,ghtsfile |
---|
78 | real, dimension(:,:), allocatable :: interm |
---|
79 | real, dimension(:,:,:), allocatable :: gwparam |
---|
80 | real, dimension(:,:,:), allocatable :: psfile,tsfile |
---|
81 | real, dimension(:,:,:), allocatable :: emissfile,co2icefile |
---|
82 | real, dimension(:,:,:), allocatable :: tnsfile,unsfile,vnsfile |
---|
83 | real, dimension(:,:,:,:), allocatable :: tfile,ufile,vfile,rfile,hfile |
---|
84 | real, dimension(:,:,:,:), allocatable :: eta_gcm |
---|
85 | !real, dimension(:,:,:,:), allocatable :: tfileorig,ufileorig,vfileorig |
---|
86 | real, dimension(:,:,:,:), allocatable :: tsoilfile, dsoilfile, isoilfile |
---|
87 | real, dimension(:,:,:,:), allocatable :: waterfile, watericefile |
---|
88 | real, dimension(:,:,:), allocatable :: swatericefile!, swaterfile |
---|
89 | real, dimension(:,:,:,:), allocatable :: dustfile,dustnfile |
---|
90 | real, dimension(:,:,:,:), allocatable :: co2file |
---|
91 | real, dimension(:,:,:,:), allocatable :: ccnfile,ccnnfile |
---|
92 | |
---|
93 | !! Reading the parameter file |
---|
94 | integer :: tmp,increment,FILES |
---|
95 | integer :: tmp2,tmp3,tmp4 |
---|
96 | character*1 :: answer |
---|
97 | character*4 :: str |
---|
98 | character*2 :: str2, str3, str4 |
---|
99 | integer, dimension(:), allocatable :: time_out |
---|
100 | character*13, dimension(:), allocatable :: date_out |
---|
101 | character*19, dimension(:), allocatable :: date_out2 |
---|
102 | |
---|
103 | #ifdef PHOTOCHEM |
---|
104 | real, dimension(:,:,:,:,:), allocatable :: chemtrac |
---|
105 | integer :: nchemtrac,i |
---|
106 | CHARACTER*20,DIMENSION(:),ALLOCATABLE :: wtnom |
---|
107 | #endif |
---|
108 | |
---|
109 | |
---|
110 | !*************************************************************************** |
---|
111 | !*************************************************************************** |
---|
112 | |
---|
113 | |
---|
114 | !!--------------------- |
---|
115 | !! Open the datafile |
---|
116 | !!--------------------- |
---|
117 | ierr=NF_OPEN ("input_diagfi.nc",NF_NOWRITE,nid) |
---|
118 | IF (ierr.NE.NF_NOERR) THEN |
---|
119 | write(*,*)'**** Please create a symbolic link called input_diagfi.nc' |
---|
120 | CALL ABORT |
---|
121 | ENDIF |
---|
122 | |
---|
123 | |
---|
124 | !!-------------------------- |
---|
125 | !! Ask for data references |
---|
126 | !!-------------------------- |
---|
127 | !write(*,*) "Create n files. What is n ?" |
---|
128 | read(*,*) FILES |
---|
129 | allocate(time_out(FILES)) |
---|
130 | allocate(date_out(FILES)) |
---|
131 | allocate(date_out2(FILES)) |
---|
132 | |
---|
133 | !write(*,*) "" |
---|
134 | !write(*,*) "INPUT: Diagfi time" |
---|
135 | !write(*,*) "list of n subscripts, separated by <Return>s" |
---|
136 | increment=1 |
---|
137 | do while (increment.ne.FILES+1) |
---|
138 | read(*,*) tmp |
---|
139 | time_out(increment)=tmp |
---|
140 | increment=increment+1 |
---|
141 | enddo |
---|
142 | |
---|
143 | !write(*,*) "" |
---|
144 | !write(*,*) "OUTPUT: WRF time" |
---|
145 | !write(*,*) "fill 4 lines indicating" |
---|
146 | !write(*,*) "-year (4 digits)" |
---|
147 | !write(*,*) "-month (2 digits)" |
---|
148 | !write(*,*) "-day (2 digits)" |
---|
149 | !write(*,*) "-hour (2 digits)" |
---|
150 | increment=1 |
---|
151 | do while (increment.ne.FILES+1) |
---|
152 | read(*,*) str |
---|
153 | read(*,*) str2 |
---|
154 | read(*,*) str3 |
---|
155 | read(*,*) str4 |
---|
156 | date_out(increment)=str//'-'//str2//'-'//str3//'_'//str4 |
---|
157 | date_out2(increment)=str//'-'//str2//'-'//str3//'_'//str4//':00:00' |
---|
158 | !print *,date_out(increment) |
---|
159 | !write(*,*) "ok? (y/n)" |
---|
160 | read(*,*) answer |
---|
161 | if (answer.eq.'n') then |
---|
162 | !write(*,*) "please write again" |
---|
163 | else |
---|
164 | !write(*,*) "next one, please" |
---|
165 | increment=increment+1 |
---|
166 | endif |
---|
167 | enddo |
---|
168 | |
---|
169 | |
---|
170 | !!------------------- |
---|
171 | !! Get array sizes |
---|
172 | !!------------------- |
---|
173 | SELECT CASE(ident) |
---|
174 | CASE('LMD') |
---|
175 | ierr=NF_INQ_DIMID(nid,"Time",timedim) |
---|
176 | CASE('OXF') |
---|
177 | ierr=NF_INQ_DIMID(nid,"time",timedim) |
---|
178 | END SELECT |
---|
179 | ierr=NF_INQ_DIMLEN(nid,timedim,timelen) |
---|
180 | write(*,*) "timelen: ",timelen |
---|
181 | |
---|
182 | SELECT CASE(ident) |
---|
183 | CASE('LMD') |
---|
184 | ierr=NF_INQ_DIMID(nid,"latitude",latdim) |
---|
185 | CASE('OXF') |
---|
186 | ierr=NF_INQ_DIMID(nid,"lat",latdim) |
---|
187 | END SELECT |
---|
188 | ierr=NF_INQ_DIMLEN(nid,latdim,latlen) |
---|
189 | write(*,*) "latlen: ",latlen |
---|
190 | |
---|
191 | SELECT CASE(ident) |
---|
192 | CASE('LMD') |
---|
193 | ierr=NF_INQ_DIMID(nid,"longitude",londim) |
---|
194 | CASE('OXF') |
---|
195 | ierr=NF_INQ_DIMID(nid,"lon",londim) |
---|
196 | END SELECT |
---|
197 | ierr=NF_INQ_DIMLEN(nid,londim,lonlen) |
---|
198 | write(*,*) "lonlen: ",lonlen |
---|
199 | |
---|
200 | SELECT CASE(ident) |
---|
201 | CASE('LMD') |
---|
202 | ierr=NF_INQ_DIMID(nid,"altitude",altdim) |
---|
203 | CASE('OXF') |
---|
204 | ierr=NF_INQ_DIMID(nid,"sigma",altdim) |
---|
205 | END SELECT |
---|
206 | ierr=NF_INQ_DIMLEN(nid,altdim,altlen) |
---|
207 | write(*,*) "altlen: ",altlen |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | !!------------------------- |
---|
212 | !! Allocate local arrays |
---|
213 | !!------------------------- |
---|
214 | allocate(eta_gcm(lonlen,latlen,altlen,timelen)) |
---|
215 | allocate(tfile(lonlen,latlen,altlen,timelen)) |
---|
216 | allocate(tsoilfile(lonlen,latlen,altlen,timelen)) |
---|
217 | allocate(dsoilfile(lonlen,latlen,altlen,timelen)) |
---|
218 | allocate(isoilfile(lonlen,latlen,altlen,timelen)) |
---|
219 | allocate(vertdsoil(altlen)) |
---|
220 | !allocate(tfileorig(lonlen,latlen,altlen,timelen)) |
---|
221 | allocate(ufile(lonlen,latlen,altlen,timelen)) |
---|
222 | !allocate(ufileorig(lonlen,latlen,altlen,timelen)) |
---|
223 | allocate(vfile(lonlen,latlen,altlen,timelen)) |
---|
224 | !allocate(vfileorig(lonlen,latlen,altlen,timelen)) |
---|
225 | allocate(rfile(lonlen,latlen,altlen,timelen)) |
---|
226 | allocate(hfile(lonlen,latlen,altlen,timelen)) |
---|
227 | allocate(waterfile(lonlen,latlen,altlen,timelen)) |
---|
228 | allocate(watericefile(lonlen,latlen,altlen,timelen)) |
---|
229 | !allocate(swaterfile(lonlen,latlen,timelen)) |
---|
230 | allocate(swatericefile(lonlen,latlen,timelen)) |
---|
231 | allocate(dustfile(lonlen,latlen,altlen,timelen)) |
---|
232 | allocate(dustnfile(lonlen,latlen,altlen,timelen)) |
---|
233 | allocate(co2file(lonlen,latlen,altlen,timelen)) |
---|
234 | allocate(ccnfile(lonlen,latlen,altlen,timelen)) |
---|
235 | allocate(ccnnfile(lonlen,latlen,altlen,timelen)) |
---|
236 | allocate(psfile(lonlen,latlen,timelen)) |
---|
237 | allocate(tsfile(lonlen,latlen,timelen)) |
---|
238 | allocate(tnsfile(lonlen,latlen,timelen)) |
---|
239 | allocate(unsfile(lonlen,latlen,timelen)) |
---|
240 | allocate(vnsfile(lonlen,latlen,timelen)) |
---|
241 | allocate(emissfile(lonlen,latlen,timelen)) |
---|
242 | allocate(co2icefile(lonlen,latlen,timelen)) |
---|
243 | allocate(interm(lonlen,latlen)) |
---|
244 | allocate(gwparam(lonlen,latlen,5)) |
---|
245 | allocate(ghtsfile(lonlen,latlen)) !! no scan axis |
---|
246 | allocate(vide(lonlen,latlen)) |
---|
247 | allocate(ones(lonlen,latlen)) |
---|
248 | allocate(lat(latlen), lon(lonlen), alt(altlen), time(timelen)) |
---|
249 | allocate(aps(altlen),bps(altlen),levels(altlen)) |
---|
250 | #ifdef PHOTOCHEM |
---|
251 | nchemtrac = 14 |
---|
252 | allocate(wtnom(nchemtrac)) |
---|
253 | wtnom(1) = "c_co2" |
---|
254 | wtnom(2) = "c_co" |
---|
255 | wtnom(3) = "c_o" |
---|
256 | wtnom(4) = "c_o1d" |
---|
257 | wtnom(5) = "c_o2" |
---|
258 | wtnom(6) = "c_o3" |
---|
259 | wtnom(7) = "c_h" |
---|
260 | wtnom(8) = "c_h2" |
---|
261 | wtnom(9) = "c_oh" |
---|
262 | wtnom(10) = "c_ho2" |
---|
263 | wtnom(11) = "c_h2o2" |
---|
264 | wtnom(12) = "c_ch4" |
---|
265 | wtnom(13) = "c_n2" |
---|
266 | wtnom(14) = "c_ar" |
---|
267 | allocate(chemtrac(lonlen,latlen,altlen,timelen,nchemtrac)) |
---|
268 | chemtrac(:,:,:,:,:)=0 |
---|
269 | #endif |
---|
270 | |
---|
271 | tfile(:,:,:,:)=0 |
---|
272 | tsoilfile(:,:,:,:)=0 |
---|
273 | isoilfile(:,:,:,:)=0 |
---|
274 | dsoilfile(:,:,:,:)=0 |
---|
275 | vertdsoil(:)=0. |
---|
276 | !tfileorig(:,:,:,:)=0 |
---|
277 | !ufileorig(:,:,:,:)=0 |
---|
278 | !vfileorig(:,:,:,:)=0 |
---|
279 | ufile(:,:,:,:)=0 |
---|
280 | vfile(:,:,:,:)=0 |
---|
281 | rfile(:,:,:,:)=0 |
---|
282 | hfile(:,:,:,:)=0 |
---|
283 | waterfile(:,:,:,:)=0 |
---|
284 | watericefile(:,:,:,:)=0 |
---|
285 | !swaterfile(:,:,:)=0 |
---|
286 | swatericefile(:,:,:)=0 |
---|
287 | dustfile(:,:,:,:)=0 |
---|
288 | dustnfile(:,:,:,:)=0 |
---|
289 | co2file(:,:,:,:)=0 |
---|
290 | ccnfile(:,:,:,:)=0 |
---|
291 | ccnnfile(:,:,:,:)=0 |
---|
292 | psfile(:,:,:)=0 |
---|
293 | tsfile(:,:,:)=0 |
---|
294 | emissfile(:,:,:)=0 |
---|
295 | co2icefile(:,:,:)=0 |
---|
296 | tnsfile(:,:,:)=0 |
---|
297 | unsfile(:,:,:)=0 |
---|
298 | vnsfile(:,:,:)=0 |
---|
299 | interm(:,:)=0 |
---|
300 | gwparam(:,:,:)=0 |
---|
301 | ghtsfile(:,:)=0 |
---|
302 | vide(:,:)=0 |
---|
303 | ones(:,:)=0 |
---|
304 | |
---|
305 | |
---|
306 | !!------------------- |
---|
307 | !! Read dimensions |
---|
308 | !!------------------- |
---|
309 | |
---|
310 | print *,'>>> Read dimensions !' |
---|
311 | |
---|
312 | print *,'Time' |
---|
313 | SELECT CASE(ident) |
---|
314 | CASE('LMD') |
---|
315 | ierr = NF_INQ_VARID (nid, "Time",nvarid) |
---|
316 | CASE('OXF') |
---|
317 | ierr = NF_INQ_VARID (nid, "time",nvarid) |
---|
318 | END SELECT |
---|
319 | IF (ierr .NE. NF_NOERR) THEN |
---|
320 | PRINT *, "Error: Readmeteo <Time> not found" |
---|
321 | stop |
---|
322 | ENDIF |
---|
323 | #ifdef NC_DOUBLE |
---|
324 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, time) |
---|
325 | #else |
---|
326 | ierr = NF_GET_VAR_REAL(nid, nvarid, time) |
---|
327 | #endif |
---|
328 | print *,time(1),' ... to ... ',time(timelen) |
---|
329 | |
---|
330 | print *,'Latitude' |
---|
331 | SELECT CASE(ident) |
---|
332 | CASE('LMD') |
---|
333 | ierr = NF_INQ_VARID (nid, "latitude",nvarid) |
---|
334 | CASE('OXF') |
---|
335 | ierr = NF_INQ_VARID (nid, "lat",nvarid) |
---|
336 | END SELECT |
---|
337 | IF (ierr .NE. NF_NOERR) THEN |
---|
338 | PRINT *, "Error: Readmeteo <latitude> not found" |
---|
339 | stop |
---|
340 | ENDIF |
---|
341 | #ifdef NC_DOUBLE |
---|
342 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, lat) |
---|
343 | #else |
---|
344 | ierr = NF_GET_VAR_REAL(nid, nvarid, lat) |
---|
345 | #endif |
---|
346 | print *,lat(1),' ... to ... ',lat(latlen),' ... step: ',lat(latlen)-lat(latlen-1) |
---|
347 | |
---|
348 | print *,'Longitude' |
---|
349 | SELECT CASE(ident) |
---|
350 | CASE('LMD') |
---|
351 | ierr = NF_INQ_VARID (nid, "longitude",nvarid) |
---|
352 | CASE('OXF') |
---|
353 | ierr = NF_INQ_VARID (nid, "lon",nvarid) |
---|
354 | END SELECT |
---|
355 | IF (ierr .NE. NF_NOERR) THEN |
---|
356 | PRINT *, "Error: Readmeteo <longitude> not found" |
---|
357 | stop |
---|
358 | ENDIF |
---|
359 | #ifdef NC_DOUBLE |
---|
360 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, lon) |
---|
361 | #else |
---|
362 | ierr = NF_GET_VAR_REAL(nid, nvarid, lon) |
---|
363 | #endif |
---|
364 | print *,lon(1),' ... to ... ',lon(lonlen),' ... step: ',lon(lonlen)-lon(lonlen-1) |
---|
365 | |
---|
366 | SELECT CASE(ident) |
---|
367 | CASE('LMD') |
---|
368 | print *, 'Hybrid coordinates' |
---|
369 | ierr = NF_INQ_VARID (nid, "aps", nvarid) |
---|
370 | IF (ierr .NE. NF_NOERR) THEN |
---|
371 | PRINT *, "Error: Readmeteo <aps> not found" |
---|
372 | stop |
---|
373 | ENDIF |
---|
374 | #ifdef NC_DOUBLE |
---|
375 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, aps) |
---|
376 | #else |
---|
377 | ierr = NF_GET_VAR_REAL(nid, nvarid, aps) |
---|
378 | #endif |
---|
379 | ierr = NF_INQ_VARID (nid, "bps", nvarid) |
---|
380 | IF (ierr .NE. NF_NOERR) THEN |
---|
381 | PRINT *, "Error: Readmeteo <bps> not found" |
---|
382 | stop |
---|
383 | ENDIF |
---|
384 | #ifdef NC_DOUBLE |
---|
385 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, bps) |
---|
386 | #else |
---|
387 | ierr = NF_GET_VAR_REAL(nid, nvarid, bps) |
---|
388 | #endif |
---|
389 | print *,aps(1),' ... to ... ',aps(altlen) |
---|
390 | print *,bps(1),' ... to ... ',bps(altlen) |
---|
391 | CASE('OXF') |
---|
392 | ierr = NF_INQ_VARID (nid, "sigma", nvarid) |
---|
393 | IF (ierr .NE. NF_NOERR) THEN |
---|
394 | PRINT *, "Error: Readmeteo <sigma> not found" |
---|
395 | stop |
---|
396 | ENDIF |
---|
397 | #ifdef NC_DOUBLE |
---|
398 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, bps) |
---|
399 | #else |
---|
400 | ierr = NF_GET_VAR_REAL(nid, nvarid, bps) |
---|
401 | #endif |
---|
402 | print *,bps(1),' ... to ... ',bps(altlen) |
---|
403 | END SELECT |
---|
404 | |
---|
405 | |
---|
406 | !!------------------------------------------- |
---|
407 | !! Reading 2D and 3D meteorological fields |
---|
408 | !!------------------------------------------- |
---|
409 | |
---|
410 | IF (blank .EQV. .false.) THEN |
---|
411 | |
---|
412 | print *,'>>> Read 2D optional fields !' |
---|
413 | |
---|
414 | print *,'Emissivity' |
---|
415 | ierr = NF_INQ_VARID (nid,"emis",nvarid) |
---|
416 | IF (ierr .NE. NF_NOERR) THEN |
---|
417 | PRINT *, '...warning: not found in diagfi !' |
---|
418 | PRINT *, '...will be filled with a prescribed value', emiss_prescribed |
---|
419 | emissfile(:,:,:)=emiss_prescribed |
---|
420 | ELSE |
---|
421 | #ifdef NC_DOUBLE |
---|
422 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, emissfile) |
---|
423 | #else |
---|
424 | ierr = NF_GET_VAR_REAL(nid, nvarid, emissfile) |
---|
425 | #endif |
---|
426 | ENDIF |
---|
427 | |
---|
428 | print *,'CO2 ice' |
---|
429 | ierr = NF_INQ_VARID (nid,"co2ice",nvarid) |
---|
430 | IF (ierr .NE. NF_NOERR) THEN |
---|
431 | PRINT *, '...warning: not found in diagfi !' |
---|
432 | PRINT *, '...will be filled with a prescribed value', co2ice_prescribed |
---|
433 | co2icefile(:,:,:)=co2ice_prescribed |
---|
434 | ELSE |
---|
435 | #ifdef NC_DOUBLE |
---|
436 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, co2icefile) |
---|
437 | #else |
---|
438 | ierr = NF_GET_VAR_REAL(nid, nvarid, co2icefile) |
---|
439 | #endif |
---|
440 | ENDIF |
---|
441 | |
---|
442 | print *,'>>> Read 2D surface fields !' |
---|
443 | |
---|
444 | print *,'Surface Pressure' |
---|
445 | ierr = NF_INQ_VARID (nid,"ps",nvarid) |
---|
446 | IF (ierr .NE. NF_NOERR) THEN |
---|
447 | PRINT *, "Error: Readmeteo <ps> not found" |
---|
448 | stop |
---|
449 | ENDIF |
---|
450 | #ifdef NC_DOUBLE |
---|
451 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, psfile) |
---|
452 | #else |
---|
453 | ierr = NF_GET_VAR_REAL(nid, nvarid, psfile) |
---|
454 | #endif |
---|
455 | |
---|
456 | print *,'Ground Temperature' |
---|
457 | ierr = NF_INQ_VARID (nid,"tsurf",nvarid) |
---|
458 | IF (ierr .NE. NF_NOERR) THEN |
---|
459 | PRINT *, "Error: Readmeteo <tsurf> not found" |
---|
460 | stop |
---|
461 | ENDIF |
---|
462 | #ifdef NC_DOUBLE |
---|
463 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tsfile) |
---|
464 | #else |
---|
465 | ierr = NF_GET_VAR_REAL(nid, nvarid, tsfile) |
---|
466 | #endif |
---|
467 | |
---|
468 | |
---|
469 | !!!"atmospheric" surface temperature is taken |
---|
470 | !!!from original diagfi.nc first level |
---|
471 | !!!... level is ~3-5 meters |
---|
472 | !print *,'Near-Surface Temperature' |
---|
473 | ! ierr = NF_INQ_VARID (nid,"temp",nvarid) |
---|
474 | ! IF (ierr .NE. NF_NOERR) THEN |
---|
475 | ! ierr = NF_INQ_VARID (nid,"t",nvarid) |
---|
476 | ! IF (ierr .NE. NF_NOERR) THEN |
---|
477 | ! PRINT *, "Error: Readmeteo <temp> not found" |
---|
478 | ! stop |
---|
479 | ! ENDIF |
---|
480 | ! ENDIF |
---|
481 | !#ifdef NC_DOUBLE |
---|
482 | ! ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tfileorig) |
---|
483 | !#else |
---|
484 | ! ierr = NF_GET_VAR_REAL(nid, nvarid, tfileorig) |
---|
485 | !#endif |
---|
486 | ! tnsfile=tfileorig(:,:,1,:) |
---|
487 | |
---|
488 | !!!"atmospheric" surface u is taken |
---|
489 | !!!from original diagfi.nc first level |
---|
490 | !!!... level is ~3-5 meters |
---|
491 | !print *,'Near-Surface Zonal Wind' |
---|
492 | ! ierr = NF_INQ_VARID (nid,"u",nvarid) |
---|
493 | ! IF (ierr .NE. NF_NOERR) THEN |
---|
494 | ! PRINT *, "Error: Readmeteo <u> not found" |
---|
495 | ! stop |
---|
496 | ! ENDIF |
---|
497 | !#ifdef NC_DOUBLE |
---|
498 | ! ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ufileorig) |
---|
499 | !#else |
---|
500 | ! ierr = NF_GET_VAR_REAL(nid, nvarid, ufileorig) |
---|
501 | !#endif |
---|
502 | ! unsfile=ufileorig(:,:,1,:) |
---|
503 | |
---|
504 | !!!"atmospheric" surface v is taken |
---|
505 | !!!from original diagfi.nc first level |
---|
506 | !!!... level is ~3-5 meters |
---|
507 | !print *,'Near-Surface Meridional Wind' |
---|
508 | ! ierr = NF_INQ_VARID (nid,"v",nvarid) |
---|
509 | ! IF (ierr .NE. NF_NOERR) THEN |
---|
510 | ! PRINT *, "Error: Readmeteo <v> not found" |
---|
511 | ! stop |
---|
512 | ! ENDIF |
---|
513 | !#ifdef NC_DOUBLE |
---|
514 | ! ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vfileorig) |
---|
515 | !#else |
---|
516 | ! ierr = NF_GET_VAR_REAL(nid, nvarid, vfileorig) |
---|
517 | !#endif |
---|
518 | ! vnsfile=vfileorig(:,:,1,:) |
---|
519 | |
---|
520 | SELECT CASE(ident) |
---|
521 | CASE('LMD') |
---|
522 | print *,'Geopotential height at the ground' |
---|
523 | ierr = NF_INQ_VARID (nid,"phisinit",nvarid) |
---|
524 | IF (ierr .NE. NF_NOERR) THEN |
---|
525 | PRINT *, "Error: Readmeteo <phisinit> not found" |
---|
526 | stop |
---|
527 | ENDIF |
---|
528 | #ifdef NC_DOUBLE |
---|
529 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ghtsfile) |
---|
530 | #else |
---|
531 | ierr = NF_GET_VAR_REAL(nid, nvarid, ghtsfile) |
---|
532 | #endif |
---|
533 | !**** from geopotential to geopotential height |
---|
534 | ghtsfile=ghtsfile/grav |
---|
535 | !**** |
---|
536 | CASE('OXF') |
---|
537 | ! |
---|
538 | ! geopotential height ~ altimetry |
---|
539 | ! |
---|
540 | print *,'Geopotential height at the ground from file mountain_new.nc' |
---|
541 | ierr=NF_OPEN("mountain_new.nc",NF_NOWRITE,nid3) |
---|
542 | if (ierr.ne.NF_NOERR) then |
---|
543 | write(*,*) "Error: Could not open that file either" |
---|
544 | stop "Might as well stop here" |
---|
545 | endif |
---|
546 | ierr=NF_INQ_VARID(nid3,"orography",nvarid) |
---|
547 | ierr=NF_GET_VAR_REAL(nid3,nvarid,ghtsfile) |
---|
548 | if (ierr.ne.NF_NOERR) then |
---|
549 | stop "Error: Failed reading phisinit" |
---|
550 | endif |
---|
551 | ierr=NF_CLOSE(nid3) |
---|
552 | END SELECT |
---|
553 | |
---|
554 | |
---|
555 | print *,'>>> Read 3D meteorological fields ! - This may take some time ...' |
---|
556 | |
---|
557 | print *,'Temperature' |
---|
558 | ierr = NF_INQ_VARID (nid,"temp",nvarid) |
---|
559 | IF (ierr .NE. NF_NOERR) THEN |
---|
560 | ierr = NF_INQ_VARID (nid,"t",nvarid) |
---|
561 | IF (ierr .NE. NF_NOERR) THEN |
---|
562 | PRINT *, "Error: Readmeteo <t> not found" |
---|
563 | stop |
---|
564 | ENDIF |
---|
565 | ENDIF |
---|
566 | #ifdef NC_DOUBLE |
---|
567 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tfile) |
---|
568 | #else |
---|
569 | ierr = NF_GET_VAR_REAL(nid, nvarid, tfile) |
---|
570 | #endif |
---|
571 | tnsfile=tfile(:,:,1,:) |
---|
572 | |
---|
573 | print *,'Zonal wind' |
---|
574 | ierr = NF_INQ_VARID (nid,"u",nvarid) |
---|
575 | IF (ierr .NE. NF_NOERR) THEN |
---|
576 | PRINT *, "Error: Readmeteo <u> not found" |
---|
577 | stop |
---|
578 | ENDIF |
---|
579 | #ifdef NC_DOUBLE |
---|
580 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ufile) |
---|
581 | #else |
---|
582 | ierr = NF_GET_VAR_REAL(nid, nvarid, ufile) |
---|
583 | #endif |
---|
584 | unsfile=ufile(:,:,1,:) |
---|
585 | |
---|
586 | print *,'Meridional wind' |
---|
587 | ierr = NF_INQ_VARID (nid,"v",nvarid) |
---|
588 | IF (ierr .NE. NF_NOERR) THEN |
---|
589 | PRINT *, "Error: Readmeteo <v> not found" |
---|
590 | stop |
---|
591 | ENDIF |
---|
592 | #ifdef NC_DOUBLE |
---|
593 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vfile) |
---|
594 | #else |
---|
595 | ierr = NF_GET_VAR_REAL(nid, nvarid, vfile) |
---|
596 | #endif |
---|
597 | vnsfile=ufile(:,:,1,:) |
---|
598 | |
---|
599 | |
---|
600 | !!------------------------ |
---|
601 | !! special water stuff |
---|
602 | !!------------------------ |
---|
603 | print *,'Water vapor' |
---|
604 | ierr=NF_INQ_VARID(nid,"q02",nvarid) |
---|
605 | if (ierr.ne.NF_NOERR) then |
---|
606 | write(*,*) "...No q02 - Water vapor set to 0" |
---|
607 | waterfile(:,:,:,:)=0. |
---|
608 | else |
---|
609 | ierr=NF_GET_VAR_REAL(nid,nvarid,waterfile) |
---|
610 | endif |
---|
611 | |
---|
612 | print *,'Water ice' |
---|
613 | ierr=NF_INQ_VARID(nid,"q01",nvarid) |
---|
614 | if (ierr.ne.NF_NOERR) then |
---|
615 | write(*,*) "...No q01 - Water ice set to 0" |
---|
616 | watericefile(:,:,:,:)=0. |
---|
617 | else |
---|
618 | ierr=NF_GET_VAR_REAL(nid,nvarid,watericefile) |
---|
619 | endif |
---|
620 | ! print *,'Surface Water vapor' |
---|
621 | ! ierr=NF_INQ_VARID(nid,"qsurf02",nvarid) |
---|
622 | ! if (ierr.ne.NF_NOERR) then |
---|
623 | ! write(*,*) "...No qsurf02 - surface Water vapor set to 0" |
---|
624 | ! swaterfile(:,:,:)=0. |
---|
625 | ! endif |
---|
626 | ! ierr=NF_GET_VAR_REAL(nid,nvarid,swaterfile) |
---|
627 | |
---|
628 | print *,'Surface Water ice' |
---|
629 | !!!!!! ATTENTION ATTENTION |
---|
630 | !!!!!! water ice a la surface est qsurf(ig,nqmx) |
---|
631 | ierr=NF_INQ_VARID(nid,"qsurf02",nvarid) |
---|
632 | if (ierr.ne.NF_NOERR) then |
---|
633 | write(*,*) "...No qsurf02 - surface Water ice set to 0" |
---|
634 | swatericefile(:,:,:)=0. |
---|
635 | else |
---|
636 | ierr=NF_GET_VAR_REAL(nid,nvarid,swatericefile) |
---|
637 | endif |
---|
638 | !!------------------------ |
---|
639 | !! special water stuff |
---|
640 | !!------------------------ |
---|
641 | |
---|
642 | print *,'CO2 mass mixing ratio' |
---|
643 | ierr=NF_INQ_VARID(nid,"co2",nvarid) |
---|
644 | if (ierr.ne.NF_NOERR) then |
---|
645 | write(*,*) "...No co2 - co2 mixing ratio set to 0.95" |
---|
646 | co2file(:,:,:,:)=0.95 |
---|
647 | else |
---|
648 | ierr=NF_GET_VAR_REAL(nid,nvarid,co2file) |
---|
649 | endif |
---|
650 | |
---|
651 | !!------------------------ |
---|
652 | !! special dust stuff |
---|
653 | !!------------------------ |
---|
654 | print *,'Dust mass' |
---|
655 | ierr=NF_INQ_VARID(nid,"dustq",nvarid) |
---|
656 | if (ierr.ne.NF_NOERR) then |
---|
657 | write(*,*) "...No dustq - Dust mass set to 0" |
---|
658 | dustfile(:,:,:,:)=0. |
---|
659 | else |
---|
660 | ierr=NF_GET_VAR_REAL(nid,nvarid,dustfile) |
---|
661 | endif |
---|
662 | |
---|
663 | print *,'Dust number' |
---|
664 | ierr=NF_INQ_VARID(nid,"dustN",nvarid) |
---|
665 | if (ierr.ne.NF_NOERR) then |
---|
666 | write(*,*) "...No dustN - Dust number set to 0" |
---|
667 | dustnfile(:,:,:,:)=0. |
---|
668 | else |
---|
669 | ierr=NF_GET_VAR_REAL(nid,nvarid,dustnfile) |
---|
670 | endif |
---|
671 | |
---|
672 | print *,'CCN mass' |
---|
673 | ierr=NF_INQ_VARID(nid,"ccn",nvarid) |
---|
674 | if (ierr.ne.NF_NOERR) then |
---|
675 | write(*,*) "...No ccn - CCN mass set to 0" |
---|
676 | ccnfile(:,:,:,:)=0. |
---|
677 | else |
---|
678 | ierr=NF_GET_VAR_REAL(nid,nvarid,ccnfile) |
---|
679 | endif |
---|
680 | |
---|
681 | print *,'CCN number' |
---|
682 | ierr=NF_INQ_VARID(nid,"ccnN",nvarid) |
---|
683 | if (ierr.ne.NF_NOERR) then |
---|
684 | write(*,*) "...No ccnN - CCN number set to 0" |
---|
685 | ccnnfile(:,:,:,:)=0. |
---|
686 | else |
---|
687 | ierr=NF_GET_VAR_REAL(nid,nvarid,ccnnfile) |
---|
688 | endif |
---|
689 | !!------------------------ |
---|
690 | !! special dust stuff |
---|
691 | !!------------------------ |
---|
692 | |
---|
693 | !SELECT CASE(ident) |
---|
694 | !CASE('LMD') |
---|
695 | |
---|
696 | print *,'Soil temperatures' |
---|
697 | ierr=NF_INQ_VARID(nid,"tsoil",nvarid) |
---|
698 | if (ierr.ne.NF_NOERR) then |
---|
699 | write(*,*) "...No tsoil - Soil temperatures set isothermal with surface temperature" |
---|
700 | DO l=1,altlen |
---|
701 | tsoilfile(:,:,l,:)=tsfile(:,:,:) |
---|
702 | ENDDO |
---|
703 | else |
---|
704 | ierr=NF_GET_VAR_REAL(nid,nvarid,tsoilfile) |
---|
705 | endif |
---|
706 | |
---|
707 | !!!!!!!! |
---|
708 | !!!!!!!! new physics (but still compatible with old physics) |
---|
709 | print *,'Soil depths' |
---|
710 | ierr=NF_INQ_VARID(nid,"soildepth",nvarid) |
---|
711 | if (ierr.ne.NF_NOERR) then |
---|
712 | write(*,*) "...No soildepth - Set to -999" !!! see soil_settings in LMD physics |
---|
713 | DO l=1,altlen |
---|
714 | vertdsoil(l)=-999. |
---|
715 | ENDDO |
---|
716 | else |
---|
717 | ierr=NF_GET_VAR_REAL(nid,nvarid,vertdsoil) |
---|
718 | endif |
---|
719 | print *, 'wait a minute' !! AS: I know this could be better |
---|
720 | DO m=1,lonlen |
---|
721 | DO n=1,latlen |
---|
722 | DO p=1,timelen |
---|
723 | dsoilfile(m,n,:,p) = vertdsoil(:) |
---|
724 | ENDDO |
---|
725 | ENDDO |
---|
726 | ENDDO |
---|
727 | DEALLOCATE(vertdsoil) |
---|
728 | |
---|
729 | print *,'Soil thermal inertia' |
---|
730 | ierr=NF_INQ_VARID(nid,"inertiedat",nvarid) |
---|
731 | if (ierr.ne.NF_NOERR) then |
---|
732 | write(*,*) "...No soil therm. inert. - Set to -999" |
---|
733 | DO l=1,altlen |
---|
734 | isoilfile(:,:,l,:)=-999. |
---|
735 | ENDDO |
---|
736 | else |
---|
737 | ierr=NF_GET_VAR_REAL(nid,nvarid,isoilfile) |
---|
738 | endif |
---|
739 | !!!!!!!! |
---|
740 | !!!!!!!! new physics |
---|
741 | |
---|
742 | |
---|
743 | !!!!!!!!!!!!!!!!!!!!!!!!NEW PHYSICS + PHOTOCHEM |
---|
744 | !!!!!!!!!!!!!!!!!!!!!!!!NEW PHYSICS + PHOTOCHEM |
---|
745 | #ifdef PHOTOCHEM |
---|
746 | print *,'photochem' |
---|
747 | DO i=1,nchemtrac |
---|
748 | print *,wtnom(i) |
---|
749 | ierr=NF_INQ_VARID(nid,wtnom(i),nvarid) |
---|
750 | if (ierr.ne.NF_NOERR) then |
---|
751 | write(*,*) "...No ",wtnom(i), " - set to 0" |
---|
752 | chemtrac(:,:,:,:,i)=0. |
---|
753 | else |
---|
754 | ierr=NF_GET_VAR_REAL(nid,nvarid,chemtrac(:,:,:,:,i)) |
---|
755 | endif |
---|
756 | ENDDO |
---|
757 | #endif |
---|
758 | !!!!!!!!!!!!!!!!!!!!!!!!NEW PHYSICS + PHOTOCHEM |
---|
759 | !!!!!!!!!!!!!!!!!!!!!!!!NEW PHYSICS + PHOTOCHEM |
---|
760 | |
---|
761 | |
---|
762 | |
---|
763 | !END SELECT |
---|
764 | |
---|
765 | ierr=NF_CLOSE(nid) |
---|
766 | |
---|
767 | !!!!lott stuff |
---|
768 | !print *,'get lott' |
---|
769 | !ierr=NF_OPEN("init_lott.nc",NF_NOWRITE,nid3) |
---|
770 | !ierr=NF_INQ_VARID(nid3,"ZMEA",nvarid) |
---|
771 | !ierr=NF_GET_VAR_REAL(nid3,nvarid,interm) |
---|
772 | !gwparam(:,:,1)=interm(:,:) |
---|
773 | !ierr=NF_INQ_VARID(nid3,"ZSTD",nvarid) |
---|
774 | !ierr=NF_GET_VAR_REAL(nid3,nvarid,interm) |
---|
775 | !gwparam(:,:,2)=interm(:,:) |
---|
776 | !ierr=NF_INQ_VARID(nid3,"ZSIG",nvarid) |
---|
777 | !ierr=NF_GET_VAR_REAL(nid3,nvarid,interm) |
---|
778 | !gwparam(:,:,3)=interm(:,:) |
---|
779 | !ierr=NF_INQ_VARID(nid3,"ZGAM",nvarid) |
---|
780 | !ierr=NF_GET_VAR_REAL(nid3,nvarid,interm) |
---|
781 | !gwparam(:,:,4)=interm(:,:) |
---|
782 | !ierr=NF_INQ_VARID(nid3,"ZTHE",nvarid) |
---|
783 | !ierr=NF_GET_VAR_REAL(nid3,nvarid,interm) |
---|
784 | !gwparam(:,:,5)=interm(:,:) |
---|
785 | !ierr=NF_CLOSE(nid3) |
---|
786 | |
---|
787 | ENDIF |
---|
788 | |
---|
789 | !!----------------------------- |
---|
790 | !! Loop on the written files |
---|
791 | !! >>> what follows is pretty repetitive ... |
---|
792 | !! gotta do something (one more loop?) |
---|
793 | !!----------------------------- |
---|
794 | |
---|
795 | !!! Equivalent eta levels for WRF interpolation in initialize_real |
---|
796 | !print *,'Computing equivalent eta levels' |
---|
797 | ! |
---|
798 | ! !ptop will be passed through RH(surface) |
---|
799 | ! ptop=MINVAL(aps(altlen)+bps(altlen)*psfile(:,:,:)) |
---|
800 | ! print *, 'ptop', ptop |
---|
801 | ! |
---|
802 | !print *, 'sample: equivalent eta levels at i=1,j=1' |
---|
803 | !DO k = 1,altlen |
---|
804 | ! levels(k)=-k |
---|
805 | ! eta_gcm(:,:,k,:)=(aps(k)+bps(k)*psfile(:,:,:)-ptop)/(psfile(:,:,:)-ptop) |
---|
806 | ! print *, eta_gcm(1,1,k,1) |
---|
807 | !END DO |
---|
808 | |
---|
809 | !!---better to pass pressure values |
---|
810 | !!---the eta treatment is done in module_initialize_real |
---|
811 | DO k = 1,altlen |
---|
812 | levels(k)=-k |
---|
813 | !!dummy decreasing levels |
---|
814 | END DO |
---|
815 | |
---|
816 | |
---|
817 | |
---|
818 | |
---|
819 | !! Dummy surface level is XLVL=200100. |
---|
820 | |
---|
821 | |
---|
822 | DO l=1,FILES |
---|
823 | |
---|
824 | |
---|
825 | !!--------------------------------------------- |
---|
826 | !! Write file in intermediate format for WPS |
---|
827 | !! 1. Surface data |
---|
828 | !!--------------------------------------------- |
---|
829 | !! |
---|
830 | !! a mettre pour tous sinon |
---|
831 | !! WRF_DEBUG: Warning DIM 4 , NAME num_metgrid_levels REDIFINED by |
---|
832 | !! var DUSTN 26 25 in wrf_io.F90 line 2349 |
---|
833 | !! |
---|
834 | |
---|
835 | ! |
---|
836 | ! These variables remain the same in the "loop" |
---|
837 | ! |
---|
838 | HDATE=date_out(l) |
---|
839 | IFV=4 |
---|
840 | XFCST=0. |
---|
841 | SOURCE=ident |
---|
842 | NX=lonlen |
---|
843 | NY=latlen |
---|
844 | ALLOCATE(SLAB(NX,NY)) |
---|
845 | IPROJ=0 |
---|
846 | STARTLOC='SWCORNER' |
---|
847 | STARTLAT=lat(1) |
---|
848 | STARTLON=lon(1) |
---|
849 | DELTALAT=lat(latlen)-lat(latlen-1) |
---|
850 | DELTALON=lon(lonlen)-lon(lonlen-1) |
---|
851 | ! |
---|
852 | ! Open the data destination file |
---|
853 | ! |
---|
854 | output="./WPSFEED/"//ident//":"//date_out2(l) |
---|
855 | open(UNIT=1, & |
---|
856 | FILE=output, & |
---|
857 | STATUS='REPLACE', & |
---|
858 | FORM='UNFORMATTED', & |
---|
859 | ACCESS='SEQUENTIAL') |
---|
860 | |
---|
861 | !------------------------! |
---|
862 | ! >>> Write a variable ! |
---|
863 | ! ... Copy&Paste part ! |
---|
864 | !------------------------! |
---|
865 | FIELD='T' |
---|
866 | UNITS='K' |
---|
867 | DESC='Atmospheric temperature' |
---|
868 | XLVL=200100. |
---|
869 | SLAB=tnsfile(:,:,time_out(l)) |
---|
870 | ! And now put everything in the destination file |
---|
871 | ! ... Header |
---|
872 | write(1) IFV |
---|
873 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
874 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
875 | ! ... Data |
---|
876 | write(1) SLAB |
---|
877 | !print *,'The field '//DESC//' was written to '//output |
---|
878 | |
---|
879 | !------------------------! |
---|
880 | ! >>> Write a variable ! |
---|
881 | ! ... Copy&Paste part ! |
---|
882 | !------------------------! |
---|
883 | FIELD='U' |
---|
884 | UNITS='m s{-1}' |
---|
885 | DESC='Zonal wind' |
---|
886 | XLVL=200100. |
---|
887 | SLAB=unsfile(:,:,time_out(l)) |
---|
888 | ! And now put everything in the destination file |
---|
889 | ! ... Header |
---|
890 | write(1) IFV |
---|
891 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
892 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
893 | ! ... Data |
---|
894 | write(1) SLAB |
---|
895 | !print *,'The field '//DESC//' was written to '//output |
---|
896 | |
---|
897 | !------------------------! |
---|
898 | ! >>> Write a variable ! |
---|
899 | ! ... Copy&Paste part ! |
---|
900 | !------------------------! |
---|
901 | FIELD='V' |
---|
902 | UNITS='m s{-1}' |
---|
903 | DESC='Meridional wind' |
---|
904 | XLVL=200100. |
---|
905 | SLAB=vnsfile(:,:,time_out(l)) |
---|
906 | ! And now put everything in the destination file |
---|
907 | ! ... Header |
---|
908 | write(1) IFV |
---|
909 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
910 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
911 | ! ... Data |
---|
912 | write(1) SLAB |
---|
913 | !print *,'The field '//DESC//' was written to '//output |
---|
914 | |
---|
915 | !------------------------! |
---|
916 | ! >>> Write a variable ! |
---|
917 | ! ... Copy&Paste part ! |
---|
918 | !------------------------! |
---|
919 | FIELD='RH' |
---|
920 | UNITS='' |
---|
921 | DESC='Customized 2D static field' |
---|
922 | XLVL=200100. |
---|
923 | SLAB=vide(:,:) |
---|
924 | ! And now put everything in the destination file |
---|
925 | ! ... Header |
---|
926 | write(1) IFV |
---|
927 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
928 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
929 | ! ... Data |
---|
930 | write(1) SLAB |
---|
931 | !print *,'The field '//DESC//' was written to '//output |
---|
932 | |
---|
933 | !------------------------! |
---|
934 | ! >>> Write a variable ! |
---|
935 | ! ... Copy&Paste part ! |
---|
936 | !------------------------! |
---|
937 | FIELD='SOILHGT' |
---|
938 | UNITS='m' |
---|
939 | DESC='Terrain field of source analysis' !Ground geopotential height |
---|
940 | XLVL=200100. |
---|
941 | SLAB=ghtsfile(:,:) |
---|
942 | ! And now put everything in the destination file |
---|
943 | ! ... Header |
---|
944 | write(1) IFV |
---|
945 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
946 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
947 | ! ... Data |
---|
948 | write(1) SLAB |
---|
949 | !print *,'The field '//DESC//' was written to '//output |
---|
950 | |
---|
951 | !------------------------! |
---|
952 | ! >>> Write a variable ! |
---|
953 | ! ... Copy&Paste part ! |
---|
954 | !------------------------! |
---|
955 | FIELD='PSFC' |
---|
956 | UNITS='Pa' |
---|
957 | DESC='Surface Pressure' |
---|
958 | XLVL=200100. |
---|
959 | SLAB=psfile(:,:,time_out(l)) |
---|
960 | ! And now put everything in the destination file |
---|
961 | ! ... Header |
---|
962 | write(1) IFV |
---|
963 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
964 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
965 | ! ... Data |
---|
966 | write(1) SLAB |
---|
967 | !print *,'The field '//DESC//' was written to '//output |
---|
968 | |
---|
969 | !------------------------! |
---|
970 | ! >>> Write a variable ! |
---|
971 | ! ... Copy&Paste part ! |
---|
972 | !------------------------! |
---|
973 | FIELD='ST000010' |
---|
974 | UNITS='' |
---|
975 | DESC='Emissivity' |
---|
976 | XLVL=200100. |
---|
977 | SLAB=emissfile(:,:,time_out(l)) |
---|
978 | ! And now put everything in the destination file |
---|
979 | ! ... Header |
---|
980 | write(1) IFV |
---|
981 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
982 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
983 | ! ... Data |
---|
984 | write(1) SLAB |
---|
985 | !print *,'The field '//DESC//' was written to '//output |
---|
986 | |
---|
987 | !------------------------! |
---|
988 | ! >>> Write a variable ! |
---|
989 | ! ... Copy&Paste part ! |
---|
990 | !------------------------! |
---|
991 | FIELD='ST010040' |
---|
992 | UNITS='' |
---|
993 | DESC='CO2 ice' |
---|
994 | XLVL=200100. |
---|
995 | SLAB=co2icefile(:,:,time_out(l)) |
---|
996 | ! And now put everything in the destination file |
---|
997 | ! ... Header |
---|
998 | write(1) IFV |
---|
999 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1000 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1001 | ! ... Data |
---|
1002 | write(1) SLAB |
---|
1003 | !print *,'The field '//DESC//' was written to '//output |
---|
1004 | |
---|
1005 | !------------------------! |
---|
1006 | ! >>> Write a variable ! |
---|
1007 | ! ... Copy&Paste part ! |
---|
1008 | !------------------------! |
---|
1009 | FIELD='ST040100' |
---|
1010 | UNITS='' |
---|
1011 | DESC='ZMEA' |
---|
1012 | XLVL=200100. |
---|
1013 | SLAB=gwparam(:,:,1) |
---|
1014 | ! And now put everything in the destination file |
---|
1015 | ! ... Header |
---|
1016 | write(1) IFV |
---|
1017 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1018 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1019 | ! ... Data |
---|
1020 | write(1) SLAB |
---|
1021 | !print *,'The field '//DESC//' was written to '//output |
---|
1022 | |
---|
1023 | !------------------------! |
---|
1024 | ! >>> Write a variable ! |
---|
1025 | ! ... Copy&Paste part ! |
---|
1026 | !------------------------! |
---|
1027 | FIELD='ST100200' |
---|
1028 | UNITS='' |
---|
1029 | DESC='ZSTD' |
---|
1030 | XLVL=200100. |
---|
1031 | SLAB=gwparam(:,:,2) |
---|
1032 | ! And now put everything in the destination file |
---|
1033 | ! ... Header |
---|
1034 | write(1) IFV |
---|
1035 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1036 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1037 | ! ... Data |
---|
1038 | write(1) SLAB |
---|
1039 | !print *,'The field '//DESC//' was written to '//output |
---|
1040 | |
---|
1041 | !------------------------! |
---|
1042 | ! >>> Write a variable ! |
---|
1043 | ! ... Copy&Paste part ! |
---|
1044 | !------------------------! |
---|
1045 | FIELD='LANDSEA' |
---|
1046 | UNITS='0/1 Flag' |
---|
1047 | DESC='Land/Sea flag' |
---|
1048 | XLVL=200100. |
---|
1049 | SLAB=ones(:,:) |
---|
1050 | ! And now put everything in the destination file |
---|
1051 | ! ... Header |
---|
1052 | write(1) IFV |
---|
1053 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1054 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1055 | ! ... Data |
---|
1056 | write(1) SLAB |
---|
1057 | !print *,'The field '//DESC//' was written to '//output |
---|
1058 | |
---|
1059 | !------------------------! |
---|
1060 | ! >>> Write a variable ! |
---|
1061 | ! ... Copy&Paste part ! |
---|
1062 | !------------------------! |
---|
1063 | FIELD='SKINTEMP' |
---|
1064 | UNITS='K' |
---|
1065 | DESC='Ground temperature' |
---|
1066 | XLVL=200100. |
---|
1067 | SLAB=tsfile(:,:,time_out(l)) |
---|
1068 | ! And now put everything in the destination file |
---|
1069 | ! ... Header |
---|
1070 | write(1) IFV |
---|
1071 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1072 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1073 | ! ... Data |
---|
1074 | write(1) SLAB |
---|
1075 | !print *,'The field '//DESC//' was written to '//output |
---|
1076 | |
---|
1077 | !------------------------! |
---|
1078 | ! >>> Write a variable ! |
---|
1079 | ! ... Copy&Paste part ! |
---|
1080 | !------------------------! |
---|
1081 | FIELD='SM000010' |
---|
1082 | UNITS='' |
---|
1083 | DESC='ZSIG' |
---|
1084 | XLVL=200100. |
---|
1085 | SLAB=gwparam(:,:,3) |
---|
1086 | ! And now put everything in the destination file |
---|
1087 | ! ... Header |
---|
1088 | write(1) IFV |
---|
1089 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1090 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1091 | ! ... Data |
---|
1092 | write(1) SLAB |
---|
1093 | !print *,'The field '//DESC//' was written to '//output |
---|
1094 | |
---|
1095 | !------------------------! |
---|
1096 | ! >>> Write a variable ! |
---|
1097 | ! ... Copy&Paste part ! |
---|
1098 | !------------------------! |
---|
1099 | FIELD='SM010040' |
---|
1100 | UNITS='' |
---|
1101 | DESC='ZGAM' |
---|
1102 | XLVL=200100. |
---|
1103 | SLAB=gwparam(:,:,4) |
---|
1104 | ! And now put everything in the destination file |
---|
1105 | ! ... Header |
---|
1106 | write(1) IFV |
---|
1107 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1108 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1109 | ! ... Data |
---|
1110 | write(1) SLAB |
---|
1111 | !print *,'The field '//DESC//' was written to '//output |
---|
1112 | |
---|
1113 | !------------------------! |
---|
1114 | ! >>> Write a variable ! |
---|
1115 | ! ... Copy&Paste part ! |
---|
1116 | !------------------------! |
---|
1117 | FIELD='SM040100' |
---|
1118 | UNITS='' |
---|
1119 | DESC='ZTHE' |
---|
1120 | XLVL=200100. |
---|
1121 | SLAB=gwparam(:,:,5) |
---|
1122 | ! And now put everything in the destination file |
---|
1123 | ! ... Header |
---|
1124 | write(1) IFV |
---|
1125 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1126 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1127 | ! ... Data |
---|
1128 | write(1) SLAB |
---|
1129 | !print *,'The field '//DESC//' was written to '//output |
---|
1130 | |
---|
1131 | !------------------------! |
---|
1132 | ! >>> Write a variable ! |
---|
1133 | ! ... Copy&Paste part ! |
---|
1134 | !------------------------! |
---|
1135 | FIELD='SM100200' |
---|
1136 | UNITS='kg/m2' |
---|
1137 | DESC='Surf water ice' |
---|
1138 | XLVL=200100. |
---|
1139 | SLAB=swatericefile(:,:,time_out(l)) |
---|
1140 | ! And now put everything in the destination file |
---|
1141 | ! ... Header |
---|
1142 | write(1) IFV |
---|
1143 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1144 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1145 | ! ... Data |
---|
1146 | write(1) SLAB |
---|
1147 | !print *,'The field '//DESC//' was written to '//output |
---|
1148 | |
---|
1149 | |
---|
1150 | !------------------------! |
---|
1151 | ! >>> Write a variable ! |
---|
1152 | ! ... Copy&Paste part ! |
---|
1153 | !------------------------! |
---|
1154 | FIELD='HV' |
---|
1155 | UNITS='kg/kg' |
---|
1156 | DESC='Water vapor' |
---|
1157 | XLVL=200100. |
---|
1158 | SLAB=waterfile(:,:,1,time_out(l)) |
---|
1159 | ! And now put everything in the destination file |
---|
1160 | ! ... Header |
---|
1161 | write(1) IFV |
---|
1162 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1163 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1164 | ! ... Data |
---|
1165 | write(1) SLAB |
---|
1166 | !print *,'The field '//DESC//' was written to '//output |
---|
1167 | |
---|
1168 | !------------------------! |
---|
1169 | ! >>> Write a variable ! |
---|
1170 | ! ... Copy&Paste part ! |
---|
1171 | !------------------------! |
---|
1172 | FIELD='HI' |
---|
1173 | UNITS='kg/kg' |
---|
1174 | DESC='Water ice' |
---|
1175 | XLVL=200100. |
---|
1176 | SLAB=watericefile(:,:,1,time_out(l)) |
---|
1177 | ! And now put everything in the destination file |
---|
1178 | ! ... Header |
---|
1179 | write(1) IFV |
---|
1180 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1181 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1182 | ! ... Data |
---|
1183 | write(1) SLAB |
---|
1184 | !print *,'The field '//DESC//' was written to '//output |
---|
1185 | |
---|
1186 | !------------------------! |
---|
1187 | ! >>> Write a variable ! |
---|
1188 | ! ... Copy&Paste part ! |
---|
1189 | !------------------------! |
---|
1190 | FIELD='TSOIL' |
---|
1191 | UNITS='K' |
---|
1192 | DESC='Soil temperature' |
---|
1193 | XLVL=200100. |
---|
1194 | SLAB=tsoilfile(:,:,1,time_out(l)) |
---|
1195 | ! And now put everything in the destination file |
---|
1196 | ! ... Header |
---|
1197 | write(1) IFV |
---|
1198 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1199 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1200 | ! ... Data |
---|
1201 | write(1) SLAB |
---|
1202 | !print *,'The field '//DESC//' was written to '//output |
---|
1203 | |
---|
1204 | !------------------------! |
---|
1205 | ! >>> Write a variable ! |
---|
1206 | ! ... Copy&Paste part ! |
---|
1207 | !------------------------! |
---|
1208 | FIELD='DSOIL' |
---|
1209 | UNITS='m' |
---|
1210 | DESC='Soil depths' |
---|
1211 | XLVL=200100. |
---|
1212 | SLAB=dsoilfile(:,:,1,time_out(l)) |
---|
1213 | ! And now put everything in the destination file |
---|
1214 | ! ... Header |
---|
1215 | write(1) IFV |
---|
1216 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1217 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1218 | ! ... Data |
---|
1219 | write(1) SLAB |
---|
1220 | !print *,'The field '//DESC//' was written to '//output |
---|
1221 | |
---|
1222 | !------------------------! |
---|
1223 | ! >>> Write a variable ! |
---|
1224 | ! ... Copy&Paste part ! |
---|
1225 | !------------------------! |
---|
1226 | FIELD='ISOIL' |
---|
1227 | UNITS='tiu' |
---|
1228 | DESC='Soil thermal inertia' |
---|
1229 | XLVL=200100. |
---|
1230 | SLAB=isoilfile(:,:,1,time_out(l)) |
---|
1231 | ! And now put everything in the destination file |
---|
1232 | ! ... Header |
---|
1233 | write(1) IFV |
---|
1234 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1235 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1236 | ! ... Data |
---|
1237 | write(1) SLAB |
---|
1238 | !print *,'The field '//DESC//' was written to '//output |
---|
1239 | |
---|
1240 | !------------------------! |
---|
1241 | ! >>> Write a variable ! |
---|
1242 | ! ... Copy&Paste part ! |
---|
1243 | !------------------------! |
---|
1244 | FIELD='CO2' |
---|
1245 | UNITS='kg/kg' |
---|
1246 | DESC='CO2 mixing ratio' |
---|
1247 | XLVL=200100. |
---|
1248 | SLAB=co2file(:,:,1,time_out(l)) |
---|
1249 | ! And now put everything in the destination file |
---|
1250 | ! ... Header |
---|
1251 | write(1) IFV |
---|
1252 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1253 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1254 | ! ... Data |
---|
1255 | write(1) SLAB |
---|
1256 | !print *,'The field '//DESC//' was written to '//output |
---|
1257 | |
---|
1258 | !------------------------! |
---|
1259 | ! >>> Write a variable ! |
---|
1260 | ! ... Copy&Paste part ! |
---|
1261 | !------------------------! |
---|
1262 | FIELD='DUSTQ' |
---|
1263 | UNITS='kg/kg' |
---|
1264 | DESC='Dust mixing ratio' |
---|
1265 | XLVL=200100. |
---|
1266 | SLAB=dustfile(:,:,1,time_out(l)) |
---|
1267 | ! And now put everything in the destination file |
---|
1268 | ! ... Header |
---|
1269 | write(1) IFV |
---|
1270 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1271 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1272 | ! ... Data |
---|
1273 | write(1) SLAB |
---|
1274 | !print *,'The field '//DESC//' was written to '//output |
---|
1275 | |
---|
1276 | !------------------------! |
---|
1277 | ! >>> Write a variable ! |
---|
1278 | ! ... Copy&Paste part ! |
---|
1279 | !------------------------! |
---|
1280 | FIELD='DUSTN' |
---|
1281 | UNITS='part/kg' |
---|
1282 | DESC='Dust number density' |
---|
1283 | XLVL=200100. |
---|
1284 | SLAB=dustnfile(:,:,1,time_out(l)) |
---|
1285 | ! And now put everything in the destination file |
---|
1286 | ! ... Header |
---|
1287 | write(1) IFV |
---|
1288 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1289 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1290 | ! ... Data |
---|
1291 | write(1) SLAB |
---|
1292 | !print *,'The field '//DESC//' was written to '//output |
---|
1293 | |
---|
1294 | !------------------------! |
---|
1295 | ! >>> Write a variable ! |
---|
1296 | ! ... Copy&Paste part ! |
---|
1297 | !------------------------! |
---|
1298 | FIELD='CCNQ' |
---|
1299 | UNITS='kg/kg' |
---|
1300 | DESC='CCN mixing ratio' |
---|
1301 | XLVL=200100. |
---|
1302 | SLAB=ccnfile(:,:,1,time_out(l)) |
---|
1303 | ! And now put everything in the destination file |
---|
1304 | ! ... Header |
---|
1305 | write(1) IFV |
---|
1306 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1307 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1308 | ! ... Data |
---|
1309 | write(1) SLAB |
---|
1310 | !print *,'The field '//DESC//' was written to '//output |
---|
1311 | |
---|
1312 | !------------------------! |
---|
1313 | ! >>> Write a variable ! |
---|
1314 | ! ... Copy&Paste part ! |
---|
1315 | !------------------------! |
---|
1316 | FIELD='CCNN' |
---|
1317 | UNITS='part/kg' |
---|
1318 | DESC='CCN number density' |
---|
1319 | XLVL=200100. |
---|
1320 | SLAB=ccnnfile(:,:,1,time_out(l)) |
---|
1321 | ! And now put everything in the destination file |
---|
1322 | ! ... Header |
---|
1323 | write(1) IFV |
---|
1324 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1325 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1326 | ! ... Data |
---|
1327 | write(1) SLAB |
---|
1328 | !print *,'The field '//DESC//' was written to '//output |
---|
1329 | |
---|
1330 | |
---|
1331 | !------------------------! |
---|
1332 | ! >>> Write a variable ! |
---|
1333 | ! PHOTOCHEMISTRY ! |
---|
1334 | !------------------------! |
---|
1335 | #ifdef PHOTOCHEM |
---|
1336 | DO i=1,nchemtrac |
---|
1337 | FIELD=wtnom(i) |
---|
1338 | UNITS='units' |
---|
1339 | DESC='desc' |
---|
1340 | XLVL=200100. |
---|
1341 | SLAB=chemtrac(:,:,1,time_out(l),i) |
---|
1342 | ! And now put everything in the destination file |
---|
1343 | ! ... Header |
---|
1344 | write(1) IFV |
---|
1345 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1346 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1347 | ! ... Data |
---|
1348 | write(1) SLAB |
---|
1349 | ENDDO |
---|
1350 | #endif |
---|
1351 | |
---|
1352 | !!---------------------------------------------------- |
---|
1353 | !! Write file in intermediate format for WPS |
---|
1354 | !! 2. 3D meteorological data |
---|
1355 | !! >>> same stuff, but handle vertical profile |
---|
1356 | !! >>> !! XLVL must be decreasing (pressure levels) |
---|
1357 | !!---------------------------------------------------- |
---|
1358 | |
---|
1359 | !------------------------! |
---|
1360 | ! >>> Write a variable ! |
---|
1361 | ! ... Copy&Paste part ! |
---|
1362 | !------------------------! |
---|
1363 | FIELD='T' |
---|
1364 | UNITS='K' |
---|
1365 | DESC='Atmospheric temperature' |
---|
1366 | DO k = 1,altlen |
---|
1367 | XLVL=levels(k) |
---|
1368 | SLAB=tfile(:,:,k,time_out(l)) |
---|
1369 | ! And now put everything in the destination file |
---|
1370 | ! ... Header |
---|
1371 | write(1) IFV |
---|
1372 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1373 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1374 | ! ... Data |
---|
1375 | write(1) SLAB |
---|
1376 | END DO |
---|
1377 | !print *,'The field '//DESC//' was written to '//output |
---|
1378 | |
---|
1379 | !------------------------! |
---|
1380 | ! >>> Write a variable ! |
---|
1381 | ! ... Copy&Paste part ! |
---|
1382 | !------------------------! |
---|
1383 | FIELD='U' |
---|
1384 | UNITS='m s{-1}' |
---|
1385 | DESC='Zonal wind' |
---|
1386 | DO k = 1,altlen |
---|
1387 | XLVL=levels(k) |
---|
1388 | SLAB=ufile(:,:,k,time_out(l)) |
---|
1389 | ! And now put everything in the destination file |
---|
1390 | ! ... Header |
---|
1391 | write(1) IFV |
---|
1392 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1393 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1394 | ! ... Data |
---|
1395 | write(1) SLAB |
---|
1396 | END DO |
---|
1397 | !print *,'The field '//DESC//' was written to '//output |
---|
1398 | |
---|
1399 | !------------------------! |
---|
1400 | ! >>> Write a variable ! |
---|
1401 | ! ... Copy&Paste part ! |
---|
1402 | !------------------------! |
---|
1403 | FIELD='V' |
---|
1404 | UNITS='m s{-1}' |
---|
1405 | DESC='Meridional wind' |
---|
1406 | DO k = 1,altlen |
---|
1407 | XLVL=levels(k) |
---|
1408 | SLAB=vfile(:,:,k,time_out(l)) |
---|
1409 | ! And now put everything in the destination file |
---|
1410 | ! ... Header |
---|
1411 | write(1) IFV |
---|
1412 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1413 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1414 | ! ... Data |
---|
1415 | write(1) SLAB |
---|
1416 | END DO |
---|
1417 | !print *,'The field '//DESC//' was written to '//output |
---|
1418 | |
---|
1419 | !------------------------! |
---|
1420 | ! >>> Write a variable ! |
---|
1421 | ! ... Copy&Paste part ! |
---|
1422 | !------------------------! |
---|
1423 | FIELD='RH' |
---|
1424 | UNITS='' |
---|
1425 | DESC='Customized 2D static field' |
---|
1426 | DESC='Eta-levels from the GCM' |
---|
1427 | DESC='Pressure values from the GCM' |
---|
1428 | DO k = 1,altlen |
---|
1429 | XLVL=levels(k) |
---|
1430 | SELECT CASE(ident) |
---|
1431 | CASE('LMD') |
---|
1432 | SLAB=aps(k)+bps(k)*psfile(:,:,time_out(l)) |
---|
1433 | CASE('OXF') |
---|
1434 | SLAB=bps(k)*psfile(:,:,time_out(l)) |
---|
1435 | END SELECT |
---|
1436 | ! And now put everything in the destination file |
---|
1437 | ! ... Header |
---|
1438 | write(1) IFV |
---|
1439 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1440 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1441 | ! ... Data |
---|
1442 | write(1) SLAB |
---|
1443 | END DO |
---|
1444 | !print *,'The field '//DESC//' was written to '//output |
---|
1445 | |
---|
1446 | !------------------------! |
---|
1447 | ! >>> Write a variable ! |
---|
1448 | ! ... Copy&Paste part ! |
---|
1449 | !------------------------! |
---|
1450 | FIELD='HGT' |
---|
1451 | UNITS='m' |
---|
1452 | DESC='Height' |
---|
1453 | DO k = 1,altlen |
---|
1454 | XLVL=levels(k) |
---|
1455 | !!******* |
---|
1456 | !! PROVISOIRE: normalement, il faudrait la hauteur geopotentielle |
---|
1457 | !!******* |
---|
1458 | !!however, not used by initialize_real |
---|
1459 | SELECT CASE(ident) |
---|
1460 | CASE('LMD') |
---|
1461 | SLAB=10000.*alog(610./(aps(k)+bps(k)*psfile(:,:,time_out(l)))) |
---|
1462 | CASE('OXF') |
---|
1463 | SLAB=10000.*alog(610./(bps(k)*psfile(:,:,time_out(l)))) |
---|
1464 | END SELECT |
---|
1465 | ! And now put everything in the destination file |
---|
1466 | ! ... Header |
---|
1467 | write(1) IFV |
---|
1468 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1469 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1470 | ! ... Data |
---|
1471 | write(1) SLAB |
---|
1472 | END DO |
---|
1473 | !print *,'The field '//DESC//' was written to '//output |
---|
1474 | |
---|
1475 | !------------------------! |
---|
1476 | ! >>> Write a variable ! |
---|
1477 | ! ... Copy&Paste part ! |
---|
1478 | !------------------------! |
---|
1479 | FIELD='HV' |
---|
1480 | UNITS='kg/kg' |
---|
1481 | DESC='Water vapor' |
---|
1482 | DO k = 1,altlen |
---|
1483 | XLVL=levels(k) |
---|
1484 | SLAB=waterfile(:,:,k,time_out(l)) |
---|
1485 | ! And now put everything in the destination file |
---|
1486 | ! ... Header |
---|
1487 | write(1) IFV |
---|
1488 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1489 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1490 | ! ... Data |
---|
1491 | write(1) SLAB |
---|
1492 | END DO |
---|
1493 | !print *,'The field '//DESC//' was written to '//output |
---|
1494 | |
---|
1495 | !------------------------! |
---|
1496 | ! >>> Write a variable ! |
---|
1497 | ! ... Copy&Paste part ! |
---|
1498 | !------------------------! |
---|
1499 | FIELD='HI' |
---|
1500 | UNITS='kg/kg' |
---|
1501 | DESC='Water ice' |
---|
1502 | DO k = 1,altlen |
---|
1503 | XLVL=levels(k) |
---|
1504 | SLAB=watericefile(:,:,k,time_out(l)) |
---|
1505 | ! And now put everything in the destination file |
---|
1506 | ! ... Header |
---|
1507 | write(1) IFV |
---|
1508 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1509 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1510 | ! ... Data |
---|
1511 | write(1) SLAB |
---|
1512 | END DO |
---|
1513 | !print *,'The field '//DESC//' was written to '//output |
---|
1514 | |
---|
1515 | !------------------------! |
---|
1516 | ! >>> Write a variable ! |
---|
1517 | ! ... Copy&Paste part ! |
---|
1518 | !------------------------! |
---|
1519 | FIELD='TSOIL' |
---|
1520 | UNITS='K' |
---|
1521 | DESC='Soil temperature' |
---|
1522 | DO k = 1,altlen |
---|
1523 | XLVL=levels(k) |
---|
1524 | SLAB=tsoilfile(:,:,k,time_out(l)) |
---|
1525 | ! And now put everything in the destination file |
---|
1526 | ! ... Header |
---|
1527 | write(1) IFV |
---|
1528 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1529 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1530 | ! ... Data |
---|
1531 | write(1) SLAB |
---|
1532 | END DO |
---|
1533 | !print *,'The field '//DESC//' was written to '//output |
---|
1534 | |
---|
1535 | !------------------------! |
---|
1536 | ! >>> Write a variable ! |
---|
1537 | ! ... Copy&Paste part ! |
---|
1538 | !------------------------! |
---|
1539 | FIELD='DSOIL' |
---|
1540 | UNITS='m' |
---|
1541 | DESC='Soil depths' |
---|
1542 | DO k = 1,altlen |
---|
1543 | XLVL=levels(k) |
---|
1544 | SLAB=dsoilfile(:,:,k,time_out(l)) |
---|
1545 | ! And now put everything in the destination file |
---|
1546 | ! ... Header |
---|
1547 | write(1) IFV |
---|
1548 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1549 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1550 | ! ... Data |
---|
1551 | write(1) SLAB |
---|
1552 | END DO |
---|
1553 | !print *,'The field '//DESC//' was written to '//output |
---|
1554 | |
---|
1555 | !------------------------! |
---|
1556 | ! >>> Write a variable ! |
---|
1557 | ! ... Copy&Paste part ! |
---|
1558 | !------------------------! |
---|
1559 | FIELD='ISOIL' |
---|
1560 | UNITS='tiu' |
---|
1561 | DESC='Soil thermal inertia' |
---|
1562 | DO k = 1,altlen |
---|
1563 | XLVL=levels(k) |
---|
1564 | SLAB=isoilfile(:,:,k,time_out(l)) |
---|
1565 | ! And now put everything in the destination file |
---|
1566 | ! ... Header |
---|
1567 | write(1) IFV |
---|
1568 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1569 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1570 | ! ... Data |
---|
1571 | write(1) SLAB |
---|
1572 | END DO |
---|
1573 | !print *,'The field '//DESC//' was written to '//output |
---|
1574 | |
---|
1575 | !------------------------! |
---|
1576 | ! >>> Write a variable ! |
---|
1577 | ! ... Copy&Paste part ! |
---|
1578 | !------------------------! |
---|
1579 | FIELD='CO2' |
---|
1580 | UNITS='kg/kg' |
---|
1581 | DESC='CO2 mixing ratio' |
---|
1582 | DO k = 1,altlen |
---|
1583 | XLVL=levels(k) |
---|
1584 | SLAB=co2file(:,:,k,time_out(l)) |
---|
1585 | ! And now put everything in the destination file |
---|
1586 | ! ... Header |
---|
1587 | write(1) IFV |
---|
1588 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1589 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1590 | ! ... Data |
---|
1591 | write(1) SLAB |
---|
1592 | END DO |
---|
1593 | !print *,'The field '//DESC//' was written to '//output |
---|
1594 | |
---|
1595 | !------------------------! |
---|
1596 | ! >>> Write a variable ! |
---|
1597 | ! ... Copy&Paste part ! |
---|
1598 | !------------------------! |
---|
1599 | FIELD='DUSTQ' |
---|
1600 | UNITS='kg/kg' |
---|
1601 | DESC='Dust mixing ratio' |
---|
1602 | DO k = 1,altlen |
---|
1603 | XLVL=levels(k) |
---|
1604 | SLAB=dustfile(:,:,k,time_out(l)) |
---|
1605 | ! And now put everything in the destination file |
---|
1606 | ! ... Header |
---|
1607 | write(1) IFV |
---|
1608 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1609 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1610 | ! ... Data |
---|
1611 | write(1) SLAB |
---|
1612 | END DO |
---|
1613 | !print *,'The field '//DESC//' was written to '//output |
---|
1614 | |
---|
1615 | !------------------------! |
---|
1616 | ! >>> Write a variable ! |
---|
1617 | ! ... Copy&Paste part ! |
---|
1618 | !------------------------! |
---|
1619 | FIELD='DUSTN' |
---|
1620 | UNITS='part/kg' |
---|
1621 | DESC='Dust number density' |
---|
1622 | DO k = 1,altlen |
---|
1623 | XLVL=levels(k) |
---|
1624 | SLAB=dustnfile(:,:,k,time_out(l)) |
---|
1625 | ! And now put everything in the destination file |
---|
1626 | ! ... Header |
---|
1627 | write(1) IFV |
---|
1628 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1629 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1630 | ! ... Data |
---|
1631 | write(1) SLAB |
---|
1632 | END DO |
---|
1633 | !print *,'The field '//DESC//' was written to '//output |
---|
1634 | |
---|
1635 | !------------------------! |
---|
1636 | ! >>> Write a variable ! |
---|
1637 | ! ... Copy&Paste part ! |
---|
1638 | !------------------------! |
---|
1639 | FIELD='CCNQ' |
---|
1640 | UNITS='kg/kg' |
---|
1641 | DESC='CCN mixing ratio' |
---|
1642 | DO k = 1,altlen |
---|
1643 | XLVL=levels(k) |
---|
1644 | SLAB=ccnfile(:,:,k,time_out(l)) |
---|
1645 | ! And now put everything in the destination file |
---|
1646 | ! ... Header |
---|
1647 | write(1) IFV |
---|
1648 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1649 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1650 | ! ... Data |
---|
1651 | write(1) SLAB |
---|
1652 | END DO |
---|
1653 | !print *,'The field '//DESC//' was written to '//output |
---|
1654 | |
---|
1655 | !------------------------! |
---|
1656 | ! >>> Write a variable ! |
---|
1657 | ! ... Copy&Paste part ! |
---|
1658 | !------------------------! |
---|
1659 | FIELD='CCNN' |
---|
1660 | UNITS='part/kg' |
---|
1661 | DESC='CCN number density' |
---|
1662 | DO k = 1,altlen |
---|
1663 | XLVL=levels(k) |
---|
1664 | SLAB=ccnnfile(:,:,k,time_out(l)) |
---|
1665 | ! And now put everything in the destination file |
---|
1666 | ! ... Header |
---|
1667 | write(1) IFV |
---|
1668 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1669 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1670 | ! ... Data |
---|
1671 | write(1) SLAB |
---|
1672 | END DO |
---|
1673 | !print *,'The field '//DESC//' was written to '//output |
---|
1674 | |
---|
1675 | |
---|
1676 | !------------------------! |
---|
1677 | ! >>> Write a variable ! |
---|
1678 | ! PHOTOCHEMISTRY ! |
---|
1679 | !------------------------! |
---|
1680 | #ifdef PHOTOCHEM |
---|
1681 | DO i=1,nchemtrac |
---|
1682 | FIELD=wtnom(i) |
---|
1683 | UNITS='units' |
---|
1684 | DESC='desc' |
---|
1685 | DO k = 1,altlen |
---|
1686 | XLVL=levels(k) |
---|
1687 | SLAB=chemtrac(:,:,k,time_out(l),i) |
---|
1688 | ! And now put everything in the destination file |
---|
1689 | ! ... Header |
---|
1690 | write(1) IFV |
---|
1691 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
---|
1692 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
---|
1693 | ! ... Data |
---|
1694 | write(1) SLAB |
---|
1695 | END DO |
---|
1696 | ENDDO |
---|
1697 | #endif |
---|
1698 | |
---|
1699 | print *,'****done file '//output, int(100.*float(l)/float(FILES)), ' % ' |
---|
1700 | close(1) |
---|
1701 | |
---|
1702 | DEALLOCATE(SLAB) |
---|
1703 | |
---|
1704 | END DO !! end of the files loop |
---|
1705 | |
---|
1706 | |
---|
1707 | !!------------------------- |
---|
1708 | !! DeAllocate local arrays |
---|
1709 | !!------------------------- |
---|
1710 | deallocate(eta_gcm) |
---|
1711 | deallocate(tfile) |
---|
1712 | deallocate(tsoilfile) |
---|
1713 | deallocate(isoilfile) |
---|
1714 | deallocate(dsoilfile) |
---|
1715 | !deallocate(tfileorig) |
---|
1716 | deallocate(ufile) |
---|
1717 | !deallocate(ufileorig) |
---|
1718 | deallocate(vfile) |
---|
1719 | !deallocate(vfileorig) |
---|
1720 | deallocate(rfile) |
---|
1721 | deallocate(hfile) |
---|
1722 | deallocate(waterfile) |
---|
1723 | deallocate(watericefile) |
---|
1724 | !deallocate(swaterfile) |
---|
1725 | deallocate(swatericefile) |
---|
1726 | deallocate(dustfile) |
---|
1727 | deallocate(dustnfile) |
---|
1728 | deallocate(co2file) |
---|
1729 | deallocate(ccnfile) |
---|
1730 | deallocate(ccnnfile) |
---|
1731 | deallocate(psfile) |
---|
1732 | deallocate(tsfile) |
---|
1733 | deallocate(tnsfile) |
---|
1734 | deallocate(unsfile) |
---|
1735 | deallocate(vnsfile) |
---|
1736 | deallocate(emissfile) |
---|
1737 | deallocate(co2icefile) |
---|
1738 | deallocate(ghtsfile) !! no scan axis |
---|
1739 | deallocate(vide) |
---|
1740 | deallocate(ones) |
---|
1741 | deallocate(lat, lon, alt, time) |
---|
1742 | deallocate(aps,bps,levels) |
---|
1743 | |
---|
1744 | #ifdef PHOTOCHEM |
---|
1745 | deallocate(chemtrac) |
---|
1746 | deallocate(wtnom) |
---|
1747 | #endif |
---|
1748 | |
---|
1749 | print *, '------------------------' |
---|
1750 | print *, 'End of pre-WPS process !' |
---|
1751 | print *, '------------------------' |
---|
1752 | print *, 'Here is what you should set in namelist.wps:' |
---|
1753 | print *, " start_date = '"//date_out2(1)//"'" |
---|
1754 | print *, " end_date = '"//date_out2(FILES)//"'" |
---|
1755 | print *, '------------------------' |
---|
1756 | print *, 'Any date between those is ok' |
---|
1757 | print *, 'for example, second available date is ... '//date_out2(2) |
---|
1758 | print *, '------------------------' |
---|
1759 | |
---|
1760 | end |
---|