“Widgets: HTC Visualizer” Module¶
A core module running interactive widgets in notebook
- class panpython.sdk.widgets.htc_visualizer.PointHtcViz(state_space, descriptions, table, units, cal_type='point')[source]¶
Bases:
object
A visualization class of point HTC results
- Parameters:
state_space (List[str]) – The state space to plot box
descriptions (List[str]) – The properties to be analyzed
table (pd.DataFrame) – The mega table to be analyzed
units (Dict[str, str]) – The units of columns of the mega table
cal_type (str, default='point') – type of HTC calculation
Examples
>>> %matplotlib inline >>> import ipywidgets as widgets >>> from ipywidgets import fixed, interactive, interact, interact_manual, HBox, VBox >>> import pandas as pd >>> >>> from panpython.sdk.stat.data_cleanup_for_htc_point import HtcPointInterpreter >>> from panpython.sdk.widgets.htc_visualizer import PointHtcViz >>> >>> # -- get table (Dataframe) and units (list) from merged csv file >>> merged_file = './output/merged.csv' >>> m_htc_point_interpreter = HtcPointInterpreter(merged_file) >>> table = pd.DataFrame() >>> units = [] >>> try: >>> table, units = m_htc_point_interpreter.get_table_and_units() >>> x_columns = table.filter(regex=r"x\(*").columns >>> vf_columns = table.filter(regex=r"f\(@*").columns >>> print(merged_file, 'is loaded') >>> except FileNotFoundError as e: >>> print(e) >>> >>> # visualize >>> if (not table.empty) and units: >>> m_htc_viz = PointHtcViz(['T'] + list(x_columns), vf_columns, table=table, units=units) >>> m_htc_viz.run() >>> else: >>> print('table is not loaded.')
- append_cond(cond_table, cond_units)[source]¶
Add htc condition table with htc task_id (and source_id) and its units to visualization
- Parameters:
cond_table (pd.DataFrame) – the table containing HTC conditions with task_id (and source_id)
cond_units (Dict[str, str]) – the units of columns of the condition table
- class panpython.sdk.widgets.htc_visualizer.PrecipitateHtcViz(cond_table, cond_units, prop_table, prop_units, descriptions)[source]¶
Bases:
object
A visualization class of Precipitation HTC results
- Parameters:
cond_table (pd.DataFrame) – the table containing HTC conditions with task_id (and source_id)
cond_units (Dict[str, str]) – the units of columns of the condition table
prop_table (pd.DataFrame) – The mega table to be analyzed
prop_units (Dict[str, str]) – The units of columns of the mega table
descriptions (List[str]) – The properties to be analyzed
Note
Please see “Solution Examplespanhtc_precipitation_post_processpanhtc_precipitation_post_process.ipynb” for a detailed example.