misc

module of dascore.utils source

Misc Utilities.

Functions

Name Description
all_close Return True if ar1 is allcose to ar2.
all_diffs_close_enough Check if all the diffs are ‘close’ handling timedeltas.
broadcast_for_index For a given shape of array, return empty slices except for slice axis.
cached_method Cache decorated method.
check_filter_kwargs Check filter kwargs and return dim name and filter range.
check_filter_range Simple check on filter parameters.
get_middle_value Get the middle value in the differences array without changing dtype.
get_parent_code_name Get the name of the calling function/class levels up in stack.
get_stencil_coefs Get centered coefficients for a derivative of specified order and derivative.
is_valid_coord_str Return True if an input string is valid for representing coord info.
iter_files Use os.scan dir to iter files, optionally only for those with given
iterate Return an iterable from any object.
maybe_get_attrs Maybe get attributes from object (if they exist).
maybe_get_items Maybe get items from a mapping (if they exist).
optional_import Import a module and return the module object if installed, else raise error.
register_func Decorator for registering a function name in a list or dict.
sanitize_range_param Given a slice or tuple, check and return slice or tuple.
separate_coord_info Separate coordinate information from attr dict.
suppress_warnings Context manager for suppressing warnings.
to_str Convert value to string.
unbyte Ensure a string is given by str or possibly bytes.
warn_or_raise A helper function to issues a warning, raise an exception or do nothing.

Classes

Name Description
CacheDescriptor A descriptor for storing infor in an instance cache (mapping).
MethodNameSpace A namespace for class methods.