xoa.cf.SGLocator.merge_attr

SGLocator.merge_attr(attr, value0, value1, loc=None, standardize=True)[source]

Merge two attribute values taking care of location

Parameters:
  • attr ({'name', 'standard_name', 'long_name'}) – Attribute name

  • value0 (str, None) – First attribute value

  • value1 (str, None) – Second attribute value, which is prioritary over the first one

  • loc (letters, {"any", None} or {"", False}) –

    • letters: one of these locations

    • None or “any”: any

    • False or ‘’: no location

Returns:

str, None

Example

In [1]: sg = SGLocator()

In [2]: sg.merge_attr('name', 'temp_t', 'mytemp')
Out[2]: 'mytemp_t'

In [3]: sg.merge_attr('name', 'temp', 'mytemp_t')
Out[3]: 'mytemp_t'

In [4]: sg.merge_attr('name', 'temp_u', 'mytemp_t', 'v')
Out[4]: 'mytemp_v'