├── .Rbuildignore ├── .github ├── .gitignore ├── CODE-OF-CONDUCT.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── help-needed---question.md │ ├── missing---unclear-documentation.md │ └── new-spectral-index.md └── workflows │ ├── R-CMD-check.yaml │ └── close-issue.yml ├── .gitignore ├── DESCRIPTION ├── Dockerfile ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── abs2rel.R ├── add_rgb_image.R ├── add_tile_suffix.R ├── build_example_param_file.R ├── calcindex.R ├── check_gcloud.R ├── check_gdal.R ├── check_gui_deps.R ├── check_param_list.R ├── check_sen2r_deps.R ├── compute_s2_paths.R ├── comsub.R ├── convert_datatype.R ├── create_indices_db.R ├── create_s2_dop.R ├── expand_path.R ├── expect_equal_crs.R ├── fix_envi_format.R ├── gdalUtil.R ├── gdal_abs2rel.R ├── gdal_warp.R ├── gdalwarp_grid.R ├── gipp.R ├── give_write_permission.R ├── helpers_extent.R ├── ignorelist.R ├── init_python.R ├── install_aria2.R ├── install_sen2cor.R ├── list_indices.R ├── list_sen2r_paths.R ├── load_binpaths.R ├── mountpoint.R ├── nn.R ├── path_check.R ├── print_message.R ├── projpar.R ├── raster_metadata.R ├── s2_angles.R ├── s2_calcindices.R ├── s2_defNA.R ├── s2_dop.R ├── s2_download.R ├── s2_download_gcloud.R ├── s2_download_scihub.R ├── s2_gui.R ├── s2_list.R ├── s2_list_gcloud.R ├── s2_list_scihub.R ├── s2_mask.R ├── s2_merge.R ├── s2_order.R ├── s2_rgb.R ├── s2_thumbnails.R ├── s2_tiles.R ├── s2_translate.R ├── safe_getMetadata.R ├── safe_is_online.R ├── safe_shortname.R ├── safelist-class.R ├── scihub_login.R ├── sen2cor.R ├── sen2r.R ├── sen2r_getElements.R ├── sen2r_process_report.R ├── smooth_mask.R ├── st_as_text_2.R ├── st_crs2.R ├── str_pad2.R ├── suppress_warnings.R ├── tile_utmzone.R ├── tiles_intersects.R ├── trace_functions.R └── zzz.R ├── README.Rmd ├── README.md ├── _pkgdown.yaml ├── cran-comments.md ├── docs ├── 404.html ├── CODE-OF-CONDUCT.html ├── CONDUCT.html ├── ISSUE_TEMPLATE.html ├── LICENSE.html ├── articles │ ├── docker.html │ ├── docker_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ ├── header-attrs-2.4 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.5 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.7 │ │ │ └── header-attrs.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── index.html │ ├── installation.html │ ├── installation_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ ├── header-attrs-2.4 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.5 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.7 │ │ │ └── header-attrs.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── outstructure.html │ ├── outstructure_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ ├── header-attrs-2.1 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.4 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.5 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.7 │ │ │ └── header-attrs.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── sen2r_cmd.html │ ├── sen2r_cmd_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ ├── header-attrs-2.4 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.5 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.7 │ │ │ └── header-attrs.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── sen2r_gui.html │ └── sen2r_gui_files │ │ ├── accessible-code-block-0.0.1 │ │ └── empty-anchor.js │ │ ├── anchor-sections-1.0 │ │ ├── anchor-sections.css │ │ └── anchor-sections.js │ │ ├── header-attrs-2.4 │ │ └── header-attrs.js │ │ ├── header-attrs-2.5 │ │ └── header-attrs.js │ │ ├── header-attrs-2.7 │ │ └── header-attrs.js │ │ └── header-attrs-2.9 │ │ └── header-attrs.js ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── index.html ├── link.svg ├── man │ └── figures │ │ ├── sen2r_gui_sheet1_small.png │ │ ├── sen2r_gui_sheet2_small.png │ │ ├── sen2r_gui_sheet3_small.png │ │ ├── sen2r_gui_sheet4_small.png │ │ └── sen2r_gui_sheet5_small.png ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── Rplot002.png │ ├── Rplot003.png │ ├── Rplot004.png │ ├── Rplot005.png │ ├── Rplot006.png │ ├── abs2rel.html │ ├── add_rgb_image.html │ ├── add_tile_suffix.html │ ├── build_example_param_file.html │ ├── calcindex.html │ ├── check_gcloud.html │ ├── check_gdal.html │ ├── check_gui_deps.html │ ├── check_param_list.html │ ├── check_sen2r_deps.html │ ├── compute_s2_paths.html │ ├── comsub.html │ ├── create_indices_db.html │ ├── create_s2_dop.html │ ├── dontuse.html │ ├── editModPoly.html │ ├── expand_path.html │ ├── expect_equal_crs.html │ ├── figures │ │ ├── irea_logo_200px.png │ │ ├── sen2r_gui_sheet1.png │ │ ├── sen2r_gui_sheet1_small.png │ │ ├── sen2r_gui_sheet2.png │ │ ├── sen2r_gui_sheet2_small.png │ │ ├── sen2r_gui_sheet3.png │ │ ├── sen2r_gui_sheet3_small.png │ │ ├── sen2r_gui_sheet4.png │ │ ├── sen2r_gui_sheet4_small.png │ │ ├── sen2r_gui_sheet5.png │ │ ├── sen2r_gui_sheet5_small.png │ │ ├── sen2r_logo_1000px.png │ │ └── sen2r_logo_200px.png │ ├── fix_envi_format.html │ ├── gdalUtil-1.png │ ├── gdalUtil-2.png │ ├── gdalUtil-3.png │ ├── gdalUtil.html │ ├── gdal_abs2rel_rel2abs.html │ ├── gdal_formats_db.html │ ├── gdal_warp-1.png │ ├── gdal_warp-2.png │ ├── gdal_warp-3.png │ ├── gdal_warp-4.png │ ├── gdal_warp.html │ ├── gdalwarp_grid-1.png │ ├── gdalwarp_grid.html │ ├── gipp.html │ ├── gipp_init.html │ ├── give_write_permission.html │ ├── ignorelist.html │ ├── index.html │ ├── init_python.html │ ├── install_aria2.html │ ├── install_sen2cor.html │ ├── list_indices.html │ ├── load_binpaths.html │ ├── load_extent.html │ ├── mountpoint.html │ ├── nn.html │ ├── normalize_path.html │ ├── path_check.html │ ├── print_message.html │ ├── projpar.html │ ├── raster2rgb.html │ ├── raster_metadata.html │ ├── s2_angles.html │ ├── s2_calcindices-1.png │ ├── s2_calcindices.html │ ├── s2_defNA.html │ ├── s2_dop.html │ ├── s2_download.html │ ├── s2_gui.html │ ├── s2_list.html │ ├── s2_mask-1.png │ ├── s2_mask.html │ ├── s2_merge.html │ ├── s2_order.html │ ├── s2_rgb-1.png │ ├── s2_rgb.html │ ├── s2_thumbnails.html │ ├── s2_tiles-1.png │ ├── s2_tiles.html │ ├── s2_translate.html │ ├── safe_getMetadata.html │ ├── safe_is_online.html │ ├── safe_shortname.html │ ├── safelist-class.html │ ├── scihub_login.html │ ├── sen2cor.html │ ├── sen2r-1.png │ ├── sen2r-2.png │ ├── sen2r-3.png │ ├── sen2r-4.png │ ├── sen2r-5.png │ ├── sen2r-6.png │ ├── sen2r.html │ ├── sen2r_getElements.html │ ├── sen2r_process_report.html │ ├── smooth_mask.html │ ├── st_as_text_2.html │ ├── st_crs2.html │ ├── stack2rgb.html │ ├── str_pad2.html │ ├── suppress_warnings.html │ ├── tile_utmzone.html │ ├── tiles_intersects-1.png │ ├── tiles_intersects-2.png │ ├── tiles_intersects.html │ └── trace_function.html └── sitemap.xml ├── index.Rmd ├── index.md ├── inst ├── CITATION ├── WORDLIST ├── extdata │ ├── out │ │ ├── S2A1C_20170703_022_Barbellino_RGB432T_10.tif │ │ ├── S2A1C_20170703_022_Barbellino_TOA_10.tif │ │ ├── S2A1C_20190723_022_Barbellino_RGB432T_10.tif │ │ ├── S2A1C_20190723_022_Barbellino_TOA_10.tif │ │ ├── S2A2A_20170703_022_Barbellino_BOA_10.tif │ │ ├── S2A2A_20170703_022_Barbellino_MSAVI2_10.tif │ │ ├── S2A2A_20170703_022_Barbellino_NDVI_10.tif │ │ ├── S2A2A_20170703_022_Barbellino_RGB432B_10.tif │ │ ├── S2A2A_20170703_022_Barbellino_RGB432B_10.vrt │ │ ├── S2A2A_20170703_022_Barbellino_RGB843B_10.tif │ │ ├── S2A2A_20170703_022_Barbellino_SCL_10.tif │ │ ├── S2A2A_20190723_022_Barbellino_BOA_10.tif │ │ ├── S2A2A_20190723_022_Barbellino_MSAVI2_10.tif │ │ ├── S2A2A_20190723_022_Barbellino_NDVI_10.tif │ │ ├── S2A2A_20190723_022_Barbellino_RGB432B_10.tif │ │ ├── S2A2A_20190723_022_Barbellino_RGB432B_10.vrt │ │ ├── S2A2A_20190723_022_Barbellino_RGB843B_10.tif │ │ └── S2A2A_20190723_022_Barbellino_SCL_10.tif │ ├── palettes │ │ ├── NDSI.cpt │ │ ├── NDVI.cpt │ │ ├── SCL.txt │ │ ├── WVP.cpt │ │ ├── Zscore.cpt │ │ ├── bw.cpt │ │ └── diff.cpt │ ├── settings │ │ ├── doybase.json │ │ ├── gdal_formats.json │ │ └── indices.json │ └── vector │ │ ├── barbellino.geojson │ │ ├── dam.geojson │ │ └── scalve.kml └── www │ ├── favicon.ico │ └── images │ ├── irea_logo.png │ ├── mask_types.jpg │ └── sen2r_logo_200px.png ├── man ├── abs2rel.Rd ├── add_rgb_image.Rd ├── add_tile_suffix.Rd ├── build_example_param_file.Rd ├── calcindex.Rd ├── check_gcloud.Rd ├── check_gdal.Rd ├── check_gui_deps.Rd ├── check_param_list.Rd ├── check_sen2r_deps.Rd ├── compute_s2_paths.Rd ├── comsub.Rd ├── create_indices_db.Rd ├── create_s2_dop.Rd ├── expand_path.Rd ├── expect_equal_crs.Rd ├── figures │ ├── irea_logo_200px.png │ ├── sen2r_gui_sheet1.png │ ├── sen2r_gui_sheet1_small.png │ ├── sen2r_gui_sheet2.png │ ├── sen2r_gui_sheet2_small.png │ ├── sen2r_gui_sheet3.png │ ├── sen2r_gui_sheet3_small.png │ ├── sen2r_gui_sheet4.png │ ├── sen2r_gui_sheet4_small.png │ ├── sen2r_gui_sheet5.png │ ├── sen2r_gui_sheet5_small.png │ ├── sen2r_logo_1000px.png │ └── sen2r_logo_200px.png ├── fix_envi_format.Rd ├── gdalUtil.Rd ├── gdal_abs2rel_rel2abs.Rd ├── gdal_warp.Rd ├── gdalwarp_grid.Rd ├── gipp.Rd ├── gipp_init.Rd ├── give_write_permission.Rd ├── ignorelist.Rd ├── init_python.Rd ├── install_aria2.Rd ├── install_sen2cor.Rd ├── list_indices.Rd ├── load_binpaths.Rd ├── load_extent.Rd ├── mountpoint.Rd ├── nn.Rd ├── normalize_path.Rd ├── path_check.Rd ├── print_message.Rd ├── projpar.Rd ├── raster2rgb.Rd ├── raster_metadata.Rd ├── s2_angles.Rd ├── s2_calcindices.Rd ├── s2_defNA.Rd ├── s2_dop.Rd ├── s2_download.Rd ├── s2_gui.Rd ├── s2_list.Rd ├── s2_mask.Rd ├── s2_merge.Rd ├── s2_order.Rd ├── s2_rgb.Rd ├── s2_thumbnails.Rd ├── s2_tiles.Rd ├── s2_translate.Rd ├── safe_getMetadata.Rd ├── safe_is_online.Rd ├── safe_shortname.Rd ├── safelist-class.Rd ├── scihub_login.Rd ├── sen2cor.Rd ├── sen2r.Rd ├── sen2r_getElements.Rd ├── sen2r_process_report.Rd ├── smooth_mask.Rd ├── st_as_text_2.Rd ├── st_crs2.Rd ├── stack2rgb.Rd ├── str_pad2.Rd ├── suppress_warnings.Rd ├── tile_utmzone.Rd ├── tiles_intersects.Rd └── trace_function.Rd ├── tests ├── spelling.R ├── testthat.R └── testthat │ ├── old │ ├── test-create_s2_dop.R │ ├── test-t30_create_s2_dop.R │ └── test-t35_create_indices_db.R │ ├── setup-commons.R │ ├── setup-dependencies.R │ ├── setup-scihub_creds.R │ ├── test-abs2rel.R │ ├── test-build_example_param_file.R │ ├── test-check_gcloud.R │ ├── test-gdal_warp.R │ ├── test-gdalwarp_grid.R │ ├── test-list_indices.R │ ├── test-load_binpaths.R │ ├── test-mountpoint.R │ ├── test-projpar.R │ ├── test-s2_calcindices.R │ ├── test-s2_dop.R │ ├── test-s2_download.R │ ├── test-s2_list.R │ ├── test-s2_mask.R │ ├── test-s2_order.R │ ├── test-s2_rgb.R │ ├── test-safelist-class.R │ ├── test-scihub_login.R │ ├── test-sen2cor.R │ ├── test-sen2r-00_connection.R │ ├── test-sen2r-01_merge.R │ ├── test-sen2r-02_warp.R │ ├── test-sen2r-03_mask.R │ ├── test-sen2r-04_indices.R │ ├── test-sen2r-05_rgb.R │ ├── test-sen2r-06_ignorelist.R │ ├── test-sen2r_getElements.R │ └── test-st_crs2.R ├── utils ├── code │ ├── code_coverage.R │ ├── create_README.sh │ ├── download_cci_wip.R │ ├── gdal_formats_db.R │ ├── mask_types.R │ └── test-coverage.yaml ├── palettes │ ├── NDSI.qml │ ├── NDVI_1.qml │ ├── NDVI_10000.qml │ ├── SCL.qml │ ├── SR_NirRG.qml │ ├── SR_RGB.qml │ ├── SR_SwirNirR.qml │ ├── Zscore.qml │ └── diff.qml └── vector │ ├── ch_bound.rds │ └── s2_tiles.rds └── vignettes ├── docker.Rmd ├── installation.Rmd ├── outstructure.Rmd ├── sen2r_cmd.Rmd └── sen2r_gui.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.travis\.yml$ 4 | ^\.covrignore\.yml$ 5 | ^.*\.yaml$ 6 | ^README\.R?md$ 7 | ^WIP$ 8 | ^\.github$ 9 | ^Dockerfile$ 10 | ^docs$ 11 | ^index\.R?md$ 12 | ^utils$ 13 | ^LICENSE\.md$ 14 | ^cran\-comments\.md$ 15 | ^CRAN-RELEASE$ 16 | ^doc$ 17 | ^Meta$ 18 | ^CRAN-SUBMISSION$ 19 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a code bug 4 | title: '' 5 | labels: bug 6 | assignees: ranghetti 7 | 8 | --- 9 | 10 | --- NEWS --- 11 | Unfortunately the owner can no longer provide assistance for this package. 12 | If you want to report a bug you can open a new issue using this template, 13 | but the issue will be automatically close and will probably remain unanswered. 14 | If you are able to correct the bug, please address your changes in a pull request. 15 | --- 16 | 17 | 29 | 30 | **Bug description** 31 | 32 | 33 | **Reproducible example** 34 | 35 | 36 | ```r 37 | ## PLEASE DELETE AND WRITE YOUR OWN 38 | library(sen2r) 39 | example_extent <- "C:/path/of/the/file/example.shp" 40 | # file example.shp _must_ be attached if not available online 41 | output <- sen2r("/path/of/the/parameter_file.json") 42 | # file parameter_file.json _must_ be attached of copied as text 43 | ``` 44 | 45 | **Expected and actual behavior** 46 | 47 | 48 | ``` 49 | ## PLEASE DELETE AND WRITE YOUR OWN OUTPUT 50 | [2020-12-21 16:17:01] #### Starting sen2r execution. #### 51 | [2020-12-21 16:17:02] Searching for available SAFE products on SciHub... 52 | [2020-12-21 16:17:10] Computing output names... 53 | ... 54 | ``` 55 | 56 | **System information** 57 | 62 | 63 | ``` 64 | # PASTE HERE YOUR OUTPUT 65 | ``` 66 | 67 | **Additional context** 68 | 69 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/missing---unclear-documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Missing / unclear documentation 3 | about: Question about general {sen2r} functionalities 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | --- NEWS --- 11 | Unfortunately the owner can no longer provide assistance for this package. 12 | If you need to ask for help or make a question about {sen2r} functionalities, 13 | you can check if the topic was already addressed within closed issues. 14 | In case you did not find a solution, please address your question on StackOverflow, 15 | where other users could answer you. 16 | Any opened issues will be automatically closed, as well as reopened old issues 17 | will be ignored. 18 | The following template instructions are kept for backwards compatibility. 19 | --- 20 | 21 | 37 | 38 | **Functionality** 39 | 40 | 41 | **Documentation reference** 42 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new-spectral-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: New spectral index 3 | about: Add a new spectral index to {sen2r} 4 | title: '' 5 | labels: new index 6 | assignees: '' 7 | 8 | --- 9 | 10 | --- NEWS --- 11 | Unfortunately the owner can no longer provide assistance for this package. 12 | The list of indices will not be extended with new requests. 13 | Any opened issues will be automatically closed, as well as reopened old issues 14 | will be ignored. 15 | The following template instructions are kept for backwards compatibility. 16 | If you are able to edit the code in order to manually add the index, 17 | you can open a pull request with your changes. 18 | The following template instructions are kept for backwards compatibility. 19 | --- 20 | 21 | 25 | 26 | **Index information** 27 | 28 | 29 | **Formula** 30 | 31 | 32 | **Target image** 33 | 34 | -------------------------------------------------------------------------------- /.github/workflows/close-issue.yml: -------------------------------------------------------------------------------- 1 | name: Autocloser 2 | on: [issues] 3 | jobs: 4 | autoclose: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Autoclose issues by default 8 | uses: roots/issue-closer@v1.1 9 | with: 10 | repo-token: ${{ secrets.GITHUB_TOKEN }} 11 | issue-close-message: " 12 | @${issue.user.login} 13 | unfortunately the owner can no longer provide assistance for this package. 14 | If you need to ask for help or make a question about {sen2r} functionalities, 15 | refer to the package documentation first, 16 | and check if the topic was already addressed within closed issues. 17 | Then, address remaining doubts to public forums like StackOverflow, 18 | where other users could eventually provide useful ticks. 19 | If you are able to correct a bug, please address your changes in a pull request. 20 | " 21 | issue-pattern: ".*do not autoclose this issue.*" 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | *.Rhistory 3 | *.Rapp.history 4 | 5 | # Session Data files 6 | *.RData 7 | # Example code in package build process 8 | *-Ex.R 9 | # Output files from R CMD build 10 | /*.tar.gz 11 | # Output files from R CMD check 12 | /*.Rcheck/ 13 | # produced vignettes 14 | vignettes/*.html 15 | vignettes/*.pdf 16 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 17 | .httr-oauth 18 | # knitr and R markdown default cache directories 19 | /*_cache/ 20 | /cache/ 21 | # Temporary files created by R markdown 22 | *.utf8.md 23 | *.knit.md 24 | .Rproj.user 25 | *.Rproj 26 | doc 27 | Meta 28 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: sen2r 2 | Type: Package 3 | Title: Find, Download and Process Sentinel-2 Data 4 | Version: 1.6.0 5 | Authors@R: c(person("Luigi", "Ranghetti", 6 | email = "rpackages.ranghetti@gmail.com", 7 | role = c("aut", "cre"), 8 | comment = c(ORCID = "0000-0001-6207-5188")), 9 | person("Lorenzo", "Busetto", 10 | role = c("aut"), 11 | comment = c(ORCID = "0000-0001-9634-6038")), 12 | person("Marina", "Ranghetti", 13 | role = c("ctb"), 14 | comment = c(ORCID = "0000-0002-5568-3887"))) 15 | Description: Functions to download Sentinel-2 optical images 16 | and perform preliminary processing operations. 17 | 'sen2r' provides the instruments required to easily perform 18 | (and eventually automate) the steps necessary to build a complete 19 | Sentinel-2 processing chain. 20 | A Graphical User Interface to facilitate data processing is also provided. 21 | For additional documentation refer to the following article: 22 | Ranghetti et al. (2020) . 23 | License: GPL-3 24 | Encoding: UTF-8 25 | URL: https://sen2r.ranghetti.info 26 | BugReports: https://github.com/ranghetti/sen2r/issues 27 | Depends: R (>= 3.5.0) 28 | Imports: 29 | methods, 30 | sf (>= 0.9.2), 31 | stars (>= 0.4.1), 32 | data.table, 33 | raster, 34 | XML, 35 | jsonlite, 36 | geojsonio, 37 | foreach, 38 | parallel, 39 | doParallel, 40 | httr, 41 | RcppTOML 42 | Suggests: 43 | leaflet, 44 | leafpm, 45 | mapedit, 46 | s2, 47 | shiny, 48 | shinyFiles, 49 | shinydashboard, 50 | shinyjs, 51 | shinyWidgets, 52 | spelling, 53 | httptest, 54 | knitr, 55 | markdown, 56 | rmarkdown, 57 | sys, 58 | tools, 59 | units, 60 | testthat (>= 2.1.0) 61 | VignetteBuilder: knitr 62 | Roxygen: list(markdown = TRUE) 63 | RoxygenNote: 7.2.3 64 | Language: en-GB 65 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/geospatial:latest 2 | 3 | LABEL maintainer="Luigi Ranghetti " 4 | 5 | # Install external dependencies 6 | RUN apt update && apt install -y \ 7 | gdal-bin \ 8 | aria2 \ 9 | libpython2-dev && \ 10 | apt autoremove -y && \ 11 | rm -rf /var/lib/apt/lists/* 12 | 13 | # Install the package 14 | RUN R -e "remotes::install_github('ranghetti/sen2r', ref = 'main', dependencies = TRUE)" 15 | 16 | # Create the user's files and settings, set runtime dependencies 17 | RUN sudo -u rstudio mkdir /home/rstudio/.sen2r && \ 18 | sudo -u rstudio R -e 'sen2r::load_binpaths(c("aria2", "gdal"))' && \ 19 | sudo -u rstudio mkdir /home/rstudio/sen2cor && \ 20 | sudo -u rstudio mkdir /home/rstudio/sen2cor/sen2cor_255 && \ 21 | sudo -u rstudio R -e 'sen2r::install_sen2cor("/home/rstudio/sen2cor/sen2cor_255", version = "2.5.5")' && \ 22 | sudo -u rstudio R -e 'tmp <- sen2r::s2_tiles()' 23 | -------------------------------------------------------------------------------- /R/check_gui_deps.R: -------------------------------------------------------------------------------- 1 | #' @title Check GUI dependencies 2 | #' @description Check if suggested dependencies required to run the 3 | #' sen2r GUI are present. 4 | #' @details Packages required to run the GUI (**`shiny`**- and 5 | #' **`leaflet`**-related packages), which were **`sen2r`** dependencies until 6 | #' version 1.3.4, are now suggested dependencies. 7 | #' **`sen2r`** can be used without them with the exception of the GUI. 8 | #' @param abort Logical parameter: if TRUE (default), the function aborts in case 9 | #' some packages need to be installed; if FALSE, a warning is shown. 10 | #' @return Logical (invisible): TRUE if all the required packages are installed, 11 | #' FALSE (if `abort = FALSE`) or an error if some is missing. 12 | #' 13 | #' @author Luigi Ranghetti, phD (2020) 14 | #' @references L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 15 | #' "sen2r": An R toolbox for automatically downloading and preprocessing 16 | #' Sentinel-2 satellite data. _Computers & Geosciences_, 139, 104473. 17 | #' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 18 | #' @note License: GPL 3.0 19 | #' @export 20 | #' @keywords internal 21 | #' @examples 22 | #' \donttest{ 23 | #' check_gui_deps() 24 | #' } 25 | 26 | check_gui_deps <- function(abort = TRUE) { 27 | 28 | # Packages required to run the GUI 29 | gui_deps <- c( 30 | "leaflet", 31 | "leafpm", 32 | "mapedit", 33 | "shiny", 34 | "shinyFiles", 35 | "shinydashboard", 36 | "shinyjs", 37 | "shinyWidgets" 38 | ) 39 | gui_deps_missing <- !sapply(gui_deps, requireNamespace, quietly = TRUE) 40 | 41 | # Install missing dependencies 42 | if (sum(gui_deps_missing) > 0) { 43 | print_message( 44 | type = ifelse(abort, "error", "warning"), 45 | "Some missing packages are needed to run the GUI; ", 46 | "please install them with the command \n", 47 | " > install.packages(c(\"", 48 | paste(names(gui_deps_missing)[gui_deps_missing], collapse = "\", \""),"\"))" 49 | ) 50 | invisible(TRUE) 51 | } else { 52 | invisible(FALSE) 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /R/comsub.R: -------------------------------------------------------------------------------- 1 | #' @title Find the longest common starting substring or directory 2 | #' @description The function search for the longest common prefix between 3 | #' multiple strings. 4 | #' @param data A vector of strings 5 | #' @param sep A character which is used to separate elements; default ("") 6 | #' is used to compare single characters; other useful alternatives are 7 | #' "/" (or "\\\\\\\\" in Windows) to find the longest common directory, or 8 | #' " " to compare words instead of characters. 9 | #' @return A character with the longest common initial substring 10 | #' 11 | #' @author Luigi Ranghetti, phD (2019) 12 | #' @references L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 13 | #' "sen2r": An R toolbox for automatically downloading and preprocessing 14 | #' Sentinel-2 satellite data. _Computers & Geosciences_, 139, 104473. 15 | #' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 16 | #' @note Modified from a suggestion taken from 17 | #' [stackoverflow](https://stackoverflow.com/questions/28273716/r-implementation-for-finding-the-longest-common-starting-substrings-in-a-set-of). 18 | #' @export 19 | #' @importFrom methods is 20 | #' 21 | #' @examples 22 | #' strings <- c("/home/user/git/sen2r", 23 | #' "/home/user/git_data/sen2r/ex/vrt/01_translate/") 24 | #' 25 | #' comsub(strings) 26 | #' 27 | #' comsub(strings, sep="/") 28 | 29 | comsub <- function(data, sep="") { 30 | . <- NULL # to avoid NOTE on check 31 | data_spl <- strsplit(data,sep) 32 | data_spl_maxlength <- max(sapply(strsplit(data,sep), length)) 33 | which_max <- if (length(unique(data)) > 1) { 34 | which.max(apply( 35 | do.call(rbind, lapply(data_spl, `length<-`, data_spl_maxlength)), 36 | 2, function(i){!length(unique(i))==1} 37 | )) -1 38 | } else { 39 | length(data_spl[[1]]) - 1 # FIXME ok for dir with "/", but not with "" 40 | } 41 | paste(c(data_spl[[1]][seq_len(which_max)],""), collapse=sep) 42 | } 43 | -------------------------------------------------------------------------------- /R/convert_datatype.R: -------------------------------------------------------------------------------- 1 | 2 | convert_datatype <- function(d) { 3 | switch( 4 | d, 5 | Byte = "INT1U", 6 | UInt16 = "INT2U", 7 | Int16 = "INT2S", 8 | UInt32 = "INT4U", 9 | Int32 = "INT4S", 10 | Float32 = "FLT4S", 11 | Float64 = "FLT8S", 12 | INT1U = "Byte", 13 | INT2U = "UInt16", 14 | INT2S = "Int16", 15 | INT4U = "UInt32", 16 | INT4S = "Int32", 17 | FLT4S = "Float32", 18 | FLT8S = "Float64" 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /R/expect_equal_crs.R: -------------------------------------------------------------------------------- 1 | #' @title Compare two non-null CRS 2 | #' @description Internal function: convenience function to compare two non-null 3 | #' CRS in tests without using EPSG (so usable with rgdal >= 1.5). 4 | #' @param crs1 CRS 1 to compare 5 | #' @param crs2 CRS 2 to compare 6 | #' @return `testthat::expect_equal()` output. 7 | #' @importFrom sf st_geometry st_read st_coordinates st_transform 8 | #' @author Luigi Ranghetti, phD (2020) 9 | #' @references L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 10 | #' "sen2r": An R toolbox for automatically downloading and preprocessing 11 | #' Sentinel-2 satellite data. _Computers & Geosciences_, 139, 104473. 12 | #' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 13 | #' @note License: GPL 3.0 14 | #' @keywords internal 15 | 16 | expect_equal_crs <- function(crs1, crs2) { 17 | ref_vec <- st_geometry(st_read( 18 | system.file("extdata/vector/barbellino.geojson", package = "sen2r"), 19 | quiet = TRUE 20 | )) 21 | testthat::expect_equal( 22 | as.integer(st_coordinates(st_transform(ref_vec, crs1))[,c("X","Y")]), 23 | as.integer(st_coordinates(st_transform(ref_vec, crs2))[,c("X","Y")]) 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /R/init_python.R: -------------------------------------------------------------------------------- 1 | #' @title Initialise python 2 | #' @description Internal function to set the environmental variables 3 | #' required to run Python-based GDAL utilities on Windows. 4 | #' @return NULL (the function is called for its side effects) 5 | #' @author Luigi Ranghetti, phD (2020) 6 | #' @references L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 7 | #' "sen2r": An R toolbox for automatically downloading and preprocessing 8 | #' Sentinel-2 satellite data. _Computers & Geosciences_, 139, 104473. 9 | #' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 10 | #' @note License: GPL 3.0 11 | #' @keywords internal 12 | 13 | init_python <- function() { 14 | 15 | # Setting environmental variables is required only on Windows 16 | if (Sys.info()["sysname"] != "Windows") { 17 | return(invisible(NULL)) 18 | } 19 | 20 | binpaths <- load_binpaths("gdal") 21 | pythonhome_new <- list.files( 22 | file.path(dirname(dirname(binpaths$gdalinfo)),"apps"), 23 | pattern="^Python", 24 | full.names=TRUE 25 | )[1] 26 | pythonhome_exi <- Sys.getenv("PYTHONHOME") 27 | if (!normalize_path(pythonhome_exi, mustWork = FALSE) %in% normalize_path(pythonhome_new, mustWork = FALSE)) { 28 | Sys.setenv(PYTHONHOME = pythonhome_new) 29 | on.exit(Sys.setenv(PYTHONHOME = pythonhome_exi)) 30 | } 31 | pythonpath_new <- list.files(pythonhome_new,"^[Ll]ib",full.names=TRUE)[1] 32 | pythonpath_exi <- Sys.getenv("PYTHONPATH") 33 | if (!normalize_path(pythonpath_exi, mustWork = FALSE) %in% normalize_path(pythonpath_new, mustWork = FALSE)) { 34 | Sys.setenv(PYTHONPATH = pythonpath_new) 35 | on.exit(Sys.setenv(PYTHONPATH = pythonpath_exi)) 36 | } 37 | path_exi <- Sys.getenv("PATH") 38 | if (!any(grepl( 39 | normalize_path(pythonhome_new, mustWork = FALSE), 40 | normalize_path(unlist(strsplit(path_exi, ";")), mustWork = FALSE), 41 | fixed=TRUE 42 | ))) { 43 | Sys.setenv(PATH = paste0(pythonhome_new,";",Sys.getenv("PATH"))) 44 | on.exit(Sys.setenv(PATH = path_exi)) 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /R/nn.R: -------------------------------------------------------------------------------- 1 | #' @title Replace NULL with character() 2 | #' @description Internal function: return character(0) instead of NULL. 3 | #' This is sometimes needed not to return error when applying some functions. 4 | #' @param x Input variable 5 | #' @return `character(0)` if `x==NULL`, `x` elsewhere 6 | #' @author Luigi Ranghetti, phD (2019) 7 | #' @references L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 8 | #' "sen2r": An R toolbox for automatically downloading and preprocessing 9 | #' Sentinel-2 satellite data. _Computers & Geosciences_, 139, 104473. 10 | #' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 11 | #' @note License: GPL 3.0 12 | #' @keywords internal 13 | #' 14 | #' @examples 15 | #' tryCatch(basename(NULL), error = print) # error 16 | #' basename(character()) # ok 17 | #' basename(sen2r:::nn(NULL)) # ok 18 | 19 | nn <- function(x) {if (is.null(x)) character(0) else x} 20 | 21 | # # Version which replaces also non-existing objects 22 | # nn <- function(x) { 23 | # if (!exists(deparse(substitute(x)))) { 24 | # character(0) 25 | # } else if (is.null(x)) { 26 | # character(0) 27 | # } else { 28 | # x 29 | # } 30 | # } 31 | -------------------------------------------------------------------------------- /R/path_check.R: -------------------------------------------------------------------------------- 1 | #' @title Check a path 2 | #' @description Accessory functions to check that a directory exists and 3 | #' the user have write permissions on it (to be used in a Shiny context) 4 | #' @param path `string` full path to a folder 5 | #' @param mustbe_empty `logical` if TRUE, accept only empty directories 6 | #' @param mustbe_writable `logical` if TRUE, accept only directories with write 7 | #' permissions 8 | #' @rdname path_check 9 | #' @author Luigi Ranghetti, phD (2019) 10 | #' @author Lorenzo Busetto, PhD (2019) 11 | #' @keywords internal 12 | path_check <- function(path, mustbe_empty = FALSE, mustbe_writable = TRUE) { 13 | 14 | if (all(length(path)>0, path[1]!="")) { 15 | if (!dir.exists(path)) { 16 | outtext <- "\u2718 (the directory does not exist)" 17 | isvalid <- FALSE 18 | } else if (mustbe_empty==TRUE & length(list.files(path, all.files = TRUE))>2) { 19 | outtext <- "\u2718 (the directory is not empty)" 20 | isvalid <- FALSE 21 | } else if (mustbe_writable == TRUE & file.access(path, mode=2)<0) { 22 | outtext <- "\u2718 (missing write permissions)" 23 | isvalid <- FALSE 24 | } else { 25 | outtext <- "\u2714" 26 | isvalid <- TRUE 27 | } 28 | # 29 | } else { 30 | outtext <- "" 31 | isvalid <- NA 32 | } 33 | 34 | out <- if (requireNamespace("shiny", quietly = TRUE)) { 35 | if (is.na(isvalid)) { 36 | shiny::renderText(outtext) 37 | } else if (isvalid) { 38 | shiny::renderUI(shiny::span(style="color:darkgreen", outtext)) 39 | } else { 40 | shiny::renderUI(shiny::span(style="color:red", outtext)) 41 | } 42 | } else { 43 | outtext 44 | } 45 | attr(out, "isvalid") <- isvalid 46 | return(out) 47 | 48 | } 49 | -------------------------------------------------------------------------------- /R/s2_defNA.R: -------------------------------------------------------------------------------- 1 | #' @title Set NA value of a specific product type 2 | #' @description Internal function to determine the NA value to be used for 3 | #' each product type (except for spectral indices, whose NA value is 4 | #' managed by [s2_calcindices]). 5 | #' @param prod_types Character vector of the input product types 6 | #' @return Numeric NA values (NA not to set any NA value), corresponding to 7 | #' `prod_types`. 8 | #' @author Luigi Ranghetti, phD (2019) 9 | #' @keywords internal 10 | #' 11 | #' @examples 12 | #' sen2r:::s2_defNA("BOA") 13 | #' sen2r:::s2_defNA(c("BOA","BOA","SCL","TCI")) 14 | 15 | 16 | s2_defNA <- function(prod_types) { 17 | 18 | sapply( 19 | prod_types, 20 | switch, 21 | BOA = 2^16-1, # default value for UInt16 22 | TOA = 2^16-1, # default value for UInt16 23 | SCL = 0, # specific for SCL 24 | TCI = 0, # no specific NA value because it is a Byte format 25 | WVP = 2^16-1, # default value for UInt16 26 | AOT = 2^16-1, # default value for UInt16 27 | CLD = 255, # default value for Byte 28 | SNW = 255, # default value for Byte 29 | SZA = -9999, # used in substitution of the default value for Float32 30 | OZA = -9999, # used in substitution of the default value for Float32 31 | SAA = -9999, # used in substitution of the default value for Float32 32 | OAA = -9999, # used in substitution of the default value for Float32 33 | 0 # default value is not yet NA because this causes errors in s2_mask 34 | ) 35 | 36 | } 37 | 38 | 39 | # # define output NA value 40 | # inraster_na <- if (is.na(NAvalue(inraster)) | NAvalue(inraster)==Inf) { 41 | # switch( 42 | # dataType(inraster), 43 | # INT1S = 127, 44 | # INT1U = 255, 45 | # INT2S = 2^15-1, 46 | # INT2U = 2^16-2, 47 | # INT4S = 2^31-1, 48 | # INT4U = 2^32, 49 | # FLT4S = 3.4e+38, 50 | # FLT8S = 1.7e+308 51 | # ) 52 | # } else if (NAvalue(inraster)==-Inf) { 53 | # switch( 54 | # dataType(inraster), 55 | # INT1S = -127, 56 | # INT1U = 0, 57 | # INT2S = -2^15-1, 58 | # INT2U = 0, 59 | # INT4S = -2^31-1, 60 | # INT4U = 0, 61 | # FLT4S = -3.4e+38, 62 | # FLT8S = -1.7e+308 63 | # ) 64 | # } else { 65 | # NAvalue(inraster) 66 | # } 67 | -------------------------------------------------------------------------------- /R/s2_download_scihub.R: -------------------------------------------------------------------------------- 1 | .s2_download_scihub <- function( 2 | s2_prodlist, s2_meta, outdir, apihub, service, downloader, abort, overwrite 3 | ) { 4 | print_message( 5 | type = "error", 6 | "The SciHub server can no longer be accessed." 7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /R/s2_list_scihub.R: -------------------------------------------------------------------------------- 1 | .s2_list_scihub <- function(spatial_extent, time_intervals, tile, orbit, max_cloud, apihub, service, availability, .s2tiles) { 2 | print_message( 3 | type = "error", 4 | "The SciHub server can no longer be accessed." 5 | ) 6 | } 7 | -------------------------------------------------------------------------------- /R/s2_order.R: -------------------------------------------------------------------------------- 1 | #' @title Order S2 products (deprecated). 2 | #' @description This function is deprecated and will be removed. 3 | #' @param s2_prodlist deprecated 4 | #' @param export_prodlist deprecated 5 | #' @param delay deprecated 6 | #' @param apihub deprecated 7 | #' @param service deprecated 8 | #' @param reorder deprecated 9 | #' @return deprecated 10 | #' @export 11 | 12 | s2_order <- function( 13 | s2_prodlist = NULL, 14 | export_prodlist = TRUE, 15 | delay = 0.5, 16 | apihub = NA, 17 | service = NA, 18 | reorder = TRUE 19 | ) { 20 | return(invisible(NULL)) 21 | } 22 | 23 | # internal function, used internally in order not to repeat the check 24 | # for online availability 25 | .s2_order <- function( 26 | s2_prodlist = NULL, 27 | export_prodlist = TRUE, 28 | delay = 0.5, 29 | apihub = NA, 30 | service = NA, 31 | reorder = TRUE, 32 | .s2_availability = NULL, 33 | .log_path = TRUE # TRUE to log all, FALSE to skip the path of the json 34 | ) { 35 | return(invisible(NULL)) 36 | } 37 | -------------------------------------------------------------------------------- /R/safe_is_online.R: -------------------------------------------------------------------------------- 1 | #' @title Check if SAFE is available for download (deprecated) 2 | #' @description This function is deprecated and will be removed. 3 | #' @param s2_prodlist deprecated 4 | #' @param apihub deprecated 5 | #' @param verbose deprecated 6 | #' @return deprecated 7 | #' @export 8 | 9 | safe_is_online <- function(s2_prodlist = NULL, apihub = NA, verbose = TRUE) { 10 | 11 | # convert input NA arguments in NULL 12 | for (a in c("s2_prodlist", "apihub")) { 13 | if (suppressWarnings(all(is.na(get(a))))) { 14 | assign(a,NULL) 15 | } 16 | } 17 | 18 | # exit if empty 19 | if (length(nn(s2_prodlist)) == 0) { 20 | return(invisible(NULL)) 21 | } 22 | 23 | # check input format 24 | s2_prodlist <- as(s2_prodlist, "safelist") 25 | # TODO add input checks 26 | 27 | # replace apihub with dhus 28 | s2_prodlist <- gsub( 29 | "((scihub)|(apihub))\\.copernicus\\.eu/apihub", 30 | "scihub.copernicus.eu/dhus", 31 | s2_prodlist 32 | ) 33 | 34 | # check for availability 35 | s2_availability <- sapply(s2_prodlist, function(p) { 36 | TRUE 37 | }) 38 | 39 | names(s2_availability) <- names(s2_prodlist) 40 | 41 | s2_availability 42 | 43 | } 44 | -------------------------------------------------------------------------------- /R/st_as_text_2.R: -------------------------------------------------------------------------------- 1 | #' @title Return WKT or WKT2 basing on the installed rgdal version 2 | #' @description This is a convenience temporary function which returns the WKT 3 | #' representation of a CRS, using `sf::st_as_text()` in case PROJ < 3, 4 | #' `rgdal::CRS()` otherwise. 5 | #' This has the advantage to perform precise transformations with PROJ >=3, 6 | #' and to avoid conversion errors 7 | #' (see [here](https://rsbivand.github.io/ECS530_h19/ECS530_III.html)). 8 | #' This function will be deleted whenever `sf` will manage WKT2. 9 | #' @param x object of class `sfg`, `sfc` or `crs` 10 | #' @param pretty logical; if TRUE, print human-readable well-known-text 11 | #' representation of a coordinate reference system 12 | #' @return Well-known Text representation of simple feature geometry or 13 | #' coordinate reference system 14 | #' @importFrom sf sf_extSoftVersion st_crs st_as_text 15 | #' @author Luigi Ranghetti, phD (2019) 16 | #' @keywords internal 17 | #' 18 | #' @examples 19 | #' sen2r:::st_as_text_2(sf::st_crs(32632)) 20 | 21 | st_as_text_2 <- function(x, pretty = FALSE) { 22 | # if ( 23 | # package_version(sf_extSoftVersion()["proj.4"]) >= 6 && 24 | # requireNamespace("rgdal", quietly = TRUE) && 25 | # packageVersion("rgdal") >= 1.5 26 | # ) { 27 | # x_crs <- st_crs(x) 28 | # x_proj <- if (is.na(x_crs$epsg)) { 29 | # x_crs$proj4string 30 | # } else { 31 | # paste0("EPSG:",x_crs$epsg) 32 | # } 33 | # srid_multiline <- if (pretty == TRUE) {"YES"} else {"NO"} 34 | # eval(parse( 35 | # text = "rgdal::showSRID(x_proj, format = 'WKT2', multiline = srid_multiline)" 36 | # )) 37 | # } else { 38 | st_as_text(x, pretty = pretty) 39 | # } 40 | } 41 | -------------------------------------------------------------------------------- /R/str_pad2.R: -------------------------------------------------------------------------------- 1 | #' @title Pad a string. 2 | #' @description Vectorised over `string`, `width` and `pad`. 3 | #' This is an internal function doing the same thing of `str_pad()` 4 | #' function in package `stringr` 5 | #' (except for parameters `'width'` and `'length'` which must be of length 1), 6 | #' but without depending on package `stringi`. 7 | #' @param string A character vector. 8 | #' @param width Minimum width of padded strings. 9 | #' @param side Side on which padding character is added (left, right or both). 10 | #' @param pad Single padding character (default is a space). 11 | #' @return A character vector. 12 | #' @author Luigi Ranghetti, phD (2019) 13 | #' @references L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 14 | #' "sen2r": An R toolbox for automatically downloading and preprocessing 15 | #' Sentinel-2 satellite data. _Computers & Geosciences_, 139, 104473. 16 | #' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 17 | #' @note License: GPL 3.0 18 | #' @export 19 | #' @examples 20 | #' rbind( 21 | #' str_pad2("hadley", 30, "left"), 22 | #' str_pad2("hadley", 30, "right"), 23 | #' str_pad2("hadley", 30, "both") 24 | #' ) 25 | #' 26 | #' # All arguments are vectorised except side 27 | #' str_pad2(c("a", "abc", "abcdef"), 10) 28 | #' 29 | #' # Longer strings are returned unchanged 30 | #' str_pad2("hadley", 3) 31 | str_pad2 <- function (string, width, side = c("left", "right", "both"), pad = " ") { 32 | side <- match.arg(side) 33 | if (length(width)>1) { 34 | warning("'width' must be of length 1 (first element is taken).") 35 | width <- width[1] 36 | } 37 | if (length(pad)>1) { 38 | warning("'pad' must be of length 1 (first element is taken).") 39 | pad <- pad[1] 40 | } 41 | sapply(string, function(sel_string) { 42 | s_length <- nchar(sel_string) 43 | pad_length <- max(0, width - s_length) 44 | paste( 45 | if (side == "left") { 46 | c(rep(pad, pad_length), sel_string) 47 | } else if (side == "right") { 48 | c(sel_string, rep(pad, pad_length)) 49 | } else if (side == "both") { 50 | c(rep(pad, floor(pad_length/2)), sel_string, rep(pad, ceiling(pad_length/2))) 51 | }, 52 | collapse = "" 53 | ) 54 | }) 55 | } 56 | -------------------------------------------------------------------------------- /R/suppress_warnings.R: -------------------------------------------------------------------------------- 1 | #' @title Selective suppress warnings 2 | #' @description Suppress warnings matching particular regular expressions. 3 | #' @details See https://stackoverflow.com/questions/16517795/selective-suppresswarnings-that-filters-by-regular-expression 4 | #' @param .expr Code to evaluate 5 | #' @param .f A regular expression (which will be passed to `grepl()`). 6 | #' @return The warning message as character string, invisibly. 7 | #' @keywords internal 8 | suppress_warnings <- function(.expr, .f) { 9 | eval.parent(substitute( 10 | withCallingHandlers( .expr, warning = function(w) { 11 | cm <- conditionMessage(w) 12 | # cond <- 13 | # if(is.character(.f)) grepl(.f, cm) else rlang::as_function(.f)(cm,...) 14 | # (simplified to avoid calling rlang) 15 | cond <- grepl(.f, cm) 16 | if (cond) { 17 | invokeRestart("muffleWarning") 18 | } 19 | }) 20 | )) 21 | } 22 | -------------------------------------------------------------------------------- /R/tile_utmzone.R: -------------------------------------------------------------------------------- 1 | #' @title Obtain the UTM zone associated to Sentinel-2 tiles 2 | #' @description Internal function: convenience function to obtain the UTM zone 3 | #' from tile IDs. 4 | #' @param tile_id Character: tile ID (5 chars), e.g. `"32TNR"` (multiple values 5 | #' can be provided). 6 | #' @return A vector of the same length of `tile_id` with UTM zones (e.g. `"32N`"). 7 | #' @author Luigi Ranghetti, phD (2020) 8 | #' @references L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 9 | #' "sen2r": An R toolbox for automatically downloading and preprocessing 10 | #' Sentinel-2 satellite data. _Computers & Geosciences_, 139, 104473. 11 | #' \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 12 | #' @note License: GPL 3.0 13 | #' @keywords internal 14 | 15 | tile_utmzone <- function(tile_id) { 16 | paste0( 17 | substr(tile_id,1,2), 18 | ifelse(substr(tile_id,3,3) %in% LETTERS[1:13], "S", "N") 19 | ) 20 | } 21 | 22 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onAttach <- function(libname, pkgname) { 2 | 3 | # If sen2r settings dir does not exist, ask for creating it 4 | invisible(give_write_permission()) 5 | 6 | # Welcome message 7 | packageStartupMessage(paste( 8 | "Welcome to sen2r. To use the package from a GUI, launch", 9 | " > sen2r()", 10 | "Documentation: https://sen2r.ranghetti.info", 11 | "\nIMPORTANT: since November 2023, SAFE archives can no longer", 12 | "be downloaded from the ESA Hub, so Google Cloud is the new default server.", 13 | "To be able to search and download inputs: ", 14 | "- install Google Cloud SDK (https://cloud.google.com/sdk/docs/install);", 15 | "- configure sen2r to use Google Cloud SDK launching the function:", 16 | " > check_gcloud()", 17 | # if (all( 18 | # Sys.info()["sysname"] %in% c("Windows", "Darwin"), 19 | # length(load_binpaths()) == 0 20 | # )) { 21 | # paste( 22 | # "\nIMPORTANT: sen2r depends on some external tools;", 23 | # "before using it, it is strongly recommended to run function", 24 | # " > check_sen2r_deps()", 25 | # "to check them and install the missing ones.", 26 | # sep = "\n" 27 | # ) 28 | # }, 29 | sep = "\n" 30 | )) 31 | 32 | } 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sen2r End Of Life 2 | 3 | sen2r will be retired from CRAN by the end of 2023. The code will remain available at this repository, but no assistance will be provided in case of errors. Please do not send emails about that. 4 | 5 | Thank you to all sen2r users. 6 | -------------------------------------------------------------------------------- /_pkgdown.yaml: -------------------------------------------------------------------------------- 1 | title: "sen2r" 2 | template: 3 | params: 4 | bootswatch: yeti 5 | reference: 6 | - title: Automatic processing chain 7 | desc: ~ 8 | contents: 9 | - sen2r 10 | - title: Find and download Sentinel-2 products 11 | desc: ~ 12 | contents: 13 | - s2_list 14 | - s2_download 15 | - s2_order 16 | - sen2cor 17 | - safe_is_online 18 | - read_scihub_login 19 | - title: Read and convert SAFE format 20 | desc: ~ 21 | contents: 22 | - s2_translate 23 | - s2_merge 24 | - gdal_warp 25 | - s2_mask 26 | - s2_rgb 27 | - s2_calcindices 28 | - s2_thumbnails 29 | - title: Manage file names and metadata 30 | desc: ~ 31 | contents: 32 | - safe_getMetadata 33 | - safe_shortname 34 | - raster_metadata 35 | - sen2r_getElements 36 | - s2_dop 37 | - s2_tiles 38 | - title: Install and configure dependencies 39 | desc: ~ 40 | contents: 41 | - check_sen2r_deps 42 | - load_binpaths 43 | - install_sen2cor 44 | - install_aria2 45 | - check_gdal 46 | - check_gcloud 47 | - set_gipp 48 | - title: Accessory functions 49 | desc: ~ 50 | contents: 51 | - build_example_param_file 52 | - s2_gui 53 | - list_indices 54 | - tiles_intersects 55 | - title: Generic accessory functions 56 | desc: ~ 57 | contents: 58 | - gdalUtil 59 | - expand_path 60 | - comsub 61 | - abs2rel 62 | - gdal_abs2rel 63 | - mountpoint 64 | - st_crs2 65 | - str_pad2 66 | - normalize_path 67 | navbar: 68 | type: inverse 69 | left: [] 70 | right: 71 | - icon: fa-home fa-lg 72 | href: index.html 73 | - text: "\u2000Reference" 74 | icon: fa-file-code 75 | href: reference/index.html 76 | - text: "\u2000Articles" 77 | icon: fa-book 78 | menu: 79 | - text: "Installation" 80 | href: articles/installation.html 81 | - text: "Run in a Docker container" 82 | href: articles/docker.html 83 | - text: "Using sen2r() from the GUI" 84 | href: articles/sen2r_gui.html 85 | - text: "Using sen2r() from the command line" 86 | href: articles/sen2r_cmd.html 87 | - text: "Output file structure" 88 | href: articles/outstructure.html 89 | - text: "\u2000Changelog" 90 | icon: fa-newspaper 91 | href: news/index.html 92 | - icon: fa-user 93 | href: http://luigi.ranghetti.info 94 | - icon: fa-github fa-lg 95 | href: https://github.com/ranghetti/sen2r/ 96 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | # sen2r v. 1.6.0 2 | 3 | 4 | ## Test environments 5 | * [local installation] Windows 11, 64 bit, R 4.3.2: 6 | There were no ERRORs, WARNINGs nor NOTEs. 7 | * [local installation] Ubuntu 22.04.3, 64 bit, R 4.3.2: 8 | There were no ERRORs, WARNINGs nor NOTEs. 9 | * [macbuilder] macOS 13.3.1 (Mac mini Apple M1), 64 bit, R 4.3.0 10 | (`https://mac.r-project.org/macbuilder/results/1699566676-0896ab0a4ed31615/`): 11 | There were no ERRORs, WARNINGs nor NOTEs. 12 | * [devtools] `check_win_devel()` 13 | (`https://win-builder.r-project.org/iv0nUfgl4D12`): 14 | There were no ERRORs, WARNINGs nor NOTEs. 15 | * [devtools] `check_win_release()` 16 | (`https://win-builder.r-project.org/6rXK4RskI2wd`): 17 | There were no ERRORs, WARNINGs nor NOTEs. 18 | * [devtools] `check_win_oldrelease()` 19 | (`https://win-builder.r-project.org/KqRJiYhQh60e/`): 20 | There were no ERRORs, WARNINGs nor NOTEs. 21 | -------------------------------------------------------------------------------- /docs/articles/docker_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/docker_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/docker_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/docker_files/header-attrs-2.4/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/docker_files/header-attrs-2.5/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/docker_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/docker_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/installation_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/installation_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/installation_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/installation_files/header-attrs-2.4/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/installation_files/header-attrs-2.5/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/installation_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/installation_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/header-attrs-2.1/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/header-attrs-2.4/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/header-attrs-2.5/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/outstructure_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_cmd_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/sen2r_cmd_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/sen2r_cmd_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/sen2r_cmd_files/header-attrs-2.4/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_cmd_files/header-attrs-2.5/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_cmd_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_cmd_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_gui_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/sen2r_gui_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/sen2r_gui_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/sen2r_gui_files/header-attrs-2.4/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_gui_files/header-attrs-2.5/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_gui_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/sen2r_gui_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/man/figures/sen2r_gui_sheet1_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/man/figures/sen2r_gui_sheet1_small.png -------------------------------------------------------------------------------- /docs/man/figures/sen2r_gui_sheet2_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/man/figures/sen2r_gui_sheet2_small.png -------------------------------------------------------------------------------- /docs/man/figures/sen2r_gui_sheet3_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/man/figures/sen2r_gui_sheet3_small.png -------------------------------------------------------------------------------- /docs/man/figures/sen2r_gui_sheet4_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/man/figures/sen2r_gui_sheet4_small.png -------------------------------------------------------------------------------- /docs/man/figures/sen2r_gui_sheet5_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/man/figures/sen2r_gui_sheet5_small.png -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.1 2 | pkgdown: 2.0.7 3 | pkgdown_sha: ~ 4 | articles: 5 | docker: docker.html 6 | installation: installation.html 7 | outstructure: outstructure.html 8 | sen2r_cmd: sen2r_cmd.html 9 | sen2r_gui: sen2r_gui.html 10 | last_built: 2023-11-09T21:25Z 11 | 12 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Rplot002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/Rplot002.png -------------------------------------------------------------------------------- /docs/reference/Rplot003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/Rplot003.png -------------------------------------------------------------------------------- /docs/reference/Rplot004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/Rplot004.png -------------------------------------------------------------------------------- /docs/reference/Rplot005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/Rplot005.png -------------------------------------------------------------------------------- /docs/reference/Rplot006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/Rplot006.png -------------------------------------------------------------------------------- /docs/reference/figures/irea_logo_200px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/irea_logo_200px.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet1.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet1_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet1_small.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet2.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet2_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet2_small.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet3.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet3_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet3_small.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet4.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet4_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet4_small.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet5.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_gui_sheet5_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_gui_sheet5_small.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_logo_1000px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_logo_1000px.png -------------------------------------------------------------------------------- /docs/reference/figures/sen2r_logo_200px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/figures/sen2r_logo_200px.png -------------------------------------------------------------------------------- /docs/reference/gdalUtil-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdalUtil-1.png -------------------------------------------------------------------------------- /docs/reference/gdalUtil-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdalUtil-2.png -------------------------------------------------------------------------------- /docs/reference/gdalUtil-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdalUtil-3.png -------------------------------------------------------------------------------- /docs/reference/gdal_warp-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdal_warp-1.png -------------------------------------------------------------------------------- /docs/reference/gdal_warp-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdal_warp-2.png -------------------------------------------------------------------------------- /docs/reference/gdal_warp-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdal_warp-3.png -------------------------------------------------------------------------------- /docs/reference/gdal_warp-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdal_warp-4.png -------------------------------------------------------------------------------- /docs/reference/gdalwarp_grid-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/gdalwarp_grid-1.png -------------------------------------------------------------------------------- /docs/reference/s2_calcindices-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/s2_calcindices-1.png -------------------------------------------------------------------------------- /docs/reference/s2_mask-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/s2_mask-1.png -------------------------------------------------------------------------------- /docs/reference/s2_rgb-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/s2_rgb-1.png -------------------------------------------------------------------------------- /docs/reference/s2_tiles-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/s2_tiles-1.png -------------------------------------------------------------------------------- /docs/reference/sen2r-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/sen2r-1.png -------------------------------------------------------------------------------- /docs/reference/sen2r-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/sen2r-2.png -------------------------------------------------------------------------------- /docs/reference/sen2r-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/sen2r-3.png -------------------------------------------------------------------------------- /docs/reference/sen2r-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/sen2r-4.png -------------------------------------------------------------------------------- /docs/reference/sen2r-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/sen2r-5.png -------------------------------------------------------------------------------- /docs/reference/sen2r-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/sen2r-6.png -------------------------------------------------------------------------------- /docs/reference/tiles_intersects-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/tiles_intersects-1.png -------------------------------------------------------------------------------- /docs/reference/tiles_intersects-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/docs/reference/tiles_intersects-2.png -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader(paste( 2 | "sen2r is being developed by Luigi Ranghetti and Lorenzo Busetto (IREA-CNR),", 3 | "and it is released under the GNU General Public License version 3 (GPL‑3).", 4 | "To cite package 'sen2r' in publications use:" 5 | )) 6 | 7 | bibentry( 8 | bibtype = "Article", 9 | author = "Luigi Ranghetti and Mirco Boschetti and Francesco Nutini and Lorenzo Busetto", 10 | title = "sen2r: An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data", 11 | journal = "Computers & Geosciences", 12 | year = "2020", 13 | volume = "139", 14 | pages = "104473", 15 | doi = "10.1016/j.cageo.2020.104473", 16 | url = "https://sen2r.ranghetti.info", 17 | textVersion = paste( 18 | "L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020).", 19 | "sen2r: An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data.", 20 | "Computers & Geosciences, 139, 104473.", 21 | "doi: 10.1016/j.cageo.2020.104473, URL: https://sen2r.ranghetti.info/." 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | AOT 2 | ArchLinux 3 | BDred 4 | Barbellino 5 | BigTIFF 6 | Boschetti 7 | CGIAR 8 | CLD 9 | CMD 10 | CNR 11 | CRS 12 | CRred 13 | DEM 14 | DOY 15 | Dockerfile 16 | ENVI 17 | EPSG 18 | EVI 19 | EXTNAME 20 | GDAL 21 | GEOMETRYCOLLECTION 22 | GIPP 23 | GTiff 24 | GeoTIFF 25 | Hagolle 26 | Homebrew 27 | IDB 28 | IREA 29 | ISI 30 | Int 31 | JP 32 | LTA 33 | MSAVI 34 | MathML 35 | NDBI 36 | NDMI 37 | NDVI 38 | NDVIre 39 | NDWI 40 | NIR 41 | NMDI 42 | NetCDF 43 | Nutini 44 | OSGeo 45 | PROJ 46 | RGBb 47 | RGBrgbX 48 | RGBrgbx 49 | RStudio 50 | RasterBrick 51 | RasterLayer 52 | Reflectances 53 | SALTO 54 | SCL 55 | SNW 56 | SRTM 57 | STAC 58 | SWIR 59 | Schwalb 60 | SciHub 61 | Sen 62 | ShareAlike 63 | Standalone 64 | TCI 65 | TCIdx 66 | TOA 67 | TOML 68 | TQQ 69 | VRT 70 | WDRVI 71 | WKT 72 | WVP 73 | Wget 74 | Willmann 75 | Xenial 76 | Zscore 77 | anymore 78 | apihub 79 | bbox 80 | binpaths 81 | bufferise 82 | builtin 83 | cageo 84 | cairo 85 | calc 86 | calcindices 87 | com 88 | cpt 89 | crs 90 | dat 91 | datatype 92 | db 93 | dem 94 | dialog 95 | dialogs 96 | difftime 97 | dir 98 | dockerised 99 | doi 100 | donttest 101 | doy 102 | dstnodata 103 | envi 104 | epsg 105 | etc 106 | fasterize 107 | fff 108 | fidolasen 109 | gdal 110 | gdalUtils 111 | gdalwarp 112 | gdtools 113 | geoJSON 114 | geojsonio 115 | geojsonlint 116 | georeferenced 117 | gui 118 | httr 119 | idx 120 | infiles 121 | init 122 | jq 123 | jqr 124 | json 125 | kmz 126 | libcurl 127 | libxml 128 | maskfile 129 | mll 130 | modaldialog 131 | mountpoint 132 | multiband 133 | multiplicated 134 | ncdf 135 | ndsi 136 | nodata 137 | nomask 138 | notordered 139 | oldname 140 | opencpu 141 | openssl 142 | org 143 | osgeo 144 | ot 145 | outformat 146 | phD 147 | prj 148 | proba 149 | proj 150 | protobuf 151 | protolite 152 | px 153 | radiobutton 154 | rds 155 | reflectances 156 | reproject 157 | reprojected 158 | reprojecting 159 | reprojection 160 | reprojections 161 | res 162 | rgb 163 | rgdal 164 | rmtmp 165 | rr 166 | rrr 167 | safelist 168 | sen 169 | sfc 170 | shinyfiles 171 | shortname 172 | singleband 173 | singlecore 174 | singlegranule 175 | sp 176 | st 177 | stackoverflow 178 | standalone 179 | str 180 | subdir 181 | suppresswarnings 182 | th 183 | threating 184 | thunderforest 185 | timewindow 186 | timezones 187 | tmpdir 188 | troublings 189 | ubuntugis 190 | unrequired 191 | vrt 192 | yyyymmdd 193 | -------------------------------------------------------------------------------- /inst/extdata/out/S2A1C_20170703_022_Barbellino_RGB432T_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A1C_20170703_022_Barbellino_RGB432T_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A1C_20170703_022_Barbellino_TOA_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A1C_20170703_022_Barbellino_TOA_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A1C_20190723_022_Barbellino_RGB432T_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A1C_20190723_022_Barbellino_RGB432T_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A1C_20190723_022_Barbellino_TOA_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A1C_20190723_022_Barbellino_TOA_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20170703_022_Barbellino_BOA_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20170703_022_Barbellino_BOA_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20170703_022_Barbellino_MSAVI2_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20170703_022_Barbellino_MSAVI2_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20170703_022_Barbellino_NDVI_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20170703_022_Barbellino_NDVI_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20170703_022_Barbellino_RGB432B_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20170703_022_Barbellino_RGB432B_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20170703_022_Barbellino_RGB843B_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20170703_022_Barbellino_RGB843B_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20170703_022_Barbellino_SCL_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20170703_022_Barbellino_SCL_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20190723_022_Barbellino_MSAVI2_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20190723_022_Barbellino_MSAVI2_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20190723_022_Barbellino_NDVI_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20190723_022_Barbellino_NDVI_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20190723_022_Barbellino_RGB432B_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20190723_022_Barbellino_RGB432B_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20190723_022_Barbellino_RGB843B_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20190723_022_Barbellino_RGB843B_10.tif -------------------------------------------------------------------------------- /inst/extdata/out/S2A2A_20190723_022_Barbellino_SCL_10.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/extdata/out/S2A2A_20190723_022_Barbellino_SCL_10.tif -------------------------------------------------------------------------------- /inst/extdata/palettes/NDVI.cpt: -------------------------------------------------------------------------------- 1 | # COLOR_MODEL = RGB 2 | -1 5 24 82 -0.3 5 24 82 3 | -0.3 5 24 82 -0.18 255 255 255 4 | -0.18 255 255 255 0 255 255 255 5 | 0 255 255 255 0.025 206 197 180 6 | 0.025 206 197 180 0.075 191 163 124 7 | 0.075 191 163 124 0.125 179 174 96 8 | 0.125 179 174 96 0.15 163 181 80 9 | 0.15 163 181 80 0.175 144 170 60 10 | 0.175 144 170 60 0.233333 166 195 29 11 | 0.233333 166 195 29 0.266667 135 183 3 12 | 0.266667 135 183 3 0.333333 121 175 1 13 | 0.333333 121 175 1 0.366667 101 163 0 14 | 0.366667 101 163 0 0.433333 78 151 0 15 | 0.433333 78 151 0 0.466667 43 132 4 16 | 0.466667 43 132 4 0.55 0 114 0 17 | 0.55 0 114 0 0.65 0 90 1 18 | 0.65 0 90 1 0.75 0 73 0 19 | 0.75 0 73 0 0.85 0 56 0 20 | 0.85 0 56 0 0.95 0 31 0 21 | 0.95 0 31 0 1 0 0 0 22 | N 255 0 0 23 | -------------------------------------------------------------------------------- /inst/extdata/palettes/SCL.txt: -------------------------------------------------------------------------------- 1 | 0 0 0 0 2 | 1 255 0 0 3 | 2 66 65 66 4 | 3 99 52 0 5 | 4 41 243 41 6 | 5 255 255 0 7 | 6 0 0 255 8 | 7 123 125 123 9 | 8 189 190 189 10 | 9 255 255 255 11 | 10 99 203 255 12 | 11 255 154 255 13 | nv 0 0 0 14 | -------------------------------------------------------------------------------- /inst/extdata/palettes/WVP.cpt: -------------------------------------------------------------------------------- 1 | # COLOR_MODEL = RGB 2 | -1 166 97 26 -0.9 192 40 70 3 | -0.9 192 40 70 -0.8 217 183 114 4 | -0.8 217 183 114 -0.7 231 211 165 5 | -0.7 231 211 165 -0.6 241 234 219 6 | -0.6 241 234 219 -0.4 219 237 234 7 | -0.4 219 237 234 -0.2 167 219 211 8 | -0.2 167 219 211 0.2 114 197 184 9 | 0.2 114 197 184 0.6 57 165 189 10 | 0.6 57 165 189 1 1 133 113 11 | N 0 0 0 12 | -------------------------------------------------------------------------------- /inst/extdata/palettes/Zscore.cpt: -------------------------------------------------------------------------------- 1 | # COLOR_MODEL = RGB 2 | -1 96 0 0 -0.6667 215 25 28 3 | -0.6667 215 25 28 -0.3333 253 174 97 4 | -0.3333 253 174 97 0 255 255 208 5 | 0 255 255 208 0.3333 166 217 106 6 | 0.3333 166 217 106 0.6667 0 128 0 7 | 0.6667 0 128 0 1 0 48 0 8 | N 255 255 255 9 | -------------------------------------------------------------------------------- /inst/extdata/palettes/bw.cpt: -------------------------------------------------------------------------------- 1 | # COLOR_MODEL = RGB 2 | -1 0 0 0 1 255 255 255 3 | N 255 255 0 4 | -------------------------------------------------------------------------------- /inst/extdata/palettes/diff.cpt: -------------------------------------------------------------------------------- 1 | # COLOR_MODEL = RGB 2 | -9999 0 0 0 -9999 0 0 0 3 | -3 7 0 51 -2.8 17 0 79 4 | -2.8 17 0 79 -2.6 25 0 107 5 | -2.6 25 0 107 -2.4 28 0 135 6 | -2.4 28 0 135 -2.2 25 0 163 7 | -2.2 25 0 163 -2 22 0 191 8 | -2 22 0 191 -1.8 15 0 219 9 | -1.8 15 0 219 -1.6 2 0 247 10 | -1.6 2 0 247 -1.4 20 33 255 11 | -1.4 20 33 255 -1.2 56 76 255 12 | -1.2 56 76 255 -1 89 117 255 13 | -1 89 117 255 -0.8 122 153 255 14 | -0.8 122 153 255 -0.6 155 186 255 15 | -0.6 155 186 255 -0.4 191 211 255 16 | -0.4 191 211 255 -0.2 224 237 255 17 | -0.2 224 237 255 0 255 255 255 18 | 0 255 255 255 0.2 255 237 224 19 | 0.2 255 237 224 0.4 255 211 191 20 | 0.4 255 211 191 0.6 255 186 155 21 | 0.6 255 186 155 0.8 255 153 122 22 | 0.8 255 153 122 1 255 117 89 23 | 1 255 117 89 1.2 255 76 56 24 | 1.2 255 76 56 1.4 255 33 20 25 | 1.4 255 33 20 1.6 247 0 2 26 | 1.6 247 0 2 1.8 219 0 15 27 | 1.8 219 0 15 2 191 0 22 28 | 2 191 0 22 2.2 163 0 25 29 | 2.2 163 0 25 2.4 135 0 28 30 | 2.4 135 0 28 2.6 107 0 25 31 | 2.6 107 0 25 2.8 79 0 17 32 | 2.8 79 0 17 3 53 0 7 33 | -------------------------------------------------------------------------------- /inst/extdata/vector/barbellino.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "name": "barbellino", 4 | "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::32632" } }, 5 | "features": [ 6 | { "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 580560.0, 5101700.0 ], [ 580680.0, 5101700.0 ], [ 580800.0, 5101820.0 ], [ 580800.0, 5102120.0 ], [ 580660.0, 5102120.0 ], [ 580560.0, 5102020.0 ], [ 580560.0, 5101700.0 ] ] ] } } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /inst/extdata/vector/dam.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "name": "dam", 4 | "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::32632" } }, 5 | "features": [ 6 | { "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 580645.8, 5101790.6 ], [ 580684.1, 5101861.0 ], [ 580692.1, 5101954.3 ], [ 580669.2, 5102043.9 ], [ 580655.6, 5102037.1 ], [ 580668.6, 5101977.1 ], [ 580661.8, 5101940.1 ], [ 580634.6, 5101914.8 ], [ 580621.7, 5101870.3 ], [ 580645.8, 5101790.6 ] ] ] } } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /inst/www/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/www/favicon.ico -------------------------------------------------------------------------------- /inst/www/images/irea_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/www/images/irea_logo.png -------------------------------------------------------------------------------- /inst/www/images/mask_types.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/www/images/mask_types.jpg -------------------------------------------------------------------------------- /inst/www/images/sen2r_logo_200px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/inst/www/images/sen2r_logo_200px.png -------------------------------------------------------------------------------- /man/abs2rel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/abs2rel.R 3 | \name{abs2rel} 4 | \alias{abs2rel} 5 | \title{Convert a path to a relative path} 6 | \usage{ 7 | abs2rel(path, ref_path, mustWork = NA) 8 | } 9 | \arguments{ 10 | \item{path}{The path to be converted (if it is not absolute, 11 | the current working directory is considered as its parent, and a 12 | warning is shown).} 13 | 14 | \item{ref_path}{The reference path to be compared to 15 | \code{path} to obtain the relative directory. 16 | \emph{Important}: the path is considered as a directory 17 | also if it is the path of a file!} 18 | 19 | \item{mustWork}{(optional) logical: if TRUE an error is given 20 | if \code{path} or \code{ref_path} do not exists; if NA (default) then a 21 | warning; if FALSE nothing is shown.} 22 | } 23 | \value{ 24 | The relative path 25 | } 26 | \description{ 27 | The function convert an absolute path to a relative path 28 | in respect to a reference. The longest common parent directory is 29 | taken as reference. Symbolic links are converted to original paths 30 | before performing the operation. 31 | } 32 | \note{ 33 | License: GPL 3.0 34 | } 35 | \examples{ 36 | # the reference path 37 | (ref_path <- system.file(package="sf")) 38 | # a path with a common parent with ref_path 39 | (in_path_1 <- system.file(package="stars")) 40 | # a path included in ref_path 41 | (in_path_2 <- system.file("DESCRIPTION", package="sf")) 42 | # a path external to ref_path (in Linux) 43 | (in_path_3 <- system.file(package="base")) 44 | # an unexisting path 45 | (in_path_4 <- gsub("sf$","unexistingpackage",ref_path)) 46 | 47 | abs2rel(in_path_1, ref_path) 48 | 49 | abs2rel(in_path_2, ref_path) 50 | 51 | suppressWarnings(abs2rel(in_path_3, ref_path)) 52 | 53 | suppressWarnings(abs2rel(in_path_4, ref_path, mustWork=FALSE)) 54 | 55 | suppressWarnings(abs2rel(ref_path, ref_path)) 56 | } 57 | \references{ 58 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 59 | "sen2r": An R toolbox for automatically downloading and preprocessing 60 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 61 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 62 | } 63 | \author{ 64 | Luigi Ranghetti, phD (2017) \email{luigi.ranghetti@gmail.com} 65 | } 66 | -------------------------------------------------------------------------------- /man/add_rgb_image.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/add_rgb_image.R 3 | \name{add_rgb_image} 4 | \alias{add_rgb_image} 5 | \title{Add RGB product} 6 | \usage{ 7 | add_rgb_image(s2_bands) 8 | } 9 | \arguments{ 10 | \item{s2_bands}{2-length list (one for TOA, one for BOA), 11 | each element being a list of S2 bands, as defined in \link{s2_gui}.} 12 | } 13 | \description{ 14 | Modal dialog to define an RGB image. 15 | } 16 | \note{ 17 | License: GPL 3.0 18 | } 19 | \references{ 20 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 21 | "sen2r": An R toolbox for automatically downloading and preprocessing 22 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 23 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 24 | } 25 | \author{ 26 | Luigi Ranghetti, phD (2019) 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/build_example_param_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/build_example_param_file.R 3 | \name{build_example_param_file} 4 | \alias{build_example_param_file} 5 | \title{Build an example JSON parameter file} 6 | \usage{ 7 | build_example_param_file( 8 | json_path = tempfile(fileext = "_sen2r_params.json"), 9 | overwrite = TRUE 10 | ) 11 | } 12 | \arguments{ 13 | \item{json_path}{Path of the output file. Default is to save it on a 14 | temporary file, whose path is returned.} 15 | 16 | \item{overwrite}{Logical value: should existing output file be 17 | overwritten? (default: TRUE)} 18 | } 19 | \value{ 20 | The path of the created file. 21 | } 22 | \description{ 23 | Function used to write JSON parameter file. 24 | A function is provided instead than a json file to ensure 25 | directories to match the user folder tree. 26 | } 27 | \note{ 28 | License: GPL 3.0 29 | } 30 | \examples{ 31 | build_example_param_file() 32 | } 33 | \references{ 34 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 35 | "sen2r": An R toolbox for automatically downloading and preprocessing 36 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 37 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 38 | } 39 | \author{ 40 | Luigi Ranghetti, phD (2019) 41 | } 42 | -------------------------------------------------------------------------------- /man/calcindex.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/calcindex.R 3 | \name{calcindex_raster} 4 | \alias{calcindex_raster} 5 | \alias{calcindex_stars} 6 | \title{Compute index using \code{raster} or \code{stars} features} 7 | \usage{ 8 | calcindex_raster( 9 | x, 10 | sel_formula, 11 | out_file, 12 | NAflag = -32768, 13 | sel_format = "GTiff", 14 | compress = "LZW", 15 | datatype = "Int32", 16 | bigtiff = FALSE, 17 | overwrite = FALSE, 18 | minrows = NULL 19 | ) 20 | 21 | calcindex_stars( 22 | x, 23 | sel_formula, 24 | out_file, 25 | NAflag = -32768, 26 | sel_format = "GTiff", 27 | compress = "LZW", 28 | datatype = "Int16", 29 | bigtiff = FALSE, 30 | overwrite = FALSE 31 | ) 32 | } 33 | \arguments{ 34 | \item{x}{Input file path, or \code{RasterLayer} (in \code{calcindex_raster()}) or 35 | \code{stars} (in \code{calcindex_stars()}).} 36 | 37 | \item{sel_formula}{Formula used to compute output raster 38 | (specific formats are used - documentation will be improved).} 39 | 40 | \item{out_file}{Output file path.} 41 | 42 | \item{NAflag}{(optional)} 43 | 44 | \item{sel_format}{(optional) Format of the output file (in a 45 | format recognised by GDAL). Default "GTiff".} 46 | 47 | \item{compress}{(optional) In the case a GTiff format is 48 | present, the compression indicated with this parameter is used.} 49 | 50 | \item{datatype}{(optional) Numeric datatype of the output rasters 51 | (see \code{s2_calcindices()}).} 52 | 53 | \item{bigtiff}{(optional) Logical: if TRUE, the creation of a BigTIFF is 54 | forced (default is FALSE). 55 | This option is used only in the case a GTiff format was chosen.} 56 | 57 | \item{overwrite}{Logical value: should existing output files be 58 | overwritten? (default: FALSE)} 59 | 60 | \item{minrows}{(optional) parameter passed to \code{blockSize()}.} 61 | } 62 | \value{ 63 | NULL (the function is called for its side effects) 64 | } 65 | \description{ 66 | Internal functions used to compute spectral indices and 67 | thumbnails through \code{raster} or \code{stars} features. 68 | } 69 | \note{ 70 | License: GPL 3.0 71 | } 72 | \references{ 73 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 74 | "sen2r": An R toolbox for automatically downloading and preprocessing 75 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 76 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 77 | } 78 | \author{ 79 | Luigi Ranghetti, phD (2020) 80 | } 81 | \keyword{internal} 82 | -------------------------------------------------------------------------------- /man/check_gdal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/check_gdal.R 3 | \name{check_gdal} 4 | \alias{check_gdal} 5 | \title{Check GDAL installation} 6 | \usage{ 7 | check_gdal(abort = TRUE, gdal_path = NULL, force = FALSE, full_scan = FALSE) 8 | } 9 | \arguments{ 10 | \item{abort}{Logical parameter: if TRUE (default), the function aborts 11 | in case no GDAL installation is found; if FALSE, a warning is shown 12 | and FALSE is returned.} 13 | 14 | \item{gdal_path}{(optional) Character: the path in which GDAL must be 15 | searched in. If NULL (default), search is performed in the whole file system.} 16 | 17 | \item{force}{(optional) Logical: if TRUE, install even if it is already 18 | installed (default is FALSE). Notice that, defining \code{gdal_path}, GDAL is 19 | searched again even if \code{"force" = FALSE} in case the existing installation 20 | is not in \code{gdal_path}.} 21 | 22 | \item{full_scan}{(optional) Logical: in Linux and MacOS, if \code{gdal_path} was 23 | not manually defined, GDAL is searched within the system path in case this 24 | argument is left to default value FALSE; instead, if TRUE, a full search is 25 | performed. In Windows, if the default OSGeo directory \verb{C:\\\\OSGeo4W64} exists, 26 | GDAL is searched there, otherwise in the main directory \verb{C:\\\\}; setting 27 | \code{full_scan} to TRUE, is is always searched in the whole \verb{C:\\\\}. 28 | This argument takes no effect if \code{gdal_path} was defined, since, in that case, 29 | a full search is always performed in \code{gdal_path}.} 30 | } 31 | \value{ 32 | Logical (invisible): TRUE in case the installation is ok, FALSE 33 | if GDAL is missing and abort=FALSE (otherwise, the function stops). 34 | } 35 | \description{ 36 | The function checks that GDAL is installed and updated to 37 | the minimum required version (2.1.2). 38 | } 39 | \note{ 40 | License: GPL 3.0 41 | } 42 | \examples{ 43 | \dontrun{ 44 | check_gdal() 45 | } 46 | } 47 | \references{ 48 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 49 | "sen2r": An R toolbox for automatically downloading and preprocessing 50 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 51 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 52 | } 53 | \author{ 54 | Luigi Ranghetti, phD (2019) 55 | } 56 | -------------------------------------------------------------------------------- /man/check_gui_deps.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/check_gui_deps.R 3 | \name{check_gui_deps} 4 | \alias{check_gui_deps} 5 | \title{Check GUI dependencies} 6 | \usage{ 7 | check_gui_deps(abort = TRUE) 8 | } 9 | \arguments{ 10 | \item{abort}{Logical parameter: if TRUE (default), the function aborts in case 11 | some packages need to be installed; if FALSE, a warning is shown.} 12 | } 13 | \value{ 14 | Logical (invisible): TRUE if all the required packages are installed, 15 | FALSE (if \code{abort = FALSE}) or an error if some is missing. 16 | } 17 | \description{ 18 | Check if suggested dependencies required to run the 19 | sen2r GUI are present. 20 | } 21 | \details{ 22 | Packages required to run the GUI (\strong{\code{shiny}}- and 23 | \strong{\code{leaflet}}-related packages), which were \strong{\code{sen2r}} dependencies until 24 | version 1.3.4, are now suggested dependencies. 25 | \strong{\code{sen2r}} can be used without them with the exception of the GUI. 26 | } 27 | \note{ 28 | License: GPL 3.0 29 | } 30 | \examples{ 31 | \donttest{ 32 | check_gui_deps() 33 | } 34 | } 35 | \references{ 36 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 37 | "sen2r": An R toolbox for automatically downloading and preprocessing 38 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 39 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 40 | } 41 | \author{ 42 | Luigi Ranghetti, phD (2020) 43 | } 44 | \keyword{internal} 45 | -------------------------------------------------------------------------------- /man/check_param_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/check_param_list.R 3 | \name{check_param_list} 4 | \alias{check_param_list} 5 | \title{Check a parameter list} 6 | \usage{ 7 | check_param_list(pm, type = "string", check_paths = FALSE, correct = TRUE) 8 | } 9 | \arguments{ 10 | \item{pm}{List of parameters or path of a JSON parameter file.} 11 | 12 | \item{type}{Type of the output (see \link{print_message} for details).} 13 | 14 | \item{check_paths}{Logical: if TRUE, the function checks required output 15 | paths to be provided; if FALSE (default) these checks are skipped.} 16 | 17 | \item{correct}{Logical: if TRUE (default), the function corrects 18 | some incoherences (e.g. timewindow of length 1 is transformed in length 2) 19 | and returns the corrected list as output; if false, only checking is 20 | performed, and the output is NULL if no errors occur.} 21 | } 22 | \value{ 23 | In case of errors, depending on \code{type} argument, output can be 24 | a vector of errors (if \code{type = "string"}), 25 | the first error occurred (if \code{type = "error"}) 26 | or a set of warnings (if \code{type = "warning"}). 27 | If no errors occur, output is the corrected parameter list if 28 | \code{correct = TRUE} or NULL otherwise. 29 | } 30 | \description{ 31 | Check that the parameter list (or JSON parameter file) 32 | is in the correct format, and then specified values are coherent with 33 | parameters. 34 | } 35 | \note{ 36 | License: GPL 3.0 37 | } 38 | \references{ 39 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 40 | "sen2r": An R toolbox for automatically downloading and preprocessing 41 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 42 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 43 | } 44 | \author{ 45 | Luigi Ranghetti, phD (2019) 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/check_sen2r_deps.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/check_sen2r_deps.R 3 | \name{check_sen2r_deps} 4 | \alias{check_sen2r_deps} 5 | \title{Check package dependencies} 6 | \usage{ 7 | check_sen2r_deps() 8 | } 9 | \value{ 10 | NULL (the function is called for its side effects) 11 | } 12 | \description{ 13 | The function allows to graphically check that all the 14 | optional runtime dependencies are installed. 15 | } 16 | \details{ 17 | This package needs some external dependencies in order to run 18 | specific actions: 19 | \itemize{ 20 | \item Sen2Cor for atmospheric correction; 21 | \item GDAL for cloud mask smoothing and buffering; 22 | \item aria2 to download SAFE images with an alternative downloader. 23 | } 24 | 25 | This function opens a GUI which allows to check that these dependencies 26 | are installed. This check is highly suggested before using the library for 27 | the fist time, in order to avoid errors. 28 | } 29 | \note{ 30 | License: GPL 3.0 31 | } 32 | \examples{ 33 | if (interactive()) { 34 | check_sen2r_deps() 35 | } 36 | } 37 | \references{ 38 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 39 | "sen2r": An R toolbox for automatically downloading and preprocessing 40 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 41 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 42 | } 43 | \author{ 44 | Luigi Ranghetti, phD (2019) 45 | } 46 | -------------------------------------------------------------------------------- /man/comsub.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/comsub.R 3 | \name{comsub} 4 | \alias{comsub} 5 | \title{Find the longest common starting substring or directory} 6 | \usage{ 7 | comsub(data, sep = "") 8 | } 9 | \arguments{ 10 | \item{data}{A vector of strings} 11 | 12 | \item{sep}{A character which is used to separate elements; default ("") 13 | is used to compare single characters; other useful alternatives are 14 | "/" (or "\\\\\\\\" in Windows) to find the longest common directory, or 15 | " " to compare words instead of characters.} 16 | } 17 | \value{ 18 | A character with the longest common initial substring 19 | } 20 | \description{ 21 | The function search for the longest common prefix between 22 | multiple strings. 23 | } 24 | \note{ 25 | Modified from a suggestion taken from 26 | \href{https://stackoverflow.com/questions/28273716/r-implementation-for-finding-the-longest-common-starting-substrings-in-a-set-of}{stackoverflow}. 27 | } 28 | \examples{ 29 | strings <- c("/home/user/git/sen2r", 30 | "/home/user/git_data/sen2r/ex/vrt/01_translate/") 31 | 32 | comsub(strings) 33 | 34 | comsub(strings, sep="/") 35 | } 36 | \references{ 37 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 38 | "sen2r": An R toolbox for automatically downloading and preprocessing 39 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 40 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 41 | } 42 | \author{ 43 | Luigi Ranghetti, phD (2019) 44 | } 45 | -------------------------------------------------------------------------------- /man/create_indices_db.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/create_indices_db.R 3 | \name{create_indices_db} 4 | \alias{create_indices_db} 5 | \title{Create the indices database} 6 | \usage{ 7 | create_indices_db(xslt_path = NA, json_path = NA, force = FALSE) 8 | } 9 | \arguments{ 10 | \item{xslt_path}{(optional) The path where to install \code{xsltml}, 11 | an external \code{xsltproc} script used to convert MathML index formulas 12 | to LaTeX (default: a subdirectory of the package).} 13 | 14 | \item{json_path}{(optional) The path of the output JSON file. 15 | \emph{Warning}: to create a file which will be usable by the package, 16 | this option must be left to NA (default location is within the 17 | package installation). Edit this only to create the file in another 18 | place for external use.} 19 | 20 | \item{force}{(optional) Logical: if FALSE (default), the db is created only 21 | if missing or not updated; if TRUE, it is created in any case.} 22 | } 23 | \value{ 24 | NULL (the function is called for its side effects) 25 | } 26 | \description{ 27 | The internal function checks if indices.json (the 28 | database of spectral indices) already exists; if not, it 29 | downloads source files and creates it. 30 | Since this function depends on \code{xsltproc} executable (available 31 | only for Linux), this function can be used only from from 32 | Linux. It is not necessary, since a indices.json file is 33 | present in the package. 34 | } 35 | \note{ 36 | License: GPL 3.0 37 | } 38 | \references{ 39 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 40 | "sen2r": An R toolbox for automatically downloading and preprocessing 41 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 42 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 43 | } 44 | \author{ 45 | Luigi Ranghetti, phD (2019) 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/create_s2_dop.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/create_s2_dop.R 3 | \name{create_s2_dop} 4 | \alias{create_s2_dop} 5 | \title{Create the database of S2 orbits and doy of passage} 6 | \usage{ 7 | create_s2_dop(json_path = NA, force = FALSE) 8 | } 9 | \arguments{ 10 | \item{json_path}{(optional) The path of the output JSON file. 11 | \emph{Warning}: to create a file which will be usable by the package, 12 | this option must be left to NA (default location is within the 13 | package installation). Edit this only to create the file in another 14 | place for external use.} 15 | 16 | \item{force}{(optional) Logical: if FALSE (default), the db is created only 17 | if missing or not updated; if TRUE, it is created in any case.} 18 | } 19 | \value{ 20 | The path of the json file 21 | } 22 | \description{ 23 | The internal function build a database with the base DOY of 24 | passage across each Sentinel-2A orbit (which is used in function \code{s2_dop}). 25 | } 26 | \note{ 27 | License: GPL 3.0 28 | } 29 | \references{ 30 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 31 | "sen2r": An R toolbox for automatically downloading and preprocessing 32 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 33 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 34 | } 35 | \author{ 36 | Luigi Ranghetti, phD (2019) 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/expand_path.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expand_path.R 3 | \name{expand_path} 4 | \alias{expand_path} 5 | \title{Expand a path with a parent directory} 6 | \usage{ 7 | expand_path(path, parent = getwd(), silent = TRUE, normalize = TRUE) 8 | } 9 | \arguments{ 10 | \item{path}{The path name (\code{character}) to check ad eventually expand.} 11 | 12 | \item{parent}{The parent directory (\code{character}) to use if \code{path} is 13 | relative (default value: the working directory).} 14 | 15 | \item{silent}{Logical value: if TRUE (default), no message are shown; 16 | if FALSE, a message inform if \code{parent} were applied or not; 17 | if NA, a warning is returned if \code{path} is expanded, nothing if it 18 | is already an absolute path.} 19 | 20 | \item{normalize}{Logical value: if TRUE (default), the path is normalised 21 | (\code{normalizePath()} is applied); if FALSE it is simply 22 | appended.} 23 | } 24 | \value{ 25 | The path eventually expanded. 26 | } 27 | \description{ 28 | Accessory function which checks if a path is absolute or relative; 29 | if relative, use a specified parent directory instead than the working 30 | directory to expand it. 31 | Useful for functions which accept more than one path as arguments, 32 | in which one of them contains the absolute position, and the others 33 | do not. 34 | } 35 | \note{ 36 | License: GPL 3.0 37 | } 38 | \references{ 39 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 40 | "sen2r": An R toolbox for automatically downloading and preprocessing 41 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 42 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 43 | } 44 | \author{ 45 | Luigi Ranghetti, phD (2019) 46 | } 47 | -------------------------------------------------------------------------------- /man/expect_equal_crs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expect_equal_crs.R 3 | \name{expect_equal_crs} 4 | \alias{expect_equal_crs} 5 | \title{Compare two non-null CRS} 6 | \usage{ 7 | expect_equal_crs(crs1, crs2) 8 | } 9 | \arguments{ 10 | \item{crs1}{CRS 1 to compare} 11 | 12 | \item{crs2}{CRS 2 to compare} 13 | } 14 | \value{ 15 | \code{testthat::expect_equal()} output. 16 | } 17 | \description{ 18 | Internal function: convenience function to compare two non-null 19 | CRS in tests without using EPSG (so usable with rgdal >= 1.5). 20 | } 21 | \note{ 22 | License: GPL 3.0 23 | } 24 | \references{ 25 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 26 | "sen2r": An R toolbox for automatically downloading and preprocessing 27 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 28 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 29 | } 30 | \author{ 31 | Luigi Ranghetti, phD (2020) 32 | } 33 | \keyword{internal} 34 | -------------------------------------------------------------------------------- /man/figures/irea_logo_200px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/irea_logo_200px.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet1.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet1_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet1_small.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet2.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet2_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet2_small.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet3.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet3_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet3_small.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet4.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet4_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet4_small.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet5.png -------------------------------------------------------------------------------- /man/figures/sen2r_gui_sheet5_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_gui_sheet5_small.png -------------------------------------------------------------------------------- /man/figures/sen2r_logo_1000px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_logo_1000px.png -------------------------------------------------------------------------------- /man/figures/sen2r_logo_200px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/man/figures/sen2r_logo_200px.png -------------------------------------------------------------------------------- /man/fix_envi_format.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fix_envi_format.R 3 | \name{fix_envi_format} 4 | \alias{fix_envi_format} 5 | \title{Fix ENVI outputs} 6 | \usage{ 7 | fix_envi_format(infiles) 8 | } 9 | \arguments{ 10 | \item{infiles}{A vector of input filenames, in the 11 | sen2r naming convention (\link{safe_shortname}) and ENVI format.} 12 | } 13 | \value{ 14 | NULL (the function is called for its side effects) 15 | } 16 | \description{ 17 | Internal function which changes some elements of output ENVI 18 | files: 19 | \itemize{ 20 | \item file extension is set to .dat if .envi (in case of files created 21 | by \code{writeRaster}) is found, and the header is edited properly, 22 | \item and band names are set in the header file (in particular, SR band names 23 | include wavelengths and names like NIR, SWIR; other products shows the 24 | product name as band name); 25 | \item SCL headers include information about class names and colours. 26 | } 27 | } 28 | \note{ 29 | License: GPL 3.0 30 | } 31 | \references{ 32 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 33 | "sen2r": An R toolbox for automatically downloading and preprocessing 34 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 35 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 36 | } 37 | \author{ 38 | Luigi Ranghetti, phD (2019) 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/gdal_abs2rel_rel2abs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gdal_abs2rel.R 3 | \name{gdal_abs2rel} 4 | \alias{gdal_abs2rel} 5 | \alias{gdal_rel2abs} 6 | \title{Convert absolute from/to relative paths in a virtual file} 7 | \usage{ 8 | gdal_abs2rel(in_vrt, out_vrt = NA) 9 | 10 | gdal_rel2abs(in_vrt, out_vrt = NA) 11 | } 12 | \arguments{ 13 | \item{in_vrt}{The path of the VRT to be read.} 14 | 15 | \item{out_vrt}{(optional) The path of the output VRT file (default 16 | is to overwrite \code{in_vrt}).} 17 | } 18 | \value{ 19 | NULL (the function is called for its side effects) 20 | } 21 | \description{ 22 | The two functions read the content of a GDAL virtual 23 | file (VRT) and check the presence of paths to linked files. 24 | 25 | \link{gdal_abs2rel} scans the presence of absolute paths: when an 26 | absolute path has a common parent directory with the path in which 27 | the VRT is, this is replaced with a relative. This is useful when 28 | VRT are on a remote driver, which can be mounted to several points. 29 | 30 | \link{gdal_rel2abs} checks the presence of relative paths, 31 | and replace them with the corresponding absolute path (symbolic 32 | links are followed). This is useful to grant that VRT can be moved 33 | (if the files they link to are not moved). 34 | } 35 | \note{ 36 | License: GPL 3.0 37 | } 38 | \examples{ 39 | # Load a VRT containing a relative path 40 | ex_vrt <- system.file( 41 | "extdata/out/S2A2A_20190723_022_Barbellino_RGB432B_10.vrt", 42 | package = "sen2r" 43 | ) 44 | abs_vrt <- tempfile(fileext = "_abs.vrt") 45 | rel_vrt <- tempfile(fileext = "_rel.vrt") 46 | gdal_rel2abs(ex_vrt, abs_vrt) 47 | gdal_abs2rel(ex_vrt, rel_vrt) 48 | 49 | # Show differences 50 | ex_vrt_content <- readLines(ex_vrt) 51 | abs_vrt_content <- readLines(abs_vrt) 52 | rel_vrt_content <- readLines(rel_vrt) 53 | ex_vrt_content[ex_vrt_content != abs_vrt_content] # Original line 54 | abs_vrt_content[ex_vrt_content != abs_vrt_content] # Modified line 55 | rel_vrt_content[ex_vrt_content != rel_vrt_content] # No edits 56 | } 57 | \references{ 58 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 59 | "sen2r": An R toolbox for automatically downloading and preprocessing 60 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 61 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 62 | } 63 | \author{ 64 | Luigi Ranghetti, phD (2019) 65 | } 66 | -------------------------------------------------------------------------------- /man/gdalwarp_grid.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gdalwarp_grid.R 3 | \name{gdalwarp_grid} 4 | \alias{gdalwarp_grid} 5 | \title{Warp a raster file aligning it on the grid of another file} 6 | \usage{ 7 | gdalwarp_grid( 8 | srcfiles, 9 | dstfiles, 10 | ref, 11 | of = NULL, 12 | r = NULL, 13 | dstnodata = NA, 14 | tmpdir = tempdir() 15 | ) 16 | } 17 | \arguments{ 18 | \item{srcfiles}{A vector of input file paths (managed by GDAL).} 19 | 20 | \item{dstfiles}{A vector of input file paths.} 21 | 22 | \item{ref}{Path of the raster taken as reference.} 23 | 24 | \item{of}{The output format (use the short format name). Default is 25 | the format of every input filename.} 26 | 27 | \item{r}{Resampling_method (\code{"near"}|\code{"bilinear"}|\code{"cubic"}|\code{"cubicspline"}| 28 | \code{"lanczos"}|\code{"average"}|\code{"mode"}|\code{"max"}|\code{"min"}|\code{"med"}|\code{"q1"}|\code{"q3"}).} 29 | 30 | \item{dstnodata}{(optional) Set nodata values for output bands 31 | (parameter passed to \code{gdalUtil()}).} 32 | 33 | \item{tmpdir}{(optional) Path where intermediate files (.prj) will be created. 34 | Default is a temporary directory.} 35 | } 36 | \value{ 37 | NULL (the function is called for its side effects) 38 | } 39 | \description{ 40 | The function applies \code{gdalwarp} to build rasters with the 41 | same projection, resolution and grid alignment of another raster. 42 | If not specified, the output format of each file is the same of the 43 | corresponding source file. 44 | } 45 | \note{ 46 | License: GPL 3.0 47 | } 48 | \examples{ 49 | \donttest{ 50 | # Define file names 51 | ex_sel <- system.file( 52 | "extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif", 53 | package = "sen2r" 54 | ) 55 | ex_ref <- system.file( 56 | "extdata/out/S2A2A_20190723_022_Barbellino_SCL_10.tif", 57 | package = "sen2r" 58 | ) 59 | ex_out <- tempfile(fileext = "_BOA_out.tif") 60 | 61 | # Run function 62 | sen2r:::gdalwarp_grid(ex_sel, ex_out, ref = ex_ref) 63 | 64 | # Show output 65 | oldpar <- par(mfrow = c(1,3), mar = rep(0,4)) 66 | image(stars::read_stars(ex_sel), rgb = 4:2, maxColorValue = 3500, useRaster = TRUE) 67 | par(mar = rep(2/3,4)) 68 | image(stars::read_stars(ex_ref), useRaster = TRUE) 69 | par(mar = rep(0,4)) 70 | image(stars::read_stars(ex_out), rgb = 4:2, maxColorValue = 3500, useRaster = TRUE) 71 | par(oldpar) 72 | } 73 | } 74 | \references{ 75 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 76 | "sen2r": An R toolbox for automatically downloading and preprocessing 77 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 78 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 79 | } 80 | \author{ 81 | Luigi Ranghetti, phD (2019) 82 | } 83 | \keyword{internal} 84 | -------------------------------------------------------------------------------- /man/gipp_init.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gipp.R 3 | \name{gipp_init} 4 | \alias{gipp_init} 5 | \title{Copy L2A_GIPP.xml in sen2r} 6 | \usage{ 7 | gipp_init(gipp_sen2r_path = NA, force = FALSE, dem_warning = FALSE) 8 | } 9 | \arguments{ 10 | \item{gipp_sen2r_path}{Character path of the output GIPP XML file. 11 | By default it is equal to NA (meaning the default sen2r GIPP path).} 12 | 13 | \item{force}{Logical: if TRUE, the file is copied in any case; 14 | if FALSE (default), only if it does not yet exist.} 15 | 16 | \item{dem_warning}{TEMPORARY ARGUMENT Logical: if TRUE, a warning about 17 | the fact that DEM_Directory XML parameter was not overwritten is shown 18 | (default is FALSE). 19 | This argument will be removed when use_dem = TRUE will become the default.} 20 | } 21 | \value{ 22 | TRUE if the file was copied, FALSE elsewhere (invisible output) 23 | } 24 | \description{ 25 | Internal function to copy L2A_GIPP.xml from default Sen2Cor 26 | directory to sen2r. After that, user will allow editing Sen2Cor options 27 | in sen2r without affecting standalone Sen2Cor behaviour. 28 | } 29 | \note{ 30 | License: GPL 3.0 31 | } 32 | \examples{ 33 | \dontrun{ 34 | gipp_init() 35 | } 36 | } 37 | \references{ 38 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 39 | "sen2r": An R toolbox for automatically downloading and preprocessing 40 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 41 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 42 | } 43 | \author{ 44 | Luigi Ranghetti, phD (2020) 45 | } 46 | \keyword{internal} 47 | -------------------------------------------------------------------------------- /man/give_write_permission.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/give_write_permission.R 3 | \name{give_write_permission} 4 | \alias{give_write_permission} 5 | \title{Give permission to write settings on disk} 6 | \usage{ 7 | give_write_permission(agree = NA) 8 | } 9 | \arguments{ 10 | \item{agree}{Logical: if TRUE, allow creating the hidden directory; 11 | if FALSE, do not allow it; if NA (default), the permission is asked to 12 | the user in interactive mode (in non-interactive mode, the permission is 13 | denied).} 14 | } 15 | \value{ 16 | Logical: if TRUE, R was authorised saving in the directory; 17 | if FALSE, it was not and a temporary directory is being used. 18 | } 19 | \description{ 20 | In interactive mode, ask users for permission to create a 21 | .sen2r settings directory, in which to store files required by the packages. 22 | The function can be used also in non-interactive mode by setting 23 | \code{agree = TRUE}. 24 | The function has no effect if the directory already exists. 25 | } 26 | \note{ 27 | License: GPL 3.0 28 | } 29 | \references{ 30 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 31 | "sen2r": An R toolbox for automatically downloading and preprocessing 32 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 33 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 34 | } 35 | \author{ 36 | Lorenzo Busetto, phD (2019) 37 | 38 | Luigi Ranghetti, phD (2019) 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/init_python.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init_python.R 3 | \name{init_python} 4 | \alias{init_python} 5 | \title{Initialise python} 6 | \usage{ 7 | init_python() 8 | } 9 | \value{ 10 | NULL (the function is called for its side effects) 11 | } 12 | \description{ 13 | Internal function to set the environmental variables 14 | required to run Python-based GDAL utilities on Windows. 15 | } 16 | \note{ 17 | License: GPL 3.0 18 | } 19 | \references{ 20 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 21 | "sen2r": An R toolbox for automatically downloading and preprocessing 22 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 23 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 24 | } 25 | \author{ 26 | Luigi Ranghetti, phD (2020) 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/install_aria2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/install_aria2.R 3 | \name{install_aria2} 4 | \alias{install_aria2} 5 | \title{Download and install aria2.} 6 | \usage{ 7 | install_aria2(aria2_dir, force = FALSE) 8 | } 9 | \arguments{ 10 | \item{aria2_dir}{Path where aria2 executable will be installed.} 11 | 12 | \item{force}{(optional) Logical: if TRUE, install even if it is already 13 | installed (default is FALSE).} 14 | } 15 | \value{ 16 | The path of aria2 17 | } 18 | \description{ 19 | This function download and install standalone version of 20 | \href{https://aria2.github.io}{aria2} for Windows. 21 | } 22 | \note{ 23 | License: GPL 3.0 24 | } 25 | \examples{ 26 | \dontrun{ 27 | # Run only on Windows 28 | install_aria2(aria2_dir = tempdir()) 29 | # ( use a non-temporary folder path instead of tempdir() ) 30 | } 31 | } 32 | \references{ 33 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 34 | "sen2r": An R toolbox for automatically downloading and preprocessing 35 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 36 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 37 | } 38 | \author{ 39 | Luigi Ranghetti, phD (2019) 40 | } 41 | -------------------------------------------------------------------------------- /man/install_sen2cor.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/install_sen2cor.R 3 | \name{install_sen2cor} 4 | \alias{install_sen2cor} 5 | \alias{link_sen2cor} 6 | \title{Download and install (or link) Sen2Cor} 7 | \usage{ 8 | install_sen2cor(sen2cor_dir = NA, version = "2.5.5", force = FALSE) 9 | 10 | link_sen2cor(sen2cor_dir) 11 | } 12 | \arguments{ 13 | \item{sen2cor_dir}{Path where sen2cor will be installed or searched 14 | (by default it is a subdirectory \code{"sen2cor"} of the default sen2r directory).} 15 | 16 | \item{version}{(optional) Character: Sen2Cor version (one among 17 | '2.5.5' - default - and '2.8.0').} 18 | 19 | \item{force}{(optional) Logical: if TRUE, installs sen2cor even if it is already 20 | found in sen2cor_dir (default is FALSE).} 21 | } 22 | \value{ 23 | NULL (the function is called for its side effects) 24 | } 25 | \description{ 26 | \code{\link[=install_sen2cor]{install_sen2cor()}} downloads and installs a standalone version of 27 | \href{https://step.esa.int/main/snap-supported-plugins/sen2cor/}{Sen2Cor}. 28 | 29 | \code{link_sen2cor()} links an existing standalone version of 30 | \href{https://step.esa.int/main/snap-supported-plugins/sen2cor/}{Sen2Cor} to sen2r. 31 | } 32 | \note{ 33 | License: GPL 3.0 34 | } 35 | \examples{ 36 | \dontrun{ 37 | install_sen2cor(sen2cor_dir = tempdir()) 38 | # ( use a non-temporary folder path instead of tempdir() ) 39 | } 40 | } 41 | \references{ 42 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 43 | "sen2r": An R toolbox for automatically downloading and preprocessing 44 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 45 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 46 | } 47 | \author{ 48 | Luigi Ranghetti, phD (2019) 49 | } 50 | -------------------------------------------------------------------------------- /man/list_indices.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/list_indices.R 3 | \name{list_indices} 4 | \alias{list_indices} 5 | \title{List spectral indices} 6 | \usage{ 7 | list_indices(values, pattern = "", all = FALSE) 8 | } 9 | \arguments{ 10 | \item{values}{A vector of attributes which will be returned, being 11 | one or more within the followings: 12 | \itemize{ 13 | \item \code{n_index}: internal index identifiers; 14 | \item \code{name}: index name; 15 | \item \code{longname}: index description; 16 | \item \code{link}: URL to the index description page; 17 | \item \code{s2_formula}: expression containing the formula to compute the index; 18 | \item \code{s2_formula_mathml}: MathML version of the formula; 19 | \item \code{checked}: logical (TRUE for verified indices); 20 | \item \code{a}, \code{b}, \code{x}: parameter values (NA for non required parameters). 21 | }} 22 | 23 | \item{pattern}{A regular expression on index names.} 24 | 25 | \item{all}{Logical: if TRUE, all the indices retrieved from 26 | \href{https://www.indexdatabase.de/db/is.php?sensor_id=96}{IDB} are returned; 27 | if FALSE (default), only indices checked by the authors are returned.} 28 | } 29 | \value{ 30 | A data.frame with the required information. The table contains 31 | also the following attributes: 32 | \itemize{ 33 | \item \code{creation_date}: timestamp of the creation date of the indices archive; 34 | \item \code{pkg_version}: version of the \code{sen2r} package used to 35 | create the indices archive. 36 | } 37 | } 38 | \description{ 39 | Return a table with attributes of the spectral indices 40 | computable with the package. 41 | } 42 | \note{ 43 | License: GPL 3.0 44 | } 45 | \examples{ 46 | # Show index names 47 | list_indices(c("name","longname")) 48 | 49 | # Return the MSAVI2 formula 50 | list_indices("s2_formula", "^MSAVI2$") 51 | 52 | # Return all index names (including unchecked) 53 | list_indices("name", all = TRUE) 54 | } 55 | \references{ 56 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 57 | "sen2r": An R toolbox for automatically downloading and preprocessing 58 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 59 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 60 | } 61 | \author{ 62 | Luigi Ranghetti, phD (2019) 63 | } 64 | -------------------------------------------------------------------------------- /man/load_binpaths.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/load_binpaths.R 3 | \name{load_binpaths} 4 | \alias{load_binpaths} 5 | \title{Load the paths of external executables} 6 | \usage{ 7 | load_binpaths(bins = NULL) 8 | } 9 | \arguments{ 10 | \item{bins}{Character vector with one of more of the following values: 11 | "gdal", sen2cor", "aria2", "python". 12 | If an executable corresponding to the passed \code{bins} value is not found 13 | in the JSON, it is checked (when possible).} 14 | } 15 | \value{ 16 | The list of the paths 17 | } 18 | \description{ 19 | Internal function to load the paths of executables 20 | from the JSON where they are saved when installed. 21 | } 22 | \note{ 23 | License: GPL 3.0 24 | } 25 | \examples{ 26 | \donttest{ 27 | # Load only existing paths 28 | binpaths <- load_binpaths() 29 | binpaths 30 | } 31 | 32 | \dontrun{ 33 | # Load paths, forcing to check GDAL and sen2cor 34 | binpaths <- load_binpaths(c("gdal", "sen2cor")) 35 | binpaths 36 | } 37 | } 38 | \references{ 39 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 40 | "sen2r": An R toolbox for automatically downloading and preprocessing 41 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 42 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 43 | } 44 | \author{ 45 | Luigi Ranghetti, phD (2019) 46 | } 47 | -------------------------------------------------------------------------------- /man/load_extent.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/helpers_extent.R 3 | \name{load_extent_bbox} 4 | \alias{load_extent_bbox} 5 | \alias{load_extent_vectfile} 6 | \alias{load_extent_draw} 7 | \title{Insert an extent} 8 | \usage{ 9 | load_extent_bbox() 10 | 11 | load_extent_vectfile() 12 | 13 | load_extent_draw(extent_ns_name) 14 | } 15 | \arguments{ 16 | \item{extent_ns_name}{Name of the namespace to be used} 17 | } 18 | \description{ 19 | Internal functions and modal dialogs to specify an extent 20 | in the GUI. 21 | } 22 | \note{ 23 | License: GPL 3.0 24 | } 25 | \references{ 26 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 27 | "sen2r": An R toolbox for automatically downloading and preprocessing 28 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 29 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 30 | } 31 | \author{ 32 | Luigi Ranghetti, phD (2019) 33 | } 34 | \keyword{internal} 35 | -------------------------------------------------------------------------------- /man/mountpoint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mountpoint.R 3 | \name{mountpoint} 4 | \alias{mountpoint} 5 | \title{Return the mountpoint of the input directory (if it is mounted)} 6 | \usage{ 7 | mountpoint(path, protocol = NA) 8 | } 9 | \arguments{ 10 | \item{path}{The path to be checked} 11 | 12 | \item{protocol}{(optional) Vector of protocol types. If NA (default), 13 | all the protocols are considered.} 14 | } 15 | \value{ 16 | The path of the parent mountpoint for mounted directories; 17 | if the input directory is not mounted, NULL is returned. 18 | NULL is returned also if the operating system is not unix 19 | (together with a warning message). 20 | An attribute "protocol" contains the protocol of the mountpoint. 21 | } 22 | \description{ 23 | The function checks if the input directory is a subdirectory 24 | of a mountpoint of a certain protocol. At the moment, it works only on unix 25 | operating systems. 26 | } 27 | \note{ 28 | License: GPL 3.0 29 | } 30 | \references{ 31 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 32 | "sen2r": An R toolbox for automatically downloading and preprocessing 33 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 34 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 35 | } 36 | \author{ 37 | Luigi Ranghetti, phD (2019) 38 | } 39 | -------------------------------------------------------------------------------- /man/nn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nn.R 3 | \name{nn} 4 | \alias{nn} 5 | \title{Replace NULL with character()} 6 | \usage{ 7 | nn(x) 8 | } 9 | \arguments{ 10 | \item{x}{Input variable} 11 | } 12 | \value{ 13 | \code{character(0)} if \code{x==NULL}, \code{x} elsewhere 14 | } 15 | \description{ 16 | Internal function: return character(0) instead of NULL. 17 | This is sometimes needed not to return error when applying some functions. 18 | } 19 | \note{ 20 | License: GPL 3.0 21 | } 22 | \examples{ 23 | tryCatch(basename(NULL), error = print) # error 24 | basename(character()) # ok 25 | basename(sen2r:::nn(NULL)) # ok 26 | } 27 | \references{ 28 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 29 | "sen2r": An R toolbox for automatically downloading and preprocessing 30 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 31 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 32 | } 33 | \author{ 34 | Luigi Ranghetti, phD (2019) 35 | } 36 | \keyword{internal} 37 | -------------------------------------------------------------------------------- /man/normalize_path.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expand_path.R 3 | \name{normalize_path} 4 | \alias{normalize_path} 5 | \title{Express file paths in canonical Form depending on the operating system} 6 | \usage{ 7 | normalize_path(path, ...) 8 | } 9 | \arguments{ 10 | \item{path}{character vector of file paths} 11 | 12 | \item{...}{additional parameters passed to \link{normalizePath} (i.e. \code{mustWork}).} 13 | } 14 | \value{ 15 | The paths normalized. 16 | } 17 | \description{ 18 | Accessory function wrapper for \code{normalizePath()} in Linux 19 | and \code{shortPathName(normalizePath())} in Windows. 20 | } 21 | \note{ 22 | License: GPL 3.0 23 | } 24 | \references{ 25 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 26 | "sen2r": An R toolbox for automatically downloading and preprocessing 27 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 28 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 29 | } 30 | \author{ 31 | Luigi Ranghetti, phD (2019) 32 | } 33 | -------------------------------------------------------------------------------- /man/path_check.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/path_check.R 3 | \name{path_check} 4 | \alias{path_check} 5 | \title{Check a path} 6 | \usage{ 7 | path_check(path, mustbe_empty = FALSE, mustbe_writable = TRUE) 8 | } 9 | \arguments{ 10 | \item{path}{\code{string} full path to a folder} 11 | 12 | \item{mustbe_empty}{\code{logical} if TRUE, accept only empty directories} 13 | 14 | \item{mustbe_writable}{\code{logical} if TRUE, accept only directories with write 15 | permissions} 16 | } 17 | \description{ 18 | Accessory functions to check that a directory exists and 19 | the user have write permissions on it (to be used in a Shiny context) 20 | } 21 | \author{ 22 | Luigi Ranghetti, phD (2019) 23 | 24 | Lorenzo Busetto, PhD (2019) 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/projpar.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/projpar.R 3 | \name{projpar} 4 | \alias{projpar} 5 | \alias{projname} 6 | \title{Return a parameter used in a WKT projection} 7 | \usage{ 8 | projpar(x, par, abort = FALSE) 9 | 10 | projname(x, abort = FALSE) 11 | } 12 | \arguments{ 13 | \item{x}{The CRS to be named (any \link{st_crs2} input is accepted).} 14 | 15 | \item{par}{Character corresponding to the parameter name 16 | (it can be one among "name" and "unit" - case insensitive).} 17 | 18 | \item{abort}{logical: if TRUE, the function aborts in case an invalid 19 | CRS is passed; if FALSE (default), the function returns NA, 20 | and a warning is shown.} 21 | } 22 | \value{ 23 | A character with the content of the parameter, and an 24 | attribute \code{crs} with the input projection checked using 25 | \code{\link[sf:st_crs]{sf::st_crs()}}. 26 | } 27 | \description{ 28 | Return the value of a parameter (the name or the unit) 29 | present in the WKT of the given CRS. 30 | } 31 | \note{ 32 | The old function, which was searching for a generic parameter 33 | parsing the WKT, was deprecated: now \code{\link[=projpar]{projpar()}} only accepts \code{par = "name"} 34 | and \code{par = "unit"}, and \code{projname()} is an alias for \code{projpar(..., par = "name")}. 35 | 36 | License: GPL 3.0 37 | } 38 | \examples{ 39 | \donttest{ 40 | projpar(4326, "name") 41 | projpar(4326, "unit") 42 | } 43 | \donttest{ 44 | projname(4326) 45 | } 46 | } 47 | \references{ 48 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 49 | "sen2r": An R toolbox for automatically downloading and preprocessing 50 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 51 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 52 | } 53 | \author{ 54 | Luigi Ranghetti, phD (2020) 55 | } 56 | \keyword{internal} 57 | -------------------------------------------------------------------------------- /man/raster2rgb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/s2_thumbnails.R 3 | \name{raster2rgb} 4 | \alias{raster2rgb} 5 | \title{Produce an RGB image from a singleband raster file.} 6 | \usage{ 7 | raster2rgb( 8 | in_rast, 9 | out_file = NULL, 10 | palette = "generic_ndsi_2", 11 | minval = -1, 12 | maxval = 1, 13 | bigtiff = FALSE, 14 | tmpdir = NA 15 | ) 16 | } 17 | \arguments{ 18 | \item{in_rast}{Path of the input multiband raster.} 19 | 20 | \item{out_file}{(optional) Path of the output RGB JPEG image; if NULL 21 | (default), a RasterLayer will be returned.} 22 | 23 | \item{palette}{Path of the palette file to be used (cpt or txt), 24 | or character value of a builtin palette ("SCL", "NDVI", the default 25 | "generic_ndsi" or "generic_ndsi_2").} 26 | 27 | \item{minval}{(to be implemented) the value corresponding to the minimum 28 | value of the palette (for now, only -1 is used). A quantile will be also 29 | accepted.} 30 | 31 | \item{maxval}{(to be implemented) the value corresponding to the maximum 32 | value of the palette (for now, only 1 is used). A quantile will be also 33 | accepted.} 34 | 35 | \item{bigtiff}{(optional) Logical: if TRUE, the creation of a BigTIFF is 36 | forced (default is FALSE). 37 | This option is used only in the case a GTiff format was chosen.} 38 | 39 | \item{tmpdir}{(optional) Path where intermediate files (VRT) will be created. 40 | Default is a temporary directory. 41 | If \code{tmpdir} is a non-empty folder, a random subdirectory will be used.} 42 | } 43 | \value{ 44 | The path of the output image; alternatively, the output image 45 | as RasterLayer (if \code{out_rast = NULL}). 46 | } 47 | \description{ 48 | Internal function to create JPEG or PNG images from a 49 | singleband raster file. This function is used by \link{s2_thumbnails}, 50 | and it will be exported when it would be more generalised. 51 | } 52 | \note{ 53 | License: GPL 3.0 54 | } 55 | \references{ 56 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 57 | "sen2r": An R toolbox for automatically downloading and preprocessing 58 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 59 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 60 | } 61 | \author{ 62 | Luigi Ranghetti, phD (2019) 63 | } 64 | \keyword{internal} 65 | -------------------------------------------------------------------------------- /man/raster_metadata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/raster_metadata.R 3 | \name{raster_metadata} 4 | \alias{raster_metadata} 5 | \title{Get metadata from raster paths} 6 | \usage{ 7 | raster_metadata(raster_paths, meta = "all", format = "data.table") 8 | } 9 | \arguments{ 10 | \item{raster_paths}{A vector of raster paths.} 11 | 12 | \item{meta}{Vector with the desired metadata: one or more values among 13 | 'res', 'size', 'bbox', 'proj', 'unit', 'outformat', 'type'. 14 | Alternatively meta = 'all' (default) allows to return all metadata.} 15 | 16 | \item{format}{One between \code{data.table} (default), \code{data.frame} and \code{list}.} 17 | } 18 | \value{ 19 | A data.table, data.frame or list of the output metadata. 20 | } 21 | \description{ 22 | This accessory function extract some useful metadata from 23 | a vector of raster paths. 24 | } 25 | \note{ 26 | License: GPL 3.0 27 | } 28 | \examples{ 29 | # Define product names 30 | examplenames <- c( 31 | system.file("tif/L7_ETMs.tif", package="stars"), 32 | system.file("extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif", 33 | package = "sen2r") 34 | ) 35 | 36 | \donttest{ 37 | # Return metadata as data.table 38 | raster_metadata(examplenames) 39 | } 40 | 41 | # Return some metadata as data.table 42 | raster_metadata(examplenames, c("res", "size", "bbox", "outformat")) 43 | 44 | # Return some metadata as list 45 | raster_metadata(examplenames, c("res", "size", "bbox", "proj"), format = "list") 46 | 47 | # Output with an invalid raster 48 | examplenames <- c( 49 | examplenames, 50 | system.file("extdata/settings/gdal_formats.json", package="sen2r") 51 | ) 52 | raster_metadata(examplenames, c("bbox", "proj")) 53 | } 54 | \references{ 55 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 56 | "sen2r": An R toolbox for automatically downloading and preprocessing 57 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 58 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 59 | } 60 | \author{ 61 | Luigi Ranghetti, phD (2019) 62 | } 63 | -------------------------------------------------------------------------------- /man/s2_defNA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/s2_defNA.R 3 | \name{s2_defNA} 4 | \alias{s2_defNA} 5 | \title{Set NA value of a specific product type} 6 | \usage{ 7 | s2_defNA(prod_types) 8 | } 9 | \arguments{ 10 | \item{prod_types}{Character vector of the input product types} 11 | } 12 | \value{ 13 | Numeric NA values (NA not to set any NA value), corresponding to 14 | \code{prod_types}. 15 | } 16 | \description{ 17 | Internal function to determine the NA value to be used for 18 | each product type (except for spectral indices, whose NA value is 19 | managed by \link{s2_calcindices}). 20 | } 21 | \examples{ 22 | sen2r:::s2_defNA("BOA") 23 | sen2r:::s2_defNA(c("BOA","BOA","SCL","TCI")) 24 | } 25 | \author{ 26 | Luigi Ranghetti, phD (2019) 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/s2_gui.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/s2_gui.R 3 | \name{s2_gui} 4 | \alias{s2_gui} 5 | \title{Launch the GUI for Sentinel-2 products} 6 | \usage{ 7 | s2_gui(param_list = NULL, thunderforest_api = NA) 8 | } 9 | \arguments{ 10 | \item{param_list}{List of parameters for initialising the GUI values 11 | (if empty, default values are used).} 12 | 13 | \item{thunderforest_api}{Character value with the API for thunderforest 14 | layers (now not used).} 15 | } 16 | \value{ 17 | A list of parameters. 18 | } 19 | \description{ 20 | Launch the GUI to set parameters for the processing 21 | chain of Sentinel-2 products. 22 | } 23 | \note{ 24 | License: GPL 3.0 25 | } 26 | \references{ 27 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 28 | "sen2r": An R toolbox for automatically downloading and preprocessing 29 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 30 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 31 | } 32 | \author{ 33 | Luigi Ranghetti, phD (2019) 34 | } 35 | -------------------------------------------------------------------------------- /man/s2_order.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/s2_order.R 3 | \name{s2_order} 4 | \alias{s2_order} 5 | \title{Order S2 products (deprecated).} 6 | \usage{ 7 | s2_order( 8 | s2_prodlist = NULL, 9 | export_prodlist = TRUE, 10 | delay = 0.5, 11 | apihub = NA, 12 | service = NA, 13 | reorder = TRUE 14 | ) 15 | } 16 | \arguments{ 17 | \item{s2_prodlist}{deprecated} 18 | 19 | \item{export_prodlist}{deprecated} 20 | 21 | \item{delay}{deprecated} 22 | 23 | \item{apihub}{deprecated} 24 | 25 | \item{service}{deprecated} 26 | 27 | \item{reorder}{deprecated} 28 | } 29 | \value{ 30 | deprecated 31 | } 32 | \description{ 33 | This function is deprecated and will be removed. 34 | } 35 | -------------------------------------------------------------------------------- /man/s2_tiles.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/s2_tiles.R 3 | \name{s2_tiles} 4 | \alias{s2_tiles} 5 | \title{Load Sentinel-2 tiles} 6 | \usage{ 7 | s2_tiles() 8 | } 9 | \value{ 10 | An sf spatial object containing the extent of the tiles. 11 | } 12 | \description{ 13 | Load the vector object of the Sentinel-2 tiles. 14 | When the function is run for the first time, it downloads the vector file 15 | from the sen2r GitHub repository and it saves it on disk. 16 | } 17 | \note{ 18 | License: GPL 3.0 19 | } 20 | \examples{ 21 | \donttest{ 22 | # Retrieve all the tiles 23 | s2tiles <- s2_tiles() 24 | 25 | # Extract a subset of all the tiles 26 | s2tiles_ch <- s2tiles[grepl("32T[LMN][ST]", s2tiles$tile_id),] 27 | s2_coords <- sf::st_coordinates(suppressWarnings(sf::st_centroid(s2tiles_ch))) 28 | 29 | # Show the tiles 30 | plot(s2tiles_ch$geometry, border = "black") 31 | text(s2_coords[,1], s2_coords[,2], s2tiles_ch$tile_id, cex = .75) 32 | } 33 | } 34 | \references{ 35 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 36 | "sen2r": An R toolbox for automatically downloading and preprocessing 37 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 38 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 39 | } 40 | \author{ 41 | Luigi Ranghetti, phD (2019) 42 | } 43 | -------------------------------------------------------------------------------- /man/safe_is_online.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/safe_is_online.R 3 | \name{safe_is_online} 4 | \alias{safe_is_online} 5 | \title{Check if SAFE is available for download (deprecated)} 6 | \usage{ 7 | safe_is_online(s2_prodlist = NULL, apihub = NA, verbose = TRUE) 8 | } 9 | \arguments{ 10 | \item{s2_prodlist}{deprecated} 11 | 12 | \item{apihub}{deprecated} 13 | 14 | \item{verbose}{deprecated} 15 | } 16 | \value{ 17 | deprecated 18 | } 19 | \description{ 20 | This function is deprecated and will be removed. 21 | } 22 | -------------------------------------------------------------------------------- /man/scihub_login.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/scihub_login.R 3 | \name{read_scihub_login} 4 | \alias{read_scihub_login} 5 | \alias{is_scihub_configured} 6 | \alias{check_scihub_login} 7 | \alias{check_scihub_connection} 8 | \alias{write_scihub_login} 9 | \title{Import / export / check SciHub username and password (deprecated)} 10 | \usage{ 11 | read_scihub_login(apihub_path = NA) 12 | 13 | is_scihub_configured() 14 | 15 | check_scihub_login(username, password, service = "apihub") 16 | 17 | check_scihub_connection(service = "apihub") 18 | 19 | write_scihub_login( 20 | username, 21 | password, 22 | apihub_path = NA, 23 | check = TRUE, 24 | append = FALSE 25 | ) 26 | } 27 | \arguments{ 28 | \item{apihub_path}{deprecated} 29 | 30 | \item{username}{deprecated} 31 | 32 | \item{password}{deprecated} 33 | 34 | \item{service}{deprecated} 35 | 36 | \item{check}{deprecated} 37 | 38 | \item{append}{deprecated} 39 | } 40 | \value{ 41 | deprecated 42 | 43 | deprecated 44 | } 45 | \description{ 46 | These functions are deprecated and will be removed. 47 | } 48 | -------------------------------------------------------------------------------- /man/sen2r_getElements.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sen2r_getElements.R 3 | \name{sen2r_getElements} 4 | \alias{sen2r_getElements} 5 | \title{Get information from S2 short name} 6 | \usage{ 7 | sen2r_getElements( 8 | s2_names, 9 | naming_convention, 10 | format = "data.table", 11 | abort = TRUE 12 | ) 13 | } 14 | \arguments{ 15 | \item{s2_names}{A vector of Sentinel-2 product names in the 16 | sen2r naming convention.} 17 | 18 | \item{naming_convention}{The naming convention used to extract information 19 | from \code{s2_names} names. \code{"sen2r"} is the 20 | \href{https://sen2r.ranghetti.info/articles/outstructure.html#naming-convention}{sen2r naming convention}; 21 | an experimental accepted value is \code{"sen2r_new"} (it will be documented in future). 22 | By default (argument unspecified or NULL), \code{"sen2r"} is used unless 23 | any \code{s2_names} matches \code{"sen2r"} while some matches \code{"sen2r_new"}. 24 | Alternatively, a list with the manual definition of the naming convention 25 | can be provided (the required format will be documented in a future release).} 26 | 27 | \item{format}{One between \code{data.table} (default), \code{data.frame} and \code{list}.} 28 | 29 | \item{abort}{Logical parameter: if TRUE (default), the function aborts 30 | in case any of \code{s2_names} is not recognised; if FALSE, a warning is shown, 31 | and a list with only the element "type"='unrecognised' is returned.} 32 | } 33 | \value{ 34 | A data.table, data.frame or list of the output metadata. 35 | } 36 | \description{ 37 | This accessory function extracts metadata included in 38 | the name of a Sentinel-2 product which follows the sen2r 39 | naming convention (see \link{safe_shortname}). 40 | } 41 | \note{ 42 | License: GPL 3.0 43 | } 44 | \examples{ 45 | # Define product name 46 | fs2nc_examplename <- 47 | "/path/of/the/product/S2A1C_20170603_022_32TQQ_TOA_20.tif" 48 | 49 | # Return metadata 50 | sen2r_getElements(fs2nc_examplename) 51 | } 52 | \references{ 53 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 54 | "sen2r": An R toolbox for automatically downloading and preprocessing 55 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 56 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 57 | } 58 | \author{ 59 | Luigi Ranghetti, phD (2019) 60 | } 61 | -------------------------------------------------------------------------------- /man/smooth_mask.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/smooth_mask.R 3 | \name{smooth_mask} 4 | \alias{smooth_mask} 5 | \title{Buffer cloud masks} 6 | \usage{ 7 | smooth_mask( 8 | inmask, 9 | tmpdir = tempdir(), 10 | radius = 250, 11 | buffer = 250, 12 | namask = NULL, 13 | bigtiff = FALSE 14 | ) 15 | } 16 | \arguments{ 17 | \item{inmask}{The path of the input 0-1 mask (where 0 represents the area 18 | to be masked, 1 the clean surface).} 19 | 20 | \item{tmpdir}{(optional) Path where intermediate files (VRT) will be created. 21 | Default is a temporary directory.} 22 | 23 | \item{radius}{(optional) Numerical (positive): the size (in the unit of 24 | \code{inmask}, typically metres) to be used as radius for the smoothing 25 | (the higher it is, the more smooth the output mask will result).} 26 | 27 | \item{buffer}{(optional) Numerical (positive or negative): the size of the 28 | buffer (in the unit of \code{inmask}, typically metres) to be applied to the 29 | masked area after smoothing it (positive to enlarge, negative to reduce).} 30 | 31 | \item{namask}{(optional) The path of an input 0-1 mask where 0 represents 32 | the area of the original file with NA values (which should not be 33 | smoothed / buffered). 34 | Default (NULL) means that no NA values are present.} 35 | 36 | \item{bigtiff}{(optional) Logical: if TRUE, the creation of a BigTIFF is 37 | forced (default is FALSE).} 38 | } 39 | \value{ 40 | The path of the smoothed mask. 41 | } 42 | \description{ 43 | Internal function (used by \link{s2_mask}) which smooths 44 | and buffers a 0-1 mask image in order to reduce the roughness of the mask 45 | obtained from SCL classification (which is done pixel by pixel). 46 | See details. 47 | } 48 | \note{ 49 | License: GPL 3.0 50 | } 51 | \references{ 52 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 53 | "sen2r": An R toolbox for automatically downloading and preprocessing 54 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 55 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 56 | } 57 | \author{ 58 | Luigi Ranghetti, phD (2019) 59 | } 60 | \keyword{internal} 61 | -------------------------------------------------------------------------------- /man/st_as_text_2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/st_as_text_2.R 3 | \name{st_as_text_2} 4 | \alias{st_as_text_2} 5 | \title{Return WKT or WKT2 basing on the installed rgdal version} 6 | \usage{ 7 | st_as_text_2(x, pretty = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{object of class \code{sfg}, \code{sfc} or \code{crs}} 11 | 12 | \item{pretty}{logical; if TRUE, print human-readable well-known-text 13 | representation of a coordinate reference system} 14 | } 15 | \value{ 16 | Well-known Text representation of simple feature geometry or 17 | coordinate reference system 18 | } 19 | \description{ 20 | This is a convenience temporary function which returns the WKT 21 | representation of a CRS, using \code{sf::st_as_text()} in case PROJ < 3, 22 | \code{rgdal::CRS()} otherwise. 23 | This has the advantage to perform precise transformations with PROJ >=3, 24 | and to avoid conversion errors 25 | (see \href{https://rsbivand.github.io/ECS530_h19/ECS530_III.html}{here}). 26 | This function will be deleted whenever \code{sf} will manage WKT2. 27 | } 28 | \examples{ 29 | sen2r:::st_as_text_2(sf::st_crs(32632)) 30 | } 31 | \author{ 32 | Luigi Ranghetti, phD (2019) 33 | } 34 | \keyword{internal} 35 | -------------------------------------------------------------------------------- /man/str_pad2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/str_pad2.R 3 | \name{str_pad2} 4 | \alias{str_pad2} 5 | \title{Pad a string.} 6 | \usage{ 7 | str_pad2(string, width, side = c("left", "right", "both"), pad = " ") 8 | } 9 | \arguments{ 10 | \item{string}{A character vector.} 11 | 12 | \item{width}{Minimum width of padded strings.} 13 | 14 | \item{side}{Side on which padding character is added (left, right or both).} 15 | 16 | \item{pad}{Single padding character (default is a space).} 17 | } 18 | \value{ 19 | A character vector. 20 | } 21 | \description{ 22 | Vectorised over \code{string}, \code{width} and \code{pad}. 23 | This is an internal function doing the same thing of \code{str_pad()} 24 | function in package \code{stringr} 25 | (except for parameters \code{'width'} and \code{'length'} which must be of length 1), 26 | but without depending on package \code{stringi}. 27 | } 28 | \note{ 29 | License: GPL 3.0 30 | } 31 | \examples{ 32 | rbind( 33 | str_pad2("hadley", 30, "left"), 34 | str_pad2("hadley", 30, "right"), 35 | str_pad2("hadley", 30, "both") 36 | ) 37 | 38 | # All arguments are vectorised except side 39 | str_pad2(c("a", "abc", "abcdef"), 10) 40 | 41 | # Longer strings are returned unchanged 42 | str_pad2("hadley", 3) 43 | } 44 | \references{ 45 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 46 | "sen2r": An R toolbox for automatically downloading and preprocessing 47 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 48 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 49 | } 50 | \author{ 51 | Luigi Ranghetti, phD (2019) 52 | } 53 | -------------------------------------------------------------------------------- /man/suppress_warnings.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/suppress_warnings.R 3 | \name{suppress_warnings} 4 | \alias{suppress_warnings} 5 | \title{Selective suppress warnings} 6 | \usage{ 7 | suppress_warnings(.expr, .f) 8 | } 9 | \arguments{ 10 | \item{.expr}{Code to evaluate} 11 | 12 | \item{.f}{A regular expression (which will be passed to \code{grepl()}).} 13 | } 14 | \value{ 15 | The warning message as character string, invisibly. 16 | } 17 | \description{ 18 | Suppress warnings matching particular regular expressions. 19 | } 20 | \details{ 21 | See https://stackoverflow.com/questions/16517795/selective-suppresswarnings-that-filters-by-regular-expression 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/tile_utmzone.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tile_utmzone.R 3 | \name{tile_utmzone} 4 | \alias{tile_utmzone} 5 | \title{Obtain the UTM zone associated to Sentinel-2 tiles} 6 | \usage{ 7 | tile_utmzone(tile_id) 8 | } 9 | \arguments{ 10 | \item{tile_id}{Character: tile ID (5 chars), e.g. \code{"32TNR"} (multiple values 11 | can be provided).} 12 | } 13 | \value{ 14 | A vector of the same length of \code{tile_id} with UTM zones (e.g. \verb{"32N}"). 15 | } 16 | \description{ 17 | Internal function: convenience function to obtain the UTM zone 18 | from tile IDs. 19 | } 20 | \note{ 21 | License: GPL 3.0 22 | } 23 | \references{ 24 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 25 | "sen2r": An R toolbox for automatically downloading and preprocessing 26 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 27 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 28 | } 29 | \author{ 30 | Luigi Ranghetti, phD (2020) 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/tiles_intersects.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tiles_intersects.R 3 | \name{tiles_intersects} 4 | \alias{tiles_intersects} 5 | \title{Select the tiles intersecting the extent} 6 | \usage{ 7 | tiles_intersects(extent, all = FALSE, out_format = "id", .s2tiles = NULL) 8 | } 9 | \arguments{ 10 | \item{extent}{\code{sf} object with the spatial extent.} 11 | 12 | \item{all}{logical: if TRUE, all the tiles overlapping the extent are 13 | provided; 14 | if FALSE (default), unnecessary tiles are skipped. 15 | Unnecessary tiles are tiles which overlaps the extent for an area already 16 | covered by another tile. 17 | In case the extent is all included in an overlapping area, only one of the 18 | two candidate tiles is returned (the first in alphabetical order).} 19 | 20 | \item{out_format}{character: if "sf", the spatial object of the overlapping tiles 21 | is returned; if "id" (default), a character vector with the tile IDs.} 22 | 23 | \item{.s2tiles}{output of \code{\link[=s2_tiles]{s2_tiles()}} function (it is possible to pass it 24 | in order to speed up the execution; 25 | otherwise leave to NULL and it will be generated within the function).} 26 | } 27 | \value{ 28 | the tiles intersecting the extent (see argument \code{out_format}). 29 | } 30 | \description{ 31 | Function which returns the tile IDs of the Sentinel-2 tiles 32 | which overlap a provided extent. 33 | } 34 | \note{ 35 | License: GPL 3.0 36 | } 37 | \examples{ 38 | \donttest{ 39 | ex_extent <- sf::st_read( 40 | system.file("extdata/vector/scalve.kml", package = "sen2r"), 41 | quiet = TRUE 42 | ) 43 | ex_extent <- ex_extent[1,] 44 | 45 | # Tile ID of the required S2 tile 46 | tiles_intersects(ex_extent) 47 | 48 | # Tile ID of all the overlapping S2 tiles 49 | tiles_intersects(ex_extent, all = TRUE) 50 | 51 | # Spatial object with the required tile 52 | sel_tiles <- tiles_intersects(ex_extent, out_format = "sf") 53 | plot(sf::st_geometry(sel_tiles)); plot(sf::st_geometry(ex_extent), add=TRUE, col="yellow") 54 | 55 | # Spatial object with the overlapping S2 tiles 56 | sel_tiles <- tiles_intersects(ex_extent, all = TRUE, out_format = "sf") 57 | plot(sf::st_geometry(sel_tiles)); plot(sf::st_geometry(ex_extent), add=TRUE, col="yellow") 58 | } 59 | } 60 | \references{ 61 | L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). 62 | "sen2r": An R toolbox for automatically downloading and preprocessing 63 | Sentinel-2 satellite data. \emph{Computers & Geosciences}, 139, 104473. 64 | \doi{10.1016/j.cageo.2020.104473}, URL: \url{https://sen2r.ranghetti.info/}. 65 | } 66 | \author{ 67 | Luigi Ranghetti, phD (2019) 68 | } 69 | -------------------------------------------------------------------------------- /tests/spelling.R: -------------------------------------------------------------------------------- 1 | if(requireNamespace('spelling', quietly = TRUE)) 2 | spelling::spell_check_test(vignettes = TRUE, error = FALSE, 3 | skip_on_cran = TRUE) 4 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(sen2r) 3 | 4 | test_check("sen2r") 5 | -------------------------------------------------------------------------------- /tests/testthat/old/test-create_s2_dop.R: -------------------------------------------------------------------------------- 1 | # context("Test create_s2_dop()") 2 | # testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | # 5 | # # NOTE: one test require a high amount of time (depending on connection speed), 6 | # # so it is disabled by default. To perform it, replace 'test_download = FALSE' with 'TRUE'. 7 | # test_download = TRUE 8 | # 9 | # testthat::test_that( 10 | # "Test that a new DOP DB is not built if another exists", { 11 | # out_time <- system.time(create_s2_dop()) 12 | # testthat::expect_lt(out_time["elapsed"], 10) 13 | # } 14 | # ) 15 | # 16 | # if (test_download) { 17 | # 18 | # testthat::test_that( 19 | # "Test the construction of a new DOP DB", { 20 | # 21 | # newjson_path <- file.path(tempdir(), "dop.json") 22 | # out_time <- system.time( 23 | # create_s2_dop(json_path = newjson_path, force = TRUE) 24 | # ) 25 | # testthat::expect_gt(out_time["elapsed"], 10) 26 | # defjson <- jsonlite::fromJSON(system.file("extdata/settings/doybase.json",package="sen2r")) 27 | # newjson <- jsonlite::fromJSON(newjson_path) 28 | # testthat::expect_is(newjson, "list") 29 | # testthat::expect_is(newjson$dop, "data.frame") 30 | # testthat::expect_equal(dim(newjson$dop), dim(defjson$dop)) 31 | # testthat::expect_equal(nrow(newjson$dop), 143) 32 | # testthat::expect_equal(names(newjson$dop), c("orbit", "doybase")) 33 | # 34 | # testthat::expect_equal(package_version(newjson$pkg_version), packageVersion("sen2r")) 35 | # testthat::expect_equal(as.Date(newjson$creation_date), Sys.Date()) 36 | # 37 | # } 38 | # ) 39 | # 40 | # } 41 | -------------------------------------------------------------------------------- /tests/testthat/old/test-t30_create_s2_dop.R: -------------------------------------------------------------------------------- 1 | # context("Test create_s2_dop()") 2 | # testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | # 5 | # # NOTE: one test require a high amount of time (depending on connection speed), 6 | # # so it is disabled by default. To perform it, replace 'test_download = FALSE' with 'TRUE'. 7 | # test_download = TRUE 8 | # 9 | # testthat::test_that( 10 | # "Test that a new DOP DB is not built if another exists", { 11 | # out_time <- system.time(create_s2_dop()) 12 | # testthat::expect_lt(out_time["elapsed"], 10) 13 | # } 14 | # ) 15 | # 16 | # if (test_download) { 17 | # 18 | # testthat::test_that( 19 | # "Test the construction of a new DOP DB", { 20 | # 21 | # newjson_path <- file.path(tempdir(), "dop.json") 22 | # out_time <- system.time( 23 | # create_s2_dop(json_path = newjson_path, force = TRUE) 24 | # ) 25 | # testthat::expect_gt(out_time["elapsed"], 10) 26 | # defjson <- jsonlite::fromJSON(system.file("extdata/settings/doybase.json",package="sen2r")) 27 | # newjson <- jsonlite::fromJSON(newjson_path) 28 | # testthat::expect_is(newjson, "list") 29 | # testthat::expect_is(newjson$dop, "data.frame") 30 | # testthat::expect_equal(dim(newjson$dop), dim(defjson$dop)) 31 | # testthat::expect_equal(nrow(newjson$dop), 143) 32 | # testthat::expect_equal(names(newjson$dop), c("orbit", "doybase")) 33 | # 34 | # testthat::expect_equal(package_version(newjson$pkg_version), packageVersion("sen2r")) 35 | # testthat::expect_equal(as.Date(newjson$creation_date), Sys.Date()) 36 | # 37 | # } 38 | # ) 39 | # 40 | # } 41 | -------------------------------------------------------------------------------- /tests/testthat/old/test-t35_create_indices_db.R: -------------------------------------------------------------------------------- 1 | # context("Test create_indices_db()") 2 | # testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | # 5 | # safe_dir <- file.path(dirname(attr(load_binpaths(), "path")), "safe") 6 | # dir.create(safe_dir, showWarnings = FALSE) 7 | # 8 | # 9 | # testthat::test_that( 10 | # "Test that a new indices DB is not built if another exists", { 11 | # out_time <- system.time(create_indices_db()) 12 | # testthat::expect_lt(out_time["elapsed"], 10) 13 | # } 14 | # ) 15 | # 16 | # 17 | # testthat::test_that( 18 | # "Test the construction of a new indices DB", { 19 | # 20 | # newjson_path <- file.path(tempdir(), "indices.json") 21 | # out_time <- system.time( 22 | # create_indices_db(json_path = newjson_path, force = TRUE) 23 | # ) 24 | # testthat::expect_gt(out_time["elapsed"], 10) 25 | # defjson <- jsonlite::fromJSON(system.file("extdata/settings/indices.json",package="sen2r")) 26 | # newjson <- jsonlite::fromJSON(newjson_path) 27 | # testthat::expect_is(newjson, "list") 28 | # testthat::expect_is(newjson$indices, "data.frame") 29 | # testthat::expect_equal(dim(newjson$indices), dim(defjson$indices)) 30 | # testthat::expect_equal(nrow(newjson$indices), 226) 31 | # testthat::expect_equal(names(newjson$indices), c( 32 | # "n_index", "longname", "name", "link", "s2_formula", 33 | # "checked", "s2_formula_mathml", "a", "b", "c", "d" 34 | # )) 35 | # 36 | # testthat::expect_equal(package_version(newjson$pkg_version), packageVersion("sen2r")) 37 | # testthat::expect_equal(as.Date(newjson$creation_date), Sys.Date()) 38 | # 39 | # } 40 | # ) 41 | -------------------------------------------------------------------------------- /tests/testthat/setup-commons.R: -------------------------------------------------------------------------------- 1 | # Define common paths 2 | ref_dir <- normalizePath(system.file("extdata/out", package = "sen2r")) 3 | safe_dir <- file.path(dirname(normalizePath(attr(load_binpaths(), "path"), mustWork = FALSE)), "safe") 4 | dir.create(safe_dir, showWarnings = FALSE) 5 | 6 | # Silence clock check (https://stackoverflow.com/questions/63613301/r-cmd-check-note-unable-to-verify-current-time) 7 | Sys.setenv('_R_CHECK_SYSTEM_CLOCK_' = 0) 8 | 9 | # Perform full tests? 10 | # If so, all the original tests are performed 11 | # (this is useful for codecov and after major releases). 12 | # If neither, only fast and strategic tests are executed. 13 | full_tests <- FALSE 14 | skip_full_tests <- function() {skip_if(full_tests == FALSE, "Full tests disabled")} 15 | # Perform tests calling GDAL? 16 | # On some specific isolated machines, calling sf::gdal_utils() 17 | # causes segmentation faults. 18 | # Functions which use GDAL are not tested in those cases. 19 | gdal_tests <- Sys.info()["user"] != "ripley" 20 | skip_gdal_tests <- function() {skip_if(gdal_tests == FALSE, "GDAL tests disabled")} 21 | -------------------------------------------------------------------------------- /tests/testthat/setup-dependencies.R: -------------------------------------------------------------------------------- 1 | if (identical(Sys.getenv("NOT_CRAN"), "true")) { 2 | 3 | # Install or check internal dependencies 4 | # install_sen2cor() 5 | # if (Sys.info()["sysname"] == "Windows") {sen2r::install_aria2()} 6 | if (full_tests) { 7 | if (Sys.info()["sysname"] == "Linux") {sen2r::check_gdal()} 8 | check_gcloud(force = TRUE, abort = FALSE) 9 | } 10 | s2tiles <- s2_tiles() 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/testthat/setup-scihub_creds.R: -------------------------------------------------------------------------------- 1 | if (full_tests) { 2 | 3 | # Retrieve Travis credentials 4 | tests_apihub <- try(sen2r::read_scihub_login(), silent = TRUE) 5 | 6 | if (!inherits(tests_apihub, "try-error")) { 7 | 8 | # Use a temporary apihub file 9 | write_scihub_login( 10 | tests_apihub[1], tests_apihub[2], 11 | tests_apihub_path <- tempfile(), 12 | check = FALSE 13 | ) 14 | 15 | # Return message 16 | message("Tests are run with SciHub user \"",tests_apihub[1],"\".") 17 | 18 | } else { 19 | message("Problems with SciHub credentials; check secrets.") 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /tests/testthat/test-build_example_param_file.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test build_example_param_file() ----") 2 | 3 | testthat::test_that( 4 | "Build an example parameter file", { 5 | json_path <- build_example_param_file() 6 | testthat::expect_true(file.exists(json_path)) 7 | list_param <- jsonlite::fromJSON(json_path) 8 | testthat::expect_equal( 9 | names(list_param), 10 | c("preprocess", "s2_levels", "sel_sensor", "online", "server", "order_lta", 11 | "downloader", "overwrite_safe", "rm_safe", "max_cloud_safe", 12 | "step_atmcorr", "sen2cor_use_dem", "sen2cor_gipp", 13 | "timewindow", "timeperiod", "extent", 14 | "s2tiles_selected", "s2orbits_selected", "list_prods", "list_indices", 15 | "list_rgb", "rgb_ranges", "index_source", "mask_type", "max_mask", 16 | "mask_smooth", "mask_buffer", "clip_on_extent", "extent_as_mask", 17 | "extent_name", "reference_path", "res", "res_s2", "unit", "proj", 18 | "resampling", "resampling_scl", "outformat", "rgb_outformat", 19 | "index_datatype", "compression", "rgb_compression", "overwrite", 20 | "path_l1c", "path_l2a", "path_tiles", "path_merged", "path_out", 21 | "path_rgb", "path_indices", "path_subdirs", "thumbnails", "log", 22 | "parallel", "processing_order", "pkg_version" 23 | ) 24 | ) 25 | } 26 | ) 27 | -------------------------------------------------------------------------------- /tests/testthat/test-check_gcloud.R: -------------------------------------------------------------------------------- 1 | message("\n---- Check GCloud connection - specific functions ----") 2 | testthat::skip_on_cran() 3 | # testthat::skip_on_ci() 4 | skip_full_tests() 5 | 6 | test_that("check internet connection on internal function", { 7 | testthat::skip_if_not(check_gcloud_connection(), "Google Cloud server is not reachable") 8 | expect_equal(check_gcloud_connection(), TRUE) 9 | expect_equal( 10 | httptest::without_internet(check_gcloud_connection()), 11 | FALSE 12 | ) 13 | }) 14 | 15 | 16 | testthat::test_that( 17 | "Check GCloud installation", { 18 | testthat::skip_if_not(is_gcloud_configured(), "Google account is not set") 19 | testthat::expect_equal( 20 | check_gcloud(force = TRUE), 21 | TRUE 22 | ) 23 | testthat::expect_equal( 24 | check_gcloud(load_binpaths()$gsutil, force = TRUE), 25 | TRUE 26 | ) 27 | testthat::expect_equal( 28 | check_gcloud(dirname(load_binpaths()$gsutil), force = TRUE), 29 | TRUE 30 | ) 31 | testthat::expect_error( 32 | check_gcloud("/wrong/path", force = TRUE), 33 | regexp = gsub( 34 | " ", "[ \n]", 35 | "Google Cloud SDK was not found" 36 | ) 37 | ) 38 | testthat::expect_warning( 39 | check_warning <- check_gcloud("/wrong/path", force = TRUE, abort = FALSE), 40 | regexp = gsub( 41 | " ", "[ \n]", 42 | "Google Cloud SDK was not found" 43 | ) 44 | ) 45 | testthat::expect_equal(check_warning, FALSE) 46 | } 47 | ) 48 | -------------------------------------------------------------------------------- /tests/testthat/test-gdalwarp_grid.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test gdalwarp_grid() ----") 2 | skip_gdal_tests() 3 | 4 | ex_sel <- system.file( 5 | "extdata/out/S2A2A_20190723_022_Barbellino_RGB432B_10.tif", 6 | package = "sen2r" 7 | ) 8 | ex_ref <- system.file( 9 | "extdata/out/S2A2A_20190723_022_Barbellino_SCL_10.tif", 10 | package = "sen2r" 11 | ) 12 | testthat::test_that( 13 | "Test on reshaping with gdalwarp_grid()", { 14 | 15 | exp_outpath_4b <- tempfile(fileext = "_BOA_out.tif") 16 | testthat::expect_true(all(file.exists(ex_sel,ex_ref))) 17 | 18 | unlink(exp_outpath_4b) 19 | sen2r:::gdalwarp_grid(srcfiles = ex_sel, dstfiles = exp_outpath_4b, ref = ex_ref) 20 | 21 | # test on raster metadata 22 | exp_meta_r <- raster_metadata(exp_outpath_4b, format = "data.frame") 23 | testthat::expect_equal(names(exp_meta_r), c( 24 | "path", "valid", "res.x", "res.y", "size.x", "size.y", "nbands", 25 | "xmin", "ymin", "xmax", "ymax", "proj", "unit", "outformat", "type" 26 | )) 27 | testthat::expect_equal(exp_meta_r[,c("size.x", "size.y")], data.frame("size.x"=12, "size.y"=21)) 28 | testthat::expect_equal(exp_meta_r[,c("res.x", "res.y")], data.frame("res.x"=20, "res.y"=20)) 29 | testthat::expect_equal(exp_meta_r$nbands, 3) 30 | testthat::expect_equal( 31 | exp_meta_r[,c("xmin", "xmax", "ymin", "ymax")], 32 | data.frame("xmin" = 580560, "xmax" = 580800, "ymin" = 5101700, "ymax" = 5102120) 33 | ) 34 | expect_equal_crs(st_crs2(exp_meta_r$proj), 32632) 35 | testthat::expect_equal(exp_meta_r$type, "Byte") 36 | testthat::expect_equal(exp_meta_r$outformat, "GTiff") 37 | 38 | # expect error on sen2r metadata with unstandard name 39 | exp_meta_s <- testthat::expect_error( 40 | sen2r_getElements(exp_outpath_4b), 41 | regexp = "not[ \n]recognised" 42 | ) 43 | 44 | # test on raster values 45 | exp_stars <- stars::read_stars(exp_outpath_4b) 46 | testthat::expect_equal(mean(exp_stars[[1]][,,3], na.rm=TRUE), 77.17063, tolerance = 1e-03) 47 | testthat::expect_equal(sum(is.na(exp_stars[[1]][,,3])), 0, tolerance = 1e-03) 48 | rm(exp_stars) 49 | 50 | } 51 | ) 52 | -------------------------------------------------------------------------------- /tests/testthat/test-list_indices.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test list indices ----") 2 | # testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | 5 | testthat::test_that( 6 | "Test the generation of a data.frame ", { 7 | df1 <- list_indices(c("name","longname")) 8 | testthat::expect_is(df1, "data.frame") 9 | testthat::expect_length(df1, 2) 10 | } 11 | ) 12 | 13 | testthat::test_that( 14 | "Test the generation of a vector ", { 15 | v1 <- list_indices("s2_formula", "^MSAVI2$") 16 | testthat::expect_is(v1, "character") 17 | testthat::expect_length(v1, 1) 18 | } 19 | ) 20 | 21 | testthat::test_that( 22 | "Test list indices to be updated ", { 23 | v2 <- list_indices("name", all = TRUE) 24 | testthat::expect_is(v2, "character") 25 | v2_version <- attr(v2, "pkg_version") 26 | sen2r_version <- packageVersion("sen2r") 27 | # Only first two elements are checked 28 | # (updating the indices list is so required only before a minor update, 29 | # not a patch update) 30 | testthat::expect_equal(v2_version$major, sen2r_version$major) 31 | testthat::expect_equal(v2_version$minor, sen2r_version$minor) 32 | # testthat::expect_equal(v2_version$patchlevel, sen2r_version$patchlevel) 33 | } 34 | ) 35 | -------------------------------------------------------------------------------- /tests/testthat/test-load_binpaths.R: -------------------------------------------------------------------------------- 1 | message("\n---- Load binaries ----") 2 | testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | skip_full_tests() 5 | 6 | binpaths_file <- normalize_path(file.path( 7 | if (dir.exists("~/.sen2r")) {"~/.sen2r"} else {tempdir()}, 8 | "paths.json" 9 | ), mustWork = FALSE) 10 | binpaths_file_backup <- tempfile() 11 | if (file.exists(binpaths_file)) { 12 | file.copy(binpaths_file, binpaths_file_backup) 13 | file.remove(binpaths_file) 14 | restore_settings <- TRUE 15 | } else { 16 | restore_settings <- FALSE 17 | } 18 | 19 | test_that("Load empty binpaths", { 20 | binpaths_0 <- load_binpaths() 21 | expect_is(binpaths_0, "list") 22 | expect_length(binpaths_0, 0) 23 | expect_equal(basename(attr(binpaths_0, "path")), "paths.json") 24 | }) 25 | 26 | test_that("Try loading Sen2Cor", { 27 | testthat::expect_warning( 28 | binpaths_1 <- load_binpaths("sen2cor"), 29 | "Sen2Cor was not found in your system;" 30 | ) 31 | expect_is(binpaths_1, "list") 32 | expect_length(binpaths_1, 0) 33 | expect_equal(basename(attr(binpaths_1, "path")), "paths.json") 34 | }) 35 | 36 | if (Sys.info()["sysname"] == "Linux") { 37 | test_that("Load GDAL", { 38 | binpaths_2 <- load_binpaths(c("gdal")) 39 | expect_is(binpaths_2, "list") 40 | expect_length(binpaths_2, 3) 41 | expect_equal(binpaths_2$gdalinfo, normalize_path(Sys.which("gdalinfo"))) 42 | expect_equal(basename(attr(binpaths_2, "path")), "paths.json") 43 | }) 44 | test_that("Load aria2", { 45 | binpaths_3 <- load_binpaths("aria2") 46 | expect_is(binpaths_3, "list") 47 | expect_length(binpaths_3, 4) 48 | expect_equal(binpaths_3$aria2, normalize_path(Sys.which("aria2c"))) 49 | expect_equal(basename(attr(binpaths_3, "path")), "paths.json") 50 | }) 51 | } 52 | 53 | if (restore_settings) { 54 | file.copy(binpaths_file_backup, binpaths_file) 55 | } 56 | -------------------------------------------------------------------------------- /tests/testthat/test-mountpoint.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test mountpoint() ----") 2 | testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | skip_full_tests() 5 | 6 | if (Sys.info()["sysname"] == "Linux") { # FIXME test on macOS 7 | testthat::test_that( 8 | "Mountpoint home", { 9 | mp_1 <- mountpoint(".") 10 | testthat::expect_is(mp_1, "character") 11 | testthat::expect_true(dir.exists(mp_1)) 12 | testthat::expect_equal(names(attributes(mp_1)), "protocol") 13 | } 14 | ) 15 | testthat::test_that( 16 | "Mountpoint package home", { 17 | mp_2 <- mountpoint(system.file(package = "sen2r")) 18 | testthat::expect_is(mp_2, "character") 19 | testthat::expect_true(dir.exists(mp_2)) 20 | testthat::expect_equal(names(attributes(mp_2)), "protocol") 21 | } 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /tests/testthat/test-projpar.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test projpar() / projname() ----") 2 | # testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | skip_gdal_tests() 5 | 6 | testthat::test_that( 7 | "Test longlat", { 8 | wgs84_projnames <- c( 9 | "WGS 84", 10 | "WGS 84 (with axis order normalized for visualization)", 11 | "unknown" 12 | ) 13 | crs_totest <- st_crs(4326) 14 | testthat::expect_true(projname(crs_totest) %in% wgs84_projnames) 15 | testthat::expect_warning( 16 | testthat::expect_true(projpar(crs_totest, "geogcs") %in% wgs84_projnames), 17 | gsub(" ", "[ \n]", "is now an alias of par = \"name\"") 18 | ) 19 | testthat::expect_equivalent(projpar(crs_totest, "unit"), "degree") 20 | testthat::expect_error( 21 | testthat::expect_equivalent(projpar(crs_totest, "datum"), "WGS_1984"), 22 | gsub(" ", "[ \n]", "is no longer accepted") 23 | ) 24 | } 25 | ) 26 | 27 | testthat::test_that( 28 | "Test UTM32", { 29 | crs_totest <- st_crs2("32N") 30 | testthat::expect_true( 31 | projname(crs_totest) %in% 32 | c("UTM Zone 32, Northern Hemisphere", "WGS 84 / UTM zone 32N", "unknown") 33 | ) 34 | testthat::expect_warning( 35 | testthat::expect_true( 36 | projpar(crs_totest, "geogcs") %in% 37 | c("UTM Zone 32, Northern Hemisphere", "WGS 84 / UTM zone 32N", "unknown") 38 | ), 39 | gsub(" ", "[ \n]", "is now an alias of par = \"name\"") 40 | ) 41 | testthat::expect_true(projpar(crs_totest, "unit") %in% c("Meter", "metre")) 42 | testthat::expect_error( 43 | testthat::expect_equivalent(projpar(crs_totest, "datum"), "WGS_1984"), 44 | gsub(" ", "[ \n]", "is no longer accepted") 45 | ) 46 | } 47 | ) 48 | 49 | -------------------------------------------------------------------------------- /tests/testthat/test-s2_rgb.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test compute RGB images - main s2_rgb() ----") 2 | skip_gdal_tests() 3 | 4 | testthat::test_that( 5 | "Tests on function s2_rgb()", { 6 | 7 | outdir_17 <- tempfile(pattern = "out_test17_") 8 | dir.create(outdir_17, showWarnings = FALSE) 9 | exp_outpath_17 <- file.path( 10 | outdir_17, c("RGBb84B","RGB954B"), 11 | paste0("S2A2A_20190723_022_Barbellino_",c("RGBb84B","RGB954B"),"_10.tif") 12 | ) 13 | unlink(exp_outpath_17) 14 | s2_rgb( 15 | infiles = file.path(ref_dir, "S2A2A_20190723_022_Barbellino_BOA_10.tif"), 16 | rgb_bands = list(c(11,8,4),c(9,5,4)), 17 | scaleRange = list(c(0,7500), matrix(c(rep(0,3),8500,6000,4000),ncol=2)), 18 | outdir = outdir_17, 19 | compress = 90, 20 | proc_mode = "stars", 21 | parallel = FALSE 22 | ) 23 | testthat::expect_true(all(file.exists(exp_outpath_17))) 24 | 25 | # test on raster metadata 26 | exp_meta_r <- raster_metadata(exp_outpath_17) # default format: data.table 27 | testthat::expect_equal( 28 | exp_meta_r[,c("size.x", "size.y")], 29 | data.table("size.x"=rep(24,2), "size.y"=42) 30 | ) 31 | testthat::expect_equal( 32 | exp_meta_r[,c("res.x", "res.y")], 33 | data.table("res.x"=rep(10,2), "res.y"=10) 34 | ) 35 | testthat::expect_equal(exp_meta_r$nbands, c(3,3)) 36 | testthat::expect_equal( 37 | exp_meta_r[1,c("xmin", "xmax", "ymin", "ymax")], 38 | data.table("xmin" = 580560, "xmax" = 580800, "ymin" = 5101700, "ymax" = 5102120) 39 | ) 40 | expect_equal_crs(st_crs2(exp_meta_r$proj[2]), 32632) 41 | testthat::expect_equal(exp_meta_r$type, rep("Byte",2)) 42 | testthat::expect_equal(exp_meta_r$outformat, rep("GTiff",2)) # default value 43 | 44 | # test on raster values 45 | skip_full_tests() 46 | exp_stars <- stars::read_stars(exp_outpath_17) 47 | testthat::expect_equal(mean(exp_stars[[1]], na.rm=TRUE), 56.30718, tolerance = 1e-3) 48 | testthat::expect_equal(mean(exp_stars[[2]], na.rm=TRUE), 56.71991, tolerance = 1e-3) 49 | testthat::expect_equal(sum(is.na(exp_stars[[1]])), 169, tolerance = 1e-3) #zeros 50 | rm(exp_stars) 51 | 52 | } 53 | ) 54 | -------------------------------------------------------------------------------- /tests/testthat/test-scihub_login.R: -------------------------------------------------------------------------------- 1 | message("\n---- Check SciHub connection - specific function ----") 2 | testthat::skip_on_cran() 3 | # testthat::skip_on_ci() 4 | skip_full_tests() 5 | 6 | test_that("check internet connection on internal function", { 7 | testthat::skip_if_not(check_scihub_connection(service = "apihub"), "API Hub server is not reachable") 8 | testthat::skip_if_not(check_scihub_connection(service = "dhus"), "SciHub dhus server is not reachable") 9 | expect_equal(check_scihub_connection(), TRUE) 10 | expect_equal( 11 | httptest::without_internet(check_scihub_connection()), 12 | FALSE 13 | ) 14 | }) 15 | 16 | 17 | message("\n---- Read / write SciHub login ----") 18 | testthat::skip_on_cran() 19 | # testthat::skip_on_ci() 20 | 21 | test_that("check reading / writing credentials", { 22 | testthat::skip_if_not(check_scihub_connection(service = "apihub"), "API Hub server is not reachable") 23 | testthat::skip_if_not(check_scihub_connection(service = "dhus"), "SciHub dhus server is not reachable") 24 | testthat::expect_error( 25 | write_scihub_login("user2", "user2"), 26 | regexp = gsub( 27 | " ", "[ \n]", 28 | "[Tt]he provided credentials are not valid" 29 | ) 30 | ) 31 | testthat::skip_if_not(is_scihub_configured(), "SciHub credentials are not set") 32 | creds <- read_scihub_login(apihub_path = tests_apihub_path) 33 | testthat::expect_equal(creds[1,], c(tests_apihub[1], tests_apihub[2])) 34 | }) 35 | 36 | 37 | message("\n---- Check SciHub login ----") 38 | testthat::skip_on_cran() 39 | # testthat::skip_on_ci() 40 | 41 | test_that("check_scihub_login works as expected", { 42 | testthat::skip_if_not(check_scihub_connection(service = "apihub"), "API Hub server is not reachable") 43 | testthat::skip_if_not(check_scihub_connection(service = "dhus"), "SciHub dhus server is not reachable") 44 | expect_false(check_scihub_login("BastianoCoimbraDeLaCoronilla", "yAcevedo!")) 45 | testthat::skip_if_not(is_scihub_configured(), "SciHub credentials are not set") 46 | expect_true(check_scihub_login(tests_apihub[1], tests_apihub[2])) 47 | }) 48 | -------------------------------------------------------------------------------- /tests/testthat/test-sen2r-06_ignorelist.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test ignorelist ----") 2 | testthat::skip_on_cran() 3 | testthat::skip_on_ci() # TODO try to remove 4 | skip_full_tests() 5 | testthat::skip_if_not(is_gcloud_configured(), "Google account is not set") 6 | testthat::skip_if_not(check_gcloud_connection(), "Google Cloud server is not reachable") 7 | 8 | # Ensure required SAFE to be downloaded 9 | s2_l2a_list <- c( 10 | "S2B_MSIL2A_20200801T100559_N0214_R022_T32TNR_20200801T135302.SAFE", 11 | "S2B_MSIL2A_20200801T100559_N0214_R022_T32TNS_20200801T135302.SAFE" 12 | ) 13 | 14 | testthat::test_that( 15 | "Tests on safelist read/write", { 16 | 17 | # Check sample inputs 18 | testthat::skip_if_not(file.exists(file.path( 19 | safe_dir, s2_l2a_list[1], 20 | "GRANULE/L2A_T32TNR_A017780_20200801T101400/IMG_DATA/R10m", 21 | "T32TNR_20200801T100559_B08_10m.jp2" 22 | ))) 23 | testthat::skip_if_not(file.exists(file.path( 24 | safe_dir, s2_l2a_list[2], 25 | "GRANULE/L2A_T32TNS_A017780_20200801T101400/IMG_DATA/R10m", 26 | "T32TNS_20200801T100559_B08_10m.jp2" 27 | ))) 28 | 29 | outdir_17 <- tempfile(pattern = "out_test17_") 30 | dir.create(dirname(outdir_17), showWarnings = FALSE) 31 | out_17 <- sen2r( 32 | gui = FALSE, 33 | online = FALSE, 34 | step_atmcorr = "l2a", # to avoid checks on Sen2Cor 35 | extent = system.file("extdata/vector/barbellino.geojson", package = "sen2r"), 36 | extent_name = "Barbellino", 37 | timewindow = as.Date("2020-08-01"), 38 | list_indices = c("NDVI","MSAVI2"), 39 | list_rgb = c("RGB432B"), 40 | mask_type = "land", 41 | max_mask = 10, 42 | path_l2a = safe_dir, 43 | path_out = outdir_17, 44 | thumbnails = FALSE 45 | ) 46 | 47 | ignorelist_path <- file.path(outdir_17, ".ignorelist.txt") 48 | expect_true(file.exists(ignorelist_path)) 49 | ignorelist <- RcppTOML::parseTOML(ignorelist_path) 50 | expect_length(ignorelist, 4) 51 | expect_equal( 52 | sort(names(ignorelist)), 53 | c("dates_cloudcovered", "mask_type", "max_mask", "names_missing") 54 | ) 55 | expect_equal(ignorelist$max_mask, 10) 56 | expect_equal(ignorelist$mask_type, "land") 57 | expect_equal(ignorelist$dates_cloudcovered, as.Date("2020-08-01")) 58 | 59 | # Relaunch the same processing to test that dates are skipped 60 | # (and to test read_ignorepath) 61 | out_17_2 <- sen2r(attr(out_17, "procpath")) 62 | expect_equal(length(out_17_2), 0) 63 | 64 | } 65 | ) 66 | -------------------------------------------------------------------------------- /tests/testthat/test-sen2r_getElements.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test sen2r_getElements ----") 2 | # testthat::skip_on_cran() 3 | # testthat::skip_on_travis() 4 | 5 | fs2nc_examplename <- "/path/of/the/product/S2A1C_20170603_022_32TQQ_TOA_20.tif" 6 | 7 | testthat::test_that( 8 | "Tests on sen2r_getElements", { 9 | # Return metadata 10 | meta <- sen2r_getElements(fs2nc_examplename) 11 | testthat::expect_is(meta, "data.table") 12 | testthat::expect_equal(meta, data.table( 13 | type = "tile", mission = "A", 14 | level = "1C", 15 | sensing_date = structure(17320, class = "Date"), 16 | id_orbit = "022", 17 | extent_name = "32TQQ", 18 | prod_type = "TOA", 19 | res = "20m", 20 | file_ext = "tif") 21 | ) 22 | 23 | meta <- sen2r_getElements(fs2nc_examplename, format = "data.frame") 24 | testthat::expect_is(meta, "data.frame") 25 | 26 | meta <- sen2r_getElements(fs2nc_examplename, format = "list") 27 | testthat::expect_is(meta, "list") 28 | } 29 | ) 30 | 31 | fs2nc_examplename_new <- "/path/of/the/product/S2_20170603_022_32TQQ_A_TOA.tif" 32 | 33 | testthat::test_that( 34 | "Tests on sen2r_getElements, new naming convention", { 35 | # Return metadata 36 | meta <- sen2r_getElements( 37 | fs2nc_examplename_new, 38 | naming_convention = "sen2r_new" 39 | ) 40 | testthat::expect_is(meta, "data.table") 41 | testthat::expect_equal(meta, data.table( 42 | type = "tile", 43 | sensing_date = structure(17320, class = "Date"), 44 | id_orbit = "022", 45 | extent_name = "32TQQ", 46 | mission = "A", 47 | prod_type = "TOA", 48 | file_ext = "tif") 49 | ) 50 | } 51 | ) 52 | -------------------------------------------------------------------------------- /tests/testthat/test-st_crs2.R: -------------------------------------------------------------------------------- 1 | message("\n---- Test st_crs2 ----") 2 | skip_gdal_tests() 3 | 4 | testthat::test_that( 5 | "st_crs2, input EPSG", { 6 | expect_equal_crs(st_crs2(9), 32609) 7 | expect_equal_crs(st_crs2("EPSG:32609"), 32609) 8 | expect_equal_crs(st_crs2("9N"), 32609) 9 | expect_equal_crs(st_crs2("9S"), 32709) 10 | } 11 | ) 12 | 13 | testthat::test_that( 14 | "st_crs2, input raster file [path]", { 15 | raster_path <- system.file( 16 | "extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif", 17 | package="sen2r" 18 | ) 19 | expect_equal_crs(st_crs2(raster_path), 32632) 20 | expect_equal_crs(st_crs2(stars::read_stars(raster_path)), 32632) 21 | # This test was skipped while raster is reading PROJ.4 instead than WKT, 22 | # and so the EPSG is being lost (#295). 23 | # testthat::expect_equal(st_crs2(raster::raster(raster_path))$epsg, 32632) 24 | } 25 | ) 26 | 27 | testthat::test_that( 28 | "st_crs2, input vector file [path]", { 29 | raster_path <- system.file( 30 | "extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif", 31 | package="sen2r" 32 | ) 33 | vector_path <- system.file( 34 | "extdata/vector/barbellino.geojson", 35 | package="sen2r" 36 | ) 37 | # 38 | expect_equal_crs(st_crs2(raster_path), 32632) 39 | expect_equal_crs(st_crs2(stars::read_stars(raster_path)), 32632) 40 | # testthat::expect_equal(st_crs2(raster::raster(raster_path))$epsg, 32632) 41 | expect_equal_crs(st_crs2(vector_path), 32632) 42 | expect_equal_crs(st_crs2(sf::read_sf(vector_path)), 32632) 43 | expect_equal_crs(st_crs2(as(sf::read_sf(vector_path), "Spatial")), 32632) 44 | } 45 | ) 46 | 47 | testthat::test_that( 48 | "st_crs2, generics and errors", { 49 | testthat::expect_error(st_crs2("wrong"), "invalid crs\\: wrong") 50 | testthat::expect_equal(st_crs2(NULL), sf::st_crs(NA)) 51 | testthat::expect_equal(st_crs2(NA), sf::st_crs(NA)) 52 | testthat::expect_equal(st_crs2(), sf::st_crs(NA)) 53 | } 54 | ) 55 | 56 | 57 | # testthat::skip_on_cran() 58 | # testthat::skip_on_travis() 59 | 60 | testthat::test_that( 61 | "st_crs2, input WKT", { 62 | wkt_32n <- st_as_text_2(st_crs(32609)) 63 | writeLines(wkt_32n, wkt_32n_path <- tempfile()) 64 | expect_equal_crs(st_crs2(wkt_32n), 32609) 65 | expect_equal_crs(st_crs2(wkt_32n_path), 32609) 66 | } 67 | ) 68 | 69 | testthat::test_that( 70 | "st_crs2, input PROJ.4", { 71 | expect_equal_crs(st_crs2("+init=epsg:32609"), 32609) 72 | testthat::expect_warning( 73 | st_crs2("+proj=utm +zone=9 +datum=WGS84 +units=m +no_defs"), 74 | "Using PROJ\\.4 strings is deprecated with" 75 | ) 76 | } 77 | ) 78 | -------------------------------------------------------------------------------- /utils/code/code_coverage.R: -------------------------------------------------------------------------------- 1 | # Code for manual package coverage 2 | # move ~/.sen2r to ~/.sen2r~ before! 3 | Sys.setenv("NOT_CRAN"="true") 4 | sen2r_covr <- covr::package_coverage( 5 | line_exclusions = c( 6 | "R/s2_gui.R", 7 | "R/add_rgb_image.R", 8 | "R/give_write_permission.R", 9 | "R/check_sen2r_deps.R", 10 | "R/check_gui_deps.R", 11 | "R/create_indices_db.R", 12 | "R/helpers_extent.R", 13 | "R/gdal_formats_db.R", 14 | "R/path_check.R", 15 | "R/list_sen2r_paths.R", 16 | "R/check_param_list.R", 17 | "R/convert_datatype.R", 18 | "R/dontuse.R" 19 | ) 20 | ) 21 | covr::codecov(sen2r_covr) -------------------------------------------------------------------------------- /utils/code/create_README.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script used to automatically generate README.Rmd from index.Rmd 4 | # (replacing internal links with complete links to the online documentation 5 | # at https://sen2r.ranghetti.info) 6 | 7 | # Launch the script from the main sen2r directory 8 | sed -e "s/](\([^\(\)]*\)\.md)/](https:\/\/sen2r.ranghetti.info\/\1\.html)/g" index.Rmd > temp.Rmd 9 | sed -e "s/https\:\/\/sen2r\.ranghetti\.info\/\.github\/CODE\-OF\-CONDUCT\.html/blob\/main\/.github\/CODE-OF-CONDUCT.md/g" temp.Rmd > README.Rmd 10 | rm temp.Rmd 11 | -------------------------------------------------------------------------------- /utils/code/mask_types.R: -------------------------------------------------------------------------------- 1 | 2 | # Internal code used to generate the images for mask comparison 3 | 4 | library(sen2r) 5 | library(ggimage) 6 | 7 | # Define directories and parameters 8 | safe_dir <- file.path(dirname(attr(load_binpaths(), "path")), "safe") 9 | dir.create(safe_dir, showWarnings = FALSE) 10 | out_dir <- tempfile(pattern = "out_masktypes_") 11 | dir.create(out_dir) 12 | 13 | sel_extent <- st_as_sfc(st_bbox( 14 | c("xmin"=583E3, "ymin"=5094E3, "xmax"=590E3, "ymax"=5098E3), 15 | crs = st_crs(32632) 16 | )) 17 | 18 | # Run sen2r to generate outputs 19 | for (s in c(0,30,100)) { 20 | for (b in c(0,30,100)) { 21 | sen2r( 22 | gui = FALSE, 23 | online = TRUE, 24 | s2tiles_selected = "32TNR", 25 | s2_levels = "l2a", 26 | step_atmcorr = "l2a", 27 | extent = sel_extent, 28 | extent_name = paste0("s",str_pad2(s,3,"left","0"),"b",str_pad2(b,3,"left","0")), 29 | extent_as_mask = FALSE, 30 | timewindow = as.Date("2018-08-05"), 31 | list_prods = c("TCI","SCL"), 32 | mask_type = "scl_0_1_2_3_7_8_9_11", mask_smooth=s, mask_buffer=b, 33 | path_l1c = safe_dir, 34 | path_l2a = safe_dir, 35 | path_out = out_dir, 36 | # tmpdir = file.path(out_dir,"tmp2"), 37 | rmtmp=FALSE 38 | ) 39 | } 40 | } 41 | 42 | # Load TCI images 43 | maps <- data.frame( 44 | "map" = list.files(file.path(out_dir,"TCI"), "\\.tif$", full.names=TRUE), 45 | stringsAsFactors = FALSE 46 | ) 47 | maps$smooth <- as.integer(gsub("^.+s([0-9]{3})b([0-9]{3}).+$","\\1",maps$map)) 48 | maps$buffer <- as.integer(gsub("^.+s([0-9]{3})b([0-9]{3}).+$","\\2",maps$map)) 49 | maps <- maps[maps$smooth %in% c(0,30,100) & maps$buffer %in% c(0,30,100),] 50 | maps$n <- seq_len(nrow(maps)) 51 | 52 | # Plot them 53 | plot_maps <- ggplot(maps, aes(x=0, y=0)) + 54 | geom_image(aes(image=map), size=Inf) + 55 | geom_text(x=Inf, y=-Inf, aes(label = n), colour="white", hjust=2, vjust=-1, fontface=2) + 56 | facet_grid(smooth~buffer, switch="both") + 57 | # scale_size_identity() + 58 | # coord_fixed() + 59 | xlab("Buffer (m)") + ylab("Smooth (m)") + 60 | theme_minimal() + 61 | theme(axis.text=element_blank(), 62 | axis.ticks=element_blank()) 63 | 64 | # Export plots 65 | jpeg(file.path(system.file("www","images", package="sen2r"),"mask_types.jpg"), 1450,850, res=100) 66 | print(plot_maps) 67 | dev.off() 68 | -------------------------------------------------------------------------------- /utils/palettes/NDVI_1.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 0 37 | 38 | -------------------------------------------------------------------------------- /utils/palettes/NDVI_10000.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 0 37 | 38 | -------------------------------------------------------------------------------- /utils/palettes/SCL.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 0 26 | 27 | -------------------------------------------------------------------------------- /utils/palettes/SR_NirRG.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 8 | 7500 9 | StretchToMinimumMaximum 10 | 11 | 12 | 0 13 | 7500 14 | StretchToMinimumMaximum 15 | 16 | 17 | 0 18 | 7500 19 | StretchToMinimumMaximum 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 28 | -------------------------------------------------------------------------------- /utils/palettes/SR_RGB.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 8 | 2500 9 | StretchToMinimumMaximum 10 | 11 | 12 | 0 13 | 2500 14 | StretchToMinimumMaximum 15 | 16 | 17 | 0 18 | 2500 19 | StretchToMinimumMaximum 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 28 | -------------------------------------------------------------------------------- /utils/palettes/SR_SwirNirR.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 8 | 8000 9 | StretchToMinimumMaximum 10 | 11 | 12 | 0 13 | 8000 14 | StretchToMinimumMaximum 15 | 16 | 17 | 0 18 | 8000 19 | StretchToMinimumMaximum 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 28 | -------------------------------------------------------------------------------- /utils/palettes/Zscore.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 0 23 | 24 | -------------------------------------------------------------------------------- /utils/vector/ch_bound.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/utils/vector/ch_bound.rds -------------------------------------------------------------------------------- /utils/vector/s2_tiles.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranghetti/sen2r/e47a78d67944036a491d685c1438e8a327d3228e/utils/vector/s2_tiles.rds --------------------------------------------------------------------------------