harmonica.EQLHarmonicSpherical

class harmonica.EQLHarmonicSpherical(damping=None, points=None, relative_depth=500, parallel=True)[source]

DEPRECATED, use harmonica.EquivalentSourcesSph instead.

This class exists to support backward compatibility until next release.

Methods Summary

EQLHarmonicSpherical.filter(coordinates, data)

Filter the data through the gridder and produce residuals.

EQLHarmonicSpherical.fit(coordinates, data)

Fit the coefficients of the equivalent sources.

EQLHarmonicSpherical.get_params([deep])

Get parameters for this estimator.

EQLHarmonicSpherical.grid(upward[, region, …])

Interpolate the data onto a regular grid.

EQLHarmonicSpherical.jacobian(coordinates, …)

Make the Jacobian matrix for the equivalent sources.

EQLHarmonicSpherical.predict(coordinates)

Evaluate the estimated equivalent sources on the given set of points.

EQLHarmonicSpherical.profile(point1, point2, …)

EQLHarmonicSpherical.scatter([region, size, …])

EQLHarmonicSpherical.score(coordinates, data)

Score the gridder predictions against the given data.

EQLHarmonicSpherical.set_params(**params)

Set the parameters of this estimator.


EQLHarmonicSpherical.filter(coordinates, data, weights=None)

Filter the data through the gridder and produce residuals.

Calls fit on the data, evaluates the residuals (data - predicted data), and returns the coordinates, residuals, and weights.

No very useful by itself but this interface makes gridders compatible with other processing operations and is used by verde.Chain to join them together (for example, so you can fit a spline on the residuals of a trend).

Parameters
  • coordinates (tuple of arrays) – Arrays with the coordinates of each data point. Should be in the following order: (easting, northing, vertical, …). For the specific definition of coordinate systems and what these names mean, see the class docstring.

  • data (array or tuple of arrays) – The data values of each data point. If the data has more than one component, data must be a tuple of arrays (one for each component).

  • weights (None or array or tuple of arrays) – If not None, then the weights assigned to each data point. If more than one data component is provided, you must provide a weights array for each data component (if not None).

Returns

coordinates, residuals, weights – The coordinates and weights are same as the input. Residuals are the input data minus the predicted data.

EQLHarmonicSpherical.fit(coordinates, data, weights=None)

Fit the coefficients of the equivalent sources.

The data region is captured and used as default for the grid method.

All input arrays must have the same shape.

Parameters
  • coordinates (tuple of arrays) – Arrays with the coordinates of each data point. Should be in the following order: (longitude, latitude, radius, …). Only longitude, latitude, and radius will be used, all subsequent coordinates will be ignored.

  • data (array) – The data values of each data point.

  • weights (None or array) – If not None, then the weights assigned to each data point. Typically, this should be 1 over the data uncertainty squared.

Returns

self – Returns this estimator instance for chaining operations.

EQLHarmonicSpherical.get_params(deep=True)

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params (dict) – Parameter names mapped to their values.

EQLHarmonicSpherical.grid(upward, region=None, shape=None, spacing=None, dims=None, data_names=None, **kwargs)

Interpolate the data onto a regular grid.

The grid can be specified by either the number of points in each dimension (the shape) or by the grid node spacing. See verde.grid_coordinates for details. All grid points will be located at the same upward coordinate. Other arguments for verde.grid_coordinates can be passed as extra keyword arguments (kwargs) to this method.

If the interpolator collected the input data region, then it will be used if region=None. Otherwise, you must specify the grid region. Use the dims and data_names arguments to set custom names for the dimensions and the data field(s) in the output xarray.Dataset. Default names will be provided if none are given.

Parameters
  • upward (float) – Upward coordinate of the grid points.

  • region (list = [W, E, S, N]) – The west, east, south, and north boundaries of a given region.

  • shape (tuple = (n_north, n_east) or None) – The number of points in the South-North and West-East directions, respectively.

  • spacing (tuple = (s_north, s_east) or None) – The grid spacing in the South-North and West-East directions, respectively.

  • dims (list or None) – The names of the northing and easting data dimensions, respectively, in the output grid. Default is determined from the dims attribute of the class. Must be defined in the following order: northing dimension, easting dimension. NOTE: This is an exception to the “easting” then “northing” pattern but is required for compatibility with xarray.

  • data_names (list of None) – The name(s) of the data variables in the output grid. Defaults to ['scalars'].

Returns

grid (xarray.Dataset) – The interpolated grid. Metadata about the interpolator is written to the attrs attribute.

EQLHarmonicSpherical.jacobian(coordinates, points, dtype='float64')

Make the Jacobian matrix for the equivalent sources.

Each column of the Jacobian is the Green’s function for a single point source evaluated on all observation points.

Parameters
  • coordinates (tuple of arrays) – Arrays with the coordinates of each data point. Should be in the following order: (longitude, latitude, radius, …). Only longitude, latitude and radius will be used, all subsequent coordinates will be ignored.

  • points (tuple of arrays) – Tuple of arrays containing the coordinates of the equivalent point sources in the following order: (longitude, latitude, radius).

  • dtype (str or numpy dtype) – The type of the Jacobian array.

Returns

jacobian (2D array) – The (n_data, n_points) Jacobian matrix.

EQLHarmonicSpherical.predict(coordinates)

Evaluate the estimated equivalent sources on the given set of points.

Requires a fitted estimator (see fit).

Parameters

coordinates (tuple of arrays) – Arrays with the coordinates of each data point. Should be in the following order: (longitude, latitude, radius, …). Only longitude, latitude and radius will be used, all subsequent coordinates will be ignored.

Returns

data (array) – The data values evaluated on the given points.

EQLHarmonicSpherical.profile(point1, point2, size, dims=None, data_names=None, projection=None, **kwargs)

Warning

Not implemented method. The profile on spherical coordinates should be done using great-circle distances through the Haversine formula.

EQLHarmonicSpherical.scatter(region=None, size=None, random_state=None, dims=None, data_names=None, projection=None, **kwargs)

Warning

Not implemented method. The scatter method will be deprecated on Verde v2.0.0.

EQLHarmonicSpherical.score(coordinates, data, weights=None)

Score the gridder predictions against the given data.

Calculates the R^2 coefficient of determination of between the predicted values and the given data values. A maximum score of 1 means a perfect fit. The score can be negative.

If the data has more than 1 component, the scores of each component will be averaged.

Parameters
  • coordinates (tuple of arrays) – Arrays with the coordinates of each data point. Should be in the following order: (easting, northing, vertical, …). For the specific definition of coordinate systems and what these names mean, see the class docstring.

  • data (array or tuple of arrays) – The data values of each data point. If the data has more than one component, data must be a tuple of arrays (one for each component).

  • weights (None or array or tuple of arrays) – If not None, then the weights assigned to each data point. If more than one data component is provided, you must provide a weights array for each data component (if not None).

Returns

score (float) – The R^2 score

EQLHarmonicSpherical.set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self (estimator instance) – Estimator instance.