Contact information

address: ORCID

Packages installed:

Script to download NEON data

Instalation instructions

Activate packages and set global options

# load packages
library(neonUtilities)
library(geoNEON)
library(raster)
## Loading required package: sp
library(rhdf5)
# Set global option to NOT convert all character variables to factors
options(stringsAsFactors=F)

put together files with stack

Put the downloaded zip file in the working directory.

If the folder is un-zipped, use the folder name without the .zip extension.

stackByTable(filepath="NEON_par.zip")
## Unpacking zip files
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |=================================================================| 100%
## Stacking table PARPAR_1min
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |====                                                             |   6%
  |                                                                       
  |=======                                                          |  11%
  |                                                                       
  |===========                                                      |  17%
  |                                                                       
  |==============                                                   |  22%
  |                                                                       
  |==================                                               |  28%
  |                                                                       
  |======================                                           |  33%
  |                                                                       
  |=========================                                        |  39%
  |                                                                       
  |=============================                                    |  44%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |====================================                             |  56%
  |                                                                       
  |========================================                         |  61%
  |                                                                       
  |===========================================                      |  67%
  |                                                                       
  |===============================================                  |  72%
  |                                                                       
  |===================================================              |  78%
  |                                                                       
  |======================================================           |  83%
  |                                                                       
  |==========================================================       |  89%
  |                                                                       
  |=============================================================    |  94%
  |                                                                       
  |=================================================================| 100%
## Stacking table PARPAR_30min
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |====                                                             |   6%
  |                                                                       
  |==============                                                   |  22%
  |                                                                       
  |======================                                           |  33%
  |                                                                       
  |=============================                                    |  44%
  |                                                                       
  |====================================                             |  56%
  |                                                                       
  |===========================================                      |  67%
  |                                                                       
  |===================================================              |  78%
  |                                                                       
  |==========================================================       |  89%
  |                                                                       
  |=================================================================| 100%
## Finished: All of the data are stacked into 2 tables!
## Copied the first available variable definition file to /stackedFiles and renamed as variables.csv
## Stacked PARPAR_1min which has 803520 out of the expected 803520 rows (100%).
## Stacked PARPAR_30min which has 26784 out of the expected 26784 rows (100%).
## Stacking took 29.58059 secs
## All unzipped monthly data folders have been removed.

download data via API

Need the DataProduct ID the API does not need token authentication.

# woody plant vegetation structure
zipsByProduct(dpID = "DP1.10098.001", site = "WREF", startdate = "2012-01", enddate = "2019-09", check.size = F)
## Warning in dir.create(filepath): '/Users/dsfernandez/Documents/R/NEON/
## filesToStack10098' already exists
## Downloading 2 files
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## 2 files downloaded to /Users/dsfernandez/Documents/R/NEON/filesToStack10098
# stack the zip
stackByTable("filesToStack10098", folder = T)
## Unpacking zip files
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |======================                                           |  33%
## Warning in utils::unzip(p, exdir = substr(o, 1, nchar(o) - 4), overwrite =
## T): error 1 in extracting from zip file
## Warning in file.remove(p): cannot remove file 'filesToStack10098/
## stackedFiles', reason 'Directory not empty'
## 
  |                                                                       
  |=================================================================| 100%
## Stacking table vst_apparentindividual
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## Stacking table vst_mappingandtagging
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## Stacking table vst_perplotperyear
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## Finished: All of the data are stacked into 3 tables!
## Copied the first available variable definition file to /stackedFiles and renamed as variables.csv
## Copied the first available validation file to /stackedFiles and renamed as validation.csv
## Stacked vst_apparentindividual which has 2431 out of the expected 2431 rows (100%).
## Stacked vst_mappingandtagging which has 2263 out of the expected 2263 rows (100%).
## Stacked vst_perplotperyear which has 20 out of the expected 20 rows (100%).
## Stacking took 0.147789 secs
## All unzipped monthly data folders have been removed.

Using R project

create object veg (a list) with the files

veg <- loadByProduct(dpID = "DP1.10098.001", site = "WREF", startdate = "2012-01", enddate = "2019-09", check.size = F)
## Downloading 2 files
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## 
## Unpacking zip files
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## Stacking table vst_apparentindividual
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## Stacking table vst_mappingandtagging
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## Stacking table vst_perplotperyear
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================================================| 100%
## Finished: All of the data are stacked into 3 tables!
## Copied the first available variable definition file to /stackedFiles and renamed as variables.csv
## Copied the first available validation file to /stackedFiles and renamed as validation.csv
## Stacked vst_apparentindividual which has 2431 out of the expected 2431 rows (100%).
## Stacked vst_mappingandtagging which has 2263 out of the expected 2263 rows (100%).
## Stacked vst_perplotperyear which has 20 out of the expected 20 rows (100%).
## Stacking took 0.1308298 secs
## All unzipped monthly data folders have been removed.
mapping <- veg$vst_mappingandtagging
View(mapping)
## Warning in system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE):
## running command ''/usr/bin/otool' -L '/Library/Frameworks/R.framework/
## Resources/modules/R_de.so'' had status 1

remote sensing data

No function to download data directly to R, could be an overload. Use selected tiles to download.

# savepath default is the current directory
byTileAOP(dpID = "DP3.30015.001", site = "WREF", year = "2017", easting=580000, northing=5075000, check.size = F)
## Downloading 6 files
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |=============                                                    |  20%
  |                                                                       
  |==========================                                       |  40%
  |                                                                       
  |=======================================                          |  60%
  |                                                                       
  |====================================================             |  80%
  |                                                                       
  |=================================================================| 100%
## Successfully downloaded  6  files.
## NEON_D16_WREF_DP3_580000_5075000_CHM.tif downloaded to /Users/dsfernandez/Documents/R/NEON/DP3.30015.001/2017/FullSite/D16/2017_WREF_1/L3/DiscreteLidar/CanopyHeightModelGtif
## NEON_D16_WREF_DP1_580000_5075000_classified_point_cloud.prj downloaded to /Users/dsfernandez/Documents/R/NEON/DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/shps
## NEON_D16_WREF_DP1_580000_5075000_classified_point_cloud.shx downloaded to /Users/dsfernandez/Documents/R/NEON/DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/shps
## NEON_D16_WREF_DP1_580000_5075000_classified_point_cloud.kml downloaded to /Users/dsfernandez/Documents/R/NEON/DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/kmls
## NEON_D16_WREF_DP1_580000_5075000_classified_point_cloud.shp downloaded to /Users/dsfernandez/Documents/R/NEON/DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/shps
## NEON_D16_WREF_DP1_580000_5075000_classified_point_cloud.dbf downloaded to /Users/dsfernandez/Documents/R/NEON/DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/shps
# to get all data for a site and year
## byFileAOP(dpID = "DP3.30015.001", site = "WREF", year = "2017") #very big 1GB
chm <- raster("DP3.30015.001/2017/FullSite/D16/2017_WREF_1/L3/DiscreteLidar/CanopyHeightModelGtif/NEON_D16_WREF_DP3_580000_5075000_CHM.tif")
plot(chm)