geoviews.data package#
Submodules#
- geoviews.data.geom_dict module
- geoviews.data.geopandas module
GeoPandasInterfaceGeoPandasInterface.add_dimension()GeoPandasInterface.applies()GeoPandasInterface.dtype()GeoPandasInterface.has_holes()GeoPandasInterface.holes()GeoPandasInterface.iloc()GeoPandasInterface.isscalar()GeoPandasInterface.length()GeoPandasInterface.loaded()GeoPandasInterface.nonzero()GeoPandasInterface.range()GeoPandasInterface.redim()GeoPandasInterface.reindex()GeoPandasInterface.select()GeoPandasInterface.select_mask()GeoPandasInterface.shape()GeoPandasInterface.split()GeoPandasInterface.validate()GeoPandasInterface.values()
from_multi()get_geom_type()to_geopandas()
- geoviews.data.iris module
CubeInterfaceCubeInterface.add_dimension()CubeInterface.aggregate()CubeInterface.applies()CubeInterface.assign()CubeInterface.concat_dim()CubeInterface.coords()CubeInterface.dtype()CubeInterface.groupby()CubeInterface.irregular()CubeInterface.length()CubeInterface.loaded()CubeInterface.range()CubeInterface.redim()CubeInterface.reindex()CubeInterface.sample()CubeInterface.select()CubeInterface.select_to_constraint()CubeInterface.shape()CubeInterface.sort()CubeInterface.validate()CubeInterface.values()
coord_to_dimension()sort_coords()
Module contents#
- class geoviews.data.CubeInterface(*, name)[source]#
Bases:
GridInterfaceThe CubeInterface provides allows HoloViews to interact with iris Cube data. When passing an iris Cube to a HoloViews Element the init method will infer the dimensions of the Cube from its coordinates. Currently the interface only provides the basic methods required for HoloViews to work with an object.
Methods
add_dimension(columns, dimension, dim_pos, ...)Adding value dimensions not currently supported by iris interface.
aggregate(columns, kdims, function, **kwargs)Aggregation currently not implemented.
applies(obj)Indicates whether the interface is designed specifically to handle the supplied object's type.
assign(dataset, new_data)Adds a dictionary containing data for multiple new dimensions to a copy of the dataset.data.
concat_dim(datasets, dim, vdims)Concatenates datasets along one dimension.
coords(dataset, dim[, ordered, expanded])Returns the coordinates along a dimension.
dtype(dataset, dimension)Returns the dtype for the selected dimension.
groupby(dataset, dims[, container_type, ...])Groups the data by one or more dimensions returning a container indexed by the grouped dimensions containing slices of the cube wrapped in the group_type.
irregular(dataset, dim)CubeInterface does not support irregular data
length(dataset)Returns the total number of samples in the dataset.
loaded()Indicates whether the required dependencies are loaded.
range(dataset, dimension)Computes the range along a particular dimension.
redim(dataset, dimensions)Rename coords on the Cube.
reindex(dataset[, kdims, vdims])Reindexes data given new key and value dimensions.
sample(dataset[, samples])Sampling currently not implemented.
select(dataset[, selection_mask])Apply a selection to the data.
select_to_constraint(dataset, selection)Transform a selection dictionary to an iris Constraint.
shape(dataset[, gridded])Returns the shape of the data.
sort(columns[, by, reverse])Cubes are assumed to be sorted by default.
validate(dataset[, vdims])Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.
values(dataset, dim[, expanded, flat, ...])Returns an array of the values along the supplied dimension.
init
mask
packed
Parameter Definitions
- classmethod add_dimension(columns, dimension, dim_pos, values, vdim)[source]#
Adding value dimensions not currently supported by iris interface.
Adding key dimensions not possible on dense interfaces.
- classmethod aggregate(columns, kdims, function, **kwargs)[source]#
Aggregation currently not implemented.
- classmethod applies(obj)[source]#
Indicates whether the interface is designed specifically to handle the supplied object’s type. By default simply checks if the object is one of the types declared on the class, however if the type is expensive to import at load time the method may be overridden.
- classmethod assign(dataset, new_data)[source]#
Adds a dictionary containing data for multiple new dimensions to a copy of the dataset.data.
- Parameters:
- dataset
Dataset The Dataset to add the dimension to
- new_data
python:dict Dictionary containing new data to add to the Dataset
- dataset
- Returns:
dataA copy of the data with the new data dimensions added
- classmethod coords(dataset, dim, ordered=False, expanded=False)[source]#
Returns the coordinates along a dimension. Ordered ensures coordinates are in ascending order and expanded creates ND-array matching the dimensionality of the dataset.
- classmethod dtype(dataset, dimension)[source]#
Returns the dtype for the selected dimension.
- Parameters:
- dataset
Dataset The dataset to query
- dimension
python:strorDimension Dimension to return the dtype for
- dataset
- Returns:
numpy.dtypeThe dtype of the selected dimension
- classmethod groupby(dataset, dims, container_type=<class 'holoviews.core.spaces.HoloMap'>, group_type=None, **kwargs)[source]#
Groups the data by one or more dimensions returning a container indexed by the grouped dimensions containing slices of the cube wrapped in the group_type. This makes it very easy to break up a high-dimensional dataset into smaller viewable chunks.
- classmethod reindex(dataset, kdims=None, vdims=None)[source]#
Reindexes data given new key and value dimensions.
- classmethod select(dataset, selection_mask=None, **selection)[source]#
Apply a selection to the data.
- classmethod select_to_constraint(dataset, selection)[source]#
Transform a selection dictionary to an iris Constraint.
- classmethod shape(dataset, gridded=False)[source]#
Returns the shape of the data.
- Parameters:
- dataset
Dataset The dataset to get the shape from
- dataset
- Returns:
python:tuple[python:int,python:int]The shape of the data (rows, cols)
- classmethod sort(columns, by=None, reverse=False)[source]#
Cubes are assumed to be sorted by default.
- class geoviews.data.GeoPandasInterface(*, name)[source]#
Bases:
PandasAPI,MultiInterfaceMethods
add_dimension(dataset, dimension, dim_pos, ...)Returns a copy of the data with the dimension values added.
applies(obj)Indicates whether the interface is designed specifically to handle the supplied object's type.
dtype(dataset, dimension)Returns the dtype for the selected dimension.
has_holes(dataset)Whether the Dataset contains geometries with holes.
holes(dataset)Returns a list of lists of arrays containing the holes for each geometry in the Dataset.
iloc(dataset, index)Implements integer indexing on the rows and columns of the data.
isscalar(dataset, dim[, per_geom])Tests if dimension is scalar in each subpath.
length(dataset)Returns the length of the multi-tabular dataset making it appear like a single array of concatenated subpaths separated by NaN values.
loaded()Indicates whether the required dependencies are loaded.
nonzero(dataset)Returns a boolean indicating whether the Dataset contains any data.
range(dataset, dim)Computes the minimum and maximum value along a dimension.
redim(dataset, dimensions)Renames dimensions in the data.
reindex(dataset[, kdims, vdims])Reindexes data given new key and value dimensions.
select(dataset[, selection_mask])Applies selectiong on all the subpaths.
select_mask(dataset, selection)Given a Dataset object and a dictionary with dimension keys and selection keys (i.e. tuple ranges, slices, sets, lists, or literals) return a boolean mask over the rows in the Dataset object that have been selected.
shape(dataset)Returns the shape of all subpaths, making it appear like a single array of concatenated subpaths separated by NaN values.
split(dataset, start, end, datatype, **kwargs)Splits a multi-interface Dataset into regular Datasets using regular tabular interfaces.
validate(dataset[, vdims])Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.
values(dataset, dimension[, expanded, flat, ...])Returns a single concatenated array of all subpaths separated by NaN values.
aggregate
dimension_type
geo_column
geom_dims
groupby
init
sample
shape_mask
sort
Parameter Definitions
- classmethod add_dimension(dataset, dimension, dim_pos, values, vdim)[source]#
Returns a copy of the data with the dimension values added.
- Parameters:
- dataset
Dataset The Dataset to add the dimension to
- dimension
Dimension The dimension to add
- dim_pos
python:int The position in the data to add it to
- valuesnumpy:array_like
The array of values to add
- vdimbool
Whether the data is a value dimension
- dataset
- Returns:
dataA copy of the data with the new dimension
- classmethod applies(obj)[source]#
Indicates whether the interface is designed specifically to handle the supplied object’s type. By default simply checks if the object is one of the types declared on the class, however if the type is expensive to import at load time the method may be overridden.
- classmethod dtype(dataset, dimension)[source]#
Returns the dtype for the selected dimension.
- Parameters:
- dataset
Dataset The dataset to query
- dimension
python:strorDimension Dimension to return the dtype for
- dataset
- Returns:
numpy.dtypeThe dtype of the selected dimension
- classmethod has_holes(dataset)[source]#
Whether the Dataset contains geometries with holes.
- Parameters:
- dataset
Dataset The dataset to check
- dataset
- Returns:
- bool
Whether the Dataset contains geometries with holes
Notes
Only meaningful to implement on Interfaces that support geometry data.
- classmethod holes(dataset)[source]#
Returns a list of lists of arrays containing the holes for each geometry in the Dataset.
- Parameters:
- dataset
Dataset The dataset to extract holes from
- dataset
- Returns:
python:list[python:list[np.ndarray]]List of list of arrays representing geometry holes
Notes
Only meaningful to implement on Interfaces that support geometry data.
- classmethod iloc(dataset, index)[source]#
Implements integer indexing on the rows and columns of the data.
- Parameters:
- dataset
Dataset The dataset to apply the indexing operation on
- index
python:tupleorpython:int Index specification (row_index, col_index) or row_index
- dataset
- Returns:
dataIndexed data
Notes
Only implement for tabular interfaces.
- classmethod isscalar(dataset, dim, per_geom=False)[source]#
Tests if dimension is scalar in each subpath.
- classmethod length(dataset)[source]#
Returns the length of the multi-tabular dataset making it appear like a single array of concatenated subpaths separated by NaN values.
- classmethod nonzero(dataset)[source]#
Returns a boolean indicating whether the Dataset contains any data.
- Parameters:
- dataset
Dataset The dataset to check
- dataset
- Returns:
- bool
Whether the dataset is not empty
- classmethod range(dataset, dim)[source]#
Computes the minimum and maximum value along a dimension.
- Parameters:
- dataset
Dataset The dataset to query
- dimension
python:strorDimension Dimension to compute the range on
- dataset
- Returns:
python:tuple[Any,Any]Tuple of (min, max) values
Notes
In the past categorical and string columns were handled by sorting the values and taking the first and last value. This behavior is deprecated and will be removed in 2.0. In future the range for these columns will be returned as (None, None).
- classmethod redim(dataset, dimensions)[source]#
Renames dimensions in the data.
- Parameters:
- dataset
Dataset The dataset to transform
- dimensions
python:dict[python:str,python:str] Dictionary mapping from old to new dimension names
- dataset
- Returns:
dataData after the dimension names have been transformed
Notes
Only meaningful for data formats that store dimension names.
- classmethod reindex(dataset, kdims=None, vdims=None)[source]#
Reindexes data given new key and value dimensions.
- classmethod select(dataset, selection_mask=None, **selection)[source]#
Applies selectiong on all the subpaths.
- classmethod select_mask(dataset, selection)[source]#
Given a Dataset object and a dictionary with dimension keys and selection keys (i.e. tuple ranges, slices, sets, lists, or literals) return a boolean mask over the rows in the Dataset object that have been selected.
- Parameters:
- dataset
Dataset The dataset to select from
- selection
python:dict Dictionary containing selections for each column
- dataset
- Returns:
ndarrayofboolBoolean array representing the selection mask
- classmethod shape(dataset)[source]#
Returns the shape of all subpaths, making it appear like a single array of concatenated subpaths separated by NaN values.
- classmethod split(dataset, start, end, datatype, **kwargs)[source]#
Splits a multi-interface Dataset into regular Datasets using regular tabular interfaces.
- class geoviews.data.GeomDictInterface(*, name)[source]#
Bases:
DictInterfaceMethods
applies(obj)Indicates whether the interface is designed specifically to handle the supplied object's type.
dtype(dataset, dimension)Returns the dtype for the selected dimension.
has_holes(dataset)Whether the Dataset contains geometries with holes.
holes(dataset)Returns a list of lists of arrays containing the holes for each geometry in the Dataset.
iloc(dataset, index)Implements integer indexing on the rows and columns of the data.
length(dataset)Returns the number of rows in the Dataset.
range(dataset, dim)Computes the minimum and maximum value along a dimension.
shape(dataset)Returns the shape of the data.
validate(dataset, validate_vdims)Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.
values(dataset, dim[, expanded, flat, ...])Returns the values along a dimension of the dataset.
aggregate
concat
dimension_type
geo_column
geom_dims
geom_type
init
sample
select
shape_mask
Parameter Definitions
- classmethod applies(obj)[source]#
Indicates whether the interface is designed specifically to handle the supplied object’s type. By default simply checks if the object is one of the types declared on the class, however if the type is expensive to import at load time the method may be overridden.
- classmethod dtype(dataset, dimension)[source]#
Returns the dtype for the selected dimension.
- Parameters:
- dataset
Dataset The dataset to query
- dimension
python:strorDimension Dimension to return the dtype for
- dataset
- Returns:
numpy.dtypeThe dtype of the selected dimension
- classmethod has_holes(dataset)[source]#
Whether the Dataset contains geometries with holes.
- Parameters:
- dataset
Dataset The dataset to check
- dataset
- Returns:
- bool
Whether the Dataset contains geometries with holes
Notes
Only meaningful to implement on Interfaces that support geometry data.
- classmethod holes(dataset)[source]#
Returns a list of lists of arrays containing the holes for each geometry in the Dataset.
- Parameters:
- dataset
Dataset The dataset to extract holes from
- dataset
- Returns:
python:list[python:list[np.ndarray]]List of list of arrays representing geometry holes
Notes
Only meaningful to implement on Interfaces that support geometry data.
- classmethod iloc(dataset, index)[source]#
Implements integer indexing on the rows and columns of the data.
- Parameters:
- dataset
Dataset The dataset to apply the indexing operation on
- index
python:tupleorpython:int Index specification (row_index, col_index) or row_index
- dataset
- Returns:
dataIndexed data
Notes
Only implement for tabular interfaces.
- classmethod length(dataset)[source]#
Returns the number of rows in the Dataset.
- Parameters:
- dataset
Dataset The dataset to get the length from
- dataset
- Returns:
python:intLength of the data
- classmethod range(dataset, dim)[source]#
Computes the minimum and maximum value along a dimension.
- Parameters:
- dataset
Dataset The dataset to query
- dimension
python:strorDimension Dimension to compute the range on
- dataset
- Returns:
python:tuple[Any,Any]Tuple of (min, max) values
Notes
In the past categorical and string columns were handled by sorting the values and taking the first and last value. This behavior is deprecated and will be removed in 2.0. In future the range for these columns will be returned as (None, None).
- classmethod shape(dataset)[source]#
Returns the shape of the data.
- Parameters:
- dataset
Dataset The dataset to get the shape from
- dataset
- Returns:
python:tuple[python:int,python:int]The shape of the data (rows, cols)
- classmethod validate(dataset, validate_vdims)[source]#
Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.
- classmethod values(dataset, dim, expanded=True, flat=True, compute=True, keep_index=False)[source]#
Returns the values along a dimension of the dataset.
- Parameters:
- dataset
Dataset The dataset to query
- dimension
python:strorDimension Dimension to return the values for
- expandedbool,
defaultpython:True When false returns unique values along the dimension
- flatbool,
defaultpython:True Whether to flatten the array
- computebool,
defaultpython:True Whether to load lazy data into memory as a NumPy array
- keep_indexbool,
defaultpython:False Whether to return the data with an index (if present)
- dataset
- Returns:
- numpy:array_like
Dimension values in the requested format
Notes
The expanded keyword has different behavior for gridded interfaces where it determines whether 1D coordinates are expanded into a multi-dimensional array.