This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Good morning,
The GEMPAK-5.6 subroutine gdsrtl.f - around line 72 - reads:
do while ( (iloc .ge. istart) .and. (ilistt .gt.
ksrtl(2,iloc,igdfln)) )
iloc = iloc-1
enddo
where istart is 1. Altough the conditional should never evaluate to
true if iloc is less than 1, the subcripts for ksrtl can be out of
range. This only shows up if the library is compiled with the -C
option, of course. The invalid addressing can be avoided by the
addition of a logical variable - stopLoop in the following replacement
segment:
stopLoop = .false.
do while (iloc .ge. istart .and. .not.stopLoop)
if (ilistt .gt. ksrtl (2,iloc,igdfln)) then
iloc = iloc - 1
else
stopLoop = .true.
endif
enddo
While this is slightly slower than the original algorithm, it avoids the
addressing error and seems to retain the original functionality. I hope
that this proves useful at some point,
Ron