1 | program stability |
---|
2 | |
---|
3 | ! SL 12/2009: |
---|
4 | ! This program reads 4D (lon-lat-alt-time) fields recast in log P coordinates |
---|
5 | ! |
---|
6 | ! it computes: |
---|
7 | ! stab -- 4D -- stability |
---|
8 | ! Ri -- 4D -- Richardson number |
---|
9 | ! deqc -- 3D -- distance to cyclostrophic equilibrium |
---|
10 | ! |
---|
11 | ! Minimal requirements and dependencies: |
---|
12 | ! The dataset must include the following data: |
---|
13 | ! - surface pressure and surface geopotential |
---|
14 | ! - atmospheric temperature |
---|
15 | ! - zonal and meridional winds |
---|
16 | ! - altitude above areoid |
---|
17 | |
---|
18 | implicit none |
---|
19 | |
---|
20 | include "netcdf.inc" ! NetCDF definitions |
---|
21 | |
---|
22 | character (len=128) :: infile ! input file name (name_P.nc) |
---|
23 | character (len=128) :: outfile ! output file name |
---|
24 | |
---|
25 | character (len=64) :: text ! to store some text |
---|
26 | integer infid ! NetCDF input file ID |
---|
27 | integer outfid ! NetCDF output file ID |
---|
28 | integer lon_dimid,lat_dimid,alt_dimid,time_dimid ! NetCDF dimension IDs |
---|
29 | integer lon_varid,lat_varid,alt_varid,time_varid |
---|
30 | integer,dimension(3) :: datashape3d ! shape of 3D datasets |
---|
31 | integer,dimension(4) :: datashape4d ! shape of 4D datasets |
---|
32 | |
---|
33 | real :: miss_val=9.99e+33 ! special "missing value" to specify missing data |
---|
34 | real,parameter :: miss_val_def=9.99e+33 ! default value for "missing value" |
---|
35 | real :: pi |
---|
36 | real,dimension(:),allocatable :: lon ! longitude |
---|
37 | integer lonlength ! # of grid points along longitude |
---|
38 | real,dimension(:),allocatable :: lat ! latitude |
---|
39 | real,dimension(:),allocatable :: latrad ! latitude in radian |
---|
40 | integer latlength ! # of grid points along latitude |
---|
41 | real,dimension(:),allocatable :: plev ! Pressure levels (Pa) |
---|
42 | integer altlength ! # of grid point along altitude (of input datasets) |
---|
43 | real,dimension(:),allocatable :: time ! time |
---|
44 | integer timelength ! # of points along time |
---|
45 | real,dimension(:,:,:),allocatable :: ps ! surface pressure |
---|
46 | real,dimension(:,:,:,:),allocatable :: temp ! atmospheric temperature |
---|
47 | real,dimension(:,:,:,:),allocatable :: vitu ! zonal wind (in m/s) |
---|
48 | real,dimension(:,:,:,:),allocatable :: vitv ! meridional wind (in m/s) |
---|
49 | real,dimension(:,:,:,:),allocatable :: za ! above areoid levels (m) |
---|
50 | |
---|
51 | !!! output variables |
---|
52 | real,dimension(:,:,:,:),allocatable :: stab ! stability (K/km) |
---|
53 | real,dimension(:,:,:,:),allocatable :: Ri ! Richardson number |
---|
54 | real,dimension(:,:,:),allocatable :: deqc ! distance to cyclostrophic equilibrium |
---|
55 | |
---|
56 | ! variables prepared for computation (4D) |
---|
57 | real,dimension(:,:,:,:),allocatable :: rayon ! distance to center (m) |
---|
58 | real,dimension(:,:,:,:),allocatable :: grav ! gravity field (m s-2) |
---|
59 | real,dimension(:,:,:,:),allocatable :: dmass ! mass in cell (kg) |
---|
60 | |
---|
61 | ! variables prepared for computation inside timeloop |
---|
62 | real,dimension(:,:,:),allocatable :: t3d ! temp |
---|
63 | real,dimension(:,:,:),allocatable :: u3d ! zonal wind |
---|
64 | real,dimension(:,:,:),allocatable :: v3d ! merid wind |
---|
65 | ! variables obtained from computation inside timeloop |
---|
66 | real,dimension(:,:,:),allocatable :: stab3d ! stability (K/km) |
---|
67 | real,dimension(:,:,:),allocatable :: Ri3d ! Richardson number |
---|
68 | real,dimension(:,:),allocatable :: deqc2d ! distance to cyclostrophic equilibrium |
---|
69 | |
---|
70 | real,dimension(:,:),allocatable :: t2d ! temp |
---|
71 | real,dimension(:,:),allocatable :: u2d ! zonal wind |
---|
72 | real,dimension(:,:),allocatable :: v2d ! merid wind |
---|
73 | real,dimension(:,:),allocatable :: dtsdp ! d(temp)/d(plev) |
---|
74 | real,dimension(:,:),allocatable :: dusdp ! du/d(plev) |
---|
75 | real,dimension(:,:),allocatable :: dvsdp ! dv/d(plev) |
---|
76 | |
---|
77 | integer ierr,ierr1,ierr2 ! NetCDF routines return codes |
---|
78 | integer i,j,ilon,ilat,ilev,itim ! for loops |
---|
79 | logical :: lmdflag |
---|
80 | |
---|
81 | real :: deltalat,deltalon ! lat and lon intervals in radians |
---|
82 | real :: fac1,ecden,ecnum ! for cyclo eq. |
---|
83 | |
---|
84 | real :: cpdet |
---|
85 | |
---|
86 | include "planet.h" |
---|
87 | |
---|
88 | !=============================================================================== |
---|
89 | ! 1. Input parameters |
---|
90 | !=============================================================================== |
---|
91 | |
---|
92 | pi = 2.*asin(1.) |
---|
93 | |
---|
94 | write(*,*) "" |
---|
95 | write(*,*) "You are working on the atmosphere of ",planet |
---|
96 | |
---|
97 | !=============================================================================== |
---|
98 | ! 1.1 Input file |
---|
99 | !=============================================================================== |
---|
100 | |
---|
101 | write(*,*) "" |
---|
102 | write(*,*) "Program valid for files with pressure axis (*_P.nc)" |
---|
103 | write(*,*) "Enter input file name:" |
---|
104 | |
---|
105 | read(*,'(a128)') infile |
---|
106 | write(*,*) "" |
---|
107 | |
---|
108 | ! open input file |
---|
109 | |
---|
110 | ierr = NF_OPEN(infile,NF_NOWRITE,infid) |
---|
111 | if (ierr.ne.NF_NOERR) then |
---|
112 | write(*,*) 'ERROR: Pb opening file ',trim(infile) |
---|
113 | stop "" |
---|
114 | endif |
---|
115 | |
---|
116 | !=============================================================================== |
---|
117 | ! 1.2 Get grids in lon,lat,alt(pressure),time |
---|
118 | !=============================================================================== |
---|
119 | |
---|
120 | call get_iddim(infid,lat_varid,latlength,lon_varid,lonlength,& |
---|
121 | alt_varid,altlength,time_varid,timelength,lmdflag ) |
---|
122 | |
---|
123 | allocate(lon(lonlength)) |
---|
124 | ierr=NF_GET_VAR_REAL(infid,lon_varid,lon) |
---|
125 | if (ierr.ne.NF_NOERR) stop "Error: Failed reading longitude" |
---|
126 | |
---|
127 | allocate(lat(latlength)) |
---|
128 | ierr=NF_GET_VAR_REAL(infid,lat_varid,lat) |
---|
129 | if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" |
---|
130 | |
---|
131 | allocate(latrad(latlength)) |
---|
132 | latrad = lat*pi/180. |
---|
133 | |
---|
134 | ! Lat, lon pressure intervals |
---|
135 | deltalat = abs(latrad(2)-latrad(1)) |
---|
136 | deltalon = abs(lon(2)-lon(1))*pi/180. |
---|
137 | |
---|
138 | allocate(plev(altlength)) |
---|
139 | ierr=NF_GET_VAR_REAL(infid,alt_varid,plev) |
---|
140 | if (ierr.ne.NF_NOERR) stop "Error: Failed reading altitude (ie pressure levels)" |
---|
141 | |
---|
142 | allocate(time(timelength)) |
---|
143 | ierr=NF_GET_VAR_REAL(infid,time_varid,time) |
---|
144 | if (ierr.ne.NF_NOERR) stop "Error: Failed reading time" |
---|
145 | |
---|
146 | !=============================================================================== |
---|
147 | ! 1.3 Get output file name |
---|
148 | !=============================================================================== |
---|
149 | write(*,*) "" |
---|
150 | !write(*,*) "Enter output file name" |
---|
151 | !read(*,*) outfile |
---|
152 | outfile=infile(1:len_trim(infile)-3)//"_STA.nc" |
---|
153 | write(*,*) "Output file name is: "//trim(outfile) |
---|
154 | |
---|
155 | |
---|
156 | |
---|
157 | !=============================================================================== |
---|
158 | ! 2.1 Store needed fields |
---|
159 | !=============================================================================== |
---|
160 | |
---|
161 | !=============================================================================== |
---|
162 | ! 2.1.1 Surface pressure |
---|
163 | !=============================================================================== |
---|
164 | allocate(ps(lonlength,latlength,timelength)) |
---|
165 | |
---|
166 | text="ps" |
---|
167 | call get_var3d(infid,lonlength,latlength,timelength,text,ps,ierr1,ierr2) |
---|
168 | if (ierr1.ne.NF_NOERR) then |
---|
169 | write(*,*) " looking for psol instead... " |
---|
170 | text="psol" |
---|
171 | call get_var3d(infid,lonlength,latlength,timelength,text,ps,ierr1,ierr2) |
---|
172 | if (ierr1.ne.NF_NOERR) stop "Error: Failed to get psol ID" |
---|
173 | endif |
---|
174 | if (ierr2.ne.NF_NOERR) stop "Error: Failed reading surface pressure" |
---|
175 | |
---|
176 | !=============================================================================== |
---|
177 | ! 2.1.2 Atmospheric temperature |
---|
178 | !=============================================================================== |
---|
179 | allocate(temp(lonlength,latlength,altlength,timelength)) |
---|
180 | |
---|
181 | text="temp" |
---|
182 | call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,ierr1,ierr2) |
---|
183 | if (ierr1.ne.NF_NOERR) then |
---|
184 | write(*,*) " looking for t instead... " |
---|
185 | text="t" |
---|
186 | call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,ierr1,ierr2) |
---|
187 | if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID" |
---|
188 | endif |
---|
189 | if (ierr2.ne.NF_NOERR) stop "Error: Failed reading temperature" |
---|
190 | |
---|
191 | !=============================================================================== |
---|
192 | ! 2.1.3 Winds |
---|
193 | !=============================================================================== |
---|
194 | allocate(vitu(lonlength,latlength,altlength,timelength)) |
---|
195 | allocate(vitv(lonlength,latlength,altlength,timelength)) |
---|
196 | |
---|
197 | ! zonal wind vitu (in m/s) |
---|
198 | text="vitu" |
---|
199 | call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,ierr1,ierr2) |
---|
200 | if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" |
---|
201 | if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" |
---|
202 | |
---|
203 | ! meridional wind vitv (in m/s) |
---|
204 | text="vitv" |
---|
205 | call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,ierr1,ierr2) |
---|
206 | if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" |
---|
207 | if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" |
---|
208 | |
---|
209 | !=============================================================================== |
---|
210 | ! 2.1.4 Altitude above areoide |
---|
211 | !=============================================================================== |
---|
212 | ! Only needed if g(z) on Titan... |
---|
213 | |
---|
214 | ! allocate(za(lonlength,latlength,altlength,timelength)) |
---|
215 | |
---|
216 | ! text="zareoid" |
---|
217 | ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,ierr1,ierr2) |
---|
218 | ! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" |
---|
219 | ! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" |
---|
220 | |
---|
221 | !=============================================================================== |
---|
222 | !!! Allocations before timeloop |
---|
223 | !=============================================================================== |
---|
224 | |
---|
225 | ! latlength correspond a jjm+1 |
---|
226 | ! mais lonlength correspond a iim |
---|
227 | ! pour boucler en longitude, on a besoin du point iim+1 (= 1) |
---|
228 | |
---|
229 | allocate(rayon(lonlength+1,latlength,altlength,timelength)) |
---|
230 | allocate(grav(lonlength+1,latlength,altlength,timelength)) |
---|
231 | allocate(dmass(lonlength+1,latlength,altlength,timelength)) |
---|
232 | |
---|
233 | allocate(t3d(lonlength+1,latlength,altlength)) |
---|
234 | allocate(u3d(lonlength+1,latlength,altlength)) |
---|
235 | allocate(v3d(lonlength+1,latlength,altlength)) |
---|
236 | |
---|
237 | allocate(t2d(latlength,altlength)) |
---|
238 | allocate(u2d(latlength,altlength)) |
---|
239 | allocate(v2d(latlength,altlength)) |
---|
240 | allocate(dtsdp(latlength,altlength)) |
---|
241 | allocate(dusdp(latlength,altlength)) |
---|
242 | allocate(dvsdp(latlength,altlength)) |
---|
243 | |
---|
244 | allocate(stab(lonlength,latlength,altlength,timelength)) |
---|
245 | allocate(Ri(lonlength,latlength,altlength,timelength)) |
---|
246 | allocate(deqc(latlength,altlength,timelength)) |
---|
247 | |
---|
248 | allocate(stab3d(lonlength+1,latlength,altlength)) |
---|
249 | allocate(Ri3d(lonlength+1,latlength,altlength)) |
---|
250 | allocate(deqc2d(latlength,altlength)) |
---|
251 | |
---|
252 | !=============================================================================== |
---|
253 | ! 2.2.2 Mass in cells |
---|
254 | !=============================================================================== |
---|
255 | |
---|
256 | do itim=1,timelength |
---|
257 | do ilon=1,lonlength |
---|
258 | do ilat=1,latlength |
---|
259 | do ilev=1,altlength |
---|
260 | ! Need to be consistent with GCM computations |
---|
261 | ! if (za(ilon,ilat,ilev,itim).ne.miss_val) then |
---|
262 | rayon(ilon,ilat,ilev,itim) = a0 |
---|
263 | ! rayon(ilon,ilat,ilev,itim) = za(ilon,ilat,ilev,itim) + a0 |
---|
264 | grav(ilon,ilat,ilev,itim) = g0*a0*a0 & |
---|
265 | /(rayon(ilon,ilat,ilev,itim)*rayon(ilon,ilat,ilev,itim)) |
---|
266 | ! else |
---|
267 | ! rayon(ilon,ilat,ilev,itim) = miss_val |
---|
268 | ! grav(ilon,ilat,ilev,itim) = miss_val |
---|
269 | ! endif |
---|
270 | enddo |
---|
271 | enddo |
---|
272 | enddo |
---|
273 | enddo ! timelength |
---|
274 | |
---|
275 | rayon(lonlength+1,:,:,:) = rayon(1,:,:,:) |
---|
276 | grav(lonlength+1,:,:,:) = grav(1,:,:,:) |
---|
277 | |
---|
278 | call cellmass(infid,latlength,lonlength+1,altlength,timelength, & |
---|
279 | lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, & |
---|
280 | dmass ) |
---|
281 | |
---|
282 | !=============================================================================== |
---|
283 | !!! GLOBAL TIME LOOP !!! |
---|
284 | !=============================================================================== |
---|
285 | do itim=1,timelength |
---|
286 | |
---|
287 | !=============================================================================== |
---|
288 | ! 2.2 Computations |
---|
289 | !=============================================================================== |
---|
290 | |
---|
291 | !=============================================================================== |
---|
292 | ! 2.2.3 Init of 3D variables |
---|
293 | !=============================================================================== |
---|
294 | |
---|
295 | do ilon=1,lonlength |
---|
296 | do ilat=1,latlength |
---|
297 | do ilev=1,altlength |
---|
298 | t3d(ilon,ilat,ilev) = temp(ilon,ilat,ilev,itim) |
---|
299 | u3d(ilon,ilat,ilev) = vitu(ilon,ilat,ilev,itim) |
---|
300 | v3d(ilon,ilat,ilev) = vitv(ilon,ilat,ilev,itim) |
---|
301 | enddo |
---|
302 | enddo |
---|
303 | enddo |
---|
304 | |
---|
305 | t3d(lonlength+1,:,:) = t3d(1,:,:) |
---|
306 | u3d(lonlength+1,:,:) = u3d(1,:,:) |
---|
307 | v3d(lonlength+1,:,:) = v3d(1,:,:) |
---|
308 | |
---|
309 | !=============================================================================== |
---|
310 | ! 2.2.4 Stability |
---|
311 | !=============================================================================== |
---|
312 | |
---|
313 | do ilon=1,lonlength+1 |
---|
314 | t2d(:,:) = t3d(ilon,:,:) |
---|
315 | call dx_dp(latlength,altlength,miss_val,plev,t2d,dtsdp) |
---|
316 | do ilat=1,latlength |
---|
317 | do ilev=1,altlength |
---|
318 | if ((grav(ilon,ilat,ilev,itim).ne.miss_val).and. & |
---|
319 | ( t3d(ilon,ilat,ilev).ne.miss_val) ) then |
---|
320 | stab3d(ilon,ilat,ilev) = grav(ilon,ilat,ilev,itim)* & |
---|
321 | ( 1./cpdet(t2d(ilat,ilev)) & |
---|
322 | - plev(ilev)*dtsdp(ilat,ilev)/(R0*t2d(ilat,ilev)) ) |
---|
323 | stab3d(ilon,ilat,ilev) = stab3d(ilon,ilat,ilev)*1000. ! passage en K/km |
---|
324 | else |
---|
325 | stab3d(ilon,ilat,ilev) = miss_val |
---|
326 | endif |
---|
327 | enddo |
---|
328 | enddo |
---|
329 | enddo |
---|
330 | |
---|
331 | !=============================================================================== |
---|
332 | ! 2.2.5 Richardson number |
---|
333 | !=============================================================================== |
---|
334 | |
---|
335 | do ilon=1,lonlength+1 |
---|
336 | u2d(:,:) = u3d(ilon,:,:) |
---|
337 | v2d(:,:) = v3d(ilon,:,:) |
---|
338 | call dx_dp(latlength,altlength,miss_val,plev,u2d,dusdp) |
---|
339 | call dx_dp(latlength,altlength,miss_val,plev,v2d,dvsdp) |
---|
340 | do ilat=1,latlength |
---|
341 | do ilev=1,altlength |
---|
342 | if ((grav(ilon,ilat,ilev,itim).ne.miss_val).and. & |
---|
343 | ( u3d(ilon,ilat,ilev).ne.miss_val).and. & |
---|
344 | ( v3d(ilon,ilat,ilev).ne.miss_val).and. & |
---|
345 | ( t3d(ilon,ilat,ilev).ne.miss_val) ) then |
---|
346 | Ri3d(ilon,ilat,ilev) = & ! attention, transfo a cause de du/dp au lieu de du/dz |
---|
347 | stab3d(ilon,ilat,ilev)*t3d(ilon,ilat,ilev)*R0*R0 & |
---|
348 | / (grav(ilon,ilat,ilev,itim)*plev(ilev)*plev(ilev)) & |
---|
349 | / (dusdp(ilat,ilev)*dusdp(ilat,ilev)+dvsdp(ilat,ilev)*dvsdp(ilat,ilev)) |
---|
350 | else |
---|
351 | Ri3d(ilon,ilat,ilev) = miss_val |
---|
352 | endif |
---|
353 | enddo |
---|
354 | enddo |
---|
355 | enddo |
---|
356 | |
---|
357 | !=============================================================================== |
---|
358 | ! 2.2.6 Distance to cyclostrophic equilibrium |
---|
359 | !=============================================================================== |
---|
360 | |
---|
361 | call moyzon(lonlength,latlength,altlength,miss_val,u3d,u2d) |
---|
362 | call moyzon(lonlength,latlength,altlength,miss_val,t3d,t2d) |
---|
363 | call dx_dp(latlength,altlength,miss_val,plev,u2d,dusdp) |
---|
364 | |
---|
365 | do ilat=2,latlength-1 |
---|
366 | if (tan(latrad(ilat)).ne.0.) then |
---|
367 | fac1 = R0/tan(latrad(ilat)) |
---|
368 | else |
---|
369 | fac1 = miss_val |
---|
370 | endif |
---|
371 | do ilev=1,altlength |
---|
372 | if ((dusdp(ilat,ilev).ne.miss_val).and. & |
---|
373 | ( u2d(ilat,ilev).ne.miss_val).and. & |
---|
374 | ( fac1.ne.miss_val).and. & |
---|
375 | ( t2d(ilat,ilev).ne.miss_val) ) then |
---|
376 | ecden = dusdp(ilat,ilev)*(2.*u2d(ilat,ilev)*plev(ilev)) |
---|
377 | ecnum = ((t2d(ilat+1,ilev)-t2d(ilat-1,ilev))/(2.*deltalat)*fac1-ecden)*100. |
---|
378 | deqc2d(ilat,ilev) = ecnum/ecden |
---|
379 | else |
---|
380 | deqc2d(ilat,ilev) = miss_val |
---|
381 | endif |
---|
382 | enddo |
---|
383 | enddo |
---|
384 | do ilev=1,altlength |
---|
385 | deqc2d(1,ilev) = miss_val |
---|
386 | deqc2d(latlength,ilev) = miss_val |
---|
387 | enddo |
---|
388 | |
---|
389 | !=============================================================================== |
---|
390 | ! 2.2.7 Building 3D+time variables |
---|
391 | !=============================================================================== |
---|
392 | |
---|
393 | deqc(:,:,itim) = deqc2d(:,:) |
---|
394 | stab(:,:,:,itim) = stab3d(1:lonlength,:,:) |
---|
395 | Ri(:,:,:,itim) = Ri3d(1:lonlength,:,:) |
---|
396 | |
---|
397 | |
---|
398 | enddo ! timelength |
---|
399 | !=============================================================================== |
---|
400 | !!! END GLOBAL TIME LOOP !!! |
---|
401 | !=============================================================================== |
---|
402 | |
---|
403 | print*,"End of computations" |
---|
404 | |
---|
405 | !=============================================================================== |
---|
406 | ! 3. Create output file |
---|
407 | !=============================================================================== |
---|
408 | |
---|
409 | ! Create output file |
---|
410 | ierr=NF_CREATE(outfile,NF_CLOBBER,outfid) |
---|
411 | if (ierr.ne.NF_NOERR) then |
---|
412 | write(*,*)"Error: could not create file ",outfile |
---|
413 | stop |
---|
414 | endif |
---|
415 | |
---|
416 | !=============================================================================== |
---|
417 | ! 3.1. Define and write dimensions |
---|
418 | !=============================================================================== |
---|
419 | |
---|
420 | call write_dim(outfid,lonlength,latlength,altlength,timelength, & |
---|
421 | lon,lat,plev,time,lon_dimid,lat_dimid,alt_dimid,time_dimid) |
---|
422 | |
---|
423 | !=============================================================================== |
---|
424 | ! 3.2. Define and write variables |
---|
425 | !=============================================================================== |
---|
426 | |
---|
427 | ! 3D Variables |
---|
428 | |
---|
429 | datashape3d(1)=lat_dimid |
---|
430 | datashape3d(2)=alt_dimid |
---|
431 | datashape3d(3)=time_dimid |
---|
432 | |
---|
433 | call write_var3d(outfid,datashape3d,latlength,altlength,timelength,& |
---|
434 | "deqc ", "Distance to cyclo eq","per cent ",miss_val,& |
---|
435 | deqc ) |
---|
436 | |
---|
437 | ! 4D Variables |
---|
438 | |
---|
439 | datashape4d(1)=lon_dimid |
---|
440 | datashape4d(2)=lat_dimid |
---|
441 | datashape4d(3)=alt_dimid |
---|
442 | datashape4d(4)=time_dimid |
---|
443 | |
---|
444 | call write_var4d(outfid,datashape4d,lonlength,latlength,altlength,timelength,& |
---|
445 | "stab ", "Stability ","K/km ",miss_val,& |
---|
446 | stab ) |
---|
447 | |
---|
448 | call write_var4d(outfid,datashape4d,lonlength,latlength,altlength,timelength,& |
---|
449 | "Ri ", "Richardson number "," ",miss_val,& |
---|
450 | Ri ) |
---|
451 | |
---|
452 | |
---|
453 | !!!! Close output file |
---|
454 | ierr=NF_CLOSE(outfid) |
---|
455 | if (ierr.ne.NF_NOERR) then |
---|
456 | write(*,*) 'Error, failed to close output file ',outfile |
---|
457 | endif |
---|
458 | |
---|
459 | |
---|
460 | end program |
---|