Skip to content

Creating function to be able to run run_fluxnet for any fluxnet site with generic parameters #1182

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 3 commits into
base: main
Choose a base branch
from

Conversation

ThanhNguyen428
Copy link
Collaborator

@ThanhNguyen428 ThanhNguyen428 commented Jun 17, 2025

Purpose

Added function to allow run_fluxnet.jl to be extrapolated for a fixed set of params and any fluxnet site (stored in any_run_fluxnet.jl). Was tested with US-Ha1 to confirm that it is working.

To-do

  • Make sure "iterating over empty list" bug is fixed (possibly fixed once rebased to origin)
  • Rebase onto main
  • Deprecated run_fluxnet.jl into any_run_fluxnet.jl

Content

  • Implemented function to get data files using site ID
  • Confirmed met_drivers_FLUXNET.jl worked with generic fluxnet sites

  • I have read and checked the items on the review checklist.

Copy link
Member

@juliasloan25 juliasloan25 left a comment

Choose a reason for hiding this comment

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

Thank you Thanhthanh, this is looking great so far! Let me know after you push your most recent changes and address the comments I've made here, and I'll do another review

@ThanhNguyen428 ThanhNguyen428 force-pushed the tn/any_fluxnet_site_empty_list branch 3 times, most recently from a630178 to 1cb4760 Compare July 10, 2025 03:27
@juliasloan25
Copy link
Member

This is looking good! I will review in a moment, but it would also be good to: 1. rebase on current main, and 2. not modify the Manifest in this PR - to do this you can check out the Manifest from main by running git checkout origin/main -- .buildkite/Manifest-v1.11.toml

AlexisRenchon and others added 2 commits July 10, 2025 12:18
…nctions from any_run_fluxnet

    pick 1cb4760 deprecated run_fluxnet.jl to become a pure simulation file calling functions from any_run_fluxnet
Copy link
Member

@juliasloan25 juliasloan25 left a comment

Choose a reason for hiding this comment

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

I have some questions about how the user-specified params are being used, but we can discuss this afternoon!

),
)

Base.invokelatest(run_helper, site_ID, params)
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't need to call Base.invokelatest, and if we remove it we'll be able to get rid of the @eval macro in run_helper


sol = SciMLBase.solve(prob, ode_algo; dt = dt, callback = cb)

# Extract model output from the saved diagnostics
Copy link
Member

Choose a reason for hiding this comment

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

Everything from here down in this function can go into another function postprocess_fluxnet(), so that we can run the simulation without postprocessing (e.g. for calibration), and also to make the code more readable

Comment on lines +529 to +541
if isfile(
joinpath(
climaland_dir,
"experiments/integrated/fluxnet/$site_ID/Artifacts.toml",
),
)
rm(
joinpath(
climaland_dir,
"experiments/integrated/fluxnet/$site_ID/Artifacts.toml",
),
)
end
Copy link
Member

Choose a reason for hiding this comment

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

this would be more concise:

Suggested change
if isfile(
joinpath(
climaland_dir,
"experiments/integrated/fluxnet/$site_ID/Artifacts.toml",
),
)
rm(
joinpath(
climaland_dir,
"experiments/integrated/fluxnet/$site_ID/Artifacts.toml",
),
)
end
artifact_file = joinpath(climaland_dir, "experiments/integrated/fluxnet/$site_ID/Artifacts.toml")
isfile(artifact_file) && rm(artifact_file)

@ThanhNguyen428 ThanhNguyen428 force-pushed the tn/any_fluxnet_site_empty_list branch from 43c662e to 2aa009f Compare July 10, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants