xarray_werrsub
- PlasmaCalcs.tools.xarray_tools.xarray_werr_stats.xarray_werrsub(A, B, *, require_std=True)
returns dataset of ‘mean’ and ‘std’ for A - B, including error propagation.
Assumes independent errors and applies the “standard” formula:mean(A - B) = mean(A) - mean(B)std(A - B) = sqrt(std(A)**2 + std(B)**2)A, B: xarray.Dataset or DataArray; B can also be any other value.Dataset –> mean = ds[‘mean’]; std = ds.get(‘std’, default=0).else –> assume it represents ‘mean’, with std=0.require_std: boolwhether to require at least one of A or B to have ‘std’.if True and std missing from both, crash with InputError.