Skip to content

Commit

Permalink
Merge pull request #9 from lrennels/registry
Browse files Browse the repository at this point in the history
Various fixes for consistency with registry
  • Loading branch information
davidanthoff authored Mar 13, 2019
2 parents 2fea967 + 158d1be commit c401772
Show file tree
Hide file tree
Showing 42 changed files with 83 additions and 160 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ language: julia
os:
- linux
julia:
- 1.0
- 1.1
notifications:
email: false
before_install:
- julia -e 'using Pkg; Pkg.add("Distributions")'
- julia -e 'using Pkg; Pkg.add("CSVFiles")'
- julia -e 'using Pkg; Pkg.add("DataFrames")'
- julia -e 'using Pkg; Pkg.add("StatsBase")'

- julia -e 'using Pkg; Pkg.add("Mimi")'
script:
- julia test/runtests.jl
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,41 @@ FUND was originally developed by Richard Tol. It is now co-developed by David An

The minimum requirement to run FUND is [Julia](http://julialang.org/) and the [Mimi](https://github.com/davidanthoff/Mimi.jl) package. To run the example IJulia notebook file you need to install [IJulia](https://github.com/JuliaLang/IJulia.jl).

### Installing Julia
### Software Requirements

You can download Julia from [http://julialang.org/downloads/](http://julialang.org/downloads/). You should use the v0.6.x version and install it.
You need to install [Julia 1.1.0](https://julialang.org) or newer to run this model. You can download Julia from [http://julialang.org/downloads/](http://julialang.org/downloads/).

### Installing the Mimi package
### Preparing the Software Environment

Start Julia and enter the following command on the Julia prompt:
You first need to connect your julia installation with the central Mimi registry of Mimi models. This central registry is like a catalogue of models that use Mimi that is maintained by the Mimi project. To add this registry, run the following command at the julia package REPL:

````julia
Pkg.add("Mimi")
````
```julia
pkg> registry add https://github.com/mimiframework/MimiRegistry.git
You only need to run this command once on a computer.
```

The next step is to install MimiRICE2010.jl itself. You need to run the following command at the julia package REPL:

```julia
pkg> add MimiRICE2010
```

You probably also want to install the Mimi package into your julia environment, so that you can use some of the tools in there:

```
pkg> add Mimi
```

### Keeping requirements up-to-date (optional)

Many of these requirements are regularly updated. To make sure you have the latest versions, periodically execute the following command on the Julia prompt:

````julia
Pkg.update()
````
```julia
pkg> up
```
## Running the model

The model uses the Mimi framework and it is highly recommended to read the Mimi documentation first to understand the code structure. For starter code on running the model just once, see the code in the file `examples/main.jl`.

## Versions and academic use policy

Expand Down
7 changes: 7 additions & 0 deletions examples/main.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Mimi
using MimiFUND

m = getfund()
run(m)

explore(m)
7 changes: 6 additions & 1 deletion src/MimiFUND.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ using DelimitedFiles #base.DelimitedFiles

include("helper.jl")

include("new_marginaldamages.jl")
include("montecarlo/defmcs.jl")
include("montecarlo/run_fund_mcs.jl")
include("montecarlo/run_fund_scc_mcs.jl")

include("components/SocioEconomicComponent.jl")
include("components/PopulationComponent.jl")
include("components/EmissionsComponent.jl")
Expand Down Expand Up @@ -36,7 +41,7 @@ include("components/ImpactAggregationComponent.jl")
include("components/VslVmorbComponent.jl")

export
getfund # Function that returns a version of fund allowing for different user specifications
getfund # a function that returns a version of fund allowing for different user specifications


const global default_nsteps = 1050
Expand Down
4 changes: 1 addition & 3 deletions src/components/BioDiversityComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp biodiversity begin
@defcomp biodiversity begin
# Number of species
nospecies = Variable(index=[time])

Expand Down
4 changes: 1 addition & 3 deletions src/components/ClimateCH4CycleComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp climatech4cycle begin
@defcomp climatech4cycle begin
# Global CH4 emissions in Mt of CH4
globch4 = Parameter(index=[time])

Expand Down
4 changes: 1 addition & 3 deletions src/components/ClimateCO2CycleComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp climateco2cycle begin
@defcomp climateco2cycle begin
# Anthropogenic CO2 emissions in Mt of C
mco2 = Parameter(index=[time])

Expand Down
4 changes: 1 addition & 3 deletions src/components/ClimateDynamicsComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp climatedynamics begin
@defcomp climatedynamics begin
# Total radiative forcing
radforc = Parameter(index=[time])

Expand Down
4 changes: 1 addition & 3 deletions src/components/ClimateForcingComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

function interact(M, N)
function interact(M, N)
d = 1.0 + (M * N)^0.75 * 2.01E-5 + (M * N)^1.52 * M * 5.31E-15
return 0.47 * log(d)
end
Expand Down
4 changes: 1 addition & 3 deletions src/components/ClimateN2OCycleComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp climaten2ocycle begin
@defcomp climaten2ocycle begin
# Global N2O emissions in Mt of N
globn2o = Parameter(index=[time])

Expand Down
4 changes: 1 addition & 3 deletions src/components/ClimateRegionalComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp climateregional begin
@defcomp climateregional begin
regions = Index()
inputtemp = Parameter(index=[time])
bregtmp = Parameter(index=[regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ClimateSF6CycleComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp climatesf6cycle begin
@defcomp climatesf6cycle begin
# Global SF6 emissions in kt of SF6
globsf6 = Parameter(index=[time])

Expand Down
4 changes: 1 addition & 3 deletions src/components/EmissionsComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp emissions begin
@defcomp emissions begin
regions = Index()

mitigationcost = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/GeographyComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp geography begin
@defcomp geography begin
regions = Index()

area = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactAggregationComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactaggregation begin
@defcomp impactaggregation begin
regions = Index()

eloss = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactAgricultureComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactagriculture begin
@defcomp impactagriculture begin
regions = Index()

gdp90 = Parameter(index=[regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactBioDiversityComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactbiodiversity begin
@defcomp impactbiodiversity begin
regions = Index()

# Change in number of species in relation to the year 2000
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactCardiovascularRespiratoryComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactcardiovascularrespiratory begin
@defcomp impactcardiovascularrespiratory begin
regions = Index()

basecardvasc = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactCoolingComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactcooling begin
@defcomp impactcooling begin
regions = Index()

cooling = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactDeathMorbidityComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactdeathmorbidity begin
@defcomp impactdeathmorbidity begin
regions = Index()

dead = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactDiarrhoeaComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactdiarrhoea begin
@defcomp impactdiarrhoea begin
regions = Index()

diadead = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactExtratropicalStormsComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactextratropicalstorms begin
@defcomp impactextratropicalstorms begin
regions = Index()

extratropicalstormsdam = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactForestsComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactforests begin
@defcomp impactforests begin
regions = Index()

forests = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactHeatingComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactheating begin
@defcomp impactheating begin
regions = Index()

heating = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactSeaLevelRiseComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactsealevelrise begin
@defcomp impactsealevelrise begin
regions = Index()

wetval = Variable(index=[time,regions]) # Valuation of wetlands
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactTropicalStormsComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impacttropicalstorms begin
@defcomp impacttropicalstorms begin
regions = Index()

hurrdam = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactVectorBorneDiseasesComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactvectorbornediseases begin
@defcomp impactvectorbornediseases begin
regions = Index()

dengue = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ImpactWaterResourcesComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp impactwaterresources begin
@defcomp impactwaterresources begin
regions = Index()

watech = Variable(index=[time])
Expand Down
4 changes: 1 addition & 3 deletions src/components/OceanComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp ocean begin
@defcomp ocean begin
# Sea-level rise in meters
sea = Variable(index=[time])

Expand Down
4 changes: 1 addition & 3 deletions src/components/PopulationComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp population begin
@defcomp population begin
regions = Index()

population = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/ScenarioUncertaintyComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp scenariouncertainty begin
@defcomp scenariouncertainty begin
regions = Index()

pgrowth = Variable(index=[time,regions])
Expand Down
4 changes: 1 addition & 3 deletions src/components/SocioEconomicComponent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Mimi

@defcomp socioeconomic begin
@defcomp socioeconomic begin
regions = Index()

income = Variable(index=[time,regions])
Expand Down
2 changes: 0 additions & 2 deletions src/components/VslVmorbComponent.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Mimi

@defcomp vslvmorb begin
regions = Index()

Expand Down
2 changes: 0 additions & 2 deletions src/components/scenconverter.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Mimi

@defcomp scenconverter begin
regions = Index()

Expand Down
9 changes: 0 additions & 9 deletions src/main.jl

This file was deleted.

5 changes: 0 additions & 5 deletions src/marginaldamage3.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using Mimi
include("helper.jl")
include("fund.jl")
using .Fund

"""
Returns one default FUND model and one model with additional emissions of the specified gas in the specified year.
"""
Expand Down
5 changes: 0 additions & 5 deletions src/marginaldamages.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using Mimi
include("helper.jl")
include("fund.jl")
using .Fund

"""
Returns a matrix of marginal damages per one ton of additional emissions of the specified gas in the specified year.
"""
Expand Down
3 changes: 1 addition & 2 deletions src/montecarlo/defmcs.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Mimi
using Distributions

function getmcs()

mcs = @defmcs begin
mcs = @defsim begin

aceiadd = ["USA" => Normal(0.0,0.025), "CAN" => Normal(0.0,0.025), "WEU" => Normal(0.0,0.025), "JPK" => Normal(0.0,0.0375), "ANZ" => Normal(0.0,0.0375), "EEU" => Normal(0.0,0.025), "FSU" => Normal(0.0,0.025), "MDE" => Normal(0.0,0.0875), "CAM" => Normal(0.0,0.05625), "LAM" => Normal(0.0,0.05625), "SAS" => Normal(0.0,0.0875), "SEA" => Normal(0.0,0.0875), "CHI" => Normal(0.0,0.0375), "MAF" => Normal(0.0,0.11875), "SSA" => Normal(0.0,0.11875), "SIS" => Normal(0.0,0.05625)]
aeeiadd = ["USA" => Normal(0.0,0.0625), "CAN" => Normal(0.0,0.0625), "WEU" => Normal(0.0,0.0625), "JPK" => Normal(0.0,0.0625), "ANZ" => Normal(0.0,0.0625), "EEU" => Normal(0.0,0.1), "FSU" => Normal(0.0,0.1), "MDE" => Normal(0.0,0.15), "CAM" => Normal(0.0,0.15), "LAM" => Normal(0.0,0.15), "SAS" => Normal(0.0,0.15), "SEA" => Normal(0.0,0.15), "CHI" => Normal(0.0,0.175), "MAF" => Normal(0.0,0.15), "SSA" => Normal(0.0,0.15), "SIS" => Normal(0.0,0.15)]
Expand Down
Loading

0 comments on commit c401772

Please sign in to comment.