program process_hirs_cfsr c --------------------------------------------------------------------------------- c c Description: Calculate cloud top properties using HIRS input radiaces c and the CO2-slicing algorithm (from MODIS processing). c c Command line inputs in order: c c HIRS HDF ("L1b") input file c CFSR reanlysis1 input profile directory c HIRS/AVHRR collocation index file c Collocated AVHRR (PATMOS-X) level 2 file c HIRS monthly zonal clear sky radiance bias (CSRB) file c debug level index c shifted/unshifted forward model option c 1=unshifted (original), 2=shifted FM and Planck coefficients c output product file c c Output of program: c c output product file: c 'outdata(line, elem, 1)' = latitude c 'outdata(line, elem, 2)' = longitude c 'outdata(line, elem, 3)' = cloud top pressure c 'outdata(line, elem, 4)' = cloud top height c 'outdata(line, elem, 5)' = cloud top temperature c 'outdata(line, elem, 6)' = effective cloud amount c 'outdata(line, elem, 7)' = retrieval solution index c 'outdata(line, elem, 8)' = day/night flag c 'outdata(line, elem, 9)' = node c 'outdata(line, elem, 10)' = viewing zenith angle c 'outdata(line, elem, 11)' = scan line beginning time c 'outdata(line, elem, 12)' = collocated AVHRR cloud fraction c 'outdata(line, elem, 13)' = collocated AVHRR land fraction c 'outdata(line, elem, 14)' = results flag c 0 = invalid AVHRR cloud fraction c 1 = too clear for HIRS CTP retrieval c 2 = bad HIRS data (e.g., calibration) c 3 = valid HIRS CTP retrieval c 'outdata(line, elem, 15)' = utls flag c 0=missing, 1=no, 2=yes c 'outdata(line, elem, 16)' = PATMOS-x (AVHRR) cloud top pressure c c Revision history: c 07/10 R. Frey Original version c 10/10 R. Frey Added documentation c 12/10 R. Frey Added collocated AVHRR (PATMOS-X) cloud fraction c Modified marine low cloud algorithm to conform to c latest MODIS version c Rearranged top level code c 01/11 R. Frey Changed dimensions of 'along_track_idx' and c 'across_track_idx' c 03/11 R. Frey Added 'land_cover' c 06/11 R. Frey Added CSRB file input; subroutine get_csrbs c 07/11 R. Frey Added shifted/unshifted FM option ('shifted_FM_opt') c 10/13 R. Frey Added utls flag to output product array c 12/13 R. Frey Added 'cloud_phase' c 01/14 R. Frey Modified to use CFSR reanalysis files c 03/14 R. Frey Added 'avhrr_ctp' c c Calls: c subroutine get_HIRS_orbit c subroutine get_month c subroutine get_dayofmonth c subroutine get_orbital_col_indecis c subroutine get_PATMOS_orbit c subroutine get_csrbs c subroutine hirspfco_101 c subroutine process_HIRS_orbit c subroutine message c c ---------------------------------------------------------------------------------- IMPLICIT NONE c----------------------------------------------------------------------------------- c Parameter definitions. integer num_2d_SDS parameter (num_2d_SDS = 13) integer num_1d_SDS parameter (num_1d_SDS = 3) c----------------------------------------------------------------------------------- c Declarations. character*160 errmsg character*120 parm, cfsr_dir integer debug, level, status, shifted_FM_opt c HIRS input data and associated variables. character*120 input_rad_file character*6 sat real*4 HIRS_2d(56,1100,num_2d_SDS), HIRS_1d(1100,num_1d_SDS) integer month, year, s_jday, s_time, dom, nscans c PATMOS-X (AVHRR) collocation input data and associated variables. character*120 collocate_index_file, PATMOS_L2_file integer land_cover(409,15000) integer cloud_phase(409,15000) real cloud_probability(409,15000) real avhrr_ctp(409,15000) integer along_track_idx(100,56,1100), across_track_idx(100,56,1100) c HIRS CSRB file and associated variables. character*120 csrb_file real*4 csrbs(180, 8, 3) c Output data. character*120 output_prd_file character*9 odate character*8 otime real*4 outdata(1100, 56, 16) c Test c real*4 tempdata(113,56,6) c----------------------------------------------------------------------------------- c Read command line arguments. call getarg(1,input_rad_file) call getarg(2,cfsr_dir) call getarg(3,collocate_index_file) call getarg(4,PATMOS_L2_file) call getarg(5,csrb_file) call getarg(6,parm) read(parm,'(i4)') debug call getarg(7,parm) read(parm,'(i4)') shifted_FM_opt call getarg(8,output_prd_file) c----------------------------------------------------------------------------------- c Get HIRS geolocation and radiance data for current orbit. call get_HIRS_orbit(input_rad_file, HIRS_2d, HIRS_1d, sat, nscans) c Check length of input data. if(nscans .lt. 2 .or. nscans .gt. 1100) then level = 3 status = -1 write( errmsg,'(''Number scan lines too few or too many: '',i10)') nscans call message( 'process_hirs_cfsr', errmsg, status, level ) end if c Get HIRS starting day-of-year, time, and month (1-12). year = int(HIRS_1d(1,1)) s_jday = int(HIRS_1d(1,2)) s_time = int(HIRS_1d(1,3)) call get_month(year, s_jday, month) c Get day of month. call get_dayofmonth(year, month, s_jday, dom) c Get HIRS instrument data for current satellite. call rf_hirspfco_101(sat, shifted_FM_opt) write(*,'(/,''Processing HIRS data from '',a6)') sat write(*,'(''Processing orbit beginning at '',4i10)') year, month, s_jday, s_time write(*,'(''Beginning day of month: '', i10)') dom write(*,'(''Number of HIRS scan lines is '',i5,/)') nscans c----------------------------------------------------------------------------------- write(*,'(''Get collocation indecis'')') c Get AVHRR (GAC) collocation indecis for current orbit. call get_orbital_col_indecis(debug, collocate_index_file, along_track_idx, * across_track_idx) c----------------------------------------------------------------------------------- write(*,'(''Get AVHRR cloud data'')') c Get collocated PATMOS (AVHRR) cloud data for current orbit. call get_PATMOS_orbit(debug, PATMOS_L2_file, cloud_probability, land_cover, * cloud_phase, avhrr_ctp) c----------------------------------------------------------------------------------- write(*,'(''Get CSRB data'')') c Get HIRS monthly zonal clear sky radiance bias (CSRB) file. call get_csrbs(debug, csrb_file, csrbs) c----------------------------------------------------------------------------------- write(*,'(''Process HIRS'')') c Process HIRS data. call process_HIRS_orbit(debug, month, sat, nscans, HIRS_2d, HIRS_1d, cfsr_dir, * year, s_jday, dom, along_track_idx, across_track_idx, * cloud_probability, land_cover, cloud_phase, csrbs, * shifted_FM_opt, output_prd_file, avhrr_ctp, * outdata) c----------------------------------------------------------------------------------- c Write product data to output binary file. open(80,file=output_prd_file,form='unformatted',access='sequential') write(80) outdata close(80) call time(otime) call date(odate) write(*,'(2a10)') odate, otime c Temporary test output. c open(81,file='HIRS_20090115_output_avhrrN.bin',form='unformatted',access='sequential') c write(81) tempdata c close(81) c----------------------------------------------------------------------------------- end