Skip to content

Move forcing script from fluxnet experiments to src #1238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .buildkite/Manifest-v1.11.toml
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,10 @@ deps = ["ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTime
path = ".."
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
version = "0.17.2"
weakdeps = ["BSON", "CSV", "CairoMakie", "ClimaAnalysis", "DataFrames", "Flux", "GeoMakie", "HTTP", "Poppler_jll", "Printf", "StatsBase"]
weakdeps = ["BSON", "CSV", "CairoMakie", "ClimaAnalysis", "DataFrames", "DelimitedFiles", "Flux", "GeoMakie", "HTTP", "Poppler_jll", "Printf", "StatsBase"]

[deps.ClimaLand.extensions]
FluxnetSimulations = ["DelimitedFiles"]
LandSimulationVisualization = ["CairoMakie", "ClimaAnalysis", "GeoMakie", "Poppler_jll", "Printf", "StatsBase"]
NeuralSnowExt = ["CSV", "DataFrames", "HTTP", "Flux", "StatsBase", "BSON"]

Expand Down
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
ClimaAnalysis = "29b5916a-a76c-4e73-9657-3c8fd22e65e6"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
Expand All @@ -37,13 +38,14 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[extensions]
FluxnetSimulations = ["DelimitedFiles",]
LandSimulationVisualization = ["CairoMakie", "ClimaAnalysis", "GeoMakie", "Poppler_jll", "Printf", "StatsBase"]
NeuralSnowExt = ["CSV", "DataFrames", "HTTP", "Flux", "StatsBase", "BSON"]

[compat]
BSON = "0.3.9"
CairoMakie = "0.12"
CSV = "0.10.14"
CairoMakie = "0.12"
ClimaAnalysis = "0.5.17"
ClimaComms = "0.6.2"
ClimaCore = "0.14.23"
Expand All @@ -53,6 +55,7 @@ ClimaTimeSteppers = "0.8"
ClimaUtilities = "0.1.24"
DataFrames = "1.4"
Dates = "1"
DelimitedFiles = "1"
DocStringExtensions = "0.9"
Flux = "0.15, 0.16"
GeoMakie = "< 0.7.13"
Expand Down
35 changes: 18 additions & 17 deletions docs/src/tutorials/integrated/soil_canopy_tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ using ClimaLand.Canopy
using ClimaLand.Canopy.PlantHydraulics
import ClimaLand
import ClimaLand.Parameters as LP
using DelimitedFiles
FluxnetSimulations =
Base.get_extension(ClimaLand, :FluxnetSimulations).FluxnetSimulations;

# Define the floating point precision desired (64 or 32 bit), and get the
# parameter set holding constants used across CliMA Models:
Expand All @@ -65,8 +68,6 @@ nelements = 10
zmin = FT(-2)
zmax = FT(0)
f_root_to_shoot = FT(3.5)
SAI = FT(0.00242)
maxLAI = FT(4.2)
plant_ν = FT(2.46e-4)
n_stem = Int64(1)
n_leaf = Int64(1)
Expand All @@ -82,14 +83,12 @@ land_domain = Column(; zlim = (zmin, zmax), nelements = nelements);
# 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.

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

# 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
Expand All @@ -98,17 +97,17 @@ long = FT(-92.2000) # degree
# Height of the sensor at the site
atmos_h = FT(32) # m

# Provide the site site ID and the path to the data file:
site_ID = "US-MOz"
data_link = "https://caltech.box.com/shared/static/7r0ci9pacsnwyo0o9c25mhhcjhsu6d72.csv"

include(
joinpath(
pkgdir(ClimaLand),
"experiments/integrated/fluxnet/met_drivers_FLUXNET.jl",
),
# Forcing data
(; atmos, radiation) = FluxnetSimulations.prescribed_forcing_fluxnet(
site_ID,
lat,
long,
time_offset,
atmos_h,
start_date,
earth_param_set,
FT,
);

# # Setup the Coupled Canopy and Soil Physics Model

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

K_sat_plant = FT(1.8e-8)
(; LAI, maxLAI) = FluxnetSimulations.prescribed_LAI_fluxnet(site_ID, start_date)
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}(LAIfunction, SAI, RAI)
ai_parameterization = PrescribedSiteAreaIndex{FT}(LAI, SAI, RAI)

ψ63 = FT(-4 / 0.0098)
Weibull_param = FT(4)
Expand Down
44 changes: 21 additions & 23 deletions docs/src/tutorials/standalone/Canopy/canopy_tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ using ClimaLand.Canopy
using ClimaLand.Canopy.PlantHydraulics
import ClimaLand
import ClimaLand.Parameters as LP
using DelimitedFiles
FluxnetSimulations =
Base.get_extension(ClimaLand, :FluxnetSimulations).FluxnetSimulations;

# Define the floating point precision desired (64 or 32 bit), and get the
# parameter set holding constants used across CliMA Models:
Expand Down Expand Up @@ -81,8 +84,6 @@ nelements = 10
zmin = FT(-2)
zmax = FT(0)
f_root_to_shoot = FT(3.5)
SAI = FT(0.00242)
maxLAI = FT(4.2)
plant_ν = FT(2.46e-4) # kg/m^2
n_stem = Int64(1)
n_leaf = Int64(1)
Expand All @@ -98,32 +99,31 @@ land_domain = Point(; z_sfc = FT(0.0))
# 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.

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

# 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)

# Provide the site site ID and the path to the data file:
site_ID = "US-MOz"
data_link = "https://caltech.box.com/shared/static/7r0ci9pacsnwyo0o9c25mhhcjhsu6d72.csv"

include(
joinpath(
pkgdir(ClimaLand),
"experiments/integrated/fluxnet/met_drivers_FLUXNET.jl",
),
);
# Site ID
site_ID = "US-MOz";

# Forcing data
(; atmos, radiation) = FluxnetSimulations.prescribed_forcing_fluxnet(
site_ID,
lat,
long,
time_offset,
atmos_h,
start_date,
earth_param_set,
FT,
)

# Populate the SharedCanopyParameters struct, which holds the parameters
# shared between all different components of the canopy model.
Expand Down Expand Up @@ -187,13 +187,11 @@ 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 = 4.2
LAIfunction = (t) -> LAI
(; LAI, maxLAI) = FluxnetSimulations.prescribed_LAI_fluxnet(site_ID, start_date)
SAI = FT(0.00242)
f_root_to_shoot = FT(3.5)
RAI = FT((SAI + LAI) * f_root_to_shoot)
ai_parameterization =
PrescribedSiteAreaIndex{FT}(TimeVaryingInput(LAIfunction), SAI, RAI)
RAI = FT((SAI + maxLAI) * f_root_to_shoot)
ai_parameterization = PrescribedSiteAreaIndex{FT}(LAI, SAI, RAI)
rooting_depth = FT(1.0);


Expand Down
174 changes: 0 additions & 174 deletions experiments/integrated/fluxnet/data_tools.jl

This file was deleted.

2 changes: 1 addition & 1 deletion experiments/integrated/fluxnet/fluxnet_simulation.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""This file contains the site-generic time variables for running ClimaLand on
fluxtower sites. These work in tandem with the site-specific timing parameters
found in the {site-ID}_simulation.jl files in each site directory."""

data_dt = Float64(FluxnetSimulations.get_data_dt(site_ID))
N_spinup_days = 15
N_days = N_spinup_days + 340

Expand Down
Loading
Loading