viscid.tree module

Classes for elements along the tree from files to fields

class viscid.tree.Leaf(name=None, time=None, info=None, parents=None, **kwargs)[source]

Bases: viscid.tree.Node

Base class for fields

class viscid.tree.Node(name=None, time=None, info=None, parents=None, **kwargs)[source]

Bases: object

Base class for Datasets and Grids

basetime
find_attr(attr_name, default=<class 'viscid.tree._NO_DEFAULT_GIVEN'>)[source]

Breadth first search of parents for attr_name

Parameters:
  • attr_name (str) – some attribute name
  • default (Any) – fallback, possibly raises AttributeError if this is not given
Raises:

AttributeError – if no default given, and no parent found with attr_name

Returns:

The attribute, or default

find_info(key, default=<class 'viscid.tree._NO_DEFAULT_GIVEN'>)[source]

Go through the parents (breadth first) and find the info

find_info_owner(key)[source]

Go through the parents (breadth first) and find the info

Raises:KeyError
format_time(fmt='.02f', default='Timeless')[source]
get_all_info()[source]
get_info(key, default=<class 'viscid.tree._NO_DEFAULT_GIVEN'>)[source]
has_info(key)[source]
iter_resolved_children()[source]
name = None
parents = None
prepare_child(obj)[source]
print_info_tree()[source]
resolve()[source]
set_info(key, val)[source]
t2datetime64(t)[source]
tear_down_child(obj)[source]
time
time_as_datetime()[source]
time_as_datetime64()[source]
time_as_timedelta()[source]
time_as_timedelta64()[source]
update_info(key, val, fallback=True)[source]

Update an existing key if found, or fall back to add_info