courtiol / IsoriX

This is the website dedicated to the development of the R package IsoriX
12 stars 5 forks source link

Function to create empty grids with coordinates #141

Closed courtiol closed 1 year ago

courtiol commented 2 years ago

When people do not need to use elevation/depth, it is a little silly to make them use a elevation/depth raster. What we need is a simple function creating the grid.

stephkramer commented 2 years ago

Do you mean something like this? (quickly googled)

library(raster) r <- raster(xmn= 0, ymn= 0, xmx = 100000,ymx = 100000, resolution = 10, crs = '+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ') r <- setValues(r, 0))

courtiol commented 2 years ago

Kind of, but with coordinates spanning specific lat/long at regular interval. It is not difficult to code the function, but the question is more what kind of input we want the user to use. I guess lat_min, lat_max, long_min, long_max and n_cell would be good. Then we just need to use n_cell as a basis to define the sequences of lat and long. So n_cell would be an approximate number of cells. I think that would meet the task, what do you think?

stephkramer commented 2 years ago

Yes, with the slight addition that I would separate this into nrows() and ncols(), because n_cells is very abstract for users, as it is the product. But often one knows the dimensions.

courtiol commented 2 years ago

I was thinking that one knows more how many cells they want on a grid that the number in x and y. With n_cell I could make sure that both lat and long are at same resolution, with numbers of rows and columns that could lead to very different lat or long resolution which may look weird. Perhaps I will provide both options then.