GithubHelp home page GithubHelp logo

neonscience / neon-geolocation Goto Github PK

View Code? Open in Web Editor NEW
18.0 11.0 5.0 1.35 MB

Code package for handling NEON geolocation data. Includes functions to extract spatial data from the API based on a named location, and to calculate more precise locations for select observational data products.

License: GNU Affero General Public License v3.0

R 100.00%

neon-geolocation's Introduction

NEON Geolocation Repository

This repository hosts code packages for acquiring and calculating geolocation data for NEON data products.

Usage

The code packages in this repository contain functions with two related purposes: (1) to acquire geolocation data via the NEON API, and (2) to calculate more precise geolocations, where possible, than NEON publishes directly. Only a subset of all NEON data products and named locations are covered by these code packages. See help files for individual packages and functions for details.

Credits & Acknowledgements

The National Ecological Observatory Network is a project solely funded by the National Science Foundation and managed under cooperative agreement by Battelle. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

License

GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007

Disclaimer

Information and documents contained within this repository are available as-is. Codes or documents, or their use, may not be supported or maintained under any program or service and may not be compatible with data currently available from the NEON Data Portal.

neon-geolocation's People

Contributors

cklunch avatar sokole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neon-geolocation's Issues

Can't install package in R 3.6.3

Hi,

I'm trying to install geoNEON in R studio using the command:
devtools::install_github("NEONScience/NEON-geolocation/geoNEON")

It looks like there might be some issues with the package code when installing. The output I'm getting is:

`* installing source package 'geoNEON' ...
** using staged installation
** R
Error in parse(outFile) :
C:/Users/Andrew/AppData/Local/Temp/Rtmpk5QEkY/R.INSTALL8a70d81335a/geoNEON/R/getLocTOS.R:583:74: unexpected ')'
582: all.return <- all.return[order(all.return$rowid),]
583: all.return <- all.return[,!names(all.return) %in% c('rowid','points'))
^
ERROR: unable to collate and parse R files for package 'geoNEON'

  • removing 'C:/Users/Andrew/Documents/R/win-library/3.6/geoNEON'
    Error: Failed to install 'geoNEON' from GitHub:
    (converted from warning) installation of package โ€˜C:/Users/Andrew/AppData/Local/Temp/RtmpSq1bat/file7bb861dd7ad/geoNEON_1.0.0.tar.gzโ€™ had non-zero exit status`

It's pointing to lines 582 and 583 of geoNEON/R/getLocTOS.

Warning message - In if (!is.na(projargs)) { : the condition has length > 1 and only the first element will be used

Function
getLocTOS

Describe the bug
Unsure it's a "bug" but its a warning that is hard to understand if its important.

To Reproduce
Code to reproduce is available here: https://github.com/nunocesarsa/NEON/blob/main/RScripts/Dev/00_10_NEON_DHP_geoNEON_getLocTOS.R (EDIT: added the wrong link)

Data was processed using the NeonUtilities for download (zipbyproduct) & stacking (stackbytable) (scripts 00_07, 00_08 and finally 00_10)

Expected behavior
No warning messages were expected

System (please complete the following information):

  • OS Version: Windows 10
  • R Version: 4.0.4

Additional context
I am using the functions on all available data downloadable by neonutilities. In this case, using the basic product of the DHP.

Warning messages:
1: In if (!is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
2: In if (!is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
3: In if (is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
4: In if (!is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
5: In if (!is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
6: In if (is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
7: In if (!is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
8: In if (!is.na(projargs)) { :
the condition has length > 1 and only the first element will be used
9: In if (is.na(projargs)) { :
the condition has length > 1 and only the first element will be used

Weird characters prevent installation on Windows

I'm working on a package that depends on geoNEON, and in trying to get CI set up on Windows through AppVeyor ran into encoding errors that prevent installation. Here's the relevant excerpt from the build log:

* preparing 'geoNEON':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'geoNEON_0.0.0.9000.tar.gz'
Installing package into 'c:/RLibrary'
(as 'lib' is unspecified)
* installing *source* package 'geoNEON' ...
** R
Error : (converted from warning) unable to re-encode 'def.calc.geo.os.R' lines 480, 482
ERROR: unable to collate and parse R files for package 'geoNEON'
* removing 'c:/RLibrary/geoNEON'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package 'C:/Users/appveyor/AppData/Local/Temp/1/RtmpQZP6sw/file7b827b379aa/geoNEON_0.0.0.9000.tar.gz' had non-zero exit status
Calls: <Anonymous> ... with_rprofile_user -> with_envvar -> force -> force -> i.p
Execution halted
Command exited with code 1

It looks like there are some odd characters on lines 480 and 482 of def.calc.geo.os.R that are causing the issue: https://github.com/NEONScience/NEON-geolocation/blob/master/geoNEON/R/def.calc.geo.os.R#L480-L482

These occur in comments in two places where I would expect a ti, but for me they are rendered on GitHub as boxes (using Ubuntu 18.04 in Firefox). I suspect this may be an encoding issue.

@cklunch I would be happy to submit a PR to try to fix it!

In case it's useful, here's the build environment info:

R version 3.5.2 Patched (2019-02-27 r76167)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2012 R2 x64 (build 9600)

getLocTOS on hbp_perbout - Error in geoNEON::calcLatLong(easting = subplot.loc$adjEasting, northing = subplot.loc$adjNorthing, : Variables must be the same length.

Function
getLocTOS

Describe the bug
The functions fails while calling calcLatLong. Potentially because of erroneous data in the downloaded files?

To Reproduce
Adapted from: https://github.com/nunocesarsa/NEON/blob/main/RScripts/Dev/00_05_NEON_geoNEON_getLocTOS.R

To reproduce, run zipbyproducts for all datasets and then stackbytable to create a single stack. Then change the folder pointers on the folder above (notice that only herpbout is necessary to recreate the error). Here is script calling the getLocTOS on the different tables:

https://github.com/nunocesarsa/NEON/blob/main/RScripts/Dev/00_05_NEON_geoNEON_getLocTOS_ForceHerpboutCrash.R

Expected behavior
No error was expeted

System (please complete the following information):

  • OS: Windows
  • OS Version: 10
  • R Version: 4.04

Additional context

Console information:
[1] "Processing: 1 of 7 - NEON10023 - hbp_perbout.csv"
|===========================================================================================================================================| 100%
[1] "Subplot 23 and clip cell 29 is not a valid location"
[1] "Subplot 39 and clip cell 57 is not a valid location"
[1] "Subplot 41 and clip cell 93 is not a valid location"
[1] "Subplot 41 and clip cell 85 is not a valid location"
[1] "Subplot 39 and clip cell 52 is not a valid location"
[1] "Subplot 23 and clip cell 26 is not a valid location"
[1] "Subplot 39 and clip cell 62 is not a valid location"
[1] "Subplot 41 and clip cell 81 is not a valid location"
[1] "Subplot 41 and clip cell 92 is not a valid location"
[1] "Subplot 23 and clip cell 36 is not a valid location"
[1] "Subplot 39 and clip cell 58 is not a valid location"
[1] "Subplot 23 and clip cell 38 is not a valid location"
[1] "Subplot 39 and clip cell 57 is not a valid location"
[1] "Subplot 23 and clip cell 31 is not a valid location"
[1] "Subplot 39 and clip cell 58 is not a valid location"
[1] "Subplot 41 and clip cell 90 is not a valid location"
[1] "Subplot 41 and clip cell 95 is not a valid location"
[1] "Subplot 23 and clip cell 39 is not a valid location"
[1] "Subplot 39 and clip cell 58 is not a valid location"
[1] "Subplot 23 and clip cell 41 is not a valid location"
[1] "Subplot 41 and clip cell 88 is not a valid location"
[1] "Subplot 39 and clip cell 52 is not a valid location"
[1] "Subplot 39 and clip cell 62 is not a valid location"
[1] "Subplot 41 and clip cell 95 is not a valid location"
[1] "Subplot 23 and clip cell 25 is not a valid location"
[1] "Subplot 23 and clip cell 26 is not a valid location"
[1] "Subplot 39 and clip cell 69 is not a valid location"
[1] "Subplot 41 and clip cell 92 is not a valid location"
[1] "Subplot 23 and clip cell 36 is not a valid location"
[1] "Subplot 39 and clip cell 64 is not a valid location"
[1] "Subplot 41 and clip cell 75 is not a valid location"
[1] "Subplot 23 and clip cell 29 is not a valid location"
[1] "Subplot 39 and clip cell 65 is not a valid location"
[1] "Subplot 41 and clip cell 86 is not a valid location"
[1] "Subplot 23 and clip cell 25 is not a valid location"
[1] "Subplot 41 and clip cell 95 is not a valid location"
[1] "Subplot 39 and clip cell 64 is not a valid location"
[1] "Subplot 41 and clip cell 81 is not a valid location"
[1] "Subplot 23 and clip cell 36 is not a valid location"
[1] "Subplot 41 and clip cell 92 is not a valid location"
[1] "Subplot 21 and clip cell 0 is not a valid location"
[1] "Subplot 23 and clip cell 45 is not a valid location"
[1] "Subplot 23 and clip cell 26 is not a valid location"
[1] "Subplot 39 and clip cell 56 is not a valid location"
[1] "Subplot 41 and clip cell 93 is not a valid location"
[1] "Subplot 41 and clip cell 77 is not a valid location"
[1] "Subplot 23 and clip cell 42 is not a valid location"
[1] "Subplot 41 and clip cell 95 is not a valid location"
[1] "Subplot 39 and clip cell 66 is not a valid location"
[1] "Subplot 23 and clip cell 42 is not a valid location"
[1] "Subplot 23 and clip cell 40 is not a valid location"
[1] "Subplot 39 and clip cell 70 is not a valid location"
[1] "Subplot 39 and clip cell 71 is not a valid location"
[1] "Subplot 23 and clip cell 26 is not a valid location"
[1] "Subplot 39 and clip cell 56 is not a valid location"
[1] "Subplot 41 and clip cell 93 is not a valid location"
[1] "Subplot 39 and clip cell 60 is not a valid location"
[1] "Subplot 41 and clip cell 93 is not a valid location"
[1] "Subplot 41 and clip cell 93 is not a valid location"
[1] "Subplot 39 and clip cell 69 is not a valid location"
[1] "Subplot 41 and clip cell 88 is not a valid location"
[1] "Subplot 23 and clip cell 27 is not a valid location"
[1] "Subplot 39 and clip cell 57 is not a valid location"
[1] "Subplot 41 and clip cell 95 is not a valid location"
[1] "Subplot 39 and clip cell 56 is not a valid location"
[1] "Subplot 41 and clip cell 88 is not a valid location"
[1] "Subplot 23 and clip cell 26 is not a valid location"
[1] "Subplot 39 and clip cell 66 is not a valid location"
[1] "Subplot 39 and clip cell 69 is not a valid location"
[1] "Subplot 41 and clip cell 77 is not a valid location"
[1] "Subplot 41 and clip cell 77 is not a valid location"
[1] "Subplot 23 and clip cell 36 is not a valid location"
[1] "Subplot 41 and clip cell 76 is not a valid location"
[1] "Subplot 39 and clip cell 54 is not a valid location"
[1] "Subplot 41 and clip cell 82 is not a valid location"
[1] "Subplot 39 and clip cell 66 is not a valid location"
[1] "Subplot 41 and clip cell 83 is not a valid location"
[1] "Subplot 41 and clip cell 79 is not a valid location"
[1] "Subplot 41 and clip cell 76 is not a valid location"
[1] "Subplot 39 and clip cell 64 is not a valid location"
[1] "Subplot 41 and clip cell 92 is not a valid location"
[1] "Subplot 39 and clip cell 57 is not a valid location"
[1] "Subplot 23 and clip cell 25 is not a valid location"
[1] "Subplot 41 and clip cell 86 is not a valid location"
[1] "Subplot 39 and clip cell 61 is not a valid location"
[1] "Subplot 39 and clip cell 55 is not a valid location"
[1] "Subplot 23 and clip cell 35 is not a valid location"
[1] "Subplot 23 and clip cell 39 is not a valid location"
[1] "Subplot 41 and clip cell 94 is not a valid location"
[1] "Subplot 41 and clip cell 92 is not a valid location"
[1] "Subplot 41 and clip cell 92 is not a valid location"
[1] "Subplot 23 and clip cell 39 is not a valid location"
[1] "Subplot 39 and clip cell 57 is not a valid location"
[1] "Subplot 41 and clip cell 81 is not a valid location"
[1] "Subplot 39 and clip cell 67 is not a valid location"
[1] "Subplot 41 and clip cell 77 is not a valid location"
[1] "Subplot 39 and clip cell 51 is not a valid location"
[1] "Subplot 23 and clip cell 25 is not a valid location"
[1] "Subplot 39 and clip cell 53 is not a valid location"
[1] "Subplot 21 and clip cell 0 is not a valid location"
[1] "Subplot 41 and clip cell 75 is not a valid location"
[1] "Subplot 39 and clip cell 61 is not a valid location"
[1] "Subplot 23 and clip cell 35 is not a valid location"
[1] "Subplot 23 and clip cell 34 is not a valid location"
[1] "Subplot 41 and clip cell 95 is not a valid location"
[1] "Subplot 39 and clip cell 70 is not a valid location"
[1] "Subplot 41 and clip cell 77 is not a valid location"
Error in geoNEON::calcLatLong(easting = subplot.loc$adjEasting, northing = subplot.loc$adjNorthing, :
Variables must be the same length.

Update rgdal and sp dependencies

Updates to the rgdal and sp packages are breaking many dependent packages: http://rgdal.r-forge.r-project.org/articles/PROJ6_GDAL3.html

In geoNEON, it appears this is primarily affecting calculations using getLocTOS(), where sp is used to calculate latitude and longitude from UTMs. I'm still investigating the best approach to fixing this problem, but for now, if possible, I recommend running geoNEON against older versions of rgdal and sp.

I'll update this issue soon.

Is it possible to get the spatial extent of the vegetation structure subplots?

I am generating spatially-explicit predictions of forest structure (biomass, basal area, species composition, etc.) and I am very interested in using the NEON plot data to evaluate these predictions! I have played around with the locations endpoint and have successfully generated the spatial footprint of the vegetation structure base plots (40 x 40 meters) but I have not yet found any information about the spatial extent of the subplots.

How would you go about generating the footprint of the four subplots (e.g. subplots 21, 23, 39, 41) as shown in this figure from the vegetation structure users guide?

image

Are the named subplots always oriented like this figure? i.e. 21 in southwest, 23 in southeast, 39 in northwest, 41 in northeast corner. Are the subplot descriptions with centroid/side length available via locations API?

Thanks for all of your hard work on this package and the NEON API!

No geoNEON for R 3.6.1

Function
devtools::install_github("NEONScience/NEON-geolocation/geoNEON")
[Edit: correct function]
Describe the bug
Unable to install the package. When tried, we get the following message:
Warning in install.packages: package 'geoNEON' is not available ( for R version 3.6.1).

To Reproduce
This occurred on all computers in today's workshop that had R 3.6.1 installed.

System (please complete the following information):

  • OS: several
  • OS Version: several
  • R Version: 3.6.1

error running example geoNEON code

> library(devtools)
> install_github('NEONScience/NEON-geolocation/geoNEON', dependencies=TRUE)
Skipping install of 'geoNEON' from a github remote, the SHA1 (a26a3990) has not changed since last install.
  Use `force = TRUE` to force installation
> library(geoNEON)
> d <- data.frame(namedLocation="GUAN_044.basePlot.ltr", subplotID=23, trapID="GUAN_044_385")
> def.calc.geo.os(d, "ltr_pertrap")

returns -
| | 0%
Error in which(clipCell$clipCellNumber == subplot.loc$cellNum[i] & clipCell$pointID == :
lazy-load database 'C:/Users/kjones/Documents/R/win-library/3.4/geoNEON/R/sysdata.rdb' is corrupt
In addition: Warning messages:
1: In which(clipCell$clipCellNumber == subplot.loc$cellNum[i] & clipCell$pointID == :
restarting interrupted promise evaluation
2: In which(clipCell$clipCellNumber == subplot.loc$cellNum[i] & clipCell$pointID == :
internal error -3 in R_decompress1

Typo in getLocTOS.R

Function
geoNEON/R/getLocTOS.R
Lines 147 and 148: I believe subplot.merg should be replaced with plot.merg, and subplot.loc should be replaced with plot.loc.

Describe the bug
I receive the following error message:

Error in base::merge(data, subplot.merg, by = locCol, all.x = T) : 
  object 'subplot.merg' not found

To Reproduce
N/A

Expected behavior
N/A

System (please complete the following information):

  • OS: iOS
  • OS Version: 10.14
  • R Version: 3.6.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.