Skip to content

Commit ce5d3dc

Browse files
committed
fix blatant bug
1 parent edb879b commit ce5d3dc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

R/run_extract.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ if (!extracted) {
55
library(xml2)
66
library(gdalraster)
77
dsn <- "/vsicurl/https://raw.githubusercontent.com/mdsumner/rema-ovr/main/REMA-2m_dem_ovr.vrt"
8+
##dsn <- "/vsicurl/https://opentopography.s3.sdsc.edu/raster/COP30/COP30_hh.vrt"
89
url <- gsub("/vsicurl/", "", dsn)
910
xml <- read_xml(url)
1011
dst <- xml |> xml_find_all(".//DstRect")
@@ -62,11 +63,12 @@ extract_pt <- function(x) {
6263
#bbbbb <- paste0(bbox, collapse = ",")
6364
#dsn <- glue::glue("vrt://{dsn}?projwin={bbbbb}")
6465
translate(dsn, tf, cl_arg = c("-projwin", unname(bbox[c(1, 4, 3, 2)])), quiet = TRUE)
65-
pixel_extract(new(GDALRaster, dsn), pts)
66+
pixel_extract(new(GDALRaster, tf), pts)
6667
}
6768

6869

6970
v <- vector("list", length(unique(tile)))
71+
## create the payload
7072
for (i in seq_along(v)) {
7173
tib <- tibble::tibble(dsn = dsn, X = xy[tile == unique(tile)[i],1 , drop = TRUE],
7274
Y = xy[tile == unique(tile)[i],2 , drop = TRUE],
@@ -77,7 +79,7 @@ for (i in seq_along(v)) {
7779
options(parallelly.fork.enable = TRUE, future.rng.onMisuse = "ignore")
7880
library(furrr); plan(multicore)
7981

80-
v <- future_map(v, extract_pt)
82+
v1 <- future_map(v, extract_pt)
8183

8284

8385
# for (i in seq_along(v)) {
@@ -88,6 +90,6 @@ v <- future_map(v, extract_pt)
8890

8991
ds$close()
9092

91-
track$elev <- unlist(v)
93+
track$elev <- unlist(v1)
9294
nanoparquet::write_parquet(track, "longlat_points_dem.parquet")
9395
}

longlat_points_dem.parquet

-195 KB
Binary file not shown.

0 commit comments

Comments
 (0)