-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
468 lines (361 loc) · 23.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
---
output: github_document
always_allow_html: true
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
library(knitr)
library(kableExtra)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "40%",
eval = TRUE
)
```
# **cdssr** <img src="man/figures/cdssr_logo_custom2.png" align="right" width="25%" />
<!-- badges: start -->
[![Dependencies](https://img.shields.io/badge/dependencies-9/02-orange?style=flat)](#)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://choosealicense.com/licenses/mit/)
<!-- badges: end -->
<div align="left">
<p align="left">
<a href="https://dwr.state.co.us/Tools"><strong>« CDSS »</strong></a>
<br />
<a href="https://dwr.state.co.us/Rest/GET/Help">CDSS REST Web Services</a>
</p>
</div>
<hr>
The goal of [**`cdssr`**](https://anguswg-ucsb.github.io/cdssr/) is to provide functions that help R users to navigate, explore, and make requests to the [CDSS REST API web service](https://dwr.state.co.us/Rest/GET/Help).
The Colorado's Decision Support Systems (CDSS) is a water management system created and developed by the [Colorado Water Conservation Board (CWCB)](https://cwcb.colorado.gov/) and the [Colorado Division of Water Resources (DWR)](https://dwr.colorado.gov/).
Thank you to those at CWCB and DWR for providing an accessible and well documented REST API!
<br>
> See [**`cdsspy`**](https://github.com/anguswg-ucsb/cdsspy), for the **Python** version of this package
---
- [**cdssr (R)**](https://github.com/anguswg-ucsb/cdssr)
- [**cdssr documentation**](https://anguswg-ucsb.github.io/cdssr/)
- [**cdsspy (Python)**](https://github.com/anguswg-ucsb/cdsspy)
- [**cdsspy documentation**](https://pypi.org/project/cdsspy/)
---
<br>
## Installation
You can install the development version of **`cdssr`** from [GitHub](https://github.com/anguswg-ucsb/cdssr) with:
```{r, eval=FALSE, echo=TRUE}
# install.packages("devtools")
devtools::install_github("anguswg-ucsb/cdssr")
```
```{r, eval=TRUE, echo=TRUE}
# Load package
library(cdssr)
```
## **Available endpoints**
Below is a table of all of the CDSS API endpoints that **`cdssr`** provides functions for.
|**-** |**Function** | **Description** | **Endpoint** |
|------|--------------------------------| -------------------------------------------------------------------|----------------------------------------------|
|1 | **get_admin_calls()** | Returns list of active/historic administrative calls | [administrativecalls/active](https://dwr.state.co.us/rest/get/help#Datasets&#AdministrativeCallsController&https://dnrweblink.state.co.us/dwr/ElectronicFile.aspx?docid=3600964&dbid=0&#gettingstarted&#jsonxml) |
|2 | **get_structures()** | Returns list of administrative structures | [structures](https://dwr.state.co.us/rest/get/help#Datasets&#StructuresController&#gettingstarted&#jsonxml) |
|3 | **get_structures_divrec_ts()** | Returns list of diversion/release records based on WDID | [structures/divrec/divrec](https://dwr.state.co.us/rest/get/help#Datasets&#DiversionRecordsController&https://dnrweblink.state.co.us/dwr/ElectronicFile.aspx?docid=3600965&dbid=0&#gettingstarted&#jsonxml) |
|4 | **get_structures_stage_ts()** | Returns list of stage/volume records based on WDID | [structures/divrec/stagevolume](https://dwr.state.co.us/rest/get/help#Datasets&#DiversionRecordsController&https://dnrweblink.state.co.us/dwr/ElectronicFile.aspx?docid=3600965&dbid=0&#gettingstarted&#jsonxml) |
|5 | **get_climate_stations()** | Returns Climate Stations | [climatedata/climatestations](https://dwr.state.co.us/rest/get/help#Datasets&#ClimateStationsController&https://www.ncdc.noaa.gov/cdo-web/webservices&https://www.northernwater.org/our-data/weather-data&#gettingstarted&#jsonxml) |
|6 | **get_climate_ts()** | Returns Climate Station Time Series (day, month, year) | [climatedata/climatestationts](https://dwr.state.co.us/rest/get/help#Datasets&#ClimateStationsController&https://www.ncdc.noaa.gov/cdo-web/webservices&https://www.northernwater.org/our-data/weather-data&#gettingstarted&#jsonxml) |
|7 | **get_climate_frostdates()** | Returns Climate Station Frost Dates | [climatedata/climatestationfrostdates](https://dwr.state.co.us/rest/get/help#Datasets&#ClimateStationsController&https://www.ncdc.noaa.gov/cdo-web/webservices&https://www.northernwater.org/our-data/weather-data&#gettingstarted&#jsonxml) |
|8 | **get_gw_gplogs_wells()** | Returns Groundwater GeophysicalLogsWell from filters | [groundwater/geophysicallogs/](https://dwr.state.co.us/rest/get/help#Datasets&#GroundwaterGeophysicalLogsController&#gettingstarted&#jsonxml) |
|9 | **get_gw_gplogs_geologpicks()** | Returns Groundwater Geophysical Log picks by well ID | [groundwater/geophysicallogs/](https://dwr.state.co.us/rest/get/help#Datasets&#GroundwaterGeophysicalLogsController&#gettingstarted&#jsonxml) |
|10 | **get_gw_wl_wells()** | Returns WaterLevelsWell from filters | [groundwater/waterlevels/wells](https://dwr.state.co.us/rest/get/help#Datasets&#GroundwaterLevelsController&#gettingstarted&#jsonxml) |
|11 | **get_gw_wl_wellmeasures()** | Returns Groundwater Measurements | [groundwater/waterlevels/wellmeasurements](https://dwr.state.co.us/rest/get/help#Datasets&#GroundwaterLevelsController&#gettingstarted&#jsonxml) |
|12 | **get_reference_tbl()** | Returns reference tables list | [referencetables/](https://dwr.state.co.us/rest/get/help#Datasets&#ReferenceTablesController&#gettingstarted&#jsonxml) |
|13 | **get_sw_stations()** | Returns Surface Water Station info | [surfacewater/surfacewaterstations](https://dwr.state.co.us/rest/get/help#Datasets&#SurfaceWaterController&#gettingstarted&#jsonxml) |
|14 | **get_sw_ts()** | Returns Surface Water Time Series | [surfacewater/surfacewaterts](https://dwr.state.co.us/rest/get/help#Datasets&#SurfaceWaterController&#gettingstarted&#jsonxml) |
|15 | **get_telemetry_stations()** | Returns telemetry stations and their most recent parameter reading | [telemetrystations/telemetrystation](https://dwr.state.co.us/rest/get/help#Datasets&#TelemetryStationsController&#gettingstarted&#jsonxml) |
|16 | **get_telemetry_ts()** | Returns telemetry time series data (raw, hour, day) | [telemetrystations/telemetrytimeseries](https://dwr.state.co.us/rest/get/help#Datasets&#TelemetryStationsController&#gettingstarted&#jsonxml)|
|17 | **get_water_rights_netamount()** | Returns current status of a water right based on all of its court decreed actions | [waterrights/netamount](https://dwr.state.co.us/rest/get/help#Datasets&#WaterRightsController&#gettingstarted&#jsonxml) |
|18 | **get_water_rights_trans()** | Returns court decreed actions that affect amount and use(s) that can be used by each water right | [waterrights/transaction](https://dwr.state.co.us/rest/get/help#Datasets&#WaterRightsController&#gettingstarted&#jsonxml)|
|19 | **get_call_analysis_wdid()** | Performs a call analysis that returns a time series showing the percentage of each day that the specified WDID and priority was out of priority and the downstream call in priority | [analysisservices/callanalysisbywdid](https://dwr.state.co.us/rest/get/help#Datasets&#AnalysisServicesController&#gettingstarted&#jsonxml) |
|20 | **get_source_route_framework()** | Returns the DWR source route framework reference table for the criteria specified | [analysisservices/watersourcerouteframework](https://dwr.state.co.us/rest/get/help#Datasets&#AnalysisServicesController&#gettingstarted&#jsonxml)|
|21 | **get_parceluse_ts()** | Returns list of Parcel Use Time Series | [structures/parcelusets](https://dwr.state.co.us/rest/get/help#Datasets&#ParcelUseTSController&#gettingstarted&#jsonxml) |
#### **Example: Explore endpoint**
To check out the various CDSS API endpoint, **`cdssr`** comes packaged with an **`api_endpoint`** table which details endpoint names, descriptions, and relevant URLs.
```{r api_endpoints_tbl, eval=T, echo=T}
dplyr::tibble(cdssr::api_endpoints)
```
<br>
#### **Example: View meta data**
**`cdssr`** also comes packaged with a **`resource_meta`** dataset which provides meta data for the data retrieved by **`cdssr`** (via the CDSS REST API)
```{r resource_meta_tbl, eval=T, echo=T}
dplyr::tibble(cdssr::resource_meta)
```
```{r return_fields_ex, eval=F, echo=F}
# <br>
# **Note:** Not all of the CDSS API endpoints have function in **`cdssr`**(yet), but if you want to *quickly view all* of the possible endpoints that the [CDSS REST API provides](https://dwr.state.co.us/Rest/GET/Help) use the **`browse_api()`** function.
#
# #### View the return fields
#
# Use **`preview_endpoint()`** to inspect what fields will be returned from a given endpoint, enter the [help page URL](https://dwr.state.co.us/Rest/GET/Help/Api/GET-api-v2-referencetables-stationflags). This URL is also located as a column named **endpoint_url** in the data frame output of **`browse_api()`**.
#
# Let's see what data will be returned from the referencetables/stationflags/ endpoint
# URL to referencetables/stationflags endpoint
# url <-
# cdssr::browse_api() %>%
# dplyr::filter(endpoint == "api/v2/referencetables/stationflags") %>%
# .$endpoint_url
#
# # Return expected data fields for a given endpoint
# return_fields <- cdssr::preview_endpoint(
# endpoint_url = url
# )
```
```{r, eval=F, echo=FALSE}
# return_fields
```
<br>
<br>
<br>
## **Identify query inputs using reference tables**
The **`get_reference_tbl()`** function will return tables that makes it easier to know what information should be supplied to the data retrieval functions in **`cdssr`**. For more information on the exact reference tables click [here](https://dwr.state.co.us/rest/get/help#Datasets&#ReferenceTablesController&#gettingstarted&#jsonxml).
Let's locate the parameters available at telemetry stations.
```{r get_tele_params, eval=TRUE, echo=TRUE}
# available parameters for telemetry stations
telemetry_params <- cdssr::get_reference_tbl(
table_name = "telemetryparams"
)
```
```{r, eval=TRUE, echo=FALSE}
dplyr::tibble(telemetry_params)
```
<br>
<br>
## **Locate structures**
**`cdssr`** provides functions for locating structures/stations/wells/sites by providing a spatial extent, water district, division, county, designated basin, or management district to the functions in the table below. Site data can also be retrieved by providing the site specific abbreviations, GNIS IDs, USGS IDs, WDIDs, or Well IDs.
|**-** |**Function** | **Description** | **Endpoint** |
|------|--------------------------------| -------------------------------------------------------------------|----------------------------------------------|
|1 | **get_structures()** | Returns list of administrative structures | [structures](https://dwr.state.co.us/rest/get/help#Datasets&#StructuresController&#gettingstarted&#jsonxml) |
|2 | **get_climate_stations()** | Returns Climate Stations | [climatedata/climatestations](https://dwr.state.co.us/rest/get/help#Datasets&#ClimateStationsController&https://www.ncdc.noaa.gov/cdo-web/webservices&https://www.northernwater.org/our-data/weather-data&#gettingstarted&#jsonxml) |
|3 | **get_gw_gplogs_wells()** | Returns Groundwater GeophysicalLogsWell from filters | [groundwater/geophysicallogs/](https://dwr.state.co.us/rest/get/help#Datasets&#GroundwaterGeophysicalLogsController&#gettingstarted&#jsonxml) |
|4 | **get_gw_wl_wells()** | Returns WaterLevelsWell from filters | [groundwater/waterlevels/wells](https://dwr.state.co.us/rest/get/help#Datasets&#GroundwaterLevelsController&#gettingstarted&#jsonxml) |
|5 | **get_sw_stations()** | Returns Surface Water Station info | [surfacewater/surfacewaterstations](https://dwr.state.co.us/rest/get/help#Datasets&#SurfaceWaterController&#gettingstarted&#jsonxml) |
|6 | **get_telemetry_stations()** | Returns telemetry stations and their most recent parameter reading | [telemetrystations/telemetrystation](https://dwr.state.co.us/rest/get/help#Datasets&#TelemetryStationsController&#gettingstarted&#jsonxml) |
<br>
#### **Example: Locating telemetry stations by county**
```{r get_tele_stations, eval=TRUE, echo=TRUE}
# identify telemetry stations in Boulder county
stations <- cdssr::get_telemetry_stations(
county = "Boulder"
)
```
```{r, eval=TRUE, echo=FALSE}
dplyr::tibble(stations)
```
```{r plot_tele_stations, eval=F, echo=FALSE, fig.align='center', out.width='100%'}
# plot(stations$latitude~stations$longitude)
# county_station_plot <-
# ggplot2::ggplot() +
# ggplot2::geom_sf(data = AOI::aoi_get(county = "Boulder", state = "CO"), color = "red") +
# ggplot2::geom_sf(data = sf::st_as_sf(stations, coords = c("longitude", "latitude"), crs = 4326), color = "darkgreen", alpha = 0.6, size = 4) +
# ggplot2::scale_y_continuous(breaks = seq(39.90, 40.30, .10)) +
# ggplot2::scale_x_continuous(breaks = seq(-105.1, -105.7, by = -0.2)) +
# ggplot2::theme_classic()
#
# ggplot2::ggsave(
# county_station_plot,
# filename = "D:/cdsspy/img/county_telem_stations2.png",
# height = 8,
# width = 10,
# scale = 1
# )
```
![](https://cdsspy-images.s3.us-west-1.amazonaws.com/county_telem_stations2.png)
<br>
#### **Example: Locating telemetry stations around a point**
```{r get_poi_stations, eval=F, echo=TRUE}
# identify telemetry stations 10 miles around a point
stations <- cdssr::get_telemetry_stations(
aoi = c(-105.358164, 40.092608),
radius = 10
)
```
```{r, eval=TRUE, echo=FALSE}
dplyr::tibble(stations)
```
![](https://cdsspy-images.s3.us-west-1.amazonaws.com/poi_telem_stations.png)
<br>
#### **Example: Locating telemetry stations within a spatial extent**
A masking operation is performed when a location search is done using a **polygon**. This ensures that the function only returns points that are ***within*** the given polygon.
```{r tele_stations_mask, eval=T, echo=TRUE}
# load AOI to retrieve county polygons
library(AOI)
# identify telemetry stations 15 miles around the centroid of a polygon
stations <- cdssr::get_telemetry_stations(
aoi = AOI::aoi_get(county = "Boulder", state = "CO"),
radius = 15
)
```
```{r, eval=TRUE, echo=FALSE}
dplyr::tibble(stations)
```
<br>
This gif highlights the masking process that happens when the **`aoi`** argument is given a **polygon**
![](https://cdsspy-images.s3.us-west-1.amazonaws.com/boulder_telem_stations_poly2.gif)
<br>
<br>
<br>
## **Retrieve time series data**
The functions in the table below retrieve time series data from the various time series related CDSS API endpoints.
|**-** |**Function** | **Description** | **Endpoint** |
|------|--------------------------------| -------------------------------------------------------------------|----------------------------------------------|
|1 | **get_structures_divrec_ts()** | Returns list of diversion/release records based on WDID | [structures/divrec/divrec](https://dwr.state.co.us/rest/get/help#Datasets&#DiversionRecordsController&https://dnrweblink.state.co.us/dwr/ElectronicFile.aspx?docid=3600965&dbid=0&#gettingstarted&#jsonxml) |
|2 | **get_structures_stage_ts()** | Returns list of stage/volume records based on WDID | [structures/divrec/stagevolume](https://dwr.state.co.us/rest/get/help#Datasets&#DiversionRecordsController&https://dnrweblink.state.co.us/dwr/ElectronicFile.aspx?docid=3600965&dbid=0&#gettingstarted&#jsonxml) |
|3 | **get_climate_ts()** | Returns Climate Station Time Series (day, month, year) | [climatedata/climatestationts](https://dwr.state.co.us/rest/get/help#Datasets&#ClimateStationsController&https://www.ncdc.noaa.gov/cdo-web/webservices&https://www.northernwater.org/our-data/weather-data&#gettingstarted&#jsonxml) |
|4 | **get_gw_wl_wellmeasures()** | Returns Groundwater Measurements | [groundwater/waterlevels/wellmeasurements](https://dwr.state.co.us/rest/get/help#Datasets&#GroundwaterLevelsController&#gettingstarted&#jsonxml) |
|5 | **get_sw_ts()** | Returns Surface Water Time Series | [surfacewater/surfacewaterts](https://dwr.state.co.us/rest/get/help#Datasets&#SurfaceWaterController&#gettingstarted&#jsonxml) |
|6 | **get_telemetry_ts()** | Returns telemetry time series data (raw, hour, day) | [telemetrystations/telemetrytimeseries](https://dwr.state.co.us/rest/get/help#Datasets&#TelemetryStationsController&#gettingstarted&#jsonxml)|
|7 | **get_parceluse_ts()** | Returns list of Parcel Use Time Series | [structures/parcelusets](https://dwr.state.co.us/rest/get/help#Datasets&#ParcelUseTSController&#gettingstarted&#jsonxml) |
<br>
#### **Example: Daily discharge at a telemetry station**
We can then take a station abbreviations from the **`get_telemetry_stations()`** call, a parameter from the **`get_reference_tbl()`** call, and use this information as inputs into the **`get_telemetry_ts()`** function.
<br>
The function below returns a dataframe of daily discharge for the "ANDDITCO" site between 2015-2022.
```{r get_ts, eval=TRUE, echo=TRUE}
# Daily discharge at "ANDDITCO" telemetry station
discharge_ts <- cdssr::get_telemetry_ts(
abbrev = "ANDDITCO", # Site abbreviation
parameter = "DISCHRG", # Desired parameter
start_date = "2015-01-01", # Starting date
end_date = "2022-01-01", # Ending date
timescale = "day" # select daily timescale
)
```
```{r, eval=TRUE, echo=FALSE}
dplyr::tibble(discharge_ts)
```
```{r plot_ts, eval=F, echo=FALSE, fig.align='center', out.width='100%'}
# Plot daily discharge at "ANDDITCO"
# plot(discharge_ts$value~discharge_ts$datetime, type = "l")
#
# #
# discharge_plot <-
# ggplot2::ggplot() +
# ggplot2::geom_line(data = discharge_ts, ggplot2::aes(x = datetime, y = value)) +
# ggplot2::labs(
# x = "Date",
# y = "CFS"
# ) +
# ggplot2::theme_bw()
#
# ggplot2::ggsave(
# discharge_plot,
# filename = "D:/cdsspy/img/discharge_timeseries_plot2.png",
# height = 8,
# width = 10,
# scale = 1
# )
```
![](https://cdsspy-images.s3.us-west-1.amazonaws.com/discharge_timeseries_plot2.png)
<br>
<br>
#### **Example: Retrieve Diversion records for multiple structures**
Some of the CDSS API endpoints allow users to request data from multiple structures if you provide a list of IDs. If we want to get diversion data from multiple structure locations, we'll need to get a list of WDIDs. We can get a list WDIDs within a given area by:
1. Executing a spatial search using **`get_structures()`**
2. Selecting the WDIDs of interest from the search results
3. Providing the WDIDs as a vector to **`get_structures_divrec_ts()`**
**Note:** Data availability can vary between structures (i.e. Missing data, not all structures have every data type/temporal resolution available, etc.)
```{r get_divrec, eval=TRUE, echo=TRUE}
# 1. Executing a spatial search
structures <- cdssr::get_structures(
aoi = c(-105.3578, 40.09244),
radius = 5
)
# 2. Selecting the WDID's of interest from our search results
ditch_wdids <-
structures %>%
dplyr::filter(ciu_code == "A", structure_type == "DITCH") %>%
.$wdid
# 3. Providing the WDID's as a vector to get_structures_divrec_ts()
diversion_rec <-
cdssr::get_structures_divrec_ts(
wdid = ditch_wdids,
wc_identifier = "diversion",
start_date = "1990-01-01",
end_date = "2022-01-01",
timescale = "month"
)
```
```{r, eval=TRUE, echo=FALSE}
dplyr::tibble(diversion_rec)
```
```{r plot_divrec, eval=F, echo=FALSE, fig.align='center', out.width='100%'}
# library(ggplot2)
#
# divrec_plot <-
# diversion_rec %>%
# ggplot2::ggplot() +
# ggplot2::geom_col(ggplot2::aes(x = datetime, y = data_value, fill = wdid)) +
# ggplot2::facet_wrap(~wdid, nrow = 2) +
# # ggplot2::facet_grid(.~wdid) +
# ggplot2::labs(
# x = "Date",
# y = "AF",
# fill = "WDID"
# ) +
# ggplot2::theme_bw()
#
# #
# ggplot2::ggsave(
# divrec_plot,
# filename = "D:/cdsspy/img/divrec_facet_plot.png",
# height = 8,
# width = 10,
# scale = 1
# )
```
![](https://cdsspy-images.s3.us-west-1.amazonaws.com/divrec_facet_plot.png)
<br>
<br>
<br>
## **Example: Groundwater well data**
#### Retrieve groundwater well data
The **`get_gw_()`** set of functions lets users make get requests to the various CDSS API groundwater endpoints shown in the table below:
|**-**|**Function** |**Endpoint** |
|-----|----------------------|---------------------------------------------------|
|1 | **get_gw_wl_wellmeasures()** |[api/v2/groundwater/waterlevels/wellmeasurements](https://dwr.state.co.us/Rest/GET/Help/Api/GET-api-v2-groundwater-waterlevels-wellmeasurements)|
|2 | **get_gw_wl_wells()** |[api/v2/groundwater/waterlevels/wells](https://dwr.state.co.us/Rest/GET/Help/Api/GET-api-v2-groundwater-waterlevels-wells)|
|3 | **get_gw_gplogs_wells()** |[api/v2/groundwater/geophysicallogs/wells](https://dwr.state.co.us/Rest/GET/Help/Api/GET-api-v2-groundwater-geophysicallogs-wells)|
|4 | **get_gw_gplogs_geologpicks()** |[api/v2/groundwater/geophysicallogs/geoplogpicks](https://dwr.state.co.us/Rest/GET/Help/Api/GET-api-v2-groundwater-geophysicallogs-geoplogpicks)|
<br>
Here we will retrieve groundwater well measurement data for Well ID 1274 between 1990-2022.
```{r get_gw, eval=TRUE, echo=TRUE}
# Request wellmeasurements endpoint (api/v2/groundwater/waterlevels/wellmeasurements)
well_measure <- cdssr::get_gw_wl_wellmeasures(
wellid = 1274,
start_date = "1990-01-01",
end_date = "2022-01-01"
)
```
```{r, eval=TRUE, echo=FALSE}
dplyr::tibble(well_measure)
```
```{r plot_gw, eval=F, echo=FALSE, fig.align='center', out.width='100%'}
# plot depth to water
# plot(well_measure$depth_to_water~well_measure$datetime, type = "l")
#
# gw_well_plot <-
# ggplot2::ggplot() +
# ggplot2::geom_line(data = well_measure, ggplot2::aes(x = datetime, y = depth_to_water)) +
# ggplot2::labs(
# x = "Date",
# y = "Feet"
# ) +
# ggplot2::theme_bw()
#
# ggplot2::ggsave(
# gw_well_plot,
# filename = "D:/cdsspy/img/gw_depth_to_water_plot.png",
# height = 8,
# width = 10,
# scale = 1
# )
```
![](https://cdsspy-images.s3.us-west-1.amazonaws.com/gw_depth_to_water_plot2.png)
<br>
<br>
<br>