watex.utils.funcutils.station_id#

watex.utils.funcutils.station_id(id_, is_index='index', how=None, **kws)[source]#

From id get the station name as input and return index id. Index starts at 0.

Parameters:
  • id – str, of list of the name of the station or indexes .

  • is_index – bool considered the given station as a index. so it remove all the letter and keep digit as index of each stations.

  • how – Mode to index the station. Default is ‘Python indexing’ i.e.the counting starts by 0. Any other mode will start the counting by 1. Note that if is_index is True and the param how is set to it default value py, the station index should be downgraded to 1.

  • kws – additionnal keywords arguments from make_ids().

Returns:

station index. If the list id_ is given will return the tuple.

Example:

>>> from watex.utils.funcutils import station_id
>>> dat1 = ['S13', 's02', 's85', 'pk20', 'posix1256']
>>> station_id (dat1)
... (13, 2, 85, 20, 1256)
>>> station_id (dat1, how='py')
... (12, 1, 84, 19, 1255)
>>> station_id (dat1, is_index= None, prefix ='site')
... ('site1', 'site2', 'site3', 'site4', 'site5')
>>> dat2 = 1
>>> station_id (dat2) # return index like it is
... 1
>>> station_id (dat2, how='py') # considering the index starts from 0
... 0