Skip to content

22 files changed

+759
-0
lines changed

.Rbuildignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
^kwb\.satellite\.Rproj$
2+
^\.Rproj\.user$
3+
^LICENSE\.md$
4+
^_pkgdown\.yml$
5+
^docs$
6+
^pkgdown$
7+
^\.github$
8+
^codecov\.yml$
9+
^index\.md$
10+
^README\.md$

.github/workflows/R-CMD-check.yaml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- main
6+
- dev
7+
pull_request:
8+
branches:
9+
- master
10+
- main
11+
- dev
12+
13+
name: R-CMD-check
14+
15+
jobs:
16+
R-CMD-check:
17+
runs-on: ${{ matrix.config.os }}
18+
19+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
config:
25+
- {os: macOS-latest, r: 'release'}
26+
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
27+
- {os: windows-latest, r: 'devel'}
28+
- {os: windows-latest, r: 'oldrel'}
29+
- {os: windows-latest, r: 'release'}
30+
31+
env:
32+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
33+
RSPM: ${{ matrix.config.rspm }}
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
38+
- uses: r-lib/actions/setup-r@master
39+
with:
40+
r-version: ${{ matrix.config.r }}
41+
42+
- uses: r-lib/actions/setup-pandoc@master
43+
44+
- name: Query dependencies
45+
run: |
46+
install.packages('remotes')
47+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
48+
shell: Rscript {0}
49+
50+
- name: Cache R packages
51+
if: runner.os != 'Windows'
52+
uses: actions/cache@v1
53+
with:
54+
path: ${{ env.R_LIBS_USER }}
55+
key: ${{ runner.os }}-r-${{ matrix.config.r }}-3-${{ hashFiles('depends.Rds') }}
56+
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-3-
57+
58+
- name: Install system dependencies
59+
if: runner.os == 'Linux'
60+
env:
61+
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
62+
run: |
63+
Rscript -e "remotes::install_github('r-hub/sysreqs')"
64+
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
65+
sudo -s eval "$sysreqs"
66+
- name: Install dependencies
67+
run: |
68+
remotes::install_deps(dependencies = TRUE)
69+
remotes::install_cran("rcmdcheck")
70+
shell: Rscript {0}
71+
72+
- name: Check
73+
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
74+
shell: Rscript {0}
75+
76+
- name: Upload check results
77+
if: failure()
78+
uses: actions/upload-artifact@master
79+
with:
80+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
81+
path: check

.github/workflows/pkgdown.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
- dev
7+
8+
name: pkgdown
9+
10+
jobs:
11+
pkgdown:
12+
runs-on: macOS-latest
13+
env:
14+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- uses: r-lib/actions/setup-r@master
19+
20+
- uses: r-lib/actions/setup-pandoc@master
21+
22+
- name: Query dependencies
23+
run: |
24+
install.packages('remotes')
25+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
26+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
27+
shell: Rscript {0}
28+
29+
- name: Cache R packages
30+
uses: actions/cache@v2
31+
with:
32+
path: ${{ env.R_LIBS_USER }}
33+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
34+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
35+
36+
- name: Install dependencies
37+
run: |
38+
remotes::install_deps(dependencies = TRUE)
39+
install.packages("pkgdown", type = "binary")
40+
shell: Rscript {0}
41+
42+
- name: Install package
43+
run: R CMD INSTALL .
44+
45+
- name: Deploy package
46+
run: |
47+
git config --local user.email "[email protected]"
48+
git config --local user.name "GitHub Actions"
49+
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'

.github/workflows/pr-commands.yaml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
issue_comment:
3+
types: [created]
4+
name: Commands
5+
jobs:
6+
document:
7+
if: startsWith(github.event.comment.body, '/document')
8+
name: document
9+
runs-on: macOS-latest
10+
env:
11+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: r-lib/actions/pr-fetch@master
15+
with:
16+
repo-token: ${{ secrets.GITHUB_TOKEN }}
17+
- uses: r-lib/actions/setup-r@master
18+
- name: Install dependencies
19+
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
20+
- name: Document
21+
run: Rscript -e 'roxygen2::roxygenise()'
22+
- name: commit
23+
run: |
24+
git add man/\* NAMESPACE
25+
git commit -m 'Document'
26+
- uses: r-lib/actions/pr-push@master
27+
with:
28+
repo-token: ${{ secrets.GITHUB_TOKEN }}
29+
style:
30+
if: startsWith(github.event.comment.body, '/style')
31+
name: style
32+
runs-on: macOS-latest
33+
env:
34+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: r-lib/actions/pr-fetch@master
38+
with:
39+
repo-token: ${{ secrets.GITHUB_TOKEN }}
40+
- uses: r-lib/actions/setup-r@master
41+
- name: Install dependencies
42+
run: Rscript -e 'install.packages("styler")'
43+
- name: Style
44+
run: Rscript -e 'styler::style_pkg()'
45+
- name: commit
46+
run: |
47+
git add \*.R
48+
git commit -m 'Style'
49+
- uses: r-lib/actions/pr-push@master
50+
with:
51+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-coverage.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- main
6+
pull_request:
7+
branches:
8+
- master
9+
- main
10+
11+
name: test-coverage
12+
13+
jobs:
14+
test-coverage:
15+
runs-on: macOS-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: r-lib/actions/setup-r@master
22+
23+
- uses: r-lib/actions/setup-pandoc@master
24+
25+
- name: Query dependencies
26+
run: |
27+
install.packages('remotes')
28+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
29+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
30+
shell: Rscript {0}
31+
32+
- name: Cache R packages
33+
uses: actions/cache@v1
34+
with:
35+
path: ${{ env.R_LIBS_USER }}
36+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
37+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
38+
39+
- name: Install dependencies
40+
run: |
41+
install.packages(c("remotes"))
42+
remotes::install_deps(dependencies = TRUE)
43+
remotes::install_cran("covr")
44+
shell: Rscript {0}
45+
46+
- name: Test coverage
47+
run: covr::codecov()
48+
shell: Rscript {0}

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData
4+
.Ruserdata
5+
docs
6+
inst/doc

DESCRIPTION

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Package: kwb.satellite
2+
Title: R Package for Working with Satellite Data from Various
3+
Providers (Copernicus, GoogleEarthEngine)
4+
Version: 0.0.0.9000
5+
Authors@R:
6+
c(person(given = "Michael",
7+
family = "Rustler",
8+
role = c("aut", "cre"),
9+
email = "[email protected]",
10+
comment = c(ORCID = "0000-0003-0647-7726")),
11+
person(given = "Kompetenzzentrum Wasser Berlin gGmbH (KWB)",
12+
role = "cph"))
13+
Description: R Package with functions for working with satellite
14+
data of Copernicus Climate Data Store
15+
(https://cds.climate.copernicus.eu) or GoogleEarthEngine
16+
(https://earthengine.google.com/).
17+
License: MIT + file LICENSE
18+
URL: https://github.com/KWB-R/kwb.satellite
19+
BugReports: https://github.com/KWB-R/kwb.satellite/issues
20+
Encoding: UTF-8
21+
LazyData: true
22+
Roxygen: list(markdown = TRUE)
23+
RoxygenNote: 7.1.1
24+
Imports:
25+
ecmwfr,
26+
kwb.utils
27+
Suggests:
28+
covr,
29+
knitr,
30+
rmarkdown
31+
Remotes:
32+
github::kwb-r/kwb.utils
33+
VignetteBuilder: knitr

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Kompetenzzentrum Wasser Berlin gGmbH (KWB)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2021 Kompetenzzentrum Wasser Berlin gGmbH (KWB)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NAMESPACE

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(copernicus_cds)
4+
export(copernicus_cds_parallel)
5+
importFrom(ecmwfr,wf_request)
6+
importFrom(kwb.utils,catAndRun)
7+
importFrom(parallel,detectCores)
8+
importFrom(parallel,makeCluster)
9+
importFrom(parallel,parLapply)
10+
importFrom(parallel,stopCluster)

NEWS.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# kwb.satellite 0.0.0.9000
2+
3+
* Added a `NEWS.md` file to track changes to the package.
4+
5+
* see https://style.tidyverse.org/news.html for writing a good `NEWS.md`
6+
7+

R/.create_r_package_from_scratch.R

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
### How to build an R package from scratch
2+
remotes::install_github("kwb-r/kwb.pkgbuild")
3+
4+
usethis::create_package(".")
5+
fs::file_delete(path = "DESCRIPTION")
6+
7+
8+
author <- list(name = "Michael Rustler",
9+
orcid = "0000-0003-0647-7726",
10+
url = "https://mrustl.de")
11+
12+
pkg <- list(name = "kwb.satellite",
13+
title = " R Package for Working with Satellite Data from Various Providers (Copernicus, GoogleEarthEngine)",
14+
desc = paste("R Package with functions for working with satellite data of",
15+
"Copernicus Climate Data Store (https://cds.climate.copernicus.eu)",
16+
"or GoogleEarthEngine (https://earthengine.google.com/)."))
17+
18+
19+
kwb.pkgbuild::use_pkg(author,
20+
pkg,
21+
version = "0.0.0.9000",
22+
stage = "experimental")
23+
24+
25+
usethis::use_vignette("copernicus-cds")
26+
27+
### R functions
28+
if(FALSE) {
29+
## add your dependencies (-> updates: DESCRIPTION)
30+
pkg_dependencies <- c('dplyr', 'httr', 'kwb.utils', 'magrittr', 'rlang', 'rvest',
31+
'stringr', 'tidyr', 'xml2')
32+
33+
sapply(pkg_dependencies, usethis::use_package)
34+
35+
desc::desc_add_remotes("kwb-r/kwb.datetime",normalize = TRUE)
36+
desc::desc_add_remotes("kwb-r/kwb.utils",normalize = TRUE)
37+
usethis::use_pipe()
38+
}
39+
40+
kwb.pkgbuild::use_ghactions()
41+
42+
kwb.pkgbuild::create_empty_branch_ghpages("wasserportal")

0 commit comments

Comments
 (0)