Skip to content

Commit

Permalink
Merge pull request #494 from CliMA/ar/climalandsimulations_allfigures
Browse files Browse the repository at this point in the history
ClimaLandSimulations make all figures of experiments
  • Loading branch information
AlexisRenchon authored Apr 16, 2024
2 parents 8311a03 + 0c58349 commit 7b0c273
Show file tree
Hide file tree
Showing 19 changed files with 532 additions and 193 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ClimaLandSimulations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ClimaLandSimulations CI
on:
pull_request:
push:
branches:
- main

permissions:
actions: write
contents: read

jobs:
lib-climalandsimulations:
runs-on: ubuntu-20.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1.10'
- uses: julia-actions/cache@v1
- name: Install Julia dependencies
run: >
julia --project= -e 'using Pkg; Pkg.develop(path="$(pwd())"); Pkg.develop(path="$(pwd())/lib/ClimaLandSimulations")'
- name: Run the tests
continue-on-error: true
env:
CI_OUTPUT_DIR: output
run: >
julia --project= -e 'using Pkg; Pkg.test("ClimaLandSimulations")'
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ v0.11.1
-------
- ![][badge-✨feature] Add option to profile albedo job. PR
[#505](https://github.com/CliMA/ClimaLand.jl/pull/551)
- ![][badge-✨feature] ClimaLandSimulations: better plots (legend and style tweaks, added cumulative ET and P), unit tests, start and end time as an optional argument. PR [#494](https://github.com/CliMA/ClimaLand.jl/pull/494)
- ![][badge-🐛bugfix] ClimaLandSimulations: installation readme. PR [#494](https://github.com/CliMA/ClimaLand.jl/pull/494)

v0.11.0
-------
Expand Down
15 changes: 13 additions & 2 deletions lib/ClimaLandSimulations/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
# ClimaLandSimulations

A library of methods to run ClimaLand:
- at single sites, such as FLUXNET
- at single sites
- globally (WIP)

## Installation

```jl
julia> ] # to go into pkg mode
pkg> add https://github.com/CliMA/ClimaLand.jl/tree/main/lib/ClimaLandSimulations # because unregistered for now
pkg> add https://github.com/CliMA/ClimaLand.jl:lib/ClimaLandSimulations # because unregistered for now
pkg> *backspace* # press backspace button to go back into julia mode
julia> using ClimaLandSimulations
```

For examples, see the [experiments](https://github.com/CliMA/ClimaLand.jl/lib/ClimaLandSimulations/experiments) folder

### Development of the `ClimaLandSimulations` subpackage

cd ClimaCore/lib/ClimaLandSimulations

# Add ClimaCore to subpackage environment
julia --project -e 'using Pkg; Pkg.develop(path="../../")'

# Instantiate ClimaCoreMakie project environment
julia --project -e 'using Pkg; Pkg.instantiate()'
julia --project -e 'using Pkg; Pkg.test()'
10 changes: 9 additions & 1 deletion lib/ClimaLandSimulations/experiments/ozark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ sv_test, sol_test, Y_test, p_test = run_fluxnet(
params = ozark_default_params(; hetero_resp = hetero_resp_ozark(; b = 2)),
)

# defaults, except start time
sv, sol, Y, p = run_fluxnet(
"US-MOz";
setup = make_setup(;
ozark_default_args(; t0 = Float64(125 * 3600 * 24))...,
),
)

# default parameters
sv, sol, Y, p = run_fluxnet("US-MOz")

# DataFrame for input and output
inputs, inputs_SI, inputs_commonly_used = make_inputs_df("US-MOz")
simulation_output = make_output_df(sv, inputs)
simulation_output = make_output_df("US-MOz", sv, inputs)

# Will save figures in current repo /figures
make_plots(inputs, simulation_output)
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
export harvard_default_configs

"""
harvard_default_configs = (
data_link = "https://caltech.box.com/shared/static/xixaod6511cutz51ag81k1mtvy05hbol.csv",
local_to_UTC = 5,
lat = FT(42.5378), # degree
long = FT(-72.1715), # degree
atmos_h = FT(30),
function harvard_default_configs(;
data_link = "https://caltech.box.com/shared/static/xixaod6511cutz51ag81k1mtvy05hbol.csv",
local_to_UTC = 5,
lat = FT(42.5378), # degree
long = FT(-72.1715), # degree
atmos_h = FT(30),
)
return (
data_link = data_link,
local_to_UTC = local_to_UTC,
atmos_h = atmos_h,
lat = lat,
long = long,
)
end
Named Tuple containing default configurations for the Harvard site.
"""
harvard_default_configs = (
function harvard_default_configs(;
data_link = "https://caltech.box.com/shared/static/xixaod6511cutz51ag81k1mtvy05hbol.csv",
local_to_UTC = 5,
lat = FT(42.5378), # degree
long = FT(-72.1715), # degree
atmos_h = FT(30),
)
return (
data_link = data_link,
local_to_UTC = local_to_UTC,
atmos_h = atmos_h,
lat = lat,
long = long,
)
end
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
export harvard_default_args

"""
harvard_default_args = (
dz_bottom = FT(1.5),
dz_top = FT(0.025),
n_stem = Int64(1),
n_leaf = Int64(1),
h_leaf = FT(12), # m
h_stem = FT(14), # m
t0 = Float64(120 * 3600 * 24),
dt = Float64(40),
n = 45,
)
function harvard_default_args(;
dz_bottom = FT(1.5),
dz_top = FT(0.025),
n_stem = Int64(1),
n_leaf = Int64(1),
h_leaf = FT(12), # m
h_stem = FT(14), # m
t0 = Float64(120 * 3600 * 24),
dt = Float64(40),
n = 45,
)
return (
dz_bottom = dz_bottom,
dz_top = dz_top,
n_stem = n_stem,
n_leaf = n_leaf,
h_stem = h_stem,
h_leaf = h_leaf,
t0 = t0,
dt = dt,
n = n,
)
end
Named Tuple containing default simulation parameter for the Harvard site.
"""
harvard_default_args = (
function harvard_default_args(;
dz_bottom = FT(1.5),
dz_top = FT(0.025),
n_stem = Int64(1),
Expand All @@ -26,3 +38,15 @@ harvard_default_args = (
dt = Float64(40),
n = 45,
)
return (
dz_bottom = dz_bottom,
dz_top = dz_top,
n_stem = n_stem,
n_leaf = n_leaf,
h_stem = h_stem,
h_leaf = h_leaf,
t0 = t0,
dt = dt,
n = n,
)
end
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
export ozark_default_configs

"""
ozark_default_configs = (
data_link = "https://caltech.box.com/shared/static/7r0ci9pacsnwyo0o9c25mhhcjhsu6d72.csv",
local_to_UTC = 7,
atmos_h = FT(32),
lat = FT(38.7441),
long = FT(-92.2000)
)
function ozark_default_configs(;
data_link = "https://caltech.box.com/shared/static/7r0ci9pacsnwyo0o9c25mhhcjhsu6d72.csv",
local_to_UTC = 7,
atmos_h = FT(32),
lat = FT(38.7441),
long = FT(-92.2000),
)
return (
data_link = data_link,
local_to_UTC = local_to_UTC,
atmos_h = atmos_h,
lat = lat,
long = long,
)
end
Named Tuple containing default configurations for the Ozark site.
"""
ozark_default_configs = (
function ozark_default_configs(;
data_link = "https://caltech.box.com/shared/static/7r0ci9pacsnwyo0o9c25mhhcjhsu6d72.csv",
local_to_UTC = 7,
atmos_h = FT(32),
lat = FT(38.7441),
long = FT(-92.2000),
)
return (
data_link = data_link,
local_to_UTC = local_to_UTC,
atmos_h = atmos_h,
lat = lat,
long = long,
)
end
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
export ozark_default_args

"""
ozark_default_args = (
dz_bottom = FT(1.5),
dz_top = FT(0.025),
n_stem = Int64(1),
n_leaf = Int64(1),
h_stem = FT(9),
h_leaf = FT(9.5),
t0 = Float64(120 * 3600 * 24),
dt = Float64(120),
n = 15
)
function ozark_default_args(;
dz_bottom = FT(1.5),
dz_top = FT(0.025),
n_stem = Int64(1),
n_leaf = Int64(1),
h_stem = FT(9),
h_leaf = FT(9.5),
t0 = Float64(120 * 3600 * 24),
dt = Float64(120),
n = 15,
)
return (
dz_bottom = dz_bottom,
dz_top = dz_top,
n_stem = n_stem,
n_leaf = n_leaf,
h_stem = h_stem,
h_leaf = h_leaf,
t0 = t0,
dt = dt,
n = n,
)
end
Named Tuple containing default simulation parameter for the Ozark site.
"""
ozark_default_args = (
function ozark_default_args(;
dz_bottom = FT(1.5),
dz_top = FT(0.025),
n_stem = Int64(1),
Expand All @@ -26,3 +38,15 @@ ozark_default_args = (
dt = Float64(120),
n = 15,
)
return (
dz_bottom = dz_bottom,
dz_top = dz_top,
n_stem = n_stem,
n_leaf = n_leaf,
h_stem = h_stem,
h_leaf = h_leaf,
t0 = t0,
dt = dt,
n = n,
)
end
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
export niwotridge_default_configs

"""
niwot_default_configs = (
data_link = "https://caltech.box.com/shared/static/r6gvldgabk3mvtx53gevnlaq1ztsk41i.csv",
local_to_UTC = 7,
lat = FT(40.0329), # degree,
long = FT(-105.5464), # degree,
atmos_h = FT(21.5),
)
function niwotridge_default_configs(;
data_link = "https://caltech.box.com/shared/static/r6gvldgabk3mvtx53gevnlaq1ztsk41i.csv",
local_to_UTC = 7,
lat = FT(40.0329), # degree,
long = FT(-105.5464), # degree,
atmos_h = FT(21.5),
)
return (
data_link = data_link,
local_to_UTC = local_to_UTC,
atmos_h = atmos_h,
lat = lat,
long = long,
)
end
Named Tuple containing default configurations for the Niwot Ridge site.
"""
niwotridge_default_configs = (
function niwotridge_default_configs(;
data_link = "https://caltech.box.com/shared/static/r6gvldgabk3mvtx53gevnlaq1ztsk41i.csv",
local_to_UTC = 7,
lat = FT(40.0329), # degree,
long = FT(-105.5464), # degree,
atmos_h = FT(21.5),
)
return (
data_link = data_link,
local_to_UTC = local_to_UTC,
atmos_h = atmos_h,
lat = lat,
long = long,
)
end
Loading

0 comments on commit 7b0c273

Please sign in to comment.