Skip to content

Commit 2ea7560

Browse files
committed
fix another potential invalid grib id error in alchimia (to be checked)
1 parent 0c80cad commit 2ea7560

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

volgrid6d/volgrid6d_alchimia_class.F03

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ subroutine make_vg6d(mayvfn,mybin,mybout,vg6din,vg6dout,allvarcomputed)
141141
vg6din%voldati(:,:,ilevel,itime,itimerange,ivarin)
142142
ENDIF
143143

144-
CALL copy (vg6din%gaid(ilevel,itime,itimerange,ivarin), &
144+
CALL copy(vg6din%gaid(ilevel,itime,itimerange,ivarin), &
145145
vg6dout%gaid(ilevel,itime,itimerange,ivarout))
146146
! save the first valid gaid for helping successive variable conversion
147147
IF (.NOT.c_e(gaid_template)) &
@@ -210,13 +210,15 @@ subroutine make_vg6d(mayvfn,mybin,mybout,vg6din,vg6dout,allvarcomputed)
210210
if (ivarin == 0) ivarin=firsttrue(c_e(vg6dout%gaid(ilevel,itime,itimerange,:))) ! if not found is enought from one present variables
211211
ivarout = index_c(newbout,mayvfn%fnds(i)%bout(ivar))
212212

213-
if (ivarin > 0 .and. ivarout > 0 )then
214-
215-
!print *, "DDD search",newbout(ivarout)
216-
!print *, "DDD index",index_c(mybout,newbout(ivarout))
217-
!if ( index_c(mybout,newbout(ivarout)) > 0)then
218-
219-
call copy (vg6dout%gaid(ilevel,itime,itimerange,ivarin), vg6dout%gaid(ilevel,itime,itimerange,ivarout))
213+
IF (ivarin > 0 .AND. ivarout > 0) THEN
214+
!print *, "DDD search",newbout(ivarout)
215+
!print *, "DDD index",index_c(mybout,newbout(ivarout))
216+
!if ( index_c(mybout,newbout(ivarout)) > 0)then
217+
! the following identity happened and generated invalid grib id error
218+
! is it a reasonable case or a bug?
219+
IF (ivarin /= ivarout) &
220+
CALL copy(vg6dout%gaid(ilevel,itime,itimerange,ivarin), &
221+
vg6dout%gaid(ilevel,itime,itimerange,ivarout))
220222

221223
#ifdef HAVE_LIBGRIBAPI
222224
if (c_e(grid_id_get_gaid(vg6dout%gaid(ilevel,itime,itimerange,ivarout)))) then

0 commit comments

Comments
 (0)