finam.data.from_compressed#
- finam.data.from_compressed(xdata, shape, order='C', mask=None, **kwargs)[source]#
Fill a (masked) array following a given mask or shape with the provided data.
This will only create a masked array if kwargs are given (especially a mask). Otherwise this is simply reshaping the given data. Filling is performed in the given array order.
- Parameters:
data (
pint.Quantityornumpy.ndarrayornumpy.ma.MaskedArray) – The reference object input.shape (str) – shape argument for
numpy.reshapeorder (str) – order argument for
numpy.reshapemask (
Maskvalue or valid boolean mask forMasked arrays) – mask to use**kwargs – keyword arguments forwarded to
numpy.ma.array
- Returns:
New object with the desired shape and same type as input. Units will be taken from the input if present. Will only be a masked array if kwargs are given.
- Return type:
See also
to_compressedInverse operation.
numpy.ma.arrayRoutine consuming kwargs to create a masked array.
numpy.reshapeEquivalent routine if no mask is provided.
Notes
If both mask and shape are given, they need to match in size.