1 | SUBROUTINE iniwrite_specVI(nid,idayref,phis) |
---|
2 | |
---|
3 | use radinc_h, only: L_NSPECTV |
---|
4 | use radcommon_h, only: WAVEV |
---|
5 | |
---|
6 | implicit none |
---|
7 | |
---|
8 | c======================================================================= |
---|
9 | c |
---|
10 | c Auteur: L. Fairhead , P. Le Van, Y. Wanherdrick, F. Forget |
---|
11 | c ------- |
---|
12 | c |
---|
13 | c Objet: |
---|
14 | c ------ |
---|
15 | c |
---|
16 | c 'Initialize' the diagfi_spec.nc file: write down dimensions as well |
---|
17 | c as time-independent fields (e.g: geopotential, mesh area, ...) |
---|
18 | c |
---|
19 | c======================================================================= |
---|
20 | c----------------------------------------------------------------------- |
---|
21 | c Declarations: |
---|
22 | c ------------- |
---|
23 | |
---|
24 | #include "dimensions.h" |
---|
25 | #include "paramet.h" |
---|
26 | !include "comconst.h" |
---|
27 | #include "comcstfi.h" |
---|
28 | #include "comvert.h" |
---|
29 | #include "comgeom.h" |
---|
30 | #include "temps.h" |
---|
31 | #include "ener.h" |
---|
32 | #include "logic.h" |
---|
33 | #include "netcdf.inc" |
---|
34 | #include "description.h" |
---|
35 | #include "serre.h" |
---|
36 | #include"dimphys.h" |
---|
37 | #include"comsoil.h" |
---|
38 | |
---|
39 | c Arguments: |
---|
40 | c ---------- |
---|
41 | |
---|
42 | integer nid ! NetCDF file ID |
---|
43 | INTEGER*4 idayref ! date (initial date for this run) |
---|
44 | REAL phis(ip1jmp1) ! surface geopotential |
---|
45 | |
---|
46 | c Local: |
---|
47 | c ------ |
---|
48 | INTEGER length,l |
---|
49 | parameter (length = 100) |
---|
50 | REAL tab_cntrl(length) ! run parameters are stored in this array |
---|
51 | INTEGER ierr |
---|
52 | |
---|
53 | integer :: nvarid,idim_index,idim_rlonu,idim_rlonv |
---|
54 | integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm |
---|
55 | ! integer :: idim_nsoilmx ! "subsurface_layers" dimension ID # |
---|
56 | integer :: idim_bandsVI ! "bandsIR" dimension ID # |
---|
57 | integer, dimension(2) :: id |
---|
58 | |
---|
59 | c----------------------------------------------------------------------- |
---|
60 | |
---|
61 | DO l=1,length |
---|
62 | tab_cntrl(l)=0. |
---|
63 | ENDDO |
---|
64 | tab_cntrl(1) = FLOAT(iim) |
---|
65 | tab_cntrl(2) = FLOAT(jjm) |
---|
66 | tab_cntrl(3) = FLOAT(llm) |
---|
67 | tab_cntrl(4) = FLOAT(idayref) |
---|
68 | tab_cntrl(5) = rad |
---|
69 | tab_cntrl(6) = omeg |
---|
70 | tab_cntrl(7) = g |
---|
71 | tab_cntrl(8) = mugaz |
---|
72 | tab_cntrl(9) = rcp |
---|
73 | tab_cntrl(10) = daysec |
---|
74 | tab_cntrl(11) = dtphys |
---|
75 | tab_cntrl(12) = etot0 |
---|
76 | tab_cntrl(13) = ptot0 |
---|
77 | tab_cntrl(14) = ztot0 |
---|
78 | tab_cntrl(15) = stot0 |
---|
79 | tab_cntrl(16) = ang0 |
---|
80 | c |
---|
81 | c .......... P.Le Van ( ajout le 8/04/96 ) ......... |
---|
82 | c ..... parametres pour le zoom ...... |
---|
83 | tab_cntrl(17) = clon |
---|
84 | tab_cntrl(18) = clat |
---|
85 | tab_cntrl(19) = grossismx |
---|
86 | tab_cntrl(20) = grossismy |
---|
87 | c |
---|
88 | c ..... ajout le 6/05/97 et le 15/10/97 ....... |
---|
89 | c |
---|
90 | IF ( fxyhypb ) THEN |
---|
91 | tab_cntrl(21) = 1. |
---|
92 | tab_cntrl(22) = dzoomx |
---|
93 | tab_cntrl(23) = dzoomy |
---|
94 | ELSE |
---|
95 | tab_cntrl(21) = 0. |
---|
96 | tab_cntrl(22) = dzoomx |
---|
97 | tab_cntrl(23) = dzoomy |
---|
98 | tab_cntrl(24) = 0. |
---|
99 | IF( ysinus ) tab_cntrl(24) = 1. |
---|
100 | ENDIF |
---|
101 | |
---|
102 | c ......................................................... |
---|
103 | |
---|
104 | ! Define dimensions |
---|
105 | |
---|
106 | ierr = NF_REDEF (nid) |
---|
107 | |
---|
108 | ierr = NF_DEF_DIM (nid, "index", length, idim_index) |
---|
109 | ! ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) |
---|
110 | ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu) |
---|
111 | ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv) |
---|
112 | ! ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) |
---|
113 | ! ierr = NF_DEF_DIM (nid, "interlayer", (llm+1), idim_llmp1) |
---|
114 | ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm) |
---|
115 | ! ierr = NF_DEF_DIM (nid, "subsurface_layers",nsoilmx,idim_nsoilmx) |
---|
116 | ierr = NF_DEF_DIM (nid, "bandsVI",L_NSPECTV,idim_bandsVI) |
---|
117 | |
---|
118 | ierr = NF_ENDDEF(nid) |
---|
119 | |
---|
120 | c Contol parameters for this run |
---|
121 | ierr = NF_REDEF (nid) |
---|
122 | #ifdef NC_DOUBLE |
---|
123 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, |
---|
124 | . idim_index,nvarid) |
---|
125 | #else |
---|
126 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, |
---|
127 | . idim_index,nvarid) |
---|
128 | #endif |
---|
129 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
130 | . "Control parameters") |
---|
131 | ierr = NF_ENDDEF(nid) |
---|
132 | #ifdef NC_DOUBLE |
---|
133 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
134 | #else |
---|
135 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
136 | #endif |
---|
137 | |
---|
138 | c -------------------------- |
---|
139 | c longitudes and latitudes |
---|
140 | |
---|
141 | |
---|
142 | c$$$ ierr = NF_REDEF (nid) |
---|
143 | c$$$#ifdef NC_DOUBLE |
---|
144 | c$$$ ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) |
---|
145 | c$$$#else |
---|
146 | c$$$ ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) |
---|
147 | c$$$#endif |
---|
148 | c$$$ ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, |
---|
149 | c$$$ . "Longitudes at u nodes") |
---|
150 | c$$$ ierr = NF_ENDDEF(nid) |
---|
151 | c$$$#ifdef NC_DOUBLE |
---|
152 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) |
---|
153 | c$$$#else |
---|
154 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) |
---|
155 | c$$$#endif |
---|
156 | |
---|
157 | c -------------------------- |
---|
158 | ierr = NF_REDEF (nid) |
---|
159 | #ifdef NC_DOUBLE |
---|
160 | ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid) |
---|
161 | #else |
---|
162 | ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid) |
---|
163 | #endif |
---|
164 | ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north") |
---|
165 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
166 | . "North latitude") |
---|
167 | ierr = NF_ENDDEF(nid) |
---|
168 | #ifdef NC_DOUBLE |
---|
169 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) |
---|
170 | #else |
---|
171 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) |
---|
172 | #endif |
---|
173 | c |
---|
174 | c -------------------------- |
---|
175 | ierr = NF_REDEF (nid) |
---|
176 | #ifdef NC_DOUBLE |
---|
177 | ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid) |
---|
178 | #else |
---|
179 | ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid) |
---|
180 | #endif |
---|
181 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
182 | . "East longitude") |
---|
183 | ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east") |
---|
184 | ierr = NF_ENDDEF(nid) |
---|
185 | #ifdef NC_DOUBLE |
---|
186 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180) |
---|
187 | #else |
---|
188 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180) |
---|
189 | #endif |
---|
190 | c |
---|
191 | c -------------------------- |
---|
192 | ierr = NF_REDEF (nid) |
---|
193 | #ifdef NC_DOUBLE |
---|
194 | ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1, |
---|
195 | . idim_llm,nvarid) |
---|
196 | #else |
---|
197 | ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1, |
---|
198 | . idim_llm,nvarid) |
---|
199 | #endif |
---|
200 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",10,"pseudo-alt") |
---|
201 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,'units',2,"km") |
---|
202 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,'positive',2,"up") |
---|
203 | |
---|
204 | ierr = NF_ENDDEF(nid) |
---|
205 | #ifdef NC_DOUBLE |
---|
206 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,pseudoalt) |
---|
207 | #else |
---|
208 | ierr = NF_PUT_VAR_REAL (nid,nvarid,pseudoalt) |
---|
209 | #endif |
---|
210 | |
---|
211 | |
---|
212 | c$$$c -------------------------- |
---|
213 | c$$$ ierr = NF_REDEF (nid) |
---|
214 | c$$$#ifdef NC_DOUBLE |
---|
215 | c$$$ ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid) |
---|
216 | c$$$#else |
---|
217 | c$$$ ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid) |
---|
218 | c$$$#endif |
---|
219 | c$$$ ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20, |
---|
220 | c$$$ . "Latitudes at v nodes") |
---|
221 | c$$$ ierr = NF_ENDDEF(nid) |
---|
222 | c$$$#ifdef NC_DOUBLE |
---|
223 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180) |
---|
224 | c$$$#else |
---|
225 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180) |
---|
226 | c$$$#endif |
---|
227 | |
---|
228 | |
---|
229 | c$$$c -------------------------- |
---|
230 | c$$$c Vertical levels |
---|
231 | c$$$ call def_var(nid,"aps","hybrid pressure at midlayers ","Pa", |
---|
232 | c$$$ . 1,idim_llm,nvarid,ierr) |
---|
233 | c$$$#ifdef NC_DOUBLE |
---|
234 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aps) |
---|
235 | c$$$#else |
---|
236 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,aps) |
---|
237 | c$$$#endif |
---|
238 | c$$$ |
---|
239 | c$$$ call def_var(nid,"bps","hybrid sigma at midlayers"," ", |
---|
240 | c$$$ . 1,idim_llm,nvarid,ierr) |
---|
241 | c$$$#ifdef NC_DOUBLE |
---|
242 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bps) |
---|
243 | c$$$#else |
---|
244 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,bps) |
---|
245 | c$$$#endif |
---|
246 | c$$$ |
---|
247 | c$$$ call def_var(nid,"ap","hybrid pressure at interlayers","Pa", |
---|
248 | c$$$ . 1,idim_llmp1,nvarid,ierr) |
---|
249 | c$$$#ifdef NC_DOUBLE |
---|
250 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
251 | c$$$#else |
---|
252 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
253 | c$$$#endif |
---|
254 | c$$$ |
---|
255 | c$$$ call def_var(nid,"bp","hybrid sigma at interlayers"," ", |
---|
256 | c$$$ . 1,idim_llmp1,nvarid,ierr) |
---|
257 | c$$$#ifdef NC_DOUBLE |
---|
258 | c$$$ ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
259 | c$$$#else |
---|
260 | c$$$ ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
261 | c$$$#endif |
---|
262 | |
---|
263 | c$$$!------------------------------- |
---|
264 | c$$$! (soil) depth variable mlayer() (known from comsoil.h) |
---|
265 | c$$$!------------------------------- |
---|
266 | c$$$ ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode |
---|
267 | c$$$ ! define variable |
---|
268 | c$$$#ifdef NC_DOUBLE |
---|
269 | c$$$ ierr=NF_DEF_VAR(nid,"soildepth",NF_DOUBLE,1,idim_nsoilmx,nvarid) |
---|
270 | c$$$#else |
---|
271 | c$$$ ierr=NF_DEF_VAR(nid,"soildepth",NF_FLOAT,1,idim_nsoilmx,nvarid) |
---|
272 | c$$$#endif |
---|
273 | c$$$ ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 20, |
---|
274 | c$$$ . "Soil mid-layer depth") |
---|
275 | c$$$ ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",1,"m") |
---|
276 | c$$$ ierr=NF_PUT_ATT_TEXT (nid,nvarid,"positive",4,"down") |
---|
277 | c$$$ ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode |
---|
278 | c$$$ ! write variable |
---|
279 | c$$$#ifdef NC_DOUBLE |
---|
280 | c$$$ ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,mlayer) |
---|
281 | c$$$#else |
---|
282 | c$$$ ierr=NF_PUT_VAR_REAL (nid,nvarid,mlayer) |
---|
283 | c$$$#endif |
---|
284 | |
---|
285 | !------------------------------- |
---|
286 | ! Number of bands in the IR |
---|
287 | !------------------------------- |
---|
288 | |
---|
289 | ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode |
---|
290 | ! define variable |
---|
291 | #ifdef NC_DOUBLE |
---|
292 | ierr=NF_DEF_VAR(nid,"bandsVI",NF_DOUBLE,1,idim_bandsVI,nvarid) |
---|
293 | #else |
---|
294 | ierr=NF_DEF_VAR(nid,"bandsVI",NF_FLOAT,1,idim_bandsVI,nvarid) |
---|
295 | #endif |
---|
296 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 27, |
---|
297 | . "Band limits in the visible") |
---|
298 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",1,"cm^-1") |
---|
299 | ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode |
---|
300 | ! write variable |
---|
301 | #ifdef NC_DOUBLE |
---|
302 | ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(WAVEV)) |
---|
303 | #else |
---|
304 | ierr=NF_PUT_VAR_REAL (nid,nvarid,real(WAVEV)) |
---|
305 | #endif |
---|
306 | |
---|
307 | c |
---|
308 | c -------------------------- |
---|
309 | c Mesh area and conversion coefficients cov. <-> contra. <--> natural |
---|
310 | |
---|
311 | id(1)=idim_rlonu |
---|
312 | id(2)=idim_rlatu |
---|
313 | c |
---|
314 | ierr = NF_REDEF (nid) |
---|
315 | #ifdef NC_DOUBLE |
---|
316 | ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid) |
---|
317 | #else |
---|
318 | ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid) |
---|
319 | #endif |
---|
320 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, |
---|
321 | . "Conversion coefficients cov <--> natural") |
---|
322 | ierr = NF_ENDDEF(nid) |
---|
323 | #ifdef NC_DOUBLE |
---|
324 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
325 | #else |
---|
326 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
327 | #endif |
---|
328 | c |
---|
329 | id(1)=idim_rlonv |
---|
330 | id(2)=idim_rlatv |
---|
331 | c |
---|
332 | c -------------------------- |
---|
333 | ierr = NF_REDEF (nid) |
---|
334 | #ifdef NC_DOUBLE |
---|
335 | ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid) |
---|
336 | #else |
---|
337 | ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid) |
---|
338 | #endif |
---|
339 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, |
---|
340 | . "Conversion coefficients cov <--> natural") |
---|
341 | ierr = NF_ENDDEF(nid) |
---|
342 | #ifdef NC_DOUBLE |
---|
343 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
344 | #else |
---|
345 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
346 | #endif |
---|
347 | c |
---|
348 | id(1)=idim_rlonv |
---|
349 | id(2)=idim_rlatu |
---|
350 | c |
---|
351 | c -------------------------- |
---|
352 | ierr = NF_REDEF (nid) |
---|
353 | #ifdef NC_DOUBLE |
---|
354 | ierr = NF_DEF_VAR (nid, "aire", NF_DOUBLE, 2, id,nvarid) |
---|
355 | #else |
---|
356 | ierr = NF_DEF_VAR (nid, "aire", NF_FLOAT, 2, id,nvarid) |
---|
357 | #endif |
---|
358 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
359 | . "Mesh area") |
---|
360 | ierr = NF_ENDDEF(nid) |
---|
361 | #ifdef NC_DOUBLE |
---|
362 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
363 | #else |
---|
364 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
365 | #endif |
---|
366 | |
---|
367 | c Surface geopotential |
---|
368 | id(1)=idim_rlonv |
---|
369 | id(2)=idim_rlatu |
---|
370 | |
---|
371 | ierr = NF_REDEF (nid) |
---|
372 | #ifdef NC_DOUBLE |
---|
373 | ierr = NF_DEF_VAR (nid, "phisinit", NF_DOUBLE, 2, id,nvarid) |
---|
374 | #else |
---|
375 | ierr = NF_DEF_VAR (nid, "phisinit", NF_FLOAT, 2, id,nvarid) |
---|
376 | #endif |
---|
377 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 27, |
---|
378 | . "Geopotential at the surface") |
---|
379 | ierr = NF_ENDDEF(nid) |
---|
380 | #ifdef NC_DOUBLE |
---|
381 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
382 | #else |
---|
383 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
384 | #endif, |
---|
385 | |
---|
386 | |
---|
387 | ! write(*,*)'iniwrite: iim,jjm,llm,idayref',iim,jjm,llm,idayref |
---|
388 | ! write(*,*)'iniwrite: rad,omeg,g,mugaz,rcp',rad,omeg,g,mugaz,rcp |
---|
389 | ! write(*,*)'iniwrite: daysec,dtphys',daysec,dtphys |
---|
390 | |
---|
391 | END |
---|