Python API¶
Spaces¶
- class rebasis.Space(inner, kind='custom')¶
An ordered set of elements: basis functions B_j, or measurement kernels K_i.
Elements are shapes, not densities: everything peaks at 1 (boxes, hats, B-spline sums and all line-shape profiles). Normalization belongs to the operation:
measure()divides by each kernel’s integral, so the kernels act as unit-area instrument responses.Line-shape profiles are truncated;
cutoffsets the half width of the support in the profile’s natural width unit (stated per constructor). Within the support every integral is accurate to rounding.- classmethod deltas(x)¶
Point evaluations at
x(as kernels), or point masses (as a basis).
- classmethod boxes(edges)¶
Piecewise-constant basis; box i is 1 on [edges[i], edges[i+1]). Coefficients are bin averages.
- classmethod boxes_from_centers(centers)¶
Boxes with edges halfway between
centers, the end boxes symmetric about theirs.
- classmethod hats(nodes)¶
Piecewise-linear basis on
nodes: coefficients are the values at the nodes, and the function is their linear interpolant. The basis for a function known by samples.
- classmethod bsplines(knots, degree)¶
B-splines of
degree(0-3) on a nondecreasing knot vector: len(knots) − degree − 1 functions.
- classmethod bsplines_clamped(breakpoints, degree=3)¶
B-splines of
degree(0-3) with repeated end knots: a partition of unity on [breakpoints[0], breakpoints[-1]] with len(breakpoints) + degree − 1 functions. Degree 0 isboxes(), degree 1hats().
- classmethod harmonics(n, period=360.0, start=0.0)¶
cos(2πkx/P) and sin(2πkx/P) for k = 1..n (2n functions, in that order) on [start, start + period]: zonal waves in a mean (with longitude in that range), annual cycles. The constant is not included, since mean terms add their own.
- classmethod bsplines_periodic(breakpoints, degree=3)¶
Periodic B-splines of
degree(0-3):breakpointsspan one period, from start to start + P, and the len(breakpoints) − 1 functions wrap around it, forming a partition of unity on [start, start + P). Localized periodic structure, e.g. in longitude.
- classmethod gaussians(centers, *, sigma=None, fwhm=None, cutoff=6.0)¶
exp(−t²/2σ²);
cutoffin standard deviations.
- classmethod lorentzians(centers, *, hwhm=None, fwhm=None, cutoff=100.0)¶
1 / (1 + (t/γ)²), γ = HWHM;
cutoffin HWHM. The heavy tails are truncated, andmeasure()normalizes by the truncated area.
- classmethod voigts(centers, *, sigma=None, fwhm_gaussian=None, gamma=None, fwhm_lorentzian=None, cutoff=100.0)¶
Gaussian (
sigmaorfwhm_gaussian) convolved with Lorentzian (half widthgammaorfwhm_lorentzian), via the Faddeeva function;cutoffin units of the Voigt HWHM.
- classmethod pseudo_voigts(centers, *, eta, hwhm=None, fwhm=None, cutoff=100.0)¶
η · Lorentzian + (1 − η) · Gaussian with a common HWHM;
cutoffin HWHM.
- classmethod super_gaussians(centers, *, power, hwhm=None, fwhm=None, asymmetry=0.0, cutoff=6.0)¶
exp(−ln2 · |t / w|^power), flat-topped for power > 2 (power >= 1).With
asymmetrya, the half widths are w(1 − a) left and w(1 + a) right of the center (the FWHM stays 2w), as used for e.g. TROPOMI slit functions.cutoffin half widths of the respective side.
- classmethod smoothed_boxes(centers, *, width, sigma=None, fwhm=None, cutoff=6.0)¶
A box of full
widthconvolved with a Gaussian: an entrance slit imaged through blurring optics.cutoffin standard deviations beyond the box edges.
- classmethod fts(centers, *, max_opd, apodization='none', cutoff=100.0)¶
Fourier-transform spectrometer line shape, ∫ A(u) cos(2πL(ν − ν₀)u) du.
max_opdL is the maximum optical path difference in inverse units of the spectral coordinate (cm for wavenumbers in cm⁻¹).apodizationis one of"none"(sinc),"triangle"(sinc²),"hann","hamming"(Happ–Genzel),"blackman","blackman_harris","norton_beer_weak","norton_beer_medium","norton_beer_strong", or a dict{"cosine_sum": [a0, a1, ...]}for A(u) = Σ a_m cos(mπu) or{"polynomial": [c0, c1, ...]}for A(u) = Σ c_i (1 − u²)^i.cutoffin units of 1/(2L), the spacing of the sinc zeros.
- classmethod rectangles(centers, *, width)¶
Boxes of full
widthcentred oncenters.
- classmethod triangles(centers, *, hwhm=None, fwhm=None)¶
Symmetric triangles with the given half width at half maximum (base 4·hwhm).
- classmethod trapezoids(centers, *, top_width, bottom_width)¶
1 over the central
top_width, falling linearly to 0 atbottom_width.
- classmethod shifted(centers, shape_x, shape_y, stretch=1.0, interp='linear')¶
Copies of one tabulated line shape, stored once.
Element i is y((x − centers[i]) / stretch[i]) with y the
"linear"or"pchip"(monotone cubic) interpolant of (shape_x, shape_y), zero outside the table.
- classmethod tabulated(centers, x, y, interp='linear')¶
A separately tabulated line shape per element (e.g. measured slit functions).
yhas shape (len(centers), m);xholds offsets from the centers, shape (m,) if shared or (len(centers), m).
- to_wavenumber(*, jacobian)¶
This space, defined in wavelength (nm), as functions of wavenumber (cm⁻¹).
jacobiandecides how values carry over; there is no default because it is a physical choice:Truemultiplies by|dλ/dν|, so that integrals over ν equal integrals over λ. Use it for kernels (an instrument response given in wavelength averages over wavelength, wherever the spectrum is computed) and for bases of spectral densities (radiance per nm).Falsekeeps values, f(ν) = f(λ(ν)): bases of functions (transmittance, reflectance, sun-normalized radiance).
Shapes are exact: a Gaussian in wavelength is integrated as such in wavenumber. Parameters (centers, widths) stay in nm, also for
measure_derivative().
- to_wavelength(*, jacobian)¶
This space, defined in wavenumber (cm⁻¹), as functions of wavelength (nm); see
to_wavenumber()forjacobian.
- reciprocal(k, *, jacobian)¶
The elements as functions of x = k / u, u their own coordinate (supports must not contain 0); see
to_wavenumber()forjacobian.
- affine(offset=0.0, scale=1.0, *, jacobian)¶
The elements as functions of x = offset + scale·u, u their own coordinate (unit changes, Doppler shifts); see
to_wavenumber()forjacobian.
- classmethod concatenate(spaces)¶
The elements of
spacesone after another, e.g. kernels of a different shape for each channel.
- take(indices)¶
The elements at
indices(repeats allowed), in that order.
- derivative(order=1)¶
The
order-th derivatives of piecewise-polynomial elements (jumps excluded).
- property kind¶
- property lower¶
Lower end of each element’s support.
- property upper¶
Upper end of each element’s support.
- property centers¶
- integrals(weight=None)¶
∫ φ_i(x) w(x) dx for each element (w(x₀) for a delta at x₀).
- evaluate(x)¶
The design matrix E, E[k, j] = B_j(x_k), so that f(x) = E @ coefficients.
Operations¶
- rebasis.measure(kernels, basis, normalization='integral', weight=None)¶
The matrix W with g = W @ f the kernel responses to f = Σ_j f_j B_j.
- Parameters:
- normalization
"integral": g_i = ∫ K_i f w / ∫ K_i w, kernels are unit-area instrument responses."rowsum": each row of W sums to one; renormalizes kernels that run off the end of the basis, and gives weighted averages for a delta basis."none": plain inner products ⟨K_i, B_j⟩.- weight
See
project().
- rebasis.measure_derivative(kernels, basis, parameter, normalization='integral', weight=None)¶
The measurement matrix W and its derivative ∂W/∂p.
Row i is differentiated with respect to the parameter of kernel i alone, so for spectra f the Jacobian of the measurements g = W @ f with respect to the per-channel parameters is diagonal, with diagonal
dW @ f. For a single parameter shared by all channels (e.g. a common spectral shift) the derivative is alsodW @ f.The derivatives are exact (to rounding) derivatives of what
measure()computes, including the truncation of the kernels’ supports and the normalization.- Parameters:
- parameter
One of:
"center"(shift),"scale"(width · ∂/∂width, squeeze or stretch),"sigma","gamma","eta","power","asymmetry","half_width"; seerebasis.PARAMETERSfor which kernels have which.
- rebasis.evaluate(basis, x)¶
The matrix E with E @ f = f(x), shape (len(x), len(basis)).
- rebasis.inner_products(a, b, weight=None)¶
The matrix ⟨a_i, b_j⟩ = ∫ a_i(x) b_j(x) w(x) dx, shape (len(a), len(b)).
- rebasis.gram(a, weight=None)¶
The Gram (mass) matrix ⟨a_i, a_j⟩.
- rebasis.apply_along(matrix, f, axis=-1)¶
Applies a sparse matrix,
ProjectionorFitalongaxisoff.
- class rebasis.Projection(src, dst, weight=None)¶
L2 (Galerkin) projection of f = Σ f_j S_j onto
dst: solves ⟨G, G⟩ g = ⟨G, S⟩ f.Conserves ∫ f w whenever
dstcan represent a constant (boxes, hats, clamped B-splines covering the domain of f). For boxes it is conservative (area-weighted) regridding; onto deltas it is interpolation; onto the same space it is the identity. The map is usually dense, so it is kept factored; useto_dense()to get it as a matrix.- Parameters:
- weight
Weight of the inner product: None,
"cos_lat_deg"or"cos_lat_rad"(area weighting for latitude), or a float s for cos(s·x).
- property shape¶
- apply(f, axis=-1, bounded=False)¶
Projects
falongaxis.boundedgives the best L2 approximation within bounds that still conserves the integral (a small quadratic program, solved exactly):True/"local": each output within the range of the source coefficients it overlaps, so no new extrema or overshoot. Meaningful when coefficients are values (boxes, hats, B-splines, whose functions then also stay within the bounds)."positive": outputs >= 0.(lo, hi): outputs in [lo, hi].
- to_dense()¶
The projection matrix, shape (len(dst), len(src)).
- property cross¶
M = ⟨dst_i, src_j⟩.
- rebasis.project(src, dst, weight=None)¶
Shorthand for
Projection.
- class rebasis.Fit(kernels, model, *, normalization='integral', smoothing=0.0, penalty='derivative', order=2, weight=None)¶
Penalized least-squares fit of coefficients in
modelto data measured bykernels.Minimizes ‖W c − d‖² + λ P(c) with W = measure(kernels, model). With box kernels and a spline model this is smooth conservative upsampling (histopolation: the fitted function’s bin averages reproduce the data); with delta kernels it is a smoothing spline; with instrument line shapes it inverts
measure().- Parameters:
- smoothing
Dimensionless: λ = smoothing · tr(WᵀW) / tr(P). Needed whenever the data do not determine every coefficient (e.g. n bins and n + 2 quadratic B-splines); small values (1e-6) then pick the smoothest exact fit.
- penalty
"derivative": P = ∫ (f⁽ʳ⁾)² dx, a true smoothing spline, blind to polynomials of degree < r (needs a model of degree >= r)."difference": P = Σ (Δʳ c)², the P-spline penalty on coefficient differences; r = 0 is ridge regression.- order
- property shape¶
- property model¶
- property design¶
W = measure(kernels, model); the fit’s predicted data are
design @ c.
- apply(data, axis=-1)¶
Model coefficients fitted to
dataalongaxis.
- to_dense()¶
The linear map from data to coefficients, shape (len(model), len(kernels)).
- rebasis.fit(kernels, model, data, axis=-1, **kwargs)¶
Shorthand for
Fit(kernels, model, **kwargs).apply(data, axis).
Regridding¶
- rebasis.regrid(data, src, dst, axis=-1, *, method='project', weight=None, bounded=False, skipna=False, na_thres=0.5, **fit_options)¶
Regrids
data(coefficients insrcalongaxis) todst.- Parameters:
- method
"project": L2 projection ontodst(conservative; the default)."measure":dstelements are averaging kernels, g_i = ∫ D_i f w / ∫ D_i w."interpolate": f evaluated atdst.centers."fit":srcelements are the kernels that measured the data (e.g. bin averages) anddstis a model space; returns the model coefficients (smooth conservative upsampling with a splinedst). Extra keyword arguments go toFit.- weight
Weight of the inner products, e.g.
"cos_lat_deg"for latitude.- bounded
"project"only: the best conservative approximation within bounds, seeProjection.apply()(True/"local": no new extrema;"positive";(lo, hi)).- skipna
Treat NaN as missing: regrid the data with NaN set to 0 and divide by the regridded validity mask (outputs whose valid fraction is below
na_thresare NaN). Exact for maps that preserve constants (projection onto boxes, hats or clamped B-splines, and measure).
- rebasis.regrid_nd(data, axes, *, method='project', bounded=False, skipna=False, na_thres=0.5, **fit_options)¶
Regrids several axes:
axesmaps axis -> (src, dst) or (src, dst, weight).
- rebasis.xarray.regrid(obj, dst, *, src=None, src_kind='boxes', dst_kind='boxes', weight=None, method='project', bounded=False, skipna=False, na_thres=0.5, **fit_options)¶
Regrids a DataArray or Dataset along the dimensions in
dst.- Parameters:
- dst
dim -> target
Space, or the target coordinate values (built into a space withdst_kind). The new coordinate is the target space’s centers.- src
dim -> source
Space. Missing dims are built from the existing coordinate withsrc_kind:"boxes"(values are cell averages, edges halfway between coordinates) or"hats"(values are point samples). A decreasing coordinate is sorted first.- weight
dim -> weight, e.g.
{"lat": "cos_lat_deg"}for area-weighted regridding.- method, bounded, skipna, na_thres, fit_options
As in
rebasis.regrid().- Data variables without any of the regridded dimensions are left untouched; other
- coordinates along a regridded dimension are dropped. The computation is eager.
Estimation¶
- rebasis.optimal_estimate(values, coords, targets, covariance, *, noise, mean='estimate', target_weight=None, weights=True, full_covariance=False, neighborhood=None)¶
Optimal (kriging) estimates of grid averages from irregular observations.
- Parameters:
- values
The n observations, or an (n, k) array of k sets of values at the same observations (e.g. one column per altitude). Columns sharing the same valid (finite) observations and noise share one factorization; NaN marks an invalid observation in a column.
- coords
For each dimension of
covariance: the n observation coordinates (point observations), or aSpaceof n elements (each observation an average over its element, e.g. a footprint or a time window).- targets
For each dimension, a
Spaceof target elements; the targets are their tensor product (e.g.{"lat": Space.boxes(lat_edges), "lon": Space.boxes([0, 360]), "time": Space.boxes(month_edges)}for monthly zonal means).- covariance
The prior
Covariance, or a sum of them (CovarianceSum).- noise
Observation error variances: a scalar, one per observation (n,), or (n, k).
- mean
"estimate"(default): an unknown constant, estimated by generalized least squares (ordinary kriging); every row of the weights then sums to 1, so a constant field is reproduced exactly however it is sampled. A dict{dim: Space}: a tensor-product mean with unconstrained coefficients (universal kriging). A list ofMeanTerm(and dicts): a sum of terms, each unconstrained or with a Gaussian prior that shrinks coefficients the data do not determine. Or a known value.- target_weight
Per dimension, a weight for the target averages, e.g.
{"lat": "cos_lat_deg"}.- weights, full_covariance
Also return the weights and the posterior covariance of the targets.
- neighborhood
Estimate locally: dimension name -> half width. Targets are grouped into blocks by their elements along these dimensions (e.g.
{"lat": 20, "time": 15}makes each latitude band × month a block), and each block uses only the observations whose support lies within the half width of its targets (periodic dimensions wrap). The cost then grows with the size of a neighbourhood, not of the whole data set. Mean bases that vanish on a block’s observations and targets are dropped there, so a global basis can be given; a block without observations is NaN. Not available withfull_covariance; the log likelihood and mean coefficients, which differ per block, are NaN and None.
Notes
Cost: the n × n observation covariance is formed once and factored once per group of columns with the same valid observations (O(n³)); the posterior variances need one solve per target (O(n² m)). Thousands to a few tens of thousands of observations per estimate are practical.
- class rebasis.Estimate(values, std, prior_std, mean, log_likelihood, dims, mean_coefficients=None, covariance=None, weights=None, offset=None, n_used=None)¶
The result of
optimal_estimate(). Arrays have the shape of the target grid, with a trailing axis of length k whenvalueshad k columns.- values¶
The estimates ĝ.
- std¶
Their posterior standard deviations (including the uncertainty of the mean).
- prior_std¶
The prior standard deviations of the targets (from the covariance and the mean terms with finite priors), for comparison with
std.
- mean¶
The estimated constant mean β when the mean is a single unconstrained constant (one per column), the known mean if one was given, otherwise NaN; see
mean_coefficients.
- log_likelihood¶
log p(y | covariance), one per column; restricted (REML, in Harville’s basis-independent form) over the unconstrained mean terms. Maximize it over the covariance parameters to fit them.
- dims¶
- mean_coefficients = None¶
The estimated coefficients of the unconstrained mean terms, shape (P,) or (P, k).
- covariance = None¶
The posterior covariance of the flattened targets, if requested: (m, m), or (k, m, m) when columns have different valid observations.
- weights = None¶
W, with ĝ = W y + offset: (m, n), or (k, m, n) when columns have different valid observations (zero weight on invalid ones). Row m is target m’s averaging kernel over the observations; it sums to 1 when the mean has an unconstrained constant.
- offset = None¶
- n_used = None¶
The number of (valid) observations each estimate used: all valid ones, or those in its neighbourhood.
- apply(values)¶
The same estimator applied to other values at the same observations (shape (n,) or (n, k)), e.g. a model field sampled like the data: comparing that with the model’s true averages measures the sampling error.
- weight_histogram(coord, edges)¶
Σ of each target’s weights over the observations whose coordinate
coord(one value per observation) falls in each bin ofedges: how the estimate draws on, e.g., each day of the month. Shape: target grid (+ k) + (len(edges) − 1,).
- class rebasis.Covariance(variance, **dims)¶
A separable prior covariance σ² Π_d c_d(x_d − x’_d), one
CovarianceDimper named dimension, e.g.Covariance(4.0, lat=CovarianceDim("squared_exponential", 10.0), ...). The keyword order fixes the order of the dimensions.- property names¶
- replace(variance=None, **dims)¶
A copy with some parameters changed (for fitting them).
- matrix(a, b, symmetric=False)¶
- diagonal(a)¶
- class rebasis.CovarianceDim(family, length, period=None, variance_profile=None)¶
The correlation function along one dimension.
- Parameters:
- family
"squared_exponential"(very smooth fields), or the rougher Matérn family:"exponential"(Matérn ½),"matern32","matern52".- length
The correlation length ℓ, in the units of the coordinate.
- period
For periodic coordinates such as longitude (e.g. 360): correlations wrap around.
- variance_profile
A
VarianceProfiles: the covariance along this dimension becomes s(x) s(x’) ρ(x − x’), e.g. a variability that peaks at the polar vortex edge.
- family¶
- length¶
- period = None¶
- variance_profile = None¶
- class rebasis.CovarianceSum(*components)¶
A sum of separable covariances over the same dimensions, e.g. a small-scale and a large-scale component:
Covariance(...) + Covariance(...). Each component is computed exactly; the sum is not separable.- property names¶
- matrix(a, b, symmetric=False)¶
- diagonal(a)¶
- class rebasis.VarianceProfile(basis, coefficients)¶
A variance that varies along a dimension: s(x) = Σ_i c_i B_i(x), so that the covariance along it is s(x) s(x’) ρ(x − x’). With B-spline bases and positive coefficients s stays positive. The basis must cover every coordinate it is used at (s is 0 outside it).
- basis¶
- coefficients¶
- class rebasis.MeanTerm(bases, prior_std=inf)¶
One term of a structured mean: a tensor product of spaces, constant along dimensions not given (
{}is a constant).- Parameters:
- bases
Dimension name ->
Space.- prior_std
The prior standard deviation of the term’s coefficients (a scalar, or one per coefficient).
inf(the default) leaves them unconstrained: estimated by generalized least squares, and reproduced exactly however the data are sampled. A finite value is a zero-mean Gaussian prior that shrinks coefficients the data do not determine, e.g. a drift through the month where only part of it was sampled, or latitude structure beyond the data. Useinfrather than a huge finite value for “unconstrained”: a finite prior enters the covariance, and one far larger than the field’s variance costs precision in its factorization.
- bases¶
- prior_std = inf¶
- rebasis.log_likelihood(values, coords, covariance, *, noise, mean='estimate')¶
log p(y | covariance) without computing any targets; see
Estimate.log_likelihood. Cheap enough to maximize over the covariance parameters withscipy.optimize.valuesmay have k columns (one likelihood each).
- rebasis.fit_covariance(values, coords, covariance, *, noise, mean='estimate', nugget=None, fit_nugget=True, fixed=frozenset({}), bounds=None, subsample=None, seed=0, maxiter=200)¶
Fit the covariance (and the mean’s prior widths and a nugget) to data by maximizing the restricted log likelihood, with analytic gradients.
The parameters, named as in
CovarianceFit.parameters, are fitted in log space:varianceandlength.<dim>of the covariance (<i>.varianceand<i>.length.<dim>for component i of aCovarianceSum), starting from the values incovariance; families and periods are kept;mean.<i>.prior_stdfor everyMeanTermwith a finite prior: a common factor on its prior standard deviations, reported as the fitted value (the largest when they vary);nugget: a variance added tonoisefor variability the covariance does not resolve, starting fromnuggetor 1 % of the data variance (withfit_nugget).
- Parameters:
- values, coords, noise, mean
As in
optimal_estimate()(one column of values; invalid values are dropped).- fixed
Names of parameters to keep at their initial values.
- bounds
Name -> (lo, hi) in natural units. Defaults: variances 1e-4 to 1e4 times their initial values, lengths 1e-2 to 1e2 times, prior widths 1e-4 to 1e4 times, the nugget 1e-10 to 10 times the data variance.
- subsample
Fit on at most this many randomly chosen observations: each likelihood evaluation costs O(n³), and a few thousand observations usually determine the parameters well.
- class rebasis.CovarianceFit(covariance, mean, nugget, log_likelihood, parameters, success, message, n_iterations, n_used, history=<factory>)¶
The result of
fit_covariance().- covariance¶
The fitted covariance.
- mean¶
The mean specification with fitted prior standard deviations, for
optimal_estimate().
- nugget¶
The fitted variance added to the given noise (0 if not fitted).
- log_likelihood¶
The maximized log likelihood (of the data used, e.g. the subsample).
- parameters¶
Every parameter by name, in natural units.
- success¶
- message¶
- n_iterations¶
- n_used¶
The number of observations used (after dropping invalid ones and subsampling).
- history¶
- estimate(values, coords, targets, *, noise, **kwargs)¶
optimal_estimate()with the fitted covariance, mean and nugget.
With xarray¶
- rebasis.xarray.optimal_estimate(obj, targets, covariance, *, noise, coords=None, obs_dim=None, var=None, epoch='1970-01-01', time_unit='D', return_estimate=False, **kwargs)¶
rebasis.optimal_estimate()for observations stored along one dimension of an xarray object, e.g. a Dataset of satellite profiles(time, altitude)with latitude and longitude variables alongtime.- Parameters:
- obj
A DataArray of values, or a Dataset with the values in variable
var. Every dimension of the values other thanobs_dim(e.g. altitude) is estimated independently, in one call: it becomes a column of values.- targets
For each dimension of the covariance: a
Space, or the edges of boxes (bin averages), as datetimes for a datetime coordinate.- covariance
A
CovarianceorCovarianceSum, or aCovarianceFit, whose covariance, mean (unlessmeanis given) and nugget are used.- noise
Observation error variances: a scalar, a DataArray (broadcast against the values), or the name of a variable or coordinate of
obj.- coords
Covariance dimension -> the name of the variable or coordinate holding the observations’ coordinate (by default the dimension’s own name), or the coordinate values, or a
Spaceof n elements (observations that are averages, e.g. over a footprint).- obs_dim
The dimension along which the observations lie; inferred from the coordinates.
- epoch, time_unit
Datetime coordinates and targets become floats with
numeric_time(): covariance lengths, periods, neighbourhood widths and mean bases along them are in these units (days by default).- return_estimate
Also return the
Estimate(for its weights,applyandweight_histogram).- kwargs
Passed to
rebasis.optimal_estimate():mean,target_weight,neighborhood,weights,full_covariance.
- Returns:
- xarray.Dataset
With the covariance’s dimensions (coordinates: the target centers, and their supports as
<dim>_bounds) followed by the other dimensions of the values, and variables<name>(the values’ name, or"estimate"): the estimates;<name>_std: their posterior standard deviations;prior_std: the prior standard deviations of the targets;n_used: the number of valid observations each estimate used;log_likelihood, andconstant_meanwhen the mean is a single estimated or known constant: one per column.
- rebasis.xarray.fit_covariance(obj, covariance, *, noise, coords=None, obs_dim=None, var=None, epoch='1970-01-01', time_unit='D', **kwargs)¶
rebasis.fit_covariance()for observations stored along one dimension of an xarray object. The values must have only that dimension (select e.g. one altitude first).obj,noise,coords,obs_dim,var,epochandtime_unitare as inoptimal_estimate();kwargsare passed torebasis.fit_covariance(). The result can be passed as the covariance ofoptimal_estimate().
- rebasis.xarray.numeric_time(times, epoch='1970-01-01', unit='D')¶
Datetimes as floats: the time since
epochin units ofunit(a numpy timedelta unit, e.g."D"for days or"h"for hours).optimal_estimate()andfit_covariance()convert datetime coordinates this way, so covariance lengths, periods, neighbourhood widths and mean bases along a time dimension are in these units; use this function to build such a basis, e.g.Space.hats(numeric_time(month_edges)).
Errors and constants¶
- exception rebasis.SingularError¶
- rebasis.FWHM_PER_SIGMA¶
Convert a string or number to a floating point number, if possible.
- rebasis.faddeeva_re(x, y)¶
Re w(x + iy) for y >= 0, w the Faddeeva function.