Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

components in raster logic #1

Open
mdsumner opened this issue May 5, 2022 · 5 comments
Open

components in raster logic #1

mdsumner opened this issue May 5, 2022 · 5 comments

Comments

@mdsumner
Copy link
Member

mdsumner commented May 5, 2022

atm it's looking like

  • vaster extent and cell and coord-access
  • grout tiling and overviews (zoom levels)
  • affinity a small special case, compare to py affine
  • something meshy for conversion to segments and polygons and triangles
  • something warpy for suggested warp output
@mdsumner
Copy link
Member Author

@mdsumner mdsumner pinned this issue Jul 25, 2022
@mdsumner
Copy link
Member Author

mdsumner commented Jul 25, 2022

Let's build this bigger list, include stuff from affinity, grout, tabularaster, and others - probably a lot is misc and is there a more natural split. Also consistency around UI ...

misc

cell_from_extent <- function(dimension, extent, x_extent) {

extent_vrt <- function(x) {

vaster_listxyz <- function(extent, dimension, data = NULL) {
vaster_long <- function(extent, dimension, data = NULL, raster_order = TRUE) {
vcrop <- function(x, extent, dimension, ..., snap = "out") {

adjacencies

cell_kernel <- function(dimension, cell, size = 1) {
kernel_group_cell <- function(dimension, cell, size = 1) {

  • the functions in affinity tl, bl, br, tr

grain, discretized crop/align

align_extent <- function(x, extent, dimension, snap = c("out", "near", "in")) {
e_dim <- function(x, extent, dimension) {
intersect_extent <- function(x_extent, extent, dimension) {
origin <- function(extent, dimension) {

cell functions get cells or operate by cells

  • arranged by arguments of dimension, dimension+extent

'dimension'

cell_from_col <- function(dimension, col) {
cell_from_row <- function(dimension, row) {
cell_from_row_col <- function(dimension, row, col) {
cell_from_row_col_combine <- function(dimension, row, col) {
col_from_cell <-function(dimension, cell) {
row_from_cell <-function(dimension, cell) {

dimension+extent

cell_from_xy <- function(dimension, extent, xy) {
col_from_x <- function(extent, dimension, x) {
coords <- function(extent, dimension) {
extent_from_cell <- function(extent, dimension, cells) {

row_from_y <- function(extent, dimension, y) {
rowcol_from_cell <- function(extent, dimension, cell) {

x_from_cell <- function(extent, dimension, cell) {
x_from_col <- function(extent, dimension, col) {
xy_from_cell <- function(extent, dimension, cell) {

y_from_cell <- function(extent, dimension, cell) {
y_from_row <- function(extent, dimension, row) {

trivial, but helpful to have

n_cell <- function(dimension) {
n_col <- function(dimension) {
n_row <- function(dimension) {

x_centre <- function(extent, dimension) {
x_corner <- function(x) {

x_max <- function(extent) {
x_min <- function(extent) {
x_res <- function(extent, dimension) {
xlim <- function(extent) {
y_centre <- function(extent, dimension) {
y_corner <- function(x) {
y_max <- function(extent) {
y_min <- function(extent) {
y_res <- function(extent, dimension) {
ylim <- function(extent) {

  • should extent have a NULL case, where it simply uses 0:ncol, 0:nrow
  • [ ]

@mdsumner
Copy link
Member Author

affinity package

There's a bunch of functions in affinity for rasters and little window vectors and transforms, these to be reworked into (extent, dimension) functions

  • raster_to_gt is 'extent_dim_to_gt'
  • 'gt_dim_to_extent' just is
  • raster_to_world is geotransform(scale, offset)
  • raster_to_rasterio is window(offset, srcdim, outdim)
  • raster_to_rasterio and rasterio_to_sfio is 'window(offset, srcdim, outdim)` and the sf list of that
  • geotransform_to_world and world_to_geotransform just reformat each other
raster_to_gt <- function(x) {
raster_to_world <- function(x) {
raster_to_rasterio <- function(x) {
raster_to_sfio <- function(x) {
gt_dim_to_extent <- function(x, dim) {
extent_dim_to_gt <- function(x, dim) {
raster_io0 <- function(src_offset, src_dim, out_dim = src_dim, resample = "NearestNeighbour") {
sfio_to_rasterio <- function(x) {
rasterio_to_sfio <- function(x) {
geo_transform0 <- function(px, ul, sh = c(0, 0)) {
world_to_geotransform <- function(x) {
geo_world0 <- function(px, ul, sh = c(0, 0)) {
geotransform_to_world <- function(x) {

@mdsumner mdsumner mentioned this issue Jul 26, 2022
3 tasks
@mdsumner
Copy link
Member Author

mdsumner commented Jul 27, 2022

need policies on

  • treatment of multiple extent (dimension, extent, x_extent) etc
  • when an extent is forced to align
  • treatment of non-integer dimension (trunc, I think)
  • functions of extent only, currently all are dimension,extent (because might be derived from dimension)
  • row/col rowcol funs are currently row, col order - should change?
  • [ ]

@mdsumner
Copy link
Member Author

we need cell2cell for different cases aligned and not, exactextractr has it here in the small for raster/terra S4 when compared to its own 'grid'

https://github.com/isciences/exactextractr/blob/ca6bc75de7db0912c987702a0404380a8115d8c8/src/raster_utils.cpp#L52-L118

in vaster this is cell2cell (WIP) and has overlap with tiles stuff in grout:

cell2cell <- function(dimension, extent, ## that's the parent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant