Git Product home page Git Product logo

rsdp's Issues

sdp_extract_data, locations = multiple polygons

## bring in landcover raster
lc <- sdp_get_raster(catalog_id="R3D018") 
## bring in 8 polygons as sf
field_planning = st_read("C:/Users/AmandaHenderson/SynologyDrive/UER_vegmap/output/sampling_areas_draft.gpkg")
## extract landcover data for polygons of interest
fp_lc = sdp_extract_data(raster = lc, locations = field_planning)
#[1] "Re-projecting locations to coordinate system of the raster."
#[1] "Extracting data at 8 locations for 1 raster layers."
#Error: [cbind] nrow does not match

Notes:
Same error when locations is SpatVector
sdp_extract_data(raster = lc, locations = field_planning, bind = FALSE) works, but returns a dataframe, which is less useful

Extraction functions fail when parallelizing via foreach()

Right now it's not possible to run the extraction function (sdp_extract_data()) inside an expression parallelized via foreach().

location_df <- data.frame(SiteName=c("Roaring Judy","Gothic","Galena Lake"),
                          Lat=c(38.716995,38.958446,39.021644),
                          Lon=c(-106.853186,-106.988934,-107.072569))
location_sv <- terra::vect(location_df,geom=c("Lon","Lat"),crs="EPSG:4327")
days <- seq(as.Date("2007-10-01"),as.Date("2007-10-31"),by="day")

cl <- parallel::makeCluster(2L)
doParallel::registerDoParallel(cl)

extr_list4 <- foreach::foreach(i=1:length(days),.packages=c("terra","devtools","rSDP")) %dopar% {
  #devtools::load_all() ## During package development.
  tmax4 <- rSDP::sdp_get_raster("R4D004",date_start=days[i],date_end=days[i],verbose=FALSE)
  extr_dat <- rSDP::sdp_extract_data(tmax4,locations_proj,verbose=FALSE)[,3]
  (extr_dat)
}
parallel::stopCluster(cl)

This gives an error:

: NULL value as symbol address.

I think it's related to this issue affecting functions in terra more generally.

README errors

I ran the code in the README and caught a few reproducibility errors. They are all minor, so collecting here under a single issue.

  1. Plotting with map tiles doesn't work
    terra::plet(dem,tiles="Esri.WorldImagery")

    Error in leaflet::addRasterImage(map, x, colors = col, opacity = alpha, : inherits(x, "RasterLayer") is not TRUE

Are raster data types supported when using tiles? Maybe this is a simple fix with class conversion?
2. Download argument misnamed

rSDP/README.Rmd

Lines 78 to 81 in d16a32b

dem_local <- sdp_get_raster(catalog_id="R3D009",
download_data=TRUE,
download_path="~/Downloads",
overwrite=FALSE)

download_data should be changed to download_files
3. Timing extraction approaches

rSDP/README.md

Lines 297 to 301 in d16a32b

#> approach timing
#> 1 Single Call 20.43772 secs
#> 2 Looping sdp_extract_data() 32.68482 secs
#> 3 Looping over sdp_get_raster() 32.89033 secs
#> 4 Foreach 36.05433 secs

Looks like something slowed down the foreach run. I get ~2x speedup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.