Typhon
0.10.0
  • Reference
    • ARTS
    • Cloud mask
    • Collocations
    • Configuration and Environment
    • Constants
    • Datasets
    • Filesets and handlers
    • Geodesy and Geography
    • Mathematics
    • Physics
    • Physics (Unit-aware via pint)
      • physics.units
      • physics.units.constants
      • physics.units.tools
        • UnitsAwareDataArray
    • Plotting
    • Retrieval
    • Spectroscopy
    • Topography
    • Miscellaneous
    • Indices and tables
  • Developer documentation
  • FAQ
  • Tutorials
Typhon
  • Reference
  • physics.units
  • UnitsAwareDataArray
  • head
  • View page source

head

UnitsAwareDataArray.head(indexers: Mapping[Any, int] | int | None = None, **indexers_kwargs: Any) → Self

Return a new DataArray whose data is given by the the first n values along the specified dimension(s). Default n = 5

See also

Dataset.head, DataArray.tail, DataArray.thin

Examples

>>> da = xr.DataArray(
...     np.arange(25).reshape(5, 5),
...     dims=("x", "y"),
... )
>>> da
<xarray.DataArray (x: 5, y: 5)> Size: 200B
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14],
       [15, 16, 17, 18, 19],
       [20, 21, 22, 23, 24]])
Dimensions without coordinates: x, y
>>> da.head(x=1)
<xarray.DataArray (x: 1, y: 5)> Size: 40B
array([[0, 1, 2, 3, 4]])
Dimensions without coordinates: x, y
>>> da.head({"x": 2, "y": 2})
<xarray.DataArray (x: 2, y: 2)> Size: 32B
array([[0, 1],
       [5, 6]])
Dimensions without coordinates: x, y
Previous Next

© Copyright The Typhon Developers.

Built with Sphinx using a theme provided by Read the Docs.