c----------------------------------------------------------------------- c c Name: c FUNCTION TEMBCK c c Purpose: c Estimate the MAS head temperature given the head count for an c IR window band (usually band 45, or band 47 if band 45 is bad). c c Usage: c RESULT = TEMBCK( BAND, BB1C, BB2C, HEADC, BB1T, BB2T ) c c Input: c BAND MAS IR band number (26-50, 45 is the usual value) c BB1C Digital counts for blackbody 1 c BB2C Digital counts for blackbody 2 c HEADC Digital counts from MAS head view c BB1T Temperature for blackbody 1 (Kelvin) c BB2T Temperature for blackbody 2 (Kelvin) c c Output: c RESULT MAS head temperature estimate (Kelvin) c c Revised: c Liam.Gumley@ssec.wisc.edu c $Id: tembck.f,v 1.3 1999/11/11 20:04:46 gumley Exp $ c c----------------------------------------------------------------------- real function tembck( band, bb1c, bb2c, headc, bb1t, bb2t ) implicit none c ... arguments integer band, bb1c, bb2c, headc real bb1t, bb2t c ... local variables real rad1, rad2, slope, intercept, radh, masrad, masbrt external masrad, masbrt c ... set default return value tembck = -1.0 c ... check input arguments if( band .lt. 26 .or. band .gt. 50 ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument BAND was out of the range [26,50]' write(*,*) 'Offending value was ', band write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif if( bb1c .le. 0 .or. bb1c .ge. 100000 ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument BB1C was out of the range [0,100000]' write(*,*) 'Offending value was ', bb1c write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif if( bb2c .le. 0 .or. bb2c .ge. 100000 ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument BB2C was out of the range [0,100000]' write(*,*) 'Offending value was ', bb2c write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif if( bb1c .ge. bb2c ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument BB1C was GE than BB2C' write(*,*) 'Offending values were ', bb1c, bb2c write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif if( headc .le. 0 .or. headc .ge. 100000 ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument HEADC was out of the range ' // & '[0,100000]' write(*,*) 'Offending value was ', headc write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif if( bb1t .le. 180.0 .or. bb1t .ge. 320.0 ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument BB1T was out of the range ' // & '[180.0,320.0]' write(*,*) 'Offending value was ', bb1t write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif if( bb2t .le. 180.0 .or. bb2t .ge. 320.0 ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument BB2T was out of the range ' // & '[180.0,320.0]' write(*,*) 'Offending value was ', bb2t write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif if( bb1t .ge. bb2t ) then write(*,*) 'Warning in function TEMBCK' write(*,*) 'Input argument BB1T was GE than BB2T' write(*,*) 'Offending values were ', bb1t, bb2t write(*,*) 'Head temperature set to -1.0 in TEMBCK' return endif c ... initialize planck function temperature correction coefficients c ... (must be done before calling MASRAD or MASBRT) call initcf() c ... convert blackbody temperatures to radiance rad1 = masrad( band, bb1t ) rad2 = masrad( band, bb2t ) c ... compute calibration slope and intercept slope = ( rad2 - rad1 ) / real( bb2c - bb1c ) intercept = rad1 - slope * real( bb1c ) c ... compute head radiance and brightness temperature radh = slope * real( headc ) + intercept tembck = masbrt( band, radh ) end