xrspatial.templates.list_templates#

xrspatial.templates.list_templates(kind: str | None = None) Dict[str, List[str]] | List[str][source]#

List the template names from_template accepts.

Every name in the result is a valid from_template argument: region and city names are lowercase, country codes are uppercase ISO-3166 / GADM alpha-3.

Parameters:

kind ({'regions', 'cities', 'countries'}, optional) – Return just one group as a sorted list. When omitted (the default), return a dict mapping each group to its sorted list of names.

Returns:

With kind=None, {'regions': [...], 'cities': [...], 'countries': [...]}. With kind set, the sorted list for that group.

Return type:

dict of str to list of str, or list of str

Examples

>>> from xrspatial.templates import list_templates
>>> names = list_templates()
>>> sorted(names)
['cities', 'countries', 'regions']
>>> 'conus' in names['regions']
True
>>> 'london' in list_templates('cities')
True