Skip to content
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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

tamigord
Copy link

@tamigord tamigord commented Apr 2, 2024

Creation of Landtrender.AGB.Model - Help still needed with checking system for old csv files

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 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.

Creation of Landtrender.AGB.Model - Help still needed with checking system for old csv files
@github-actions github-actions bot added the Tests label Apr 2, 2024
Copy link
Member

@mdietze mdietze left a 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
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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"
Copy link
Member

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",
Copy link
Member

Choose a reason for hiding this comment

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

  1. not clear how someone would figure out what zip files they'd need for a different set of sites
  2. 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)
Copy link
Member

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))
Copy link
Member

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")
Copy link
Member

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")
Copy link
Member

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"
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants