eviz.models.iviz package
Submodules
eviz.models.iviz.airnow_dashboard module
- class eviz.models.iviz.airnow_dashboard.AirNowDash(*args: Any, **kwargs: Any)
Bases:
TabularDash
EPA AirNow Observations interactive visualization dashboard
- drop_nas(data)
- getCFatEPASites(ObsData, CFData)
Function to get CF data at EPA sites
- Inputs:
- ObsData (pandas dataframe):
Output of the getEPAData function
- CFData (xarray dataarray):
CF output read in through getCFaqcData
Outputs: pandas dataframe with the CF forecast added
- make_differences()
Returns a pn.Tabs object with xy image, xy contours, and yz contours plots of the difference between the two files. Checks if regridding is needed between the files, and regrids if needed. Calculates difference, depending on difference type.
- Returns:
Tabs panel object with difference plots.
- Return type:
diff_layout (pn.Tabs)
- make_layout()
Makes a hv.Layout with xy image, xy contours, and yz contours plot. Embeds in self.tabs pn.Tabs object defined in __init__. Returns new self.tabs.
- Returns:
returns pn.Tabs object with embedded Layout.
- Return type:
self.tabs (pn.Tabs)
- make_second_layout()
Returns a pn.Tabs object with xy image, xy contours, and yz contours plot for the secondary file selected.
- Returns:
Tabs panel object with plots for second file.
- Return type:
tabs2 (pn.Tabs)
- set_file2_param_values(file)
Set the secondary files Parameter default values and bounds using the data’s attributes and coordinates.
- Parameters:
file (xarray) – Secondary file opened as a Xarray dataset. Info to set parameter values extracted from file.
- Sets:
xc2 (str): X coordinate for file 2. yc2 (str): Y coordinate for file 2. tc2 (str): T coordinate for file 2. zc2 (str): Z coordinate for file 2.
- set_file2_params(file1, file2)
Set the t and z bounds, and the xy_ylim2 and xy_xlim2 values, for the secondary file accordinting to # of values in each coordinate. Use the first files parameters and widgets if the same as 2nd file.
- Parameters:
file1 (xarray) – Primary file opened as a Xarray dataset.
file2 (xarray) – Secondary file opened as a Xarray dataset.
- Sets:
t2 (int): T coordinate value for file 2. z2 (int): Z coordinate value for file 2. xy_ylim2 (int tuple): Tuple of integers representing the value of the xy ylim for plot 2. xy_xlim2 (int tuple): Tuple of integers representing the value of the xy xlim for plot 2.
- Returns:
levval (int):
- Return type:
timeval (int)
- slice_cf_data(cf_data)
eviz.models.iviz.base_dashboard module
- class eviz.models.iviz.base_dashboard.BaseDash(*args: Any, **kwargs: Any)
Bases:
RootDash
The BaseDash class represents an interactive visualization dashboard for earth system model climate data, using Panel, Param, Hvplot, and Xarray.
- Variables:
config (dict) – Config class with file and data information.
params (dict) – Input class with Parameters, configured with yaml and/or input data attributes; contains input data.
- clim = None
- compare_units(source_data, target_data)
- comparison_file = None
- create_time_av()
Triggered by the run_time_avg_btn, this function uses the Panel template modal where the user selects files in the multi_selector, enters what variables to average over, and creates a time averaged dataset. The time averaged dataset is then set as the tool’s input file and will immediately visualize the results.
- data2d = None
- data3d = None
- data4d = None
- data4d_2 = None
- data_2 = None
- diff_data = None
- formatter = None
- ft_diff = None
- get_1d_plot_types(plot_type_list)
- get_2d_plot_types(plot_type_list)
- get_comparison_ds(d1, d2)
- get_converter(data, plot_type, field, xc, yc, tc, zc, by=None)
Returns a HoloViewsConverter according to plot type.
- Parameters:
data (xr.Dataset) – Data to be plotted.
- Returns:
Plot type
- Return type:
plot_type (str)
- get_f2_exp_name()
Return the experiment name for the secondary file.
- Returns:
configured experiment name.
- Return type:
exp_name (str)
- get_plot_data(data, plot_type)
- lat_remap_check(data, xc, yc)
After data has been selected and field has been converted, check that the longitude values are not 0-360. Remap to -180, 180 if so.
- Parameters:
data (xr dataset) – data to check for 0-360 lon coordinates
xc (str) – x coordinate name of data
yc (str) – y coordinate name of data
- Returns:
data with remapped longitude values if needed
- Return type:
data (xr dataset)
- layout_diff = None
- logger = <Logger eviz.models.iviz.base_dashboard (WARNING)>
- lon_remap_check(data, xc, yc)
After data has been selected and field has been converted, check that the longitude values are not 0-360. Remap to -180, 180 if so.
- Parameters:
data (xr dataset) – data to check for 0-360 lon coordinates
xc (str) – x coordinate name of data
yc (str) – y coordinate name of data
- Returns:
data with remapped longitude values if needed
- Return type:
data (xr dataset)
- make_differences()
Returns a pn.Tabs object with xy image, xy contours, and yz contours plots of the difference between the two files. Checks if regridding is needed between the files, and regrids if needed. Calculates difference, depending on difference type.
- Returns:
Tabs panel object with difference plots.
- Return type:
diff_layout (pn.Tabs)
- make_layout()
Makes a hv.Layout with xy image, xy contours, and yz contours plot. Embeds in self.tabs pn.Tabs object defined in __init__. Returns new self.tabs.
- Returns:
returns pn.Tabs object with embedded Layout.
- Return type:
self.tabs (pn.Tabs)
- make_second_layout()
Returns a pn.Tabs object with xy image, xy contours, and yz contours plot for the secondary file selected.
- Returns:
Tabs panel object with plots for second file.
- Return type:
tabs2 (pn.Tabs)
- overlay_trop(zonal)
Returns an overlay of zonal plot with tropopause line.
- Parameters:
zonal (plot) – A Holoviz zonal (yz) plot to overlay with tropopause line.
- Returns:
Overlay plot
- Return type:
zonal_ov (overlay)
- profileplot(data, xc, yc, tc)
Create a profile plot of the input variable, averaging over xc, yc, and tc.
- Parameters:
data (xarray) – data variable
xc (int) – x coordinate selection value.
yc (int) – y coordinate selection value.
tc (int) – t coordinate selection value.
- Returns:
line holoviews plot
- Return type:
profile_plot (plot)
- select_comparison_file()
- set_comparison_file()
Find files from the user entered location or from the files included in YAML configuration. Fill in the second file selector Parameter ‘comparison_file’ objects with files.
- Parameters:
second_file_input (str) – Parameter widget taking string inputs to directory to glob for files.
- Sets:
comparison_file (selector): Object Selector parameter.
- set_diff_1d_plots(field)
- set_diff_2d_plots(diff_opts)
- set_diff_ft(img_opts, field)
Set field/time diff plot.
- Parameters:
diff_opts (dict) – Options to apply to plot.
- Sets:
ft_diff (list): list containing ft diff plots.
- set_diff_tc(diff_opts)
Set xy diff plot.
- Parameters:
diff_opts (dict) – Options to apply to plot.
- Sets:
xy_diff (list): list containing xy diff plots.
- set_diff_xy(diff_opts)
Set xy diff plot.
- Parameters:
diff_opts (dict) – Options to apply to plot.
- Sets:
xy_diff (list): list containing xy diff plots.
- set_diff_yz(diff_opts)
Set yz diff plot.
- Parameters:
diff_opts (dict) – Options to apply to plot.
- Sets:
yz_diff (list): list containing yz diff plots.
- set_diff_zt()
Set zt diff plot.
- Sets:
zt_diff (list): list containing zt diff plots.
- set_f1_1d_plots(data2d)
Run all file 1 1d plots.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- set_f1_2d_plots(data2d)
Run all file 1 2d plots.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- set_f1_ft(data2d, img_opts)
Set ft (field/time) plot for file 1.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- Sets:
ft (list): list containing ft plots.
- set_f1_polar(data2d)
Set polar plot for file 1.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- Sets:
polar (list): list containing polar plots.
- set_f1_tc()
Set tc plot for file 1.
- Sets:
tc (list): list containing tc plots.
- set_f1_ts()
Set time series (ts) plot for file 1.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- Sets:
ts (list): list containing ts plots.
- set_f1_xt()
Set xt plot for file 1.
- Sets:
xt (list): list containing xt plots.
- set_f1_xy(data2d)
Set xy plot for file 1.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
- Sets:
xy (list): list containing xy plots.
- set_f1_yt()
Set yt plot for file 1.
- Sets:
yt (list): list containing yt plots.
- set_f1_yz(data2d)
Set yz plot for file 1.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
- Sets:
yz (list): list containing yz plots.
- set_f1_zt()
Set zt (profile) plot for file 1.
- Sets:
zt (list): list containing zt plots.
- set_f2_1d_plots(data2d_2, field)
Run all file 1 1d plots.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
- set_f2_2d_plots(data2d_2, timeval, field)
Run all file 2 2d plots.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
plotval (str) – variable name in data to plot.
timeval (str) – time value to select data.
img_opts (dict) – Dictionary of plot options.
- set_f2_ft(data2d_2, img_opts, field)
Set ft plot for file 2.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- Sets:
ft2 (list): list containing ft plots.
- set_f2_polar(data2d, field)
Set polar plot for file 2.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- Sets:
polar2 (list): list containing polar plots.
- set_f2_tc(field)
Set tc plot for file 2.
- Sets:
tc (list): list containing tc plots.
- set_f2_ts(field)
Set ts (time series) plot for file 2.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- Sets:
ts2 (list): list containing ts plots.
- set_f2_xt(field)
Set xt plot for file 2.
- Sets:
xt (list): list containing xt plots.
- set_f2_xy(data2d_2, field)
Set xy plot for file 2.
- Parameters:
data2d (xr.Dataset) – Data to be plotted.
img_opts (dict) – Dictionary of plot options.
- Sets:
xy2 (list): list containing xy plots.
- set_f2_yt(field)
Set yt plot for file 2.
- Sets:
yt (list): list containing yt plots.
- set_f2_yz(field)
Set yz plot for file 2.
- Sets:
yz2 (list): list containing yz plots.
- set_f2_zt(field)
Set zt (profile) plot for file 2.
- Sets:
zt (list): list containing zt plots.
- set_file2_param_values(file, comparison_source)
Set the secondary files Parameter default values and bounds using the data’s attributes and coordinates.
- Parameters:
file (xarray) – Secondary file opened as a Xarray dataset. Info to set parameter values extracted from file.
- Sets:
xc2 (str): X coordinate for file 2. yc2 (str): Y coordinate for file 2. tc2 (str): T coordinate for file 2. zc2 (str): Z coordinate for file 2.
- set_file2_params(file1, file2, comparison_source)
Set the t and z bounds, and the xy_ylim2 and xy_xlim2 values, for the secondary file accordinting to # of values in each coordinate. Use the first files parameters and widgets if the same as 2nd file.
- Parameters:
file1 (xarray) – Primary file opened as a Xarray dataset.
file2 (xarray) – Secondary file opened as a Xarray dataset.
- Sets:
t2 (int): T coordinate value for file 2. z2 (int): Z coordinate value for file 2. xy_ylim2 (int tuple): Tuple of integers representing the value of the xy ylim for plot 2. xy_xlim2 (int tuple): Tuple of integers representing the value of the xy xlim for plot 2.
- Returns:
levval (int):
- Return type:
timeval (int)
- set_selected_comparison_data()
- set_selected_data()
Returns unit converted and dimension selected data. If zc is found in data coords, make index selection. If zc not in data coords, make tc index selection. User Parameters t and z define the selection value. Define class vars data4d, data3d, and data2d for use by class functions.
- Parameters:
file (xarray) – use cached xarray dataset.
zc (str) – z coordinates string of current data.
tc (str) – t coordinates string of current data.
z (int) – z coordinate selection value.
t (in) – t zoordinate selection value.
- Returns:
2 dimensional xarray dataset.
- Return type:
data2d (xarray)
- tc = None
- tc2 = None
- tc_diff = None
- tcd = None
- tcd2 = None
- time_series = None
- time_series_plot()
Returns a time series plot based on the currently selected dataset in the multi_selector.
- Parameters:
multi_selector (str) – Select multiple files and navigate directories.
- Returns:
Tabs panel object with difference plots.
- Return type:
time_series (pn.Tabs)
- tropo = None
- tropopause = None
- ts = None
- zonal_clim = (None, None)
- zonal_data2 = None
- zt = []
- zt2 = None
- zt_diff = None
- ztd = None
- ztd2 = None
eviz.models.iviz.cf_dashboard module
eviz.models.iviz.geos_dashboard module
- class eviz.models.iviz.geos_dashboard.GeosDash(*args: Any, **kwargs: Any)
Bases:
BaseDash
- converted = False
- get_comparison_types()
- make_differences()
Returns a pn.Tabs object with xy image, xy contours, and yz contours plots of the difference between the two files. Checks if regridding is needed between the files, and regrids if needed. Calculates difference, depending on difference type.
- Returns:
Tabs panel object with difference plots.
- Return type:
diff_layout (pn.Tabs)
- set_f1_xy(data2d)
Set tc plot for file 1.
- Sets:
tc (list): list containing xy plots.
- src_units = None
- trg_units = None
eviz.models.iviz.lis_dashboard module
- class eviz.models.iviz.lis_dashboard.LisDash(*args: Any, **kwargs: Any)
Bases:
BaseDash
- create_overlay(plot)
Returns an overlay of provided plot with any selected geoviews/Cartopy features.
- Features:
coast (gv): Global coastlines and country borders. lakes (gv): Global lakes. rivers (gv): Global rivers. states (gv): United States borders. grid (gv): Grid lines
- Parameters:
plot (plot): Input xy plot to be overlayed with selected features.
- Returns:
overlay (overlay): xy overlay with selected features.
- get_converter(data, plot_type, field, xc, yc, tc, zc)
Returns a HoloViewsConverter according to plot type.
- Parameters:
data (xr.Dataset) – Data to be plotted.
- Returns:
Plot type
- Return type:
plot_type (str)
- get_proj_from_attrs()
Get projection information from the datasets metadata.
- Sets:
proj (params.proj): The current projection value to apply to data.
- get_xy_opts(data)
- gif()
Creates and returns a gif based on the user selected dimension to animate through.
- Returns:
- gif (gif): Animated gif plotted and saved to current working directory. User selects which
dimension to animate through.
- set_selected_data()
Returns unit converted and dimension selected data. If zc is found in data coords, make index selection. If zc not in data coords, make tc index selection. User Parameters t and z define the selection value. Define class vars data4d, data3d, and data2d for use by class functions.
- Parameters:
file (xarray) – use cached xarray dataset.
zc (str) – z coordinates string of current data.
tc (str) – t coordinates string of current data.
z (int) – z coordinate selection value.
t (in) – t zoordinate selection value.
- Returns:
2 dimensional xarray dataset.
- Return type:
data2d (xarray)
- set_z_bounds(data, zc, z)
Set the bounds of the z coordinate slider for selection of data.
- Parameters:
data (xr.Dataset): Dataset to get z values from. zc (params.zc): The z coordinate label.
- Sets:
z.bounds (param.z.bounds): Number of values for z. gif_dim (params.gif_dim): Adds to available dimensions for gifs.
- set_zc(field, zc, file, z)
Set the z coordinate label according to the currently selected field for plotting.
- Sets:
plot_type.options (params): Updates available plot types.
- title_function(data, exp, zc, tc)
Returns a title based off the input data, experiment name if available, zc and tc coordinates, or if the user has selected a custom title, title input will come from title_input widget.
- Parameters:
data (xarray): xarray dataset to get attributes from, including .name and .units. exp (str): experiment name, if available, from yaml configuration. zc (str): Input zc coordinate, will check to confirm in data, used for .units and .values. tc (str): Input tc coordinate, confirm in data, uses .name, .units, .values
- Returns:
title (str): Plot title.
- update_plot_limits()
Update the x and y limit values according to the data for the xy (lat/lon) plot.
- Sets:
xy_ylim.start (params): start of y limit values xy_ylim.end (params): end of y limit values xy_ylim.value (params): current value of y limit xy_xlim.start (params): start of x limit values xy_xlim.end (params): end of x limit values xy_xlim.value (params): current value of x limit
eviz.models.iviz.multi_file module
- class eviz.models.iviz.multi_file.MultiFile(*args: Any, **kwargs: Any)
Bases:
Parameterized
‘mini’ control panel for multiple file plotting
- check_for2d()
- cmap = 'rainbow'
- coords = None
- custom_title = False
- data_show()
add panel Row with file metadata if show data is checked
- gif()
create gif on either time or lev based on user selection
- invert_zonal_x = False
- invert_zonal_y = True
- keys = None
- logy = False
- make_coastlines(xy_contours)
create coastlines from app shapefile using geopandas and spatial pandas, plot with hvplot overlay with xy image and xy contours (if provided) and return overlays
- model = None
- ndims = None
- set_dim_params(model)
- set_param_values()
- set_selected_data()
- show_coastlines = False
- show_data = False
- show_grid = False
- show_statistics = False
- statistics_box()
get basic statistics and display values in markdown pane
- tabs()
- tabs_switch = True
- title_function(time_select2)
eviz.models.iviz.root_dashboard module
- class eviz.models.iviz.root_dashboard.RootDash(*args: Any, **kwargs: Any)
Bases:
Parameterized
RootDash contains basic model-agnostic functions for preparing an iViz dashboard.
- Variables:
config (dict) – Config class with file and data information.
params (dict) – Input class with Parameters, configured with yaml and/or input data attributes; contains input data.
- add_files()
Adds files being explored with the multi_selector to the current files available in the file selector.
- Returns:
New files parameter with updated files available.
- Return type:
files (str)
- add_plot_histogram(plot)
Add a histogram to all plots in a list.
- Parameters:
plot (list) – All plots to add a histogram.
- Returns:
List of plots with histograms.
- Return type:
newplots (list)
- add_to_tabs()
Adds the current plots to the main tabs object so that a user can refer to plots they’ve already created without saving.
- animate()
Returns a panel WidgetBox with the widgets for creating a gif when toggled by the user, otherwise empty. Includes a selector of the available dimensions to animate over, and a gif button.
- Returns:
A panel with gif widgets.
- Return type:
gif_pane
- apply_operations_to_data(data)
Returns data with a basic operation applied to it based on user inputs. Multiply, divide, add, subtract factors extracted from the literal user input parameter.
- Parameters:
data (xarray) – xarray dataset to apply factor to.
operations (str) – what kind of operation to do: multiply, divide, add, subtract.
- Returns:
Plot title.
- Return type:
title (str)
- cache_data()
Add the input xarray dataset to the Panel cache.
- Parameters:
file (xarray): xarray dataset.
- Cached:
file (xarray): xarray dataset.
- clear_diff()
When ‘Clear difference plot’ is clicked, clear the difference_plots result from the main plot panel. Re-set relevant class variables to None.
- clear_second()
When ‘Clear secondary plot’ is clicked, clear the second_tabs result from the main plot panel. Remove the secondary plot widgets, and re-set relevant class variables to None.
- colorbar_ticks(img, data, begin=None, end=None)
Returns a Bokeh Fixed Ticker object, containing tick locations for a plots colorbar. Calculated from inputs, plot range, and number of color levels.
- Parameters:
img (plot) – Input Holoviz plot
begin (float) – If provided, value to use as first tick mark.
end (float) – If provided, value to use as last tick mark.
- Returns:
Bokeh fixed ticker.
- Return type:
ticker
- create_overlay(plot)
Returns an overlay of provided plot with any selected geoviews/Cartopy features.
- Features:
coast (gv): Global coastlines and country borders. lakes (gv): Global lakes. rivers (gv): Global rivers. states (gv): United States borders. grid (gv): Grid lines
- Parameters:
plot (plot) – Input xy plot to be overlayed with selected features.
- Returns:
xy overlay with selected features.
- Return type:
overlay (overlay)
- create_plot_list(plot_list)
Returns a list of plots that are not empty.
- Parameters:
plot_list (list) – All possible plots in a layout.
- Returns:
list of plots that are not empty.
- Return type:
plots (list)
- data_show()
Returns an interactive Panel pane of current Xarray Dataset.
- Returns:
pane (panel): Panel pane of an interactive Xarray dataset.
- do_diff()
Returns a panel Column with the differencing workflow widgets when toggled by the user, otherwise empty. Includes the directory input, the files found in the directory, a selector for the diff types, and buttons that add the second file, clear the second file, add the difference plots, and clear the difference plots.
- Returns:
A panel Column with differencing widgets.
- Return type:
diff_pane
- do_explorer()
- explore_cmaps()
Returns a Layout of hv.Images of possible colormaps, options filtered by the colormap category, provider, and reverse parameters. Filters through all colormaps with user input to select category, whether it’s a reversed, and whether it’s provided by matplotlib, bokeh, or colrocet. Sets the options of the filtered colormaps selector for the user to select a new colormap.
- Parameters:
cmap_category (str) – filter colormaps by category.
cmap_reverse (bool) – Whether to reverse the colormap.
cmap_provider (str) – Colormap provider.
- Returns:
hv.Images depicting color ranges of available filtered colormaps.
- Return type:
cmaps (hv.Layout)
- filename()
Create a filename to write a gif or layout to file.
- Returns:
filename of saved object
- Return type:
filename (str)
- get_cartopy_projection(x, y)
Check if cartopy projection has central_longitude or central_latitude parameters, use x and y median value of data if found.
- Parameters:
x (xarray) – Input x values from data
y (xarray) – Input y values from data
- Returns:
cartopy projection.
- Return type:
projection (ccrs)
- get_clim(d1, d2)
- get_diff_data(left_side, right_side)
- get_diff_opts()
- get_gen_opts(data)
Returns a dictionary of general plot options and settings applicable to all plots.
- Parameters:
data (xarray) – xarray dataset input to get attributes, .name and .units, from.
- Returns:
Dictionary of plot options and settings, defaults and user parameters.
- Return type:
img_opts (dict)
- get_lims(dct_params)
- get_player()
Returns a media player, with play, pause, next, back, controls, that can animate or step through time or vertical levels.
- Returns:
A media player widget from Panel.
- Return type:
player (pn.widgets.Player)
- get_xy_opts(data)
- get_ylim(d1, d2)
- get_yz_opts(data)
Returns a dictionary of plot options and settings.
- Parameters:
data (xarray) – xarray dataset input to get attributes, .name and .units, from.
- Returns:
Dictionary of plot options and settings, defaults and user parameters.
- Return type:
img_opts (dict)
- get_zt_opts()
- gif()
Creates and returns a gif based on the user selected dimension to animate through.
- Returns:
- Animated gif plotted and saved to current working directory. User selects which
dimension to animate through.
- Return type:
gif (gif)
- plot_difference()
When ‘Add difference plots’ is clicked, run the difference_plots function and append the results to the main plot panel.
- plot_opts()
Returns a panel Tabs object with all the available plot options and parameters controlling visualizations.
- Returns:
A panel with plot options widgets.
- Return type:
plot_opts_tabs
- plot_second()
When the “Add secondary plot” button is clicked, run the second_tabs function and append the results to the plot panel.
- plot_type_tabs()
Returns panel tabs with different plot types widgets.
- Returns:
tabs containing plot type widgets.
- Return type:
plot_type_tabs (pn.Tabs)
- regional_selection()
- Set the spatial extent, the ylim and xlim, of a plot, with current regional selection value. Available regions:
global, north america, south america, europe, asia, australia and oceania, africa.
- Parameters:
regions (str) – user selected region to spatially select.
xy_xlim (tuple) – set parameter xy_xlim to selected region, the xlim of xy plot.
xy_ylim (tuple) – set parameter xy_ylim to selected region, the ylim of xy plot.
- run_multi()
Creates mini visualization tool using MultiFile class for each file selected in the multiple file selector. Creates xy image, xy contours, and yz contours plots, arranged in a pn.Tabs object, and with corresponding widgets. Appends the result to the layout tabs object. Triggered user clicking add_plots_button.
- save_layout()
Saves the current entire tool view (stored as ‘column’) to the output directory, which is either configured with yaml or the current working directory. Format type of the saved plots determined by user input, save_menu_button.
- Parameters:
output_dir (str) – Configured with YAML or current working directory.
save_menu_button (event) – Button that includes further menu options with save formats.
- save_plot_opts()
Saves the user’s current plot options by getting the value of corresponding params and params_const values. Created a dictionary of those settings, and saving as a YAML file to the current working directory.
- Outputs:
plot_options (yaml): YAML dictionary containing all params values of currently applied plot options.
- save_session()
Saves the user’s current session by getting the value of all params and params_const values. Created a dictionary of those settings, and saving as a YAML file to the current working directory.
- Outputs:
session_file (yaml): YAML dictionary containing all params values of current session.
- set_cformatter()
- set_new_cmap()
Sets new colormap using selected colormap from explore colormaps in plot options tabs.
- statistics_box()
Calculates basic statistics (median, mean, min, max, std), formats and creates a panel Markdown object, which is appended to the side of the main column.
- Returns:
A formatted box of basic statistics.
- Return type:
column (list)
- title_function(data, exp, zc, tc)
Returns a title based off the input data, experiment name if available, zc and tc coordinates, or if the user has selected a custom title, title input will come from title_input widget.
- Parameters:
data (xarray) – xarray dataset to get attributes from, including .name and .units.
exp (str) – experiment name, if available, from yaml configuration.
zc (str) – Input zc coordinate, will check to confirm in data, used for .units and .values.
tc (str) – Input tc coordinate, confirm in data, uses .name, .units, .values
- Returns:
Plot title.
- Return type:
title (str)
- unit_conversion_check(data, field, config=None)
If input is a yaml configuratio with unitconversion specs available for the current field, apply conversion factor to data and return new data.
- Parameters:
data (xarray) – xarray dataset to get attributes from, including .name and .units.
exp (str) – experiment name, if available, from yaml configuration.
zc (str) – Input zc coordinate, will check to confirm in data, used for .units and .values.
tc (str) – Input tc coordinate, confirm in data, uses .name, .units, .values
- Returns:
Plot title.
- Return type:
title (str)
- update_config()
Update config class and re-set to self.config if a file change is detected.
- Sets:
self.config (dict): Config class initialized.
- zonal_title(data, exp_name)
Returns a zonal title based off the input data, experiment name if available, or if the user has selected a custom title, title input will come from title_input widget.
- Parameters:
data (xarray): xarray dataset to get attributes from, including .name and .units. exp_name (str): experiment name, if available, from yaml configuration.
- Returns:
zonal_title (str): Plot title.
eviz.models.iviz.tabular_dashboard module
- class eviz.models.iviz.tabular_dashboard.TabularDash(*args: Any, **kwargs: Any)
Bases:
BaseDash
The TabularDash class represents an interactive visualization dashboard for tabular data (rows,columns) in the form of a pandas Dataframe.
- Variables:
config (dict) – Config class with file and data information.
params (dict) – Input class with Parameters, configured with yaml and/or input data attributes; contains input data.
- cache_data()
- create_overlay(plot)
- create_time_av()
- data_show()
Returns an interactive Panel pane of current Xarray Dataset.
- Returns:
Panel pane of an interactive Xarray dataset.
- Return type:
pane (panel)
- describe_data()
- filename()
Create a filename to write a gif or layout to file.
- Returns:
filename of saved object
- Return type:
filename (str)
- logger = <Logger eviz.models.iviz.tabular_dashboard (WARNING)>
- make_layout()
Makes a hv.Layout with xy image, xy contours, and yz contours plot. Embeds in self.tabs pn.Tabs object defined in __init__. Returns new self.tabs.
- Returns:
returns pn.Tabs object with embedded Layout.
- Return type:
self.tabs (pn.Tabs)
- plot_opts()
Returns a panel Tabs object with all the available plot options and parameters controlling visualizations.
- Returns:
A panel with plot options widgets.
- Return type:
plot_opts_tabs
- select_comparison_file()
- set_input()
Create a filename to write a gif or layout to file.
- Returns:
filename of saved object
- Return type:
filename (str)
- set_plot_types_on_var_change()
- set_selected_data()
- statistics_box()
Calculates basic statistics (median, mean, min, max, std), formats and creates a panel Markdown object, which is appended to the side of the main column.
- Returns:
A formatted box of basic statistics.
- Return type:
column (list)
- title_function(field)
Returns a title based off the input data, experiment name if available, zc and tc coordinates, or if the user has selected a custom title, title input will come from title_input widget.
- Parameters:
data (xarray) – xarray dataset to get attributes from, including .name and .units.
exp (str) – experiment name, if available, from yaml configuration.
zc (str) – Input zc coordinate, will check to confirm in data, used for .units and .values.
tc (str) – Input tc coordinate, confirm in data, uses .name, .units, .values
- Returns:
Plot title.
- Return type:
title (str)
eviz.models.iviz.wrf_dashboard module
- class eviz.models.iviz.wrf_dashboard.WrfDash(*args: Any, **kwargs: Any)
Bases:
BaseDash
WrfDash is a dashboard for visualizing output from the Weather Research & Forecasting (WRF) model.
- Variables:
config (dict) – Config class with file and data information.
params (dict) – Input class with Parameters, configured with yaml and/or input data attributes; contains input data.
- convert_to_levs(data, zc)
Convert vertical coordinate values in wrf data to pressure levels.
- Parameters:
data (xr.Dataset) – data to assign new coords and get values.
zc (str) – z coordinate label
- Returns:
data
- Return type:
data (xr.Dataset)
- create_overlay(plot)
Returns an overlay of provided plot with any selected geoviews/Cartopy features.
- Features:
coast (gv): Global coastlines and country borders. lakes (gv): Global lakes. rivers (gv): Global rivers. states (gv): United States borders. grid (gv): Grid lines
- Parameters:
plot (plot): Input xy plot to be overlayed with selected features.
- Returns:
overlay (overlay): xy overlay with selected features.
- get_converter(data, plot_type, field, xc, yc, tc, zc)
Returns a HoloViewsConverter according to plot type.
- Parameters:
data (xr.Dataset) – Data to be plotted.
- Returns:
Plot type
- Return type:
plot_type (str)
- get_proj_from_attrs()
Get projection information from the datasets metadata.
- Sets:
proj (str): The current projection value to apply to data.
- get_stagger_fields(data, plotting_fields)
Get all fields from the data that contain a stagger value.
- Parameters:
data (xr.Dataset) – Dataset to get z values from.
plotting_fields (list) – All plottable fields.
- Returns:
all fields that contain x stagger. y_stag (list): all fields that contain y stagger. z_stag (list): all fields that contain z stagger.
- Return type:
x_stag (list)
- get_xy_opts(data)
- set_plot_options(data)
Get all fields that contain at least three dimensions for plotting.
- Parameters:
data (xr.Dataset) – Dataset with fields to plot.
- Sets:
plot.objects (list): Available plotting fields.
- set_selected_data()
Returns unit converted and dimension selected data. If zc is found in data coords, make index selection. If zc not in data coords, make tc index selection. User Parameters t and z define the selection value. Define class vars data4d, data3d, and data2d for use by class functions.
- Parameters:
file (xarray) – use cached xarray dataset.
zc (str) – z coordinates string of current data.
tc (str) – t coordinates string of current data.
z (int) – z coordinate selection value.
t (in) – t zoordinate selection value.
- Returns:
2 dimensional xarray dataset.
- Return type:
data2d (xarray)
- set_stagger_param_values(stagger)
Sets xc, yc, and zc coordinate labels if the plotting field is a staggered field.
- Parameters:
stagger (str) – The identified stagger value in the field.
- Sets:
xc (str): x coordinate label. yc (str): y coordinate label. zc (str): z coordinate label.
- set_z_bounds(data, zc)
Set the bounds of the z coordinate slider for selection of data.
- Parameters:
data (xr.Dataset) – Dataset to get z values from.
zc (str) – The z coordinate label.
- Sets:
z.bounds (tuple): Number of values for z. gif_dim (list): Adds to available dimensions for gifs.