xarray_werrdiv
- PlasmaCalcs.tools.xarray_tools.xarray_werr_stats.xarray_werrdiv(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:z = A / Bmean(z) = mean(A) / mean(B)std(z) = abs(mean(z)) * sqrt((std(A)/mean(A))**2 + (std(B)/mean(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: bool
- whether to require at least one of A or B to have ‘std’.if True and std missing from both, crash with InputError.