Keywords: sic-gdfv2

Next: GDF_READ_UVDATASET Up: GDF API and programming Previous: GDF_RANGE Contents

## GDF_READ_GILDAS

Subroutine `gdf_read_gildas` is the basic entry point to read a GILDAS data file into a GILDAS data structure. Based on the `hx%gil%type_gdf` code (previously set by an appropriate call to `gildas_null` or inherited by `gdf_copy_header` or `gdf_transpose_header`, it will perform different operations.

    interface
      subroutine gdf_read_gildas(hx,name,ext,error, rank, data)
        use image_def
        use gbl_message
        !-----------------------------------------------------------------
        ! @ public
        ! Read a Gildas Data File of name "name" and extention "ext"
        ! and return it into the "hx" Gildas data type.
        !
        ! Desired Form & Rank can be specified: an error will happen
        ! in case of mismatch.
        !-----------------------------------------------------------------
        type (gildas), intent(inout) :: hx    ! Gildas data type
        character(len=*), intent(in) :: name  ! Filename
        character(len=*), intent(in) :: ext   ! Extension
        logical, intent(out) :: error         ! Error flag
        integer, intent(in), optional :: rank
        logical, intent(in), optional :: data
      end subroutine gdf_read_gildas
    end interface

Read a GILDAS data set and (optionally) return data from it.

Optional argument `data` is a logical indicating whether the data is read (`data=.true.`, which is the default) or only the header is read (`data=.false.`). The data is returned in the `hx%XNd` where `X = r, d` or `i` according to the data type, and `N = 1-4` is the data rank. The array is allocated by the routine.

Optional argument `rank=value` indicates the desired rank of the result. `value<0` means the image must have an intrinsic rank equal to `-value`. `value>0` means that the data must be trimmed of its last, or extended by, (degenerate) dimensions to match the requested rank; an error is returned if not possible. `value=0` means the header should take the rank from file, but the data should be returned as a 1D array.

Note: if preset on input, hx%gil%form indicates the desired type of values. An error will occur in case of mismatch: no conversion between real or integers is performed.

For UV data sets (in UVT or TUV order), it reads the header and the data according to the file layout.

Next: GDF_READ_UVDATASET Up: GDF API and programming Previous: GDF_RANGE Contents