Skip to content

Commit abe6401

Browse files
authored
fluxnet data handling in extension (#1238)
1 parent 4cb1823 commit abe6401

File tree

20 files changed

+1202
-856
lines changed

20 files changed

+1202
-856
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ClimaLand.jl Release Notes
33

44
main
55
-------
6+
- Add data handling tools to FluxnetSimulationsExt and use throughout docs and experiments PR[#1238](https://github.com/CliMA/ClimaLand.jl/pull/1238)
67
- Add convenience constructors for CanopyModel and integrated models PR[#1255](https://github.com/CliMA/ClimaLand.jl/pull/1255)
78
- Rename LandSimulationVisualization to LandSimulationVisualizationExt; add template for FluxnetSimulationsExt PR[#1259](https://github.com/CliMA/ClimaLand.jl/pull/1259)
89
- Remove root_depths from the PrescribeGroundConditions struct, and treat these ground ``drivers" consistently with how we handle atmospheric forcing PR[#1199](https://github.com/CliMA/ClimaLand.jl/pull/1240)

docs/src/tutorials/integrated/soil_canopy_tutorial.jl

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ using ClimaLand.Canopy
5252
using ClimaLand.Canopy.PlantHydraulics
5353
import ClimaLand
5454
import ClimaLand.Parameters as LP
55+
using DelimitedFiles
56+
FluxnetSimulationsExt =
57+
Base.get_extension(ClimaLand, :FluxnetSimulationsExt).FluxnetSimulationsExt;
5558

5659
# Define the floating point precision desired (64 or 32 bit), and get the
5760
# parameter set holding constants used across CliMA Models:
@@ -65,8 +68,6 @@ nelements = 10
6568
zmin = FT(-2)
6669
zmax = FT(0)
6770
f_root_to_shoot = FT(3.5)
68-
SAI = FT(0.00242)
69-
maxLAI = FT(4.2)
7071
plant_ν = FT(2.46e-4)
7172
n_stem = Int64(1)
7273
n_leaf = Int64(1)
@@ -82,14 +83,12 @@ land_domain = Column(; zlim = (zmin, zmax), nelements = nelements);
8283
# the simulation with atmospheric and radiative flux models. We also
8384
# read in the observed LAI and let that vary in time in a prescribed manner.
8485

85-
# Use the data tools for reading FLUXNET data sets
86-
include(
87-
joinpath(pkgdir(ClimaLand), "experiments/integrated/fluxnet/data_tools.jl"),
88-
);
8986

9087
# First provide some information about the site
88+
site_ID = "US-MOz"
9189
# Timezone (offset from UTC in hrs)
9290
time_offset = 7
91+
start_date = DateTime(2010) + Hour(time_offset)
9392

9493
# Site latitude and longitude
9594
lat = FT(38.7441) # degree
@@ -98,17 +97,17 @@ long = FT(-92.2000) # degree
9897
# Height of the sensor at the site
9998
atmos_h = FT(32) # m
10099

101-
# Provide the site site ID and the path to the data file:
102-
site_ID = "US-MOz"
103-
data_link = "https://caltech.box.com/shared/static/7r0ci9pacsnwyo0o9c25mhhcjhsu6d72.csv"
104-
105-
include(
106-
joinpath(
107-
pkgdir(ClimaLand),
108-
"experiments/integrated/fluxnet/met_drivers_FLUXNET.jl",
109-
),
100+
# Forcing data
101+
(; atmos, radiation) = FluxnetSimulationsExt.prescribed_forcing_fluxnet(
102+
site_ID,
103+
lat,
104+
long,
105+
time_offset,
106+
atmos_h,
107+
start_date,
108+
earth_param_set,
109+
FT,
110110
);
111-
112111
# # Setup the Coupled Canopy and Soil Physics Model
113112

114113
# We want to simulate the canopy-soil system together, so the model type
@@ -224,9 +223,13 @@ photosynthesis_args =
224223
(; parameters = FarquharParameters(FT, is_c3; Vcmax25 = FT(5e-5)));
225224

226225
K_sat_plant = FT(1.8e-8)
226+
(; LAI, maxLAI) =
227+
FluxnetSimulationsExt.prescribed_LAI_fluxnet(site_ID, start_date)
228+
maxLAI = FT(maxLAI) # convert to the float type of our simulation
229+
SAI = FT(0.00242)
227230
RAI = (SAI + maxLAI) * f_root_to_shoot;
228231
# Note: LAIfunction was determined from data in the script we included above.
229-
ai_parameterization = PrescribedSiteAreaIndex{FT}(LAIfunction, SAI, RAI)
232+
ai_parameterization = PrescribedSiteAreaIndex{FT}(LAI, SAI, RAI)
230233

231234
ψ63 = FT(-4 / 0.0098)
232235
Weibull_param = FT(4)

docs/src/tutorials/standalone/Canopy/canopy_tutorial.jl

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ using ClimaLand.Canopy
5252
using ClimaLand.Canopy.PlantHydraulics
5353
import ClimaLand
5454
import ClimaLand.Parameters as LP
55+
using DelimitedFiles
56+
FluxnetSimulationsExt =
57+
Base.get_extension(ClimaLand, :FluxnetSimulationsExt).FluxnetSimulationsExt;
5558

5659
# Define the floating point precision desired (64 or 32 bit), and get the
5760
# parameter set holding constants used across CliMA Models:
@@ -81,8 +84,6 @@ nelements = 10
8184
zmin = FT(-2)
8285
zmax = FT(0)
8386
f_root_to_shoot = FT(3.5)
84-
SAI = FT(0.00242)
85-
maxLAI = FT(4.2)
8687
plant_ν = FT(2.46e-4) # kg/m^2
8788
n_stem = Int64(1)
8889
n_leaf = Int64(1)
@@ -98,31 +99,30 @@ land_domain = Point(; z_sfc = FT(0.0))
9899
# the simulation with atmospheric and radiative flux models. We also
99100
# read in the observed LAI and let that vary in time in a prescribed manner.
100101

101-
# Use the data tools for reading FLUXNET data sets
102-
include(
103-
joinpath(pkgdir(ClimaLand), "experiments/integrated/fluxnet/data_tools.jl"),
104-
);
105-
106102
# First provide some information about the site
107103
# Timezone (offset from UTC in hrs)
108104
time_offset = 7
105+
start_date = DateTime(2010) + Hour(time_offset)
109106

110107
# Site latitude and longitude
111108
lat = FT(38.7441) # degree
112109
long = FT(-92.2000) # degree
113110

114111
# Height of the sensor at the site
115112
atmos_h = FT(32)
116-
117-
# Provide the site site ID and the path to the data file:
118-
site_ID = "US-MOz"
119-
data_link = "https://caltech.box.com/shared/static/7r0ci9pacsnwyo0o9c25mhhcjhsu6d72.csv"
120-
121-
include(
122-
joinpath(
123-
pkgdir(ClimaLand),
124-
"experiments/integrated/fluxnet/met_drivers_FLUXNET.jl",
125-
),
113+
# Site ID
114+
site_ID = "US-MOz";
115+
116+
# Forcing data
117+
(; atmos, radiation) = FluxnetSimulationsExt.prescribed_forcing_fluxnet(
118+
site_ID,
119+
lat,
120+
long,
121+
time_offset,
122+
atmos_h,
123+
start_date,
124+
earth_param_set,
125+
FT,
126126
);
127127

128128
# Populate the SharedCanopyParameters struct, which holds the parameters
@@ -185,13 +185,12 @@ AR_model = AutotrophicRespirationModel{FT}(AR_params);
185185
# Begin by providing general plant parameters. For the area
186186
# indices of the canopy, we choose a `PrescribedSiteAreaIndex`,
187187
# which supports LAI as a function of time, with RAI and SAI as constant.
188-
LAI = 4.2
189-
LAIfunction = (t) -> LAI
188+
(; LAI, maxLAI) =
189+
FluxnetSimulationsExt.prescribed_LAI_fluxnet(site_ID, start_date)
190190
SAI = FT(0.00242)
191191
f_root_to_shoot = FT(3.5)
192-
RAI = FT((SAI + LAI) * f_root_to_shoot)
193-
ai_parameterization =
194-
PrescribedSiteAreaIndex{FT}(TimeVaryingInput(LAIfunction), SAI, RAI)
192+
RAI = FT((SAI + maxLAI) * f_root_to_shoot)
193+
ai_parameterization = PrescribedSiteAreaIndex{FT}(LAI, SAI, RAI)
195194
rooting_depth = FT(1.0);
196195

197196

experiments/integrated/fluxnet/data_tools.jl

Lines changed: 0 additions & 174 deletions
This file was deleted.

experiments/integrated/fluxnet/fluxnet_simulation.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""This file contains the site-generic time variables for running ClimaLand on
22
fluxtower sites. These work in tandem with the site-specific timing parameters
33
found in the {site-ID}_simulation.jl files in each site directory."""
4-
54
N_spinup_days = 15
65
N_days = N_spinup_days + 340
76

0 commit comments

Comments
 (0)