gps_data_analyzer.raster_analysis module¶
-
class
gps_data_analyzer.raster_analysis.
Extent
(xmin, xmax, ymin, ymax, border=0)¶ Bases:
object
Class to manage extent of a Raster data and generate a mesh.
- Parameters
-
mesh
(mesh_size=None, x_size=None, y_size=None, nx=None, ny=None)¶ Create a mesh in the current extent.
- Parameters
mesh_size (float, optional) – The space between two pixels of the heatmap.
x_size (float, optional) – The space between two pixels of the heatmap along the X axis.
y_size (float, optional) – The space between two pixels of the heatmap along the Y axis.
nx (int, optional) – The number of pixels of the heatmap along the X axis.
ny (int, optional) – The number of pixels of the heatmap along the Y axis.
- Returns
X and Y coordinates of the mesh nodes.
- Return type
(
numpy.array
,numpy.array
)
-
project
(current_proj, new_proj)¶ Create a new
Extent
instance after projection.- Parameters
current_proj (
pyproj.proj.Proj
or int) – The current projection.new_proj (
pyproj.proj.Proj
or int) – The target projection.
- Returns
The projected extent.
- Return type
-
reset_border
(border)¶ Define new extent and recalculate the extent according to it.
- Parameters
border (float) – The extra border to add around the data values.
-
property
xmax
-
property
xmin
-
property
ymax
-
property
ymin
-
class
gps_data_analyzer.raster_analysis.
Raster
(X, Y, values, extent, crs=None)¶ Bases:
object
Class to manage Raster data.
-
Y
¶ The default column name of input data that contains X coordinates (only used when
x_col
isNone
).- Type
-
values
¶ The default column name of input data that contains Y coordinates (only used when
y_col
isNone
).- Type
-
extent
¶ The default column name of input data that contains Z coordinates (only used when
z_col
isNone
and_has_z
isTrue
).- Type
- Parameters
X (
numpy.array
) – The X coordinates.Y (
numpy.array
) – The Y coordinates.values (
numpy.array
) – The values at each point (X, Y).extent (
Extent
) – The extent of the raster data.
-
static
_load
(path)¶
-
plot
(ax=None, show=True, cmap=None, background=False, zoom=None, annotations=None, annotation_kwargs=None, **kwargs)¶ Plot raster with background and annotations.
- Parameters
ax (
matplotlib.pyplot.Axes
, optional) – The axis object to update.show (bool, optional) – If true, call
plt.show()
else return the figure and axis objects.cmap (
matplotlib.colors.Colormap
, optional) – The colormap to use (a default will be created if not given).background (bool or
cartopy.io.img_tiles.GoogleWTS
, optional) – If true, a default background is added using Google Satellite. If aGoogleWTS
object is given, it is used.zoom (int, mandatory if
background
is notNone
) – The zoom value used to generate the background.annotations (
PoiPoints
, optional) – The points used to annotate the figure.annotation_kwargs (dict, optional) – The kwargs passed to
add_annotated_points()
.kwargs – The given kwargs will be passed to
matplotlib.pyplot.Axes.imshow()
.
- Returns
Raster
The 2D array containing the result.
-
save
(path)¶
-
-
gps_data_analyzer.raster_analysis.
heatmap
(gps_data, mesh_size=None, x_size=None, y_size=None, nx=None, ny=None, border=0, kernel_size=None, kernel_cut=4.0, weight_col=None, normalize=True)¶ Compute heatmap from a set of points using a Gaussian kernel.
- Parameters
gps_data (
_GpsBase
) – The point set.mesh_size (float, optional) – The space between two pixels of the heatmap.
x_size (float, optional) – The space between two pixels of the heatmap along the X axis.
y_size (float, optional) – The space between two pixels of the heatmap along the Y axis.
nx (int, optional) – The number of pixels of the heatmap along the X axis.
ny (int, optional) – The number of pixels of the heatmap along the Y axis.
border (float, optional) – The extra border around the data.
kernel_size (float, optional) – The kernel size used for computation.
kernel_cut (float, optional) – The kernel cut used for computation.
weight_col (str, optional) – The column name used as point weights.
normalize (bool, optional) – Trigger normalization of the result.
- Returns
Raster
The 2D array containing the result.