/[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.9 - (show annotations) (download)
Fri Jul 16 19:37:04 2004 UTC (19 years, 11 months ago) by molod
Branch: MAIN
CVS Tags: checkpoint54c_post
Changes since 1.8: +26 -26 lines
Debugging
Add Land Surface Model (Koster-Suarez) code to fizhi

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

  ViewVC Help
Powered by ViewVC 1.1.22