C*************************************************************** PROGRAM UV24HR C*************************************************************** C C Purpose: create global noontime composite fields C C 00Z runs start at 180W C * 12Z runs start at 00E C C Changes: C 209-03-05 : CRIAG LONG C added ip2 and itri to comgrib C changed ifcst to (ifday*24) c set ip2 to (ifday+1)*24 C set itri to 2 C 2021-07-14 Hai-Tien Lee C Revise time zone (longitudes) assignment C Time zone -12 and +12 are half width C Time zone -12 includes 180W C Time zone 0 covers [-7.5 to 7.0] deg (right side yield) C Note: Cycle is no longer used in time zone assignment. C This version is hardcoded for 12Z run. C 2022-01-24 Hai-Tien Lee C Modified for 0.25 deg field, changes: C longitude zone boundary indices - lon_zone_index C indices for uv24 assignment for time zone dependent longitude bands C******************************************************************* C integer nx, ny, nxy parameter (nx=1440, ny=721, nxy=nx*ny) parameter (mxbit=32, lenpds=28, lengds=32) parameter (mxsize=30+lenpds+lengds+nxy*(mxbit+1)/8) C real uv(nx,ny), uv24(nx,ny), uvgrb(nxy) C integer yy, mm, dd, ihr, ifcst, idscale, idmodel, idpara, > idlevel, itot, yyyy, ip2, itri C character*1 kbuf(mxsize) integer izone integer lon_zone_index(25) C common /comgrib/yy,mm,dd,ihr,ifcst,idscale,idmodel,idpara, > idlevel,itot,ip2,itri C 0p50 boundary C data lon_zone_index/361,376,406,436,466,496,526,556,586,616, C $ 646,676, 1, 16, 46, 76,106,136,166,196,226,256,286,316,346/ C 0p25 boundary data lon_zone_index/721, 751, 811, 871, 931, 991,1051,1111,1171, $ 1231,1291,1351, 1, 31, 91, 151, 211, 271, 331, 391, 451, $ 511, 571, 631, 691/ C------------------------------------------------------------------- C read(5,*) icycl read(5,*) ifday C open(50, status='replace', form='formatted') C C 2021-07-14 Hai-Tien Lee Revise Time zone UV assingment C assign UV in 25 time zones. UV is a 0.5deg field (720x361) C iun=11 is for time zone -12 (izone=1) C iun=23 for time zone 0 (izone=13) C iun=35 is for time zone +12 (izone=25) C 2022-01-24 Hai-Tien Lee Update indices for 0.25deg field (1440x721) do 20 izone=1,25 iun=izone+10 open(iun, status='old', form='formatted') read(iun,900) idate read(iun,901) uv close(iun) C special treatment for time zone -12, +12, and 0. C time zone -12 and +12 are half width (time zone -12 include 180W) C time zone 0 includes wrap around longitudes if ( izone .eq. 1 ) then c time zone -12 uv24(721:750,:)=uv(721:750,:) else if ( izone .eq. 25) then c time zone +12 uv24(691:720,:)=uv(691:720,:) else if ( izone .eq. 13 ) then c time zone 0 uv24(1:30,:)=uv(1:30,:) uv24(1411:1440,:)=uv(1411:1440,:) else C any other time zones klona=lon_zone_index(izone) klonb=lon_zone_index(izone)+59 write(6,*) izone,klona,klonb uv24(klona:klonb,:)=uv(klona:klonb,:) endif 20 continue C C...write 24hr file C write(50,902) idate, icycl, ifday write(50,901) uv24 C C...create grib file C yyyy = idate/10000 yy = mod(yyyy,100) mm = (idate - yyyy*10000)/100 dd = idate - yyyy*10000 - mm*100 ihr = icycl ifcst = ifday*24 idscale = 0 idmodel = 2 idpara = 206 idlevel = 1 ip2 = (ifday+1)*24 itri = 2 C...model 2 = uv index C...para 206 = uv index (W/M**2) C...level 1 = surface C C...convert unit mW/m**2 to Grib Standard W/m**2 C do 50 j = 1, ny do 40 i = 1, nx k = (j-1)*nx + i uvgrb(k) = uv24(i,j)*1.0e-3 40 continue 50 continue C call grib(uvgrb, kbuf) C open(60, status='replace', form='unformatted',access='direct', > recl=itot) C write(60,rec=1) (kbuf(i),i=1,itot) C 900 format(I8) 901 format(10f8.2) 902 format(I8.8, I3, I3) C end