Image I/O Example


Each sequence of calls to one of the image I/O routines is associated with a unique identifier, the so called transfer identifier.

Before the first call, 0 should be assigned to this identifier. When upon return the identifier has a value < 0, an error has occurred. A number > 0 means that the transfer has not been completed with this call and that further calls are necessary. These further calls must be made using the unmodified transfer identifier.

When the value is 0, the transfer has been completed successfully. With the help of this identifier, it is possible to handle subsets which contain more data than there is room for in your read/write buffer.


N     Reset transfer id for input data
      TIDI = 0
N     Reset transfer id for output data
      TIDO = 0
N     Start of read/write loop
      REPEAT
N        Read input data
         CALL GDSI_READ( SET, CWLO, CWUP, BUFFER, MAXBUF, NREAD, TIDI )
N        Scale data
         FOR N = 1, NREAD
           BUFFER(N) = 2.0 * BUFFER(N)
         CFOR
N        Write output data
         CALL GDSI_WRITE( SET, CWLO, CWUP, BUFFER, NREAD, NREAD, TIDO )
N     Stop if TIDI again zero
      UNTIL (TIDI .EQ. 0)

Programming GIPSY