Skip to content

Instantly share code, notes, and snippets.

@sverhoeven
Last active January 19, 2023 10:32
Show Gist options
  • Save sverhoeven/e8b6c8ef4d025540b63f812fb9580c49 to your computer and use it in GitHub Desktop.
Save sverhoeven/e8b6c8ef4d025540b63f812fb9580c49 to your computer and use it in GitHub Desktop.

Phenocam

https://phenocam.nau.edu/

Using API might need login.

Install

# Dependencies from supplemental_code/3_Figures/PS3_figures.Rmd
install.packages("phenocamr")
devtools::install_github('bnasr/phenocamapi')

Example

From pheno-synthesis-software-suite/supplemental_code/3_Figures/PS3_figures.Rmd

library(phenocamapi) #pull phenocam metadata
library(phenocamr) #pull pre-processed phenocam data
library(dplyr) 

Pulling a list of PhenoCam sites:

phenos=get_phenos()
colnames(phenos)
rois=get_rois()

Filter for sites used in this paper and remove non-vegetated ROIs:

site_names=c('ibp', 'jernort', 'NEON.D14.JORN.DP1.00042')
jer=phenos%>%
filter(is.element(phenos$site,site_names))

jer_full_list= rois%>%
  filter(is.element(rois$site,site_names))%>%
  filter(!roitype=='NV')%>% #remove 'No Vegetation' NV ROIs 
  filter(!sequence_number==1001) #remove defunct ROI

Use the phenocamr package to download timeseries data:

data_dir='/home/stefanv/git/springtime/ps3/ps3-phenocam-tryout'
n=nrow(jer_full_list)
for(i in seq(1, n, by = 1)){
  phenocamr::download_phenocam(
  frequency = 3,
  veg_type = jer_full_list$primary_veg_type[i],
  roi_id = 1000,
  site = jer_full_list$site[i],
  phenophase = FALSE,
  out_dir = data_dir
  )
}

PS3 redo

https://git.earthdata.nasa.gov/projects/APIS/repos/pheno-synthesis-software-suite/browse

Install R with https://cran.r-project.org/bin/linux/ubuntu/

OS Deps

sudo apt install libssl-dev libfontconfig1-dev libcurl4-openssl-dev  libxml2-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev libproj-dev libgdal-dev libudunits2-dev
# or r-cran-devtools

# Required for tidyverse installation, see https://skeptric.com/tidyverse-timedatectl-wsl2/
export TZ="Europe/Amsterdam"

Repos

git clone https://git.earthdata.nasa.gov/scm/apis/pheno-synthesis-software-suite.git 
git clone https://git.earthdata.nasa.gov/scm/apis/dacqre.git

In R

install.packages("devtools")
library('devtools') 
devtools::install_github(c("usa-npn/AppEEARS4R"))
install.packages("tidyverse")
devtools::install_gitlab("apis-staging/greenwave")
install.packages("rnpn")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment