From 7e1a7da0b24d8b836e9feef956501dfb5b3cdcfe Mon Sep 17 00:00:00 2001 From: Luke Winslow Date: Fri, 6 May 2016 11:36:58 -0500 Subject: [PATCH 1/2] use bathy for zmax first if available --- DESCRIPTION | 2 +- R/get_zmax.R | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f63b9ca..c5ffdb6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: lakeattributes Type: Package Title: A collection of lake attribute data -Version: 0.8.6 +Version: 0.8.7 Date: 2015-05-18 Author: Luke Winslow Maintainer: Luke Winslow diff --git a/R/get_zmax.R b/R/get_zmax.R index 836f1bb..bfd7736 100644 --- a/R/get_zmax.R +++ b/R/get_zmax.R @@ -20,6 +20,14 @@ get_zmax = function(id){ site_id = as.character(id) + bathy = get_bathy(id, cone_est=FALSE) + #quick short circuit. If we have a bathy file, + #return max depth from that. + + if(!is.null(bathy)){ + return(max(bathy$depths, na.rm=TRUE)) + } + lake_zmax = subset(zmax, site_id == id) if(nrow(lake_zmax) < 1){ From 95da83fbc7e9b7e09dbc2825efd30c7bc3ec769f Mon Sep 17 00:00:00 2001 From: Luke Winslow Date: Fri, 6 May 2016 13:18:51 -0500 Subject: [PATCH 2/2] fix get_zmax issue --- R/get_zmax.R | 2 +- R/wtemp.R | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/R/get_zmax.R b/R/get_zmax.R index bfd7736..1935ef6 100644 --- a/R/get_zmax.R +++ b/R/get_zmax.R @@ -31,7 +31,7 @@ get_zmax = function(id){ lake_zmax = subset(zmax, site_id == id) if(nrow(lake_zmax) < 1){ - return(max(get_bathy(site_id, cone_est=FALSE)$depth)) + return(max(get_bathy(site_id, cone_est=FALSE)$depths)) }else{ if(nrow(lake_zmax) > 1){ diff --git a/R/wtemp.R b/R/wtemp.R index d3356da..0797d7e 100644 --- a/R/wtemp.R +++ b/R/wtemp.R @@ -17,6 +17,8 @@ #' #' @docType data #' +#' +#' #' @examples #' data(wtemp) #' head(wtemp)