Closed MickeyRush closed 9 months ago
Can you upload the problematic grid so I can take a look at what's grong?
I am generating the grid with this code: bbox <- c("xmin" = 499000, "ymin" = 538700, "xmax" = 500000, "ymax" = 539200) interp_res <- 20
grd <- expand.grid( x = seq(from = bbox["xmin"], to = bbox["xmax"], by = interp_res), y = seq(from = bbox["ymin"], to = bbox["ymax"], by = interp_res) )
Then x and y are grd$x and grd$y
Thank you for looking into this! It is a great package.
I'm unable to reproduce this in the current CRAN version nor the current dev version.
Using CRAN:
bbox <- c("xmin" = 499000,
"ymin" = 538700,
"xmax" = 500000,
"ymax" = 539200)
interp_res <- 20
grd <- expand.grid(
x = seq(from = bbox["xmin"], to = bbox["xmax"], by = interp_res),
y = seq(from = bbox["ymin"], to = bbox["ymax"], by = interp_res)
)
grd$dx <- rnorm(nrow(grd))
grd$dy <- rnorm(nrow(grd))
library(ggplot2)
library(metR)
ggplot(grd, aes(x, y)) +
geom_streamline(aes(dx = dx, dy = dy), L = 1000)
#> Warning: Using the `size` aesthetic in this geom was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` in the `default_aes` field and elsewhere instead.
Created on 2022-12-21 by the reprex package (v2.0.1)
I am getting the "'x' and 'y' do not define a regular grid." error on a regular grid that I have verified. I ran the .is.regular_grid function on my x, y grid and got TRUE for both unicity and regularity.
It looks like "field" might be passed to .is.regular_grid rather than the x, y grid. I was able to get it to run by creating my own version with the call to .is.regular_grid commented out.