Skip to content

Geotools

GeographicField

Bases: Field

geo_metadata = GeographicMetadata(cast('Metadata', field.metadata()), geography) instance-attribute

clone(*, values=None, metadata=None, **kwargs)

message()

Delegate message generation to the underlying field.

to_latlon(flatten=True, dtype=None, index=None)

Return the latitudes and longitudes for the field.

We take these from the geography as GeographicField might be a wrapper around a differently-sized field. This is done, for example, in ReprojectFilter.

to_numpy(flatten=False, dtype=None, index=None)

Delegate creation of numpy array to the underlying field.

It is important to do this rather than relying on the base class implementation since self._field might override the base class method.

GeographicGrid

Bases: Geography

resolution_ = resolution instance-attribute

native_crs = native_crs instance-attribute

latitudes_ = None instance-attribute

longitudes_ = None instance-attribute

latitudes(dtype=None)

longitudes(dtype=None)

x(dtype=None)

y(dtype=None)

bounding_box()

mars_area()

mars_grid()

resolution()

shape()

gridspec()

grid_spec()

projection()

nearest_neighbour_indices(input_latlons, output_latlons)

Calculate the nearest neighbour input cell for each cell in the output grid.

Parameters:

Name Type Description Default
input_latlons ArrayHWV

Array of shape [input_h, input_w, 2] containing the latitudes and longitudes of each cell in the input grid.

required
output_latlons ArrayHWV

Array of shape [output_h, output_w, 2] containing the latitudes and longitudes of each cell in the output grid.

required

Returns:

Type Description
ArrayIndices2D

Tuple of (nn_indices_h, nn_indices_w) where each is a numpy array of shape

ArrayIndices2D

[output_height, output_width] containing, for each output cell, the index in

tuple[ArrayIndices2D, ArrayIndices2D]

the H and W dimensions of the nearest neighbour input cell that should be

tuple[ArrayIndices2D, ArrayIndices2D]

used as the source.