ClimateModels.ModelConfig
— MethodModelConfig(func::Function,inputs::NamedTuple)
Simplified constructor for case when model is a Function.
diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json
index dcc8052..6855e80 100644
--- a/dev/.documenter-siteinfo.json
+++ b/dev/.documenter-siteinfo.json
@@ -1 +1 @@
-{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-06-03T12:27:18","documenter_version":"1.4.1"}}
\ No newline at end of file
+{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-06-03T15:26:08","documenter_version":"1.4.1"}}
\ No newline at end of file
diff --git a/dev/API/index.html b/dev/API/index.html
index 68c0c8f..5923233 100644
--- a/dev/API/index.html
+++ b/dev/API/index.html
@@ -5,28 +5,28 @@
outputs :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
channel :: Channel{Any} = Channel{Any}(10)
folder :: String = tempdir()
-ID :: UUID = UUIDs.uuid4()source Simplified constructor for case when model is a Function. Generic data structure for a model configuration based on a Pluto notebook.ClimateModels.ModelConfig
— MethodModelConfig(func::Function,inputs::NamedTuple)
ClimateModels.PlutoConfig
— Typestruct PlutoConfig <: AbstractModelConfig
ClimateModels.setup
— Methodsetup(x::AbstractModelConfig)
Defaults to default_ClimateModelSetup(x)
. Can be expected to be specialized for most concrete types of AbstractModelConfig
f=ClimateModels.RandomWalker
+ID :: UUID = UUIDs.uuid4()
ClimateModels.ModelConfig
— MethodModelConfig(func::Function,inputs::NamedTuple)
Simplified constructor for case when model is a Function.
ClimateModels.PlutoConfig
— Typestruct PlutoConfig <: AbstractModelConfig
Generic data structure for a model configuration based on a Pluto notebook.
ClimateModels.setup
— Methodsetup(x::AbstractModelConfig)
Defaults to default_ClimateModelSetup(x)
. Can be expected to be specialized for most concrete types of AbstractModelConfig
f=ClimateModels.RandomWalker
tmp=ModelConfig(model=f)
-setup(tmp)
ClimateModels.build
— Functionbuild(x)
Defaults to default_ClimateModelBuild(x)
. Can be expected to be specialized for most concrete types of AbstractModelConfig
using ClimateModels
+setup(tmp)
ClimateModels.build
— Functionbuild(x)
Defaults to default_ClimateModelBuild(x)
. Can be expected to be specialized for most concrete types of AbstractModelConfig
using ClimateModels
tmp=ModelConfig(model=ClimateModels.RandomWalker)
setup(tmp)
build(tmp)
-isa(tmp,AbstractModelConfig) # hide
ClimateModels.launch
— Functionlaunch(x)
Defaults to default_ClimateModelLaunch(x)
which consists in take!(x)
for AbstractModelConfig
. Can be expected to be specialized for most concrete types of AbstractModelConfig
f=ClimateModels.RandomWalker
+isa(tmp,AbstractModelConfig) # hide
ClimateModels.launch
— Functionlaunch(x)
Defaults to default_ClimateModelLaunch(x)
which consists in take!(x)
for AbstractModelConfig
. Can be expected to be specialized for most concrete types of AbstractModelConfig
f=ClimateModels.RandomWalker
tmp=ModelConfig(model=f)
setup(tmp)
build(tmp)
-launch(tmp)
Base.log
— Functionlog(x :: AbstractModelConfig)
Show the record of git
commits that have taken place in the log
folder.
log( x :: AbstractModelConfig, y :: String; fil="", msg="", prm=false)
Show or add a git
commit to the log
folder (i.e., joinpath(x,"log")
).
If no keyword is provided then y
should be a commit ID from log(x)
Keyword arguments are mutually exclusive (i.e., use only one at a time) and work like this:
msg
is a non empty String
: commit msg
to log/README.md
with message y
. fil
is a non empty String
: commit changes to file log/$(fil)
with message y
. If log/$(fil)
is unknown to git (i.e. commit errors out) then try adding log/$(fil)
first. prm
is true
: add files found in input
or tracked_parameters/
(if any) to git log.Example:
MC=run(ModelConfig(ClimateModels.RandomWalker,(NS=100,)))
+launch(tmp)
Base.log
— Functionlog(x :: AbstractModelConfig)
Show the record of git
commits that have taken place in the log
folder.
log( x :: AbstractModelConfig, y :: String; fil="", msg="", prm=false)
Show or add a git
commit to the log
folder (i.e., joinpath(x,"log")
).
If no keyword is provided then y
should be a commit ID from log(x)
Keyword arguments are mutually exclusive (i.e., use only one at a time) and work like this:
msg
is a non empty String
: commit msg
to log/README.md
with message y
. fil
is a non empty String
: commit changes to file log/$(fil)
with message y
. If log/$(fil)
is unknown to git (i.e. commit errors out) then try adding log/$(fil)
first. prm
is true
: add files found in input
or tracked_parameters/
(if any) to git log.Example:
MC=run(ModelConfig(ClimateModels.RandomWalker,(NS=100,)))
MC.inputs[:NS]=200
msg="update tracked_parameters.toml (or skip if up to date)"
log(MC,msg,prm=true)
-log(MC)
Also provided : pathof
, joinpath
, cd
, readdir
, show
, clean
, and @ModelRun
ClimateModels.setup
— Methodsetup(MC::PlutoConfig)
default_ClimateModelSetup
unroll
notebook_launch
to tasksMC1=PlutoConfig(model="examples/defaults.jl")
+log(MC)
Also provided : pathof
, joinpath
, cd
, readdir
, show
, clean
, and @ModelRun
ClimateModels.setup
— Methodsetup(MC::PlutoConfig)
default_ClimateModelSetup
unroll
notebook_launch
to tasksMC1=PlutoConfig(model="examples/defaults.jl")
setup(MC1)
build(MC1)
-launch(MC1)
ClimateModels.notebooks.update
— Methodupdate(MC::PlutoConfig)
Update notebook dependencies (via unroll
& reroll
) and replace initial notebook file.
update(PlutoConfig(model="examples/defaults.jl"))
-run(PlutoConfig(model="examples/defaults.jl"))
Base.open
— Methodopen(MC::PlutoConfig))
Open notebook in web-browser via Pluto.
Important note: this assumes that the Pluto server is already running, e.g. from Pluto.run()
, at URL pluto_url
(by default, "http://localhost:1234/", should work on a laptop or desktop).
notebooks.open(PlutoConfig(model="examples/defaults.jl"))
setup
and update
use unroll
and reroll
internally to process notebooks.
ClimateModels.ModelRun
— FunctionModelRun(x :: AbstractModelConfig)
Shorthand for x |> setup |> build |> launch
Returns AbstractModelConfig
as output.
ClimateModels.@ModelRun
— Macro@ModelRun(func)
Macro equivalent for run(ModelConfig(model=func))
.
Base.pathof
— Functionpathof(x::AbstractModelConfig)
Returns the run directory path for x ; i.e. joinpath(x.folder,string(x.ID))
pathof(x::AbstractModelConfig,subfolder::String)
Same as pathof(joinpath(x,subfolder))
or joinpath(pathof(x),subfolder)
Base.Filesystem.joinpath
— Functionjoinpath(x::AbstractModelConfig,y...)
Same as joinpath(pathof(x),y...)
Base.Filesystem.cd
— Functioncd(x::AbstractModelConfig)
Temporarily change the current working directory to x.folder
.
Base.Filesystem.readdir
— Functionreaddir(x::AbstractModelConfig)
Same as readdir(pathof(x)).
readdir(x::AbstractModelConfig,subfolder::String)
Same as readdir(joinpath(pathof(x),subfolder)).
Base.show
— Functionshow(io::IO, z::AbstractModelConfig)
tmp=ModelConfig(model=ClimateModels.RandomWalker)
+launch(MC1)
ClimateModels.notebooks.update
— Methodupdate(MC::PlutoConfig)
Update notebook dependencies (via unroll
& reroll
) and replace initial notebook file.
update(PlutoConfig(model="examples/defaults.jl"))
+run(PlutoConfig(model="examples/defaults.jl"))
Base.open
— Methodopen(MC::PlutoConfig))
Open notebook in web-browser via Pluto.
Important note: this assumes that the Pluto server is already running, e.g. from Pluto.run()
, at URL pluto_url
(by default, "http://localhost:1234/", should work on a laptop or desktop).
notebooks.open(PlutoConfig(model="examples/defaults.jl"))
setup
and update
use unroll
and reroll
internally to process notebooks.
ClimateModels.ModelRun
— FunctionModelRun(x :: AbstractModelConfig)
Shorthand for x |> setup |> build |> launch
Returns AbstractModelConfig
as output.
ClimateModels.@ModelRun
— Macro@ModelRun(func)
Macro equivalent for run(ModelConfig(model=func))
.
Base.pathof
— Functionpathof(x::AbstractModelConfig)
Returns the run directory path for x ; i.e. joinpath(x.folder,string(x.ID))
pathof(x::AbstractModelConfig,subfolder::String)
Same as pathof(joinpath(x,subfolder))
or joinpath(pathof(x),subfolder)
Base.Filesystem.joinpath
— Functionjoinpath(x::AbstractModelConfig,y...)
Same as joinpath(pathof(x),y...)
Base.Filesystem.cd
— Functioncd(x::AbstractModelConfig)
Temporarily change the current working directory to x.folder
.
Base.Filesystem.readdir
— Functionreaddir(x::AbstractModelConfig)
Same as readdir(pathof(x)).
readdir(x::AbstractModelConfig,subfolder::String)
Same as readdir(joinpath(pathof(x),subfolder)).
Base.show
— Functionshow(io::IO, z::AbstractModelConfig)
tmp=ModelConfig(model=ClimateModels.RandomWalker)
setup(tmp)
-show(tmp)
ClimateModels.clean
— Functionclean(x :: AbstractModelConfig)
Cancel any remaining task (x.channel) and rm the run directory (pathof(x))
tmp=ModelConfig(model=ClimateModels.RandomWalker)
+show(tmp)
ClimateModels.clean
— Functionclean(x :: AbstractModelConfig)
Cancel any remaining task (x.channel) and rm the run directory (pathof(x))
tmp=ModelConfig(model=ClimateModels.RandomWalker)
setup(tmp)
-clean(tmp)
Convenience functions for notebooks documented in the JuliaClimate/Notebooks
webpage.
ClimateModels.notebooks.list
— Functionnotebooks.list()
List downloadable notebooks based on the JuliaClimate/Notebooks
webpage.
Returns a DataFrame
with columns folder, file, and url.
ClimateModels.notebooks.download
— Functionnotebooks.download(path,nbs)
Download notebooks/files listed in nbs
to path
.
nbs.file[i]
is found at nbs.url[i]
then download it to path
/nbs.folder[i]
. nbs.url[i][1:end-3]*"_module.jl"
then we download it too.nbs=notebooks.list()
-notebooks.download(tempdir(),nbs)
In the package development mode, model
is specified as a PackageSpec
.
ClimateModels.PkgDevConfig
— FunctionPkgDevConfig(url::String,func::Function,inputs::NamedTuple)
Simplified constructor for case when model is a url (PackageSpec).
This leads setup
to install the chosen package using Pkg.develop
. This can be useful for developing a package or using an unregistered package in the context of ClimateModels.jl
.
There are two common cases:
configuration
is left undefined then launch
will run the package test suite using Pkg.test
as in this example (code link)configuration
is provided as a Function
then launch
will call it as illustrated in the ShallowWaters.jl example (code link)As an exercise, can you turn ShallowWaters.jl example into a normal user mode example?
Settings
This document was generated with Documenter.jl version 1.4.1 on Monday 3 June 2024. Using Julia version 1.10.3.