Changeset 24 for trunk/src/readwind.f90
- Timestamp:
- May 23, 2014, 11:48:41 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/readwind.f90
r20 r24 71 71 integer :: iret 72 72 integer :: igrib 73 integer :: gribVer,parCat,parNum,typSurf,valSurf,discipl 73 integer :: gribVer,parCat,parNum,typSurf,valSurf,discipl,parId 74 74 integer :: gotGrid 75 75 !HSO end … … 90 90 integer :: isec1(56),isec2(22+nxmax+nymax) 91 91 real(kind=4) :: zsec4(jpunp) 92 real(kind=4) :: xaux,yaux ,xaux0,yaux092 real(kind=4) :: xaux,yaux 93 93 real(kind=8) :: xauxin,yauxin 94 94 real,parameter :: eps=1.e-4 95 95 real(kind=4) :: nsss(0:nxmax-1,0:nymax-1),ewss(0:nxmax-1,0:nymax-1) 96 real :: plev1,pmean,tv,fu,hlev1,ff10m,fflev1 96 real :: plev1,pmean,tv,fu,hlev1,ff10m,fflev1,conversion_factor 97 97 98 98 logical :: hflswitch,strswitch … … 101 101 character(len=24) :: gribErrorMsg = 'Error reading grib file' 102 102 character(len=20) :: gribFunction = 'readwind' 103 104 !HSO conversion of ECMWF etadot to etadot*dp/deta105 logical :: etacon=.false.106 real,parameter :: p00=101325.107 real :: dak,dbk108 103 109 104 hflswitch=.false. … … 155 150 endif 156 151 152 conversion_factor=1. 153 157 154 else 158 155 … … 168 165 call grib_check(iret,gribFunction,gribErrorMsg) 169 166 call grib_get_int(igrib,'level',valSurf,iret) 167 call grib_check(iret,gribFunction,gribErrorMsg) 168 call grib_get_int(igrib,'paramId',parId,iret) 170 169 call grib_check(iret,gribFunction,gribErrorMsg) 171 170 … … 177 176 isec1(8)=-1 178 177 isec1(8)=valSurf ! level 178 conversion_factor=1. 179 179 if ((parCat.eq.0).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! T 180 180 isec1(6)=130 ! indicatorOfParameter … … 188 188 isec1(6)=134 ! indicatorOfParameter 189 189 elseif ((parCat.eq.2).and.(parNum.eq.32)) then ! W, actually eta dot 190 isec1(6)=135 ! indicatorOfParameter 191 elseif ((parCat.eq.128).and.(parNum.eq.77)) then ! W, actually eta dot 190 192 isec1(6)=135 ! indicatorOfParameter 191 193 elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.101)) then !SLP … … 201 203 elseif ((parCat.eq.1).and.(parNum.eq.11).and.(typSurf.eq.1)) then ! SD 202 204 isec1(6)=141 ! indicatorOfParameter 203 elseif ((parCat.eq.6).and.(parNum.eq.1)) then ! CC 205 conversion_factor=1000. 206 elseif ((parCat.eq.6).and.(parNum.eq.1) .or. parId .eq. 164) then ! CC 204 207 isec1(6)=164 ! indicatorOfParameter 205 elseif ((parCat.eq.1).and.(parNum.eq.9) ) then ! LSP208 elseif ((parCat.eq.1).and.(parNum.eq.9) .or. parId .eq. 142) then ! LSP 206 209 isec1(6)=142 ! indicatorOfParameter 207 210 elseif ((parCat.eq.1).and.(parNum.eq.10)) then ! CP 208 211 isec1(6)=143 ! indicatorOfParameter 212 conversion_factor=1000. 209 213 elseif ((parCat.eq.0).and.(parNum.eq.11).and.(typSurf.eq.1)) then ! SHF 210 214 isec1(6)=146 ! indicatorOfParameter 211 215 elseif ((parCat.eq.4).and.(parNum.eq.9).and.(typSurf.eq.1)) then ! SR 212 216 isec1(6)=176 ! indicatorOfParameter 213 elseif ((parCat.eq.2).and.(parNum.eq.17) ) then ! EWSS217 elseif ((parCat.eq.2).and.(parNum.eq.17) .or. parId .eq. 180) then ! EWSS 214 218 isec1(6)=180 ! indicatorOfParameter 215 elseif ((parCat.eq.2).and.(parNum.eq.18) ) then ! NSSS219 elseif ((parCat.eq.2).and.(parNum.eq.18) .or. parId .eq. 181) then ! NSSS 216 220 isec1(6)=181 ! indicatorOfParameter 217 221 elseif ((parCat.eq.3).and.(parNum.eq.4)) then ! ORO 218 222 isec1(6)=129 ! indicatorOfParameter 219 elseif ((parCat.eq.3).and.(parNum.eq.7) ) then ! SDO223 elseif ((parCat.eq.3).and.(parNum.eq.7) .or. parId .eq. 160) then ! SDO 220 224 isec1(6)=160 ! indicatorOfParameter 221 225 elseif ((discipl.eq.2).and.(parCat.eq.0).and.(parNum.eq.0).and. & … … 223 227 isec1(6)=172 ! indicatorOfParameter 224 228 else 225 print*,'*** ERROR: undefined GRiB2 message found!',discipl, &229 print*,'***WARNING: undefined GRiB2 message found!',discipl, & 226 230 parCat,parNum,typSurf 231 endif 232 if(parId .ne. isec1(6) .and. parId .ne. 77) then 233 write(*,*) 'parId',parId, 'isec1(6)',isec1(6) 234 ! stop 227 235 endif 228 236 … … 237 245 !HSO get the required fields from section 2 in a gribex compatible manner 238 246 if (ifield.eq.1) then 239 call grib_get_int(igrib,'numberOfPointsAlongAParallel', & 240 isec2(2),iret) 241 call grib_check(iret,gribFunction,gribErrorMsg) 242 call grib_get_int(igrib,'numberOfPointsAlongAMeridian', & 243 isec2(3),iret) 244 call grib_check(iret,gribFunction,gribErrorMsg) 245 call grib_get_int(igrib,'numberOfVerticalCoordinateValues', & 246 isec2(12)) 247 call grib_get_int(igrib,'numberOfPointsAlongAParallel',isec2(2),iret) 248 call grib_check(iret,gribFunction,gribErrorMsg) 249 call grib_get_int(igrib,'numberOfPointsAlongAMeridian',isec2(3),iret) 250 call grib_check(iret,gribFunction,gribErrorMsg) 251 call grib_get_int(igrib,'numberOfVerticalCoordinateValues',isec2(12)) 247 252 call grib_check(iret,gribFunction,gribErrorMsg) 248 253 ! CHECK GRID SPECIFICATIONS … … 250 255 if(isec2(3).ne.ny) stop 'READWIND: NY NOT CONSISTENT' 251 256 if(isec2(12)/2-1.ne.nlev_ec) & 252 257 stop 'READWIND: VERTICAL DISCRETIZATION NOT CONSISTENT' 253 258 endif ! ifield 254 259 255 260 !HSO get the second part of the grid dimensions only from GRiB1 messages 256 if ( (gribVer.eq.1).and.(gotGrid.eq.0)) then261 if (isec1(6) .eq. 167 .and. (gotGrid.eq.0)) then 257 262 call grib_get_real8(igrib,'longitudeOfFirstGridPointInDegrees', & 258 263 xauxin,iret) … … 261 266 yauxin,iret) 262 267 call grib_check(iret,gribFunction,gribErrorMsg) 268 if (xauxin.gt.180.) xauxin=xauxin-360.0 269 if (xauxin.lt.-180.) xauxin=xauxin+360.0 270 263 271 xaux=xauxin+real(nxshift)*dx 264 272 yaux=yauxin 265 xaux0=xlon0 266 yaux0=ylat0 267 if(xaux.lt.0.) xaux=xaux+360. 268 if(yaux.lt.0.) yaux=yaux+360. 269 if(xaux0.lt.0.) xaux0=xaux0+360. 270 if(yaux0.lt.0.) yaux0=yaux0+360. 271 if(abs(xaux-xaux0).gt.eps) & 272 stop 'READWIND: LOWER LEFT LONGITUDE NOT CONSISTENT' 273 if(abs(yaux-yaux0).gt.eps) & 274 stop 'READWIND: LOWER LEFT LATITUDE NOT CONSISTENT' 273 if (xaux.gt.180.) xaux=xaux-360.0 274 if(abs(xaux-xlon0).gt.eps) & 275 stop 'READWIND: LOWER LEFT LONGITUDE NOT CONSISTENT' 276 if(abs(yaux-ylat0).gt.eps) & 277 stop 'READWIND: LOWER LEFT LATITUDE NOT CONSISTENT' 275 278 gotGrid=1 276 279 endif ! gotGrid … … 298 301 zsec4(nxfield*(ny-j-1)+i+1) 299 302 if(isec1(6).eq.141) sd(i,j,1,n)= &!! SNOW DEPTH 300 zsec4(nxfield*(ny-j-1)+i+1) 303 zsec4(nxfield*(ny-j-1)+i+1)/conversion_factor 301 304 if(isec1(6).eq.151) msl(i,j,1,n)= &!! SEA LEVEL PRESS. 302 305 zsec4(nxfield*(ny-j-1)+i+1) … … 316 319 endif 317 320 if(isec1(6).eq.143) then !! CONVECTIVE PREC. 318 convprec(i,j,1,n)=zsec4(nxfield*(ny-j-1)+i+1) 321 convprec(i,j,1,n)=zsec4(nxfield*(ny-j-1)+i+1)/conversion_factor 319 322 if (convprec(i,j,1,n).lt.0.) convprec(i,j,1,n)=0. 320 323 endif … … 366 369 do j=0,nymin1 367 370 wwh(i,j,nlev_ec+1)=0. 368 end do369 end do370 endif371 372 ! convert from ECMWF etadot to etadot*dp/deta as needed by FLEXPART373 if(etacon.eqv..true.) then374 do k=1,nwzmax375 dak=akm(k+1)-akm(k)376 dbk=bkm(k+1)-bkm(k)377 do i=0,nxmin1378 do j=0,nymin1379 wwh(i,j,k)=2*wwh(i,j,k)*ps(i,j,1,n)*(dak/ps(i,j,1,n)+dbk)/(dak/p00+dbk)380 if (k.gt.1) then381 wwh(i,j,k)=wwh(i,j,k)-wwh(i,j,k-1)382 endif383 end do384 371 end do 385 372 end do … … 479 466 480 467 end subroutine readwind 468
Note: See TracChangeset
for help on using the changeset viewer.