Utilities#

assign_crs(xx[, crs, crs_coord_name])

Assign CRS for a non-georegistered array or dataset.

crs_units_per_degree(crs, lon[, lat, step])

Compute number of CRS units per degree for a projected CRS at a given location in lon/lat.

geobox_union_conservative(geoboxes)

Union of geoboxes.

geobox_intersection_conservative(geoboxes)

Intersection of geoboxes.

scaled_down_geobox(src_geobox, scaler)

Given a source geobox and integer scaler compute geobox of a scaled down image.

intersects(a, b)

Returns True if geometries intersect, else False

common_crs(geoms)

Return CRS common across geometries, or raise CRSMismatchError

is_affine_st(A[, tol])

True if Affine transform has scale and translation components only.

apply_affine(A, x, y)

broadcast A*(x_i, y_i) across all elements of x/y arrays in any shape (usually 2d image)

roi_boundary(roi[, pts_per_side])

Get boundary points from a 2d roi.

roi_is_empty(roi)

roi_is_full(roi, shape)

Check if ROI covers the entire region.

roi_intersect(a, b)

Compute intersection of two ROIs

roi_shape(roi)

roi_normalise(roi, shape)

Fill in missing .start/.stop, also deal with negative values, which are treated as offsets from the end.

roi_from_points(xy, shape[, padding, align])

Compute envelope around a bunch of points and return it as roi (tuple of row/col slices)

roi_center(roi)

Return center point of roi

roi_pad(roi, pad, shape)

Pad ROI on each side, with clamping (0,..) -> shape

scaled_down_shape(shape, scale)

scaled_down_roi(roi, scale)

scaled_up_roi(roi, scale[, shape])

decompose_rws(A)

Compute decomposition Affine matrix sans translation into Rotation, Shear and Scale.

affine_from_pts(X, Y)

Given points X,Y compute A, such that: Y = A*X.

get_scale_at_point(pt, tr[, r])

Given an arbitrary locally linear transform estimate scale change around a point.

native_pix_transform(src, dst)

direction: from src to dst .back: goes the other way .linear: None|Affine linear transform src->dst if transform is linear (i.e.

compute_reproject_roi(src, dst[, tol, ...])

Given two GeoBoxes find the region within the source GeoBox that overlaps with the destination GeoBox, and also compute the scale factor (>1 means shrink).

split_translation(t)

Split translation into pixel aligned and sub-pixel components.

compute_axis_overlap(Ns, Nd, s, t)

s, t define linear transform from destination coordinate space to source >> x_s = s * x_d + t

w_

Translate numpy slices to rasterio window tuples.

warp_affine(src, dst, A, resampling[, ...])

Perform Affine warp using best available backend (GDAL via rasterio is the only one so far).

rio_reproject(src, dst, s_gbox, d_gbox, ...)

Perform reproject from ndarray->ndarray using rasterio as backend library.