# Path: src/pys5p/biweight.py
# def biweight(data, axis=None, spread=False):
#     """
#     Calculate Tukey's biweight.
#     Implementation based on Eqn. 7.6 and 7.7 in the SWIR OCAL ATBD.
# 
#     Parameters
#     ----------
#     data   :   array_like
#        input array
#     axis   :   int, optional
#        axis along which the biweight medians are computed.
#         - Note that axis will be ignored when data is a 1-D array.
#     spread :   bool, optional
#        if True, then return also the biweight spread.
# 
#     Returns
#     -------
#     out    :   ndarray or tuple
#        biweight median and biweight spread if parameter "spread" is True
#     """
#     if axis is None or data.ndim == 1:
#         mask = np.isfinite(data)
#         if np.all(~mask):
#             if spread:
#                 return (np.nan, 0.)
#             return np.nan
#         return __biweight(data, spread)
# 
#     # only a single axis!
#     if not isinstance(axis, int):
#         raise TypeError('axis not an integer')
#     if not 0 <= axis < data.ndim:
#         raise ValueError('axis out-of-range')
# 
#     with warnings.catch_warnings():
#         warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
#         return __biweight_axis(data, axis, spread)


from datetime import datetime, timedelta
from pathlib import Path, PurePosixPath
from .biweight import biweight
import h5py
import numpy as np
            data_a = buff
        else:
            data_a = np.vstack((data_a, buff))

    if data_a is not None:
        if 'mean' in mode:
            data_a = np.nanmean(data_a, axis=0)
        elif 'median' in mode:
            data_a = np.nanmedian(data_a, axis=0)
        elif 'biweight' in mode:
            data_a = biweight(data_a, axis=0)

    if dict_b is None:
        return data_a

    data_b = None
    for key in sorted(dict_b):
        buff = dict_b[key][...]

        if data_b is None:
            data_b = buff
        else:
            data_b = np.vstack((data_b, buff))

    if data_b is not None:
        if 'mean' in mode:
            data_b = np.nanmean(data_b, axis=0)
        elif 'median' in mode:
            data_b = np.nanmedian(data_b, axis=0)
        elif 'biweight' in mode:

# Path: src/pys5p/biweight.py
# def biweight(data, axis=None, spread=False):
#     """
#     Calculate Tukey's biweight.
#     Implementation based on Eqn. 7.6 and 7.7 in the SWIR OCAL ATBD.
# 
#     Parameters
#     ----------
#     data   :   array_like
#        input array
#     axis   :   int, optional
#        axis along which the biweight medians are computed.
#         - Note that axis will be ignored when data is a 1-D array.
#     spread :   bool, optional
#        if True, then return also the biweight spread.
# 
#     Returns
#     -------
#     out    :   ndarray or tuple
#        biweight median and biweight spread if parameter "spread" is True
#     """
#     if axis is None or data.ndim == 1:
#         mask = np.isfinite(data)
#         if np.all(~mask):
#             if spread:
#                 return (np.nan, 0.)
#             return np.nan
#         return __biweight(data, spread)
# 
#     # only a single axis!
#     if not isinstance(axis, int):
#         raise TypeError('axis not an integer')
#     if not 0 <= axis < data.ndim:
#         raise ValueError('axis out-of-range')
# 
#     with warnings.catch_warnings():
#         warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
#         return __biweight_axis(data, axis, spread)


# Path: src/pys5p/ocm_io.py
from datetime import datetime, timedelta
from pathlib import Path, PurePosixPath
from .biweight import biweight
import h5py
import numpy as np

            data_a = buff
        else:
            data_a = np.vstack((data_a, buff))

    if data_a is not None:
        if 'mean' in mode:
            data_a = np.nanmean(data_a, axis=0)
        elif 'median' in mode:
            data_a = np.nanmedian(data_a, axis=0)
        elif 'biweight' in mode:
            data_a = biweight(data_a, axis=0)

    if dict_b is None:
        return data_a

    data_b = None
    for key in sorted(dict_b):
        buff = dict_b[key][...]

        if data_b is None:
            data_b = buff
        else:
            data_b = np.vstack((data_b, buff))

    if data_b is not None:
        if 'mean' in mode:
            data_b = np.nanmean(data_b, axis=0)
        elif 'median' in mode:
            data_b = np.nanmedian(data_b, axis=0)
        elif 'biweight' in mode:

            data_b = biweight(data_b, axis=0)