geovista.gridlines#

Provides graticule support and other geographical lines of interest for geolocation.

Notes#

Added in version 0.3.0.

Module Contents#

Classes#

GraticuleGrid

Graticule composed of a block of meshes, labels and their points.

Functions#

create_meridian_labels(lons)

Generate labels for the meridians.

create_meridians([start, stop, step, lat_step, ...])

Generate graticule lines of constant longitude (meridians) with labels.

create_parallel_labels(lats[, poles_parallel])

Generate labels for the parallels.

create_parallels([start, stop, step, lon_step, ...])

Generate graticule lines of constant latitude (parallels) with labels.

Attributes#

GRATICULE_CLOSED_INTERVAL

Whether longitudes within half-closed [-180, 180) or closed [-180, 180] interval.

GRATICULE_ZLEVEL

The default zlevel for graticule meridians and parallels.

LABEL_DEGREE

The degree symbol label.

LABEL_EAST

The east of the prime meridian label.

LABEL_NORTH

The north of the equatorial parallel label.

LABEL_SOUTH

The south of the equatorial parallel label.

LABEL_WEST

The west of the prime meridian label.

LATITUDE_N_SAMPLES

The default number of points in a line of latitude.

LATITUDE_POLES_LABEL

Whether to generate a north/south pole label.

LATITUDE_POLES_PARALLEL

Whether to generate parallels at the north/south poles.

LATITUDE_START

The first graticule line of latitude (degrees).

LATITUDE_STEP

The default step size between graticule parallels (degrees).

LATITUDE_STEP_PERIOD

The period or upper bound (degrees) for parallel step size.

LATITUDE_STOP

The last graticule line of latitude (degrees).

LONGITUDE_N_SAMPLES

The default number of points in a meridian line.

LONGITUDE_START

The first meridian line in the graticule (degrees).

LONGITUDE_STEP

The default step size between graticule meridians (degrees).

LONGITUDE_STEP_PERIOD

The period or upper bound (degrees) for meridian step size.

LONGITUDE_STOP

The last graticule meridian (degrees).

class geovista.gridlines.GraticuleGrid[source]#

Graticule composed of a block of meshes, labels and their points.

Notes

Added in version 0.3.0.

blocks: pv#
labels: list[str]#
lonlat: numpy.typing.ArrayLike#
mask: numpy.typing.ArrayLike = None#
geovista.gridlines.create_meridian_labels(lons)[source]#

Generate labels for the meridians.

Parameters:
lonslist of float

The meridian lines that require a label of their location east or west relative to the prime meridian.

Returns:
list of str

The sequence of string labels for each meridian line.

Notes

Added in version 0.3.0.

geovista.gridlines.create_meridians(start=None, stop=None, step=None, lat_step=None, n_samples=None, closed_interval=None, central_meridian=None, radius=None, zlevel=None, zscale=None)[source]#

Generate graticule lines of constant longitude (meridians) with labels.

Parameters:
startfloat, optional

The first line of longitude (degrees). The graticule will include this meridian. Defaults to LONGITUDE_START.

stopfloat, optional

The last line of longitude (degrees). The graticule will include this meridian when it is a multiple of step. Also see closed_interval. Defaults to LONGITUDE_STOP.

stepfloat, optional

The delta (degrees) between neighbouring meridians. Defaults to LONGITUDE_STEP.

lat_stepfloat, optional

The delta (degrees) between neighbouring parallels. Sets the frequency of the labels. Defaults to LATITUDE_STEP.

n_samplesint, optional

The number of points in a single line of longitude. Defaults to LONGITUDE_N_SAMPLES.

closed_intervalbool, default=False

Longitude values will be in the half-closed interval [-180, 180). Otherwise, longitudes will be in the closed interval [-180, 180]. Defaults to GRATICULE_CLOSED_INTERVAL.

central_meridianfloat, optional

The central meridian of the longitude range. Defaults to geovista.common.CENTRAL_MERIDIAN.

radiusfloat, optional

The radius of the sphere. Defaults to geovista.common.RADIUS.

zlevelint, optional

The z-axis level. Used in combination with the zscale to offset the radius by a proportional amount i.e., radius * zlevel * zscale. Defaults to GRATICULE_ZLEVEL.

zscalefloat, optional

The proportional multiplier for z-axis zlevel. Defaults to geovista.common.ZLEVEL_SCALE.

Returns:
GraticuleGrid

The graticule meridians and points with labels on those meridians.

Notes

Added in version 0.3.0.

geovista.gridlines.create_parallel_labels(lats, poles_parallel=None)[source]#

Generate labels for the parallels.

Parameters:
latslist of float

The lines of latitude that require a label of their location north or south relative to the equator.

poles_parallelbool, optional

Whether to generate a label for the north/south poles. Defaults to LATITUDE_POLES_PARALLEL.

Returns:
list of str

The sequence of string labels for each line of latitude.

Notes

Added in version 0.3.0.

geovista.gridlines.create_parallels(start=None, stop=None, step=None, lon_step=None, n_samples=None, poles_parallel=None, poles_label=None, radius=None, zlevel=None, zscale=None)[source]#

Generate graticule lines of constant latitude (parallels) with labels.

Parameters:
startfloat, optional

The first line of latitude (degrees). The graticule will include this parallel. Also see poles_parallel. Defaults to LATITUDE_START.

stopfloat, optional

The last line of latitude (degrees). The graticule will include this parallel when it is a multiple of step. Also see poles_parallel. Defaults to LATITUDE_STOP.

stepfloat, optional

The delta (degrees) between neighbouring parallels. Defaults to LATITUDE_STEP.

lon_stepfloat, optional

The delta (degrees) between neighbouring meridians. Sets the frequency of the labels. Defaults to LONGITUDE_STEP.

n_samplesint, optional

The number of points in a single line of latitude. Defaults to LATITUDE_N_SAMPLES.

poles_parallelbool, optional

Whether to create a line of latitude at the north/south poles. Also see poles_label. Defaults to LATITUDE_POLES_PARALLEL.

poles_labelbool, optional

Whether to create a single north/south pole label. Only applies when poles_parallel=False. Defaults to LATITUDE_POLES_LABEL.

radiusfloat, optional

The radius of the sphere. Defaults to geovista.common.RADIUS.

zlevelint, optional

The z-axis level. Used in combination with the zscale to offset the radius by a proportional amount i.e., radius * zlevel * zscale. Defaults to GRATICULE_ZLEVEL.

zscalefloat, optional

The proportional multiplier for z-axis zlevel. Defaults to geovista.common.ZLEVEL_SCALE.

Returns:
GraticuleGrid

The graticule parallels and points with labels on the parallels.

Notes

Added in version 0.3.0.

geovista.gridlines.GRATICULE_CLOSED_INTERVAL: bool = False#

Whether longitudes within half-closed [-180, 180) or closed [-180, 180] interval.

geovista.gridlines.GRATICULE_ZLEVEL: int = 1#

The default zlevel for graticule meridians and parallels.

geovista.gridlines.LABEL_DEGREE: str = '°'#

The degree symbol label.

geovista.gridlines.LABEL_EAST: str#

The east of the prime meridian label.

geovista.gridlines.LABEL_NORTH: str#

The north of the equatorial parallel label.

geovista.gridlines.LABEL_SOUTH: str#

The south of the equatorial parallel label.

geovista.gridlines.LABEL_WEST: str#

The west of the prime meridian label.

geovista.gridlines.LATITUDE_N_SAMPLES: int = 360#

The default number of points in a line of latitude.

geovista.gridlines.LATITUDE_POLES_LABEL: bool = True#

Whether to generate a north/south pole label.

geovista.gridlines.LATITUDE_POLES_PARALLEL: bool = False#

Whether to generate parallels at the north/south poles.

geovista.gridlines.LATITUDE_START: float#

The first graticule line of latitude (degrees).

geovista.gridlines.LATITUDE_STEP: float = 30.0#

The default step size between graticule parallels (degrees).

geovista.gridlines.LATITUDE_STEP_PERIOD: float = 90.0#

The period or upper bound (degrees) for parallel step size.

geovista.gridlines.LATITUDE_STOP: float = 90.0#

The last graticule line of latitude (degrees).

geovista.gridlines.LONGITUDE_N_SAMPLES: int = 180#

The default number of points in a meridian line.

geovista.gridlines.LONGITUDE_START: float#

The first meridian line in the graticule (degrees).

geovista.gridlines.LONGITUDE_STEP: float = 45.0#

The default step size between graticule meridians (degrees).

geovista.gridlines.LONGITUDE_STEP_PERIOD: float = 180.0#

The period or upper bound (degrees) for meridian step size.

geovista.gridlines.LONGITUDE_STOP: float#

The last graticule meridian (degrees).