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
Create Landtrender.AGB.Model [Work In Progress] #3282
base: develop
Are you sure you want to change the base?
Conversation
Creation of Landtrender.AGB.Model - Help still needed with checking system for old csv files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current code has a good way to go still. I'd recommend getting an example site_info from Dongchen (e.g. the 39 NEON CONUS sites) and work through the steps of grabbing data for different sites than the ones the tutorial you were using are built around. I think that will help move things towards the function we are looking for and help generalize the things that were specific to the tutorial.
title: "GEDI4R Code" | ||
author: "Tami Gordon" | ||
date: "2024-03-18" | ||
output: html_document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File should be named GEDI_AGB_prep.R (and function should be GEDI_AGB_prep) and should be in the modules/data.remote/R/ folder. Also, since it's a R file you need to remove the Rmarkdown formatting, such as this header and all the ```{r} code chunk seperators
#'Suggests: rmarkdown, knitr, testthat (>= 3.0.0) | ||
#' @export | ||
#' | ||
#' @examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you don't have an example, you don't need an @examples section
devtools::install_github("VangiElia/GEDI4R") | ||
#loading GEDI4R package | ||
library(GEDI4R) | ||
library(magrittr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for during development, but library calls don't go inside R functions when they're within R packages. Instead they get added to that package's DESCRIPTION file (in this case modules/data.remote/DESCRIPTION)
## Setting Parameters | ||
country = 'ITA' | ||
start_date = "2020-01-01" | ||
end_date = "2020-01-31" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things that are examples of inputs to the function should go in the @examples
end_date = "2020-01-31" | ||
|
||
## Specific Sites you want to focus on | ||
focus_sites = c("GEDI04_A_2020036151358_O06515_02_T00198_02_002_01_V002.zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- not clear how someone would figure out what zip files they'd need for a different set of sites
- for this to work in our workflow, figuring out filenames is something that would need to be automated, not something the user would have to input
#with extension | ||
clipped <- l4_clip(l4_data,clip=bound,usegeometry = F) | ||
#with polygon boundaries | ||
clipped2 <- l4_clip(l4_data,clip=bound,usegeometry = T) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely don't need this bit on using a shapefile to clip -- seems leftover from the tutorial
## l4_convert, which can also reproject the data to a user-defined coordinate reference system | ||
converted <- l4_convert(l4_data,epsg = 4326, filename=paste0(outdir,"/example.shp"),return_path = T) | ||
example <- sf::read_sf(converted) | ||
file.remove(list.files(outdir,pattern = "example",full.names = T)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to reproject the GEDI data? If so, we should be doing that before extracting site data to ensure things are aligned correctly.
|
||
|
||
## Save file as csv | ||
write.csv(gediL4, "gediL4_output.csv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This data doesn't seem to be organized in the way that our downstream data assimilation code is looking for.
## Plotting Data | ||
|
||
#footprints locations and AGBD distribution against elevation | ||
l4_plotagb(gedil4,type="distribution") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
download function shouldn't be making plots
|
||
```{r} | ||
## Check for old CSV and create new CSV | ||
outdir = "/Users/tamigordon/Desktop/rGEDI/data files" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outdir shouldn't be hard coded, it should be a function input
Creation of Landtrender.AGB.Model - Help still needed with checking system for old csv files
Description
Motivation and Context
Review Time Estimate
Types of changes
Checklist: