The problem occurs in extract_obs.F and ad_extract_obs.F:
line 358 in extract_obs.F and following (some comments added by me):
Code: Select all
IF (Zobs(iobs).gt.0.0_r8) THEN
k1=INT(Zobs(iobs)) ! k1 can become 0
k2=MIN(k1+1,N(ng))
r2=REAL(k2-k1,r8)*(Zobs(iobs)-REAL(k1,r8))
r1=1.0_r8-r2
ELSE
!...
END IF
! ... no changes to k1
IF ((r1+r2).gt.0.0_r8) THEN
! ... no changes to k1
Aobs(iobs)=Hmat(1)*A(i1,j1,k1)+ & ! k1 is used as an index here and A's 3rd dimension starts at 1
& Hmat(2)*A(i2,j1,k1)+ &
& Hmat(3)*A(i2,j2,k1)+ &
& Hmat(4)*A(i1,j2,k1)+ &
& Hmat(5)*A(i1,j1,k2)+ &
& Hmat(6)*A(i2,j1,k2)+ &
& Hmat(7)*A(i2,j2,k2)+ &
& Hmat(8)*A(i1,j2,k2)
I fixed it replacing lines 359 and 360 by:0: Subscript out of range for array a (extract_obs.f90: 362)
subscript=0, lower bound=1, upper bound=42, dimension=3
Code: Select all
k1=MAX(INT(Zobs(iobs)),1) ! Positions in fractional
k2=MIN(INT(Zobs(iobs))+1,N(ng)) ! levels
The same patch needs to be applied to ad_extract_obs.F.