Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ API Reference
fetchers/slovenia
fetchers/southafrica
fetchers/spain
fetchers/taiwan
fetchers/uk_ea
fetchers/uk_nrfa
fetchers/usa
fetchers/usa
5 changes: 5 additions & 0 deletions docs/fetchers/taiwan.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Taiwan Fetcher
==============

.. automodule:: rivretrieve.taiwan
:members:
44 changes: 44 additions & 0 deletions examples/download_taiwan_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""Download and plot a short Taiwan discharge series."""

import logging

import matplotlib.pyplot as plt

from rivretrieve import TaiwanFetcher, constants


def main() -> None:
logging.basicConfig(level=logging.INFO)

gauge_id = "1140H099"
variable = constants.DISCHARGE_DAILY_MEAN
start_date = "2024-01-01"
end_date = "2024-01-10"

fetcher = TaiwanFetcher()
data = fetcher.get_data(
gauge_id=gauge_id,
variable=variable,
start_date=start_date,
end_date=end_date,
)

if data.empty:
print(f"No data found for {gauge_id}")
return

print(data.head())

plt.figure(figsize=(12, 6))
plt.plot(data.index, data[variable], marker=".", linestyle="-")
plt.xlabel(constants.TIME_INDEX)
plt.ylabel(f"{variable} (m3/s)")
plt.title(f"Taiwan River Discharge ({gauge_id} - {start_date} to {end_date})")
plt.grid(True)
plt.tight_layout()
plt.savefig("taiwan_discharge_plot.png")
print("Plot saved to taiwan_discharge_plot.png")


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions rivretrieve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .slovenia import SloveniaFetcher
from .southafrica import SouthAfricaFetcher
from .spain import SpainFetcher
from .taiwan import TaiwanFetcher
from .uk_ea import UKEAFetcher
from .uk_nrfa import UKNRFAFetcher
from .usa import USAFetcher
Expand Down
189 changes: 189 additions & 0 deletions rivretrieve/cached_site_data/taiwan_sites.csv

Large diffs are not rendered by default.

Loading
Loading