Skip to content

CAMELS-SE

Overview

CAMELS-SE is the Sweden hydrological dataset implementation. Swedish CAMELS dataset for Scandinavian catchments.

Dataset Information

  • Region: Sweden
  • Module: hydrodataset.camels_se
  • Class: CamelsSe

Features

Static Attributes

Static catchment attributes include: - Basin area - Mean precipitation - Topographic characteristics - Land cover information - Soil properties - Climate indices

Dynamic Variables

Timeseries variables available (varies by dataset): - Streamflow - Precipitation - Temperature (min, max, mean) - Potential evapotranspiration - Solar radiation - And more...

Usage

Basic Usage

 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
from hydrodataset.camels_se import CamelsSe
from hydrodataset import SETTING

# Initialize dataset
data_path = SETTING["local_data_path"]["datasets-origin"]
ds = CamelsSe(data_path)

# Get basin IDs
basin_ids = ds.read_object_ids()
print(f"Number of basins: {len(basin_ids)}")

# Check available features
print("Static features:", ds.available_static_features)
print("Dynamic features:", ds.available_dynamic_features)

# Read timeseries data
timeseries = ds.read_ts_xrdataset(
    gage_id_lst=basin_ids[:5],
    t_range=ds.default_t_range,
    var_lst=["streamflow", "precipitation"]
)
print(timeseries)

# Read attribute data
attributes = ds.read_attr_xrdataset(
    gage_id_lst=basin_ids[:5],
    var_lst=["area", "p_mean"]
)
print(attributes)

Reading Specific Variables

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Read with specific time range
ts_data = ds.read_ts_xrdataset(
    gage_id_lst=basin_ids[:10],
    t_range=["1990-01-01", "1995-12-31"],
    var_lst=["streamflow", "precipitation", "temperature_mean"]
)

# Read basin area
areas = ds.read_area(gage_id_lst=basin_ids[:10])

# Read mean precipitation
mean_precip = ds.read_mean_prcp(gage_id_lst=basin_ids[:10])

Data Sources

The dataset supports multiple data sources for certain variables. Check the class documentation for available sources and use tuple notation to specify:

1
2
3
4
5
6
7
8
9
# Request specific data source
ts_data = ds.read_ts_xrdataset(
    gage_id_lst=basin_ids[:5],
    t_range=["1990-01-01", "1995-12-31"],
    var_lst=[
        ("precipitation", "era5land"),  # Specify ERA5-Land source
        "streamflow"  # Use default source
    ]
)

API Reference

hydrodataset.camels_se.CamelsSe

Bases: HydroDataset

CAMELS_SE dataset class extending RainfallRunoff.

This class provides access to the CAMELS_SE dataset, which contains hourly hydrological and meteorological data for various watersheds.

Attributes:

Name Type Description
region

Geographic region identifier

download

Whether to download data automatically

ds_description

Dictionary containing dataset file paths

Source code in hydrodataset/camels_se.py
 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
class CamelsSe(HydroDataset):
    """CAMELS_SE dataset class extending RainfallRunoff.

    This class provides access to the CAMELS_SE dataset, which contains hourly
    hydrological and meteorological data for various watersheds.

    Attributes:
        region: Geographic region identifier
        download: Whether to download data automatically
        ds_description: Dictionary containing dataset file paths
    """

    def __init__(
        self, data_path: str, region: Optional[str] = None, download: bool = False
    ) -> None:
        """Initialize CAMELS_SE dataset.

        Args:
            data_path: Path to the CAMELS_SE data directory
            region: Geographic region identifier (optional)
            download: Whether to download data automatically (default: False)
        """
        super().__init__(data_path)
        self.region = region
        self.download = download
        self.aqua_fetch = CAMELS_SE(data_path)

    @property
    def _attributes_cache_filename(self):
        return "camels_se_attributes.nc"

    @property
    def _timeseries_cache_filename(self):
        return "camels_se_timeseries.nc"

    @property
    def default_t_range(self):
        return ["1961-01-01", "2020-12-31"]

    # get the information of features from dataset file"Documentation_2024-01-02.pdf"
    _subclass_static_definitions = {
        "p_mean": {"specific_name": "pmean_mm_year", "unit": "mm/year"},
        "area": {"specific_name": "area_km2", "unit": "km^2"},
    }

    _dynamic_variable_mapping = {
        StandardVariable.STREAMFLOW: {
            "default_source": "obs_cms",
            "sources": {
                "obs_cms": {"specific_name": "q_cms_obs", "unit": "m^3/s"},
                "obs_mm": {"specific_name": "q_mm_obs", "unit": "mm/day"},
            },
        },
        StandardVariable.PRECIPITATION: {
            "default_source": "default",
            "sources": {
                "default": {"specific_name": "pcp_mm", "unit": "mm/day"},
            },
        },
        StandardVariable.TEMPERATURE_MEAN: {
            "default_source": "default",
            "sources": {
                "default": {"specific_name": "airtemp_C_mean", "unit": "°C"},
            },
        },
    }

default_t_range property

__init__(data_path, region=None, download=False)

Initialize CAMELS_SE dataset.

Parameters:

Name Type Description Default
data_path str

Path to the CAMELS_SE data directory

required
region Optional[str]

Geographic region identifier (optional)

None
download bool

Whether to download data automatically (default: False)

False
Source code in hydrodataset/camels_se.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def __init__(
    self, data_path: str, region: Optional[str] = None, download: bool = False
) -> None:
    """Initialize CAMELS_SE dataset.

    Args:
        data_path: Path to the CAMELS_SE data directory
        region: Geographic region identifier (optional)
        download: Whether to download data automatically (default: False)
    """
    super().__init__(data_path)
    self.region = region
    self.download = download
    self.aqua_fetch = CAMELS_SE(data_path)