hypertidy / vaster

grid logic, without any pesky data
https://hypertidy.github.io/vaster/
Other
7 stars 0 forks source link

components in raster logic #1

Open mdsumner opened 2 years ago

mdsumner commented 2 years ago

atm it's looking like

mdsumner commented 2 years ago

a few examples here

https://gist.github.com/mdsumner/b844766f28910a3f87dc2c8a398a3a13

mdsumner commented 2 years ago

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) {

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

'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) {

mdsumner commented 2 years ago

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 <- 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 commented 2 years ago

need policies on

mdsumner commented 1 year ago

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:

https://github.com/hypertidy/vaster/blob/3e27df59ef04d12a2b1ac61a3ded09001cf33467/R/tiles.R#L28