From c00debb3348844b8963f289ee4910b90973b1789 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Fri, 10 May 2024 23:59:09 -0300 Subject: [PATCH 1/7] update description --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 67520f6..46b3a6d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: sitsfeats Type: Package Title: Satellite Image Time Series Features Version: 0.0.1 -Date: 2021-06-02 +Date: 2024-05-10 Authors@R: c(person(given = "Felipe", family = "Carvalho", From 0acacce5f5f635b3a3bf3380264362e5d3f328d0 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Fri, 10 May 2024 23:59:16 -0300 Subject: [PATCH 2/7] update exports --- src/RcppExports.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index ab7d4d5..89bd76f 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -6,6 +6,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // max_calc arma::vec max_calc(const arma::mat& mtx); RcppExport SEXP _sitsfeats_max_calc(SEXP mtxSEXP) { From cd4eb90c3f165fd35cba9fe005b0a0606d25b3ec Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Fri, 10 May 2024 23:59:49 -0300 Subject: [PATCH 3/7] update examples from readme --- README.Rmd | 11 ++++++----- README.md | 16 ++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.Rmd b/README.Rmd index d283808..4868032 100644 --- a/README.Rmd +++ b/README.Rmd @@ -58,10 +58,10 @@ library(tibble) # loading example time series data("timeseries") -polar_metrics <- tibble::tibble(area_q1 = sitsfeats::area_q1(timeseries), - area_q2 = sitsfeats::area_q2(timeseries), - area_q3 = sitsfeats::area_q3(timeseries), - area_q4 = sitsfeats::area_q3(timeseries)) +polar_metrics <- tibble::tibble(area_q1 = area_q1(timeseries), + area_q2 = area_q2(timeseries), + area_q3 = area_q3(timeseries), + area_q4 = area_q3(timeseries)) polar_metrics ``` @@ -73,8 +73,9 @@ polar_metrics one_instance <- timeseries[1,] # plot first time series example -sitsfeats::polar_plot(one_instance) +polar_plot(one_instance) ``` ## Getting help + Feel free to create issues if you have any questions. diff --git a/README.md b/README.md index 7213507..a24511c 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ The goal of the sitsfeats package is to extract temporal metrics from satellite images time series. The metrics implemented in this version are: - - **basics**: statistics metrics - - **polar**: polar metrics +- **basics**: statistics metrics +- **polar**: polar metrics The implementations of this package are based on the [stmetrics](https://github.com/brazil-data-cube/stmetrics) library in @@ -54,13 +54,13 @@ library(tibble) # loading example time series data("timeseries") -polar_metrics <- tibble::tibble(area_q1 = sitsfeats::area_q1(timeseries), - area_q2 = sitsfeats::area_q2(timeseries), - area_q3 = sitsfeats::area_q3(timeseries), - area_q4 = sitsfeats::area_q3(timeseries)) +polar_metrics <- tibble::tibble(area_q1 = area_q1(timeseries), + area_q2 = area_q2(timeseries), + area_q3 = area_q3(timeseries), + area_q4 = area_q3(timeseries)) polar_metrics -#> # A tibble: 5 x 4 +#> # A tibble: 5 × 4 #> area_q1[,1] area_q2[,1] area_q3[,1] area_q4[,1] #> #> 1 29443841. 14207184. 30180681. 30180681. @@ -77,7 +77,7 @@ polar_metrics one_instance <- timeseries[1,] # plot first time series example -sitsfeats::polar_plot(one_instance) +polar_plot(one_instance) ``` From 33d5d75a702e741fbea1c9798c8757b301b508d0 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Sat, 11 May 2024 00:14:36 -0300 Subject: [PATCH 4/7] update makevars --- src/Makevars | 13 ++----------- src/Makevars.win | 14 ++------------ 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/Makevars b/src/Makevars index 5731d8d..e0f1e85 100644 --- a/src/Makevars +++ b/src/Makevars @@ -1,14 +1,5 @@ -## With R 3.1.0 or later, you can uncomment the following line to tell R to -## enable compilation with C++11 (where available) -## -## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider -## availability of the package we do not yet enforce this here. It is however -## recommended for client packages to set it. -## -## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP -## support within Armadillo prefers / requires it -CXX_STD = CXX11 - +## Armadillo requires it +# CXX_STD = CXX11 PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/Makevars.win b/src/Makevars.win index d3e3f41..1d32f13 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,14 +1,4 @@ -## With R 3.1.0 or later, you can uncomment the following line to tell R to -## enable compilation with C++11 (where available) -## -## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider -## availability of the package we do not yet enforce this here. It is however -## recommended for client packages to set it. -## -## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP -## support within Armadillo prefers / requires it -CXX_STD = CXX11 - -PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) +# CXX_STD = CXX11 +PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) From 44bece5b1dacd13a249374aa3533ab359ab7f7ea Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Sat, 11 May 2024 00:14:47 -0300 Subject: [PATCH 5/7] update docs --- man/sitsfeats.Rd | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/man/sitsfeats.Rd b/man/sitsfeats.Rd index 38068e3..c9b72f9 100644 --- a/man/sitsfeats.Rd +++ b/man/sitsfeats.Rd @@ -2,15 +2,11 @@ % Please edit documentation in R/sitsfeats-package.R \docType{package} \name{sitsfeats} -\alias{sitsfeats} \alias{sitsfeats-package} +\alias{sitsfeats} \title{R package for extracting metrics from time series of satellite images} \description{ -Provides a set of temporal metrics derived from satellite image time series. - The basics metrics are composed of basic statistics, histogram-based statistics, and methods - based on time series analysis. - The polar metrics, an approach proposed by Korting et al. (2013) , - is based on the polar representation to describe cyclic events, whose events are common in agricultural applications. +Provides a set of temporal metrics derived from satellite image time series. The basics metrics are composed of basic statistics, histogram-based statistics, and methods based on time series analysis. The polar metrics, an approach proposed by Korting et al. (2013) \doi{10.1016/j.cageo.2013.02.007}, is based on the polar representation to describe cyclic events, whose events are common in agricultural applications. } \section{The \code{sitsfeats} functions}{ From 84c9eaa261ddfd704705608e43afc288e15b62b9 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Sat, 11 May 2024 00:14:54 -0300 Subject: [PATCH 6/7] remove libgeos --- DESCRIPTION | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 46b3a6d..d6d0420 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,6 @@ Imports: sf, sfheaders, geos, - libgeos, ggplot2, cowplot Suggests: @@ -41,4 +40,4 @@ Suggests: wk, covr LinkingTo: Rcpp, RcppArmadillo -RoxygenNote: 7.1.1 +RoxygenNote: 7.3.1 From a4539cf3b25b95d1f7e84605139ad4969fae4485 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Sat, 11 May 2024 12:53:09 -0300 Subject: [PATCH 7/7] update workflow definitions --- .github/workflows/R-CMD-check.yaml | 101 +++++---------------------- .github/workflows/test-coverage.yaml | 57 ++++++++------- 2 files changed, 47 insertions(+), 111 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c30c958..5c46b84 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,18 +1,10 @@ -# NOTE: This workflow is overkill for most R packages -# check-standard.yaml is likely a better choice -# usethis::use_github_action("check-standard") will install it. -# -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - main - - master + branches: [master, dev] pull_request: - branches: - - main - - master + branches: [master, dev] name: R-CMD-check @@ -26,86 +18,31 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: - RSPM: ${{ matrix.config.rspm }} - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v1 - id: install-r + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Install pak and query dependencies - run: | - install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") - saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") - shell: Rscript {0} - - - name: Restore R package cache - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: | - ${{ env.R_LIBS_USER }}/* - !${{ env.R_LIBS_USER }}/pak - key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} - restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - pak::local_system_requirements(execute = TRUE) - pak::pkg_system_requirements("rcmdcheck", execute = TRUE) - shell: Rscript {0} - - - name: Install dependencies - run: | - pak::local_install_dev_deps(upgrade = TRUE) - pak::pkg_install("rcmdcheck") - shell: Rscript {0} + extra-packages: any::rcmdcheck + needs: check - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_: false - run: | - options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results - path: check - - - name: Don't use tar from old Rtools to store the cache - if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }} - shell: bash - run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH + upload-snapshots: false diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index ba1f94f..734e79f 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,48 +1,47 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - main - - master + branches: [main, master] pull_request: - branches: - - main - - master + branches: [main, master] name: test-coverage +permissions: read-all + jobs: test-coverage: - runs-on: macOS-latest + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 - - - uses: r-lib/actions/setup-r@v1 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true - - name: Restore R package cache - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + extra-packages: any::covr, any::xml2 + needs: coverage - - name: Install dependencies + - name: Test coverage run: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("covr") + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) shell: Rscript {0} - - name: Test coverage - run: covr::codecov() - shell: Rscript {0} + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash