Skip to content

Commit

Permalink
Merge pull request #35 from gaelforget/v0p1p13b
Browse files Browse the repository at this point in the history
V0p1p13b
  • Loading branch information
gaelforget authored Sep 1, 2021
2 parents 4007044 + 2a753ae commit 1d5d40c
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ClimateModels"
uuid = "f6adb021-9183-4f40-84dc-8cea6f651bb0"
authors = ["gaelforget <[email protected]>"]
version = "0.1.12"
version = "0.1.13"

[deps]
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ It also supports e.g. cloud computing workflows that start from previous model o

- [CMIP6 model output](https://gaelforget.github.io/ClimateModels.jl/dev/generated/CMIP6/) via cloud storage

## Trying Out The Examples

For detail please refer to [the docs](https://gaelforget.github.io/ClimateModels.jl/dev/). All requirements are preinstalled in the following <https://mybinder.org> cloud instance.

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/gaelforget/ClimateModels.jl/HEAD?urlpath=lab)

## JuliaCon 2021 Presentation Link

[![Screen Shot 2021-08-31 at 2 25 04 PM](https://user-images.githubusercontent.com/20276764/131556274-48f3df13-0608-4cd0-acf9-c3e29894a32c.png)](https://youtu.be/XR5hKCja0uw)
6 changes: 3 additions & 3 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ The next sections are examples which broadly fall into two categories.

## [Running The Examples](@id examples-running)

An example found in the online documentation can be run as follows:
Any example found in the online documentation can be run as follows:

```
git clone https://github.com/gaelforget/ClimateModels.jl
cd ClimateModels.jl
julia --project=docs/ 'using Pkg; Pkg.instantiate()'
julia --project=docs/ -e 'using Pkg; Pkg.instantiate()'
julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()))'
julia --project=docs/ -e 'include("examples/defaults.jl")'
```

The example file name (`defaults.jl` here) can readily be replaced with another one from `examples/` to run a different example. However, running examples which rely on a fortran compiler (`gfortran`) and / or netcdf libraries (`libnetcdf-dev`,`libnetcdff-dev`) will require that those have been pre-installed. It should also be noted that some models may only support linux based environments (i.e. linux and macos).

All requirements are preinstalled in the following <https://mybinder.org> cloud instance, where one can just open a terminal window and run the above commands. All examples have been run in this fashion.
All requirements are preinstalled in the <https://mybinder.org> cloud instance linked below, where one can just open a terminal window and run the above _julia --project=docs/ ..._ commands directly. The final command should return the _run folder_ path name where outputs will be located.

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/gaelforget/ClimateModels.jl/HEAD?urlpath=lab)

Expand Down
2 changes: 1 addition & 1 deletion docs/src/functionalities.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Here we document key functionalities offered in `ClimateModels.jl`

## Climate Model Interface

The climate model interface is based on a data structure (`ModelConfig`) and a series of methods like `setup` and `launch`. The default assumption is that the model is either _1)_ a `Julia` package to be downloaded from a URL within `setup` using `Pkg`, and run within `launch` using `Pkg.test` or _2)_ a `Julia` function to be called with a `ModelConfig` argument.
The climate model interface is based on a data structure (`ModelConfig`) and a series of methods like `setup`, `build`, and `launch`. The default assumption is that the model is either _1)_ a `Julia` package to be downloaded from a URL within `setup` using `Pkg.develop`, and run within `launch` using `Pkg.test` or _2)_ a `Julia` function to be called with a `ModelConfig` argument.

A key point is that everything can be customized to e.g. `1)` use a custom workflow instead of `Pkg.test` or `2)` use popular models previously written in Fortran or C just as simply. The latter typically involves calling a `build` method to compile the model between `setup` and `launch`.

Expand Down
1 change: 1 addition & 0 deletions examples/CMIP6.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ MC=ModelConfig(model="GlobalAverage",configuration=GlobalAverage,inputs=paramete
# _Note: this step may take most time, since `launch` is where data is accessed over the internet, and computation takes place.

setup(MC)
build(MC)
launch(MC)

# ## Read Output Files
Expand Down
2 changes: 1 addition & 1 deletion examples/RandomWalker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ end

MC=ModelConfig(model=RandomWalker,inputs=Dict("nSteps" => 1000))
setup(MC)
build(MC)
launch(MC)
MC

# ## Exercise
#
Expand Down
3 changes: 2 additions & 1 deletion examples/ShallowWaters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ end
#
# `ModelConfig` wraps up the model into a data structure, `MC`, which also includes e.g. the online location for the model repository, parameters, and a local folder path used later on.

MC=ModelConfig(model=URL,configuration=SWM,inputs=parameters)
MC=ModelConfig(model=URL,configuration=SWM,inputs=parameters);

# The `setup` function then calls `Pkg.develop` and sets up the `git` log subfolder.

setup(MC)
build(MC)

# ## Run Model
#
Expand Down
1 change: 1 addition & 0 deletions examples/defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MC=ModelConfig(model=url)
#

setup(MC)
build(MC)
launch(MC)

# See run folder for workflow output:
Expand Down
5 changes: 1 addition & 4 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ true
compile(x :: AbstractModelConfig) = default_ClimateModelBuild(x)

function default_ClimateModelBuild(x::AbstractModelConfig)
@suppress begin
isa(x.model,String) ? Pkg.build(x.model) : nothing
isa(x.model,Pkg.Types.PackageSpec) ? build_the_pkg(x) : nothing
end
isa(x.model,Pkg.Types.PackageSpec) ? build_the_pkg(x) : nothing
end

"""
Expand Down

0 comments on commit 1d5d40c

Please sign in to comment.