unifhy.BritishNationalGrid.from_extent_and_resolution
- classmethod BritishNationalGrid.from_extent_and_resolution(projection_y_coordinate_extent, projection_x_coordinate_extent, projection_y_coordinate_resolution, projection_x_coordinate_resolution, projection_y_coordinate_projection_x_coordinate_location='centre')
Instantiate a
BritishNationalGrid
from the extent and the resolution of northing, easting coordinates.- Parameters
- projection_y_coordinate_extent: pair of
float
orint
The extent of northing coordinates in metres for the desired grid. The first element of the pair is the location of the start of the extent along the northing coordinate, the second element of the pair is the location of the end of the extent along the northing coordinate. Extent must be oriented positively. May be any type that can be unpacked (e.g.
tuple
,list
,numpy.ndarray
).Parameter example:
projection_y_coordinate_extent=(12000, 15000)
- projection_x_coordinate_extent: pair of
float
orint
The extent of easting coordinates in metres for the desired grid. The first element of the pair is the location of the start of the extent along the easting coordinate, the second element of the pair is the location of the end of the extent along the easting coordinate. Extent must be oriented positively. May be any type that can be unpacked (e.g.
tuple
,list
,numpy.ndarray
).Parameter example:
projection_x_coordinate_extent=(80000, 84000)
- projection_y_coordinate_resolution:
float
orint
The spacing between two consecutive northing coordinates in metres for the desired grid. Must be positive.
Parameter example:
projection_y_coordinate_resolution=1000
- projection_x_coordinate_resolution:
float
orint
The spacing between two consecutive easting coordinates in metres for the desired grid. Must be positive.
Parameter example:
projection_x_coordinate_resolution=1000
- projection_y_coordinate_projection_x_coordinate_location:
str
orint
, optional The location of the northing and easting coordinates in relation to their grid cells (i.e. their bounds). This information is required to generate the latitude and longitude bounds for each grid coordinate. If not provided, set to default ‘centre’.
The locations left and right are related to the easting coordinates (X-axis), while the locations lower and upper are related to the northing coordinates (Y-axis). The orientation of the coordinate system considered is detailed below (i.e. positive directions are northwards and eastwards).
See also
latitude_longitude_location in
LatLonGrid.from_extent_and_resolution
- projection_y_coordinate_extent: pair of
- Returns
Examples
Instantiating grid using non-standard coordinates location in their cells:
>>> sd = BritishNationalGrid.from_extent_and_resolution( ... projection_y_coordinate_extent=(12000, 15000), ... projection_x_coordinate_extent=(80000, 84000), ... projection_y_coordinate_resolution=1000, ... projection_x_coordinate_resolution=1000, ... projection_y_coordinate_projection_x_coordinate_location='upper right' ... ) >>> print(sd) BritishNationalGrid( shape {Y, X}: (3, 4) Y, projection_y_coordinate (3,): [13000.0, 14000.0, 15000.0] m X, projection_x_coordinate (4,): [81000.0, ..., 84000.0] m Y_bounds (3, 2): [[12000.0, ..., 15000.0]] m X_bounds (4, 2): [[80000.0, ..., 84000.0]] m )