next up previous contents index
Next: DELETE Up: DEFINE Previous: DEFINE /LIKE   Contents   Index


DEFINE /TRIM

        [SIC\]DEFINE IMAGE|HEADER Var1 File1 Key1 [Var2 File2 Key2 [...]]
                  /TRIM [Rank] [/GLOBAL]

    Attempt to trim trailing degenerate dimensions up to the specified Rank.
    If no Rank is given, trim all possible trailing degenerate dimensions.

    If  Rank is positive, the defined header or image will have exactly Rank
    dimensions. An error occur if the corresponding file has  non-degenerate
    dimensions  beyond  this  rank.   If the file is of lower dimensionality
    than the specified Rank, its dimensionality is extended by   adding  de-
    generate dimensions up to Rank.

    If  Rank  is negative, trim all possible trailing degenerate dimensions,
    and return an error if the  final  dimensionality  remains  larger  than
    Rank.

    Examples:
      Assume file.gdf contains a 3-D array of dimensions [Nx,Ny,1]
      DEFINE IMAG A file.gdf READ
        will return the 3-D array A[Nx,Ny,1]
      DEFINE IMAG A file.gdf READ /TRIM 4
        will return the 4-D array A[Nx,Ny,1,1]
      DEFINE IMAG A file.gdf READ /TRIM 1
        will produce an error (same with /TRIM -1)
      DEFINE IMAG A file.gdf READ /TRIM -4
        will return the 2-D array A[Nx,Ny]
      DEFINE IMAG A file.gdf READ /TRIM
        will also return the 2-D array A[Nx,Ny]


Gildas manager 2024-04-19