diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e1ecff493236dc3c0ad239f3dc1e658593a2b6df..3faa28ca20770fa7e6c60e18e3afdb6f0f220f8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,7 +50,7 @@ content: script: - Rscript -e "sf::sf_extSoftVersion() |> as.data.frame() |> print()" - Rscript -e "renv::lockfile_create() |> renv::lockfile_write(file = 'renv.lock')" - - Rscript --no-save --no-restore --verbose data-raw/make-erd.R > ./man/figures/erd.svg + - Rscript --no-save --no-restore --verbose data-raw/make-dm.R artifacts: paths: - "renv.lock" diff --git a/Makefile b/Makefile index a4e1399fe525838771d6ecad0c432b6040e622d9..b5bdde498ad6815aef1771c9c3e329b2badbec90 100644 --- a/Makefile +++ b/Makefile @@ -75,13 +75,13 @@ data-release: install )" .PHONY: data-release -erd: - Rscript --no-save --no-restore --verbose data-raw/make-erd.R > ./man/figures/erd.svg -.PHONY: erd +dm: + Rscript --no-save --no-restore --verbose data-raw/make-dm.R +.PHONY: dm clear-cache: R -q -e "inldata::clear_cache_dir('inldata')" .PHONY: clear-cache -everything: datasets erd readme check data-release website lockfile clean +everything: datasets dm readme check data-release website lockfile clean .PHONY: everything diff --git a/R/compute_shade.R b/R/compute_shade.R index 5aea1e2695bb4d9efd64d66eceb24c03db3acd5a..ad39dbe7bea009b6d852fe641d17cb16ef8ae254 100644 --- a/R/compute_shade.R +++ b/R/compute_shade.R @@ -41,8 +41,8 @@ #' terra::plot(hillshade, col = col, mar = mar, legend = FALSE) #' terra::plot(elevation, #' col = inlcolor::get_colors( -#' n = 25, -#' scheme = "dem3", +#' n = 256, +#' scheme = "dem2", #' alpha = 0.7, #' bias = 0.9 #' ), diff --git a/data-raw/README.md b/data-raw/README.md index 085470e4f8a802a894e94ef0f065b32aec31d679..77c4ee53fd69a8c159d326f5d49bd0dfbc57cd93 100644 --- a/data-raw/README.md +++ b/data-raw/README.md @@ -31,7 +31,7 @@ The folder contains an [R script](make-datasets.R) that builds datasets in the i +-- README.md +-- detection-limites.tsv (laboratory detection limits) +-- make-datasets.R (script for building datasets) -+-- make-erd.R (script for creating Entity Relationship Diagram) ++-- make-dm.R (script for creating the data model) +-- output.log (script output log) ``` diff --git a/data-raw/make-erd.R b/data-raw/make-dm.R similarity index 86% rename from data-raw/make-erd.R rename to data-raw/make-dm.R index 204d2050daf4cddae7208790ff4b7138248be248..c036e43e70985aef9cfcbdcc3e5b23802c51da66 100644 --- a/data-raw/make-erd.R +++ b/data-raw/make-dm.R @@ -13,7 +13,7 @@ list.files("data", full.names = TRUE) |> invisible() # add tables to data model -dm::dm( +dm <- dm::dm( background, benchmarks, cities, @@ -67,17 +67,21 @@ dm::dm( dm::dm_add_fk(table = samples, columns = "site_no", ref_table = sites, check = FALSE) |> dm::dm_add_fk(table = samples, columns = "pcode", ref_table = parameters, check = TRUE) |> dm::dm_add_fk(table = samples, columns = "parm_unit", ref_table = units, check = TRUE) |> - dm::dm_add_fk(table = swm, columns = "site_no", ref_table = sites, check = FALSE) |> + dm::dm_add_fk(table = swm, columns = "site_no", ref_table = sites, check = FALSE) - # validate - dm::dm_validate() |> +# validate data model +dm::dm_validate(dm) - # make diagram - dm::dm_draw( - view_type = "all", - graph_name = "ERD", - column_types = FALSE, - font_size = c("header" = 12L, "column" = 12L) - ) |> +# make entity relationship diagram +file <- file.path(getwd(), "man/figures/erd.svg", fsep = "/") +if (!checkmate::test_path_for_output(file, overwrite = TRUE)) { + dir.create(path = dirname(file), recursive = TRUE) +} +dm::dm_draw(dm, + view_type = "all", + graph_name = "ERD", + column_types = FALSE, + font_size = c("header" = 12L, "column" = 12L) +) |> DiagrammeRsvg::export_svg() |> - cat() + cat(file = file) diff --git a/data-raw/output.log b/data-raw/output.log index 6c80ff40605c6cde8ef1ecd7c4c9993c0cc304c6..260fef17d65afe9961488ac63a034035fa4e5f4d 100644 --- a/data-raw/output.log +++ b/data-raw/output.log @@ -1,7 +1,7 @@ running '/usr/lib/R/bin/R --no-echo --no-restore --no-save --no-restore --file=data-raw/make-datasets.R' -TIMESTAMP: 2024-01-17 20:10:37 PST +TIMESTAMP: 2024-01-19 09:36:27 PST STATUS: making 'crs' dataset ... STATUS: making 'dl' dataset ... STATUS: making 'parameters' dataset ... @@ -113,7 +113,7 @@ Bounding box: xmin: -114 ymin: 43.27246 xmax: -112.2147 ymax: 44.50002 Geodetic CRS: WGS 84 STATUS: making 'idaho' dataset ... Reading layer `tl_2022_us_state' from data source - `/tmp/RtmpzDikMF/tl_2022_us_state.shp' using driver `ESRI Shapefile' + `/tmp/RtmpcBSxUh/tl_2022_us_state.shp' using driver `ESRI Shapefile' Simple feature collection with 56 features and 14 fields Geometry type: MULTIPOLYGON Dimension: XY @@ -121,7 +121,7 @@ Bounding box: xmin: -179.2311 ymin: -14.60181 xmax: 179.8597 ymax: 71.43979 Geodetic CRS: NAD83 STATUS: making 'cities' dataset ... Reading layer `tl_2022_16_place' from data source - `/tmp/RtmpzDikMF/tl_2022_16_place.shp' using driver `ESRI Shapefile' + `/tmp/RtmpcBSxUh/tl_2022_16_place.shp' using driver `ESRI Shapefile' Simple feature collection with 237 features and 16 fields Attribute-geometry relationships: constant (16) Geometry type: MULTIPOLYGON @@ -130,7 +130,7 @@ Bounding box: xmin: -117.0466 ymin: 41.9989 xmax: -111.081 ymax: 48.73532 Geodetic CRS: NAD83 STATUS: making 'counties' dataset ... Reading layer `tl_2022_us_county' from data source - `/tmp/RtmpzDikMF/tl_2022_us_county.shp' using driver `ESRI Shapefile' + `/tmp/RtmpcBSxUh/tl_2022_us_county.shp' using driver `ESRI Shapefile' Simple feature collection with 3235 features and 17 fields Attribute-geometry relationships: constant (17) Geometry type: MULTIPOLYGON @@ -139,14 +139,14 @@ Bounding box: xmin: -179.2311 ymin: -14.60181 xmax: 179.8597 ymax: 71.43979 Geodetic CRS: NAD83 STATUS: making 'roads' dataset ... Reading layer `tl_2022_16_prisecroads' from data source - `/tmp/RtmpzDikMF/tl_2022_16_prisecroads.shp' using driver `ESRI Shapefile' + `/tmp/RtmpcBSxUh/tl_2022_16_prisecroads.shp' using driver `ESRI Shapefile' Simple feature collection with 1492 features and 4 fields Geometry type: LINESTRING Dimension: XY Bounding box: xmin: -117.0418 ymin: 41.99685 xmax: -111.044 ymax: 49.00056 Geodetic CRS: NAD83 Reading layer `tl_2022_16023_roads' from data source - `/tmp/RtmpzDikMF/tl_2022_16023_roads.shp' using driver `ESRI Shapefile' + `/tmp/RtmpcBSxUh/tl_2022_16023_roads.shp' using driver `ESRI Shapefile' Simple feature collection with 1474 features and 4 fields Geometry type: LINESTRING Dimension: XY @@ -177,7 +177,7 @@ Folders: 4 Files: 36 Size: 415343814 Compressed: 107012670 -Reading layer `NHDWaterbody' from data source `/tmp/RtmpzDikMF/NHDWaterbody.shp' using driver `ESRI Shapefile' +Reading layer `NHDWaterbody' from data source `/tmp/RtmpcBSxUh/NHDWaterbody.shp' using driver `ESRI Shapefile' Simple feature collection with 14367 features and 12 fields Attribute-geometry relationships: constant (12) Geometry type: MULTIPOLYGON @@ -209,7 +209,7 @@ Folders: 4 Files: 36 Size: 415343814 Compressed: 107012670 -Reading layer `NHDFlowline' from data source `/tmp/RtmpzDikMF/NHDFlowline.shp' using driver `ESRI Shapefile' +Reading layer `NHDFlowline' from data source `/tmp/RtmpcBSxUh/NHDFlowline.shp' using driver `ESRI Shapefile' Simple feature collection with 272340 features and 14 fields Attribute-geometry relationships: constant (14) Geometry type: MULTILINESTRING @@ -221,4 +221,4 @@ Geodetic CRS: NAD83 STATUS: making 'dem' dataset ... |---------|---------|---------|---------| ========================================= |---------|---------|---------|---------| ========================================= STATUS: compress dataset files ... STATUS: copy dataset files to destination directory ... -DURATION: 5.755672 mins +DURATION: 5.751602 mins diff --git a/man/compute_shade.Rd b/man/compute_shade.Rd index 9797ffb2b2a8ad507a36f1f1dbb840bfce5a9dab..e77fc2d940ae602b5b81116d0709e5f3fe077ef3 100644 --- a/man/compute_shade.Rd +++ b/man/compute_shade.Rd @@ -58,8 +58,8 @@ terra::plot(hillshade, col = col, mar = mar) terra::plot(hillshade, col = col, mar = mar, legend = FALSE) terra::plot(elevation, col = inlcolor::get_colors( - n = 25, - scheme = "dem3", + n = 256, + scheme = "dem2", alpha = 0.7, bias = 0.9 ), diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index ac907e39e67a9c4ad3038823764f4658d3c8b94b..f9c205a15268d186e00b017d66a8058694b23c08 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -20,10 +20,10 @@ navbar: href: https://code.usgs.gov/inl/inldata reference: -- title: All datasets +- title: Datasets contents: - has_keyword("datasets") -- title: All functions +- title: Functions contents: - -has_keyword("datasets")