uxarray.UxDataArray.zonal_anomaly#
- UxDataArray.zonal_anomaly(lat=(-90, 90, 10), conservative=False)#
Compute the zonal anomaly: each face value minus the mean of its latitude band.
Returns a new
UxDataArraywith the same dimensions as the input, where each face holds its original value minus the zonal mean of the latitude band it belongs to.- Parameters:
lat (tuple or array-like, default=(-90, 90, 10)) –
- Latitude band specification:
tuple (start, end, step): band edges via np.linspace(start, end, n)
array-like: explicit band edges in degrees
conservative (bool, default=False) – If True, uses area-weighted band means and blends across bands for faces that straddle a band boundary, reusing the face-band weight matrix computed for zonal_mean so no geometry is duplicated. If False, assigns each face to a band by its centroid latitude.
- Returns:
Same dimensions as input with per-face band mean subtracted.
- Return type:
Examples
>>> uxds["var"].zonal_anomaly() >>> uxds["var"].zonal_anomaly(lat=(-60, 60, 5), conservative=True)