Add data tools
Closes #35 (closed)
This merge request adds a data_tools.py
submodule with:
-
to_xarray(data, info, time)
: create xarray from raw data, time can beNone
(check thatinfo.meta
is correctly set toxdata.attrs
) -
has_time(xdata)
:time in xdata.dims
-
get_time(xdata)
: get time from xdata if it has time else None -
get_data(xdata)
: get data from an xarray (arr.data) -
get_magnitude(xdata)
: get data from an xarray as numpy array (data.magnitude) -
get_units(xdata)
: (pint.units) -
get_dimensionality(xdata)
: (pint.dimensionality) -
full_like(xdata, value)
: xarray with single value like given data -
full(info, value, time)
: xarray with single value liketo_xarray
withnp.full(info.grid.shape, value)
-
get_time(xdata)
: get list(datatime) or None (if no time dim) -
to_units(xdata, units)
: (pint.to(units)
) -
check(xdata, name, info, time)
: check if xarray matches info
Edited by Sebastian Müller