Skip to content

Commit

Permalink
wshed ch1
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed May 29, 2024
1 parent dc9816e commit 79ad5b5
Show file tree
Hide file tree
Showing 22 changed files with 250 additions and 532 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ install_time_patches/
src/Makevars.ucrt.orig
src/Makevars.ucrt.rej

proj_conf_test
.Rproj

*.tar.gz
*Rcheck/
*.o
Expand All @@ -13,7 +16,6 @@ src/Makevars.ucrt.rej
*.zip
.Rproj.user
af_acc*
.Rbuildignore
.RData
revdep/
python/
Expand Down
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Authors@R: c(
person("Robert J.", "Hijmans", role = c("cre", "aut"),
email = "r.hijmans@gmail.com", comment = c(ORCID = "0000-0001-5872-2872")),
person("Roger", "Bivand", role = "ctb", comment = c(ORCID = "0000-0003-2392-6140")),
person("Cordana", "Emanuele", role="ctb"),
person("Krzysztof", "Dyba", role = "ctb", comment = c(ORCID = "0000-0002-8614-3816")),
person("Edzer", "Pebesma", role = "ctb", comment = c(ORCID = "0000-0001-8049-7069")),
person("Michael D.", "Sumner", role = "ctb"))
Expand Down
22 changes: 4 additions & 18 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import(methods, Rcpp)
exportClasses(SpatExtent, SpatRaster, SpatRasterDataset, SpatRasterCollection, SpatVector, SpatVectorProxy, SpatVectorCollection)
exportMethods("[", "[[", "!", "%in%", activeCat, "activeCat<-", "add<-", addCats, adjacent, all.equal, aggregate, allNA, align, animate, anyNA, app, area, Arith, approximate, as.bool, as.int, as.contour, as.lines, as.points, as.polygons, as.raster, as.array, as.data.frame, as.factor, as.list, as.logical, as.matrix, as.numeric, atan2, atan_2, autocor, barplot, blocks, boundaries, boxplot, buffer, cartogram, categories, cats, catalyze, clamp, clamp_ts, classify, clearance, cellSize, cells, cellFromXY, cellFromRowCol, cellFromRowColCombine, centroids, click, bestMatch, colFromX, colFromCell, colorize, coltab, "coltab<-", combineGeoms, compare, concats, Compare, compareGeom, contour, convHull, countNA, costDist, crds, cover, crop, crosstab, crs, "crs<-", datatype, deepcopy, delaunay, densify, density, depth, "depth<-", describe, diff, disagg, direction, distance, dots, draw, droplevels, elongate, emptyGeoms, erase, extend, ext, "ext<-", extract, extractRange, expanse, fillHoles, fillTime, flip, focal, focal3D, focalCor, focalPairs, focalReg, focalCpp, focalValues, forceCCW, freq, gaps, geom, geomtype, getTileExtents, global, gridDist, gridDistance, has.colors, has.RGB, has.time, hasMinMax, hasValues, hist, head, identical, ifel, impose, init, image, inext, interpIDW, interpNear, inMemory, inset, interpolate, intersect, is.bool, is.int, is.lonlat, is.rotated, isTRUE, isFALSE, is.empty, is.factor, is.lines, is.points, is.polygons, is.related, is.valid, k_means, lapp, layerCor, levels, linearUnits, lines, Logic, varnames, "varnames<-", logic, longnames, "longnames<-", makeValid, mask, match, math, Math, Math2, mean, median, meta, merge, mergeLines, mergeTime, minCircle, minmax, minRect, modal, mosaic, na.omit, not.na, NAflag, "NAflag<-", nearby, nearest, ncell, ncol, "ncol<-", nlyr, "nlyr<-", noNA, normalize.longitude, nrow, "nrow<-", nsrc, origin, "origin<-", pairs, panel, patches, perim, persp, plot, plotRGB, plet, prcomp, princomp, RGB, "RGB<-", polys, points, predict, project, quantile, query, rangeFill, rapp, rast, rasterize, rasterizeGeom, rasterizeWin, readStart, readStop, readValues, rectify, regress, relate, removeDupNodes, res, "res<-", resample, rescale, rev, rcl, roll, rotate, rowFromY, rowColCombine, rowColFromCell, rowFromCell, sapp, scale, scoff, "scoff<-", sds, sort, sprc, sel, selectRange, setMinMax, setValues, segregate, selectHighest, set.cats, set.crs, set.ext, set.names, set.RGB, set.values, size, sharedPaths, shift, sieve, simplifyGeom, snap, sources, spatSample, split, spin, stdev, stretch, subset, subst, summary, Summary, svc, symdif, t, metags, "metags<-", tail, tapp, terrain, tighten, makeNodes, makeTiles, time, timeInfo, "time<-", text, trans, trim, units, union, "units<-", unique, unwrap, update, vect, values, "values<-", viewshed, voronoi, vrt, weighted.mean, where.min, where.max, which.lyr, which.min, which.max, which.lyr, width, window, "window<-", writeCDF, writeRaster, wrap, wrapCache, writeStart, writeStop, writeVector, writeValues, xmin, xmax, "xmin<-", "xmax<-", xres, xFromCol, xyFromCell, xFromCell, ymin, ymax, "ymin<-", "ymax<-", yres, yFromCell, yFromRow, zonal, zoom, cbind2, readRDS, saveRDS, unserialize, serialize, xapp)

## EC 20210702 ecor
exportMethods(watershed, pitfinder, NIDP, flowAccumulation)


S3method(cbind, SpatVector)
S3method(rbind, SpatVector)
S3method(as.data.frame, SpatRaster)
Expand All @@ -21,24 +25,6 @@ S3method(str, SpatGraticule)

export(add_box, add_legend, add_grid, focalMat, extractAlong, gdal, getGDALconfig, graticule, halo, setGDALconfig, map.pal, map_extent, north, sbar, terraOptions, tmpFiles, makeVRT, mem_info, free_RAM, same.crs, shade, gdalCache, fileBlocksize, vector_layers, vrt_tiles, names, round)

## EC 20210702 ecor
exportMethods(watershed2)
## END EC 20210702 ecor
## EC 20220809
exportMethods(pitfinder2)
## END EC 20220809 ecor

## EC 20231031 ecor
exportMethods(NIDP2)
## END EC 20231031

## EC 20231031 ecor
exportMethods(flowAccu2)
## END EC 20231031

## EC 20231114 ecor
exportMethods(flowAccu2_weight)
## END EC 2023114



7 changes: 7 additions & 0 deletions R/Agenerics.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#if (!isGeneric("#")) { setGeneric("#", function(x, ...) standardGeneric("#")) }
#if (!isGeneric("prcomp")) {setGeneric("prcomp", function(x, ...) standardGeneric("princomp"))}

## ADDED BY ecor
if (!isGeneric("watershed")) {setGeneric("watershed", function(x, ...) standardGeneric("watershed"))}
if (!isGeneric("pitfinder")) {setGeneric("pitfinder", function(x, ...) standardGeneric("pitfinder"))}
if (!isGeneric("NIDP")) {setGeneric("NIDP", function(x, ...) standardGeneric("NIDP"))}
if (!isGeneric("flowAccumulation")) {setGeneric("flowAccumulation", function(x, ...) standardGeneric("flowAccumulation"))}


if (!isGeneric("bestMatch")) {setGeneric("bestMatch", function(x, y, ...) standardGeneric("bestMatch"))}
if (!isGeneric("k_means")) {setGeneric("k_means", function(x, ...) standardGeneric("k_means"))}
if (!isGeneric("princomp")) {setGeneric("princomp", function(x, ...) standardGeneric("princomp"))}
Expand Down
13 changes: 0 additions & 13 deletions R/Agenerics_watershed2_extesion.R

This file was deleted.

89 changes: 0 additions & 89 deletions R/generics_watershed2_extension.R

This file was deleted.

42 changes: 42 additions & 0 deletions R/watershed.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Author: Emanuele Cordano
# Date : October 2023
# Version 1.0
# License GPL v3

setMethod("watershed", signature(x="SpatRaster"),
function(x, pourpoin, filename="", ...) {
opt <- spatOptions(filename, ...)
x@ptr <- x@ptr$watershed2(as.integer(offset-1), opt)
messages(x, "watershed2") ## EC 20210318
}
)

setMethod("pitfinder", signature(x="SpatRaster"),
function(x, filename="", ...) {
opt <- spatOptions(filename, ...)
x@ptr <- x@ptr$pitfinder2(opt)
messages(x, "pitfinder") ## EC 20210318
}
)

setMethod("NIDP", signature(x="SpatRaster"),
function(x, filename="", ...) {
opt <- spatOptions(filename, ...)
x@ptr <- x@ptr$NIDP2(opt)
messages(x, "NIDP") ## EC 20231031
}
)

setMethod("flowAccumulation", signature(x="SpatRaster"),
function(x, weight=NULL, filename="", ...) {
opt <- spatOptions(filename, ...)
if (is.null(weight)) {
x@ptr <- x@ptr$flowAccu2(opt)
} else {
x@ptr <- x@ptr$flowAccu2_weight(weight@ptr, opt)
}
messages(x, "flowAccu2")
}
)


File renamed without changes.
108 changes: 0 additions & 108 deletions man/flowAccu2.Rd

This file was deleted.

Loading

0 comments on commit 79ad5b5

Please sign in to comment.