hypso.grid.regridding#
Regridding: a product (georeferenced L1B, L1C or L2A) from sensor geometry onto a map grid, as a product of the same level.
The gridded product has dims (y, x[, bands]) with CF projection coordinates x/y and a crs grid-mapping variable, which ESA SNAP and GIS tools read as a map-projected raster; latitude/longitude are kept as 2D auxiliary coordinates. Per variable:
product cube and float variables: method - “nearest” by default, so every grid pixel holds one measured spectrum, unmixed; “bilinear” on request (it blends neighbouring pixels’ spectra); “average” for grids coarser than the product (each cell the mean of the pixels whose centres fall in it, plus a source_pixel_count variable);
azimuth angles: like the rest, but through their sine and cosine unless nearest (no 0/360 wrap artefacts);
integer variables: nearest neighbour; bit flags with “average”: OR-ed over the cell (flagged if any of its pixels is);
pixel_flags gains an outside_swath flag for grid pixels the capture does not cover;
*_directgeolocation and angles are dropped (the grid’s latitude and longitude replace both georeferencings).
Functions#
|
A product tree on a map grid, at the same level. |
Module Contents#
- hypso.grid.regridding.regrid(tree, target='utm', resolution=None, method='nearest', radius_of_influence=None, max_gb=4.0)[source]#
A product tree on a map grid, at the same level.
- Parameters:
tree (xarray.DataTree) – Georeferenced L1B, L1C, L2A or L2B product tree.
target (str, int, pyproj.CRS or pyresample.geometry.AreaDefinition, default "utm") –
"utm"(WGS84 UTM zone of the scene centre), a CRS pyproj accepts (e.g."EPSG:3035",4326), or an AreaDefinition (e.g. another product’s grid).resolution (float, optional) – Pixel size in the CRS’s units (m, or degrees for a geographic CRS); default the product’s resolution. Not with an AreaDefinition.
method ({"nearest", "bilinear", "average"}, default "nearest") – See the module description.
radius_of_influence (float, optional) – In m; default 1.5 times the coarser of source and target pixel size.
max_gb (float, default 4.0) – Refuse grids whose cube would exceed this many GB (a fine grid over a long capture gets large quickly).
- Return type: