RcamelsCL

RcamelsCL is an R package that provides functions for downloading spatial and temporal data from the Catchment Attributes and Meteorology for Large Sample Studies, Chile Dataset (CAMELS-CL) https://camels.cr2.cl/. Details of the dataset are provided in https://doi.org/10.5194/hess-22-5817-2018.

Bugs / comments / questions / collaboration of any kind are very welcomed.

A simpler way to work with CAMELS-CL

RcamelsCL is an R package built to make the CAMELS-CL dataset easier to use. For hydrologists, that matters because CAMELS-CL (Alvarez-Garreton et al., 2018) has become a key reference for studying how river basins behave across Chile's wide range of climates and landscapes.

Instead of spending a large amount of time downloading files, reorganizing folders, and cleaning inputs, users can access the CAMELS-CL data through a consistent R workflow designed for research and modelling.

Why CAMELS-CL matters?

CAMELS-CL, short for Catchment Attributes and Meteorology for Large Sample Studies -- Chile, is one of the Chile's main benchmark datasets for large-sample hydrology and comparative catchment analysis.

It brings together the kinds of information researchers need to ask big questions, including:

That broad coverage makes the dataset especially useful for testing hydrological models, comparing catchments, and exploring how geography and climate shape water availability.

What RcamelsCL does?

Developed by Héctor Garcés-Figueroa and Mauricio Zambrano-Bigiarini, within the Kimün-Ko water resources observatory at Universidad de La Frontera, RcamelsCL was designed to support reproducible scientific workflows end-to-end.

RcamelsCL gives users a reliable way to:

The result is straightforward: less time spent preparing data, and more time spent on model development, hypothesis testing, and hydrological analysis.

Why direct access to raw data is important?

One of the package's strongest features is that it preserves the original dataset exactly as published. RcamelsCL provides access to the raw source CAMELS-CL data without changing its content.

That matters for public trust in science as much as for technical work. When researchers can trace their inputs back to the original repository, it becomes easier to check methods, compare results, and repeat studies with confidence.

This kind of transparency is especially valuable for:

For students, it lowers the barrier to working with real hydrological data. For practitioners, it offers a dependable entry point into one of the most comprehensive catchment datasets available for Chile.

The bigger picture

Hydrology increasingly depends on tools that are not just accurate, but also transparent, repeatable, and efficient. RcamelsCL addresses a basic but important bottleneck: reproducible data access.

By making CAMELS-CL easier to download, organise, and use without altering the original records, the package gives researchers a stronger foundation for data-driven hydrology in Chile. That is a practical contribution with wide reach, from classroom exercises to large-scale environmental assessments.

How to cite it?

FAQs

What is RcamelsCL?

RcamelsCL is an R package that gives users direct, organised access to the CAMELS-CL hydrology dataset for Chile. It helps researchers handle catchment attributes and hydrometeorological time series without building their own data-access pipeline from scratch.

Why is CAMELS-CL important for hydrology?

CAMELS-CL is a benchmark dataset used to compare river basins across different climates and landscapes in Chile. It supports large-sample studies, model testing, and regional analysis by bringing together consistent catchment and meteorological information.

Does RcamelsCL modify the original data?

No. A central feature of RcamelsCL is that it preserves the original raw data as provided by the official repository. That improves transparency, traceability, and reproducibility in scientific work.

Who should use RcamelsCL?

The package is useful for researchers, students, and practitioners working in hydrology, environmental science, and water resources. It is especially helpful for anyone who wants a reliable, reproducible way to use Chilean catchment data in teaching, modelling, or comparative analysis.

Additional info:

     library(RcamelsCL)

     ###############
     # Example 1: Getting only daily time series data for the 'Rio Trancura Antes Rio Llafenco'
     #            catchment
     ###############
     x1 <- getData(9414001)
     head(x1)
     
     ###############
     # Example 2: Getting only daily time series of P [mm/day], Tmin [degC], Tavg [degC],
     #            Tmax [degC], PET [mm/day] and Q [mm/day] data for the 'Rio Trancura Antes 
     #            Rio Llafenco' catchment
     ###############
     var.names <- c("P_mm_day", "Tmin_degC_day", "Tavg_degC_day", 
                    "Tmax_degC_day", "PET_mm_day", "Qobs_mm_day")
     x2 <- getData(9414001)
     x2 <- x2[, var.names]
     names(x2) <- c("P", "Tmin", "Tavg", "Tmax", "PET", "Q")
     
     ###############
     # Example 3: Getting only daily time series and catchment borders data for the 
     #            'Rio Trancura Antes Rio Llafenco' catchment
     ###############
     x3 <- getData(9414001, include.shp=TRUE)
     terra::plot(x3[["CatchmentBorders"]])
     
     ###############
     # Example 4: Getting only daily time series and catchment attributes data for the 
     #            'Rio Trancura Antes Rio Llafenco' catchment
     ###############
     x4 <- getData(9414001, include.attr=TRUE) 
     head(x4[["CatchmentAttributes"]])
     
     ###############
     # Example 5: Getting daily time series, catchment borders and catchment attributes data for the 
     #            'Rio Trancura Antes Rio Llafenco' catchment
     ###############
     x5 <- getData(9414001, include.shp=TRUE, include.attr=TRUE) 
     head(x5[["CatchmentTS"]])
     terra::plot(x5[["CatchmentBorders"]])

     ###############
     # Example 6: Getting daily time series, catchment borders, catchment attributes and additional
     #            precipitation datasets for the 'Rio Trancura Antes Rio Llafenco' catchment
     ###############
     x6 <- getData(9414001, include.shp=TRUE, include.attr=TRUE,
                   include.extra.P=TRUE)
     head(x6[["CatchmentTS"]])
     terra::plot(x6[["CatchmentBorders"]])
     head(x6[["CatchmentAttributes"]])
     
     ###############
     # Example 7: Getting only monthly time series data for the 'Rio Trancura Antes Rio Llafenco'
     #            catchment
     ###############
     x7 <- getData(9414001, tscale="monthly")
     head(x7)
     
     ###############
     # Example 8: Getting only annual time series data for the 'Rio Trancura Antes Rio Llafenco'
     #            catchment
     ###############
     x8 <- getData(9414001, tscale="annual")
     head(x8)
     
     ###############
     # Example 9: Getting only annual time series data between 2008 and 2015 for the
     #            'Rio Trancura Antes Rio Llafenco' catchment
     ###############
     x9 <- getData(9414001, tscale="annual", from = as.Date("2008-01-01"),
                   to = as.Date("2015-12-31"))
     head(x9)
     
     ###############
     # Example 10: Getting only monthly time series data for the 'Rio Mapocho en Los Almendros'
     #             and 'Rio Trancura Antes Rio Llafenco' catchments
     ###############
     
     target.ids <- c(5722002, 9414001)
     nelements  <- length(target.ids)
     x10 <- vector(mode = "list", length = nelements)
     
     for (i in seq_len(nelements)) {
       x10[[i]] <- getData(target.ids[[i]], tscale="monthly")
     }
     str(x10)

Installation

Installing the latest stable version from CRAN:

install.packages("RcamelsCL")

Alternatively, you can also try the under-development version from GitLab:

# Using devtools
if (!require(devtools)) install.packages("devtools")
devtools::install_gitlab("hgarcesf/RcamelsCL")

# Using remotes
if (!require(remotes)) install.packages("remotes")
remotes::install_gitlab("hgarcesf/RcamelsCL")

Reporting bugs, requesting new features

If you find an error in some function, or want to report a typo in the documentation, or to request a new feature (and wish it be implemented :) you can do it here

See Also