Monday, March 3, 2014

binary file structure holding data for a list of radiance files

1. Radiance files:
This file structure applied to both observed radiance file and simulated radiance file.

A radiance file has both a header, which has summary information about the data, and a body,
which holds data itself.

A binary file can contain data for a list of radiance files, and the file structure we are talking about here refers to this kind of binary files.

If a binary files contains data for a list of  radiance files, then headers are stacked in the front while
bodies are group at the end of this binary file.
































LoadRadFile,nfilesRad,filesRad,Rad,Idtop
   - nfilesRad          I           Number of radiance files to read
   - filesRad           I           List of files of read
   - Rad                O           Structure containing
   - Idtop              X           Dummy (not needed here)

      ReadRadHdr,
         - TopId              I              Not used
         - fileRad            I              Name of radiance file
         - iu                 O              Unit number
h1        - nMeasurData        O              Number of measuremnts in file
h2        - nchan              O              Number of channels
h6        - cfreq              O              Central frequencies
h7        - polar              O              Poalrizations
h5        - nqc                O              Size of QC
h3        - nPosScan           O              Number of scan positions
h4       == nScanLines   ;; missing in description


      ReadRad
         - IdTop              I              Not used.
         - iu                 I              Unit number
         - nprof              I              Number of profiles
         - nchan              I              Number of channels
         - nqc                I              Size of QC array
b12       - tb                 O              TB array
b13       - qc                 O              QC array
b11       - Angle              O              Viewing angle
b3        - RelAziAngle        O              Relative Azimuth Angle
b4        - SolZenAngle        O              Solar Zenith Angle
b1        - lat                O              Latitude
b2        - lon                O              Longitude
b5        - direc              O              Orbit mode
b6        - iscanPos           O              Scan position
b7       == iscanLine    ;; missing in description
b8        - Year               O              Year
b9        - Day                O              Day
b10       - Time               O              Time
         - nprofsEff          O              Efective number of profiles

Data structure:
  Rad={                                             $
       ;----Header
       nfilesRad:   nfilesRad,                      $  ;Number of files
  constants:
  h1     nProf:       nprof,                          $  ;Number of profiles
  h2     nchan:       nchan,                          $  ;Number of channels
  h3     nPosScan:    nPosScan,                       $  ;Number of scan positions
  h4     nScanLines:  nScanLines,                     $  ;Number of scan lines
  h5     nqc:         fltarr(nfilesRad),              $  ;Size of QC vector
  1-d:  per channel
  h6     Cfreq:       cfreq (fltarr(nchan))           $  ;Central frequencies
  h7     Polarity:    polar (lonarr(nchan))           $  ;Polarizations
;; ---------------------------------------------------------------------------------------------
  3-d:  per file, per fov , per chan
  b12    tb:          fltarr(nfilesRad,nProf,nchan),  $  ;Array of TBs
  b11    Angle:       fltarr(nfilesRad,nProf,nchan),  $  ;Array of viewing angles

  2-d:  per file, per fov
  b3     RelAziAngle: fltarr(nfilesRad,nProf),        $  ;Array of relative azimuth angles
  b4     SolZenAngle: fltarr(nfilesRad,nProf),        $  ;Array of solar zenith angles
  b1     Lat:         fltarr(nfilesRad,nProf),        $  ;Array of latitude
  b2     Lon:         fltarr(nfilesRad,nProf),        $  ;Array of longitude
  b5     Direc:       intarr(nfilesRad,nProf),        $  ;Array of orbit mode flags
  b6     ScanPos:     intarr(nfilesRad,nProf),        $  ;Scan positions
  b7     ScanLine:    intarr(nfilesRad,nProf),        $  ;Scan lines
  b8     Year:        lonarr(nfilesRad,nProf),        $  ;Year
  b9     Day:         lonarr(nfilesRad,nProf),        $  ;Day
  b10    Time:        fltarr(nfilesRad,nProf),        $  ;UTC Time
         Hours:       fltarr(nfilesRad,nProf),        $  ;Hours
         Mins:        fltarr(nfilesRad,nProf),        $  ;Minutes
         Secs:        fltarr(nfilesRad,nProf),        $  ;Seconds
  b13    qc:          intarr(nfilesRad,nProf,14)      $  ;QC information
      }

what is read in Header:  (7)
constant:
    nMeasurData
    nchan
    nPosScan
    nScanLines
    nqc
1-d : fltarr(nchan)
    cfreq ; 1d(nchan)
    polar ; 1d(nchan)


what is read in Body:  (13)
1-d: lonarr(nprof)
  1  lat
  2  lon
  3  raa
  4  sza
  5  direc
  6  iscanPos
  7  iscanLine
  8  Year
  9  Day
  10 time
  11 angle
2-d: fltarr(nprof,nchan)
  12 tb : 2-d
  13 qc : 2-d

2. Scene files: (EDR format)
readu order when reading scene data file: 

header:  18 elements
   iType
   algSN
   nProf
   nLayer
   nLevel
   nChan
   nPosScan
   nScanLines
   nAbsorb
0  nParmCLW
   nParmRain
   nParmSnow
   nParmIce
   nParmGrpl
   absorbID
   cFreq
   polar
8  nQC

body:   28 + [7] ==> up to 35 elements
   profIndx
   presLayer
   presLevel
   tempLayer
   absorbents
   xCLW
   xRain
   xGrpl
   emiss
0  angle
   windSpeed
   tSkin
   sfcPressure
   sfcType
   windU
   windV
   RAA
   SZA
   snowDepth
0  QC
   lat
   lon
   node
   scanUTC
   scanYear
   scanDay
   iScanPos
8  iScanLine
   IF (Scene.iType eq 1) THEN BEGIN
       nAtt
       nIter
       chiSquare
       yFwd
       chanSelected
       ym
7      ymCorr
   ENDIF 
 
scene data structure: 
  Scene={                                        
    ;----Header
       algSN:algSN,                                readu,iu,algSN
       iTyp:iTyp,                                  readu,iu,iTyp
       nProf:nPrf,                                 readu,iu,nPrf
       nProfsProcessed:0L, not from scene file,    Num of profs read successfully                       nLay:nLay,                                  readu,iu,nLay
       nLev:nLev,                                  readu,iu,nLev
       nChan:nChan,                                readu,iu,nChan
       nScanPos:nPosScan,                          readu,iu,nPosScan
       nScanLines:nScanLines,                      readu,iu,nScanLines
       nAbsorb:nAbsorb,                            readu,iu,nAbsorb
       nParmCLW:nParmCLW,                          readu,iu,nParmCLW
       nParmRain:nParmRain,                        readu,iu,nParmRain
       nParmSnow:nParmSnow,                        readu,iu,nParmSnow
       nParmIce:nParmIce,                          readu,iu,nParmIce 
       nParmGrpl:nParmGrpl,                        readu,iu,nParmGrpl
       absorbID:absorbID2use4Declaration, A        AbsorbID=lonarr(nAbsorb), readu,iu,absorbID
       cFreq:cFreq,                       A        cfreq=fltarr(nChan), readu,iu,cFreq
       polarity:polar,                    A        polar=lonarr(nChan), readu,iu,polar
       nQC:nQC,                                    readu,iu,nQC
       declarN_Prf:nPrf,    duplicate value        nPrf
    ;----Body of Scene file  ( all FOVs )
       profIndxVec:  intarr(nPrf),        A    readu,iu, profIndx
       PresLayVec:   fltarr(nPrf,nLay),   AA   fltarr(Nlay), readu,iu, pressLay
       presLevVec:   fltarr(nPrf,nLev),   AA   fltarr(nLev), readu,iu, pressLev
       tempLayVec:   fltarr(nPrf,nLay),   AA   fltarr(Nlay), readu,iu, tempLay
       absorbLayVec: fltarr(nPrf,nLay,2), AA   fltarr(nAbsorb), readu,iu,absorbents
       tpwVec:       fltarr(nPrf),        A    DERIVED. !!!
       rhVec:        fltarr(nPrf,nLay),   A    DERIVED. !!!
       clwLayVec:    fltarr(nPrf,nParmCLW)AA   fltarr(nParmCLW), readu,iu, xCLW 
       clwVec:       fltarr(nPrf),        A    DERIVED. !!!
       rwpVec:       fltarr(nPrf),        A    DERIVED  !!!
       iwpVec:       fltarr(nPrf),        A    NOT SET  !!!
       gwpVec:       fltarr(nPrf),        A    DERIVED  !!!
       swpVec:       fltarr(nPrf),        A    NOT SET  !!! 
       rainLayVec:   fltarr(nPrf,nParmRain),AA fltarr(nParmRain), readu,iu, xRain
       snowLayVec:   fltarr(nPrf,nParmSnow),AA 0.0  (hard-coded)
       IceLayVec:    fltarr(nPrf,nParmIce), AA 0.0  (hard-coded)
       grplLayVec:   fltarr(nPrf,nParmGrpl),AA fltarr(Scene.nParmGrpl), readu,iu, xGrpl 
       anglVec:      fltarr(nPrf),          A  readu,iu, angl
       relAziAnglVec:fltarr(nPrf),          A  readu,iu, relAziAngl
       solZenAnglVec:fltarr(nPrf),          A  readu,iu, solZenAngl
       emissVec:     fltarr(nPrf,nChan),    AA fltarr(Scene.nchan), readu,iu, emiss
       reflVec:      fltarr(nPrf,nChan),    AA NOT SET !!!
       windSpVec:    fltarr(nPrf),          A  readu,iu, windSp
       windUVec:     fltarr(nPrf),          A  readu,iu, windU
       windVVec:     fltarr(nPrf),          A  readu,iu, windV 
       tskinVec:     fltarr(nPrf),          A  readu,iu, tSkin
       snowDepthVec: fltarr(nPrf),          A  readu,iu, snowDepth
       sfcPressVec:  fltarr(nPrf),          A  readu,iu, sfcPress
       sfcTypVec:    intarr(nPrf),          A  readu,iu, sfcTyp
       QC:           intarr(nPrf,nqc),      AA intarr(Scene.nqc), readu,iu, qc
       lat:          fltarr(nPrf),          A  readu,iu, lat
       lon:          fltarr(nPrf),          A  readu,iu, lon 
       direc:        intarr(nPrf),          A  readu,iu, node  (asc, desc)
       time:         fltarr(nPrf),          A  readu,iu, scanUTC
       year:         intarr(nPrf),          A  readu,iu, scanYear 
       day:          intarr(nPrf),          A  readu,iu, scanDay
       hours:        fltarr(nPrf),  DERIVED A  fix(scanUTC/3600.)  !!!
       mins:         fltarr(nPrf),  DERIVED A  fix( ( time - fix(Hours) * 3600. )/60.)  !!!
       secs:         fltarr(nPrf),  DERIVED A  (Time - Hours*3600. - Mins*60.)   !!!
       nAttempt:     intarr(nPrf),    COD   A  readu,iu, nAtt
       nIter:        intarr(nPrf),    COD   A  readu,iu, nIter
       chiSq:        fltarr(nPrf),    COD   A  readu,iu, chiSq
       yFwd:         fltarr(nPrf,nChan),COD AA fltarr(Scene.nchan), readu,iu,yFwd
       chanSel:      lonarr(nPrf,nChan),COD AA lonarr(Scene.nchan), readu,iu,chanSel
       ym:           fltarr(nPrf,nChan),COD AA fltarr(Scene.nchan), readu,iu,ym
       ymCorr:       fltarr(nPrf,nChan),cOD AA fltarr(Scene.nchan), readu,iu,ymCorr
       scanPos:      lonarr(nPrf),          A  readu,iu, iScanPos
       scanLine:     lonarr(nPrf)           A  readu,iu, iScanLine
  }

NOTE: 
1. Condition : COD
   COD: if Scene.iTyp eq 1

2. Derived data
   ;---compute TPW  (1)
   ind = WHERE(scene.absorbLayVec(iprof,0:Scene.nLay-1,0) ge 0.,ncount)
   IF (ncount gt 0) THEN BEGIN
      presLevFiltered = FLTARR(nCount+1)
      presLevFiltered(0:nCount-1) = scene.presLevVec(iProf,ind)
      presLevFiltered(nCount) = scene.presLevVec(iProf,ind(nCount-1)+1)
      columIntegr_LayW, nCount,     $
                        presLevFiltered,     $
                        sfcPress,     $
                        scene.absorbLayVec(iProf,ind,0),     $
                        water
      scene.tpwVec(iprof)  = water      ; (derived 1)
   ENDIF ELSE BEGIN
      scene.tpwVec(iprof)  = 0
   ENDELSE

   ;---compute ozon amt  ( NOT used ! ) 
   IF (WHERE(scene.absorbID(0:scene.nAbsorb-1) EQ 3) GE 0) THEN BEGIN
       columIntegr_LayW, scene.nLay,     $
                         scene.presLevVec(iProf,0:scene.nLev-1),   $
                         sfcPress,$
                         scene.absorbLayVec(iProf,0:scene.nLay-1,1),   $
                         ozon          ;  ( NOT USED ! )
   ENDIF

   ;---compute hydrometeors integrated amounts 
   columIntegr, scene.nParmCLW,     $
                scene.presLevVec(iProf,0:scene.nLev-1),   $
                sfcPress,                                 $
                scene.clwLayVec(iProf,0:scene.nParmCLW-1),$
                clw
   scene.clwVec(iprof) = clw        ; (derived 2)

   columIntegr, scene.nParmRain,     $
                scene.PresLevVec(iprof,0:Scene.nLev-1),  $
                sfcPress,                                $
                Scene.RainLayVec(iprof,0:Scene.nParmRain-1), $
                rwp
   scene.rwpVec(iprof) = rwp              ; (derived 3)

   columIntegr, scene.nParmGrpl,   $
                scene.PresLevVec(iProf,0:scene.nLev-1),  $
                sfcPress,$
                scene.GrplLayVec(iprof,0:Scene.nParmGrpl-1),  $
                gwp
   scene.gwpVec(iprof) = gwp           ; (derived 4)

   ;---compute RH
   FOR iLay=0L,scene.nLay-1 DO BEGIN
       IF (scene.absorbLayVec(iProf,iLay,0) GT 0) THEN BEGIN
           T=scene.tempLayVec(iProf,iLay)
           P=scene.presLayVec(iProf,iLay)
           Q=scene.absorbLayVec(iProf,iLay,0)/1000.
           scene.rhVec(iProf,iLay) = mixingratio_to_RelHum(Q,T,P)*100.   ; (derived 5)
       ENDIF ELSE BEGIN
           scene.rhVec(iprof,iLay) = -999.
       ENDELSE
   ENDFOR
 
 
 

No comments:

Post a Comment