Page 1 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 1 program BUFR_TRANOMI 2 3 !$$$ MAIN PROGRAM DOCUMENTATION BLOCK 4 ! 5 ! MAIN PROGRAM: BUFR_TRANOMI 6 ! PRGMMR: KEYSER ORG: NP22 DATE: 2012-11-16 7 ! 8 ! Abstract: Reads in Aura OMI total ozone data from a raw HDF5 format file 9 ! (OMTO3) and reformats them into BUFR in preparation for their ingest into 10 ! the BUFR data base on the NCEP supercomputers. 11 ! 12 ! Program history log: 13 ! 2008-12-31 Greg Krasowski - Original author (adapted from decoder written 14 ! by Trevor Beck, NESDIS Sensor Physics Branch) 15 ! 2009-09-30 Dennis Keyser - Prepared for implementation into NCEP production 16 ! 2012-11-16 Dennis Keyser - Changes to run on WCOSS (minor). 17 ! 18 ! Usage: 19 ! 20 ! Input files: 21 ! command line argument 22 ! - HDF5 binary file containing raw OMI OMTO3 data 23 ! unit 31 - NCEP BUFR mnemonic table 24 ! 25 ! Output files: 26 ! unit 06 - printout 27 ! unit 51 - NCEP BUFR file containing OMI data 28 ! unit 52 - diagnostic (ASCII) output file (currently not written to) 29 ! 30 ! Subprograms called: 31 ! Unique: - TO3_DATASETS GRANULE_CALENDAR_DATE CHECK_ERROR 32 ! Library: 33 ! W3NCO - W3TAGB W3FI01 ERREXIT W3MOVDAT GBYTE 34 ! BUFRLIB - DATELEN OPENBF OPENMB UFBINT 35 ! WRITSB CLOSBF UPFTBV 36 ! HDF5LIB - H5OPEN_F H5FOPEN_F H5GOPEN_F H5AOPEN_NAME_F H5AREAD_F 37 ! H5ACLOSE_F H5DOPEN_F H5DREAD_F H5DCLOSE_F H5GCLOSE_F 38 ! H5FCLOSE_F H5CLOSE_F 39 ! SYSTEM - GET_COMMAND_ARGUMENT 40 ! 41 ! 42 ! Exit states 43 ! 0 = no errors detected 44 ! >0 = some type of error detected 45 ! 1 = Cannot open HDF5 interface 46 ! 2 = Cannot open HDF5 file 47 ! 3 = Cannot open a groupname 48 ! 4 = Cannot open an attribute 49 ! 5 = Cannot read attribute-based variable 50 ! 6 = Invalid number of along-track scan lines in file 51 ! 7 = Cannot close a groupname 52 ! 8 = Error returned from an HDF5 interface routine 53 ! 54 ! Remarks: 55 ! Note that input file is specified from command line argument. 56 ! 57 ! Code proceeds as follows: Page 2 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 58 ! 59 ! 1) Open the file. 60 ! 2) Read the calendar date (UTC). 61 ! 3) Read the number of along-track scans, typically about 1644. 62 ! 4) Allocate the variables, based on number of along track scans. 63 ! 5) Read the datasets, one at a time. 64 ! 6) Enocde dataset into BUFR. 65 ! 7) Close interfaces and deallocate variables. 66 ! 67 ! 68 ! 69 ! Attributes: 70 ! Language: FORTRAN 90 (free format) 71 ! Machine: NCEP WCOSS 72 ! 73 !$$$ 74 75 use to3_datasets 76 77 ! 78 ! ***MUST DEFINE ALL VARIABLES*** 79 implicit none 80 81 ! Set parameters and declare variables 82 ! ------------------------------------ 83 real :: rinc(5) 84 real(8) :: obs_8(19),bmiss 85 86 integer :: error ! Error flag returned by HDF5 interface calls 87 integer :: fid ! File ID number 88 integer :: gid ! Group ID number 89 integer :: attr_id ! Attribute ID 90 integer :: nXtrk ! Index pointing to cross-track measurement (scan 91 ! position, 1 to nXtracks) 92 integer :: nscan ! Index pointing to along-track scan (1 to nATscans) 93 integer :: numTimes(1) ! Must be array of one, for calling hdf5 attribute 94 ! function 95 integer :: lunbfr, lunprt, lundx, iwrite, iskip, iread, iret 96 integer :: idat(8), jdat(8), ibit(31), ii, nib 97 integer :: idate, iunpk, toqc, toqf, nbytw, nbitw, stko 98 integer(hsize_t), dimension(1) :: data_dims ! Required for call to read 99 ! attribute 100 integer(hsize_t), dimension(2) :: swath_dims ! Required for call to read 101 ! dataset 102 integer(kind=4) :: granuleyear,granulemonth,granuleday 103 integer, parameter :: nXtracks=60 ! OMI has exactly 60 across-track 104 ! measurements (scan positions) 105 106 character(LEN=256) :: to3_name ! Input filename, read from command line 107 ! argument 108 character(LEN=256) :: to3_output 109 character(LEN=8) :: subset 110 character(LEN=*), parameter :: totaloz_swath=& 111 "/HDFEOS/SWATHS/OMI Column Amount O3" 112 113 data lunbfr/51/, lunprt/52/, lundx/31/, bmiss/10e10/, iread/0/, iskip/0/, & 114 iwrite/0/ Page 3 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 115 116 !============================================================================= 117 !============================================================================= 118 119 call W3TAGB('BUFR_TRANOMI',2012,0321,0068,'NP22') 120 121 print * 122 print *, 'Welcome to BUFR_TRANOMI - Version 11-16-2012' 123 print * 124 125 126 ! Get machine word length (nbytw) and specify number of bits per word (nbitw) 127 ! --------------------------------------------------------------------------- 128 call W3FI01(nbytw) 129 nbitw = 8*nbytw 130 131 132 to3_output='omi_output' 133 134 135 ! Command line argument is input filename 136 ! --------------------------------------- 137 call GET_COMMAND_ARGUMENT(1,to3_name) 138 139 140 ! Initialize HDF5 interface 141 ! ------------------------- 142 call H5OPEN_F(error) 143 if(error.ne.0) then 144 write(*,'(" ##### Cannot open HDF5 interface, error = ",I0)') error 145 call W3TAGE('BUFR_TRANOMI') 146 call ERREXIT(1) 147 endif 148 149 150 ! Open HDF5 file 151 ! -------------- 152 call H5FOPEN_F( to3_name, H5F_ACC_RDONLY_F, fid, error) 153 if(error.ne.0) then 154 write(*,'(" ##### PROBLEM: Cannot open HDF5 file ",A,", error = ",I0)') & 155 trim(to3_name),error 156 call W3TAGE('BUFR_TRANOMI') 157 call ERREXIT(2) 158 endif 159 160 161 ! Get file (granule) start date (UTC) (YYYYMMDD) 162 ! ---------------------------------------------- 163 call GRANULE_CALENDAR_DATE(granuleyear,granulemonth,granuleday) 164 165 print * 166 write(*,'(" File (granule) start Date (UTC): ", I04,I0.2,I0.2)') & 167 granuleyear,granulemonth,granuleday 168 print * 169 170 171 ! Open groupname "/HDFEOS/SWATHS/OMI Column Amount O3" Page 4 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 172 ! ---------------------------------------------------- 173 call H5GOPEN_F(fid,trim(totaloz_swath), gid, error) 174 if(error.ne.0) then 175 write(*,'(" ##### Cannot open groupname ",A,", error = ",I0)') & 176 trim(totaloz_swath),error 177 call W3TAGE('BUFR_TRANOMI') 178 call ERREXIT(3) 179 endif 180 181 182 ! Extract number of along-track scan lines in file and set to "nATscans" 183 ! ---------------------------------------------------------------------- 184 call H5AOPEN_NAME_F(gid, "NumTimes", attr_id, error) 185 if(error.ne.0) then 186 write(*,'(" ##### Cannot open NumTimes attribute, error = ",I0)') error 187 call W3TAGE('BUFR_TRANOMI') 188 call ERREXIT(4) 189 endif 190 call H5AREAD_F(attr_id, H5T_NATIVE_INTEGER, numTimes,data_dims,error) 191 if(error.ne.0) then 192 write(*,'(" ##### Cannot read NumTimes, error = ",I0)') error 193 call W3TAGE('BUFR_TRANOMI') 194 call ERREXIT(5) 195 endif 196 call H5ACLOSE_F(attr_id,error) 197 if(error.ne.0) then 198 write(*,'(" ----- Cannot close NumTimes attribute (non-fatal), error = ",& 199 I0)') error 200 endif 201 nATscans=numTimes(1) 202 if(nATscans.le.0) then 203 write(*,'(" ##### Invalid number of along-track scan lines in file (=", & 204 I0)') nATscans 205 call W3TAGE('BUFR_TRANOMI') 206 call ERREXIT(6) 207 endif 208 209 print * 210 write(*,'(" Number of cross-track measurements (scan positions) = ",I0)') & 211 nXtracks 212 write(*,'(" Number of along-track scan lines = ",I0)') & 213 nATscans 214 print * 215 216 ! Allocate fields that will next be read 217 ! -------------------------------------- 218 allocate(tozone(nXtracks,nATscans)) 219 allocate(cldfcn(nXtracks,nATscans)) 220 allocate(aflags(nXtracks,nATscans)) 221 allocate(qflags(nXtracks,nATscans)) 222 allocate(acidx(nXtracks,nATscans)) 223 allocate(lat(nXtracks,nATscans)) 224 allocate(lon(nXtracks,nATscans)) 225 allocate(vza(nXtracks,nATscans)) 226 allocate(sza(nXtracks,nATscans)) 227 allocate(sec(nATscans)) 228 Page 5 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 229 swath_dims=(/nXtracks, nATscans /) 230 231 232 ! Extract best total column ozone solution (in "Data Fields" swath) & set to 233 ! "tozone" 234 ! -------------------------------------------------------------------------- 235 call H5DOPEN_F(gid, "Data Fields/"//ds_toz%name , ds_toz%dataset_id, error) 236 call CHECK_ERROR(error) 237 call H5DREAD_F(ds_toz%dataset_id ,H5T_NATIVE_REAL , tozone, swath_dims, error) 238 call CHECK_ERROR(error) 239 call H5DCLOSE_F(ds_toz%dataset_id, error) 240 call CHECK_ERROR(error) 241 242 243 ! Extract radiative cloud fraction (in "Data Fields" swath) & set to "cldfcn" 244 ! --------------------------------------------------------------------------- 245 call H5DOPEN_F(gid, "Data Fields/"//ds_cld%name , ds_cld%dataset_id, error) 246 call CHECK_ERROR(error) 247 call H5DREAD_F(ds_cld%dataset_id ,H5T_NATIVE_REAL , cldfcn, swath_dims, error) 248 call CHECK_ERROR(error) 249 call H5DCLOSE_F(ds_cld%dataset_id, error) 250 call CHECK_ERROR(error) 251 252 253 ! Extract alg. flag for best ozone (in "Data Fields" swath) and set to "aflags" 254 ! ----------------------------------------------------------------------------- 255 call H5DOPEN_F(gid, "Data Fields/"//ds_algflag%name , ds_algflag%dataset_id, & 256 error) 257 call CHECK_ERROR(error) 258 call H5DREAD_F(ds_algflag%dataset_id ,H5T_NATIVE_INTEGER , aflags, & 259 swath_dims, error) 260 call CHECK_ERROR(error) 261 call H5DCLOSE_F(ds_algflag%dataset_id, error) 262 call CHECK_ERROR(error) 263 264 265 ! Extract quality flags (in "Data Fields" swath) and set to "qflags" 266 ! ------------------------------------------------------------------ 267 call H5DOPEN_F(gid, "Data Fields/"//ds_qflag%name , ds_qflag%dataset_id, & 268 error) 269 call CHECK_ERROR(error) 270 call H5DREAD_F(ds_qflag%dataset_id ,H5T_NATIVE_INTEGER , qflags, swath_dims, & 271 error) 272 call CHECK_ERROR(error) 273 call H5DCLOSE_F(ds_qflag%dataset_id, error) 274 call CHECK_ERROR(error) 275 276 277 ! Extract UV aerosol index (in "Data Fields" swath) and set to "acidx" 278 ! -------------------------------------------------------------------- 279 call H5DOPEN_F(gid, "Data Fields/"//ds_acidx%name , ds_acidx%dataset_id, & 280 error) 281 call CHECK_ERROR(error) 282 call H5DREAD_F(ds_acidx%dataset_id ,H5T_NATIVE_REAL , acidx, swath_dims, & 283 error) 284 call CHECK_ERROR(error) 285 call H5DCLOSE_F(ds_acidx%dataset_id, error) Page 6 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 286 call CHECK_ERROR(error) 287 288 289 ! Extract latitude (in "Geolocation Fields" swath) and set to "lat" 290 ! ----------------------------------------------------------------- 291 call H5DOPEN_F(gid, "Geolocation Fields/"//ds_lat%name , ds_lat%dataset_id, & 292 error) 293 call CHECK_ERROR(error) 294 call H5DREAD_F(ds_lat%dataset_id ,H5T_NATIVE_REAL , lat, swath_dims, error) 295 call CHECK_ERROR(error) 296 call H5DCLOSE_F(ds_lat%dataset_id, error) 297 call CHECK_ERROR(error) 298 299 300 ! Extract longitude (in "Geolocation Fields" swath) and set to "lon" 301 ! ------------------------------------------------------------------ 302 call H5DOPEN_F(gid, "Geolocation Fields/"//ds_lon%name , ds_lon%dataset_id, & 303 error) 304 call CHECK_ERROR(error) 305 call H5DREAD_F(ds_lon%dataset_id ,H5T_NATIVE_REAL , lon, swath_dims, error) 306 call CHECK_ERROR(error) 307 call H5DCLOSE_F(ds_lon%dataset_id, error) 308 call CHECK_ERROR(error) 309 310 311 ! Extract viewing zenith angle (in "Geolocation Fields" swath) and set to "vza" 312 ! ----------------------------------------------------------------------------- 313 call H5DOPEN_F(gid, "Geolocation Fields/"//ds_vza%name , ds_vza%dataset_id, & 314 error) 315 call CHECK_ERROR(error) 316 call H5DREAD_F(ds_vza%dataset_id ,H5T_NATIVE_REAL , vza, swath_dims, error) 317 call CHECK_ERROR(error) 318 call H5DCLOSE_F(ds_vza%dataset_id, error) 319 call CHECK_ERROR(error) 320 321 322 ! Extract solar zenith angle (in "Geolocation Fields" swath) and set to "sza" 323 ! --------------------------------------------------------------------------- 324 call H5DOPEN_F(gid, "Geolocation Fields/"//ds_sza%name , ds_sza%dataset_id, & 325 error) 326 call CHECK_ERROR(error) 327 call H5DREAD_F(ds_sza%dataset_id ,H5T_NATIVE_REAL , sza, swath_dims, error) 328 call CHECK_ERROR(error) 329 call H5DCLOSE_F(ds_sza%dataset_id, error) 330 call CHECK_ERROR(error) 331 332 333 ! Extract seconds in day (UTC) (in "Geolocation Fields" swath) and set to "sec" 334 ! (Note: No nXtracks dimension on sec) 335 ! ----------------------------------------------------------------------------- 336 call H5DOPEN_F(gid, "Geolocation Fields/"//ds_sec%name , ds_sec%dataset_id, & 337 error) 338 call CHECK_ERROR(error) 339 call H5DREAD_F(ds_sec%dataset_id ,H5T_NATIVE_REAL , sec, swath_dims, error) 340 call CHECK_ERROR(error) 341 call H5DCLOSE_F(ds_sec%dataset_id, error) 342 call CHECK_ERROR(error) Page 7 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 343 344 345 subset = 'NC008013' ! Message type for OMI is "NC008013" 346 347 348 call DATELEN(10) 349 350 351 ! Open output BUFR file 352 ! --------------------- 353 !!!!! call OPENBF(lunbfr,'OUT',lundx) 354 call OPENBF(lunbfr,'NODX',lundx) 355 356 357 ! Open output diagnostic print file 358 ! --------------------------------- 359 !!open(lunprt,file=to3_output,form='formatted') 360 361 362 ! Loop through the cross-track measurements (scan positions) in data file 363 ! ----------------------------------------------------------------------- 364 do nXtrk=1,nXtracks 365 366 !!!write(lunprt,*) "==> At cross-track measurement (scan position) ",nXtrk 367 write(*,*) "==> At cross-track measurement (scan position) ",nXtrk 368 369 !!!write(lunprt,*) "latitude:" 370 !!!write(lunprt,*) lat(nXtrk,:) 371 372 !!!write(lunprt,*) "longitude:" 373 !!!write(lunprt,*) lon(nXtrk,:) 374 375 !!!write(lunprt,*) "viewing zenith angle:" 376 !!!write(lunprt,*) vza(nXtrk,:) 377 378 !!!write(lunprt,*) "solar zenith angle:" 379 !!!write(lunprt,*) sza(nXtrk,:) 380 381 !!!write(lunprt,*) "best total column ozone solution:" 382 !!!write(lunprt,*) tozone(nXtrk,:) 383 384 !!!write(lunprt,*) "radiative cloud fraction:" 385 !!!write(lunprt,*) cldfcn(nXtrk,:) 386 387 !!!write(lunprt,*) "aerosol index:" 388 !!!write(lunprt,*) acidx(nXtrk,:) 389 390 !!!write(lunprt,*) "algorithm flag for best ozone:" 391 !!!write(lunprt,*) aflags(nXtrk,:) 392 393 !!!write(lunprt,*) "quality flags:" 394 !!!write(lunprt,*) qflags(:,:) 395 396 ! Loop through the along-track scans in each cross-track measurement (scan pos.) 397 ! ------------------------------------------------------------------------------ 398 do nscan=1,nATscans 399 Page 8 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 400 iread = iread + 1 401 402 !!! write(lunprt,*) " ---> At along-track scan ",nscan 403 if(sec(nscan).lt.0. .or. sec(nscan).gt.86400.) then 404 write(*,'(" ##### Invalid date at scan - track ",I0,", scan ",I0, & 405 ", number of seconds in day = ",E," -- skip!!")') & 406 nXtrk,nscan,sec(nscan) 407 408 iskip = iskip + 1 409 cycle 410 endif 411 if(lat(nXtrk,nscan).lt.-90. .or. lat(nXtrk,nscan) .gt.90.) then 412 write(*,'(" ##### Invalid latitude at scan position ",I0,", scan ", & 413 I0,", latitude = ",I0," -- skip!!")') nXtrk,nscan,lat(nXtrk,nscan) 414 iskip = iskip + 1 415 cycle 416 endif 417 if(lon(nXtrk,nscan).lt.-180. .or. lon(nXtrk,nscan).gt.180.) then 418 write(*,'(" #### Invalid longitude at scan position ",I0,", scan ", & 419 I0,", longitude = ",I0," -- skip!!")') nXtrk,nscan,lon(nXtrk,nscan) 420 iskip = iskip + 1 421 cycle 422 endif 423 424 if(qflags(nXtrk,nscan).lt.65535.) then 425 426 ! Pull the last 4 bits out of qflags to determine if orbit is ascending or 427 ! descending and to obtain the total ozone quality code 428 ! ------------------------------------------------------------------------ 429 call GBYTE(qflags(nXtrk,nscan),iunpk,nbitw-4,4) 430 toqc = mod(iunpk,8) ! total ozone quality code 431 stko = 0 ! ascending orbit 432 if(iunpk.gt.7) stko = 1 ! descending orbit 433 434 ! Pull the first 28 (4-byte word machine) or 60 (8-byte word machine) bits out 435 ! of qflags and multiply by 2 to obtain the total ozone quality flag {multiply 436 ! by 2 allows for extra bit (=0) at end to hold "missing" when all bits on} 437 ! ----------------------------------------------------------------------------- 438 call GBYTE(qflags(nXtrk,nscan),iunpk,0,nbitw-4) 439 toqf = 2*iunpk ! total ozone quality flag 440 !!! write(*,*) "qflags, stko, toqc, toqf: ", & 441 !!! qflags(nXtrk,nscan), stko, toqc, toqf 442 endif 443 444 !!! write(lunprt,*) " seconds in day (UTC)=",sec(nscan) 445 446 rinc=0.0 447 rinc(4)=sec(nscan) 448 449 idat=0 450 idat(1)=granuleyear 451 idat(2)=granulemonth 452 idat(3)=granuleday 453 454 call W3MOVDAT(rinc,idat,jdat) 455 456 idate = jdat(1)*1000000 + jdat(2)*10000 + jdat(3)*100 + jdat(5) Page 9 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 457 458 !!! write(lunprt,*) " time of scan (HH : MM : SS)=",jdat(5), & 459 !!! ":",jdat(6),":",jdat(7) 460 461 462 ! Open a new output BUFR message (first time in, or if idate is different than 463 ! for previous output message 464 ! ---------------------------------------------------------------------------- 465 call OPENMB(lunbfr,subset,idate) 466 467 468 ! TRANSLATE THE OMI REPORT TO BUFR FORMAT 469 ! --------------------------------------------------------------------- 470 ! NC008013 | SAID CLAT CLON VZAN SOZA YEAR MNTH 471 ! NC008013 | DAYS HOUR MINU SECO STKO OZON AFBO 472 ! NC008013 | TOQC TOQF ACIDX CLDMNT FOVN 473 ! --------------------------------------------------------------------- 474 475 obs_8 = bmiss 476 477 obs_8(1) = 785 ! satellite id (Aura = 785) 478 obs_8(2) = lat(nXtrk,nscan) ! latitude (N+, S-) 479 obs_8(3) = lon(nXtrk,nscan) ! longitude (-180 to +180, W-, E+) 480 obs_8(4) = vza(nXtrk,nscan) ! viewing zenith angle 481 obs_8(5) = sza(nXtrk,nscan) ! solar zenith angle 482 obs_8(6) = jdat(1) ! year 483 obs_8(7) = jdat(2) ! month 484 obs_8(8) = jdat(3) ! day 485 obs_8(9) = jdat(5) ! hour 486 obs_8(10) = jdat(6) ! minute 487 obs_8(11) = jdat(7) ! second 488 obs_8(12) = stko ! ascending/descending orbit id 489 obs_8(13) = tozone(nXtrk,nscan) ! best total column ozone solution 490 obs_8(14) = aflags(nXtrk,nscan) ! algorithm flag for best ozone 491 obs_8(15) = toqc ! total ozone quality code 492 obs_8(16) = toqf ! total ozone quality flag 493 obs_8(17) = acidx(nXtrk,nscan) ! UV aerosol index 494 obs_8(18) = cldfcn(nXtrk,nscan)*100. ! radiative cloud fraction (%) 495 obs_8(19) = nXtrk ! scan position 496 497 if(nscan.eq.1 .or. nscan.eq.50) then ! sample scans 1 and 50 498 write(*,*) " ---> At scan ",nscan 499 write(*,'(" satellite id = ",F7.0)') obs_8(1) 500 write(*,'(" latitude = ",F7.2)') obs_8(2) 501 write(*,'(" longitude = ",F7.2)') obs_8(3) 502 write(*,'(" viewing zenith angle = ",F7.2)') obs_8(4) 503 write(*,'(" solar zenith angle = ",F7.2)') obs_8(5) 504 write(*,'(" UTC seconds in day = ",F7.0)') sec(nscan) 505 write(*,& 506 '(" UTC time of scan = ",I4,3I2.2,2(":",I2.2))') & 507 jdat(1),jdat(2),jdat(3),jdat(5),jdat(6),jdat(7) 508 write(*,'(" quality flags = ",F7.0)') & 509 qflags(nXtrk,nscan) 510 write(*,'(" asc/des orbit id = ",F7.0)') obs_8(12) 511 write(*,'(" total col ozone sol = ",F7.2)') obs_8(13) 512 write(*,'(" alg flg for best ozone = ",F7.0)') obs_8(14) 513 write(*,'(" total ozone qual code = ",F7.0)') obs_8(15) Page 10 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 514 write(*,'(" total ozone qual flag = ",F7.0)') obs_8(16) 515 call upftbv(lunbfr,'TOQF',obs_8(16),31,ibit,nib) 516 if(nib.gt.0) print 100, (ibit(ii),ii=1,nib) 517 100 format(35X,' (',I3,')') 518 write(*,'(" UV aerosol index = ",F7.2)') obs_8(17) 519 write(*,'(" radiative cld fraction = ",F7.2)') obs_8(18) 520 write(*,'(" scan position = ",F7.0)') obs_8(19) 521 endif 522 523 ! Store obs_8 array into BUFR subset 524 ! ---------------------------------- 525 call UFBINT(lunbfr,obs_8(1), 9,1,iret, & 526 'SAID CLAT CLON VZAN SOZA YEAR MNTH DAYS HOUR') 527 call UFBINT(lunbfr,obs_8(10),10,1,iret, & 528 'MINU SECO STKO OZON AFBO TOQC TOQF ACIDX CLDMNT FOVN') 529 530 ! Encode subset into BUFR message 531 ! ------------------------------- 532 call WRITSB(lunbfr) 533 iwrite = iwrite + 1 534 535 enddo 536 537 enddo 538 539 ! All reports have been processed 540 ! Close output BUFR file & write out any incomplete messages 541 ! ---------------------------------------------------------- 542 543 call CLOSBF(lunbfr) 544 545 546 ! Deallocate allocated arrays 547 ! --------------------------- 548 deallocate(tozone) 549 deallocate(cldfcn) 550 deallocate(lat) 551 deallocate(lon) 552 deallocate(vza) 553 deallocate(sza) 554 deallocate(sec) 555 deallocate(aflags) 556 deallocate(qflags) 557 deallocate(acidx) 558 559 560 !!close(lunprt) 561 562 563 ! Close the Group 564 ! --------------- 565 call H5GCLOSE_F(gid,error) 566 567 568 ! Close the file 569 ! -------------- 570 call H5FCLOSE_F(fid,error) Page 11 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 571 call CHECK_ERROR(error) 572 573 574 ! Close FORTRAN interface 575 ! ----------------------- 576 call H5CLOSE_F(error) 577 call CHECK_ERROR(error) 578 579 print * 580 print *, 'Number of scans read = ',iread 581 print *, 'Number of scans skipped = ',iskip 582 print *, 'Number of scans written = ',iwrite 583 print * 584 585 call W3TAGE('BUFR_TRANOMI') 586 587 stop 588 589 contains 590 591 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 592 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 593 594 ! Subroutine to get year, month, day at start of file (granule) 595 ! ------------------------------------------------------------- 596 597 subroutine GRANULE_CALENDAR_DATE(year,month,day) 598 599 ! ***MUST DEFINE ALL VARIABLES*** 600 implicit none 601 602 integer, intent(inout) :: year,month,day 603 integer :: fileattrib_gid 604 integer :: date(1) ! Must be array of one, for calling hdf5 attribute 605 ! function 606 character(LEN=*), parameter :: file_attr_swath=& 607 "/HDFEOS/ADDITIONAL/FILE_ATTRIBUTES/" 608 character(LEN=256) :: datename 609 610 611 ! Open groupname "/HDFEOS/ADDITIONAL/FILE_ATTRIBUTES/" 612 ! ---------------------------------------------------- 613 call H5GOPEN_F(fid,file_attr_swath, fileattrib_gid, error) 614 if(error.ne.0) then 615 write(*,'(" ##### Cannot open groupname ",A,", error = ",I0)') & 616 file_attr_swath,error 617 call W3TAGE('BUFR_TRANOMI') 618 call ERREXIT(3) 619 endif 620 621 622 ! Extract file day (day of month at start of the granule) and set to "day" 623 ! ------------------------------------------------------------------------ 624 datename="GranuleDay" 625 call H5AOPEN_NAME_F(fileattrib_gid, trim(datename), attr_id, error) 626 if(error.ne.0) then 627 write(*,'(" ##### Cannot open GranuleDay attribute, error = ",I0)') error Page 12 Source Listing GRANULE_CALENDAR_DATE 2012-12-13 18:38 tranomi.f90 628 call W3TAGE('BUFR_TRANOMI') 629 call ERREXIT(4) 630 endif 631 call H5AREAD_F(attr_id, H5T_NATIVE_INTEGER, date,data_dims,error) 632 if(error.ne.0) then 633 write(*,'(" ##### Cannot read GranuleDay, error = ",I0)') error 634 call W3TAGE('BUFR_TRANOMI') 635 call ERREXIT(5) 636 endif 637 call H5ACLOSE_F(attr_id,error) 638 if(error.ne.0) then 639 write(*,'(" ----- Cannot close GranuleDay attribute (non-fatal), ", & 640 "error = ",I0)') error 641 endif 642 day=date(1) 643 644 645 ! Extract file month (month at start of granule) and set to "month" 646 ! ----------------------------------------------------------------- 647 datename="GranuleMonth" 648 call H5AOPEN_NAME_F(fileattrib_gid, trim(datename), attr_id, error) 649 if(error.ne.0) then 650 write(*,'(" ##### Cannot open GranuleMonth attribute, error = ",I0)') & 651 error 652 call W3TAGE('BUFR_TRANOMI') 653 call ERREXIT(4) 654 endif 655 call H5AREAD_F(attr_id, H5T_NATIVE_INTEGER, date,data_dims,error) 656 if(error.ne.0) then 657 write(*,'(" ##### Cannot read GranuleMonth, error = ",I0)') error 658 call W3TAGE('BUFR_TRANOMI') 659 call ERREXIT(5) 660 endif 661 call H5ACLOSE_F(attr_id,error) 662 if(error.ne.0) then 663 write(*,'(" ----- Cannot close GranuleMonth attribute (non-fatal), ", & 664 "error = ",I0)') error 665 endif 666 month=date(1) 667 668 669 ! Extract file year (4-digit year at start of granule) and set to "year" 670 ! ---------------------------------------------------------------------- 671 datename="GranuleYear" 672 call H5AOPEN_NAME_F(fileattrib_gid, trim(datename), attr_id, error) 673 if(error.ne.0) then 674 write(*,'(" ##### Cannot open GranuleYear attribute, error = ",I0)') & 675 error 676 call W3TAGE('BUFR_TRANOMI') 677 call ERREXIT(4) 678 endif 679 call H5AREAD_F(attr_id, H5T_NATIVE_INTEGER, date,data_dims,error) 680 if(error.ne.0) then 681 write(*,'(" ##### Cannot read GranuleYear, error = ",I0)') error 682 call W3TAGE('BUFR_TRANOMI') 683 call ERREXIT(5) 684 endif Page 13 Source Listing GRANULE_CALENDAR_DATE 2012-12-13 18:38 tranomi.f90 685 call H5ACLOSE_F(attr_id,error) 686 if(error.ne.0) then 687 write(*,'(" ----- Cannot close GranuleYear attribute (non-fatal), ", & 688 "error = ",I0)') error 689 endif 690 year=date(1) 691 692 693 ! Close the Group 694 ! --------------- 695 call H5GCLOSE_F( fileattrib_gid, error) 696 if(error.ne.0) then 697 write(*,'(" ##### Cannot close groupname ",A,", error = ",I0)') & 698 file_attr_swath,error 699 call W3TAGE('BUFR_TRANOMI') 700 call ERREXIT(7) 701 endif 702 703 !!!!write(*,*) "granule_calendar_date day is ", day, month, year 704 705 end subroutine GRANULE_CALENDAR_DATE ENTRY POINTS Name bufr_tranomi_IP_granule_calendar_date_ Page 14 Source Listing GRANULE_CALENDAR_DATE 2012-12-13 18:38 Symbol Table tranomi.f90 SYMBOL CROSS REFERENCE Name Object Declared Type Bytes Dimen Elements Attributes References ATTR_ID Local 625 I(4) 4 scalar 184,190,196,625,631,637,648,655,66 1,672,679,685 DATA_DIMS Local 631 I(8) 8 1 1 190,631,655,679 DATE Local 604 I(4) 4 1 1 631,642,655,666,679,690 DATENAME Local 608 CHAR 256 scalar 624,625,647,648,671,672 DAY Dummy 597 I(4) 4 scalar ARG,INOUT 642 ERREXIT Subr 618 146,157,178,188,194,206,618,629,63 5,653,659,677,683,700,721 ERROR Local 613 I(4) 4 scalar 142,143,144,152,153,155,173,174,17 6,184,185,186,190,191,192,196,197, 199,235,236,237,238,239,240,245,24 6,247,248,249,250,256,257,259,260, 261,262,268,269,271,272,273,274,28 0,281,283,284,285,286,292,293,294, 295,296,297,303,304,305,306,307,30 8,314,315,316,317,318,319,325,326, 327,328,329,330,337,338,339,340,34 1,342,565,570,571,576,577,613,614, 616,625,626,627,631,632,633,637,63 8,640,648,649,651,655,656,657,661, 662,664,672,673,675,679,680,681,68 5,686,688,695,696,698,719 FID Local 613 I(4) 4 scalar 152,173,570,613 FILEATTRIB_GID Local 603 I(4) 4 scalar 613,625,648,672,695 FILE_ATTR_SWATH Param 606 CHAR 35 scalar 613,616,698 GRANULE_CALENDAR_DATE Subr 597 163 H5ACLOSE_F Subr 637 196,637,661,685 H5AOPEN_NAME_F Subr 625 184,625,648,672 H5AREAD_F Local 631 scalar 190,631,655,679 H5AREAD_INTEGER_1 Subr 631 190,631,655,679 H5GCLOSE_F Subr 695 565,695 H5GOPEN_F Subr 613 173,613 H5T_NATIVE_INTEGER Scalar 631 I(4) 4 scalar COM 190,258,270,631,655,679 MONTH Dummy 597 I(4) 4 scalar ARG,INOUT 666 TRIM Func 625 scalar 155,173,176,625,648,672 W3TAGE Subr 617 145,156,177,187,193,205,585,617,62 8,634,652,658,676,682,699,720 YEAR Dummy 597 I(4) 4 scalar ARG,INOUT 690 Page 15 Source Listing GRANULE_CALENDAR_DATE 2012-12-13 18:38 tranomi.f90 706 707 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 708 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 709 710 ! Generic check_error subroutine 711 ! ------------------------------ 712 713 subroutine CHECK_ERROR(error_code) 714 implicit none 715 integer, intent(in) :: error_code 716 717 if(error_code.ne.0) then 718 write(*,'(" #### Error returned from an HDF5 interface routine, ", & 719 "error = ",I0)') error 720 call W3TAGE('BUFR_TRANOMI') 721 call ERREXIT(8) 722 endif 723 724 end subroutine CHECK_ERROR ENTRY POINTS Name bufr_tranomi_IP_check_error_ SYMBOL CROSS REFERENCE Name Object Declared Type Bytes Dimen Elements Attributes References CHECK_ERROR Subr 713 236,238,240,246,248,250,257,260,26 2,269,272,274,281,284,286,293,295, 297,304,306,308,315,317,319,326,32 8,330,338,340,342,571,577 ERROR_CODE Dummy 713 I(4) 4 scalar ARG,IN 717 Page 16 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 725 726 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 727 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 728 729 end program BUFR_TRANOMI ENTRY POINTS Name MAIN__ SYMBOL CROSS REFERENCE Name Object Declared Type Bytes Dimen Elements Attributes References 100 Label 517 516 ACIDX Local 222 R(4) 4 2 1 ALC 222,282,493,557 AFLAGS Local 220 I(4) 4 2 1 ALC 220,258,490,555 BMISS Local 84 R(8) 8 scalar 113,475 BUFR_TRANOMI Prog 1 CLDFCN Local 219 R(4) 4 2 1 ALC 219,247,494,549 CLOSBF Subr 543 543 DATASET_ID Local 235 I(4) 4 scalar 235,237,239,245,247,249,255,258,26 1,267,270,273,279,282,285,291,294, 296,302,305,307,313,316,318,324,32 7,329,336,339,341 DATELEN Subr 348 348 DS_ACIDX Local 279 DSH5_T 144 scalar 279,282,285 DS_ALGFLAG Local 255 DSH5_T 144 scalar 255,258,261 DS_CLD Local 245 DSH5_T 144 scalar 245,247,249 DS_LAT Local 291 DSH5_T 144 scalar 291,294,296 DS_LON Local 302 DSH5_T 144 scalar 302,305,307 DS_QFLAG Local 267 DSH5_T 144 scalar 267,270,273 DS_SEC Local 336 DSH5_T 144 scalar 336,339,341 DS_SZA Local 324 DSH5_T 144 scalar 324,327,329 DS_TOZ Local 235 DSH5_T 144 scalar 235,237,239 DS_VZA Local 313 DSH5_T 144 scalar 313,316,318 GBYTE Subr 429 429,438 GET_COMMAND_ARGUMENT Intrin 137 137 GID Local 88 I(4) 4 scalar 173,184,235,245,255,267,279,291,30 2,313,324,336,565 GRANULEDAY Local 102 I(4) 4 scalar 163,167,452 GRANULEMONTH Local 102 I(4) 4 scalar 163,167,451 GRANULEYEAR Local 102 I(4) 4 scalar 163,167,450 H5CLOSE_F Subr 576 576 H5DCLOSE_F Subr 239 239,249,261,273,285,296,307,318,32 9,341 H5DOPEN_F Subr 235 235,245,255,267,279,291,302,313,32 4,336 H5DREAD_F Local 237 scalar 237,247,258,270,282,294,305,316,32 7,339 H5DREAD_INTEGER_2 Subr 258 258,270 H5DREAD_REAL_1 Subr 339 339 H5DREAD_REAL_2 Subr 237 237,247,282,294,305,316,327 Page 17 Source Listing CHECK_ERROR 2012-12-13 18:38 Symbol Table tranomi.f90 Name Object Declared Type Bytes Dimen Elements Attributes References H5FCLOSE_F Subr 570 570 H5FOPEN_F Subr 152 152 H5F_ACC_RDONLY_F Scalar 152 I(4) 4 scalar COM 152 H5OPEN_F Subr 142 142 H5T_NATIVE_REAL Scalar 237 I(4) 4 scalar COM 237,247,282,294,305,316,327,339 HSIZE_T Param 98 I(4) 4 scalar 98,100 IBIT Local 96 I(4) 4 1 31 515,516 IDAT Local 96 I(4) 4 1 8 449,450,451,452,454 IDATE Local 97 I(4) 4 scalar 456,465 II Local 96 I(4) 4 scalar 516 IREAD Local 95 I(4) 4 scalar 113,400,580 IRET Local 95 I(4) 4 scalar 525,527 ISKIP Local 95 I(4) 4 scalar 113,408,414,420,581 IUNPK Local 97 I(4) 4 scalar 429,430,432,438,439 IWRITE Local 95 I(4) 4 scalar 114,533,582 JDAT Local 96 I(4) 4 1 8 454,456,482,483,484,485,486,487,50 7 LAT Local 223 R(4) 4 2 1 ALC 223,294,411,413,478,550 LON Local 224 R(4) 4 2 1 ALC 224,305,417,419,479,551 LUNBFR Local 95 I(4) 4 scalar 113,354,465,515,525,527,532,543 LUNDX Local 95 I(4) 4 scalar 113,354 LUNPRT Local 95 I(4) 4 scalar 113 MOD Func 430 scalar 430 NAME Local 235 CHAR 80 scalar 235,245,255,267,279,291,302,313,32 4,336 NATSCANS Local 201 I(4) 4 scalar 201,202,204,213,218,219,220,221,22 2,223,224,225,226,227,229,398 NBITW Local 97 I(4) 4 scalar 129,429,438 NBYTW Local 97 I(4) 4 scalar 128,129 NIB Local 96 I(4) 4 scalar 515,516,517 NSCAN Local 92 I(4) 4 scalar 398,403,406,411,413,417,419,424,42 9,438,447,478,479,480,481,489,490, 493,494,497,498,504,509 NUMTIMES Local 93 I(4) 4 1 1 190,201 NXTRACKS Param 103 I(4) 4 scalar 211,218,219,220,221,222,223,224,22 5,226,229,364 NXTRK Local 90 I(4) 4 scalar 364,367,406,411,413,417,419,424,42 9,438,478,479,480,481,489,490,493, 494,495,509 OBS_8 Local 84 R(8) 8 1 19 475,477,478,479,480,481,482,483,48 4,485,486,487,488,489,490,491,492, 493,494,495,499,500,501,502,503,51 0,511,512,513,514,515,518,519,520, 525,527 OPENBF Subr 354 354 OPENMB Subr 465 465 QFLAGS Local 221 I(4) 4 2 1 ALC 221,270,424,429,438,509,556 RINC Local 83 R(4) 4 1 5 446,447,454 SEC Local 227 R(4) 4 1 1 ALC 227,339,403,406,447,504,554 STKO Local 97 I(4) 4 scalar 431,432,488 SUBSET Local 109 CHAR 8 scalar 345,465 SWATH_DIMS Local 100 I(8) 8 1 2 229,237,247,259,270,282,294,305,31 6,327,339 SZA Local 226 R(4) 4 2 1 ALC 226,327,481,553 TO3_DATASETS Module 75 75 Page 18 Source Listing CHECK_ERROR 2012-12-13 18:38 Symbol Table tranomi.f90 Name Object Declared Type Bytes Dimen Elements Attributes References TO3_NAME Local 106 CHAR 256 scalar 137,152,155 TO3_OUTPUT Local 108 CHAR 256 scalar 132 TOQC Local 97 I(4) 4 scalar 430,491 TOQF Local 97 I(4) 4 scalar 439,492 TOTALOZ_SWATH Param 110 CHAR 35 scalar 173,176 TOZONE Local 218 R(4) 4 2 1 ALC 218,237,489,548 UFBINT Subr 525 525,527 UPFTBV Subr 515 515 VZA Local 225 R(4) 4 2 1 ALC 225,316,480,552 W3FI01 Subr 128 128 W3MOVDAT Subr 454 454 W3TAGB Subr 119 119 WRITSB Subr 532 532 Page 19 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 730 Page 20 Source Listing CHECK_ERROR 2012-12-13 18:38 Subprograms/Common Blocks tranomi.f90 SUBPROGRAMS/COMMON BLOCKS Name Object Declared Type Bytes Dimen Elements Attributes References BUFR_TRANOMI Prog 1 CHECK_ERROR Subr 713 236,238,240,246,248,250,257,260,26 2,269,272,274,281,284,286,293,295, 297,304,306,308,315,317,319,326,32 8,330,338,340,342,571,577 GRANULE_CALENDAR_DATE Subr 597 163 COMPILER OPTIONS BEING USED -align nocommons -align nodcommons -align noqcommons -align records -align nosequence -align norec1byte -align norec2byte -align norec4byte -align norec8byte -align norec16byte -altparam -assume accuracy_sensitive -assume nobscc -assume nobuffered_io -assume nobyterecl -assume nocc_omp -assume nocstring -assume nodummy_aliases -assume nofpe_summary -assume noieee_fpe_flags -assume nominus0 -assume noold_boz -assume old_unit_star -assume noold_ldout_format -assume noold_logical_ldio -assume old_maxminloc -assume old_xor -assume protect_constants -assume noprotect_parens -assume split_common -assume source_include -assume nostd_intent_in -assume nostd_mod_proc_name -assume norealloc_lhs -assume underscore -assume no2underscores -auto no -auto_scalar no -bintext -ccdefault default -check noargs -check noarg_temp_created -check nobounds -check noformat -check nooutput_conversion -check nooverflow -check nopointers -check power -check noshape -check nounderflow -check nouninitialized -coarray-num-procs 0 no -coarray-config-file -convert big_endian -cross_reference -D __INTEL_COMPILER=1210 -D __unix__ -D __unix -D __linux__ -D __linux -D __gnu_linux__ -D unix -D linux -D __ELF__ -D __x86_64 -D __x86_64__ -D _MT -D __INTEL_COMPILER_BUILD_DATE=20120612 -D __i686 -D __i686__ -D __pentiumpro -D __pentiumpro__ -D __pentium4 -D __pentium4__ -D __tune_pentium4__ -D __SSE2__ -D __SSE__ -D __MMX__ -double_size 64 no -d_lines no -Qdyncom -error_limit 30 no -f66 no -f77rtl Page 21 Source Listing CHECK_ERROR 2012-12-13 18:38 tranomi.f90 no -fast -fpscomp nofilesfromcmd -fpscomp nogeneral -fpscomp noioformat -fpscomp noldio_spacing -fpscomp nologicals no -fpconstant -fpe3 -fprm nearest no -ftz -fp_model noprecise -fp_model fast -fp_model nostrict -fp_model nosource -fp_model nodouble -fp_model noextended -fp_model novery_fast -fp_model noexcept -fp_model nono_except -heap_arrays 0 no -threadprivate_compat -free -g0 -iface nomixed_str_len_arg -iface nono_mixed_str_len_arg no -intconstant -integer_size 32 no -mixed_str_len_arg no -module -names lowercase no -noinclude -O2 no -pad_source -real_size 32 no -recursive -reentrancy none no -sharable_localsaves -vec=simd -show noinclude -show map -show options no -syntax_only no -threadcom no -U no -vms -w noall -w nonone -w alignments -w noargument_checking -w nodeclarations -w general -w noignore_bounds -w noignore_loc -w nointerfaces -w notruncated_source -w uncalled -w uninitialized -w nounused -w usage -includepath : /usrx/local/intel/composerxe/tbb/include/,/usr/include/,./,/usrx/local/hdf5-1.8.9/include/, /usrx/local/hdf5-1.8.9/lib/,/usrx/local/intel/composerxe/mkl/include/,/usrx/local/intel/composerxe/tbb/include/, /gpfs/tp2/usrx/local/intel/composer_xe_2011_sp1.11.339/compiler/include/intel64/,/gpfs/tp2/usrx/local/intel/composer_xe_2011_sp1.11.339/compiler/include/, /usr/local/include/,/usr/lib/gcc/x86_64-redhat-linux/4.4.6/include/,/usr/include/,/usr/include/ -list filename : tranomi.lst -o filename : none COMPILER: Intel(R) Fortran 12.1-2100