/[MITgcm]/MITgcm/pkg/fizhi/update_ocean_exports.F
ViewVC logotype

Contents of /MITgcm/pkg/fizhi/update_ocean_exports.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.10 - (show annotations) (download)
Sun Jul 18 23:17:00 2004 UTC (19 years, 11 months ago) by molod
Branch: MAIN
Changes since 1.9: +3 -1 lines
Fix last issues: save statements, random number generator

1 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/update_ocean_exports.F,v 1.9 2004/07/16 19:37:04 molod Exp $
2 C $Name: $
3
4 subroutine update_ocean_exports (myTime, myIter, myThid)
5 c----------------------------------------------------------------------
6 c Subroutine update_ocean_exports - 'Wrapper' routine to update
7 c the fields related to the ocean's surface that are needed
8 c by fizhi (sst and sea ice extent).
9 c
10 c Call: getsst (Return the current sst field-read dataset if needed)
11 c getsice (Return the current sea ice field-read data if needed)
12 c-----------------------------------------------------------------------
13 implicit none
14 #include "CPP_OPTIONS.h"
15 #include "SIZE.h"
16 #include "GRID.h"
17 #include "fizhi_ocean_coms.h"
18 #include "EEPARAMS.h"
19 #include "chronos.h"
20
21 integer myTime, myIter, myThid
22
23 integer i, j, bi, bj, biglobal, bjglobal
24 integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2
25 integer nSxglobal, nSyglobal
26 integer ksst,kice
27 _RL sstmin
28 parameter ( sstmin = 273.16 )
29
30 idim1 = 1-OLx
31 idim2 = sNx+OLx
32 jdim1 = 1-OLy
33 jdim2 = sNy+OLy
34 im1 = 1
35 im2 = sNx
36 jm1 = 1
37 jm2 = sNy
38 nSxglobal = nSx*nPx
39 nSyglobal = nSy*nPy
40
41 call mdsfindunit( ksst, myThid )
42 call mdsfindunit( kice, myThid )
43
44 C***********************************************************************
45
46 DO BJ = myByLo(myThid),myByHi(myThid)
47 DO BI = myBxLo(myThid),myBxHi(myThid)
48
49 biglobal=bi+(myXGlobalLo-1)/im2
50 bjglobal=bj+(myYGlobalLo-1)/jm2
51
52 call getsst(ksst,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx,
53 . nSy,nSxglobal,nSyglobal,bi,bj,biglobal,bjglobal,nymd,nhms,sst)
54 call getsice(kice,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx,
55 . nSy,nSxglobal,nSyglobal,bi,bj,biglobal,bjglobal,nymd,nhms,sice)
56
57 c Check for Minimum Open-Water SST
58 c --------------------------------
59 do j=jm1,jm2
60 do i=im1,im2
61 if(sice(i,j,bi,bj).eq.0.0 .and. sst(i,j,bi,bj).lt.sstmin)
62 . sst(i,j,bi,bj) = sstmin
63 enddo
64 enddo
65
66 ENDDO
67 ENDDO
68
69 return
70 end
71
72 subroutine getsice(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,
73 . nSx,nSy,nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms,sice)
74 C************************************************************************
75 C
76 C!ROUTINE: GETSICE
77 C!DESCRIPTION: GETSICE returns the sea ice depth.
78 C! This routine is adaptable for any frequency
79 C! data upto a daily frequency.
80 C! note: for diurnal data ndmax should be increased.
81 C
82 C!INPUT PARAMETERS:
83 C! iunit Unit number assigned to the sice data file
84 C! idim1 Start dimension in x-direction
85 C! idim2 End dimension in x-direction
86 C! jdim1 Start dimension in y-direction
87 C! jdim2 End dimension in y-direction
88 C! im1 Begin of x-direction span for filling sice
89 C! im2 End of x-direction span for filling sice
90 C! jm1 Begin of y-direction span for filling sice
91 C! jm2 End of y-direction span for filling sice
92 C! nSx Number of processors in x-direction (local processor)
93 C! nSy Number of processors in y-direction (local processor)
94 C! nPx Number of processors in x-direction (global)
95 C! nPy Number of processors in y-direction (global)
96 C! bi Processor number in x-direction (local to processor)
97 C! bj Processor number in y-direction (local to processor)
98 C! biglobal Processor number in x-direction (global)
99 C! bjglobal Processor number in y-direction (global)
100 C! nymd YYMMDD of the current model timestep
101 C! nhms HHMMSS of the model time
102 C
103 C!OUTPUT PARAMETERS:
104 C! sice(idim1:idim2,jdim1:jdim2,nSx,nSy) Sea ice depth in meters
105 C
106 C!ROUTINES CALLED:
107 C
108 C! bcdata Reads the data for a given unit number
109 C! bcheader Reads the header info for a given unit number
110 C! interp_time Returns weights for linear interpolation
111 C
112 C--------------------------------------------------------------------------
113
114 implicit none
115 #include "CPP_EEOPTIONS.h"
116
117 integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx,nSy
118 integer nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms
119
120 _RL sice(idim1:idim2,jdim1:jdim2,nSx,nSy)
121
122 C Maximum number of dates in one year for the data
123 integer ndmax
124 parameter (ndmax = 370)
125
126 character*8 cname
127 character*80 cdscrip
128 real fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef
129 logical first, found, error
130 integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc,npxbc,npybc
131 integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec
132 integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod
133
134 real sicebc1(im2,jm2,nPx,nPy),sicebc2(im2,jm2,nPx,nPy)
135
136 C--------- Variable Initialization ---------------------------------
137
138 data first /.true./
139 data error /.false./
140
141 save
142
143 c save header info
144 c save imbc,jmbc,npxbc,npybc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc
145 c save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2
146 c save first
147 c save sicebc1, sicebc2
148
149 c this only works for between 1950-2050
150 if (nymd .lt. 500101) then
151 nymdmod = 20000000 + nymd
152 else if (nymd .le. 991231) then
153 nymdmod = 19000000 + nymd
154 else
155 nymdmod = nymd
156 endif
157
158 c initialize so that first time through they have values for the check
159 c these vaules make the iyear .ne. iyearbc true anyways for
160 c for the first time so first isnt checked below.
161
162 if (first) then
163 nymdbc(2) = 0
164 nymdbc1 = 0
165 nymdbc2 = 0
166 nhmsbc1 = 0
167 nhmsbc2 = 0
168 first = .false.
169 endif
170
171 C---------- Read in Header file ----------------------------------
172
173 iyear = nymdmod/10000
174 iyearbc = nymdbc(2)/10000
175
176 if( iyear.ne.iyearbc ) then
177
178 close(iunit)
179 open (iunit,form='unformatted',access='direct',
180 . recl=im2*jm2*nPx*nPy*4)
181 nrec = 1
182 call bcheader (iunit, ndmax, nrec,
183 . cname, cdscrip, imbc, jmbc, npxbc, npybc, lat0, lon0,
184 . ndatebc, nymdbc, nhmsbc, undef, error)
185
186 C--------- Check data for Compatibility ------------------------------
187
188 C Check for correct data in boundary condition file
189 if (.not.error .and. cname.ne.'SICE') then
190 write(6,*)'Wrong data in SICE boundary condition file => ',cname
191 error = .true.
192 endif
193
194 C Check Horizontal Resolution
195 if(.not.error .and. imbc*jmbc*npxbc*npybc.ne.im2*jm2*npx*npy)then
196 write(6,*) ' B.C. Resolution DOES NOT match Model Resolution!'
197 write(6,*) ' B.C. Resolution: ',imbc*jmbc*npxbc*npybc
198 write(6,*) 'Model Resolution: ',im2*jm2*npx*npy
199 error = .true.
200 endif
201
202 C Check Year
203 iyearbc = nymdbc(2)/10000
204 if (.not.error .and. iyear.ne.iyearbc .and. iyearbc.ne.0) then
205 write(6,*)' B.C. Year DOES NOT match REQUESTED Year!'
206 write(6,*)' B.C. Year: ', iyearbc
207 write(6,*)'Requested Year: ', iyear
208 error = .true.
209 endif
210
211 if (.not.error) then
212 C if climatology, fill dates for data with current model year
213 if (iyearbc.eq.0) then
214 write(6,*)
215 write(6,*) 'Climatological Dataset is being used.'
216 write(6,*) 'Current model year to be used to fill Header Dates'
217 do n = 2, ndatebc-1
218 nymdbc(n) = nymdbc(n) +(nymdmod/10000)*10000
219 enddo
220 C For the first date subtract 1 year from the current model NYMD
221 n = 1
222 nymdbc(n) = nymdbc(n) +(nymdmod/10000-1)*10000
223 C For the last date add 1 year to the current model NYMD
224 n = ndatebc
225 nymdbc(n) = nymdbc(n) +(nymdmod/10000+1)*10000
226 endif
227
228 C Write out header info
229 write(6,*) ' Updated boundary condition data'
230 write(6,*) ' ---------------------------------'
231 write(6,*) ' Variable: ',cname
232 write(6,*) ' Description: ',cdscrip
233 write(6,*) ' Resolution: x= ',imbc,' y= ',jmbc,
234 . ' Undefined value = ',undef
235 write(6,*) ' Starting latitude = ',lat0,' longitude =',lon0
236 write(6,*) ' Data valid at these times: '
237 ndby3 = ndatebc/3
238 do n = 1, ndby3*3,3
239 write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=n,n+2)
240 1000 format(3(2x,i3,':',i8,2x,i8))
241 enddo
242 write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=ndby3*3+1,ndatebc)
243 endif
244
245 endif
246
247 C---------- Read sice data if necessary -------------------------------
248
249 found = .false.
250 nd = 2
251
252 c If model time is not within the times of saved sice data
253 c from previous call to getsice then read new data
254
255 timemod = float(nymdmod) + float(nhms) /1000000
256 timebc1 = float(nymdbc1) + float(nhmsbc1)/1000000
257 timebc2 = float(nymdbc2) + float(nhmsbc2)/1000000
258
259 if (timemod .lt. timebc1 .or. timemod .ge. timebc2) then
260
261 do while (.not.found .and. nd .le. ndatebc)
262 timebc2 = float(nymdbc(nd)) + float(nhmsbc(nd))/1000000
263 if (timebc2 .gt. timemod) then
264 nymdbc1 = nymdbc(nd-1)
265 nymdbc2 = nymdbc(nd)
266 nhmsbc1 = nhmsbc(nd-1)
267 nhmsbc2 = nhmsbc(nd)
268 call bcdata (iunit,imbc,jmbc,nPx,nPy,nd,nd+1,sicebc1,sicebc2)
269 found = .true.
270 else
271 nd = nd + 1
272 endif
273 enddo
274
275 c Otherwise the data from the last time in getsice surrounds the
276 c current model time.
277
278 else
279 found = .true.
280 endif
281
282 if (.not.found) then
283 print *, 'STOP: Could not find SICE dates for model time.'
284 call my_finalize
285 call my_exit (101)
286 endif
287
288 C---------- Interpolate sice data ------------------------------------
289
290 call interp_time(nymdmod,nhms,nymdbc1,nhmsbc1,nymdbc2,nhmsbc2,
291 . fac1,fac2)
292
293 do j = jm1,jm2
294 do i = im1,im2
295 sice(i,j,bi,bj) = sicebc1(i,j,biglobal,bjglobal)*fac1
296 . + sicebc2(i,j,biglobal,bjglobal)*fac2
297 c average to 0 or 1
298 c -----------------
299 if (sice(i,j,bi,bj) .ge. 0.5) then
300 sice(i,j,bi,bj) = 1.
301 else
302 sice(i,j,bi,bj) = 0.
303 endif
304 enddo
305 enddo
306
307 C---------- Fill sice with depth of ice ------------------------------------
308 do j = jm1,jm2
309 do i = im1,im2
310 if (sice(i,j,bi,bj) .eq. 1.) then
311 sice(i,j,bi,bj) = 3.
312 endif
313 enddo
314 enddo
315 C---------------------------------------------------------------------------
316
317 return
318 end
319 subroutine getsst(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,
320 . nSx,nSy,nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms,sst)
321 C************************************************************************
322 C
323 C!ROUTINE: GETSST
324 C!DESCRIPTION: GETSST gets the SST data.
325 C! This routine is adaptable for any frequency
326 C! data upto a daily frequency.
327 C! note: for diurnal data ndmax should be increased.
328 C
329 C!INPUT PARAMETERS:
330 C! iunit Unit number assigned to the sice data file
331 C! idim1 Start dimension in x-direction
332 C! idim2 End dimension in x-direction
333 C! jdim1 Start dimension in y-direction
334 C! jdim2 End dimension in y-direction
335 C! im1 Begin of x-direction span for filling sice
336 C! im2 End of x-direction span for filling sice
337 C! jm1 Begin of y-direction span for filling sice
338 C! jm2 End of y-direction span for filling sice
339 C! nSx Number of processors in x-direction (local processor)
340 C! nSy Number of processors in y-direction (local processor)
341 C! nPx Number of processors in x-direction (global)
342 C! nPy Number of processors in y-direction (global)
343 C! bi Processor number in x-direction (local to processor)
344 C! bj Processor number in y-direction (local to processor)
345 C! biglobal Processor number in x-direction (global)
346 C! bjglobal Processor number in y-direction (global)
347 C! nymd YYMMDD of the current model timestep
348 C! nhms HHMMSS of the model time
349 C
350 C!OUTPUT PARAMETERS:
351 C! sst(idim1:idim2,jdim1:jdim2,nSx,nSy) Sea surface temperature (K)
352 C
353 C!ROUTINES CALLED:
354 C
355 C! bcdata Reads the data for a given unit number
356 C! bcheader Reads the header info for a given unit number
357 C! interp_time Returns weights for linear interpolation
358 C
359 C--------------------------------------------------------------------------
360
361 implicit none
362 #include "CPP_EEOPTIONS.h"
363
364 integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx,nSy
365 integer nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms
366
367 _RL sst(idim1:idim2,jdim1:jdim2,nSx,nSy)
368
369 C Maximum number of dates in one year for the data
370 integer ndmax
371 parameter (ndmax = 370)
372
373 character*8 cname
374 character*80 cdscrip
375 real fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef
376 logical first, found, error
377 integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc,npxbc,npybc
378 integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec
379 integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod
380
381 real sstbc1(im2,jm2,nPx,nPy),sstbc2(im2,jm2,nPx,nPy)
382
383 C--------- Variable Initialization ---------------------------------
384
385 data first /.true./
386 data error /.false./
387
388 c save header info
389 c save imbc,jmbc,npxbc,npybc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc
390 c save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2
391 c save first
392 c save sstbc1, sstbc2
393
394 c this only works for between 1950-2050
395 if (nymd .lt. 500101) then
396 nymdmod = 20000000 + nymd
397 else if (nymd .le. 991231) then
398 nymdmod = 19000000 + nymd
399 else
400 nymdmod = nymd
401 endif
402
403 c initialize so that first time through they have values for the check
404 c these vaules make the iyear .ne. iyearbc true anyways for
405 c for the first time so first isnt checked below.
406 if (first) then
407 nymdbc(2) = 0
408 nymdbc1 = 0
409 nymdbc2 = 0
410 nhmsbc1 = 0
411 nhmsbc2 = 0
412 first = .false.
413 endif
414
415 C---------- Read in Header file ----------------------------------
416
417 iyear = nymdmod/10000
418 iyearbc = nymdbc(2)/10000
419
420 if( iyear.ne.iyearbc ) then
421
422 close(iunit)
423 open (iunit,form='unformatted',access='direct',
424 . recl=im2*jm2*nPx*nPy*4)
425 nrec = 1
426 call bcheader (iunit, ndmax, nrec,
427 . cname, cdscrip, imbc, jmbc, npxbc, npybc, lat0, lon0,
428 . ndatebc, nymdbc, nhmsbc, undef, error)
429
430 C--------- Check data for Compatibility
431
432 C Check for correct data in boundary condition file
433 if (.not.error .and. cname.ne.'SST') then
434 write(6,*)'Wrong data in SST boundary condition file => ',cname
435 error = .true.
436 endif
437
438 C Check Horizontal Resolution
439 if(.not.error .and. imbc*jmbc*npxbc*npybc.ne.im2*jm2*npx*npy)then
440 write(6,*) ' B.C. Resolution DOES NOT match Model Resolution!'
441 write(6,*) ' B.C. Resolution: ',imbc*jmbc*npxbc*npybc
442 write(6,*) 'Model Resolution: ',im2*jm2*npx*npy
443 error = .true.
444 endif
445
446 C Check Year
447 iyearbc = nymdbc(2)/10000
448 if (.not.error .and. iyear.ne.iyearbc .and. iyearbc.ne.0) then
449 write(6,*)' B.C. Year DOES NOT match REQUESTED Year!'
450 write(6,*)' B.C. Year: ', iyearbc
451 write(6,*)'Requested Year: ', iyear
452 error = .true.
453 endif
454
455 if (.not.error) then
456 C if climatology, fill dates for data with current model year
457 if (iyearbc.eq.0) then
458 write(6,*)
459 write(6,*)'Climatological Dataset is being used.'
460 write(6,*)'Current model year is used to fill Header Dates'
461 do n = 2, ndatebc-1
462 nymdbc(n) = nymdbc(n) +(nymdmod/10000)*10000
463 enddo
464 C For the first date subtract 1 year from the current model NYMD
465 n = 1
466 nymdbc(n) = nymdbc(n) +(nymdmod/10000-1)*10000
467 C For the last date add 1 year to the current model NYMD
468 n = ndatebc
469 nymdbc(n) = nymdbc(n) +(nymdmod/10000+1)*10000
470 endif
471
472 C Write out header info
473 write(6,*) ' Updated boundary condition data'
474 write(6,*) ' ---------------------------------'
475 write(6,*) ' Variable: ',cname
476 write(6,*) ' Description: ',cdscrip
477 write(6,*) ' Resolution: x= ',imbc,' y= ',jmbc,
478 . ' Undefined value = ',undef
479 write(6,*) ' Starting latitude = ',lat0,' longitude =',lon0
480 write(6,*) ' Data valid at these times: '
481 ndby3 = ndatebc/3
482 do n = 1, ndby3*3,3
483 write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=n,n+2)
484 1000 format(3(2x,i3,':',i8,2x,i8))
485 enddo
486 write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=ndby3*3+1,ndatebc)
487 endif
488
489 if( error ) call my_exit (101)
490
491 endif
492
493 C---------- Read SST data if necessary -------------------------------
494
495 found = .false.
496 nd = 2
497
498 c If model time is not within the times of saved sst data
499 c from previous call to getsst then read new data
500
501 timemod = float(nymdmod) + float(nhms) /1000000
502 timebc1 = float(nymdbc1) + float(nhmsbc1)/1000000
503 timebc2 = float(nymdbc2) + float(nhmsbc2)/1000000
504 if (timemod .lt. timebc1 .or. timemod .ge. timebc2) then
505
506 do while (.not.found .and. nd .le. ndatebc)
507 timebc2 = float(nymdbc(nd)) + float(nhmsbc(nd))/1000000
508 if (timebc2 .gt. timemod) then
509 nymdbc1 = nymdbc(nd-1)
510 nymdbc2 = nymdbc(nd)
511 nhmsbc1 = nhmsbc(nd-1)
512 nhmsbc2 = nhmsbc(nd)
513 call bcdata (iunit,imbc,jmbc,nPx,nPy,nd,nd+1,sstbc1,sstbc2)
514 found = .true.
515 else
516 nd = nd + 1
517 endif
518 enddo
519
520 c Otherwise the data from the last time in getsst surrounds the
521 c current model time.
522
523 else
524 found = .true.
525 endif
526
527 if (.not.found) then
528 print *, 'STOP: Could not find SST dates for model time.'
529 call my_finalize
530 call my_exit (101)
531 endif
532
533 C---------- Interpolate SST data ------------------------------------
534
535 call interp_time(nymdmod,nhms,nymdbc1,nhmsbc1,nymdbc2,nhmsbc2,
536 . fac1,fac2)
537
538 do j = jm1,jm2
539 do i = im1,im2
540 sst(i,j,bi,bj) = sstbc1(i,j,biglobal,bjglobal)*fac1
541 . + sstbc2(i,j,biglobal,bjglobal)*fac2
542 enddo
543 enddo
544
545 return
546 end
547
548 subroutine bcdata (iunit,im,jm,nPx,nPy,nrec1,nrec2,field1,field2)
549 C************************************************************************
550 C
551 C!ROUTINE: BCDATA
552 C!DESCRIPTION: BCDATA reads the data from the file assigned to the
553 C! passed unit number and returns data from the two times
554 C! surrounding the current model time. The two record
555 C! postitions are not assumed to be next to each other.
556 C
557 C!INPUT PARAMETERS:
558 C! im number of x points
559 C! im number of x points
560 C! nPx number of faces in x-direction
561 C! nPy number of faces in y-direction
562 C! nrec1 record number of the time before the model time
563 C! nrec2 record number of the time after the model time
564 C
565 C!OUTPUT PARAMETERS:
566 C! field1(im,jm,nPx,nPy) data field before the model time
567 C! field2(im,jm,nPx,nPy) data field after the model time
568 C
569 C--------------------------------------------------------------------------
570 implicit none
571 #include "CPP_EEOPTIONS.h"
572
573 integer iunit,im,jm,nPx,nPy,nrec1,nrec2
574
575 real field1(im,jm,nPx,nPy)
576 real field2(im,jm,nPx,nPy)
577
578 integer i,j,n1,n2
579 real*4 f1(im,jm,nPx,nPy), f2(im,jm,nPx,nPy)
580
581 C--------- Read file -----------------------------------------------
582 read(iunit,rec=nrec1) f1
583 read(iunit,rec=nrec2) f2
584
585 do n2=1,nPy
586 do n1=1,nPx
587 do j=1,jm
588 do i=1,im
589 field1(i,j,n1,n2) = f1(i,j,n1,n2)
590 field2(i,j,n1,n2) = f2(i,j,n1,n2)
591 enddo
592 enddo
593 enddo
594 enddo
595
596 return
597 end
598 subroutine bcheader (iunit, ndmax, nrec,
599 . cname, cdscrip, im, jm, npx, npy, lat0, lon0, ndatebc,
600 . nymdbc, nhmsbc, undef, error)
601 C************************************************************************
602 C
603 C!ROUTINE: BCHEADER
604 C!DESCRIPTION: BCHEADER reads the header from a file and returns the info.
605 C
606 C!INPUT PARAMETERS:
607 C! iunit unit number assigned to the data file
608 C! ndmax maximum number of date/times of the data
609 C! nrec record number of the header info (or assume 1??)
610 C
611 C!OUTPUT PARAMETERS:
612 C! cname name of the data in the file header
613 C! cdscrip description of the data in the file header
614 C! im number of x points
615 C! jm number of y points
616 C! npx number of faces (processors) in x-direction
617 C! npy number of faces (processors) in x-direction
618 C! lat0 starting latitude for the data grid
619 C! lon0 starting longitude for the data grid
620 C! ndatebc number of date/times of the data in the file
621 C! nymdbc(ndmax) array of dates for the data including century
622 C! nhmsbc(ndmax) array of times for the data
623 C! undef value for undefined values in the data
624 C! error logical TRUE if dataset problem
625 C
626 C--------------------------------------------------------------------------
627 implicit none
628 #include "CPP_EEOPTIONS.h"
629
630 integer iunit, ndmax, nrec
631
632 character*8 cname
633 character*80 cdscrip
634 integer im,jm,npx,npy,ndatebc,nymdbc(ndmax),nhmsbc(ndmax)
635 real lat0,lon0,undef
636 logical error
637
638 integer i,n
639 integer*4 im_32,jm_32,npx_32,npy_32
640 integer*4 ndatebc_32,nhmsbc_32(ndmax),nymdbc_32(ndmax)
641 real*4 lat0_32,lon0_32,undef_32
642
643 C--------- Read file -----------------------------------------------
644
645 read(iunit,rec=nrec,err=500) cname, cdscrip,
646 . im_32, jm_32, npx_32, npy_32, lat0_32, lon0_32,
647 . ndatebc_32, undef_32,
648 . (nymdbc_32(i), nhmsbc_32(i), i=1,ndatebc_32)
649
650 im = im_32
651 jm = jm_32
652 npx = npx_32
653 npy = npy_32
654 lat0 = lat0_32
655 lon0 = lon0_32
656 undef = undef_32
657
658 ndatebc = ndatebc_32
659 do i=1,ndatebc
660 nymdbc(i) = nymdbc_32(i)
661 nhmsbc(i) = nhmsbc_32(i)
662 enddo
663
664 return
665 500 continue
666 print *, 'Error reading boundary condition from unit ',iunit
667 error = .true.
668 return
669 end

  ViewVC Help
Powered by ViewVC 1.1.22