podpac.interpolators.Interpolate

class podpac.interpolators.Interpolate(**kwargs: Any)[source]

Bases: Node

Node to used to interpolate from self.source.coordinates to the user-specified, evaluated coordinates.

Parameters:
  • source (Any) – The source node which will be interpolated

  • interpolation (str, dict, optional) –

    Interpolation definition for the data source. By default, the interpolation method is set to podpac.settings[“DEFAULT_INTERPOLATION”] which defaults to 'nearest' for all dimensions.

    If input is a string, it must match one of the interpolation shortcuts defined in

    podpac.data.INTERPOLATION_SHORTCUTS. The interpolation method associated with this string will be applied to all dimensions at the same time.

    If input is a dict or list of dict, the dict or dict elements must adhere to the following format:

    The key 'method' defining the interpolation method name. If the interpolation method is not one of podpac.data.INTERPOLATION_SHORTCUTS, a second key 'interpolators' must be defined with a list of podpac.interpolators.Interpolator classes to use in order of uages. The dictionary may contain an option 'params' key which contains a dict of parameters to pass along to the podpac.interpolators.Interpolator classes associated with the interpolation method.

    The dict may contain the key 'dims' which specifies dimension names (i.e. 'time' or ('lat', 'lon') ). If the dictionary does not contain a key for all unstacked dimensions of the source coordinates, the podpac.data.INTERPOLATION_DEFAULT value will be used. All dimension keys must be unstacked even if the underlying coordinate dimensions are stacked. Any extra dimensions included but not found in the source coordinates will be ignored.

    The dict may contain a key 'params' that can be used to configure the podpac.interpolators.Interpolator classes associated with the interpolation method.

    If input is a podpac.data.Interpolation class, this Interpolation class will be used without modification.

  • cache_output (bool) – Should the node’s output be cached? If not provided or None, uses default based on settings[“CACHE_DATASOURCE_OUTPUT_DEFAULT”]. If True, outputs will be cached and retrieved from cache. If False, outputs will not be cached OR retrieved from cache (even if they exist in cache).

Examples

# To use bilinear interpolation for [lat,lon] a specific interpolator for [time], and the default for [alt], use: >>> interp_node = Interpolation(

source=some_node, interpolation=interpolation = [

{ ‘method’: ‘bilinear’, ‘dims’: [‘lat’, ‘lon’] }, { ‘method’: [podpac.interpolators.NearestNeighbor], ‘dims’: [‘time’] }

]

)

Alternative Constructors

from_definition(definition)

Create podpac Node from a dictionary definition.

from_json(s)

Create podpac Node from a JSON definition.

Methods

__init__(**kwargs)

Do not overwrite me

create_output_array(coords[, data, attrs, ...])

Initialize an output data array

eval(coordinates, **kwargs)

Evaluate the node at the given coordinates.

eval_group(group)

Evaluate the node for each of the coordinates in the group.

find_coordinates()

Get the available coordinates for the Node.

from_name_params(name[, params])

Create podpac Node from a WMS/WCS request.

from_url(url)

Create podpac Node from a WMS/WCS request.

get_bounds([crs])

Get the full available coordinate bounds for the Node.

get_cache(key[, coordinates])

Get cached data for this node.

get_ui_spec([help_as_html])

Get spec of node attributes for building a ui

has_cache(key[, coordinates])

Check for cached data for this node.

init()

Overwrite this method if a node needs to do any additional initialization after the standard initialization.

load(path)

Create podpac Node from file.

probe([lat, lon, time, alt, crs])

Evaluates every part of a node / pipeline at a point and records which nodes are actively being used.

put_cache(data, key[, coordinates, expires, ...])

Cache data for this node.

rem_cache(key[, coordinates, mode])

Clear cached data for this node.

save(path)

Write node to file.

trait_defaults(*names, **metadata)

Return a trait's default value or a dictionary of them

trait_has_value(name)

Returns True if the specified trait has a value.

trait_is_defined(name)

trait_values(**metadata)

A dict of trait names and their values.

Attributes

attrs

List of node attributes

base_ref

Default reference/name in node definitions

cache_ctrl

A trait whose value must be an instance of a specified class.

cache_output

A boolean (True, False) trait.

definition

dtype

An enum whose value must be in a given sequence.

force_eval

A boolean (True, False) trait.

hash

interpolation

interpolation_class

Get the interpolation class currently set for this data source.

interpolators

Return the interpolators selected for the previous node evaluation interpolation.

json

Definition for this node in JSON format.

json_pretty

Definition for this node in JSON format, with indentation suitable for display.

output

A trait for unicode strings.

outputs

An instance of a Python list.

source

source_id

A trait for unicode strings.

style

A trait whose value must be an instance of a specified class.

units

A trait for unicode strings.

Members:

__init__(**kwargs)

Do not overwrite me

cache_output

A boolean (True, False) trait.

find_coordinates()[source]

Get the available coordinates for the Node. For a DataSource, this is just the coordinates.

Returns:

coords_list – singleton list containing the coordinates (Coordinates object)

Return type:

list

get_bounds(crs='default')[source]

Get the full available coordinate bounds for the Node.

Parameters:

crs (str) – Desired CRS for the bounds. Use ‘source’ to use the native source crs. If not specified, the default CRS in the podpac settings is used. Optional.

Returns:

  • bounds (dict) – Bounds for each dimension. Keys are dimension names and values are tuples (hi, lo).

  • crs (str) – The crs for the bounds.

interpolation
property interpolation_class

Get the interpolation class currently set for this data source.

The DataSource interpolation property is used to define the podpac.data.InterpolationManager class that will handle interpolation for requested coordinates.

Returns:

InterpolationManager class defined by DataSource interpolation definition

Return type:

podpac.data.InterpolationManager

property interpolators

Return the interpolators selected for the previous node evaluation interpolation. If the node has not been evaluated, or if interpolation was not necessary, this will return an empty OrderedDict

Returns:

Key are tuple of unstacked dimensions, the value is the interpolator used to interpolate these dimensions

Return type:

OrderedDict

source
source_id

A trait for unicode strings.