Skip to content

Commit

Permalink
Preparing release
Browse files Browse the repository at this point in the history
  • Loading branch information
vwmaus committed Oct 11, 2022
1 parent 37ea865 commit cb685b3
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 28 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ dtwSat-Ex_i386.Rout
dtwSat-Ex_x64.Rout
examples_i386
examples_x64
vignettes/twdtw03-speed.Rmd

^CRAN-RELEASE$
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: dtwSat
Type: Package
Title: Time-Weighted Dynamic Time Warping for Satellite Image Time Series Analysis
Version: 0.2.7.9999
Date: 2021-12-17
Version: 0.2.8
Date: 2022-10-11
Authors@R:
c(person(given = "Victor",
family = "Maus",
Expand Down Expand Up @@ -31,7 +31,7 @@ Description: Provides an implementation of the Time-Weighted Dynamic Time
produce land cover maps, create temporal plots for land cover change, and compute
accuracy metrics.
Depends:
R (>= 3.2.0),
R (>= 3.5.0),
zoo,
raster,
ggplot2
Expand Down
2 changes: 1 addition & 1 deletion R/plotCostMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#' log_fun = logisticWeight(-0.1, 100)
#' ts = twdtwTimeSeries(MOD13Q1.ts.list)
#' patt = twdtwTimeSeries(MOD13Q1.patterns.list)
#' mat1 = twdtwApply(x=ts, y=patt, weight.fun=log_fun, keep=TRUE)
#' mat1 = twdtwApply(x=ts, y=patt, weight.fun=log_fun, keep=TRUE, legacy=TRUE)
#'
#' plotCostMatrix(mat1, matrix.name="costMatrix")
#'
Expand Down
2 changes: 1 addition & 1 deletion R/plotPaths.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#' log_fun = logisticWeight(-0.1, 100)
#' ts = twdtwTimeSeries(MOD13Q1.ts.list)
#' patt = twdtwTimeSeries(MOD13Q1.patterns.list)
#' mat1 = twdtwApply(x=ts, y=patt, weight.fun=log_fun, keep=TRUE)
#' mat1 = twdtwApply(x=ts, y=patt, weight.fun=log_fun, keep=TRUE, legacy=TRUE)
#'
#' plotPaths(mat1)
#'
Expand Down
23 changes: 20 additions & 3 deletions R/twdtw_reduce_time.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,26 @@ twdtwReduceTime = function(x,
il <- order(aligs[,1], aligs[,2])

# Create classification intervals
if(is.null(breaks)){
breaks <- seq(as.Date(from), as.Date(to), by = by)
}
# if(is.null(breaks)){
# breaks <- seq(as.Date(from), as.Date(to), by = by)
# }
if(is.null(breaks))
if( !is.null(from) & !is.null(to) ){
breaks = seq(as.Date(from), as.Date(to), by = by)
} else {
patt_range = lapply(y, function(yy) range(yy$date))
patt_diff = trunc(sapply(patt_range, diff)/30)+1
min_range = which.min(patt_diff)
by = patt_diff[[min_range]]
from = patt_range[[min_range]][1]
to = from
month(to) = month(to) + by
year(from) = year(range(x$date)[1])
year(to) = year(range(x$date)[2])
if(to<from) year(to) = year(to) + 1
breaks = seq(from, to, paste(by,"month"))
breaks = as.Date(breaks)
}

# Find best macthes for the intervals
best_matches <- .bestmatches2(
Expand Down
Binary file modified data/MOD13Q1.patterns.list.RData
Binary file not shown.
2 changes: 1 addition & 1 deletion man/plotCostMatrix.Rd

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

2 changes: 1 addition & 1 deletion man/plotPaths.Rd

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

2 changes: 1 addition & 1 deletion man/twdtwApply.Rd

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

4 changes: 2 additions & 2 deletions man/twdtwClassify.Rd

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

6 changes: 3 additions & 3 deletions man/twdtwMatches-class.Rd

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

8 changes: 4 additions & 4 deletions man/twdtwRaster-class.Rd

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

4 changes: 2 additions & 2 deletions man/twdtwReduceTime.Rd

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

8 changes: 4 additions & 4 deletions man/twdtwTimeSeries-class.Rd

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

2 changes: 1 addition & 1 deletion vignettes/twdtw01.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ weight_fun <- logisticWeight(alpha = -0.1, beta = 50)
twdtw_matches <- twdtwApply(x = veg_ts,
y = veg_profiles,
weight.fun = weight_fun,
keep = TRUE)
keep = TRUE, legacy=TRUE)
class(twdtw_matches)
Expand Down
1 change: 0 additions & 1 deletion vignettes/twdtw03-speed.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ samples_cerrado_mod13q1 |>


```{r}
# TODO:
# - twdtwCLassify call for twdtwTimeSeries class and list of data.frame/data.table
# - the same as above with the legacy option
Expand Down

0 comments on commit cb685b3

Please sign in to comment.