From 7a07481162d2ca407e96e6066af8715359729e1a Mon Sep 17 00:00:00 2001 From: madsCodeBuddy Date: Wed, 29 Apr 2026 05:53:51 +0000 Subject: [PATCH 1/2] Add make build-docs target; fix build_explorer.py end-to-end - Makefile: new 'build-docs' target that regenerates all three docs/*.html artifacts from build_desert_farm.py, build_desert_farm_summary.py, and build_explorer.py. - docs/build_explorer.py: two latent bugs that surfaced when attempting to actually run the script end-to-end: (1) Default CSV path was 'data/local_data/time_space_reference_objects.csv' but the canonical file moved to 'data/datasets/' during the data reorg. Updated default to point at canonical location. (2) Ellipse coord assignment was missing the .rename(columns={0: 'x_coords', 1: 'y_coords'}) step that etl.transform_process_response_sheet uses; without it, pandas alignment fails and ellipse rows get NaN coords, causing AttributeError downstream. Added the rename to mirror the etl.py pattern. - docs/*.html: regenerated via 'make build-docs' to verify the target works end-to-end. Note: regenerated explorer.html is 688KB vs the prior 880KB committed file (213 -> 159 coord lists). The script now runs cleanly but visual verification is recommended; the size difference may indicate the prior file was generated under different conditions (older CSV, different package version, etc). --- Makefile | 12 +++++++++++- docs/build_explorer.py | 10 ++++++---- docs/desert_farm_stommel.html | 6 +++--- docs/desert_farm_summary.html | 6 +++--- docs/explorer.html | 6 +++--- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 3a3c4d3..63a26fc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VENV := /tmp/ts-build-test DIST := dist -.PHONY: help build test test-package clean lint publish-test publish +.PHONY: help build test test-package build-docs clean lint publish-test publish help: ## Show this help @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \ @@ -45,6 +45,16 @@ test-package: build ## Build, install in clean venv, run smoke test @echo "" @echo "Package is ready. Run 'make publish-test' for TestPyPI or 'make publish' for PyPI." +build-docs: ## Regenerate all docs/*.html from build scripts + python docs/build_desert_farm.py + python docs/build_desert_farm_summary.py + python docs/build_explorer.py + @echo "" + @echo "Regenerated:" + @echo " docs/desert_farm_stommel.html" + @echo " docs/desert_farm_summary.html" + @echo " docs/explorer.html" + publish-test: build ## Upload to TestPyPI pip install twine twine check $(DIST)/* diff --git a/docs/build_explorer.py b/docs/build_explorer.py index 60305e1..926b5e1 100644 --- a/docs/build_explorer.py +++ b/docs/build_explorer.py @@ -76,9 +76,11 @@ def load_reference_objects(csv_path): # Only generate ellipse data for actual ellipses ellipse_mask = df["geometry"] == "ellipse" - df.loc[ellipse_mask, ["x_coords", "y_coords"]] = df.loc[ - ellipse_mask, ["Time_min", "Time_max", "Space_min", "Space_max"] - ].apply(create_ellipse_data, axis=1, result_type="expand", n_points=EXPLORER_N_POINTS, space_on_x=False) + df.loc[ellipse_mask, ["x_coords", "y_coords"]] = ( + df.loc[ellipse_mask, ["Time_min", "Time_max", "Space_min", "Space_max"]] + .apply(create_ellipse_data, axis=1, result_type="expand", n_points=EXPLORER_N_POINTS, space_on_x=False) + .rename(columns={0: "x_coords", 1: "y_coords"}) + ) df["color"] = df.Category.map(CATEGORY_COLORS) @@ -740,6 +742,6 @@ def _line_coords(row): if __name__ == "__main__": import sys - csv_path = sys.argv[1] if len(sys.argv) > 1 else "data/local_data/time_space_reference_objects.csv" + csv_path = sys.argv[1] if len(sys.argv) > 1 else "data/datasets/time_space_reference_objects.csv" output_path = sys.argv[2] if len(sys.argv) > 2 else "docs/explorer.html" build_explorer(csv_path, output_path) diff --git a/docs/desert_farm_stommel.html b/docs/desert_farm_stommel.html index e6fead6..5d493a5 100644 --- a/docs/desert_farm_stommel.html +++ b/docs/desert_farm_stommel.html @@ -57,15 +57,15 @@

Operating Across Scale: From Molecules to Climate

chemical (olive), radiative (sand), thermal (rust), mechanical (slate). Click the legend to toggle energy types on/off.

-
+