{"id":299671,"name":"rOPTRAM","description":"Implements The OPtical TRapezoid Model (OPTRAM) to derive soil moisture based on the linear relation between a vegetation index, i.e. NDVI, and Shortwave Infra-red.","url":"https://github.com/ropensci/roptram","last_synced_at":"2026-04-14T00:30:21.164Z","repository":{"id":243067259,"uuid":"811356946","full_name":"ropensci/rOPTRAM","owner":"ropensci","description":"Derive Soil Moisture Using the OPTRAM Algorithm","archived":false,"fork":false,"pushed_at":"2026-03-21T14:52:47.000Z","size":62594,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-31T18:03:43.206Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/rOPTRAM/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-06T12:46:15.000Z","updated_at":"2026-03-21T14:52:51.000Z","dependencies_parsed_at":"2024-06-27T18:47:14.510Z","dependency_job_id":"313b253d-9b99-4a3e-9760-34ae67da59c8","html_url":"https://github.com/ropensci/rOPTRAM","commit_stats":{"total_commits":708,"total_committers":5,"mean_commits":141.6,"dds":0.1426553672316384,"last_synced_commit":"aa147a8be6a8809b49bc0151f4617c0a9f1261f9"},"previous_names":["ropensci/roptram"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ropensci/rOPTRAM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FrOPTRAM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FrOPTRAM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FrOPTRAM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FrOPTRAM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/rOPTRAM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FrOPTRAM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31313842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"owner":{"login":"ropensci","name":"rOpenSci","uuid":"1200269","kind":"organization","description":"","email":"info@ropensci.org","website":"https://ropensci.org/","location":"Berkeley, CA","twitter":"rOpenSci","company":null,"icon_url":"https://avatars.githubusercontent.com/u/1200269?v=4","repositories_count":307,"last_synced_at":"2023-03-10T20:30:59.242Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/ropensci","funding_links":[],"total_stars":null,"followers":null,"following":null,"created_at":"2022-11-02T19:23:08.224Z","updated_at":"2023-03-10T20:30:59.305Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci/repositories"},"packages":[],"commits":{"id":1693096,"full_name":"ropensci/roptram","default_branch":"main","total_commits":764,"total_committers":5,"total_bot_commits":0,"total_bot_committers":0,"mean_commits":152.8,"dds":0.04973821989528793,"past_year_total_commits":43,"past_year_total_committers":2,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":21.5,"past_year_dds":0.023255813953488413,"last_synced_at":"2026-04-08T11:17:33.572Z","last_synced_commit":"223cd0c774f77f9c3daf7f8823d7fb7592165038","created_at":"2024-09-06T00:17:16.410Z","updated_at":"2026-04-08T11:16:54.151Z","committers":[{"name":"Micha Silver","email":"silverm@post.bgu.ac.il","login":"micha-silver","count":726},{"name":"Ron Beiden","email":"125788367+RonBeiden","login":"RonBeiden","count":31},{"name":"Natalya","email":"npanov5856@gmail.com","login":null,"count":5},{"name":"Maëlle Salmon","email":"maelle.salmon@yahoo.se","login":"maelle","count":1},{"name":"Micha","email":"micha@tp480","login":null,"count":1}],"past_year_committers":[{"name":"Micha Silver","email":"silverm@post.bgu.ac.il","login":"micha-silver","count":42},{"name":"Micha","email":"micha@tp480","login":null,"count":1}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Froptram/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-09T00:00:23.197Z","repositories_count":6212716,"commits_count":906467613,"contributors_count":34968293,"owners_count":1143518,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"ropensci/roptram","html_url":"https://github.com/ropensci/roptram","last_synced_at":"2026-03-31T18:00:42.045Z","status":"active","issues_count":4,"pull_requests_count":5,"avg_time_to_close_issue":23316740.0,"avg_time_to_close_pull_request":15414643.333333334,"issues_closed_count":4,"pull_requests_closed_count":3,"pull_request_authors_count":2,"issue_authors_count":4,"avg_comments_per_issue":4.5,"avg_comments_per_pull_request":1.0,"merged_pull_requests_count":2,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":1,"past_year_pull_requests_count":1,"past_year_avg_time_to_close_issue":19261789.0,"past_year_avg_time_to_close_pull_request":null,"past_year_issues_closed_count":1,"past_year_pull_requests_closed_count":0,"past_year_pull_request_authors_count":1,"past_year_issue_authors_count":1,"past_year_avg_comments_per_issue":2.0,"past_year_avg_comments_per_pull_request":0.0,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":0,"created_at":"2024-09-06T00:17:17.640Z","updated_at":"2026-03-31T18:00:42.045Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Froptram","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Froptram/issues","issue_labels_count":{"documentation":1},"pull_request_labels_count":{},"issue_author_associations_count":{"NONE":2,"MEMBER":1,"COLLABORATOR":1},"pull_request_author_associations_count":{"MEMBER":4,"NONE":1},"issue_authors":{"micha-silver":1,"maelle":1,"javimarlop":1,"kiviarttu":1},"pull_request_authors":{"maelle":4,"tsemachg":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-09T00:00:10.509Z","repositories_count":14193586,"issues_count":34638451,"pull_requests_count":113235296,"authors_count":11231976,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{},"past_year_pull_request_author_associations_count":{"NONE":1},"past_year_issue_authors":{},"past_year_pull_request_authors":{"tsemachg":1},"maintainers":[{"login":"maelle","count":5,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/maelle"},{"login":"micha-silver","count":1,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/micha-silver"}],"active_maintainers":[]},"events":{"total":{"DeleteEvent":2,"IssuesEvent":4,"WatchEvent":5,"IssueCommentEvent":11,"PushEvent":26,"CreateEvent":1},"last_year":{"WatchEvent":2,"IssueCommentEvent":7,"PushEvent":13}},"keywords":[],"dependencies":[{"ecosystem":"cran","filepath":"DESCRIPTION","sha":null,"kind":"manifest","created_at":"2024-06-06T15:05:42.452Z","updated_at":"2024-06-06T15:05:42.452Z","repository_link":"https://github.com/ropensci/rOPTRAM/blob/main/DESCRIPTION","dependencies":[{"id":18447383601,"package_name":"R","ecosystem":"cran","requirements":"\u003e= 4.1.0","direct":true,"kind":"depends","optional":false},{"id":18447383602,"package_name":"dplyr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":18447383603,"package_name":"ggplot2","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":18447383604,"package_name":"sf","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":18447383605,"package_name":"terra","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":18447383606,"package_name":"utils","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":18447383607,"package_name":"geojsonio","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383608,"package_name":"lwgeom","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383609,"package_name":"knitr","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383610,"package_name":"rmarkdown","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383611,"package_name":"stats","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383612,"package_name":"testthat","ecosystem":"cran","requirements":"\u003e= 3.0.0","direct":true,"kind":"suggests","optional":false},{"id":18447383613,"package_name":"xml2","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383614,"package_name":"openeo","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383625,"package_name":"CDSE","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383626,"package_name":"jsonlite","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":18447383627,"package_name":"qpdf","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/R-CMD-check.yaml","sha":null,"kind":"manifest","created_at":"2024-06-27T18:47:13.763Z","updated_at":"2024-06-27T18:47:13.763Z","repository_link":"https://github.com/ropensci/rOPTRAM/blob/main/.github/workflows/R-CMD-check.yaml","dependencies":[{"id":18857990971,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false},{"id":18857990972,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":18857990973,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":18857990974,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":18857990975,"package_name":"r-lib/actions/check-r-package","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/ubuntu-latest-check.yaml","sha":null,"kind":"manifest","created_at":"2024-06-27T18:47:13.977Z","updated_at":"2024-06-27T18:47:13.977Z","repository_link":"https://github.com/ropensci/rOPTRAM/blob/main/.github/workflows/ubuntu-latest-check.yaml","dependencies":[{"id":18857990976,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false},{"id":18857990977,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":18857990978,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":18857990979,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":18857990980,"package_name":"r-lib/actions/check-r-package","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false}]}],"score":4.2484952420493585,"created_at":"2024-09-06T00:17:12.635Z","updated_at":"2026-04-14T00:30:21.166Z","avatar_url":"https://github.com/ropensci.png","language":"R","category":"Natural Resources","sub_category":"Soil and Land","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"---\noutput: github_document\nbibliography: vignettes/references.bib\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# rOPTRAM  \u003cimg align=\"right\" width=\"100\" height=\"100\" src=\"vignettes/images/rOPTRAM_logo.jpg\"\u003e\n\n\u003c!-- badges: start --\u003e\n[![Project Status: ACTIVE](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![R-CMD-check](https://github.com/ropensci/rOPTRAM/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/rOPTRAM/actions/workflows/R-CMD-check.yaml)\n[![Status at rOpenSci Software Peer Review](https://badges.ropensci.org/612_status.svg)](https://github.com/ropensci/software-review/issues/612)\n[![DOI](https://zenodo.org/badge/811356946.svg)](https://zenodo.org/doi/10.5281/zenodo.13257766)\n\u003c!-- badges: end --\u003e\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.07086/status.svg)](https://doi.org/10.21105/joss.07086)\n\n`rOPTRAM` implements The OPtical TRapezoid Model (OPTRAM) \n  to derive soil moisture based on the linear relation between a vegetation index, i.e. NDVI, and Shortwave Infra-red (SWIR).  The SWIR band is transformed to SWIR Transformed Reflectance (STR).\n  \n  A scatterplot of NDVI vs. STR is used to produce wet and dry linear regression lines, and the slope/intercept coefficients of these lines comprise the trapezoid. These coefficients are then used on a new satellite image to determine soil moisture.\n\n  See:  @sadeghi_optical_2017, @burdun_satellite_2020, @ambrosone_retrieving_2020\n\n\n## Installation\n\n`rOPTRAM` resides on github.\nYou can install the development version of rOPTRAM like so:\n\n``` {r install, eval=FALSE}\n# Install remotes package\nif (! require(\"remotes\")) {\n  install.packages(\"remotes\")\n}\nremotes::install_github(\"ropensci/rOPTRAM\")\n```\n\n#### Prerequisites\n\nOnly a small number of commonly used R packages are required to use {rOPTRAM}. This includes:\n - base packages {tools} and {utils}\n - spatial packages {sf} and {terra}\n - data.frame and plotting {dplyr}, {ggplot2}, {MASS}\n\nUsers can download Sentinel-2 tiles from the Copernicus manually, and run thru the steps to produce the OPTRAM trapezoid, and predicted soil moisture maps. However, this approach is not optimal. By installing a few additional packages, the workflow can be initiated by a single function call to download, clip to area of interest, and produce the trapezoid coefficients. The all-inclusive approach is highly recommended since processing of the Sentinel-2 data is performed \"in the cloud\" and only the final products are downloaded, **greatly** reducing the download file sizes. \n\nTo run the all-inclusive approach, the first step of acquiring Sentinel-2 imagery is handled by the R package {CDSE}. (see @karaman_cdse_2023). The {jsonlite} package is also necessary.\n\nThat R package interfaces with the Copernicus DataSpace Ecosystem in one of two ways:\n - Thru the [Scihub API](https://shapps.dataspace.copernicus.eu/dashboard/#/).\n - Thru the [openEO platform](https://openeo.dataspace.copernicus.eu/) \n \nBoth methods require [registering](https://dataspace.copernicus.eu/) on the Copernicus DataSpace \n\n## Available functions\n\n#### optram_options()\n\nSeveral package options are defined, with default values, when {rOPTRAM} first loads. Each of these can be set individually to user chosen values. For example, the package uses a vegetation index (compared to SWIR Transformed Reflectance) values to plot the trapezoid. The default index is \"NDVI\". In a low vegetation, arid region, users can choose an alternative such as \"SAVI\" (see example below). The default maximum cloud cover is set to 12 [%], and users can choose any value between 0-100. \n\n#### optram()\n\nA main wrapper function to run the whole OPTRAM procedure. \nThis function performs the following steps:\n\n  - Acquire Sentinel 2 images covering the requested date range, and clipped to the input area of interest. This step relies on the {CDSE} package\n  - Create the set of SWIR Transformed Reflectance (STR) rasters;\n  - Prepare a dataframe of NDVI and STR values for all pixels from all images;\n  - Calculate the trapezoid wet and dry regression lines, and save coefficients to a CSV file.\nReturns: RMSE values of the fitted regression lines of the trapezoid.\n\n\n#### optram_acquire_s2()\nAcquire Sentinel 2 images covering the requested date range, and clipped to the input area of interest.\n\nAmong the function parameters, the `method` can be specified as either \"scihub\" or \"openeo\", thus choosing one of the two available acqquistion methods.\n\nReturns: a list of downloaded Sentinel 2 images\n\n\n#### optram_calculate_str()\nExtracts the required bands and prepares the vegetation index and SWIR transformed reflectance.\n\n#### optram_ndvi_str()\nCollects all pixel values from both the vegetation index and STR rasters, for all acquisition dates, and saves into a data.frame\n\nReturns: the full data.frame\n\n\n#### optram_wetdry_coefficients()\nCalculates the wet-dry trapezoid from the data.frame of NDVI and STR values, and obtains regression slope and intercept for both lines\n\nThree possible fitting methods are offered in this function, thru the \"trapezoid_method\" parameter. The user can choose to match the upper (wet) and lower (dry) bounds of the trapezoid either as a linear regression line, an exponential curve, or a second order polynomial function.\n\nReturns: the set of four (or six, in the case of polynomial curve) coefficients.\n\n#### optram_calculate_soil_moisture()\nCalculates soil moisture rasters for a time series of images, using the OPTRAM model coefficients from above procedure.\n\n#### optram_landsat()\nPrepares the OPTRAM coefficients from a time series of Landsat images, (instead of Sentinel). This function requires that the images are downloaded in advance.\n\nReturns: the set of four coefficients.\n\n\n#### optram_safe()\nIn case Sentinel images have been downloaded in advance, this function prepares the STR and NDVI rasters, then calculate the trapezoid regression coefficients. It requires an input directory containing the Sentinel 2 images in the original SAFE file format.\n\n\n## Example\n\nFirst, a demonstration of choosing non-default package options.\n\n```{r options}\n# Show default options\nrOPTRAM::optram_options()\n# Change one options\nrOPTRAM::optram_options(\"veg_index\", \"SAVI\", show_opts = FALSE)\n```\n\nNext a basic example which shows how to:\n\n  - retrieve Sentinel 2 imagery for a specific area of interest\n  - covering a date range\n  - preprocess the imagery to obtain a vegetation index and STR band\n  - use these to derive coefficients of slope and intercept for the OPTRAM trapezoid\n  - using the \"linear\" fitting method\n\n```{r example, eval=FALSE}\nlibrary(rOPTRAM)\n# basic example\naoi \u003c- sf::st_read(system.file(\"extdata\", \"lachish.gpkg\", package=\"rOPTRAM\"))\nrmse \u003c- rOPTRAM::optram(\n    aoi = aoi,\n    from_date = \"2021-01-01\", to_date = \"2021-03-30\",\n    max_cloud = 10)\nprint(rmse)\n```\n\n## Note\n\nIn order to download Sentinel 2 images, the {CDSE} package is used: (@karaman_cdse_2023)\n\nThat package should be installed in advance in order to run the `optram()` wrapper function.\n\nIf, on the other hand, Sentinel 2 imagery has been downloaded in advance, then {CDSE} is not strictly necessary.\nInstead, the following workflow can be used:\n\n  - call `optram_safe()` to prepare NDVI and STR rasters\n  - call `optram_calculate_str()` to calculate SWIR Transform\n  - call `optram_ndvi_str()` to build a data.frame of pixel values\n  - call `optram_wetdry_coefficients()` to derive slope and intercept of the trapezoid. \n\n## Meta\n\n  - Please report any issues on [github](https://github.com/ropensci/rOPTRAM/issues)\n  - Anyone interested in collaborating is invited to \"sign up\" by contacting the maintainers.\n  - This package is released with a [Contributor Code of Conduct](https://github.com/ropensci/.github/blob/master/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.\n","funding_links":[],"readme_doi_urls":["https://doi.org/10.21105/joss.07086"],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":["geocoding"],"project_url":"https://ost.ecosyste.ms/api/v1/projects/299671","html_url":"https://ost.ecosyste.ms/projects/299671"}