Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: switch to SpatRaster #20

Merged
merged 28 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1223bc4
names not correct
gisler Oct 29, 2023
cf3a9a9
passes all tests now
gisler Oct 30, 2023
d4def08
ceased support for *.img files
gisler Oct 30, 2023
3f6e47d
some fixes
gisler Oct 30, 2023
9df34e5
ceased backward compatibility to major version 0
gisler Oct 30, 2023
f761c29
several improvements
gisler Oct 31, 2023
16a5fe5
more raster to terra
gisler Oct 31, 2023
10a9fbe
use xyRowColCell (update of control missing)
gisler Oct 31, 2023
e5d1dfa
all terra in core
gisler Oct 31, 2023
94d1894
default in terra
gisler Oct 31, 2023
959093a
update of control
gisler Oct 31, 2023
132a1f1
add extended support for parallel processing
gisler Nov 1, 2023
4ca54de
better explanation
gisler Nov 1, 2023
be57a58
compare all cell values
gisler Nov 3, 2023
18c3ef2
nncross to nearest (requires update of control and probably assertions)
gisler Nov 3, 2023
8068cc9
add sort just to be sure
gisler Nov 3, 2023
732aae4
update to Rd file
gisler Nov 3, 2023
669ce07
update control
gisler Nov 3, 2023
f061a06
update ci
gisler Nov 3, 2023
0234125
some internal improvements
gisler Nov 4, 2023
7cb947c
improve the improvements
gisler Nov 4, 2023
d8ca569
const parameters
gisler Nov 4, 2023
736f539
improved docs
gisler Nov 5, 2023
0037d4f
rename class
gisler Nov 7, 2023
4895c52
partly enable support for IMG files again
gisler Nov 10, 2023
36d6b2a
deprecated warning
gisler Nov 11, 2023
b5b2a2d
img2tif() instead support for ERDAS IMAGINE raster files
gisler Nov 12, 2023
285aa11
make raster files comparable
gisler Nov 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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