Skip to contents

Loads geospatial catchment boundary polygons or gauging station point locations from the CAMELS-PE dataset as sf spatial objects.

Usage

load_pe_geospatial(
  type = c("catchments", "gauges"),
  gauge_ids = NULL,
  path = get_camels_pe_path()
)

Arguments

type

Character string. Either "catchments" to load catchment boundary polygons or "gauges" to load gauge point locations.

gauge_ids

Character vector. Station identifiers to filter the spatial features. If NULL (default), loads all spatial features.

path

Character string. Path to the CAMELS-PE dataset directory. If NULL, retrieved automatically via get_camels_pe_path().

Value

An sf spatial data frame object containing the requested geometries and station attributes.

Examples

# Load all catchment boundaries
catchments <- load_pe_geospatial(type = "catchments")
catchments
#> Simple feature collection with 136 features and 10 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -81.03042 ymin: -17.99042 xmax: -68.56208 ymax: 0.7970833
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>          gauge_id       name                             name_cat       area
#> 1       PE_212500  Agua Azul                       Cuenca Chillón  1962.2939
#> 2     PE_47E0D438     Alamor                         Cuenca Chira  1187.5657
#> 3  PE_30455012121 Amaru Mayu Intercuenca Medio Bajo Madre de Dios 90693.0568
#> 4       PE_117059   Ancoaque                         Cuenca Mauri   358.4666
#> 5       PE_212700  Antapucro                         Cuenca Lurín   950.3986
#> 6     PE_47A00F5E  Antioquia                         Cuenca Lurín   804.6763
#> 7     PE_47A03AC4    Autisha                         Cuenca Rímac   791.6978
#> 8     PE_472501F4     Balsas          Intercuenca Alto Marañón IV 28757.5581
#> 9       PE_240111 Bellavista                          Cuenca Napo 99944.7964
#> 10      PE_221804      Biavo                         Cuenca Biabo  5972.3871
#>     perimeter is_nested downstream_gauge_id upstream_gauge_id nested_group_id
#> 1   283.75668      TRUE                NONE         PE_111151       PE_212500
#> 2   230.04153      TRUE         PE_47E09732              NONE     PE_47E0B1DE
#> 3  1958.79641      TRUE                NONE        PE_1113355  PE_30455012121
#> 4    98.68844      TRUE           PE_117060              NONE       PE_117060
#> 5   163.70873      TRUE                NONE       PE_47A00F5E       PE_212700
#> 6   148.86928      TRUE           PE_212700              NONE       PE_212700
#> 7   148.80524      TRUE         PE_472E24B0              NONE       PE_202906
#> 8  1584.52051      TRUE         PE_472B3006         PE_220201      PE_2401081
#> 9  2561.79191      TRUE          PE_2401081        PE_1113346      PE_2401081
#> 10  504.80493      TRUE           PE_230715              NONE      PE_2401081
#>    nested_group_size                           geom
#> 1                  4 MULTIPOLYGON (((-76.97292 -...
#> 2                  6 MULTIPOLYGON (((-80.38875 -...
#> 3                  2 MULTIPOLYGON (((-69.23042 -...
#> 4                  2 MULTIPOLYGON (((-69.92042 -...
#> 5                  2 MULTIPOLYGON (((-76.60042 -...
#> 6                  2 MULTIPOLYGON (((-76.54542 -...
#> 7                  4 MULTIPOLYGON (((-76.62292 -...
#> 8                 54 MULTIPOLYGON (((-78.35042 -...
#> 9                 54 MULTIPOLYGON (((-73.14875 -...
#> 10                54 MULTIPOLYGON (((-76.52125 -...

# Load specific gauging stations
gauges_sub <- load_pe_geospatial(type = "gauges", gauge_ids = "PE_110139")
gauges_sub
#> Simple feature collection with 1 feature and 13 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -81.021 ymin: -17.974 xmax: -69.125 ymax: -0.917
#> Geodetic CRS:  WGS 84
#>    gauge_id  name latitude longitude   COMID      name_cat     area perimeter
#> 1 PE_110139 Picoy  -10.922   -76.736 9068753 Cuenca Huaura 360.5843   98.0372
#>   is_nested downstream_gauge_id upstream_gauge_id nested_group_id
#> 1      TRUE         PE_4724966C              NONE     PE_4724966C
#>   nested_group_size                    geom
#> 1                 2 POINT (-76.736 -10.922)