Skip to contents

Loads one or more catchment attribute files and merges them by gauge_id. High-performance implementation using 'arrow' and 'collapse'.

Usage

load_pe_attributes(
  attributes = "all",
  gauge_ids = NULL,
  variables = NULL,
  path = get_camels_pe_path()
)

Arguments

attributes

Character vector. The attribute groups to load. Can be any combination of "topographic", "climatic", "geologic", "soil", "landcover", "intervention", and "signatures", or "all" (default) to load and merge all attribute tables. Aliases "hydrological" (for "signatures") and "human_intervention" (for "intervention") are also supported.

gauge_ids

Character vector. Optional gauge identifiers to filter the returned attributes. If NULL, attributes for all catchments are returned.

variables

Character vector or NULL. Optional variable names to retain in the returned table. If NULL, all variables in the selected attribute groups are returned.

path

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

Value

A data.frame containing the merged catchment attributes with gauge_id as primary identifier.

Details

CAMELS-PE v1.0.1 documents 79 attributes in seven thematic tables. Hydrological signatures are derived from simulated streamflow, not observations.

Examples

# Load all attributes merged
attrs_all <- load_pe_attributes()
head(attrs_all)
#>      gauge_id      area perimeter elev_min elev_max elev_mean elev_median
#> 1 PE_472A9204  9187.868   283.757  2762.00  6317.23  4210.225    4215.969
#> 2   PE_210003  2008.790   230.042  4311.50  6030.24  4659.078    4620.180
#> 3   PE_204617 13224.802  1958.796   685.17  6414.83  4213.036    4495.940
#> 4 PE_472935F2  9576.154    98.688  2144.00  6317.23  4196.945    4207.877
#> 5   PE_210406  2867.025   163.709  3825.50  5425.87  4467.149    4451.980
#> 6   PE_270503   390.800   148.869  3825.43  4616.46  3990.867    3953.976
#>   slope_mean p_mean pet_mean aridity p_seasonality high_prec_freq high_prec_dur
#> 1     11.325  2.297    3.364   1.465         0.990          7.111         1.382
#> 2     17.753  1.842    2.907   1.578         0.980          7.778         1.354
#> 3     12.651  1.503    3.643   2.423         0.934         19.556         2.002
#> 4     11.486  2.302    3.349   1.455         0.991          6.583         1.375
#> 5      3.240  2.058    3.349   1.627         0.960         16.389         1.436
#> 6      3.965  2.181    3.187   1.462         0.954         17.250         1.543
#>   high_prec_timing low_prec_freq low_prec_dur low_prec_timing geol_class_1st
#> 1              DJF       189.500        7.335             JJA             ss
#> 2              DJF       197.833        6.410             JJA             sm
#> 3              DJF       258.417       14.002             JJA             vi
#> 4              DJF       187.417        7.158             JJA             ss
#> 5              DJF       229.750        9.406             JJA             vi
#> 6              DJF       228.194        8.077             JJA             su
#>   geol_class_1st_perc geol_class_2nd geol_class_2nd_perc inter_volca_rocks_perc
#> 1               26.97             sm               23.01                   1.23
#> 2               49.60             su               25.36                   0.76
#> 3               69.49             sm               11.64                  69.49
#> 4               27.47             sm               22.07                   1.18
#> 5               61.61             su               18.62                  61.61
#> 6               44.80             sc               25.86                  11.47
#>   geol_porosity geol_permeability inceptisols_perc entisols_perc alfisols_perc
#> 1         0.105           -13.973            78.17         13.49          7.65
#> 2         0.026           -11.691            81.39          5.45         11.66
#> 3         0.067           -13.364            54.86         43.21          1.66
#> 4         0.104           -13.996            78.64         13.30          7.38
#> 5         0.080           -12.461            83.85         13.56          2.54
#> 6         0.060           -11.919            81.11          0.21         18.26
#>   ultisols_perc aridisols_perc gelisols_perc oxisols_perc mollisols_perc
#> 1          0.37           0.24          0.07         0.02              0
#> 2          1.50           0.00          0.00         0.00              0
#> 3          0.00           0.24          0.03         0.00              0
#> 4          0.37           0.23          0.06         0.02              0
#> 5          0.02           0.04          0.00         0.00              0
#> 6          0.38           0.01          0.01         0.01              0
#>   vertisols_perc soil_dominant_class agricul_perc forest_perc non_veget_perc
#> 1              0    inceptisols_perc       20.467       1.389          1.178
#> 2              0    inceptisols_perc        0.000       0.050          0.885
#> 3              0    inceptisols_perc        6.850       1.373          7.609
#> 4              0    inceptisols_perc       19.801       1.876          1.153
#> 5              0    inceptisols_perc       11.748       0.000          0.188
#> 6              0    inceptisols_perc       61.399       0.000          0.000
#>   non_woody_perc water_perc non_forest_perc non_identi_perc land_dominant_class
#> 1         74.524      2.442               0               0      non_woody_perc
#> 2         96.262      2.803               0               0      non_woody_perc
#> 3         83.392      0.776               0               0      non_woody_perc
#> 4         74.783      2.387               0               0      non_woody_perc
#> 5         84.349      3.715               0               0      non_woody_perc
#> 6         38.601      0.000               0               0   agricul_perc_perc
#>   surface_adh_n surface_adh_vol surface_adh_use groundwater_adh_n
#> 1             0               0            None                 0
#> 2             0               0            None                 0
#> 3             0               0            None                 5
#> 4             0               0            None                 0
#> 5             0               0            None                 0
#> 6             0               0            None                 2
#>   groundwater_adh_vol groundwater_adh_use reservoir_n reservoir_vol
#> 1               0.000                None          48       498.123
#> 2               0.000                None           0            NA
#> 3               0.038        Agricultural          20       505.876
#> 4               0.000                None          48       498.123
#> 5               0.000                None           1       800.000
#> 6               0.038            Domestic           0            NA
#>   reservoir_use q_mean runoff_ratio stream_elas baseflow_index slope_fdc
#> 1    Irrigation  0.933        0.406       1.386          0.674     1.128
#> 2          None  0.488        0.265       3.646          0.504     2.646
#> 3    Irrigation  0.406        0.270       1.562          0.670     0.813
#> 4    Irrigation  1.081        0.469       1.404          0.648     1.497
#> 5 Multi_purpose  0.699        0.340       1.660          0.420     1.973
#> 6          None  0.294        0.135       2.665          0.362     1.344
#>   hfd_mean    Q5   Q95 high_q_freq high_q_dur low_q_freq low_q_dur zero_q_freq
#> 1  170.730 0.251 2.762       1.889      4.500      7.556    11.405           0
#> 2  158.595 0.006 3.050      38.333     20.459    163.056    63.034           0
#> 3  185.973 0.112 1.385       9.222      9.553      5.722    45.444           0
#> 4  171.216 0.272 3.394       1.750      4.115      0.889     4.000           0
#> 5  176.811 0.028 3.271      40.583     15.033    133.472    23.276           0
#> 6  188.541 0.022 1.360      29.889     11.189    120.444    18.749           0

# Load only topographic and climatic attributes
attrs_sub <- load_pe_attributes(c("topographic", "climatic"))
head(attrs_sub)
#>      gauge_id      area perimeter elev_min elev_max elev_mean elev_median
#> 1 PE_472A9204  9187.868   283.757  2762.00  6317.23  4210.225    4215.969
#> 2   PE_210003  2008.790   230.042  4311.50  6030.24  4659.078    4620.180
#> 3   PE_204617 13224.802  1958.796   685.17  6414.83  4213.036    4495.940
#> 4 PE_472935F2  9576.154    98.688  2144.00  6317.23  4196.945    4207.877
#> 5   PE_210406  2867.025   163.709  3825.50  5425.87  4467.149    4451.980
#> 6   PE_270503   390.800   148.869  3825.43  4616.46  3990.867    3953.976
#>   slope_mean p_mean pet_mean aridity p_seasonality high_prec_freq high_prec_dur
#> 1     11.325  2.297    3.364   1.465         0.990          7.111         1.382
#> 2     17.753  1.842    2.907   1.578         0.980          7.778         1.354
#> 3     12.651  1.503    3.643   2.423         0.934         19.556         2.002
#> 4     11.486  2.302    3.349   1.455         0.991          6.583         1.375
#> 5      3.240  2.058    3.349   1.627         0.960         16.389         1.436
#> 6      3.965  2.181    3.187   1.462         0.954         17.250         1.543
#>   high_prec_timing low_prec_freq low_prec_dur low_prec_timing
#> 1              DJF       189.500        7.335             JJA
#> 2              DJF       197.833        6.410             JJA
#> 3              DJF       258.417       14.002             JJA
#> 4              DJF       187.417        7.158             JJA
#> 5              DJF       229.750        9.406             JJA
#> 6              DJF       228.194        8.077             JJA

# Load attributes for specific stations
attrs_sel <- load_pe_attributes(gauge_ids = c("PE_110139", "PE_111151"))
attrs_sel
#>    gauge_id     area perimeter elev_min elev_max elev_mean elev_median
#> 1 PE_110139  360.584  1348.403  3009.65  5292.85  4534.981    4631.856
#> 2 PE_111151 1263.804   887.330   866.67  5294.93  3542.298    3695.919
#>   slope_mean p_mean pet_mean aridity p_seasonality high_prec_freq high_prec_dur
#> 1      3.902  2.062    3.185   1.544         0.952         10.111         1.349
#> 2     22.799  1.504    3.231   2.149         0.960         13.806         1.586
#>   high_prec_timing low_prec_freq low_prec_dur low_prec_timing geol_class_1st
#> 1              DJF       211.944        8.499             JJA             sc
#> 2              DJF       237.639       10.248             JJA             vi
#>   geol_class_1st_perc geol_class_2nd geol_class_2nd_perc inter_volca_rocks_perc
#> 1               62.87             vi               21.48                  21.48
#> 2               61.18             pa               18.50                  61.18
#>   geol_porosity geol_permeability inceptisols_perc entisols_perc alfisols_perc
#> 1         0.087           -12.483            94.43          4.36          1.20
#> 2         0.088           -13.230            71.15         22.95          4.04
#>   ultisols_perc aridisols_perc gelisols_perc oxisols_perc mollisols_perc
#> 1          0.01            0.0          0.00         0.00              0
#> 2          1.48            0.2          0.11         0.07              0
#>   vertisols_perc soil_dominant_class agricul_perc forest_perc non_veget_perc
#> 1              0    inceptisols_perc        1.911       1.827          0.713
#> 2              0    inceptisols_perc       11.382       3.511         13.845
#>   non_woody_perc water_perc non_forest_perc non_identi_perc land_dominant_class
#> 1         95.244      0.305               0               0      non_woody_perc
#> 2         71.132      0.130               0               0      non_woody_perc
#>   surface_adh_n surface_adh_vol surface_adh_use groundwater_adh_n
#> 1             0               0            None                 0
#> 2             0               0            None                 0
#>   groundwater_adh_vol groundwater_adh_use reservoir_n reservoir_vol
#> 1                   0                None           1            NA
#> 2                   0                None          10          27.9
#>   reservoir_use q_mean runoff_ratio stream_elas baseflow_index slope_fdc
#> 1    Irrigation  1.109        0.538       0.819          0.791     0.641
#> 2    Irrigation  0.396        0.263       1.339          0.571     1.466
#>   hfd_mean    Q5   Q95 high_q_freq high_q_dur low_q_freq low_q_dur zero_q_freq
#> 1  180.811 0.395 2.424       0.000         NA      0.000        NA           0
#> 2  180.486 0.037 1.466      13.306      7.831     64.639    22.488           0