unifhy.RotatedLatLonGrid.from_extent_and_resolution

classmethod RotatedLatLonGrid.from_extent_and_resolution(grid_latitude_extent, grid_longitude_extent, grid_latitude_resolution, grid_longitude_resolution, grid_north_pole_latitude, grid_north_pole_longitude, north_pole_grid_longitude=0.0, grid_latitude_grid_longitude_location='centre')

Instantiate a RotatedLatLonGrid from the extent and the resolution of grid_latitude and grid_longitude coordinates (and optional altitude coordinates).

Parameters
grid_latitude_extent: pair of float or int

The extent of grid_latitude coordinates in degrees for the desired grid. The first element of the pair is the location of the start of the extent along the grid_latitude coordinate, the second element of the pair is the location of the end of the extent along the grid_latitude coordinate. Extent must be oriented positively. May be any type that can be unpacked (e.g. tuple, list, numpy.ndarray).

Parameter example:

grid_latitude_extent=(30, 70)
grid_longitude_extent: pair of float or int

The extent of grid_longitude coordinates in degrees for the desired grid. The first element of the pair is the location of the start of the extent along the grid_longitude coordinate, the second element of the pair is the location of the end of the extent along the grid_latitude coordinate. Extent must be oriented positively. May be any type that can be unpacked (e.g. tuple, list, numpy.ndarray).

Parameter example:

grid_longitude_extent=(0, 90)
grid_latitude_resolution: float or int

The spacing between two consecutive grid_latitude coordinates in degrees for the desired grid. Must be positive.

Parameter example:

grid_latitude_resolution=10
grid_longitude_resolution: float or int

The spacing between two consecutive grid_longitude coordinates in degrees for the desired grid. Must be positive.

Parameter example:

grid_longitude_resolution=10
grid_latitude_grid_longitude_location: str or int, optional

The location of the grid_latitude and grid_longitude coordinates in relation to their grid cells (i.e. their bounds). This information is required to generate the grid_latitude and grid_longitude bounds for each grid coordinate. If not provided, set to default ‘centre’.

The locations left and right are related to the grid_longitude coordinates (X-axis), while the locations lower and upper are related to the grid_latitude coordinates (Y-axis). The orientation of the coordinate system considered is detailed below.

See also

latitude_longitude_location in LatLonGrid.from_extent_and_resolution

grid_north_pole_latitude: int or float

The true latitude (i.e. in EPSG:4326) of the north pole of the rotated grid in degrees North. This parameter is required to project the rotated grid into a true latitude-longitude coordinate system.

grid_north_pole_longitude: int or float

The true longitude (i.e. in EPSG:4326) of the north pole of the rotated grid in degrees East. This parameter is required to project the rotated grid into a true latitude-longitude coordinate system.

north_pole_grid_longitude: int or float, optional

The longitude of the true north pole in the rotated grid in degrees. This parameter is optional to project the rotated grid into a true latitude-longitude coordinate system (i.e. EPSG:4326). If not provided, set to default value 0.

Returns

RotatedLatLonGrid

Examples

>>> sd = RotatedLatLonGrid.from_extent_and_resolution(
...     grid_latitude_extent=(-1.1, 1.1),
...     grid_longitude_extent=(-2.72, -0.96),
...     grid_latitude_resolution=0.44,
...     grid_longitude_resolution=0.44,
...     grid_north_pole_latitude=38.0,
...     grid_north_pole_longitude=190.0
... )
>>> print(sd)
RotatedLatLonGrid(
    shape {Y, X}: (5, 4)
    Y, grid_latitude (5,): [-0.88, ..., 0.88] degrees
    X, grid_longitude (4,): [-2.5, ..., -1.18] degrees
    Y_bounds (5, 2): [[-1.1, ..., 1.1]] degrees
    X_bounds (4, 2): [[-2.72, ..., -0.96]] degrees
)