USGS-R / hazardItems

Services for creating coastal change hazards items for the USGS Coastal Change Hazards Portal
https://marine.usgs.gov/coastalchangehazardsportal
Other
4 stars 9 forks source link

https-related changes; layer service change for raster #106

Closed mhines-usgs closed 7 years ago

mhines-usgs commented 7 years ago

Checking out the Travis failure...

jiwalker-usgs commented 7 years ago

This only changes examples, there is somewhere in the code where services are defined. (edit: I see that they were already https)

mhines-usgs commented 7 years ago

The Travis failure has to do with using XML with https, apparently it doesn't work with https. Trying to find a workaround.

mhines-usgs commented 7 years ago

@jread-usgs & @jiwalker-usgs what makes sense here. Right now the xml package doesn't successfully grab https URLs. I can change that so that it uses httr::GET but, a lot of our examples are working with local files in the extdata dir, so that won't work. does the vulnerability.service() need to work with both local and remote files? that would require another parameter then, probably? and then some logic to either use the XML or httr::GET methods?

mhines-usgs commented 7 years ago

Just updated my PR. I am seeing some examples failing when I run a check, however, but not sure it's related to what I changed?

==> devtools::check(document = FALSE)

Setting env vars ---------------------------------------------------------------
CFLAGS  : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building hazardItems -----------------------------------------------------------
"C:/Users/mhines/DOCUME~1/R/R-32~1.2/bin/x64/R" --no-site-file --no-environ  \
  --no-save --no-restore --quiet CMD build  \
  "D:\MKHData\cch\hazardItems\hazardItems" --no-resave-data --no-manual 

* checking for file 'D:\MKHData\cch\hazardItems\hazardItems/DESCRIPTION' ... OK
* preparing 'hazardItems':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory 'hazardItems/data'
* looking to see if a 'data/datalist' file should be added
* building 'hazardItems_2.0.8.tar.gz'

Setting env vars ---------------------------------------------------------------
_R_CHECK_CRAN_INCOMING_ : FALSE
_R_CHECK_FORCE_SUGGESTS_: FALSE
Checking hazardItems -----------------------------------------------------------
"C:/Users/mhines/DOCUME~1/R/R-32~1.2/bin/x64/R" --no-site-file --no-environ  \
  --no-save --no-restore --quiet CMD check  \
  "C:\Users\mhines\AppData\Local\Temp\1\Rtmpq2OkVr/hazardItems_2.0.8.tar.gz"  \
  --as-cran --timings --no-manual 

* using log directory 'D:/MKHData/cch/hazardItems/hazardItems.Rcheck'
* using R version 3.2.2 (2015-08-14)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using options '--no-manual --as-cran'
* checking for file 'hazardItems/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'hazardItems' version '2.0.8'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'hazardItems' can be installed ... WARNING
Found the following significant warnings:
  Warning: package 'mapdata' was built under R version 3.2.5
  Warning: package 'maps' was built under R version 3.2.5
  Warning: replacing previous import by 'httr::DELETE' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::GET' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::POST' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::PUT' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::accept_json' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::add_headers' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::content' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::content_type' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::headers' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::http_status' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::timeout' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::write_disk' when loading 'hazardItems'
See 'D:/MKHData/cch/hazardItems/hazardItems.Rcheck/00install.out' for details.
* checking installed package size ... OK
* checking package directory ... OK
* checking 'build' directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... NOTE
Non-standard file/directory found at top level:
  'hazardItems.knit.md'
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
Setting endpoint to  https://cida.usgs.gov/coastalchangehazardsportal/ 
* checking Rd files ... WARNING
checkRd: (5) checkAuth.Rd:0-23: Must have a \description
checkRd: (5) getAuth.Rd:0-14: Must have a \description
* checking Rd metadata ... OK
* checking Rd line widths ... NOTE
Rd file 'realtime.service.Rd':
  \examples lines wider than 100 characters:
     serviceEndpoint  <-     system.file('extdata', "GOM_erosion_hazards_metadata.xml", package = 'hazardItems')

Rd file 'storm.service.Rd':
  \examples lines wider than 100 characters:
     serviceEndpoint  <-     system.file('extdata', "GOM_erosion_hazards_metadata.xml", package = 'hazardItems')

These lines will be truncated in the PDF manual.
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'loadConfig'
  'filename'

Documented arguments not in \usage in documentation object 'saveTrack':
  'item'

Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.
* checking Rd contents ... WARNING
Argument items with no description in Rd object 'grabXML':
  'serviceEndpoint'

* checking for unstated dependencies in examples ... OK
* checking R/sysdata.rda ... OK
 WARNING
'qpdf' is needed for checks on size reduction of PDFs
* checking installed files from 'inst/doc' ... OK
* checking files in 'vignettes' ... OK
* checking examples ... ERROR
Running examples in 'hazardItems-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: vulnerability.service
> ### Title: create summary json for an individual vulnerability item
> ### Aliases: vulnerability.service
> 
> ### ** Examples
> 
> serviceEndpoint  <- paste0('http://cida.usgs.gov/coastalhazards/csw/?',
+ 'service=CSW&request=GetRecordById&version=2.0.2&typeNames=fgdc:metadata',
+ '&id=urn:uuid:12d6c1ee-a9e6-11e3-99f6-0050569524e0&',
+ 'outputSchema=http://www.opengis.net/cat/csw/csdgm&elementSetName=full')
> attribute <- 'DHIGH'
> summary <- vulnerability.service(serviceEndpoint,attribute)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function 'saveXML' for signature '"XMLDocument"'
Calls: vulnerability.service ... xpathApply -> xpathApply.XMLDocument -> saveXML -> <Anonymous>
Execution halted
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
  Running 'testthat.R' OK
* checking for unstated dependencies in vignettes ...
 OK
* checking package vignettes in 'inst/doc' ... OK
* checking running R code from vignettes ...
   'hazardItems.Rmd' using 'UTF-8' ... OK
 OK
* checking re-building of vignette outputs ... OK
* DONE
Status: 1 ERROR, 5 WARNINGs, 3 NOTEs
checking examples ... ERROR
Running examples in 'hazardItems-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: vulnerability.service
> ### Title: create summary json for an individual vulnerability item
> ### Aliases: vulnerability.service
> 
> ### ** Examples
> 
> serviceEndpoint  <- paste0('http://cida.usgs.gov/coastalhazards/csw/?',
+ 'service=CSW&request=GetRecordById&version=2.0.2&typeNames=fgdc:metadata',
+ '&id=urn:uuid:12d6c1ee-a9e6-11e3-99f6-0050569524e0&',
+ 'outputSchema=http://www.opengis.net/cat/csw/csdgm&elementSetName=full')
> attribute <- 'DHIGH'
> summary <- vulnerability.service(serviceEndpoint,attribute)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function 'saveXML' for signature '"XMLDocument"'
Calls: vulnerability.service ... xpathApply -> xpathApply.XMLDocument -> saveXML -> <Anonymous>
Execution halted

checking whether package 'hazardItems' can be installed ... WARNING
Found the following significant warnings:
  Warning: package 'mapdata' was built under R version 3.2.5
  Warning: package 'maps' was built under R version 3.2.5
  Warning: replacing previous import by 'httr::DELETE' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::GET' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::POST' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::PUT' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::accept_json' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::add_headers' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::content' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::content_type' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::headers' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::http_status' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::timeout' when loading 'hazardItems'
  Warning: replacing previous import by 'httr::write_disk' when loading 'hazardItems'
See 'D:/MKHData/cch/hazardItems/hazardItems.Rcheck/00install.out' for details.

checking Rd files ... WARNING
checkRd: (5) checkAuth.Rd:0-23: Must have a \description
checkRd: (5) getAuth.Rd:0-14: Must have a \description

checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'loadConfig'
  'filename'

Documented arguments not in \usage in documentation object 'saveTrack':
  'item'

Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.

checking Rd contents ... WARNING
Argument items with no description in Rd object 'grabXML':
  'serviceEndpoint'

checking top-level files ... NOTE
Non-standard file/directory found at top level:
  'hazardItems.knit.md'

checking R code for possible problems ... NOTE
Setting endpoint to  https://cida.usgs.gov/coastalchangehazardsportal/ 

checking Rd line widths ... NOTE
Rd file 'realtime.service.Rd':
  \examples lines wider than 100 characters:
     serviceEndpoint  <-     system.file('extdata', "GOM_erosion_hazards_metadata.xml", package = 'hazardItems')

Rd file 'storm.service.Rd':
  \examples lines wider than 100 characters:
     serviceEndpoint  <-     system.file('extdata', "GOM_erosion_hazards_metadata.xml", package = 'hazardItems')

These lines will be truncated in the PDF manual.

See
  'D:/MKHData/cch/hazardItems/hazardItems.Rcheck/00check.log'
for details.

R CMD check results
1 error  | 4 warnings | 3 notes

R CMD check succeeded
jiwalker-usgs commented 7 years ago

It looks like saveXML only works with the Internal version of things, I still don't know quite what that means, but that is what is catching here.

mhines-usgs commented 7 years ago

@jiwalker-usgs yeah, I actually changed xmlTreeParse to just xmlParse and it seems to not error... but I'm not sure if that's acceptable or not..

jiwalker-usgs commented 7 years ago

I don't know either. :worried:

mhines-usgs commented 7 years ago

image

coveralls commented 7 years ago

Coverage Status

Coverage increased (+13.8%) to 30.552% when pulling abc34b03dadb5c825b440ec46b5359e3ccb06244 on mhines-usgs:master into b50a63d4044d62d7c67526f444987a328ea4edf5 on USGS-R:master.

mhines-usgs commented 7 years ago

This still seems to work! so, yay?!

image

jiwalker-usgs commented 7 years ago

:shipit: