xr1d
- PlasmaCalcs.tools.xarray_tools.xarray_grids.xr1d(arraylike, name, *, coords={}, **kw_data_array)
create a 1D xarray.DataArray from arraylike, using name for array, dim, & coord.
Equivalent: xr.DataArray(arraylike, coords={name: arraylike}, name=name, dims=name)- name: str
- name of the array. Result name, dim, and coord will all use this name.
- coords: dict
- if provided, update default coords using this dict.E.g. xr1d([1,2,3], ‘x’, coords={‘y’: 7}) coords will be {‘x’: [1,2,3], ‘y’: 7}.E.g. xr1d([1,2,3], ‘x’, coords={‘x’: [1,2,3]+10}) coord for ‘x’ will be [11,12,13].
Example: xr1d([1,7,3], ‘x’)<xarray.DataArray ‘x’ (x: 3)> Size: 24Barray([1, 7, 3])Coordinates:* x (x) int64 24B 1 7 3