Skip to content

Commit

Permalink
feat!: switch to SpatRaster
Browse files Browse the repository at this point in the history
  • Loading branch information
gisler authored Nov 12, 2023
1 parent 3f73ceb commit d712810
Show file tree
Hide file tree
Showing 76 changed files with 367 additions and 329 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check-backwards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
run: |
install.packages("remotes")
remotes::install_cran(
c("checkmate", "raster", "Rcpp", "RcppArmadillo", "spatstat.geom", "yaml", "whitebox", "rcmdcheck"),
repos = "https://packagemanager.posit.co/cran/2023-03-15",
c("checkmate", "raster", "Rcpp", "RcppArmadillo", "terra", "yaml", "whitebox", "rcmdcheck"),
repos = "https://packagemanager.posit.co/cran/2023-10-31",
type = "win.binary",
dependencies = TRUE
)
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ Imports:
methods,
raster (>= 3.6.3),
Rcpp,
spatstat.geom,
stats,
terra,
tools,
utils,
yaml
Suggests:
Expand All @@ -50,7 +51,6 @@ Collate:
'RPhosFate.R'
'RcppExports.R'
'assertives.R'
'deprecated.R'
'gettersSetters.R'
'input.R'
'interface.R'
Expand Down
7 changes: 2 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export(erosionPrerequisites)
export(firstRun)
export(getLayer)
export(getParameter)
export(img2tif)
export(saveState)
export(setParameter)
export(snapGauges)
Expand Down Expand Up @@ -41,16 +42,12 @@ exportMethods(transportPrerequisites)
import(checkmate)
import(methods)
import(raster)
import(terra)
importFrom(Rcpp,sourceCpp)
importFrom(graphics,abline)
importFrom(graphics,clip)
importFrom(graphics,par)
importFrom(graphics,points)
importFrom(spatstat.geom,as.owin)
importFrom(spatstat.geom,as.ppp)
importFrom(spatstat.geom,nncross)
importFrom(stats,cor)
importFrom(stats,median)
importFrom(stats,optim)
importFrom(stats,optimize)
importFrom(stats,sd)
Expand Down
16 changes: 12 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# RPhosFate v1.0.4.9000

* Switched to utilising the `SpatRaster` class from the `terra` package instead of the `RasterLayer` class from the `raster` package. However, the transition from `raster` to `terra` encompasses only the core and not `DEMrelatedInput()` yet.
* Added `is_ths` parameter: allows for specifying the number of threads to use for processing.
* Ceased support for _ERDAS IMAGINE_ (\*.img) raster files. `img2tif()` can be used to convert all _ERDAS IMAGINE_ raster files in a directory and its subdirectories into _GeoTIFF_ raster files.
* Dropped backward compatibility to major version zero.
* Removed `spatstat.geom` from imported packages list (utilised functionality is now also provided by `terra`).
* Bumped minimum tested R version from 4.2.3 to 4.3.2 using the corresponding _Posit_ public package manager snapshot.
* Major internal code improvements.

# RPhosFate v1.0.4

* The current `raster` package does not compress _GeoTIFF_ raster files any longer by default. This is probably due to the switch from `rgdal` to `terra` and has been fixed by generally using the _LZW_ algorithm.
* Fixed warning "GDAL Message 6: driver GTiff does not support creation option COMPRESSED" curiously only occurring in the reference on GitHub Pages.
* Removed `hydroGOF` from imported packages list (`maptools` is retiring and `hydroGOF` depends on it via `hydroTSM`). Thanks to Roger Bivand for raising this issue (#17).
* Bumped minimum tested R version from 4.2.2 to 4.2.3 using the corresponding Posit Public Package Manager snapshot.
* Bumped minimum tested R version from 4.2.2 to 4.2.3 using the corresponding _Posit_ public package manager snapshot.
* Slightly improved documentation.

# RPhosFate v1.0.3

* Removed `rgdal` from suggested packages list and set minimum required version of the `raster` package to ≥ 3.6.3 (`rgdal` is retiring and `raster` ≥ 3.6.3 does not depend on it any longer). Thanks to Roger Bivand for raising this issue (#17).
* Bumped minimum tested R version from 4.1.2 to 4.2.2 using the corresponding MRAN repository snapshot.
* Bumped minimum tested R version from 4.1.2 to 4.2.2 using the corresponding _MRAN_ repository snapshot.
* Slightly improved documentation.
* Minor internal code improvements.

Expand Down Expand Up @@ -51,8 +59,8 @@
# RPhosFate v0.10.0

* `DEMrelatedInput()` function now calculates the slopes from the breached DEM (stream burning is undone beforehand).
* Switched to utilising _GeoTIFF_ (\*.tif) instead of _Erdas Imagine_ (\*.img) raster files.
* Added `cs_fex` argument to `DEMrelatedInput()` function: allows for using _Erdas Imagine_ raster files for backward compatibility.
* Switched to utilising _GeoTIFF_ (\*.tif) instead of _ERDAS IMAGINE_ (\*.img) raster files.
* Added `cs_fex` argument to `DEMrelatedInput()` function: allows for using _ERDAS IMAGINE_ raster files for backward compatibility.
* Added `cs_dir` argument to `DEMrelatedInput()` function: allows for utilising an existing D8 flow directions raster using _ArcGIS_ codes.
* Added `demoProject()` function providing training data.
* Added examples to documentation.
Expand Down
2 changes: 1 addition & 1 deletion R/GOFmetrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kge <- function(mld, old) {
}

mdrae <- function(rae) {
MdRAE <- median(rae)
MdRAE <- stats::median(rae)

if (qtest(MdRAE, "N1(,)")) {
MdRAE
Expand Down
Loading

0 comments on commit d712810

Please sign in to comment.