Skip to content

Commit

Permalink
Merge pull request #110 from ropensci/0.9.0-cran
Browse files Browse the repository at this point in the history
0.9.1-1
  • Loading branch information
sigmafelix authored Feb 13, 2025
2 parents a78896a + 74de82a commit 96391c4
Show file tree
Hide file tree
Showing 13 changed files with 197 additions and 191 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Description: Geospatial data computation is parallelized by grid, hierarchy,
simple areal interpolation (`summarize_aw`) and summation of
exponentially decaying weights (`summarize_sedc`) are also provided.
License: MIT + file LICENSE
URL: https://docs.ropensci.org/chopin, https://github.com/ropensci/chopin
URL: https://docs.ropensci.org/chopin/, https://github.com/ropensci/chopin
BugReports: https://github.com/ropensci/chopin/issues
Depends:
R (>= 4.1)
Expand Down
1 change: 1 addition & 0 deletions R/scale_process.R
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ par_grid <-
#' system.file("shape/nc.shp", package = "sf")
#' )
#' nccnty <- sf::st_transform(nccnty, "EPSG:5070")
#' nccnty <- nccnty[seq_len(30L), ]
#'
#' nccntygrid <- sf::st_make_grid(nccnty, n = c(200, 100))
#' nccntygrid <- sf::st_as_sf(nccntygrid)
Expand Down
1 change: 1 addition & 0 deletions R/scale_process_mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ par_hierarchy_mirai <-
#' system.file("shape/nc.shp", package = "sf")
#' )
#' nccnty <- sf::st_transform(nccnty, "EPSG:5070")
#' nccnty <- nccnty[seq_len(30L), ]
#'
#' nccntygrid <- sf::st_make_grid(nccnty, n = c(200, 100))
#' nccntygrid <- sf::st_as_sf(nccntygrid)
Expand Down
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ system.time(
)
)
#> user system elapsed
#> 6.021 0.109 5.733
#> 5.979 0.058 5.786
```

#### Generate regular grid computational regions
Expand Down Expand Up @@ -355,7 +355,7 @@ system.time(
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Task at CGRIDID: 4 is successfully dispatched.
#> user system elapsed
#> 1.508 0.148 8.290
#> 1.447 0.154 9.714

ncpoints_srtm <-
extract_at(
Expand Down Expand Up @@ -414,7 +414,7 @@ system.time(
#> Attempt to track the data source file path...
#> ℹ Input is not a character.
#> user system elapsed
#> 0.964 0.119 7.923
#> 0.847 0.132 7.721

# remove mirai::daemons
mirai::daemons(0L)
Expand Down Expand Up @@ -449,14 +449,14 @@ download.file(hierarchy_url, hierarchy_path, mode = "wb")

nc_data <- hierarchy_path
nc_county <- sf::st_read(nc_data, layer = "county")
#> Reading layer `county' from data source `/tmp/RtmpqcjL3G/nc_hierarchy.gpkg' using driver `GPKG'
#> Reading layer `county' from data source `/tmp/RtmpBBOR7A/nc_hierarchy.gpkg' using driver `GPKG'
#> Simple feature collection with 100 features and 1 field
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 1054155 ymin: 1341756 xmax: 1838923 ymax: 1690176
#> Projected CRS: NAD83 / Conus Albers
nc_tracts <- sf::st_read(nc_data, layer = "tracts")
#> Reading layer `tracts' from data source `/tmp/RtmpqcjL3G/nc_hierarchy.gpkg' using driver `GPKG'
#> Reading layer `tracts' from data source `/tmp/RtmpBBOR7A/nc_hierarchy.gpkg' using driver `GPKG'
#> Simple feature collection with 2672 features and 1 field
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
Expand Down Expand Up @@ -484,7 +484,7 @@ system.time(
)
)
#> user system elapsed
#> 0.756 0.000 0.725
#> 0.710 0.000 0.679

# hierarchical parallelization
system.time(
Expand Down Expand Up @@ -803,7 +803,7 @@ system.time(
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Your input function at 37047 is dispatched.
#> user system elapsed
#> 1.600 0.166 7.868
#> 1.449 0.178 7.734
```

### `par_multirasters()`: parallelize over multiple rasters
Expand All @@ -830,9 +830,9 @@ terra::writeRaster(ncelev, file.path(tdir, "test5.tif"), overwrite = TRUE)
# check if the raster files were exported as expected
testfiles <- list.files(tdir, pattern = "*.tif$", full.names = TRUE)
testfiles
#> [1] "/tmp/RtmpqcjL3G/nc_srtm15_otm.tif" "/tmp/RtmpqcjL3G/test1.tif"
#> [3] "/tmp/RtmpqcjL3G/test2.tif" "/tmp/RtmpqcjL3G/test3.tif"
#> [5] "/tmp/RtmpqcjL3G/test4.tif" "/tmp/RtmpqcjL3G/test5.tif"
#> [1] "/tmp/RtmpBBOR7A/nc_srtm15_otm.tif" "/tmp/RtmpBBOR7A/test1.tif"
#> [3] "/tmp/RtmpBBOR7A/test2.tif" "/tmp/RtmpBBOR7A/test3.tif"
#> [5] "/tmp/RtmpBBOR7A/test4.tif" "/tmp/RtmpBBOR7A/test5.tif"
```

``` r
Expand All @@ -849,35 +849,35 @@ system.time(
)
#> ℹ Input is not a character.
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Your input function at /tmp/RtmpqcjL3G/nc_srtm15_otm.tif is dispatched.
#> ℹ Your input function at /tmp/RtmpBBOR7A/nc_srtm15_otm.tif is dispatched.
#>
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Your input function at /tmp/RtmpqcjL3G/test1.tif is dispatched.
#> ℹ Your input function at /tmp/RtmpBBOR7A/test1.tif is dispatched.
#>
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Your input function at /tmp/RtmpqcjL3G/test2.tif is dispatched.
#> ℹ Your input function at /tmp/RtmpBBOR7A/test2.tif is dispatched.
#>
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Your input function at /tmp/RtmpqcjL3G/test3.tif is dispatched.
#> ℹ Your input function at /tmp/RtmpBBOR7A/test3.tif is dispatched.
#>
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Your input function at /tmp/RtmpqcjL3G/test4.tif is dispatched.
#> ℹ Your input function at /tmp/RtmpBBOR7A/test4.tif is dispatched.
#>
#> Input is a character. Attempt to read it with terra::rast...
#> ℹ Your input function at /tmp/RtmpqcjL3G/test5.tif is dispatched.
#> ℹ Your input function at /tmp/RtmpBBOR7A/test5.tif is dispatched.
#> user system elapsed
#> 1.471 0.206 2.572
#> 1.418 0.107 3.952
knitr::kable(head(res))
```

| mean | base_raster |
|----------:|:----------------------------------|
| 136.80203 | /tmp/RtmpqcjL3G/nc_srtm15_otm.tif |
| 189.76170 | /tmp/RtmpqcjL3G/nc_srtm15_otm.tif |
| 231.16968 | /tmp/RtmpqcjL3G/nc_srtm15_otm.tif |
| 98.03845 | /tmp/RtmpqcjL3G/nc_srtm15_otm.tif |
| 41.23463 | /tmp/RtmpqcjL3G/nc_srtm15_otm.tif |
| 270.96933 | /tmp/RtmpqcjL3G/nc_srtm15_otm.tif |
| 136.80203 | /tmp/RtmpBBOR7A/nc_srtm15_otm.tif |
| 189.76170 | /tmp/RtmpBBOR7A/nc_srtm15_otm.tif |
| 231.16968 | /tmp/RtmpBBOR7A/nc_srtm15_otm.tif |
| 98.03845 | /tmp/RtmpBBOR7A/nc_srtm15_otm.tif |
| 41.23463 | /tmp/RtmpBBOR7A/nc_srtm15_otm.tif |
| 270.96933 | /tmp/RtmpBBOR7A/nc_srtm15_otm.tif |

``` r

Expand Down Expand Up @@ -920,7 +920,7 @@ pnts <- sf::st_as_sf(pnts)
pnts$pid <- sprintf("RPID-%04d", seq(1, 5000))
rd1 <- sf::st_read(ncrd1_path)
#> Reading layer `ncroads_first' from data source
#> `/tmp/RtmpqcjL3G/ncroads_first.gpkg' using driver `GPKG'
#> `/tmp/RtmpBBOR7A/ncroads_first.gpkg' using driver `GPKG'
#> Simple feature collection with 620 features and 4 fields
#> Geometry type: MULTILINESTRING
#> Dimension: XY
Expand Down Expand Up @@ -972,11 +972,11 @@ system.time(
restr <- terra::nearest(x = terra::vect(pntst), y = terra::vect(rd1t))
)
#> user system elapsed
#> 0.459 0.003 0.415
#> 0.471 0.000 0.449

pnt_path <- file.path(tdir, "pntst.gpkg")
sf::st_write(pntst, pnt_path)
#> Writing layer `pntst' to data source `/tmp/RtmpqcjL3G/pntst.gpkg' using driver `GPKG'
#> Writing layer `pntst' to data source `/tmp/RtmpBBOR7A/pntst.gpkg' using driver `GPKG'
#> Writing 5000 features with 1 fields and geometry type Point.

# we use four threads that were configured above
Expand Down Expand Up @@ -1022,7 +1022,7 @@ system.time(
#> ℹ Input is a character. Trying to read with terra .
#> ℹ Task at CGRIDID: 8 is successfully dispatched.
#> user system elapsed
#> 0.076 0.000 0.359
#> 0.077 0.001 0.384
```

- We will compare the results from the single-thread and multi-thread
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "chopin",
"description": "Geospatial data computation is parallelized by grid, hierarchy, or raster files. Based on future and mirai parallel backends, terra and sf functions as well as convenience functions in the package can be distributed over multiple threads. The simplest way of parallelizing generic geospatial computation is to start from `par_pad_*` functions to `par_grid`, `par_hierarchy`, or `par_multirasters` functions. Virtually any functions accepting classes in terra or sf packages can be used in the three parallelization functions. A common raster-vector overlay operation is provided as a function `extract_at`, which uses exactextractr, with options for kernel weights for summarizing raster values at vector geometries. Other convenience functions for vector-vector operations including simple areal interpolation (`summarize_aw`) and summation of exponentially decaying weights (`summarize_sedc`) are also provided.",
"name": "chopin: Computation of Spatial Data by Hierarchical and Objective Partitioning of Inputs for Parallel Processing",
"relatedLink": "https://docs.ropensci.org/chopin",
"relatedLink": "https://docs.ropensci.org/chopin/",
"codeRepository": "https://github.com/ropensci/chopin",
"issueTracker": "https://github.com/ropensci/chopin/issues",
"license": "https://spdx.org/licenses/MIT",
Expand Down Expand Up @@ -370,7 +370,7 @@
},
"SystemRequirements": "netcdf"
},
"fileSize": "2440.244KB",
"fileSize": "2440.32KB",
"releaseNotes": "https://github.com/ropensci/chopin/blob/master/NEWS.md",
"readme": "https://github.com/ropensci/chopin/blob/main/README.md",
"contIntegration": "https://github.com/ropensci/chopin/actions/workflows/check-standard.yaml",
Expand Down
2 changes: 1 addition & 1 deletion man/chopin-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/par_hierarchy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/par_multirasters_mirai.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 96391c4

Please sign in to comment.