28 |
integer i, j, bi, bj, bislot, bjslot |
integer i, j, bi, bj, bislot, bjslot |
29 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
30 |
integer xsize, ysize |
integer xsize, ysize |
|
integer ksst,kice |
|
31 |
_RL sstmin |
_RL sstmin |
32 |
parameter ( sstmin = 273.16 ) |
parameter ( sstmin = 273.16 ) |
33 |
|
|
40 |
#endif |
#endif |
41 |
_RL sst1(xsize,ysize),sst2(xsize,ysize) |
_RL sst1(xsize,ysize),sst2(xsize,ysize) |
42 |
_RL sice1(xsize,ysize),sice2(xsize,ysize) |
_RL sice1(xsize,ysize),sice2(xsize,ysize) |
43 |
|
integer nymd1sst(nSx,nSy),nymd2sst(nSx,nSy) |
44 |
|
integer nymd1sice(nSx,nSy),nymd2sice(nSx,nSy) |
45 |
|
integer nhms1sst(nSx,nSy),nhms2sst(nSx,nSy) |
46 |
|
integer nhms1sice(nSx,nSy),nhms2sice(nSx,nSy) |
47 |
|
integer sstdates(370,nSx,nSy),sicedates(370,nSx,nSy) |
48 |
|
integer ssttimes(370,nSx,nSy),sicetimes(370,nSx,nSy) |
49 |
|
logical first(nSx,nSy) |
50 |
|
integer nSxnSy |
51 |
|
parameter(nSxnSy = nSx*nSy) |
52 |
|
data first/nSxnSy*.true./ |
53 |
|
|
54 |
|
save nymd1sst,nymd2sst,nymd1sice,nymd2sice |
55 |
|
save nhms1sst,nhms2sst,nhms1sice,nhms2sice |
56 |
save sst1, sst2, sice1, sice2 |
save sst1, sst2, sice1, sice2 |
57 |
|
save sstdates, sicedates |
58 |
|
save ssttimes, sicetimes |
59 |
|
|
60 |
idim1 = 1-OLx |
idim1 = 1-OLx |
61 |
idim2 = sNx+OLx |
idim2 = sNx+OLx |
66 |
jm1 = 1 |
jm1 = 1 |
67 |
jm2 = sNy |
jm2 = sNy |
68 |
|
|
|
call mdsfindunit( ksst, myThid ) |
|
|
call mdsfindunit( kice, myThid ) |
|
|
|
|
69 |
C*********************************************************************** |
C*********************************************************************** |
70 |
|
|
71 |
DO BJ = myByLo(myThid),myByHi(myThid) |
DO BJ = myByLo(myThid),myByHi(myThid) |
79 |
#endif |
#endif |
80 |
|
|
81 |
call getsst(ksst,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx, |
call getsst(ksst,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx, |
82 |
. nSy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms,sst1,sst2,sst) |
. nSy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms,sst1,sst2, |
83 |
|
. first(bi,bj),nymd1sst(bi,bj),nymd2sst(bi,bj), |
84 |
|
. nhms1sst(bi,bj),nhms2sst(bi,bj),sstdates(1,bi,bj), |
85 |
|
. ssttimes(1,bi,bj),sst,myThid) |
86 |
call getsice(kice,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx, |
call getsice(kice,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx, |
87 |
. nSy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms,sice1,sice2,sice) |
. nSy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms,sice1,sice2, |
88 |
|
. first(bi,bj),nymd1sice(bi,bj),nymd2sice(bi,bj), |
89 |
|
. nhms1sice(bi,bj),nhms2sice(bi,bj),sicedates(1,bi,bj), |
90 |
|
. sicetimes(1,bi,bj),sice,myThid) |
91 |
|
|
92 |
c Check for Minimum Open-Water SST |
c Check for Minimum Open-Water SST |
93 |
c -------------------------------- |
c -------------------------------- |
107 |
end |
end |
108 |
|
|
109 |
subroutine getsice(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
subroutine getsice(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
110 |
. nSumx,nSumy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms, |
. nSumx,nSumy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms, |
111 |
. sicebc1,sicebc2,sice) |
. sicebc1,sicebc2,first,nymdbc1,nymdbc2,nhmsbc1,nhmsbc2, |
112 |
|
. nymdbc,nhmsbc,sice,mythid) |
113 |
C*********************************************************************** |
C*********************************************************************** |
114 |
C |
C |
115 |
C!ROUTINE: GETSICE |
C!ROUTINE: GETSICE |
154 |
#include "SIZE.h" |
#include "SIZE.h" |
155 |
|
|
156 |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSumx,nSumy |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSumx,nSumy |
157 |
integer xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms |
integer xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms,mythid |
158 |
|
|
159 |
_RL sicebc1(xsize,ysize) |
_RL sicebc1(xsize,ysize) |
160 |
_RL sicebc2(xsize,ysize) |
_RL sicebc2(xsize,ysize) |
161 |
_RL sice(idim1:idim2,jdim1:jdim2,nSumx,nSumy) |
_RL sice(idim1:idim2,jdim1:jdim2,nSumx,nSumy) |
162 |
|
integer nhmsbc1,nhmsbc2,nymdbc1,nymdbc2 |
163 |
|
logical first |
164 |
|
|
165 |
C Maximum number of dates in one year for the data |
C Maximum number of dates in one year for the data |
166 |
integer ndmax |
integer ndmax |
167 |
parameter (ndmax = 370) |
parameter (ndmax = 370) |
168 |
|
integer nymdbc(ndmax),nhmsbc(ndmax) |
169 |
|
|
170 |
character*8 cname |
character*8 cname |
171 |
character*80 cdscrip |
character*80 cdscrip |
172 |
character*40 sicedata |
character*40 sicedata |
173 |
_RL fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
_RL fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
174 |
logical first, found, error |
logical found, error |
175 |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc |
176 |
integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec |
integer ndatebc,nrec |
177 |
integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod |
integer nymdmod |
178 |
|
|
179 |
|
|
180 |
C--------- Variable Initialization --------------------------------- |
C--------- Variable Initialization --------------------------------- |
181 |
|
|
|
data first /.true./ |
|
182 |
data error /.false./ |
data error /.false./ |
183 |
|
|
184 |
c save header info |
c save header info |
185 |
save imbc,jmbc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc |
save imbc,jmbc,lat0,lon0,ndatebc,undef |
|
save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2 |
|
|
save first |
|
186 |
|
|
187 |
c this only works for between 1950-2050 |
c this only works for between 1950-2050 |
188 |
if (nymd .lt. 500101) then |
if (nymd .lt. 500101) then |
196 |
sicedata='sice19232.weekly.clim' |
sicedata='sice19232.weekly.clim' |
197 |
|
|
198 |
c initialize so that first time through they have values for the check |
c initialize so that first time through they have values for the check |
199 |
c these vaules make the iyear .ne. iyearbc true anyways for |
c these values make the iyear .ne. iyearbc true anyways for |
200 |
c for the first time so first isnt checked below. |
c for the first time so first isnt checked below. |
201 |
|
|
202 |
if (first) then |
if (first) then |
205 |
nymdbc2 = 0 |
nymdbc2 = 0 |
206 |
nhmsbc1 = 0 |
nhmsbc1 = 0 |
207 |
nhmsbc2 = 0 |
nhmsbc2 = 0 |
208 |
c first = .false. |
first = .false. |
209 |
endif |
endif |
210 |
|
|
211 |
C---------- Read in Header file ---------------------------------- |
C---------- Read in Header file ---------------------------------- |
215 |
|
|
216 |
if( iyear.ne.iyearbc ) then |
if( iyear.ne.iyearbc ) then |
217 |
|
|
218 |
|
close(iunit) |
219 |
open (iunit,file=sicedata,form='unformatted',access='direct', |
open (iunit,file=sicedata,form='unformatted',access='direct', |
220 |
. recl=xsize*ysize*4) |
. recl=xsize*ysize*4) |
221 |
nrec = 1 |
nrec = 1 |
266 |
endif |
endif |
267 |
|
|
268 |
C Write out header info |
C Write out header info |
269 |
|
_BEGIN_MASTER( myThid ) |
270 |
write(6,*) ' Updated boundary condition data' |
write(6,*) ' Updated boundary condition data' |
271 |
write(6,*) ' ---------------------------------' |
write(6,*) ' ---------------------------------' |
272 |
write(6,*) ' Variable: ',cname |
write(6,*) ' Variable: ',cname |
281 |
1000 format(3(2x,i3,':',i8,2x,i8)) |
1000 format(3(2x,i3,':',i8,2x,i8)) |
282 |
enddo |
enddo |
283 |
write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=ndby3*3+1,ndatebc) |
write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=ndby3*3+1,ndatebc) |
284 |
|
_END_MASTER( myThid ) |
285 |
endif |
endif |
286 |
|
|
287 |
endif |
endif |
294 |
c If model time is not within the times of saved sice data |
c If model time is not within the times of saved sice data |
295 |
c from previous call to getsice then read new data |
c from previous call to getsice then read new data |
296 |
|
|
297 |
timemod = float(nymdmod) + float(nhms) /1000000 |
timemod = dfloat(nymdmod) + dfloat(nhms) /1000000 |
298 |
timebc1 = float(nymdbc1) + float(nhmsbc1)/1000000 |
timebc1 = dfloat(nymdbc1) + dfloat(nhmsbc1)/1000000 |
299 |
timebc2 = float(nymdbc2) + float(nhmsbc2)/1000000 |
timebc2 = dfloat(nymdbc2) + dfloat(nhmsbc2)/1000000 |
300 |
|
|
301 |
if (timemod .lt. timebc1 .or. timemod .ge. timebc2) then |
if (timemod .lt. timebc1 .or. timemod .ge. timebc2) then |
302 |
|
|
303 |
do while (.not.found .and. nd .le. ndatebc) |
do while (.not.found .and. nd .le. ndatebc) |
304 |
timebc2 = float(nymdbc(nd)) + float(nhmsbc(nd))/1000000 |
timebc2 = dfloat(nymdbc(nd)) + dfloat(nhmsbc(nd))/1000000 |
305 |
if (timebc2 .gt. timemod) then |
if (timebc2 .gt. timemod) then |
306 |
nymdbc1 = nymdbc(nd-1) |
nymdbc1 = nymdbc(nd-1) |
307 |
nymdbc2 = nymdbc(nd) |
nymdbc2 = nymdbc(nd) |
355 |
enddo |
enddo |
356 |
enddo |
enddo |
357 |
C--------------------------------------------------------------------------- |
C--------------------------------------------------------------------------- |
|
close(iunit) |
|
358 |
|
|
359 |
return |
return |
360 |
end |
end |
361 |
subroutine getsst(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
subroutine getsst(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
362 |
. nSumx,nSumy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms, |
. nSumx,nSumy,xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms, |
363 |
. sstbc1,sstbc2,sst) |
. sstbc1,sstbc2,first,nymdbc1,nymdbc2,nhmsbc1,nhmsbc2, |
364 |
|
. nymdbc,nhmsbc,sst,mythid) |
365 |
C*********************************************************************** |
C*********************************************************************** |
366 |
C |
C |
367 |
C!ROUTINE: GETSST |
C!ROUTINE: GETSST |
406 |
#include "SIZE.h" |
#include "SIZE.h" |
407 |
|
|
408 |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSumx,nSumy |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSumx,nSumy |
409 |
integer xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms |
integer xsize,ysize,bi,bj,bislot,bjslot,nymd,nhms,mythid |
410 |
|
|
411 |
_RL sstbc1(xsize,ysize) |
_RL sstbc1(xsize,ysize) |
412 |
_RL sstbc2(xsize,ysize) |
_RL sstbc2(xsize,ysize) |
413 |
_RL sst(idim1:idim2,jdim1:jdim2,nSumx,nSumy) |
_RL sst(idim1:idim2,jdim1:jdim2,nSumx,nSumy) |
414 |
|
integer nhmsbc1,nhmsbc2,nymdbc1,nymdbc2 |
415 |
|
logical first |
416 |
|
|
417 |
C Maximum number of dates in one year for the data |
C Maximum number of dates in one year for the data |
418 |
integer ndmax |
integer ndmax |
419 |
parameter (ndmax = 370) |
parameter (ndmax = 370) |
420 |
|
integer nymdbc(ndmax),nhmsbc(ndmax) |
421 |
|
|
422 |
character*8 cname |
character*8 cname |
423 |
character*80 cdscrip |
character*80 cdscrip |
424 |
character*20 sstdata |
character*20 sstdata |
425 |
_RL fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
_RL fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
426 |
logical first, found, error |
logical found, error |
427 |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc |
428 |
integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec |
integer ndatebc,nrec |
429 |
integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod |
integer nymdmod |
430 |
|
|
431 |
|
|
432 |
C--------- Variable Initialization --------------------------------- |
C--------- Variable Initialization --------------------------------- |
433 |
|
|
|
data first /.true./ |
|
434 |
data error /.false./ |
data error /.false./ |
435 |
|
|
436 |
c save header info |
c save header info |
437 |
save imbc,jmbc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc |
save imbc,jmbc,lat0,lon0,ndatebc,undef |
|
save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2 |
|
|
save first |
|
438 |
|
|
439 |
c this only works for between 1950-2050 |
c this only works for between 1950-2050 |
440 |
if (nymd .lt. 500101) then |
if (nymd .lt. 500101) then |
456 |
nymdbc2 = 0 |
nymdbc2 = 0 |
457 |
nhmsbc1 = 0 |
nhmsbc1 = 0 |
458 |
nhmsbc2 = 0 |
nhmsbc2 = 0 |
459 |
c first = .false. |
first = .false. |
460 |
endif |
endif |
461 |
|
|
462 |
C---------- Read in Header file ---------------------------------- |
C---------- Read in Header file ---------------------------------- |
466 |
|
|
467 |
if( iyear.ne.iyearbc ) then |
if( iyear.ne.iyearbc ) then |
468 |
|
|
469 |
|
close(iunit) |
470 |
open (iunit,file=sstdata,form='unformatted',access='direct', |
open (iunit,file=sstdata,form='unformatted',access='direct', |
471 |
. recl=xsize*ysize*4) |
. recl=xsize*ysize*4) |
472 |
nrec = 1 |
nrec = 1 |
517 |
endif |
endif |
518 |
|
|
519 |
C Write out header info |
C Write out header info |
520 |
|
_BEGIN_MASTER( myThid ) |
521 |
write(6,*) ' Updated boundary condition data' |
write(6,*) ' Updated boundary condition data' |
522 |
write(6,*) ' ---------------------------------' |
write(6,*) ' ---------------------------------' |
523 |
write(6,*) ' Variable: ',cname |
write(6,*) ' Variable: ',cname |
532 |
1000 format(3(2x,i3,':',i8,2x,i8)) |
1000 format(3(2x,i3,':',i8,2x,i8)) |
533 |
enddo |
enddo |
534 |
write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=ndby3*3+1,ndatebc) |
write(6,1000) (nn,nymdbc(nn),nhmsbc(nn),nn=ndby3*3+1,ndatebc) |
535 |
|
_END_MASTER( myThid ) |
536 |
endif |
endif |
537 |
|
|
538 |
if( error ) call my_exit (101) |
if( error ) call my_exit (101) |
547 |
c If model time is not within the times of saved sst data |
c If model time is not within the times of saved sst data |
548 |
c from previous call to getsst then read new data |
c from previous call to getsst then read new data |
549 |
|
|
550 |
timemod = float(nymdmod) + float(nhms) /1000000 |
timemod = dfloat(nymdmod) + dfloat(nhms) /1000000 |
551 |
timebc1 = float(nymdbc1) + float(nhmsbc1)/1000000 |
timebc1 = dfloat(nymdbc1) + dfloat(nhmsbc1)/1000000 |
552 |
timebc2 = float(nymdbc2) + float(nhmsbc2)/1000000 |
timebc2 = dfloat(nymdbc2) + dfloat(nhmsbc2)/1000000 |
553 |
|
|
554 |
if (timemod .lt. timebc1 .or. timemod .ge. timebc2) then |
if (timemod .lt. timebc1 .or. timemod .ge. timebc2) then |
555 |
|
|
556 |
do while (.not.found .and. nd .le. ndatebc) |
do while (.not.found .and. nd .le. ndatebc) |
557 |
timebc2 = float(nymdbc(nd)) + float(nhmsbc(nd))/1000000 |
timebc2 = dfloat(nymdbc(nd)) + dfloat(nhmsbc(nd))/1000000 |
558 |
if (timebc2 .gt. timemod) then |
if (timebc2 .gt. timemod) then |
559 |
nymdbc1 = nymdbc(nd-1) |
nymdbc1 = nymdbc(nd-1) |
560 |
nymdbc2 = nymdbc(nd) |
nymdbc2 = nymdbc(nd) |
592 |
enddo |
enddo |
593 |
enddo |
enddo |
594 |
|
|
|
close(iunit) |
|
595 |
|
|
596 |
return |
return |
597 |
end |
end |