Git Product home page Git Product logo

ebase's Introduction

EBASE

R-CMD-check EBASE status badge pkgdown Codecov test coverage CRAN status

R package for Estuarine BAyesian Single-station Estimation (EBASE) method for ecosystem metabolism.

Installation

Install the package as follows:

# Install EBASE in R:
install.packages('EBASE', repos = c('https://fawda123.r-universe.dev', 'https://cloud.r-project.org'))

The JAGS software must also be installed to use this package. Follow the instructions in the link to download and install the version appropriate for your operating system.

Minimal example

library(dplyr)
library(lubridate)
library(doParallel)

# get four days of data
dat <- exdat %>%
  filter(month(DateTimeStamp) == 6 & day(DateTimeStamp) %in% 1:4)

##
# run ebase with defaults

# setup parallel backend
cl <- makeCluster(2)
registerDoParallel(cl)

res <- ebase(dat, interval = 900, Z = 1.85)

stopCluster(cl)

ebase's People

Contributors

fawda123 avatar

Watchers

James Cloos avatar  avatar Kostas Georgiou avatar

ebase's Issues

Misc fixes and edits

  • Units in documentation for b parameter should be (cm/hr) / (m2/s2), update comments in model file, ebase function
  • Change name of troc argument to something different, this really isn't troc, something like "number of time steps per day" or "nstepd"
  • Allow flexibility in running the model up to n days as the basis of the for loop, this requires changing the input to troc (as it's currently listed) from 86400 to whatever ndays is supplied by the user. This will still give us one estimate for a, r, and b per iteration of the loop, but it is based on model iterations that account for the full length of data in n days. This is not the same as running the model as is and taking the average across n days (not informed by data).
  • Check units for dDO in output, is it mmol/m3/d?
  • Allow user to define range on priors for all, but especially b since it is very constrained
  • Add ability to plot DO_obs vs DO_mod as diagnostic, calc other goodness of fit measures
  • How do we accommodate missing data if not all measurements are available for the specified time step in interval, e.g., interpolate, calc interval on the fly?

Remove interpolated days from output

For time series with multiple missing days, interp = TRUE with maxgap = 1e6 or some other large number must be used for ebase() to work. This will set the timestep consistently based on the value passed to interval. However, these large gaps will be estimated by ebase() and need to be removed from the output. The isinterp column added from ebase_prep() could be used to filter these days, but must not filter interpolated values for days that have data.

Fix to cut input data with dangling days

The ebase() function will not work if there are dangling days at the beginning or end of the input data. An obscure JAGS error will be returned to the console, something like this:

Error in { : 
  task 8 failed - "4 nodes produced errors; first error: 'names' attribute [1] must be the same length as the vector [0]"

The ebase_prep() function needs to include a fix to cut these dangling days and return a warning indicating these records are removed.

EBASE with no air-sea diffusion

There are cases where a researcher may want to estimate production and respiration with no air-sea diffusion, such as for a sonde that is located at the bottom of the water column. In the comparable ecometab() function from the WtRegDO package, this feature is accomplished by setting bott_stat=TRUE. It is possible to approximate the result using the following code, but it is clunky, and a dedicated option to remove air-sea diffusion would be more intuitive.

library(EBASE)
library(dplyr)
library(lubridate)
library(doParallel)

# get four days of data
dat <- exdat %>%
  filter(month(DateTimeStamp) == 6 & day(DateTimeStamp) %in% 1:4)

##
# run ebase with defaults

# setup parallel backend
cl <- makeCluster(2)
registerDoParallel(cl)

res <- ebase(dat, interval = 900, Z = 1.85, bprior=c(0, 0.001))

stopCluster(cl)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.