Skip to content

source code for Bayesian inverse modeling software, written in R

Notifications You must be signed in to change notification settings

lkunik/bayesian-inversion-R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README file: bayesian-inversion-R source code

-------------------------
Overview of inverse model code
-------------------------

This Bayesian inverse model code is based loosely on NOAA CarbonTracker-Lagrange
software (see: https://www.esrl.noaa.gov/gmd/ccgg/carbontracker-lagrange/), but
written in the R programming language.


Code can be run as-is, provided that the proper input files are supplied. See
config.r file in inversion/ directory for more information.

After inputs are supplied, the program may be run from the inversion/ directory.
If running in the R programming environment (R or Rstudio), run by typing 'source("run_all.r")'. (without single quotes)
If running directly from the terminal, run by typing 'Rscript run_all.r'.

The following packages must be installed to successfully run the model code:
  "ncdf4"
  "lubridate"
  "geosphere"

Required input files should be placed in the include/ directory:
  prior_emiss.nc
  prior_uncert.nc
  lonlat_domain.rds
  obs.rds
  background.rds

  (optional input files:)
  outer_emiss.nc
  bio_flux.nc
  lonlat_outer.rds

  NOTE: input NetCDF files (prior_emiss.nc, prior_uncert.nc, etc) should exist
  in (lon x lat x time) format, with lon/lat values indicating center-of-cell,
  and time values expressed as either POSIX time or seconds since R epoch
  (1970-01-01 00:00:00 UTC).

  obs.rds file should be formatted as an (n x 3) matrix where all observation
   datapoints are be concatenated by rows, with the site code in column 1, the
  timestamp in column 2, and data value in column 3. Data timestamps should
  correspond to the observation resolution of the inversion, denoted in config.r.
  The inversion code does internal processing and filtering of data to match the
  observation time domain, so the supplied file can list as many datapoints as desired.
   see example:
(column names)  # SITECODE  OBS TIME (seconds since 1970-01-01 00:00:00)  OBS VALUE
   (row 1)      # 'site1'          '[t1 number of seconds]'                 'X.XXX'
   (row 2)      # 'site1'          '[t2 number of seconds]'                 'X.XXX'
    (...)       #   ...                       ...                             ...
   (row n)      # 'siteN'          '[tN number of seconds]'                 'X.XXX'

   background.rds should be formatted similarly, but excluding SITECODE column.
   see example:

 (column names)  #  OBS TIME (seconds since 1970-01-01 00:00:00)   BG VALUE
    (row 1)      #         '[t1 number of seconds]'                 'X.XXX'
    (row 2)      #         '[t2 number of seconds]'                 'X.XXX'
     (...)       #                    ...                             ...
    (row n)      #         '[tN number of seconds]'                 'X.XXX'



In addition, footprint files must be supplied in the footprints/ directory.
Files should be in NetCDF format with dimensions (lon x lat x time). Source code
is designed to work with files matching output format from STILT-R
(https://uataq.github.io/stilt/)

About

source code for Bayesian inverse modeling software, written in R

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages