Skip to content

Commit 2257e07

Browse files
committed
bug trace in terra namespace
1 parent da80d28 commit 2257e07

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ Encoding: UTF-8
1111
LazyData: true
1212
RoxygenNote: 7.3.2
1313
Imports:
14-
httr, utils, stringr, crayon, tibble, terra, jsonlite, stars
14+
httr, utils, stringr, crayon, tibble, terra, jsonlite, stars, crayon

R/COGsUtils.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ cogPreview <- function(urls=NULL, delay=3){
6666
# terra::plot(r, main=n)
6767
url <- paste0('/vsicurl/', urls[i])
6868
rs = stars::read_stars(url, proxy = TRUE)
69-
plot(rs, downsample = 30, col=rainbow(10))
69+
terra::plot(rs, downsample = 30, col=rainbow(10))
7070
Sys.sleep(dly)
7171
}
7272
print('Done')
@@ -92,7 +92,7 @@ cogPlot <- function(url){
9292
n=stringr::str_remove(basename(url), '.tif')
9393
url <- paste0('/vsicurl/', url)
9494
rs = stars::read_stars(url, proxy = TRUE)
95-
plot(rs, downsample = 30, col=rainbow(10), main=n)
95+
terra::plot(rs, downsample = 30, col=rainbow(10), main=n)
9696
}
9797

9898

R/examples.R

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,10 @@ codeDemoCOGs <- function(){
6464
cat(crayon::blue("\n\n###################################### Code Demo ############################################\n"))
6565
cat(crayon::blue("\n\nTo utilise COGs effectively you will need to install the R 'terra' package (the 'raster' package replacement.\n"))
6666

67-
t <- require('terra')
68-
69-
if(!t){
70-
cat(crayon::blue("\n\nIt looks like the 'terra' package is not installed. Lets try and install it now\n"))
71-
install.packages('terra')
72-
}
73-
67+
if (!requireNamespace("terra", quietly = TRUE)) {
68+
cat(crayon::blue("\n\nIt looks like the 'terra' package is not installed. Let's try and install it now\n"))
69+
install.packages("terra")
70+
}
7471

7572
cat(crayon::blue("\n\nWe will now demonstrate how to access and use some terra functions with COGs \n"))
7673
cat(crayon::green("\nLets start by grabbing a COGs URL using - prods <- getProductMetaData(Detail = 'Low', Attribute='Clay', Resolution = '90m', Version = 2, Component = 'Modelled-Value)\n\n"))
@@ -92,7 +89,7 @@ codeDemoCOGs <- function(){
9289
url <- paste0(rsp2$StagingPath[1])
9390
cogPlot(url)
9491
# rs = stars::read_stars(url, proxy = TRUE)
95-
# plot(rs, downsample = 30, col=rainbow(10), main='This is a 40800 x 49200 pixel raster')
92+
# terra::plot(rs, downsample = 30, col=rainbow(10), main='This is a 40800 x 49200 pixel raster')
9693

9794
# o <- try(terra::plot(r), silent=TRUE)
9895

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![pkg-test](https://github.com/AusSoilsDSM/SLGACloud/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/AusSoilsDSM/SLGACloud/actions/workflows/R-CMD-check.yaml)
2+
13
# SLGACloud
24

35
SLGACloud is an R package to simplify access to the Soil and Landscape Grid of Australia (SLGA) Cloud Optimised GeoTIFF (COG) DataStore URLs directly within R. It provides helper functions for retrieving COG URLs, working with `terra`, and navigating relevant SLGA web resources.

0 commit comments

Comments
 (0)