Skip to content

R šŸ“¦ for exploring and requesting resources from the CDSS REST API.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

anguswg-ucsb/cdssr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ā 

History

88 Commits
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Repository files navigation

cdssr

Dependencies License: MIT


The goal of cdssr is to provide functions that help R users to navigate, explore, and make requests to the CDSS REST API web service.

The Coloradoā€™s Decision Support Systems (CDSS) is a water management system created and developed by the Colorado Water Conservation Board (CWCB) and the Colorado Division of Water Resources (DWR).

Thank you to those at CWCB and DWR for providing an accessible and well documented REST API!


See cdsspy, for the Python version of this package




Installation

You can install the development version of cdssr from GitHub with:

# install.packages("devtools")
devtools::install_github("anguswg-ucsb/cdssr")
# 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
2 get_structures() Returns list of administrative structures structures
3 get_structures_divrec_ts() Returns list of diversion/release records based on WDID structures/divrec/divrec
4 get_structures_stage_ts() Returns list of stage/volume records based on WDID structures/divrec/stagevolume
5 get_climate_stations() Returns Climate Stations climatedata/climatestations
6 get_climate_ts() Returns Climate Station Time Series (day, month, year) climatedata/climatestationts
7 get_climate_frostdates() Returns Climate Station Frost Dates climatedata/climatestationfrostdates
8 get_gw_gplogs_wells() Returns Groundwater GeophysicalLogsWell from filters groundwater/geophysicallogs/
9 get_gw_gplogs_geologpicks() Returns Groundwater Geophysical Log picks by well ID groundwater/geophysicallogs/
10 get_gw_wl_wells() Returns WaterLevelsWell from filters groundwater/waterlevels/wells
11 get_gw_wl_wellmeasures() Returns Groundwater Measurements groundwater/waterlevels/wellmeasurements
12 get_reference_tbl() Returns reference tables list referencetables/
13 get_sw_stations() Returns Surface Water Station info surfacewater/surfacewaterstations
14 get_sw_ts() Returns Surface Water Time Series surfacewater/surfacewaterts
15 get_telemetry_stations() Returns telemetry stations and their most recent parameter reading telemetrystations/telemetrystation
16 get_telemetry_ts() Returns telemetry time series data (raw, hour, day) telemetrystations/telemetrytimeseries
17 get_water_rights_netamount() Returns current status of a water right based on all of its court decreed actions waterrights/netamount
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
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
20 get_source_route_framework() Returns the DWR source route framework reference table for the criteria specified analysisservices/watersourcerouteframework
21 get_parceluse_ts() Returns list of Parcel Use Time Series structures/parcelusets

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.

dplyr::tibble(cdssr::api_endpoints)
#> # A tibble: 61 Ɨ 5
#>    resource                                      descripā€¦Ā¹ endpoā€¦Ā² url   endpoā€¦Ā³
#>    <chr>                                         <chr>     <chr>   <chr> <chr>  
#>  1 Active Administrative Calls Generator         Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  2 Historical Administrative Calls Generator     Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  3 Water Source Route Analysis Info Generator    Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  4 Water Source Route Framework Info Generator   Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  5 Call Analysis Structure Info Generator        Performsā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  6 Call Analysis Stream Mile Info Generator      Performsā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  7 Climate Stations Generator                    Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  8 Climate Station Data Types Generator          Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#>  9 Climate Station Time Series - Day Generator   Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#> 10 Climate Station Time Series - Month Generator Returns ā€¦ api/v2ā€¦ httpā€¦ https:ā€¦
#> # ā€¦ with 51 more rows, and abbreviated variable names Ā¹ā€‹description, Ā²ā€‹endpoint,
#> #   Ā³ā€‹endpoint_url

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)

dplyr::tibble(cdssr::resource_meta)
#> # A tibble: 1,031 Ɨ 5
#>    endpoint                          name                  descrā€¦Ā¹ type  endpoā€¦Ā²
#>    <chr>                             <chr>                 <chr>   <chr> <chr>  
#>  1 api/v2/administrativecalls/active boundingStructureLatā€¦ Latituā€¦ deciā€¦ https:ā€¦
#>  2 api/v2/administrativecalls/active boundingStructureLonā€¦ Longitā€¦ deciā€¦ https:ā€¦
#>  3 api/v2/administrativecalls/active boundingStructureName Structā€¦ striā€¦ https:ā€¦
#>  4 api/v2/administrativecalls/active boundingWdid          WDID oā€¦ striā€¦ https:ā€¦
#>  5 api/v2/administrativecalls/active callNumber            Uniqueā€¦ inteā€¦ https:ā€¦
#>  6 api/v2/administrativecalls/active callType              The tyā€¦ striā€¦ https:ā€¦
#>  7 api/v2/administrativecalls/active dateTimeReleased      Date aā€¦ date  https:ā€¦
#>  8 api/v2/administrativecalls/active dateTimeSet           Date aā€¦ date  https:ā€¦
#>  9 api/v2/administrativecalls/active division              DWR Waā€¦ inteā€¦ https:ā€¦
#> 10 api/v2/administrativecalls/active locationStructureLatā€¦ Latituā€¦ deciā€¦ https:ā€¦
#> # ā€¦ with 1,021 more rows, and abbreviated variable names Ā¹ā€‹description,
#> #   Ā²ā€‹endpoint_url




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.

Letā€™s locate the parameters available at telemetry stations.

# available parameters for telemetry stations
telemetry_params <- cdssr::get_reference_tbl(
  table_name = "telemetryparams"
  )
#> Retrieving telemetry parameter reference table
#> # A tibble: 46 Ɨ 1
#>    parameter
#>    <chr>    
#>  1 AIRTEMP  
#>  2 BAR_P    
#>  3 BATTERY  
#>  4 COND     
#>  5 D1       
#>  6 D2       
#>  7 DISCHRG  
#>  8 DISCHRG1 
#>  9 DISCHRG2 
#> 10 DISCHRG3 
#> # ā€¦ with 36 more rows



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
2 get_climate_stations() Returns Climate Stations climatedata/climatestations
3 get_gw_gplogs_wells() Returns Groundwater GeophysicalLogsWell from filters groundwater/geophysicallogs/
4 get_gw_wl_wells() Returns WaterLevelsWell from filters groundwater/waterlevels/wells
5 get_sw_stations() Returns Surface Water Station info surfacewater/surfacewaterstations
6 get_telemetry_stations() Returns telemetry stations and their most recent parameter reading telemetrystations/telemetrystation

Example: Locating telemetry stations by county

# identify telemetry stations in Boulder county
stations <- cdssr::get_telemetry_stations(
  county = "Boulder"
  )
#> Retrieving telemetry station data
#> # A tibble: 110 Ɨ 35
#>    divisā€¦Ā¹ waterā€¦Ā² county statiā€¦Ā³ data_ā€¦ā“ data_ā€¦āµ waterā€¦ā¶ gnis_id streaā€¦ā· abbrev
#>      <int>   <int> <chr>  <chr>   <chr>   <chr>   <chr>   <chr>     <dbl> <chr> 
#>  1       1       5 BOULDā€¦ "CLOUGā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   NA    05005ā€¦
#>  2       1       6 BOULDā€¦ "ANDERā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   23.6  ANDDIā€¦
#>  3       1       6 BOULDā€¦ "ANDREā€¦ DWR     Co. Diā€¦ SOUTH ā€¦ 001809ā€¦    1.5  ANFDIā€¦
#>  4       1       6 BOULDā€¦ "BASELā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   19.2  BASOUā€¦
#>  5       1       6 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ BOULDEā€¦ 001783ā€¦   15.5  BCSCBā€¦
#>  6       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ LEFT Hā€¦ 001782ā€¦    8.66 BFCINā€¦
#>  7       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   31.7  BFCLYā€¦
#>  8       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   31.7  BFCLYā€¦
#>  9       1       5 BOULDā€¦ "LYONSā€¦ DWR     Co. Diā€¦ SOUTH ā€¦ 001782ā€¦    0.03 BHNPRā€¦
#> 10       1       6 BOULDā€¦ "BOULDā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   22.3  BLDLHā€¦
#> # ā€¦ with 100 more rows, 25 more variables: usgs_station_id <chr>,
#> #   station_status <chr>, station_type <chr>, structure_type <chr>,
#> #   meas_date_time <dttm>, parameter <chr>, stage <dbl>, meas_value <dbl>,
#> #   units <chr>, flag_a <chr>, flag_b <chr>, contr_area <dbl>,
#> #   drain_area <dbl>, huc10 <chr>, utm_x <dbl>, utm_y <dbl>, latitude <dbl>,
#> #   longitude <dbl>, location_accuracy <chr>, wdid <chr>, modified <chr>,
#> #   more_information <chr>, station_por_start <dttm>, station_por_end <dttm>, ā€¦


Example: Locating telemetry stations around a point

# identify telemetry stations 10 miles around a point
stations <- cdssr::get_telemetry_stations(
  aoi    = c(-105.358164, 40.092608),
  radius = 10
  )
#> # A tibble: 110 Ɨ 35
#>    divisā€¦Ā¹ waterā€¦Ā² county statiā€¦Ā³ data_ā€¦ā“ data_ā€¦āµ waterā€¦ā¶ gnis_id streaā€¦ā· abbrev
#>      <int>   <int> <chr>  <chr>   <chr>   <chr>   <chr>   <chr>     <dbl> <chr> 
#>  1       1       5 BOULDā€¦ "CLOUGā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   NA    05005ā€¦
#>  2       1       6 BOULDā€¦ "ANDERā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   23.6  ANDDIā€¦
#>  3       1       6 BOULDā€¦ "ANDREā€¦ DWR     Co. Diā€¦ SOUTH ā€¦ 001809ā€¦    1.5  ANFDIā€¦
#>  4       1       6 BOULDā€¦ "BASELā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   19.2  BASOUā€¦
#>  5       1       6 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ BOULDEā€¦ 001783ā€¦   15.5  BCSCBā€¦
#>  6       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ LEFT Hā€¦ 001782ā€¦    8.66 BFCINā€¦
#>  7       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   31.7  BFCLYā€¦
#>  8       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   31.7  BFCLYā€¦
#>  9       1       5 BOULDā€¦ "LYONSā€¦ DWR     Co. Diā€¦ SOUTH ā€¦ 001782ā€¦    0.03 BHNPRā€¦
#> 10       1       6 BOULDā€¦ "BOULDā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   22.3  BLDLHā€¦
#> # ā€¦ with 100 more rows, 25 more variables: usgs_station_id <chr>,
#> #   station_status <chr>, station_type <chr>, structure_type <chr>,
#> #   meas_date_time <dttm>, parameter <chr>, stage <dbl>, meas_value <dbl>,
#> #   units <chr>, flag_a <chr>, flag_b <chr>, contr_area <dbl>,
#> #   drain_area <dbl>, huc10 <chr>, utm_x <dbl>, utm_y <dbl>, latitude <dbl>,
#> #   longitude <dbl>, location_accuracy <chr>, wdid <chr>, modified <chr>,
#> #   more_information <chr>, station_por_start <dttm>, station_por_end <dttm>, ā€¦


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.

# 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
  )
#> Retrieving telemetry station data
#> Location search: 
#> Latitude: 40.0843975
#> Longitude: -105.345242774525
#> Radius (miles): 15
#> # A tibble: 108 Ɨ 35
#>    divisā€¦Ā¹ waterā€¦Ā² county statiā€¦Ā³ data_ā€¦ā“ data_ā€¦āµ waterā€¦ā¶ gnis_id streaā€¦ā· abbrev
#>      <int>   <int> <chr>  <chr>   <chr>   <chr>   <chr>   <chr>     <dbl> <chr> 
#>  1       1       5 BOULDā€¦ "CLOUGā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   NA    05005ā€¦
#>  2       1       6 BOULDā€¦ "ANDERā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   23.6  ANDDIā€¦
#>  3       1       6 BOULDā€¦ "ANDREā€¦ DWR     Co. Diā€¦ SOUTH ā€¦ 001809ā€¦    1.5  ANFDIā€¦
#>  4       1       6 BOULDā€¦ "BASELā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   19.2  BASOUā€¦
#>  5       1       6 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ BOULDEā€¦ 001783ā€¦   15.5  BCSCBā€¦
#>  6       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ LEFT Hā€¦ 001782ā€¦    8.66 BFCINā€¦
#>  7       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   31.7  BFCLYā€¦
#>  8       1       5 BOULDā€¦ "BOULDā€¦ NCWCD   Northeā€¦ SAINT ā€¦ 002050ā€¦   31.7  BFCLYā€¦
#>  9       1       5 BOULDā€¦ "LYONSā€¦ DWR     Co. Diā€¦ SOUTH ā€¦ 001782ā€¦    0.03 BHNPRā€¦
#> 10       1       6 BOULDā€¦ "BOULDā€¦ DWR     Co. Diā€¦ BOULDEā€¦ 001783ā€¦   22.3  BLDLHā€¦
#> # ā€¦ with 98 more rows, 25 more variables: usgs_station_id <chr>,
#> #   station_status <chr>, station_type <chr>, structure_type <chr>,
#> #   meas_date_time <dttm>, parameter <chr>, stage <dbl>, meas_value <dbl>,
#> #   units <chr>, flag_a <chr>, flag_b <chr>, contr_area <dbl>,
#> #   drain_area <dbl>, huc10 <chr>, utm_x <dbl>, utm_y <dbl>, latitude <dbl>,
#> #   longitude <dbl>, location_accuracy <chr>, wdid <chr>, modified <chr>,
#> #   more_information <chr>, station_por_start <dttm>, station_por_end <dttm>, ā€¦

This gif highlights the masking process that happens when the aoi argument is given a polygon




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
2 get_structures_stage_ts() Returns list of stage/volume records based on WDID structures/divrec/stagevolume
3 get_climate_ts() Returns Climate Station Time Series (day, month, year) climatedata/climatestationts
4 get_gw_wl_wellmeasures() Returns Groundwater Measurements groundwater/waterlevels/wellmeasurements
5 get_sw_ts() Returns Surface Water Time Series surfacewater/surfacewaterts
6 get_telemetry_ts() Returns telemetry time series data (raw, hour, day) telemetrystations/telemetrytimeseries
7 get_parceluse_ts() Returns list of Parcel Use Time Series structures/parcelusets

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.


The function below returns a dataframe of daily discharge for the ā€œANDDITCOā€ site between 2015-2022.

# 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 
                               )
#> Retrieving telemetry station time series data (day - DISCHRG)
#> # A tibble: 572 Ɨ 11
#>    abbrev   parameter meas_date    meas_ā€¦Ā¹ meas_ā€¦Ā² flag_a flag_b meas_ā€¦Ā³ modifā€¦ā“
#>    <chr>    <chr>     <chr>          <dbl> <chr>   <chr>  <chr>    <int> <chr>  
#>  1 ANDDITCO DISCHRG   2020-05-07 ā€¦    3.05 cfs     O      <NA>        33 2020-0ā€¦
#>  2 ANDDITCO DISCHRG   2020-05-08 ā€¦    3.04 cfs     O      <NA>        96 2020-0ā€¦
#>  3 ANDDITCO DISCHRG   2020-05-09 ā€¦    2.98 cfs     O      <NA>        96 2020-0ā€¦
#>  4 ANDDITCO DISCHRG   2020-05-10 ā€¦    2.95 cfs     O      <NA>        96 2020-0ā€¦
#>  5 ANDDITCO DISCHRG   2020-05-11 ā€¦    2.95 cfs     O      <NA>        96 2020-0ā€¦
#>  6 ANDDITCO DISCHRG   2020-05-12 ā€¦    2.95 cfs     O      <NA>        96 2020-0ā€¦
#>  7 ANDDITCO DISCHRG   2020-05-13 ā€¦    2.95 cfs     O      <NA>        96 2020-0ā€¦
#>  8 ANDDITCO DISCHRG   2020-05-14 ā€¦    2.95 cfs     O      <NA>         9 2020-0ā€¦
#>  9 ANDDITCO DISCHRG   2020-05-15 ā€¦    2.95 cfs     O      <NA>        63 2020-0ā€¦
#> 10 ANDDITCO DISCHRG   2020-05-16 ā€¦    2.95 cfs     O      <NA>        96 2020-0ā€¦
#> # ā€¦ with 562 more rows, 2 more variables: datetime <dttm>, timescale <chr>, and
#> #   abbreviated variable names Ā¹ā€‹meas_value, Ā²ā€‹meas_unit, Ā³ā€‹meas_count, ā“ā€‹modified



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.)

# 1. Executing a spatial search
structures <- cdssr::get_structures(
  aoi    = c(-105.3578, 40.09244),
  radius = 5
)
#> Retreiving administrative structures
#> Location search: 
#> Latitude: 40.09244
#> Longitude: -105.3578
#> Radius (miles): 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"
                        )
#> Retrieving monthly diversion data
#> # A tibble: 495 Ɨ 12
#>    wdid  waterā€¦Ā¹ wc_idā€¦Ā² meas_ā€¦Ā³ meas_ā€¦ā“ data_ā€¦āµ data_ā€¦ā¶ meas_ā€¦ā· obs_cā€¦āø approā€¦ā¹
#>    <chr>   <int> <chr>   <chr>     <int> <chr>     <dbl> <chr>   <chr>   <chr>  
#>  1 0500ā€¦  1.05e7 050056ā€¦ Daily        18 1992-04    165. ACFT    U       Approvā€¦
#>  2 0500ā€¦  1.05e7 050056ā€¦ Daily        31 1992-05    745. ACFT    U       Approvā€¦
#>  3 0500ā€¦  1.05e7 050056ā€¦ Daily        30 1992-06    430. ACFT    U       Approvā€¦
#>  4 0500ā€¦  1.05e7 050056ā€¦ Daily        31 1992-07    372. ACFT    U       Approvā€¦
#>  5 0500ā€¦  1.05e7 050056ā€¦ Daily        31 1992-08    611. ACFT    U       Approvā€¦
#>  6 0500ā€¦  1.05e7 050056ā€¦ Daily        29 1992-09    315. ACFT    U       Approvā€¦
#>  7 0500ā€¦  1.05e7 050056ā€¦ Daily        29 1992-10    120. ACFT    U       Approvā€¦
#>  8 0500ā€¦  1.05e7 050056ā€¦ Daily        25 2004-04    244. ACFT    U       Approvā€¦
#>  9 0500ā€¦  1.05e7 050056ā€¦ Daily        40 2004-05    699. ACFT    U       Approvā€¦
#> 10 0500ā€¦  1.05e7 050056ā€¦ Daily        25 2004-06    294. ACFT    U       Approvā€¦
#> # ā€¦ with 485 more rows, 2 more variables: modified <chr>, datetime <date>, and
#> #   abbreviated variable names Ā¹ā€‹water_class_num, Ā²ā€‹wc_identifier,
#> #   Ā³ā€‹meas_interval, ā“ā€‹meas_count, āµā€‹data_meas_date, ā¶ā€‹data_value, ā·ā€‹meas_units,
#> #   āøā€‹obs_code, ā¹ā€‹approval_status




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
2 get_gw_wl_wells() api/v2/groundwater/waterlevels/wells
3 get_gw_gplogs_wells() api/v2/groundwater/geophysicallogs/wells
4 get_gw_gplogs_geologpicks() api/v2/groundwater/geophysicallogs/geoplogpicks

Here we will retrieve groundwater well measurement data for Well ID 1274 between 1990-2022.

# 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"
  )
#> Retrieving groundwater well measurements
#> # A tibble: 1,469 Ɨ 18
#>    well_id well_name      divisā€¦Ā¹ waterā€¦Ā² county managā€¦Ā³ desigā€¦ā“ publiā€¦āµ measuā€¦ā¶
#>      <int> <chr>            <int>   <int> <chr>  <lgl>   <lgl>   <chr>   <chr>  
#>  1    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1990-0ā€¦
#>  2    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1990-1ā€¦
#>  3    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1991-0ā€¦
#>  4    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1991-1ā€¦
#>  5    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1992-0ā€¦
#>  6    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1992-0ā€¦
#>  7    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1992-1ā€¦
#>  8    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1993-0ā€¦
#>  9    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1993-1ā€¦
#> 10    1274 LSP-020  03N6ā€¦       1       2 WELD   NA      NA      LOWER ā€¦ 1994-0ā€¦
#> # ā€¦ with 1,459 more rows, 9 more variables: depth_to_water <dbl>,
#> #   measuring_point_above_land_surface <dbl>,
#> #   depth_water_below_land_surface <dbl>, elevation_of_water <dbl>,
#> #   delta <dbl>, data_source <chr>, published <chr>, modified <chr>,
#> #   datetime <dttm>, and abbreviated variable names Ā¹ā€‹division, Ā²ā€‹water_district,
#> #   Ā³ā€‹management_district, ā“ā€‹designated_basin, āµā€‹publication, ā¶ā€‹measurement_date




About

R šŸ“¦ for exploring and requesting resources from the CDSS REST API.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages