Skip to content

Commit

Permalink
Fix up module vs package text and code
Browse files Browse the repository at this point in the history
  • Loading branch information
lrennels committed Jun 30, 2021
1 parent 6a88010 commit e934167
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,39 @@

This is a work-in-progress respository for a Julia-Mimi implementation of the FAIRv2.0 simple climate model. The model description paper can be found at [FaIRv2.0.0: A Generalized Impulse Response Model for Climate Uncertainty and Future Scenario Exploration](https://gmd.copernicus.org/articles/14/3007/2021/gmd-14-3007-2021.html).

## Running Mimi-FAIRv2
To run the model, execute the following code:
## Preparing the Software Environment

To add the package without necessarily downloading the full repository, run the following command at the julia package REPL:

```julia
pkg> add https://github.com/FrankErrickson/MimiFAIRv2.jl.git # add MimiFAIRv2 module on main branch
```

To work locally assuming you have downloaded the full repository and want to work with that version, likely only if you want to actively develope the MimiFAIRv2 package itself, ou will later run the following command at the julia REPL, but do not need to call `add`.

```julia
include("src/MimiFAIRv2.jl") # load the MimiFAIRv2 module
```

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

```julia
pkg> add Mimi
```
## 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. The basic way to access a copy of the default MimiFAIRv2 model and explore the resuts is the following:

```julia
using Mimi
using MimiFAIRv2 # if you used the `pkg> add` syntax above and thus have the module in your environment

# Load the model code.
include("src/MimiFAIRv2.jl") # load the MimiFAIRv2 module
using Main.MimiFAIRv2 # bring the module into your namespace
# note that instead of the line above one could call the following line, which
# may be particularly helpful for package development
# include("src/MimiFAIRv2.jl")

# Create an instance of Mimi-FAIRv2.
m = get_model()
# Create an instance of MimiFAIRv2.
m = MimiFAIRv2.get_model()

# Run the model.
run(m)
Expand Down
2 changes: 0 additions & 2 deletions src/MimiFAIRv2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ include("components/aerosol_plus_gas_cycles.jl")
include("components/radiative_forcing.jl")
include("components/temperature.jl")

export get_model

"""
get_model(;emissions_forcing_scenario::String="ssp585", start_year::Int=1750,
end_year::Int=2500, TCR::Float64=1.79, RWF::Float64=0.552,
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using CSVFiles
using Test

include(joinpath(@__DIR__, "..", "src", "MimiFAIRv2.jl"))
using Main.MimiFAIRv2
using MimiFAIRv2: get_model # load `get_model` function to avoid need for `MimiFAIRv2.` prefix

@testset "UI" begin

Expand Down

0 comments on commit e934167

Please sign in to comment.