Skip to content

Commit

Permalink
Drops projection method for twdtwRaster class
Browse files Browse the repository at this point in the history
  • Loading branch information
vwmaus committed Sep 19, 2021
1 parent bf60679 commit 4ca327b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ exportMethods(ncol)
exportMethods(nlayers)
exportMethods(nrow)
exportMethods(plot)
exportMethods(projection)
exportMethods(projecttwdtwRaster)
exportMethods(res)
exportMethods(resampleTimeSeries)
Expand Down
2 changes: 1 addition & 1 deletion R/getTimeSeries.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ setMethod("getTimeSeries", "twdtwRaster",
extractTimeSeries.twdtwRaster = function(x, y){

# Reproject points to raster projection
y = spTransform(y, CRS(projection(x)))
y = spTransform(y, CRS(projection(x@timeseries[[1]])))
# Check if the coordinates are over the raster extent
pto = .getPointsOverRaster(x, y)
if(length(pto)<1)
Expand Down
15 changes: 1 addition & 14 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
setGeneric("layers",
function(x) standardGeneric("layers"))

setGeneric("projection",
function(x) standardGeneric("projection"))

setGeneric("index",
function(x) standardGeneric("index"))

Expand Down Expand Up @@ -75,10 +72,6 @@ dim.twdtwRaster = function(x){
res
}

projection.twdtwRaster = function(x){
projection(x@timeseries[[1]])
}

res.twdtwRaster = function(x){
res(x@timeseries[[1]])
}
Expand Down Expand Up @@ -193,12 +186,6 @@ setMethod("writeRaster", "twdtwRaster",
}
)

#' @inheritParams twdtwRaster-class
#' @rdname twdtwRaster-class
#' @export
setMethod(f = "projection", "twdtwRaster",
definition = projection.twdtwRaster)

#' @inheritParams twdtwRaster-class
#' @rdname twdtwRaster-class
#' @export
Expand Down Expand Up @@ -485,7 +472,7 @@ show.twdtwRaster = function(object){
cat("Dimensions:",dim(object),"(nlayers, nrow, ncol, length)\n")
cat("Resolution:",res(object)," (x, y)\n")
cat("Extent :",as.vector(extent(object)), "(xmin, xmax, ymin, ymax)\n")
cat("Coord.ref.:",projection(object),"\n")
cat("Coord.ref.:",projection(object@timeseries[[1]]),"\n")
invisible(NULL)
}

Expand Down
4 changes: 2 additions & 2 deletions R/twdtwAssess.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ twdtwAssess.twdtwRaster = function(object, y, labels, id.labels, proj4string, co
x_twdtw = object@timeseries$Distance

# Reproject points to raster projection
y = spTransform(y, CRS(projection(object)))
y = spTransform(y, CRS(projection(object@timeseries[[1]])))

# Remove samples outside raster bbox
n_s <- length(y)
Expand Down Expand Up @@ -239,7 +239,7 @@ twdtwAssess.twdtwRaster = function(object, y, labels, id.labels, proj4string, co

sp.data = SpatialPointsDataFrame(coords = samples_all[,c("longitude", "latitude")],
data = samples_all[,!names(samples_all)%in%c("longitude", "latitude")],
proj4string = CRS(projection(object)))
proj4string = CRS(projection(object@timeseries[[1]])))

new("twdtwAssessment", accuracySummary = accuracy_summary,
accuracyByPeriod = accuracy_by_period,
Expand Down
3 changes: 0 additions & 3 deletions man/twdtwRaster-class.Rd

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

0 comments on commit 4ca327b

Please sign in to comment.