Skip to content

Update NEE and LE gap-fill functions#3883

Open
Amedieus wants to merge 7 commits intoPecanProject:developfrom
Amedieus:develop
Open

Update NEE and LE gap-fill functions#3883
Amedieus wants to merge 7 commits intoPecanProject:developfrom
Amedieus:develop

Conversation

@Amedieus
Copy link
Copy Markdown

@Amedieus Amedieus commented Mar 19, 2026

Description

Motivation and Context

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I agree that PEcAn Project may distribute my contribution under any or all of
    • the same license as the existing code,
    • and/or the BSD 3-clause license.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Amedieus Amedieus requested a review from mdietze March 20, 2026 00:14
@mdietze mdietze requested review from DongchenZ and ankurdesai March 20, 2026 17:51
@@ -0,0 +1,589 @@
utils::globalVariables(c(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd strongly recommend agains setting global variables

#'
#' @param site.dir character: path to the site information table.
#' @param n_sites numeric: number of sites to keep from the site table,
#' the total number of sites is 241.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd drop this specific number, as it's likely to change in the future

#' @return character vector of selected site IDs. Example: 'Site ID' CA-ARB
#'
#' @author Yang Gu
read_site_ids <- function(site.dir, n_sites = 40) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remember that this code is becoming part of the overall PEcAn codebase, and in that context site_id means something different. I'd recommend a slight renaming to include fluxnet in the function name

#' @return data.frame containing filtered predictor/flux data.
#'
#' @author Yang Gu
read_pred_data <- function(pred.var.dir, site_ids) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

similar request to make the function name more specific, such as read_flux_gapfill_covariates

#' }
#'
#' @author Yang Gu
build_sitecov_df <- function(resimet.df,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
build_sitecov_df <- function(resimet.df,
build_fluxnet_sitecov_df <- function(resimet.df,

#' @author Yang Gu
#' @importFrom foreach %dopar%
#' @export
xgb_gapfill <- function(site.dir,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xgb_gapfill <- function(site.dir,
xgb_flux_gapfill <- function(site.dir,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants