XMM-Newton SAS Home Page
XMM-Newton Science Analysis System

ssclib (ssclib-4.35) [xmmsas_20211130_0941-20.0.0]


  subroutine splitSetTabName(setTabName, setName, tabName, noColonFound, useBlock)
    character(*),  intent(in)            :: setTabName
    character(*),  intent(out)           :: setName, tabName
    logical,       intent(out), optional :: noColonFound
    logical,       intent(in),  optional :: useBlock
  end subroutine splitSetTabName

The parameter type `table' (see param) accepts a string consisting of a dataset name followed by a colon followed by a binary table name. If the user forgets to include the colon + table name, the resulting dal error is not very helpful as an indication of what has gone wrong. Personally I find it more useful to have as the default behaviour in this case that the first table in the dataset should be opened, with an accompanying warning. So I have written this routine splitSetTabName() to act as a trap for the situation in which the user leaves off the colon+table name. The idea is that the string read from a `table'-type parameter is sent first to splitSetTabName(), which searches the string for a colon; if it finds one, then it returns the before- and after-colon strings respectively in setName and tabName; if no colon is detected, splitSetTabName() issues a warning (if noColonFound is not given), returns the entire string in setName, and also attempts to extract the name of the first table in the dataset (unless useBlock is given and is .false.) and returns this in tabName, which can be an empty string. In the latter case, if the file does not exist and if noColonFound is not given, then it raises an error.

An example of how to use splitSetTabName() is as follows:

  setTabName = stringParameter('mytable') ! this should be of param type `table'
  call splitSetTabName(setTabName, setName, tabName)
  set = dataSet(setName, READ)
  tab = table(set, tabName)


XMM-Newton SOC -- 2021-11-30