PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.
www.pecanproject.org
Other
202 stars 235 forks source link

Downscale Function created for for hourly data in nc #3322

Closed Snafkin547 closed 2 months ago

Snafkin547 commented 3 months ago

Description

This new function, called 'NA_downscale_hrly', is extended from the original 'NA_downscale' function. This newly created downscale function handles hourly data stored in nc file and generates outputs including the weights of each ensemble member for each observatory site. These weights are not currently used, however, they will be used effectively in the aggregation step in the future, once we come up with an idea of how to distribute to each coordinate.

Motivation and Context

In the previously developed 'NA_downscale' function, monthly-yearly data was handled. This newly developed downscale function enables to deal with the hourly data. Due to the difference in data structures and absence of weights in previous data structure, we needed this change.

Review Time Estimate

Types of changes

Checklist:

Snafkin547 commented 2 months ago

Example usage

# Set working directory
my_wd <- "<Your working directory>"
setwd(my_wd)

# Load necessary library
library(terra)
library(readr)
library(sf)
library(ncdf4)

nc_file <- "/Users/hishii/Desktop/PEcAn/osfstorage-archive/NCDF/NEE.nc"
nc_data <- nc_open(nc_file)
coords <- paste0(my_wd, "data/SDA/sites.csv")
covariates <- rast(paste0(my_wd, "data/covariates.tif"))
date <- "1986-01-01 00:00:00 EST"
downscale_output <- NA_downscale_hrly(nc_data, coords, date, covariates)
infotroph commented 3 weeks ago

Hi, @Snafkin547! With this PR you became an author of the PEcAn.assim.sequential package, so we'd like to make sure we have your agreement to change the package license from NCSA to BSD-3. Commenting "yes" here is enough. More details are in #3364 if you want them.

We started the relicensing process (with notes in CHANGELOG.md) before you opened this PR, but at merge time we hadn't yet updated any license files in this package, so for full clarity we'd like to hear your explicit consent even if you had been assuming your contribution would be BSD-3 all along 😁