transforms.tools ================ .. py:module:: transforms.tools Attributes ---------- .. autoapisummary:: transforms.tools.GROUPBY_KWARGS transforms.tools.HOW_METHODS transforms.tools.WEIGHTED_HOW_METHODS transforms.tools.ALLOWED_LIBS transforms.tools.WEIGHTS_DICT transforms.tools.STANDARD_AXIS_KEYS Functions --------- .. autoapisummary:: transforms.tools.ensure_list transforms.tools.time_dim_decorator transforms.tools.groupby_kwargs_decorator transforms.tools.season_order_decorator transforms.tools.nanaverage transforms.tools.standard_weights transforms.tools.latitude_weights transforms.tools.get_how transforms.tools.get_dim_key transforms.tools.get_spatial_info transforms.tools.groupby_time transforms.tools.groupby_bins Module Contents --------------- .. py:function:: ensure_list(thing) .. py:function:: time_dim_decorator(func) .. py:data:: GROUPBY_KWARGS :value: ['frequency', 'bin_widths', 'squeeze'] .. py:function:: groupby_kwargs_decorator(func) .. py:function:: season_order_decorator(func) .. py:function:: nanaverage(data, weights=None, **kwargs) A merge of the functionality of np.nanmean and np.average. :param data: :type data: :class:`numpy array` :param weights: Weights will be normalised and must correspond to the shape of the numpy data array and axis/axes that is/are averaged over. :type weights: :class:`Weights` to :class:`apply` to :class:`the data for averaging.` :param axis: :type axis: :class:`axis/axes` to :class:`compute the nanaverage over.` :param kwargs: :type kwargs: :class:`any other np.nansum kwargs` :returns: * :class:`numpy array mean` of :class:`data (along axis) where nan-values are ignored` * :class:`and weights applied if provided.` .. py:function:: standard_weights(dataarray, weights, **kwargs) Implement any standard weights functions included in earthkit-transforms. .. py:function:: latitude_weights(dataarray, lat_key = None) xarray.DataArray wrapper for latitude_weights. Detects the spatial dimensions latitude must be a coordinate of the dataarray. .. py:data:: HOW_METHODS .. py:data:: WEIGHTED_HOW_METHODS .. py:data:: ALLOWED_LIBS .. py:data:: WEIGHTS_DICT .. py:function:: get_how(how, how_methods=HOW_METHODS) .. py:data:: STANDARD_AXIS_KEYS :type: dict[str, list[str]] .. py:function:: get_dim_key(dataarray, axis) Return the key of the dimension. .. py:function:: get_spatial_info(dataarray, lat_key=None, lon_key=None) .. py:function:: groupby_time(dataarray, frequency = None, bin_widths = None, squeeze = False, time_dim = 'time') .. py:function:: groupby_bins(dataarray, frequency, bin_widths = 1, squeeze = False, time_dim = 'time')