Merge branch 'main' of https://git.wing.id.au/cal/plotbox
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Plotbox
|
# Plotbox
|
||||||
|
|
||||||
A quick MatPlotLib data visualization tool
|
A quick MatPlotLib data visualization tool, currently a little jank.
|
||||||
|
|
||||||
|
First argument is the path to a CSV file, in the future more data formats are desired.
|
||||||
|
|
||||||
|
Can run with uv `uv run plotbox .\IDCJAC0009_040976_1800_Data.csv` or once installed into an environment `python -m plotbox .\IDCJAC0009_040976_1800_Data.csv`
|
||||||
|
|
||||||
Rainfall Data `IDCJAC0009_040976_1800_Data.csv` obtained from BOM (https://www.bom.gov.au/jsp/ncc/cdio/weatherData/av?p_nccObsCode=136&p_display_type=dailyDataFile&p_startYear=2025&p_c=-335807484&p_stn_num=040976) on the 2026-02-20
|
Rainfall Data `IDCJAC0009_040976_1800_Data.csv` obtained from BOM (https://www.bom.gov.au/jsp/ncc/cdio/weatherData/av?p_nccObsCode=136&p_display_type=dailyDataFile&p_startYear=2025&p_c=-335807484&p_stn_num=040976) on the 2026-02-20
|
||||||
Binary file not shown.
@@ -22,16 +22,19 @@ def main():
|
|||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
numeric_headers = []
|
numeric_headers = []
|
||||||
headers = np.genfromtxt(data_path, delimiter=",", skip_header=0, max_rows=1, dtype=str)
|
headers = np.genfromtxt(data_path, delimiter=",", skip_header=0, max_rows=1, dtype=str, comments="#")
|
||||||
for i, header in enumerate(headers):
|
for i, header in enumerate(headers):
|
||||||
data[header] = np.genfromtxt(data_path, delimiter=",", skip_header=1, max_rows=None, dtype=float, usecols=(i,))
|
data[header] = np.genfromtxt(data_path, delimiter=",", skip_header=1, max_rows=None, comments="#", dtype=float, usecols=(i,))
|
||||||
|
|
||||||
if np.isnan(data[header][0]):
|
if np.isnan(data[header][0]):
|
||||||
data[header] = np.genfromtxt(data_path, delimiter=",", skip_header=1, max_rows=None, dtype=str, usecols=(i,))
|
data[header] = np.genfromtxt(data_path, delimiter=",", skip_header=1, max_rows=None, dtype=str, comments="#", usecols=(i,))
|
||||||
else:
|
else:
|
||||||
numeric_headers.append(header)
|
numeric_headers.append(header)
|
||||||
|
|
||||||
data["Index"] = tuple(range(len(data[numeric_headers[0]])))
|
if len(numeric_headers) > 0:
|
||||||
|
data["Index"] = tuple(range(len(data[numeric_headers[0]])))
|
||||||
|
else:
|
||||||
|
data["Index"] = tuple(range(len(data[headers[0]])))
|
||||||
|
|
||||||
fig, ax = plt.subplot_mosaic(
|
fig, ax = plt.subplot_mosaic(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user