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.
I found some redbook graphics on NOAAport which cause AW_APLT to enter in an infinite loop. Some text blocks appear to be Null padded 2 bytes less than the itotln. Don't know if this is an intended checksum. The wave period charts on NOAAport today exhibit this: WMO Headers: PKQD01 KWNM 181200, PKQD03 KWNM 181200 (NMCGPH0P1, NMCGPH0P3). I can send you these products if needed. The problem appears in the main loop, where the IF block decrements ibeg DO WHILE ( ibeg .le. itotln ) ... C C* Storing text in string. C ELSE IF ( .not. textfl ) THEN IF ( ispch .ne. 0 ) THEN DO WHILE ( ( ( ispch .ge. 32) .and. + ( ispch .le. 127 ) ) .and. ( ibeg .le. itotln ) ) stchar ( i:i ) = char ( b ( ibeg ) ) i = i + 1 ibeg = ibeg + 1 ispch = ibits( ibte (ibeg), 0, 8) textfl = .true. END DO ibeg = ibeg - 1 ... ibeg = ibeg + 1 C C* Check for I = 0 (Chiz) C if(i.eq.0) then iret = -1 return endif C END DO When ispch is 0, ibeg is not incremented. I added a check just before the end_do to prevent the infinite loop by returning to the calling routine- though you might want to stay in the routine and finish the checksum. I also added a check in the debug printing to avoid trying to write the stchar(1:i) when i < 1: write(14,*)'CHARACTER STRING:' if(i .gt. 0) then write(14,68) stchar(1:i) else write(14,*) 'No char ',i endif Steve Chiswell Unidata User Support