| Title: | PEcAn Functions Used for Extracting Remote Sensing Data |
|---|---|
| Description: | PEcAn module for processing remote data. Python module requirements: requests, json, re, ast, panads, sys. If any of these modules are missing, install using pip install <module name>. |
| Authors: | Mike Dietze, Bailey Morrison |
| Maintainer: | Bailey Morrison <[email protected]> |
| License: | BSD_3_clause + file LICENSE |
| Version: | 1.9.1.9000 |
| Built: | 2026-06-05 14:56:07 UTC |
| Source: | https://github.com/PecanProject/pecan |
Get MODIS data by date and location
call_MODIS( var, product, band, site_info, product_dates, outdir = NULL, run_parallel = FALSE, ncores = NULL, package_method = "MODISTools", QC_filter = FALSE, progress = FALSE )call_MODIS( var, product, band, site_info, product_dates, outdir = NULL, run_parallel = FALSE, ncores = NULL, package_method = "MODISTools", QC_filter = FALSE, progress = FALSE )
var |
the simple name of the modis dataset variable (e.g. lai) |
product |
string value for MODIS product number |
band |
string value for which measurement to extract |
site_info |
Bety list of site info for parsing MODIS data: list(site_id, site_name, lat, lon, time_zone) |
product_dates |
a character vector of the start and end date of the data in YYYYJJJ |
outdir |
where the output file will be stored. Default is NULL and in this case only values are returned. When path is provided values are returned and written to disk. |
run_parallel |
optional method to download data paralleize. Only works if more than 1 site is needed and there are >1 CPUs available. |
ncores |
number of cpus to use if run_parallel is set to TRUE. If you do not know the number of CPU's available, enter NULL. |
package_method |
string value to inform function of which package method to use to download modis data. Either "MODISTools" or "reticulate" (optional) |
QC_filter |
Converts QC values of band and keeps only data values that are excellent or good (as described by MODIS documentation), and removes all bad values. qc_band must be supplied for this parameter to work. Default is False. Only MODISTools option. |
progress |
TRUE reports the download progress bar of the dataset, FALSE omits the download progress bar. Default is TRUE. Only MODISTools option. Requires Python3 for reticulate method option. There are a number of required python libraries. sudo -H pip install numpy suds netCDF4 json depends on the MODISTools package version 1.1.0 |
Bailey Morrison
## Not run: site_info <- list( site_id = 1, site_name = "test", lat = 44, lon = 90, time_zone = "UTC") test_modistools <- call_MODIS( var = "lai", product = "MOD15A2H", band = "Lai_500m", site_info = site_info, product_dates = c("2001150", "2001365"), outdir = NULL, run_parallel = TRUE, ncores = NULL, package_method = "MODISTools", QC_filter = TRUE, progress = FALSE) ## End(Not run)## Not run: site_info <- list( site_id = 1, site_name = "test", lat = 44, lon = 90, time_zone = "UTC") test_modistools <- call_MODIS( var = "lai", product = "MOD15A2H", band = "Lai_500m", site_info = site_info, product_dates = c("2001150", "2001365"), outdir = NULL, run_parallel = TRUE, ncores = NULL, package_method = "MODISTools", QC_filter = TRUE, progress = FALSE) ## End(Not run)
construct remotedata module file names
construct_remotedata_filename( source, collection, siteid, scale = NULL, projection = NULL, qc = NULL, algorithm = NULL, out_process_data = NULL )construct_remotedata_filename( source, collection, siteid, scale = NULL, projection = NULL, qc = NULL, algorithm = NULL, out_process_data = NULL )
source |
source |
collection |
collection or product requested from the source |
siteid |
shortform of siteid |
scale |
scale, NULL by default |
projection |
projection, NULL by default |
qc |
qc_parameter, NULL by default |
algorithm |
algorithm name to process data, NULL by default |
out_process_data |
variable name requested for the processed file, NULL by default |
remotedata_file_names
Ayush Prasad
## Not run: remotedata_file_names <- construct_remotedata_filename( source="gee", collection="s2", siteid="0-721", scale=10.0, projection=NULL, qc=1.0, algorithm="snap", out_process_data="lai" ) remotedata_file_names ## End(Not run)## Not run: remotedata_file_names <- construct_remotedata_filename( source="gee", collection="s2", siteid="0-721", scale=10.0, projection=NULL, qc=1.0, algorithm="snap", out_process_data="lai" ) remotedata_file_names ## End(Not run)
download.thredds
download_thredds( site_info, dates, varid, dir_url, data_url, run_parallel = FALSE, outdir = NULL )download_thredds( site_info, dates, varid, dir_url, data_url, run_parallel = FALSE, outdir = NULL )
site_info |
list containing site_id, site_name, lat, lon, time_zone. Derived from BETY using a PEcAn .xml settings file with site information. Can use the get_site_info function to generate this list. |
dates |
vector of start and end date for dataset as YYYYmmdd, YYYY-mm-dd, YYYYjjj, or date object. |
varid |
character vector of shorthand variable name. i.e. LAI |
dir_url |
catalog url of data from ncei.noaa.gov/thredds website |
data_url |
opendap url of data from ncei.noaa.gov/thredds website |
run_parallel |
Logical. Download and extract files in parallel? |
outdir |
file location to place output |
data.frame summarize the results of the function call
Bailey Morrison
## Not run: settings <- PEcAn.settings::read.settings("/path/to/pecan.xml") site_info <- get_site_info(settings) results <- download_thredds( site_info = site_info, dates = c("19950201", "19961215"), varid = "LAI", dir_url = "https://www.ncei.noaa.gov/thredds/catalog/cdr/lai/files", data_url = "https://www.ncei.noaa.gov/thredds/dodsC/cdr/lai/files", run_parallel = TRUE, outdir = NULL) ## End(Not run)## Not run: settings <- PEcAn.settings::read.settings("/path/to/pecan.xml") site_info <- get_site_info(settings) results <- download_thredds( site_info = site_info, dates = c("19950201", "19961215"), varid = "LAI", dir_url = "https://www.ncei.noaa.gov/thredds/catalog/cdr/lai/files", data_url = "https://www.ncei.noaa.gov/thredds/dodsC/cdr/lai/files", run_parallel = TRUE, outdir = NULL) ## End(Not run)
download.LandTrendr.AGB
download.LandTrendr.AGB( outdir, target_dataset = "biomass", product_dates = NULL, product_version = "v1", con = NULL, run_parallel = TRUE, ncores = NULL, overwrite = FALSE )download.LandTrendr.AGB( outdir, target_dataset = "biomass", product_dates = NULL, product_version = "v1", con = NULL, run_parallel = TRUE, ncores = NULL, overwrite = FALSE )
outdir |
Where to place output |
target_dataset |
Which LandTrendr dataset to download? Default = "biomass" |
product_dates |
What data product dates to download |
product_version |
Optional. LandTrend AGB is provided with two versions, v0 and v1 (latest version) |
con |
Optional database connection. If specified then the code will check to see |
run_parallel |
Logical. Download and extract files in parallel? |
ncores |
Optional. If run_parallel=TRUE how many cores to use? If left as NULL will select max number -1 |
overwrite |
Logical. Overwrite existing files and replace with new versions |
data.frame summarize the results of the function call
Shawn Serbin
## Not run: outdir <- "~/scratch/abg_data/" product_dates <- c(1990, 1991, 1995) # using discontinous, or specific years product_dates2 <- seq(1992, 1995, 1) # using a date sequence for selection of years product_version = "v1" results <- PEcAn.data.remote::download.LandTrendr.AGB(outdir=outdir, product_dates = product_dates, product_version = product_version) results <- PEcAn.data.remote::download.LandTrendr.AGB(outdir=outdir, product_dates = product_dates2, product_version = product_version) ## End(Not run)## Not run: outdir <- "~/scratch/abg_data/" product_dates <- c(1990, 1991, 1995) # using discontinous, or specific years product_dates2 <- seq(1992, 1995, 1) # using a date sequence for selection of years product_version = "v1" results <- PEcAn.data.remote::download.LandTrendr.AGB(outdir=outdir, product_dates = product_dates, product_version = product_version) results <- PEcAn.data.remote::download.LandTrendr.AGB(outdir=outdir, product_dates = product_dates2, product_version = product_version) ## End(Not run)
Downloads and unzips the National Land Cover Database https://www.mrlc.gov/data. Will automatically insert into PEcAn database if database connection provided.
download.NLCD(outdir, year = 2011, con = NULL)download.NLCD(outdir, year = 2011, con = NULL)
outdir |
Directory to download NLCD to |
year |
which NLCD year to download. Only 2001 and 2011 are currently supported. |
con |
Optional database connection. If specified then the code will check to see if the file already exists in PEcAn before downloading, and will also create a database entry for new downloads |
Mike Dietze
Based on codes from Christy Rollinson and from Max Joseph (http://mbjoseph.github.io/2014/11/08/nlcd.html)
extract_NLCD(buffer, coords, data_dir = NULL, con = NULL, year = 2011)extract_NLCD(buffer, coords, data_dir = NULL, con = NULL, year = 2011)
buffer |
search radius (meters) |
coords |
data frame containing elements 'long' and 'lat'. Currently just supports single point extraction. |
data_dir |
directory where input data is located. Can be NUL if con is specified |
con |
connection to PEcAn database. Can be NULL if data_dir is specified |
year |
which NLCD year to extract. If data_dir not provided, must be one of '2001' or '2011' |
dataframe of fractional cover of different cover classes
Mike Dietze
Get MODIS phenology data by date and location
extract_phenology_MODIS( site_info, start_date, end_date, outdir, run_parallel = TRUE, ncores = NULL )extract_phenology_MODIS( site_info, start_date, end_date, outdir, run_parallel = TRUE, ncores = NULL )
site_info |
A dataframe of site info containing the BETYdb site ID, site name, latitude, and longitude, e.g. |
start_date |
Start date to download data |
end_date |
End date to download data |
outdir |
Path to store the outputs |
run_parallel |
optional method to download data parallely. Only works if more than 1 site is needed and there are >1 CPUs available. |
ncores |
number of cpus to use if run_parallel is set to TRUE. If you do not know the number of CPU's available, enter NULL. |
the path for output file The output file will be saved as a CSV file to the outdir. Output column names are "year", "site_id", "lat", "lon", "leafonday","leafoffday","leafon_qa","leafoff_qa"
Qianyu Li
extract_thredds_nc
extract_thredds_nc(site_info, url, varid)extract_thredds_nc(site_info, url, varid)
site_info |
list containing site_id, site_name, lat, lon, time_zone. Derived from BETY using a PEcAn .xml settings file with site information. Can use the get_site_info function to generate this list. |
url |
a THREDDS url of a .nc file to extract data from. |
varid |
character vector of shorthand variable name. i.e. LAI |
a dataframe with the values for each date/site combination from a THREDDS file
Bailey Morrison
## Not run: settings <- PEcAn.settings::read.settings("/path/to/pecan.xml") site_info <- get_site_info(settings) thredds_url = paste0( # breaking up long URL for readability "https://www.ncei.noaa.gov/thredds/dodsC/cdr/lai/files/1995/", "AVHRR-Land_v005_AVH15C1_NOAA-14_19950201_c20180831220722.nc") output <- extract_thredds_nc( site_info = site_info, url = thredds_url, varid = "LAI") ## End(Not run)## Not run: settings <- PEcAn.settings::read.settings("/path/to/pecan.xml") site_info <- get_site_info(settings) thredds_url = paste0( # breaking up long URL for readability "https://www.ncei.noaa.gov/thredds/dodsC/cdr/lai/files/1995/", "AVHRR-Land_v005_AVH15C1_NOAA-14_19950201_c20180831220722.nc") output <- extract_thredds_nc( site_info = site_info, url = thredds_url, varid = "LAI") ## End(Not run)
extract.LandTrendr.AGB
extract.LandTrendr.AGB( site_info, dataset = "median", buffer = NULL, fun = "mean", data_dir = NULL, product_dates = NULL, output_file = NULL, ... )extract.LandTrendr.AGB( site_info, dataset = "median", buffer = NULL, fun = "mean", data_dir = NULL, product_dates = NULL, output_file = NULL, ... )
site_info |
list of site info for parsing AGB data: list(site_id, site_name, lat, lon, time_zone) |
dataset |
Which LandTrendr dataset to parse, "median" or "stdv".Default: "median" |
buffer |
Optional. operate over desired buffer area (not yet implemented) |
fun |
Optional function to apply to buffer area. Default - mean |
data_dir |
directory where input data is located. Can be NUL if con is specified |
product_dates |
Process and extract data only from selected years. Default behavior (product_dates = NULL) is to extract data from all availible years in BETYdb or data_dir |
output_file |
Path to save LandTrendr_AGB_output.RData file containing the output extraction list (see return) |
... |
Additional arguments, currently ignored |
list of two containing the median AGB values per pixel and the corresponding standard deviation values (uncertainties)
Shawn Serbin, Alexey Shiklomanov
## Not run: # Example 1 - using BETYdb site IDs to extract data # Database connection (optional) con <- PEcAn.DB::db.open( list(user='bety', password='bety', host='localhost', dbname='bety', driver='PostgreSQL',write=TRUE)) site_ID <- c(2000000023,1000025731,676,1000005149) # BETYdb site IDs suppressWarnings(site_qry <- glue::glue_sql("SELECT *, ST_X(ST_CENTROID(geometry)) AS lon, ST_Y(ST_CENTROID(geometry)) AS lat FROM sites WHERE id IN ({ids*})", ids = site_ID, .con = con)) suppressWarnings(qry_results <- DBI::dbSendQuery(con,site_qry)) suppressWarnings(qry_results <- DBI::dbFetch(qry_results)) site_info <- list(site_id=qry_results$id, site_name=qry_results$sitename, lat=qry_results$lat, lon=qry_results$lon, time_zone=qry_results$time_zone) data_dir <- "~/scratch/agb_data/" results <- extract.LandTrendr.AGB(site_info, "median", buffer = NULL, fun = "mean", data_dir, product_dates, output_file) ## End(Not run)## Not run: # Example 1 - using BETYdb site IDs to extract data # Database connection (optional) con <- PEcAn.DB::db.open( list(user='bety', password='bety', host='localhost', dbname='bety', driver='PostgreSQL',write=TRUE)) site_ID <- c(2000000023,1000025731,676,1000005149) # BETYdb site IDs suppressWarnings(site_qry <- glue::glue_sql("SELECT *, ST_X(ST_CENTROID(geometry)) AS lon, ST_Y(ST_CENTROID(geometry)) AS lat FROM sites WHERE id IN ({ids*})", ids = site_ID, .con = con)) suppressWarnings(qry_results <- DBI::dbSendQuery(con,site_qry)) suppressWarnings(qry_results <- DBI::dbFetch(qry_results)) site_info <- list(site_id=qry_results$id, site_name=qry_results$sitename, lat=qry_results$lat, lon=qry_results$lon, time_zone=qry_results$time_zone) data_dir <- "~/scratch/agb_data/" results <- extract.LandTrendr.AGB(site_info, "median", buffer = NULL, fun = "mean", data_dir, product_dates, output_file) ## End(Not run)
This function converts trait data from the external TRY database into the tabular format required by the PEcAn meta-analysis module.
format_try_for_ma( try_data, trait_map = try_trait_mapping(), species_map = NULL )format_try_for_ma( try_data, trait_map = try_trait_mapping(), species_map = NULL )
try_data |
A data frame containing data from the TRY database. |
trait_map |
A named character vector for mapping TRY TraitName to PEcAn vname. Names should be TRY TraitName and values should be PEcAn vname. Defaults to 'try_trait_mapping()'. |
species_map |
An optional named vector mapping TRY 'SpeciesName' to PEcAn BETY 'specie_id'. If provided, this is used to assign 'specie_id' instead of using the raw 'AccSpeciesID'. If omitted, the returning data will include a 'species_name' column to help users map PFTs later. |
The resulting data frame is in the format returned by the PEcAn database ('PEcAn.DB::query.traits()'). To be used in 'pecan.ma()', **it must first be run through the 'jagify()' function** to ensure all missing values and columns are appropriately processed, as the meta-analysis model requires data converted into specific distributions and error formats. 'jagify' will drop unused TRY-specific columns and compute the final 'obs.prec' values.
A data frame formatted similarly to BETYdb output to be passed to 'PEcAn.MA::jagify'.
This function provides tool for remote sensing image conversion using GDAL utility.
gdal_conversion( in_path, outfolder = NULL, band_name = NULL, tile_id = NULL, just_band_name = TRUE, target_format = ".tif" )gdal_conversion( in_path, outfolder = NULL, band_name = NULL, tile_id = NULL, just_band_name = TRUE, target_format = ".tif" )
in_path |
character: physical path to the image file. |
outfolder |
character: physical path to the folder where you want to export the converted image. Default is NULL. |
band_name |
character: band name of the image. Default is NULL. |
tile_id |
character/numeric: id for differentiate different converted image tiles. |
just_band_name |
logical: if we just want the band names of the image file. Default is TRUE. |
target_format |
character: target image format. Default is .tif. |
Please note that, this function only supports conversions for one band of one image. If you want to convert multiple images or bands, make sure to loop over these targets. Currently tested H5, NetCDF, HDF4, and GeoTIFF formats. This function should be ready to any GDAL supported image format.
Dongchen Zhang
## Not run: in_path <- "/projectnb/dietzelab/malmborg/CARB/HLS_data/MSLSP_10SDH_2016.nc" outfolder <- "/projectnb/dietzelab/dongchen/anchorSites/NA_runs/MODIS_Phenology" band_name <- "NumCycles" # try grab all available bands from the target file. band_names <- gdal_conversion(in_path = in_path, outfolder = outfolder, band_name = NULL, just_band_name = TRUE) # try convert the first band of the available band names to GeoTIFF file. f <- gdal_conversion(in_path = in_path, outfolder = outfolder, band_name = band_names[1], just_band_name = FALSE, target_format = ".tif") ## End(Not run)## Not run: in_path <- "/projectnb/dietzelab/malmborg/CARB/HLS_data/MSLSP_10SDH_2016.nc" outfolder <- "/projectnb/dietzelab/dongchen/anchorSites/NA_runs/MODIS_Phenology" band_name <- "NumCycles" # try grab all available bands from the target file. band_names <- gdal_conversion(in_path = in_path, outfolder = outfolder, band_name = NULL, just_band_name = TRUE) # try convert the first band of the available band names to GeoTIFF file. f <- gdal_conversion(in_path = in_path, outfolder = outfolder, band_name = band_names[1], just_band_name = FALSE, target_format = ".tif") ## End(Not run)
This function provides tool the gdal_translate execution.
gdal_translate(from, to)gdal_translate(from, to)
from |
character: subdataset name. Generated from the 'get_subdatasets' function. |
to |
character: physical path to the output file. |
Dongchen Zhang
Prepare L4A GEDI above ground biomass (AGB) data for the state data assimilation (SDA) workflow.
GEDI_AGB_prep( site_info, time_points, outdir = file.path(getwd(), "GEDI_AGB"), buffer = 0.005, search_window = "6 month", bbox = NULL, batch = FALSE, prerun = NULL, num.folder = NULL, cores = parallel::detectCores(), credential_path = "~/.netrc" )GEDI_AGB_prep( site_info, time_points, outdir = file.path(getwd(), "GEDI_AGB"), buffer = 0.005, search_window = "6 month", bbox = NULL, batch = FALSE, prerun = NULL, num.folder = NULL, cores = parallel::detectCores(), credential_path = "~/.netrc" )
site_info |
List: A list including site_id, longitude, and latitude. |
time_points |
Character: A vector of date contains target dates (in YYYY-MM-DD). |
outdir |
Character: Directory where the final CSV file will be stored. |
buffer |
Numeric: buffer distance (in degrees) for locate GEDI AGB searching box (default is 0.005 [~ 500 m]). |
search_window |
Character: search window (any length of time. e.g., 6 month) for locate available GEDI AGB values. |
bbox |
Numeric: the vector (in xmin, xmax, ymin, and ymax) that covers all the sites in the site_info object (default is NULL). |
batch |
Boolean: determine if we want to submit jobs to the queue or not (default is FALSE). |
prerun |
Character: series of pre-launch shell command before running the shell job (default is NULL). |
num.folder |
Numeric: the number of batch folders to be created when submitting jobs to the queue. |
cores |
Numeric: numbers of core to be used for the parallel computation. The default is the maximum current CPU number. |
credential_path |
Character: the physical path to the credential file. (.netrc). |
During the first use, users will need to create the '.nasadaacapirc' file in the out folder where the first and second lines are the username and password on the NASA Earth Explore server. If you don't have an account, register at https://urs.earthdata.nasa.gov/users/new.
A data frame containing AGB and sd for each site and each time step.
Dongchen Zhang
## Not run: settings <- PEcAn.settings::read.settings("pecan.xml") site_info <- settings %>% purrr::map(~.x[['run']] ) %>% purrr::map('site')%>% purrr::map(function(site.list){ #conversion from string to number site.list$lat <- as.numeric(site.list$lat) site.list$lon <- as.numeric(site.list$lon) list(site_id=site.list$id, lat=site.list$lat, lon=site.list$lon, site_name=site.list$name) }) %>% dplyr::bind_rows() %>% as.list() time_points <- seq(start.date, end.date, by = time.step) buffer <- 0.005 outdir <- getwd() GEDI_AGB <- GEDI_AGB_prep(site_info, time_points, outdir, buffer) ## End(Not run)## Not run: settings <- PEcAn.settings::read.settings("pecan.xml") site_info <- settings %>% purrr::map(~.x[['run']] ) %>% purrr::map('site')%>% purrr::map(function(site.list){ #conversion from string to number site.list$lat <- as.numeric(site.list$lat) site.list$lon <- as.numeric(site.list$lon) list(site_id=site.list$id, lat=site.list$lat, lon=site.list$lon, site_name=site.list$name) }) %>% dplyr::bind_rows() %>% as.list() time_points <- seq(start.date, end.date, by = time.step) buffer <- 0.005 outdir <- getwd() GEDI_AGB <- GEDI_AGB_prep(site_info, time_points, outdir, buffer) ## End(Not run)
Aggregate AGB mean and uncertainty from the GEDI level4A tiles.
GEDI_L4A_2_mean_var( site_info, which.point.in.which.file, buffer = 0.005, cores = parallel::detectCores() )GEDI_L4A_2_mean_var( site_info, which.point.in.which.file, buffer = 0.005, cores = parallel::detectCores() )
site_info |
List: list of site info including site_id, site_name, lon, and lat. |
which.point.in.which.file |
List: lists containing physical paths of GEDI tiles that intercept the each site. |
buffer |
Numeric: buffer distance (in degree) that is used to create the bounding box (default is 0.005 [~ 500 m]). |
cores |
Numeric: numbers of core to be used for the parallel computation. The default is the maximum current CPU number. |
A list containing AGB mean and standard deviation for each site.
Submit jobs through 'qsub' for the 'GEDI_L4A_2_mean_var' function.
GEDI_L4A_2_mean_var.batch( site_info, outdir, which.point.in.which.file, num.folder, buffer = 0.005, cores = parallel::detectCores(), prerun = NULL )GEDI_L4A_2_mean_var.batch( site_info, outdir, which.point.in.which.file, num.folder, buffer = 0.005, cores = parallel::detectCores(), prerun = NULL )
site_info |
List: list of site info including site_id, site_name, lon, and lat. |
outdir |
Character: the physical path within which the batch job folders will be created. |
which.point.in.which.file |
List: lists containing physical paths of GEDI tiles that intercept the each site. |
num.folder |
Numeric: the number of batch folders to be created. |
buffer |
Numeric: buffer distance (in degree) that is used to create the bounding box (default is 0.005 [~ 500 m]). |
cores |
Numeric: numbers of core to be used for the parallel computation. The default is the maximum current CPU number. |
prerun |
Character: a vector of strings that will be executed beforehand. The default is NULL. |
A list containing AGB mean and standard devieation for each site.
Detect which GEDI level 4A tiles intercept which site.
GEDI_L4A_Finder( files, site_info, buffer = 0.005, cores = parallel::detectCores() )GEDI_L4A_Finder( files, site_info, buffer = 0.005, cores = parallel::detectCores() )
files |
Character: full paths of GEDI level 4A tiles. |
site_info |
List: list of site info including site_id, site_name, lon, and lat. |
buffer |
Numeric: buffer distance (in degree) that is used to create the bounding box (default is 0.005 [~ 500 m]). |
cores |
Numeric: numbers of core to be used for the parallel computation. The default is the maximum current CPU number. |
A list containing physical paths of GEDI tiles that intercept the each site.
Submit jobs through 'qsub' for the 'GEDI_L4A_Finder' function.
GEDI_L4A_Finder_batch( files, outdir, site_info, num.folder, buffer = 0.005, cores = parallel::detectCores(), prerun = NULL )GEDI_L4A_Finder_batch( files, outdir, site_info, num.folder, buffer = 0.005, cores = parallel::detectCores(), prerun = NULL )
files |
Character: full paths of GEDI level 4A tiles. |
outdir |
Character: the physical path within which the batch job folders will be created. |
site_info |
List: list of site info including site_id, site_name, lon, and lat. |
num.folder |
Numeric: the number of batch folders to be created. |
buffer |
Numeric: buffer distance (in degree) that is used to create the bounding box (default is 0.005 [~ 500 m]). |
cores |
Numeric: numbers of core to be used for the parallel computation. The default is the maximum current CPU number. |
prerun |
Character: a vector of strings that will be executed beforehand. The default is NULL. |
A list containing physical paths of GEDI tiles that intercept the each site.
get_site_info
get_site_info(settings)get_site_info(settings)
settings |
a PEcAn settings object |
a list of site information derived from BETY using a pecan .xml settings file with site_id, site_name, lat, lon, and time_zone.
Bailey Morrison
## Not run: settings <- PEcAn.settings::read.settings("/path/to/pecan.xml") site_info <- get_site_info(settings) ## End(Not run)## Not run: settings <- PEcAn.settings::read.settings("/path/to/pecan.xml") site_info <- get_site_info(settings) ## End(Not run)
This function provides tool for reading band names of remote sensing image.
get_subdatasets(in_path)get_subdatasets(in_path)
in_path |
character: physical path to the image file. |
Dongchen Zhang
Set NASA DAAC credentials to the .netrc file.
getnetrc(dl_path)getnetrc(dl_path)
dl_path |
Character: physical path to the .netrc credential file. |
Dongchen Zhang
Prepare Landtrendr AGB data for the SDA workflow.
Landtrendr_AGB_prep( site_info, start_date, end_date, time_points, AGB_indir, outdir = NULL, export_csv = TRUE, allow_download = FALSE, buffer = NULL, skip_buffer = TRUE )Landtrendr_AGB_prep( site_info, start_date, end_date, time_points, AGB_indir, outdir = NULL, export_csv = TRUE, allow_download = FALSE, buffer = NULL, skip_buffer = TRUE )
site_info |
Bety list of site info including site_id, site_name, lon, and lat. |
start_date |
Start date of SDA workflow. |
end_date |
End date of SDA workflow. |
time_points |
A vector contains each time point within the start and end date. |
AGB_indir |
Where the Landtrendr AGB data can be accessed. |
outdir |
Where the final CSV file will be stored. |
export_csv |
Decide if we want to export the CSV file. |
allow_download |
If data is missing, should we download the missing data? |
buffer |
buffer area to calculate the min var of AGB data. |
skip_buffer |
flag to skip calculating min var based on buffer area. |
A data frame containing AGB median and sd for each site and each time step.
Dongchen Zhang
Merge image tiles to a single image (currently support hdf and tif image format).
merge_image_tiles( in.path, out.path = NULL, band.name = NULL, just.band.name = TRUE, keep.files = FALSE, skip.conversion = FALSE, image.settings = list(crs = "EPSG:4326", dimension = NULL, ext = NULL, fun = NULL), computation = list(GDAL_CACHEMAX = 1000, wm = "80%", NUM_THREADS = parallel::detectCores() - 1, COMPRESS = "DEFLATE") )merge_image_tiles( in.path, out.path = NULL, band.name = NULL, just.band.name = TRUE, keep.files = FALSE, skip.conversion = FALSE, image.settings = list(crs = "EPSG:4326", dimension = NULL, ext = NULL, fun = NULL), computation = list(GDAL_CACHEMAX = 1000, wm = "80%", NUM_THREADS = parallel::detectCores() - 1, COMPRESS = "DEFLATE") )
in.path |
character: physical path to the folder that contains all the original image tiles. |
out.path |
character: physical path to the folder that contains converted and merged images. |
band.name |
character: band name of the image. Default is NULL. |
just.band.name |
logical: if we just want the band names of the image file. Default is TRUE. |
keep.files |
logical: if we want to keep the image tiles at the end. |
skip.conversion |
logical: if we want to ignore the image conversion. Note that this is a experimental feature, which only works when images are all in the GeoTIFF format. |
image.settings |
list: settings used during exporting merged image. Such as image coordinate system (crs), dimension, extents (ext), and average function (fun). |
computation |
list: settings used for configuring computation. Such as maximum memory per CPU (GDAL_CACHEMAX), percentage of total memory (wm), number of CPUs (NUM_THREADS), compress method (COMPRESS). |
Please make sure all image tiles are stored in the 'folder.path'. Please refer to the gdalwarp manual for more details https://gdal.org/en/stable/programs/gdalwarp.html
character: file path to the merged GeoTIFF file.
Dongchen Zhang
Prepare MODIS LAI data for the SDA workflow.
MODIS_LAI_prep( site_info, time_points, outdir = NULL, search_window = 30, export_csv = FALSE, sd_threshold = 20, skip_download = FALSE, boundary = NULL )MODIS_LAI_prep( site_info, time_points, outdir = NULL, search_window = 30, export_csv = FALSE, sd_threshold = 20, skip_download = FALSE, boundary = NULL )
site_info |
list: Bety list of site info including site_id, lon, and lat. |
time_points |
character: a vector contains each time point within the start and end date. |
outdir |
character: where the final CSV file will be stored. |
search_window |
numeric: search window for locate available LAI values. |
export_csv |
boolean: decide if we want to export the CSV file. |
sd_threshold |
numeric or character: for filtering out any estimations with unrealistic high standard error, default is 20. The QC check will be skipped if it's set as NULL. |
skip_download |
boolean: determine if we want to use existing LAI.csv file and skip the MODIS LAI download part. |
boundary |
numeric vector or list: the upper and lower quantiles for filtering out noisy LAI values (e.g., c(0.05, 0.95) or list(0.05, 0.95)). The default is NULL. |
A data frame containing LAI and sd for each site and each time step.
Dongchen Zhang
Prepare MODIS LAI data from the NASA DAAC server for the SDA workflow.
MODIS_LAI_ts_filter(lai.csv, boundary = c(0.05, 0.95))MODIS_LAI_ts_filter(lai.csv, boundary = c(0.05, 0.95))
lai.csv |
data frame: A data frame containing date, site id, lat, lon, lai, sd, and qc columns. |
boundary |
numeric: A vector contains the upper and lower quantiles for filtering lai records. The default is c(0.05, 0.95). |
A data frame containing date, site id, lat, lon, lai, sd, and qc columns.
Dongchen Zhang
Prepare MODIS land cover data for the SDA workflow.
MODIS_LC_prep( site_info, time_points, outdir = NULL, qc.filter = c("000", "001") )MODIS_LC_prep( site_info, time_points, outdir = NULL, qc.filter = c("000", "001") )
site_info |
Bety list of site info including site_id, lon, and lat. |
time_points |
A vector contains each time point within the start and end date. |
outdir |
Where the final CSV file will be stored. |
qc.filter |
values that will pass the QC check. the check will be skipped if it's NULL. |
This function enables the feature of grabbing pre-extracted MODIS LC CSV files such that any site that has records will be skipped (See Line 33). In more detail, we will be loading the previous 'LC.csv' file, which contains previous extracted land cover records and trying to match that with current requests (location, time). Any requests that fail the match will be regarded as new extractions and combine with the previous 'LC.csv' file.
A data frame containing MODIS land cover types for each site and each time step.
Dongchen Zhang
Create URL that can be used to request data from NASA DAAC server.
NASA_CMR_finder(doi)NASA_CMR_finder(doi)
doi |
Character: data DOI on the NASA DAAC server, it can be obtained directly from the NASA ORNL DAAC data portal (e.g., GEDI L4A through https://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=2056). |
A list with each containing corresponding provider and concept ids given the data doi.
Dongchen Zhang
## Not run: provider_conceptID <- NASA_CMR_finder("10.3334/ORNLDAAC/2183") ## End(Not run)## Not run: provider_conceptID <- NASA_CMR_finder("10.3334/ORNLDAAC/2183") ## End(Not run)
Parallel download data from the NASA ORNL DAAC server given period, spatial bounding box, and data DOI.
NASA_DAAC_download( ul_lat, ul_lon, lr_lat, lr_lon, ncore = 1, from, to, outdir = getwd(), band = NULL, data_version = NULL, credential_path = NULL, doi, just_path = FALSE )NASA_DAAC_download( ul_lat, ul_lon, lr_lat, lr_lon, ncore = 1, from, to, outdir = getwd(), band = NULL, data_version = NULL, credential_path = NULL, doi, just_path = FALSE )
ul_lat |
Numeric: upper left latitude. |
ul_lon |
Numeric: upper left longitude. |
lr_lat |
Numeric: lower right latitude. |
lr_lon |
Numeric: lower right longitude. |
ncore |
Numeric: numbers of core to be used if the maximum core |
from |
Character: date from which the data search starts. In the form "yyyy-mm-dd". |
to |
Character: date on which the data search end. In the form "yyyy-mm-dd". |
outdir |
Character: path of the directory in which to save the downloaded files. Default is the current work directory(getwd()). |
band |
Character: the band name (or vector of band names) of data to be requested. Default is NULL. |
data_version |
Character: the version (typically starts with V) of data to be requested. Default is NULL. |
credential_path |
Character: physical path to the credential file (.netrc file). The default NULL. |
doi |
Character: data DOI on the NASA DAAC server, it can be obtained directly from the NASA ORNL DAAC data portal (e.g., GEDI L4A through https://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=2056). |
just_path |
Boolean: if we just want the metadata and URL or proceed the actual download. |
Physical paths of downloaded files (just_path = T) or URLs of the files (just_path = F).
Dongchen Zhang
## Not run: # SHIFT Hyper-spectral data. ul_lat <- 35 ul_lon <- -121 lr_lat <- 33 lr_lon <- -117 from <- "2022-02-23" to <- "2022-05-30" doi <- "10.3334/ORNLDAAC/2183" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # GEDI level 4A data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2020-01-01" to <- "2020-12-31" doi <- "10.3334/ORNLDAAC/2056" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, data_version = "V2_1", doi = doi, just_path = T) # MODIS LAI data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2020-01-01" to <- "2020-01-31" doi <- "10.5067/MODIS/MCD15A3H.061" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # SMAP Soil Moisture data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2020-01-01" to <- "2020-01-31" doi <- "10.5067/02LGW4DGJYRX" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # GLANCE Phenology and LC data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2019-01-01" to <- "2019-12-31" doi <- "10.5067/MEaSUREs/GLanCE/GLanCE30.001" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # HLS reflectance data. ul_lat <- 35 ul_lon <- -121 lr_lat <- 33 lr_lon <- -117 from <- "2022-02-23" to <- "2022-05-30" doi <- "10.5067/HLS/HLSS30.002" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) ul_lat <- 35 # HLS Phenology data. ul_lon <- -121 lr_lat <- 33 lr_lon <- -117 from <- "2019-01-01" to <- "2019-12-31" doi <- "10.5067/Community/MuSLI/MSLSP30NA.011" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) ## End(Not run)## Not run: # SHIFT Hyper-spectral data. ul_lat <- 35 ul_lon <- -121 lr_lat <- 33 lr_lon <- -117 from <- "2022-02-23" to <- "2022-05-30" doi <- "10.3334/ORNLDAAC/2183" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # GEDI level 4A data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2020-01-01" to <- "2020-12-31" doi <- "10.3334/ORNLDAAC/2056" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, data_version = "V2_1", doi = doi, just_path = T) # MODIS LAI data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2020-01-01" to <- "2020-01-31" doi <- "10.5067/MODIS/MCD15A3H.061" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # SMAP Soil Moisture data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2020-01-01" to <- "2020-01-31" doi <- "10.5067/02LGW4DGJYRX" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # GLANCE Phenology and LC data. ul_lat <- 85 ul_lon <- -179 lr_lat <- 7 lr_lon <- -20 from <- "2019-01-01" to <- "2019-12-31" doi <- "10.5067/MEaSUREs/GLanCE/GLanCE30.001" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) # HLS reflectance data. ul_lat <- 35 ul_lon <- -121 lr_lat <- 33 lr_lon <- -117 from <- "2022-02-23" to <- "2022-05-30" doi <- "10.5067/HLS/HLSS30.002" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) ul_lat <- 35 # HLS Phenology data. ul_lon <- -121 lr_lat <- 33 lr_lon <- -117 from <- "2019-01-01" to <- "2019-12-31" doi <- "10.5067/Community/MuSLI/MSLSP30NA.011" paths <- NASA_DAAC_download(ul_lat = ul_lat, ul_lon = ul_lon, lr_lat = lr_lat, lr_lon = lr_lon, from = from, to = to, doi = doi, just_path = T) ## End(Not run)
Create URL that can be used to request data from NASA DAAC server.
NASA_DAAC_URL( base_url = "https://cmr.earthdata.nasa.gov/search/granules.json?pretty=true", provider, page_size = 2000, page = 1, concept_id, bbox, daterange = NULL )NASA_DAAC_URL( base_url = "https://cmr.earthdata.nasa.gov/search/granules.json?pretty=true", provider, page_size = 2000, page = 1, concept_id, bbox, daterange = NULL )
base_url |
Character: base URL for the CMR search. default is "https://cmr.earthdata.nasa.gov/search/granules.json?pretty=true". |
provider |
Character: ID of data provider from NASA DAAC. See 'NASA_CMR_finder' for more details. |
page_size |
Numeric: maximum requested length, default is 2000. |
page |
Numeric: which page of the URL, default is 1. |
concept_id |
Character: CMR Concept ID. See 'NASA_CMR_finder' for more details. |
bbox |
Numeric: vector of bounding box coordinates. |
daterange |
Character: vectors of the requested start and end dates. In the form "yyyy-mm-dd". |
A character of URL that can be used to request data.
Dongchen Zhang
## Not run: provider <- "ORNL_CLOUD" concept_id <- "C2770099044-ORNL_CLOUD" bbox <- "-121,33,-117,35" daterange <- c("2022-02-23", "2022-05-30") URL <- NASA_DAAC_URL(provider = provider, concept_id = concept_id, bbox = bbox, daterange = daterange) ## End(Not run)## Not run: provider <- "ORNL_CLOUD" concept_id <- "C2770099044-ORNL_CLOUD" bbox <- "-121,33,-117,35" daterange <- c("2022-02-23", "2022-05-30") URL <- NASA_DAAC_URL(provider = provider, concept_id = concept_id, bbox = bbox, daterange = daterange) ## End(Not run)
Extract ensemble above ground biomass density from pre-existing GeoTIFF files for the SDA workflow. Note that, this function only works for those products who have both mean and uncertainty GeoTIFF images prepared. And it works under the 2010 Global AGB products: DOI: https://doi.org/10.3334/ORNLDAAC/1763.
Prep_AGB_IC_from_2010_global(site_info, paths.list, ens)Prep_AGB_IC_from_2010_global(site_info, paths.list, ens)
site_info |
Bety list of site info including site_id, lon, and lat. |
paths.list |
list containing file paths for 'mean' and 'uncertainty' datasets. |
ens |
ensemble number. |
A data frame containing sampled above ground biomass densities, each column represent each site.
Dongchen Zhang
Prepare MODIS LAI data from the NASA DAAC server for the SDA workflow.
Prep.MODIS.CSV.from.DAAC( site_info, extent, from, to, download.outdir, csv.outdir, credential_path )Prep.MODIS.CSV.from.DAAC( site_info, extent, from, to, download.outdir, csv.outdir, credential_path )
site_info |
list: Bety list of site info including site_id, lon, and lat. |
extent |
numeric: A vector contains the bounding box that covers all sites (West longitude, East longitude, South latitude ,North latitude). |
from |
character: the start time for searching the MODIS products. |
to |
character: the end time for searching the MODIS products. |
download.outdir |
character: Where the MODIS tiles will be stored. |
csv.outdir |
character: Where the final CSV file will be stored. |
credential_path |
Character: physical path to the credential file (.netrc file). |
A data frame containing LAI and sd for each site and each time step.
Dongchen Zhang
Prepare SMAP soil moisture profile (SMP) data from the NASA DAAC server for the SDA workflow. The CSV file that works for the 'SMAP_SMP_prep' function will be exported.
Prep.SMAP.CSV.from.DAAC( site_info, extent, from, to, download.outdir, csv.outdir, credential_path )Prep.SMAP.CSV.from.DAAC( site_info, extent, from, to, download.outdir, csv.outdir, credential_path )
site_info |
list: Bety list of site info including site_id, lon, and lat. |
extent |
numeric: A vector contains the bounding box that covers all sites (West longitude, East longitude, South latitude ,North latitude). |
from |
character: the start time for searching the MODIS products. |
to |
character: the end time for searching the MODIS products. |
download.outdir |
character: Where the MODIS tiles will be stored. |
csv.outdir |
character: Where the final CSV file will be stored. |
credential_path |
Character: physical path to the credential file (.netrc file). |
A data frame containing SMP and sd for each site and each time step.
Dongchen Zhang
read remote module registration files
read_remote_registry(source, collection)read_remote_registry(source, collection)
source |
remote source, e.g gee or appeears |
collection |
collection or product name |
list containing original_name, pecan_name, scale, qc, projection raw_mimetype, raw_formatname pro_mimetype, pro_formatname, coordtype
Istem Fer
## Not run: read_remote_registry( "gee", "COPERNICUS/S2_SR") ## End(Not run)## Not run: read_remote_registry( "gee", "COPERNICUS/S2_SR") ## End(Not run)
Regrid dataset to even grid
regrid(latlon.data)regrid(latlon.data)
latlon.data |
dataframe with lat, lon, and some value to be regridded |
dataframe with regridded data
David LeBauer
call rp_control (from RpTools Python package) and store the output in BETY
remote_process(settings)remote_process(settings)
settings |
PEcAn settings list containing remotedata tags: source, collection, scale, projection, qc, algorithm, credfile, out_get_data, out_process_data, overwrite |
Ayush Prasad, Istem Fer
## Not run: remote_process(settings) ## End(Not run)## Not run: remote_process(settings) ## End(Not run)
check the status of the requested data in the DB
remotedata_db_check( raw_file_name, pro_file_name, start, end, siteid, siteid_short, out_get_data, algorithm, out_process_data, overwrite, dbcon )remotedata_db_check( raw_file_name, pro_file_name, start, end, siteid, siteid_short, out_get_data, algorithm, out_process_data, overwrite, dbcon )
raw_file_name |
raw_file_name |
pro_file_name |
pro_file_name |
start |
start date requested by user |
end |
end date requested by the user |
siteid |
siteid of the site |
siteid_short |
short form of the siteid |
out_get_data |
out_get_data |
algorithm |
algorithm |
out_process_data |
out_process_data |
overwrite |
overwrite |
dbcon |
BETYdb con |
list containing remotefile_check_flag, start, end, stage_get_data, write_raw_start, write_raw_end, raw_merge, existing_raw_file_path, stage_process_data, write_pro_start, write_pro_end, pro_merge, input_file, existing_pro_file_path, raw_check, pro_check
Ayush Prasad
## Not run: dbstatus <- remotedata_db_check( raw_file_name, pro_file_name, start, end, siteid, siteid_short, out_get_data, algorithm, out_process_data, overwrite, dbcon) ## End(Not run)## Not run: dbstatus <- remotedata_db_check( raw_file_name, pro_file_name, start, end, siteid, siteid_short, out_get_data, algorithm, out_process_data, overwrite, dbcon) ## End(Not run)
Insert the output data returned from rp_control into BETYdb
remotedata_db_insert( output, remotefile_check_flag, siteid, out_get_data, out_process_data, write_raw_start, write_raw_end, write_pro_start, write_pro_end, raw_check, pro_check, raw_mimetype, raw_formatname, pro_mimetype, pro_formatname, dbcon )remotedata_db_insert( output, remotefile_check_flag, siteid, out_get_data, out_process_data, write_raw_start, write_raw_end, write_pro_start, write_pro_end, raw_check, pro_check, raw_mimetype, raw_formatname, pro_mimetype, pro_formatname, dbcon )
output |
output list from rp_control |
remotefile_check_flag |
remotefile_check_flag |
siteid |
siteid |
out_get_data |
out_get_data |
out_process_data |
out_process_data |
write_raw_start |
write_raw_start, start date of the raw file |
write_raw_end |
write_raw_end, end date of the raw file |
write_pro_start |
write_pro_start |
write_pro_end |
write_pro_end |
raw_check |
id, site_id, name, start_date, end_date, of the existing raw file from inputs table and file_path from dbfiles tables |
pro_check |
pro_check id, site_id, name, start_date, end_date, of the existing processed file from inputs table and file_path from dbfiles tables |
raw_mimetype |
raw_mimetype |
raw_formatname |
raw_formatname |
pro_mimetype |
pro_mimetype |
pro_formatname |
pro_formatname |
dbcon |
BETYdb con |
list containing raw_id, raw_path, pro_id, pro_path
Ayush Prasad
## Not run: db_out <- remotedata_db_insert( output, remotefile_check_flag, siteid, out_get_data, out_process_data, write_raw_start, write_raw_end, write_pro_start, write_pro_end, raw_check, pro_check, raw_mimetype, raw_formatname, pro_mimetype, pro_formatname, dbcon) ## End(Not run)## Not run: db_out <- remotedata_db_insert( output, remotefile_check_flag, siteid, out_get_data, out_process_data, write_raw_start, write_raw_end, write_pro_start, write_pro_end, raw_check, pro_check, raw_mimetype, raw_formatname, pro_mimetype, pro_formatname, dbcon) ## End(Not run)
set dates, stage and merge status for remote data download
set_stage(result, req_start, req_end, stage)set_stage(result, req_start, req_end, stage)
result |
dataframe containing id, site_id, name, start_date, end_date from inputs table and file_path from dbfiles table |
req_start |
start date requested by the user |
req_end |
end date requested by the user |
stage |
the stage which needs to be set, get_remote_data or process_remote_data |
list containing req_start, req_end, stage, merge, write_start, write_end
Ayush Prasad
## Not run: raw_check <- set_stage( result, req_start, req_end, get_remote_data) ## End(Not run)## Not run: raw_check <- set_stage( result, req_start, req_end, get_remote_data) ## End(Not run)
Prepare SMAP Soil Moisture (SMP) data for the SDA workflow.
SMAP_SMP_prep( site_info, start_date, end_date, time_points, outdir, search_window = 30, export_csv = TRUE, update_csv = FALSE )SMAP_SMP_prep( site_info, start_date, end_date, time_points, outdir, search_window = 30, export_csv = TRUE, update_csv = FALSE )
site_info |
Bety list of site info including site_id, lon, and lat. |
start_date |
Start date of SDA workflow. |
end_date |
End date of SDA workflow. |
time_points |
A vector contains each time point within the start and end date. |
outdir |
Where the final CSV file, and the CSV file from GEE are stored. |
search_window |
search window for locate available SMP values. |
export_csv |
Decide if we want to export the CSV file. |
update_csv |
Decide if we want to update current CSV file given an updated SMAP_gee.csv file |
A data frame containing SMAP smp and sd for each site and each time step.
Dongchen Zhang
Create a predefined trait mapping from TRY to PEcAn
try_trait_mapping()try_trait_mapping()
A named character vector where names are TRY trait names and values are PEcAn variable names.