## GDF_READ_HEADER

Subroutine GDF_READ_HEADER reads the header of the requested Gildas data set (specified in imag%file), and optionally change its rank.

    subroutine gdf_read_header(imag,error,rank)
      use gio_dependencies_interfaces
      use gio_interfaces, except_this=>gdf_read_header
      use image_def
      use gbl_message
      !---------------------------------------------------------------------
      ! @ public
      ! GDF API
      !       Read an image header from the requested file
      !---------------------------------------------------------------------
      type(gildas), intent(inout) :: imag   ! Image structure
      logical,      intent(out)   :: error  ! Error flag
      integer,      intent(in), optional :: rank  ! Desired rank

If the optional rank=value argument is present, the header is modified according to the following rules. value < 0 means the image must have hx%gil%ndim=-rank. value = 0 means trim all possible trailine degenerate dimensions, i.e. set hx%gil%ndim to the last dimension . value > 0 means extend or trim rank to desired value.