Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,3 @@ git-tree-sha1 = "c35ba0e899040cb8153226ab751f69100f475d39"
[[mizoguchi_soil_freezing_data.download]]
sha256 = "0027cc080ba45ba33dc790b176ec2854353ce7dce4eae4bef72963b0dd944e0b"
url = "https://caltech.box.com/shared/static/tn1bnqjmegyetw5kzd2ixq5pbnb05s3u.gz"

[modis_lai_fluxnet_sites]
git-tree-sha1 = "cdcc1708832654d2209d267e01a3893c4b25c085"

[[modis_lai_fluxnet_sites.download]]
sha256 = "c74780775d98b56eed74222377604272658f59686d4d7881c7b815b6c230080b"
url = "https://caltech.box.com/shared/static/g6vubma6vcxulb9fl0pvzq6v0oto4iu3.gz"
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ClimaLand.jl Release Notes

main
-------
- Use global MODIS LAI for all simulations; remove `modis_lai_fluxnet_sites` artifact PR[#1282](https://github.com/CliMA/ClimaLand.jl/pull/1282)
- Use ClimaUtilities v0.1.25 to read in spatial data to a point using lat/lon PR[#1279](https://github.com/CliMA/ClimaLand.jl/pull/1279)
- Add data handling tools to FluxnetSimulationsExt and use throughout docs and experiments PR[#1238](https://github.com/CliMA/ClimaLand.jl/pull/1238)
- Add convenience constructors for CanopyModel and integrated models PR[#1255](https://github.com/CliMA/ClimaLand.jl/pull/1255)
Expand Down
72 changes: 43 additions & 29 deletions docs/src/tutorials/integrated/soil_canopy_tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,20 @@ FluxnetSimulationsExt =
const FT = Float32;
earth_param_set = LP.LandParameters(FT);

# Setup the domain for the model:
# First provide some information about the site
site_ID = "US-MOz"
# Timezone (offset from UTC in hrs)
time_offset = 7
start_date = DateTime(2010) + Hour(time_offset)

# Site latitude and longitude
lat = FT(38.7441) # degree
long = FT(-92.2000) # degree

# Height of the sensor at the site
atmos_h = FT(32) # m

# Setup the domain for the model:
nelements = 10
zmin = FT(-2)
zmax = FT(0)
Expand All @@ -75,28 +87,21 @@ h_stem = FT(9)
h_leaf = FT(9.5)
compartment_midpoints = [h_stem / 2, h_stem + h_leaf / 2]
compartment_surfaces = [zmax, h_stem, h_stem + h_leaf]
land_domain = Column(; zlim = (zmin, zmax), nelements = nelements);
land_domain =
Column(; zlim = (zmin, zmax), nelements = nelements, longlat = (long, lat));

# Specify the time range and dt value over which to perform the simulation.
t0 = Float64(150 * 3600 * 24)# start mid year
N_days = 100
tf = t0 + Float64(3600 * 24 * N_days)
dt = Float64(30)

# - We will be using prescribed atmospheric and radiative drivers from the
# US-MOz tower, which we read in here. We are using prescribed
# atmospheric and radiative flux conditions, but it is also possible to couple
# the simulation with atmospheric and radiative flux models. We also
# read in the observed LAI and let that vary in time in a prescribed manner.


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

# Site latitude and longitude
lat = FT(38.7441) # degree
long = FT(-92.2000) # degree

# Height of the sensor at the site
atmos_h = FT(32) # m

# Forcing data
(; atmos, radiation) = FluxnetSimulationsExt.prescribed_forcing_fluxnet(
site_ID,
Expand Down Expand Up @@ -223,12 +228,27 @@ photosynthesis_args =
(; parameters = FarquharParameters(FT, is_c3; Vcmax25 = FT(5e-5)));

K_sat_plant = FT(1.8e-8)
(; LAI, maxLAI) =
FluxnetSimulationsExt.prescribed_LAI_fluxnet(site_ID, start_date)
maxLAI = FT(maxLAI) # convert to the float type of our simulation

# Read in LAI from MODIS data
surface_space = land_domain.space.surface;
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(;
start_date = start_date + Second(t0),
end_date = start_date + Second(t0) + Second(tf),
Comment on lines +235 to +236
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it strange that start_date isn't actually the start date.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree. I think we used to call it ref_date and it may be clearer if we go back to using that. But this is the convention we use throughout ClimaLand right now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we maybe discuss this more? I think we should get rid of t0 and tf and only work with start and stop_date

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(at least in fluxnet runs; this is also what we do in global runs)

)
LAI = ClimaLand.prescribed_lai_modis(
modis_lai_ncdata_path,
surface_space,
start_date,
);
# Get the maximum LAI at this site over the first year of the simulation
maxLAI = FluxnetSimulationsExt.get_maxLAI_at_site(
modis_lai_ncdata_path[1],
lat,
long,
)

SAI = FT(0.00242)
RAI = (SAI + maxLAI) * f_root_to_shoot;
# Note: LAIfunction was determined from data in the script we included above.
ai_parameterization = PrescribedSiteAreaIndex{FT}(LAI, SAI, RAI)

ψ63 = FT(-4 / 0.0098)
Expand Down Expand Up @@ -346,15 +366,7 @@ for i in 1:2
augmented_liquid_fraction.(plant_ν, S_l_ini[i])
end;

# Select the timestepper and solvers needed for the specific problem. Specify the time range and dt
# value over which to perform the simulation.

t0 = Float64(150 * 3600 * 24)# start mid year
N_days = 100
tf = t0 + Float64(3600 * 24 * N_days)
dt = Float64(30)
n = 120
saveat = Array(t0:(n * dt):tf)
# Select the timestepper and solvers needed for the specific problem.

timestepper = CTS.ARS343()
ode_algo = CTS.IMEXAlgorithm(
Expand All @@ -374,6 +386,8 @@ set_initial_cache!(p, Y, t0);
# how often we save output, and how often we update
# the forcing data ("drivers")

n = 120
saveat = Array(t0:(n * dt):tf)
sv = (;
t = Array{Float64}(undef, length(saveat)),
saveval = Array{NamedTuple}(undef, length(saveat)),
Expand Down
71 changes: 43 additions & 28 deletions docs/src/tutorials/standalone/Canopy/canopy_tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,21 @@ earth_param_set = LP.LandParameters(FT);
# stomatal conductance model, and atmospheric and radiative flux conditions
# which may be either prescribed or simulated.

# First, define the parameters of the model domain. These values are needed
# First provide some information about the site
# Timezone (offset from UTC in hrs)
time_offset = 7
start_date = DateTime(2010) + Hour(time_offset)

# Site latitude and longitude
lat = FT(38.7441) # degree
long = FT(-92.2000) # degree

# Height of the sensor at the site
atmos_h = FT(32)
# Site ID
site_ID = "US-MOz";

# Now we define the parameters of the model domain. These values are needed
# by some of the component models. Here we are performing a 1-dimensional
# simulation in a `Point` domain and will use
# single stem and leaf compartments, but for 2D simulations, the parameters of
Expand All @@ -91,28 +105,23 @@ h_stem = FT(9)
h_leaf = FT(9.5)
compartment_midpoints = [h_stem / 2, h_stem + h_leaf / 2]
compartment_surfaces = [zmax, h_stem, h_stem + h_leaf]
land_domain = Point(; z_sfc = FT(0.0))
land_domain = Point(; z_sfc = FT(0.0), longlat = (long, lat));

# Select a time range to perform time stepping over, and a dt. As usual,
# the timestep depends on the problem you are solving, the accuracy of the
# solution required, and the timestepping algorithm you are using.

t0 = 0.0
N_days = 364
tf = t0 + 3600 * 24 * N_days
dt = 225.0

# - We will be using prescribed atmospheric and radiative drivers from the
# US-MOz tower, which we read in here. We are using prescribed
# atmospheric and radiative flux conditions, but it is also possible to couple
# the simulation with atmospheric and radiative flux models. We also
# read in the observed LAI and let that vary in time in a prescribed manner.

# First provide some information about the site
# Timezone (offset from UTC in hrs)
time_offset = 7
start_date = DateTime(2010) + Hour(time_offset)

# Site latitude and longitude
lat = FT(38.7441) # degree
long = FT(-92.2000) # degree

# Height of the sensor at the site
atmos_h = FT(32)
# Site ID
site_ID = "US-MOz";

# Forcing data
(; atmos, radiation) = FluxnetSimulationsExt.prescribed_forcing_fluxnet(
site_ID,
Expand Down Expand Up @@ -185,8 +194,24 @@ AR_model = AutotrophicRespirationModel{FT}(AR_params);
# Begin by providing general plant parameters. For the area
# indices of the canopy, we choose a `PrescribedSiteAreaIndex`,
# which supports LAI as a function of time, with RAI and SAI as constant.
(; LAI, maxLAI) =
FluxnetSimulationsExt.prescribed_LAI_fluxnet(site_ID, start_date)
# Read in LAI from MODIS data
surface_space = land_domain.space.surface;
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(
start_date = start_date + Second(t0),
end_date = start_date + Second(t0) + Second(tf),
)
LAI = ClimaLand.prescribed_lai_modis(
modis_lai_ncdata_path,
surface_space,
start_date,
);
# Get the maximum LAI at this site over the first year of the simulation
maxLAI = FluxnetSimulationsExt.get_maxLAI_at_site(
modis_lai_ncdata_path[1],
lat,
long,
);

SAI = FT(0.00242)
f_root_to_shoot = FT(3.5)
RAI = FT((SAI + maxLAI) * f_root_to_shoot)
Expand Down Expand Up @@ -281,16 +306,6 @@ for i in 1:2
Y.canopy.hydraulics.ϑ_l.:($i) .= augmented_liquid_fraction.(ν, S_l_ini[i])
end;

# Select a time range to perform time stepping over, and a dt. Also create the
# saveat Array to contain the data from the model at each time step. As usual,
# the timestep depends on the problem you are solving, the accuracy of the
# solution required, and the timestepping algorithm you are using.

t0 = 0.0
N_days = 364
tf = t0 + 3600 * 24 * N_days
dt = 225.0;

# Initialize the cache variables for the canopy using the initial
# conditions and initial time.

Expand Down
5 changes: 3 additions & 2 deletions experiments/benchmarks/snowy_land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
photosynthesis_args =
(; parameters = Canopy.FarquharParameters(FT, is_c3; Vcmax25 = Vcmax25))
# Set up plant hydraulics
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_single_year_path(;
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(;
context = nothing,
year = Dates.year(Second(t0) + start_date),
start_date = start_date + Second(t0),
end_date = start_date + Second(t0) + Second(tf),
)
LAIfunction = ClimaLand.prescribed_lai_modis(
modis_lai_ncdata_path,
Expand Down
7 changes: 5 additions & 2 deletions experiments/calibration/forward_model_land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ function setup_prob(
#sc = sc,
))
# Set up plant hydraulics
modis_lai_ncdata_path =
ClimaLand.Artifacts.find_modis_year_paths(date(t0), date(tf); context)
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(
date(t0),
date(tf);
context,
)
LAIfunction = ClimaLand.prescribed_lai_modis(
modis_lai_ncdata_path,
surface_space,
Expand Down
2 changes: 1 addition & 1 deletion experiments/integrated/fluxnet/US-Var/US-Var_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fluxtower site."""
## Ma, S., Baldocchi, D. D., Xu, L., Hehn, T. (2007)
## Inter-Annual Variability In Carbon Dioxide Exchange Of An
## Oak/Grass Savanna And Open Grassland In California, Agricultural
## And Forest Meteorology, 147(3-4), 157-171. https://doi.org/10.1016/j.agrformet.2007.07.008
## And Forest Meteorology, 147(3-4), 157-171. https://doi.org/10.1016/j.agrformet.2007.07.008
## CLM 5.0 Tech Note: https://www2.cesm.ucar.edu/models/cesm2/land/CLM50_Tech_Note.pdf
# Bonan, G. Climate change and terrestrial ecosystem modeling. Cambridge University Press, 2019.

Expand Down
6 changes: 1 addition & 5 deletions experiments/integrated/fluxnet/fluxnet_domain.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""This file sets up the domain to run Clima Land on a fluxtower site, using both
the generic parameters set in this file as well as the site-specific parameters
the generic parameters set in this file as well as the site-specific parameters
given in the {site-ID}_simulation.jl file in each site directory."""

# Domain setup
Expand All @@ -8,7 +8,3 @@ h_canopy = h_stem + h_leaf
compartment_midpoints =
n_stem > 0 ? [h_stem / 2, h_stem + h_leaf / 2] : [h_leaf / 2]
compartment_surfaces = n_stem > 0 ? [zmax, h_stem, h_canopy] : [zmax, h_leaf]

land_domain =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this into the driver scripts so that we have access to lat and long when we construct it. This file will be removed soon in a different PR, so it doesn't matter that this is duplicating some code.

Column(; zlim = (zmin, zmax), nelements = nelements, dz_tuple = dz_tuple)
canopy_domain = ClimaLand.Domains.obtain_surface_domain(land_domain)
30 changes: 28 additions & 2 deletions experiments/integrated/fluxnet/ozark_pft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ClimaLand
import SciMLBase
import ClimaTimeSteppers as CTS
using ClimaCore
import ClimaComms
import ClimaParams as CP
using Dates
using Insolation
Expand Down Expand Up @@ -57,6 +58,14 @@ include(
),
)

land_domain = Column(;
zlim = (zmin, zmax),
nelements = nelements,
dz_tuple = dz_tuple,
longlat = (long, lat),
)
canopy_domain = ClimaLand.Domains.obtain_surface_domain(land_domain)

# Define the PFT land cover percentages for the Ozark site. Currently we only
# use the dominant PFT, which for Ozark is deciduous broadleaf temperate trees.
pft_pcts = [
Expand Down Expand Up @@ -117,8 +126,25 @@ start_date = DateTime(2010) + Hour(time_offset)
earth_param_set,
FT,
)
(; LAI, maxLAI) =
FluxnetSimulationsExt.prescribed_LAI_fluxnet(site_ID, start_date)

# Read in LAI from MODIS data
surface_space = land_domain.space.surface
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(
start_date = start_date + Second(t0),
end_date = start_date + Second(t0) + Second(tf);
context = ClimaComms.context(surface_space),
)
LAI = ClimaLand.prescribed_lai_modis(
modis_lai_ncdata_path,
surface_space,
start_date,
)
# Get the maximum LAI at this site over the first year of the simulation
maxLAI = FluxnetSimulationsExt.get_maxLAI_at_site(
modis_lai_ncdata_path[1],
lat,
long,
);
RAI = maxLAI * f_root_to_shoot
capacity = plant_ν * maxLAI * h_leaf * FT(1000)

Expand Down
29 changes: 27 additions & 2 deletions experiments/integrated/fluxnet/run_fluxnet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ include(
),
)

land_domain = Column(;
zlim = (zmin, zmax),
nelements = nelements,
dz_tuple = dz_tuple,
longlat = (long, lat),
)
canopy_domain = ClimaLand.Domains.obtain_surface_domain(land_domain)

# This reads in the data from the flux tower site and creates
# the atmospheric and radiative driver structs for the model
include(
Expand All @@ -80,8 +88,25 @@ include(
earth_param_set,
FT,
)
(; LAI, maxLAI) =
FluxnetSimulationsExt.prescribed_LAI_fluxnet(site_ID, start_date)

# Read in LAI from MODIS data
surface_space = land_domain.space.surface
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(;
context = ClimaComms.context(surface_space),
start_date = start_date + Second(t0),
end_date = start_date + Second(t0) + Second(tf),
)
LAI = ClimaLand.prescribed_lai_modis(
modis_lai_ncdata_path,
surface_space,
start_date,
)
# Get the maximum LAI at this site over the first year of the simulation
maxLAI = FluxnetSimulationsExt.get_maxLAI_at_site(
modis_lai_ncdata_path[1],
lat,
long,
);
RAI = maxLAI * f_root_to_shoot
capacity = plant_ν * maxLAI * h_leaf * FT(1000)

Expand Down
5 changes: 3 additions & 2 deletions experiments/integrated/global/global_soil_canopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ conductance_args = (; parameters = Canopy.MedlynConductanceParameters(FT; g1))
photosynthesis_args =
(; parameters = Canopy.FarquharParameters(FT, is_c3; Vcmax25 = Vcmax25))
# Set up plant hydraulics
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_single_year_path(;
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(;
context = nothing,
year = Dates.year(Second(t0) + start_date),
start_date = start_date + Second(t0),
end_date = start_date + Second(t0) + Second(tf),
)
LAIfunction = ClimaLand.prescribed_lai_modis(
modis_lai_ncdata_path,
Expand Down
Loading
Loading