# Raw datasets (https://nolantw.github.io/cwa/en/advanced/datasets/)

When you need fields or query parameters the SDK does not cover, read the dataset by its ID; the SDK still handles the API key, retries and caching.

Dataset IDs and their parameters are listed in the [CWA API documentation](https://opendata.cwa.gov.tw/dist/opendata-swagger.html).

## Reading JSON

```python
from cwa import datasets

rain = datasets.get("O-A0002-001")  # rain gauge stations
sunrise = datasets.get("A-B0062-001", params={"CountyName": "臺北市"})
```

`get()` returns parsed JSON: data made of `dict`, `list`, strings and numbers, structured as in the CWA documentation.

`params` holds the CWA API query parameters described for each dataset. The SDK adds the API key itself; putting it in `params` raises `ValueError`.

## Reading raw content

For XML or another format, use `raw()` to get the unprocessed bytes:

```python
xml = datasets.raw("W-C0034-001", params={"format": "XML"})
```

`get()` handles only JSON; use `raw()` for any other format.

## Validated forecast datasets

The township forecast datasets also have descriptor objects. Passing a descriptor to `get()` validates the response against its structure and returns typed objects instead of JSON:

```python
from cwa import County, datasets

three_day, one_week = datasets.COUNTY_FORECASTS[County.TAIPEI]
forecast = datasets.get(three_day)
print(forecast.records.locations[0].name)
```

| Descriptor | Dataset |
| --- | --- |
| `datasets.COUNTY_FORECASTS[county]` | That county's (three-day, one-week) forecasts |
| `datasets.NATIONWIDE_TOWNSHIP_3_DAY` | Three-day forecasts for every township |
| `datasets.NATIONWIDE_TOWNSHIP_7_DAY` | One-week forecasts for every township |

[Forecasts](/en/guides/forecast) covers normal use; reach for these descriptors when you need forecast elements the SDK does not summarize.

## Several at once

Pass a list to request them simultaneously and get results keyed by dataset:

```python
results = datasets.get(["O-A0002-001", "O-A0003-001"])
rain = results["O-A0002-001"]
```