Giter VIP home page Giter VIP logo

eps236-project's Introduction

EPS236 Final Class Project

EPS236 project source for David Hagan (MIT), Chris Lim (MIT), and Sidhant Pai (MIT)

Objective

Set up a 5-box model and minimize the residuals between experimental results from EDGAR and that of our model output.

Requirements

The following R packages are required:

  • feather
  • MonteCarlo
  • dplyr
  • progress

The following Python packages are required to make the plots:

  • seaborn
  • matplotlib
  • pandas
  • feather

Getting Started

We have attempted to minimize the error in the model in 3 different ways:

  1. Iterative grid-search
  2. Monte Carlo using the MonteCarlo package
  3. Monte Carlo as written by us

Each method is contained within it's own file. Below, we show how to run each file.

Iterative Grid Search

The run file for this method is iterative_gridsearch.R. To run the file, you should be able to just run from within RStudio or from the R command line. The output is three files, all in feather format.

  1. results/iterative_gridsearch_results.feather

    Contains results for each individual run in a table containing columns for each of the optimized parameters, as well as the sum of the squared residuals.

  2. results/model_results_minimized.feather

    Contains the final model results from the run with the minimized residuals as a timeseries.

  3. results/sf6_emissions.feather

    Contains the observed SF6 emissions as a timeseries (for plotting purposes)

Monte Carlo using the MonteCarlo package

We found a MonteCarlo package, however it appears that it works for as an iterative grid-search than a true Monte Carlo simulation. We tried parsing the source, but it was written pretty horribly...Regardless, the results output the files from running montecarlo.R:

Not updated...

Monte Carlo from Scratch

We weren't totally sure the MonteCarlo package was working the way we thought it should, so we took matters into our own hands and wrote the file monte_carlo_mit.R. This version is a Monte Carlo algorithm we wrote to pick from input distributions for each parameter. You can change the number of iterations through the num.iterations variable. There are two output files:

  1. results/mc_results_by_iter.feather

    Contains the run-by-run results of the Monte Carlo simulation with parameters and results.

  2. results/mc_results_final.feather

    Contains the final model results as found by optimizing the parameters.

Final Model Parameters

After running a Monte Carlo for 1M iterations, we arrived at our optimal solution:

Variable Result
t.strat 5.21 yr
t.hemi.inter 0.774
t.hemi.intra 0.150
strat.frac 0.484

Variable Definitions

Variable Name Definition
tau.global.lifetimes.years Global mean photochemical lifetime for several species
ghg.observations NASA GHG observations for several species by box for many years (>1977)
loss.monthly Monthly loss rate for several compounds by box per month
sf6.sources Yearly SF6 emissions by box from EDGAR
time.range.sf6.sources Vector with the first and last year of EDGAR sources
mass.global Total mass of the atmosphere in units of kg
mass.stratosphere Total mass of the stratosphere in kg
molecular.wt.all Molecular weight of various species in terms of just terms of Carbon and Nitrogen

Description of Data Files

Filename Description
data/tglobal_all.txt Table of global lifetimes in years
data/ghg.GMD.conc.tbl NASA Greenhouse Gas emissions
data/loss.monthly.tbl Box-by-box losses as a function of month
data/SF6.emissions.bybox.tbl SF6 Emissions by box from 1970-2008

eps236-project's People

Contributors

dhhagan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

eps236-project's Issues

Discrepancy in Jacobian

When writing the jacobian, we left out a division by 2 in the calculation of flux.adv.ntrop.to.strop in the utils.r file.

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.