From 2e8f3f7df77a4598b93cb81cbe06ab949a83db62 Mon Sep 17 00:00:00 2001 From: Jason Fisher <jfisher@usgs.gov> Date: Wed, 5 Feb 2025 13:55:23 -0800 Subject: [PATCH 1/2] add system requirements to description --- DESCRIPTION | 1 + README.md | 39 +++++++++++++++++++++++++++++++++++++++ data/calibrations.rda | Bin 632 -> 632 bytes 3 files changed, 40 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index cd6b825..a6022c9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -70,6 +70,7 @@ Copyright: This software is in the public domain because it contains materials see the official USGS copyright policy at https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits Encoding: UTF-8 +SystemRequirements: libarchive-dev (dev) LazyData: true LazyDataCompression: xz URL: https://rconnect.usgs.gov/INLPO/mlms-main/, https://code.usgs.gov/inl/mlms diff --git a/README.md b/README.md index 47ae2e7..d75ba6b 100644 --- a/README.md +++ b/README.md @@ -44,16 +44,21 @@ remain in the MLMS wells and found that the tracer moved out of the formation for most of the monitoring zones analyzed. <p> + <figure class="figure"> + <img src="man/figures/photo.jpg" class="figure-img img-fluid" alt="photo" width="860px" /> <figcaption class="figure-caption"> + Hydrologic Technician, Jayson Blom (USGS), collecting pressure and temperature data at well site USGS 137A. In the background is Big Southern Butte, Idaho. Photograph taken on the INL in March 2014 by Brian V. Twining, Supervisory Hydrologist, USGS INLPO, Idaho Falls, Idaho. </figcaption> + </figure> + </p> ## Installation @@ -201,49 +206,83 @@ Additional metadata about this publication, not found in other parts of the page is in this table. <!--html_preserve--> + <table> + <tbody> + <tr> + <th scope="row"> + Publication type </th> + <td> + Formal R language package </td> + </tr> + <tr> + <th scope="row"> + DOI </th> + <td> + 10.5066/P9V6VCBO </td> + </tr> + <tr> + <th scope="row"> + Year published </th> + <td> + 2024 </td> + </tr> + <tr> + <th scope="row"> + Version </th> + <td> + <a href='https://code.usgs.gov/inl/mlms/-/tree/v1.0.0'>1.0.0</a> </td> + </tr> + <tr> + <th scope="row"> + IPDS </th> + <td> + IP-151143 </td> + </tr> + </tbody> + </table> <cr><!--/html_preserve--> diff --git a/data/calibrations.rda b/data/calibrations.rda index 267289f7a850f536320e09eef35a377fe076e8f5..66a36367e59cfefb7ab30f70d1fb1d94b1381e0a 100644 GIT binary patch delta 357 zcmV-r0h<2!1o#Ay905A99R&e@vU3iUP7UXxh4}xDstO`wV<J*XBmR*egVWrwl|`#v z(Y&-k=tM+gI-)dTee48;)PV)i=gljhai*lh<-Qz8x&fqum%N6FrVChZizuacqGc1C zBW7FQBqV#Vc@IRB<Bdq`)C9{43<4J+o)mp->*DmGI&`E`A(%`l!MfCc6Y#Zc6U)m! ztL|<GU1*NL*wf%B<g?ZZM+PFnwID=Oa*z-qu^~atAl2lSTDYNVlOHJPI+IuiUFvha z8&Aas^&*US_@2!I>mS_14A2`w7m|%u{^8LUsn~}x!D4*w8<lA&UaG3spAdy0oaHZ$ zn%g)nzS<_R7;5T)0iS1BX`@b<#)O8v^xgnAIhe!Nm?AMUfzI>&H59F_!gOhS6OCVp zU_1{Ta^F~>1f<Cx^baq~X}zKY00000Uegq400GhjlnVd=D^^rjJ}?c70ssI200CKA Dzzd;L delta 357 zcmV-r0h<2!1o#Ay905789R&e@O2zJ!P7UXxh4}xDstO`wV<J*XBmR*egXjV<l|`#v z(XQw~=tM+gI-)dTee48;)PV)i=gljhaifIZE*u1ykr7TQiH8WJ%Ek4&Ihw3ODp(Zl zy(`z}Fo2ynvQy1cG)7v7w-LC!qdo@D5jrrTOymX@aof665%&p>>9vi2@Q9*@T4oaX z6?LkyBN;$JF=)0uefj)U>I@Eq94UG<33WPT7f=Ap*4lRCl8kp#oCP>Oa4O6%65^4W zhj8tVB)a&4P1!Mpm(xCkl&QX6@(DGYM1;VmJVV*~I$0WvWM*Ni$P_CM*4b;LGK<;_ zmi?P;O#I1DQ;U!GS3O%;E1muvkJKb<BAW9zl*k(DE}1i$z1u@OJEia^q|~#W&7FZa zc>E{^*PW4Cb*R8HFwmqb(cCCL00000s17{q00GeilnVd=g(SeyJ}?c70ssI200CKA Dq<5i| -- GitLab From 8472b7578f31cd26a6b58f149517609ff64f2ac1 Mon Sep 17 00:00:00 2001 From: Jason Fisher <jfisher@usgs.gov> Date: Mon, 10 Feb 2025 10:05:13 -0800 Subject: [PATCH 2/2] fix lintr issues --- .lintr | 9 +++++---- Makefile | 6 +++++- R/get_head_stats.R | 2 +- R/plot_profile.R | 4 ++-- R/read_field_xlsx.R | 3 ++- R/utils.R | 6 +++--- vignettes/download.Rmd | 3 +-- vignettes/heads.Rmd | 1 - vignettes/ports.Rmd | 1 - vignettes/samples.Rmd | 1 - vignettes/statistics.Rmd | 1 - vignettes/visits.Rmd | 2 +- vignettes/wells.Rmd | 1 - vignettes/zones.Rmd | 1 - 14 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.lintr b/.lintr index f0c4585..bc81026 100644 --- a/.lintr +++ b/.lintr @@ -1,6 +1,7 @@ -linters: with_defaults( - line_length_linter(120), +linters: linters_with_defaults( + line_length_linter = line_length_linter(120), object_usage_linter = NULL, - undesirable_function_linter("sapply"), - object_name_linter(styles = c("dotted.case", "snake_case", "symbols")) + assignment_linter = assignment_linter(), + function_left_parentheses_linter = function_left_parentheses_linter() ) +encoding: "UTF-8" diff --git a/Makefile b/Makefile index 91be931..05d5fe4 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,10 @@ cran-check: install R CMD check --no-build-vignettes --as-cran $(PKGNAME)_$(PKGVERS).tar.gz .PHONY: cran-check +lintr: + R -q -e "lintr::lint_dir()" +.PHONY: lintr + coverage: R -q -e "covr::package_coverage(type = 'all')" .PHONY: coverage @@ -84,5 +88,5 @@ website: install R -q -e "pkgdown::build_site()" .PHONY: website -everything: datasets erd install readme check coverage data-release website lockfile clean +everything: datasets erd install readme check lintr coverage data-release website lockfile clean .PHONY: everything diff --git a/R/get_head_stats.R b/R/get_head_stats.R index fa9cf99..a69682a 100644 --- a/R/get_head_stats.R +++ b/R/get_head_stats.R @@ -129,7 +129,7 @@ aggregate_data <- function(var_nm, digits = 2, by_port = TRUE) { d <- do.call(rbind, args = l) d <- data.frame("port_nu" = unique_ports, d) - # aggregate by site only + # aggregate by site only } else { var_va <- heads[[var_nm]][is_site] var_dt <- heads[["press_dt"]][is_site] diff --git a/R/plot_profile.R b/R/plot_profile.R index c0b780d..ae0d632 100644 --- a/R/plot_profile.R +++ b/R/plot_profile.R @@ -95,13 +95,13 @@ plot_profile <- function(site_nm, xlab <- "Hydraulic head, in feet above the NAVD 88" x <- d$total_head_va - # set temperature data + # set temperature data } else if (type == "temp") { main <- "Temperature Profile" xlab <- "Fluid temperature, in degree Celsius" x <- d$temp_va - # set water-quality data + # set water-quality data } else { d <- d[!is.na(d$sample_dt), ] main <- "Water-Quality Profile" diff --git a/R/read_field_xlsx.R b/R/read_field_xlsx.R index 65b0e73..5f72716 100644 --- a/R/read_field_xlsx.R +++ b/R/read_field_xlsx.R @@ -187,7 +187,8 @@ read_excel_worksheet <- function(path, sheet, max_rows = 100L) { # remove extraneous table rows m <- apply(d, 1, function(x) all(is.na(x))) |> - which() |> min() - 1L + which() |> + min() - 1L d <- d[seq_len(m), , drop = FALSE] # remove rows with missing values in required fields diff --git a/R/utils.R b/R/utils.R index 92cad62..334b7eb 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,7 +1,7 @@ # Function to calculate the specific weight of water in lb/ft^3, where temperature is in degC ---- calc_specific_weight <- function(temp) { checkmate::assert_numeric(temp) - rho <- 1000 * (1 - (temp + 288.9414) / (508929.2 * (temp + 68.12963)) * (temp - 3.9863)^2) # kg/m^3 + rho <- 1000 * (1 - (temp + 288.9414) / (508929.2 * (temp + 68.12963)) * (temp - 3.9863)^2) # kg per cubic meter sw <- rho * 9.80665 # N/m^3 or kg/(m^2*s^2) sw * 0.22480894387 / 35.314666721 } @@ -12,7 +12,7 @@ calc_press_head <- function(press_va, baro_va, temp_va) { checkmate::assert_numeric(press_va) checkmate::assert_numeric(baro_va) checkmate::assert_numeric(temp_va) - psf <- (press_va - baro_va) * 144 # lb/ft^2 + psf <- (press_va - baro_va) * 144 # pounds per square foot psf / calc_specific_weight(temp_va) } @@ -44,7 +44,7 @@ null_to_na <- function(x) { # code adapted from a blog post by Stephen Turner, # accessed on 2023-08-09 at # https://gettinggeneticsdone.blogspot.com/2011/01/rstats-function-for-extracting-f-test-p.html -get_p_value <- function (x) { +get_p_value <- function(x) { checkmate::assert_class(x, "lm") f <- summary(x)$fstatistic p <- stats::pf(f[1], f[2], f[3], lower.tail = FALSE) diff --git a/vignettes/download.Rmd b/vignettes/download.Rmd index a9e263f..2e00534 100644 --- a/vignettes/download.Rmd +++ b/vignettes/download.Rmd @@ -154,7 +154,7 @@ archive_size <- inldata::get_file_size(archive) ```{r echo=FALSE, results="asis"} align <- c("l", rep("c", ncol(tbl) - 1L)) -options(knitr.kable.NA = '-') +options(knitr.kable.NA = "-") knitr::kable(tbl, row.names = FALSE, col.names = col_names, @@ -177,5 +177,4 @@ fontawesome::fa("download") |> ) |> htmltools::tagList() |> htmltools::p() - ``` diff --git a/vignettes/heads.Rmd b/vignettes/heads.Rmd index 43de385..da5e7c3 100644 --- a/vignettes/heads.Rmd +++ b/vignettes/heads.Rmd @@ -191,5 +191,4 @@ mlms::heads[, names(columns)] |> elementId = table_id ) mlms::make_dl_button(table_id) - ``` diff --git a/vignettes/ports.Rmd b/vignettes/ports.Rmd index 8f762db..a8e294f 100644 --- a/vignettes/ports.Rmd +++ b/vignettes/ports.Rmd @@ -171,5 +171,4 @@ mlms::ports[, names(columns)] |> elementId = table_id ) mlms::make_dl_button(table_id) - ``` diff --git a/vignettes/samples.Rmd b/vignettes/samples.Rmd index c6f539f..be98e5a 100644 --- a/vignettes/samples.Rmd +++ b/vignettes/samples.Rmd @@ -166,5 +166,4 @@ mlms::samples[, names(columns)] |> elementId = table_id ) mlms::make_dl_button(table_id) - ``` diff --git a/vignettes/statistics.Rmd b/vignettes/statistics.Rmd index 6040d7a..f5a47cf 100644 --- a/vignettes/statistics.Rmd +++ b/vignettes/statistics.Rmd @@ -227,5 +227,4 @@ columns <- get_columns( ) add_web_table(table_id, columns, var_nm = "total_head_va") mlms::make_dl_button(table_id) - ``` diff --git a/vignettes/visits.Rmd b/vignettes/visits.Rmd index 0516666..d09ccdb 100644 --- a/vignettes/visits.Rmd +++ b/vignettes/visits.Rmd @@ -170,6 +170,6 @@ mlms::visits[, names(columns)] |> compact = TRUE, elementId = table_id ) - mlms::make_dl_button(table_id) +mlms::make_dl_button(table_id) ``` diff --git a/vignettes/wells.Rmd b/vignettes/wells.Rmd index fc19433..7bcfda5 100644 --- a/vignettes/wells.Rmd +++ b/vignettes/wells.Rmd @@ -245,7 +245,6 @@ data[, names(columns)] |> elementId = table_id ) mlms::make_dl_button(table_id) - ``` <!-- Embedded References --> diff --git a/vignettes/zones.Rmd b/vignettes/zones.Rmd index 04928c7..4db49c1 100644 --- a/vignettes/zones.Rmd +++ b/vignettes/zones.Rmd @@ -120,5 +120,4 @@ mlms::zones[, names(columns)] |> elementId = table_id ) mlms::make_dl_button(table_id) - ``` -- GitLab