xoa.cf.SGLocator

class xoa.cf.SGLocator(name_format=None, valid_locations=None, encoding=None)[source]

Staggered grid location parsing and formatting utility

Parameters:
  • name_format (str) – A string containing the string patterns {root} and {loc}, which defaults to "{root}_{loc}"

  • valid_locations (list(str), None) – Valid location strings that are used when parsing

__init__(name_format=None, valid_locations=None, encoding=None)[source]

Methods

add_loc(da, loc[, to_name, to_attrs])

A shortcut to format_dataarray() to update da with loc without copy

format_attr(attr, value, loc[, standardize])

Format a single attribute at a specified location

format_attrs(attrs[, loc, standardize])

Copy and format a dict of attributes

format_dataarray(da[, loc, standardize, ...])

Format name and attributes of a copy of DataArray

get_loc([name, attrs, errors])

Parse name and attributes to find a unique location

get_loc_from_da(da[, errors])

Parse a data array name and attributes to find a unique location

match_attr(attr, value, root[, loc])

Check if an attribute is matching a location

merge_attr(attr, value0, value1[, loc, ...])

Merge two attribute values taking care of location

parse_attr(attr, value)

Parse an attribute string to get its root and location

parse_loc_arg(loc)

Parse the location argument

patch_attrs(attrs, patch[, loc, ...])

Patch a dict of attribute with another dict taking care of loc

Attributes

formats

location_pattern

re_match

root_patterns

valid_attrs