pysiral.core.helper =================== .. py:module:: pysiral.core.helper .. autoapi-nested-parse:: Created on Tue Jul 21 18:04:43 2015 @author: Stefan TODO: Is this still being used? Classes ------- .. autoapisummary:: pysiral.core.helper.ProgressIndicator pysiral.core.helper.SimpleTimer Functions --------- .. autoapisummary:: pysiral.core.helper.get_multiprocessing_1d_array_chunks pysiral.core.helper.parse_datetime_str pysiral.core.helper.get_first_array_index pysiral.core.helper.get_last_array_index pysiral.core.helper.rle pysiral.core.helper.month_iterator pysiral.core.helper.days_iterator pysiral.core.helper.get_month_time_range pysiral.core.helper.validate_year_month_list Module Contents --------------- .. py:function:: get_multiprocessing_1d_array_chunks(array_size: int, n_processes: int) -> Tuple[List[Tuple[int, int]], int] Break down an array in chunks for multiprocessing. The rule is one chunk per process/CPU. :param array_size: The number of elements to be distributed to chunks :param n_processes: The number processes/CPU's/chunks :return: List with start and end index for each chunk and number of (viable) processes .. py:function:: parse_datetime_str(dtstr) Converts a time string to a datetime object using dateutils .. py:function:: get_first_array_index(array, value) Get the index in array of the first occurance of ``value`` .. py:function:: get_last_array_index(array, value) Get the index in array of the last occurance of ``value`` .. py:function:: rle(inarray) run length encoding. Partial credit to R rle function. Multi datatype arrays catered for including non Numpy returns: tuple (runlengths, startpositions, values) from: http://stackoverflow.com/questions/1066758/find-length-of-sequences- of-identical-values-in-a-numpy-array .. py:function:: month_iterator(start_year, start_month, end_year, end_month) returns an iterator over months .. py:function:: days_iterator(year, month) returns an iterator over all days in given month .. py:function:: get_month_time_range(year, month) Returns the a start and stop datetime object for a given month .. py:function:: validate_year_month_list(year_month_list, label) .. py:class:: ProgressIndicator(n_steps) Bases: :py:obj:`object` .. py:attribute:: n_steps .. py:attribute:: index :value: None .. py:method:: reset() .. py:method:: get_status_report(i, fmt='{step} of {n_steps} ({percent:.2f}%)') .. py:property:: step .. py:property:: percent .. py:class:: SimpleTimer(name='') Bases: :py:obj:`object` .. py:attribute:: name :value: '' .. py:attribute:: start .. py:attribute:: last_event .. py:property:: elapsed .. py:property:: total .. py:method:: checkpoint(name='') .. py:method:: __enter__() .. py:method:: __exit__(type, value, traceback)