Ignore:
Timestamp:
Apr 22, 2015, 3:42:35 PM (9 years ago)
Author:
pesei
Message:

Wet dep quick fix and other small changes. Wet depo quick fix not final yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/petra/src/gridcheck.f90

    r27 r37  
    3232  !             LAST UPDATE: 1997-10-10                                 *
    3333  !                                                                     *
     34  !**********************************************************************
     35  !                                                                     *
    3436  !             Update:      1999-02-08, global fields allowed, A. Stohl*
    3537  !             CHANGE: 11/01/2008, Harald Sodemann, GRIB1/2 input with *
     
    3739  !             CHANGE: 03/12/2008, Harald Sodemann, update to f90 with *
    3840  !                                 ECMWF grib_api                      *
    39   !                                                                     *
     41  !
     42  !   3/2015, PS: add GRIB2 coding for deta/dt dp/deta used by ZAMG
     43  ! 
     44  !
    4045  !**********************************************************************
    4146  !                                                                     *
     
    144149  if (gribVer.eq.1) then ! GRIB Edition 1
    145150
    146   !print*,'GRiB Edition 1'
    147   !read the grib2 identifiers
    148   call grib_get_int(igrib,'indicatorOfParameter',isec1(6),iret)
    149   call grib_check(iret,gribFunction,gribErrorMsg)
    150   call grib_get_int(igrib,'level',isec1(8),iret)
    151   call grib_check(iret,gribFunction,gribErrorMsg)
    152 
    153   !change code for etadot to code for omega
    154   if (isec1(6).eq.77) then
    155     isec1(6)=135
    156   endif
    157 
    158   !print*,isec1(6),isec1(8)
    159 
    160   else
    161 
    162   !print*,'GRiB Edition 2'
    163   !read the grib2 identifiers
    164   call grib_get_int(igrib,'discipline',discipl,iret)
    165   call grib_check(iret,gribFunction,gribErrorMsg)
    166   call grib_get_int(igrib,'parameterCategory',parCat,iret)
    167   call grib_check(iret,gribFunction,gribErrorMsg)
    168   call grib_get_int(igrib,'parameterNumber',parNum,iret)
    169   call grib_check(iret,gribFunction,gribErrorMsg)
    170   call grib_get_int(igrib,'typeOfFirstFixedSurface',typSurf,iret)
    171   call grib_check(iret,gribFunction,gribErrorMsg)
    172   call grib_get_int(igrib,'level',valSurf,iret)
    173   call grib_check(iret,gribFunction,gribErrorMsg)
    174   call grib_get_int(igrib,'paramId',parId,iret)
    175   call grib_check(iret,gribFunction,gribErrorMsg)
    176 
    177   !print*,discipl,parCat,parNum,typSurf,valSurf
    178 
    179   !convert to grib1 identifiers
    180   isec1(6)=-1
    181   isec1(7)=-1
    182   isec1(8)=-1
    183   isec1(8)=valSurf     ! level
    184   if ((parCat.eq.0).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! T
    185     isec1(6)=130         ! indicatorOfParameter
    186   elseif ((parCat.eq.2).and.(parNum.eq.2).and.(typSurf.eq.105)) then ! U
    187     isec1(6)=131         ! indicatorOfParameter
    188   elseif ((parCat.eq.2).and.(parNum.eq.3).and.(typSurf.eq.105)) then ! V
    189     isec1(6)=132         ! indicatorOfParameter
    190   elseif ((parCat.eq.1).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! Q
    191     isec1(6)=133         ! indicatorOfParameter
    192   elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.1)) then !SP
    193     isec1(6)=134         ! indicatorOfParameter
    194   elseif ((parCat.eq.2).and.(parNum.eq.32)) then ! W, actually eta dot
    195     isec1(6)=135         ! indicatorOfParameter
    196   elseif ((parCat.eq.128).and.(parNum.eq.77)) then ! W, actually eta dot
    197     isec1(6)=135         ! indicatorOfParameter
    198   elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.101)) then !SLP
    199     isec1(6)=151         ! indicatorOfParameter
    200   elseif ((parCat.eq.2).and.(parNum.eq.2).and.(typSurf.eq.103)) then ! 10U
    201     isec1(6)=165         ! indicatorOfParameter
    202   elseif ((parCat.eq.2).and.(parNum.eq.3).and.(typSurf.eq.103)) then ! 10V
    203     isec1(6)=166         ! indicatorOfParameter
    204   elseif ((parCat.eq.0).and.(parNum.eq.0).and.(typSurf.eq.103)) then ! 2T
    205     isec1(6)=167         ! indicatorOfParameter
    206   elseif ((parCat.eq.0).and.(parNum.eq.6).and.(typSurf.eq.103)) then ! 2D
    207     isec1(6)=168         ! indicatorOfParameter
    208   elseif ((parCat.eq.1).and.(parNum.eq.11).and.(typSurf.eq.1)) then ! SD
    209     isec1(6)=141         ! indicatorOfParameter
    210   elseif ((parCat.eq.6).and.(parNum.eq.1) .or. parId .eq. 164) then ! CC
    211     isec1(6)=164         ! indicatorOfParameter
    212   elseif ((parCat.eq.1).and.(parNum.eq.9) .or. parId .eq. 142) then ! LSP
    213     isec1(6)=142         ! indicatorOfParameter
    214   elseif ((parCat.eq.1).and.(parNum.eq.10)) then ! CP
    215     isec1(6)=143         ! indicatorOfParameter
    216   elseif ((parCat.eq.0).and.(parNum.eq.11).and.(typSurf.eq.1)) then ! SHF
    217     isec1(6)=146         ! indicatorOfParameter
    218   elseif ((parCat.eq.4).and.(parNum.eq.9).and.(typSurf.eq.1)) then ! SR
    219     isec1(6)=176         ! indicatorOfParameter
    220   elseif ((parCat.eq.2).and.(parNum.eq.17) .or. parId .eq. 180) then ! EWSS
    221     isec1(6)=180         ! indicatorOfParameter
    222   elseif ((parCat.eq.2).and.(parNum.eq.18) .or. parId .eq. 181) then ! NSSS
    223     isec1(6)=181         ! indicatorOfParameter
    224   elseif ((parCat.eq.3).and.(parNum.eq.4)) then ! ORO
    225     isec1(6)=129         ! indicatorOfParameter
    226   elseif ((parCat.eq.3).and.(parNum.eq.7) .or. parId .eq. 160) then ! SDO
    227     isec1(6)=160         ! indicatorOfParameter
    228   elseif ((discipl.eq.2).and.(parCat.eq.0).and.(parNum.eq.0).and. &
    229        (typSurf.eq.1)) then ! LSM
    230     isec1(6)=172         ! indicatorOfParameter
    231   else
    232     print*,'***ERROR: undefined GRiB2 message found!',discipl, &
    233          parCat,parNum,typSurf
    234   endif
    235   if(parId .ne. isec1(6) .and. parId .ne. 77) then
    236     write(*,*) 'parId',parId, 'isec1(6)',isec1(6)
    237 !    stop
    238   endif
    239 
    240   endif
     151    !print*,'GRiB Edition 1'
     152    !read the grib2 identifiers
     153    call grib_get_int(igrib,'indicatorOfParameter',isec1(6),iret)
     154    call grib_check(iret,gribFunction,gribErrorMsg)
     155    call grib_get_int(igrib,'level',isec1(8),iret)
     156    call grib_check(iret,gribFunction,gribErrorMsg)
     157
     158    !change code for etadot to code for omega
     159    if (isec1(6).eq.77) then
     160      isec1(6)=135
     161    endif
     162
     163    !print*,isec1(6),isec1(8)
     164
     165  else ! GRIB 2
     166
     167    !print*,'GRiB Edition 2'
     168    ! read the grib2 identifiers
     169
     170    call grib_get_int(igrib,'discipline',discipl,iret)
     171    call grib_check(iret,gribFunction,gribErrorMsg)
     172    call grib_get_int(igrib,'parameterCategory',parCat,iret)
     173    call grib_check(iret,gribFunction,gribErrorMsg)
     174    call grib_get_int(igrib,'parameterNumber',parNum,iret)
     175    call grib_check(iret,gribFunction,gribErrorMsg)
     176    call grib_get_int(igrib,'typeOfFirstFixedSurface',typSurf,iret)
     177    call grib_check(iret,gribFunction,gribErrorMsg)
     178    call grib_get_int(igrib,'level',valSurf,iret)
     179    call grib_check(iret,gribFunction,gribErrorMsg)
     180    call grib_get_int(igrib,'paramId',parId,iret)
     181    call grib_check(iret,gribFunction,gribErrorMsg)
     182
     183    !print*,discipl,parCat,parNum,typSurf,valSurf
     184
     185    ! convert to grib1 identifiers
     186
     187    isec1(6)=-1
     188    isec1(7)=-1
     189    isec1(8)=-1
     190    isec1(8)=valSurf     ! level
     191    if ((parCat.eq.0).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! T
     192      isec1(6)=130         ! indicatorOfParameter
     193    elseif ((parCat.eq.2).and.(parNum.eq.2).and.(typSurf.eq.105)) then ! U
     194      isec1(6)=131         ! indicatorOfParameter
     195    elseif ((parCat.eq.2).and.(parNum.eq.3).and.(typSurf.eq.105)) then ! V
     196      isec1(6)=132         ! indicatorOfParameter
     197    elseif ((parCat.eq.1).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! Q
     198      isec1(6)=133         ! indicatorOfParameter
     199    elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.1)) then !SP
     200      isec1(6)=134         ! indicatorOfParameter
     201    elseif ((parCat.eq.2).and.(parNum.eq.32)) then ! W, actually detadtdpdeta
     202      isec1(6)=135         ! indicatorOfParameter
     203    elseif ((parCat.eq.128).and.(parNum.eq.77)) then ! W, actually detadtdpdeta
     204      isec1(6)=135         ! indicatorOfParameter
     205    elseif ((parCat.eq.2).and.(parNum.eq.8)) then ! Omega, actually detadtdpdeta
     206      isec1(6)=135         ! indicatorOfParameter
     207    elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.101)) then !SLP
     208      isec1(6)=151         ! indicatorOfParameter
     209    elseif ((parCat.eq.2).and.(parNum.eq.2).and.(typSurf.eq.103)) then ! 10U
     210      isec1(6)=165         ! indicatorOfParameter
     211    elseif ((parCat.eq.2).and.(parNum.eq.3).and.(typSurf.eq.103)) then ! 10V
     212      isec1(6)=166         ! indicatorOfParameter
     213    elseif ((parCat.eq.0).and.(parNum.eq.0).and.(typSurf.eq.103)) then ! 2T
     214      isec1(6)=167         ! indicatorOfParameter
     215    elseif ((parCat.eq.0).and.(parNum.eq.6).and.(typSurf.eq.103)) then ! 2D
     216      isec1(6)=168         ! indicatorOfParameter
     217    elseif ((parCat.eq.1).and.(parNum.eq.11).and.(typSurf.eq.1)) then ! SD
     218      isec1(6)=141         ! indicatorOfParameter
     219    elseif ((parCat.eq.6).and.(parNum.eq.1) .or. parId .eq. 164) then ! CC
     220      isec1(6)=164         ! indicatorOfParameter
     221    elseif ((parCat.eq.1).and.(parNum.eq.9) .or. parId .eq. 142) then ! LSP
     222      isec1(6)=142         ! indicatorOfParameter
     223    elseif ((parCat.eq.1).and.(parNum.eq.10)) then ! CP
     224      isec1(6)=143         ! indicatorOfParameter
     225    elseif ((parCat.eq.0).and.(parNum.eq.11).and.(typSurf.eq.1)) then ! SHF
     226      isec1(6)=146         ! indicatorOfParameter
     227    elseif ((parCat.eq.4).and.(parNum.eq.9).and.(typSurf.eq.1)) then ! SR
     228      isec1(6)=176         ! indicatorOfParameter
     229    elseif ((parCat.eq.2).and.(parNum.eq.17) .or. parId .eq. 180) then ! EWSS
     230      isec1(6)=180         ! indicatorOfParameter
     231    elseif ((parCat.eq.2).and.(parNum.eq.18) .or. parId .eq. 181) then ! NSSS
     232      isec1(6)=181         ! indicatorOfParameter
     233    elseif ((parCat.eq.3).and.(parNum.eq.4)) then ! ORO
     234      isec1(6)=129         ! indicatorOfParameter
     235    elseif ((parCat.eq.3).and.(parNum.eq.7) .or. parId .eq. 160) then ! SDO
     236      isec1(6)=160         ! indicatorOfParameter
     237    elseif ((discipl.eq.2).and.(parCat.eq.0).and.(parNum.eq.0).and. &
     238         (typSurf.eq.1)) then ! LSM
     239      isec1(6)=172         ! indicatorOfParameter
     240    else
     241      print*,'***ERROR: undefined GRiB2 message found!',discipl, &
     242           parCat,parNum,typSurf
     243    endif
     244    if(parId .ne. isec1(6) .and. parId .ne. 77) then
     245      write(*,*) 'parId',parId, 'isec1(6)',isec1(6)
     246  !    stop
     247    endif
     248
     249  endif ! GRIB 1 / GRIB 2 cases
    241250
    242251  !get the size and data of the values array
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG