Giter VIP home page Giter VIP logo

bayesian-osse-r-sample's Introduction

README file for bayesian-osse-R source code (sample version with inputs)
Author: Lewis Kunik ([email protected])
University of Utah LAIR group

-------------------------
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. This particular set-up performs an Observing
System Simulation Experiment (OSSE), meaning that a set of "true" emissions are
defined so as to generate synthetic enhancements which serve as the model data,
in hopes of recovering the "true" emissions in the posterior/optimized result.
This framework is equipped with random-normal (Gaussian) perturbations in the
synthetic data in order to simulate the presence of model-data mismatch errors
in the observations.


Code can be downloaded and run as-is, provided that the proper input files are supplied.
See the config.r file in inversion/ directory for sample naming conventions of input files.

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

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

In addition, netCDF library library version 4.1 or later is required, as well as
R version 3.1.0 or later

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")
If running directly from the terminal, run by typing: Rscript run_all.r

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


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/).  This inversion code works with files that
abide by the naming convention where the first 10 characters of the filename indicate
the start time of the footprint in format: YYYYmmddHH (i.e. year, month, day, hour). There
is no required naming convention after 10 characters (the rest of the filename can be
whatever you want).

Note that this source code uses the bayesian-osse-R Github repository as "upstream"
source code. Original source code is primarily maintained by that repository,
then merged into this one.

bayesian-osse-r-sample's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

bayesian-osse-r-sample's Issues

Chi^2 distribution clarifications

The paper referencing this code mentions that
X2 = spriorT B-1 sprior + zT R-1 z
is distributed as a χ2 variable on ν = Nobservations + Nfluxes. This is true.

The paper then goes on to generate an ensemble of pseudo-observations, calculate X2/ν for each member, and states that the expected value of this latter quantity is one. This is also true.

The difficulty I am having is that I can decompose X2 into two random variables:
Xflux2 = spriorT B-1 sprior
and
Xobs2 = zT R-1 z,
which are distributed as χ2 variables on Nfluxes and Nobservations, respectively. The ensemble in the paper generates multiple realizations of the second variable, but I only see one realization of the first.
E(X2 / ν) is still one;
E(E(X2 | Xflux2)) is also one;
E(X2 | Xflux2) is a function of Xflux2 and is what I think the paper has.

Is this an accurate description of what is going on? Is this a known and intended behavior of this package? It is entirely possible I just missed this section of the paper while reading. If that is th case, a pointer to the section of the paper where this is described would be welcome.

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.