subroutine getwin(cwd,cwm,cwy,awadir,awudmx, awudmn,awhrmx) C ***************************************************************** wjr C reads wingen file into common blocks and supplies wingen data to main C C Edit History C 09-Mar-99 wjr created C include 'p1werm.inc' include 'file.fi' c + + + LOCAL COMMON BLOCKS + + + include 'main/w1win.inc' C C + + + Arguments + + + integer cwd,cwm,cwy real awadir,awudmx, awudmn,awhrmx C c + + + LOCAL VARIABLES + + + integer dayidx integer maxday character header*80 logical wrnflg integer ioc integer rewcnt C c + + + FUNCTION DECLARATIONS + + + C data rewcnt /0/ data dayidx /0/ data wrnflg /.true./ C C skip header if (dayidx.ne.0) goto 40 10 do 20 dayidx=1,8 read(luiwin,1010,err=9000) header 1010 format (a80) 20 continue C C load data buffers if it is the first day of a year 40 if (cwd.eq.1.and.cwm.eq.1) then maxday = 365 C *** if (mod(cwy,4).eq.0) maxday=366 do 30 dayidx=1,maxday ioc=0 read(luiwin, 1030, iostat=ioc) wwd(dayidx), wwm(dayidx), * wwy(dayidx), wwadir(dayidx), wwudmx(dayidx), * wwudmn(dayidx), wwhrmx(dayidx) 1030 format (2(1x, i2), 1x, i4, 4f6.1) if (ioc .eq. -1) then if (cwd.eq.1.and.cwm.eq.1) then rewind luiwin rewcnt = rewcnt + 1 if (rewcnt.eq.10) stop 1305 write(6,2030) 2030 format (' warning !',24x,' day month year') write(6,2040) cwd, cwm, cwy 2040 format (' current WINDGEN date - ',i2,9x,i2, * 8x,i4,/,' is the end of file - rewinding to top of ', * 'WINDGEN file', /) goto 10 else goto 9001 endif endif 30 continue dayidx = 1 endif C if (wrnflg) then if (wwd(dayidx).ne.cwd.or.wwm(dayidx).ne.cwm.or. * wwy(dayidx).ne.cwy) then write (*,2010) 2010 format (' warning !',28x,' day month year') write (6,2020) wwd(dayidx), wwm(dayidx), wwy(dayidx), * cwd, cwm, cwy 2020 format (' current simulation date - ',i2,9x,i2, * 8x,i4,/,' does not match current WINDGEN date - ',i2,9x, * i2,8x,i4,/) wrnflg = .false. endif endif C *** cwd = wwd(dayidx) C *** cwm = wwm(dayidx) C *** cwy = wwy(dayidx) awadir = wwadir(dayidx) awudmx = wwudmx(dayidx) awudmn = wwudmn(dayidx) awhrmx = wwhrmx(dayidx) dayidx = dayidx + 1 return C C error returns and stops C 9000 write(*,*) 'Unexpected error in wingen header' stop 1301 9001 write(*,*) 'Unexpected error reading wingen file day ', dayidx stop 1302 end