Skip to content

Commit

Permalink
docs + vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
cneyens committed Jul 18, 2024
1 parent ed1cbba commit a6d8038
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 85 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: raem
Title: Analytic Element Modeling of Steady Single-Layer Groundwater Flow
Version: 0.0.0.9000
Authors@R:
person("Cas", "Neyens", , "[email protected]", role = c("aut", "cre"))
person("Cas", "Neyens", , "[email protected]", role = c("aut", "cre", "cph"))
Description: Analytic element modeling of steady-state single-layer
groundwater flow under the Dupuit-Forchheimer assumption. Elements
such as wells, area-sinks and line-sinks can be placed at arbitrary
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2023
YEAR: 2024
COPYRIGHT HOLDER: raem authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2023 raem authors
Copyright (c) 2024 raem authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 8 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ output: github_document

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
```{r knitr-setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
Expand Down Expand Up @@ -76,11 +76,10 @@ Find the head and discharge at two locations: `x = -200, y = 200` and `x = 100,

```{r find-head}
heads(m, x = c(-200, 100), y = 200)
discharge(m, c(-200, 100), 200, z = top) # m^2/d
```

Plot head contours and element locations. First, specify the contouring grid:
Plot the head contours and element locations. First, specify the contouring grid:

```{r set-grid}
xg = seq(-500, 500, length = 100)
Expand All @@ -97,7 +96,12 @@ plot(m, add = TRUE)
Compute particle traces starting along `y = 200` at 20 intervals per year for 5 years and add to the plot:

```{r plot-traces, dpi = 300}
paths = tracelines(m, x0 = seq(-450, 450, 50), y0 = 200, z0 = top, times = seq(0, 5 * 365, 365 / 20))
paths = tracelines(m,
x0 = seq(-450, 450, 50),
y0 = 200,
z0 = top,
times = seq(0, 5 * 365, 365 / 20))
plot(paths, add = TRUE, col = 'orange')
```

Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ heads(m, x = c(-200, 100), y = 200)
```

``` r

discharge(m, c(-200, 100), 200, z = top) # m^2/d
#> Qx Qy Qz
#> [1,] 0.15028815 -0.2923908 0
#> [2,] 0.06041242 -0.3347206 0
```

Plot head contours and element locations. First, specify the contouring
grid:
Plot the head contours and element locations. First, specify the
contouring grid:

``` r
xg = seq(-500, 500, length = 100)
Expand All @@ -101,7 +100,12 @@ Compute particle traces starting along `y = 200` at 20 intervals per
year for 5 years and add to the plot:

``` r
paths = tracelines(m, x0 = seq(-450, 450, 50), y0 = 200, z0 = top, times = seq(0, 5 * 365, 365 / 20))
paths = tracelines(m,
x0 = seq(-450, 450, 50),
y0 = 200,
z0 = top,
times = seq(0, 5 * 365, 365 / 20))

plot(paths, add = TRUE, col = 'orange')
```

Expand Down
174 changes: 103 additions & 71 deletions vignettes/vign-01-overview.Rmd

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions vignettes/vign-02-export-spatial.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ knitr::opts_chunk$set(
)
```

`raem` does not contain functions to export output to spatial data formats such as vector data or rasters. This vignette describes a way to create spatial data from `raem` output in R using other packages.
`raem` does not contain functions to export output to spatial data formats such as vector data or rasters. Other R packages do have this functionality however. This vignette describes a way to create spatial data from `raem` output using other, well-established, packages.

# Create an example AEM model

Expand Down Expand Up @@ -88,7 +88,7 @@ plot(isolines_sf)
```

To export the `sf` object to disk, the `sf` package provides the `write_sf()`:
To export the `sf` object to disk, the `sf` package provides the `write_sf()` function:

```{r export-shapefile, eval = FALSE}
# export as shapefile
Expand All @@ -97,7 +97,7 @@ write_sf(isolines_sf, 'isolines.shp')

# Exporting as spatial raster

To create and export output as a spatial raster object such as a GeoTIFF, the [terra](https://rspatial.github.io/terra/) can be used. This package is the replacement of the older, widely popular [raster](https://github.com/rspatial/raster) package. Similar to the creation of a spatial vector object, a grid of values for the variable of interest (here hydraulic head) needs to be specified. Optionally, the origin coordinates can be given to georeference the output. The extent of the raster needs to be specified explicitly from the range of the marginal grid vectors.
To create and export output as a spatial raster object such as a GeoTIFF, the [terra](https://rspatial.github.io/terra/) package can be used. This package is the replacement of the older, widely popular [raster](https://github.com/rspatial/raster) package. Similar to the creation of a spatial vector object, a grid of values for the variable of interest (here hydraulic head) needs to be specified. Optionally, the origin coordinates can be given to georeference the output. The extent of the raster needs to be specified explicitly from the range of the marginal grid vectors.

```{r terra, message = FALSE}
library(terra)
Expand Down

0 comments on commit a6d8038

Please sign in to comment.