From 44e8b879df18edef8b92f722a9ec4677640b7f45 Mon Sep 17 00:00:00 2001 From: Dan Buchholz Date: Thu, 22 Feb 2024 16:39:06 -0800 Subject: [PATCH] refactor: alter chart x-axis; sci notation for precip; incr event limit --- basin_wxm/fetch.py | 2 +- basin_wxm/run.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/basin_wxm/fetch.py b/basin_wxm/fetch.py index a402844..d2f1cc3 100644 --- a/basin_wxm/fetch.py +++ b/basin_wxm/fetch.py @@ -82,7 +82,7 @@ def get_vault_events(vault: str, start: int | None, end: int | None) -> List[Dic # objects that contain the CID and other metadata try: url = f"https://basin.tableland.xyz/vaults/{vault}/events" - params = {"after": start, "before": end, "limit": 50} + params = {"after": start, "before": end, "limit": 1000} response = get(url, params) if response.status_code == 200: diff --git a/basin_wxm/run.py b/basin_wxm/run.py index 556d398..9249232 100644 --- a/basin_wxm/run.py +++ b/basin_wxm/run.py @@ -382,11 +382,14 @@ def write_history_plots(root: Path, exclude_cols: List[str]) -> None: plt.ylabel(col) # Set date format on x-axis plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%d")) - plt.gca().xaxis.set_major_locator(mdates.DayLocator()) + plt.gca().xaxis.set_major_locator(mdates.DayLocator(interval=7)) plt.gcf().autofmt_xdate() - # Format y-axis to use fixed-point notation with one decimal + # Format y-axis to use fixed-point notation with two decimals ax = plt.gca() # Get the current axis - ax.yaxis.set_major_formatter(ticker.FormatStrFormatter("%.2f")) + if col == "total_precipitation": + ax.yaxis.set_major_formatter(ticker.FormatStrFormatter("%.2e")) + else: + ax.yaxis.set_major_formatter(ticker.FormatStrFormatter("%.2f")) plt.grid(True) # Ensure the directory exists