climakitae.explore package

Contents

climakitae.explore package#

Submodules#

climakitae.explore.agnostic module#

Backend for agnostic tools.

climakitae.explore.agnostic.agg_area_subset_sims(area_subset, cached_area, metric, years, downscaling_method='LOCA', months=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])#

This function combines all available WRF or LOCA simulation data that is filtered on the area_subset (a string from existing keys in Boundaries.boundary_dict()) and on one of the areas of the values in that area_subset (cached_area). It then extracts this data across all SSP pathways for specific years/months, and runs the passed in metric on all of this data. The results are then returned in 3 values, the first as a dict of statistic names to xr.DataArray single simulation objects (i.e. median), the second as a dict of statistic names to xr.DataArray objects consisting of multiple simulation objects (i.e. middle 10%), and the last as a xr.DataArray of simulations’ aggregated values sorted in ascending order.

Parameters:
  • area_subset (str) – Describes the category of the boundaries of interest (i.e. “CA Electric Load Serving Entities (IOU & POU)”)

  • cached_area (str) – Describes the specific area of interest (i.e. “Southern California Edison”)

  • metric (str) – The metric to aggregate the simulations by.

  • years (tuple) – The lower and upper year bounds (inclusive) to extract simulation data by.

  • months (list, optional) – Specific months of interest. The default is all months.

Returns:

  • single_stats (dict of str: DataArray) – Dictionary mapping string names of statistics to single simulation xr.DataArray objects.

  • multiple_stats (dict of str: DataArray) – Dictionary mapping string names of statistics to multiple simulations xr.DataArray objects.

  • results (DataArray) – Aggregated results of running the given metric on the lat/lon gridcell of interest. Results are also sorted in ascending order.

climakitae.explore.agnostic.agg_lat_lon_sims(lat, lon, metric, years, downscaling_method='LOCA', months=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])#

Gets aggregated WRF or LOCA simulation data for a lat/lon coordinate for a given metric and timeframe (years, months). It combines all selected simulation data that is filtered by lat/lon, years, and specific months across SSP pathways and runs the passed in metric on all of the data. The results are then returned in ascending order, along with dictionaries mapping specific statistic names to the simulation objects themselves.

Parameters:
  • lat (float) – Latitude for specific location of interest.

  • lon (float) – Longitude for specific location of interest.

  • metric (str) – The metric to aggregate the simulations by.

  • years (tuple) – The lower and upper year bounds (inclusive) to subset simulation data by.

  • months (list, optional) – Specific months of interest. The default is all months.

Returns:

  • single_stats (dict of str: DataArray) – Dictionary mapping string names of statistics to single simulation xr.DataArray objects.

  • multiple_stats (dict of str: DataArray) – Dictionary mapping string names of statistics to multiple simulations xr.DataArray objects.

  • results (DataArray) – Aggregated results of running the given metric on the lat/lon gridcell of interest. Results are also sorted in ascending order.

climakitae.explore.agnostic.create_conversion_function(lookup_tables)#

Create a function that converts between warming level and time.

Parameters:

lookup_tables (dict of pandas.DataFrame) – Lookup tables for the conversions as output from the create_lookup_tables function. It is a dictionary with a “time lookup table” and a “warming level lookup table”.

Returns:

function – The find_wl_or_time function preloaded with the given lookup_tables. Given either a warming level or a time, the function uses lookup_tables to find information about the other. Please see find_wl_or_time for details.

Notes

This saves time otherwise needed to remake the lookup tables for each call.

climakitae.explore.agnostic.create_lookup_tables()#

Create lookup tables for converting between warming level and time.

Returns:

dict of pandas.DataFrame – A dictionary containing two dataframes: “time lookup table” which maps warming levels to their occurence times for each GCM simulation we catalog, and “warming level lookup table” which contains yearly warming levels for those simulations.

climakitae.explore.agnostic.find_wl_or_time(lookup_tables, scenario='ssp370', warming_level=None, year=None)#

Given either a warming level or a time, find information about the other.

If given a warming_level, the function looks up the times when simulations under the specified scenario reach the warming level. It returns the median month across the simulations. It also plots a histogram of the years with a label for the median year. The lookup is based on the “time lookup table” in lookup_tables.

If given a year, the function looks up the warming levels reached in the year by simulations under the specified scenario. It plots a histogram of the warming levels. It also calculates the median warming level across the simulations and prints the major warming level nearest to the median. Guidance provided include a list of major warming levels considered (1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, and 4.5°C), and the 0.5 interval the median is in.

Parameters:
  • lookup_tables (dict of pandas.DataFrame) – Lookup tables as output from the create_lookup_tables function. It is a dictionary with a “time lookup table” and a “warming level lookup table”.

  • scenario (str, optional) – The scenario to consider. The default is “ssp370”.

  • warming_level (str, optional) – The warming level to analyze (“1.5”, “2.0”, “3.0”). The default is None.

  • year (int, optional) – The year to analyze. Must be between 2021 and 2089. The default is None.

Returns:

str or None – Given a warming level, returns a string representing the median month. Given a year, returns None. None is also returned if neither warming level nor year is given, or if both are given.

climakitae.explore.agnostic.plot_WRF(sim_vals, metric)#

Scatter plot WRF models against their metric values.

climakitae.explore.agnostic.plot_double_WRF(var1, var2)#

Plots aggregations of WRF models on a scatterplot of two quantitative variables. Labels points with specific WRF model names.

climakitae.explore.agnostic.plot_sims(sim_vals, selected_val, time_slice, stats)#

Creates resulting plot figures.

climakitae.explore.amy module#

Calculates the Average Meterological Year (AMY) and Severe Meteorological Year (SMY) for the Cal-Adapt: Analytics Engine using a standard climatological period (1981-2010) for the historical baseline, and uses a 30-year window around when a designated warming level is exceeded for the SSP3-7.0 future scenario for 1.5°C, 2°C, and 3°C. The AMY is comparable to a typical meteorological year, but not quite the same full methodology.

class climakitae.explore.amy.AverageMetYearParameters(*args, **params)

Bases: DataParametersWithPanes

params(amy_type=Selector, cmap=Selector, computation_method=Selector, reload_data=Action, tmy_computation_description=Selector, warmlevel=Selector, _data_warning=String, _station_data_info=String, area_average=Selector, area_subset=Selector, cached_area=ListSelector, data_type=Selector, downscaling_method=Selector, extended_description=Selector, latitude=Range, longitude=Range, resolution=Selector, scenario_historical=ListSelector, scenario_ssp=ListSelector, simulation=ListSelector, station=ListSelector, time_slice=Range, timescale=Selector, units=Selector, variable=Selector, variable_id=ListSelector, variable_type=Selector, name=String) An object that holds the data options parameters for the explore.tmy panel. Parameters of ‘AverageMetYearParameters’ ========================================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Bounds Mode 

area_subset None Selector V RW cached_area None ListSelector V RW latitude (32.5, 42) Range (10, 67) V RW longitude (-125.5, -114) Range (-156.82317, -84.18701) V RW variable_type ‘Variable’ Selector V RW time_slice (1980, 2015) Range (1950, 2100) V RW resolution ‘9 km’ Selector V RW timescale ‘monthly’ Selector V RW scenario_historical [‘Historical Climate’] ListSelector V RW area_average ‘No’ Selector V RW downscaling_method ‘Dynamical’ Selector V RW data_type ‘Gridded’ Selector V RW station None ListSelector V RW _station_data_info ‘’ String V RW scenario_ssp None ListSelector V RW simulation None ListSelector V RW variable None Selector V RW units None Selector V RW extended_description None Selector V RW variable_id None ListSelector V RW _data_warning ‘’ String V RW amy_type ‘Absolute’ Selector V RW computation_method None Selector V RW tmy_computation_description None Selector V RW cmap None Selector V RW warmlevel 1.5 Selector V RW reload_data <function AverageMetYearParameters.<l… Action V RW

Parameter docstrings: =====================

area_subset: < No docstring available > cached_area: < No docstring available > latitude: < No docstring available > longitude: < No docstring available > variable_type: Choose between variable or AE derived index time_slice: < No docstring available > resolution: < No docstring available > timescale: < No docstring available > scenario_historical: < No docstring available > area_average: Compute an area average? downscaling_method: < No docstring available > data_type: < No docstring available > station: < No docstring available > _station_data_info: Information about the bias correction process and resolution scenario_ssp: < No docstring available > simulation: < No docstring available > variable: < No docstring available > units: < No docstring available > extended_description: < No docstring available > variable_id: < No docstring available > _data_warning: Warning if user has made a bad selection amy_type: < No docstring available > computation_method: < No docstring available > tmy_computation_description: < No docstring available > cmap: < No docstring available > warmlevel: < No docstring available > reload_data: < No docstring available >

amy_type = 'Absolute'
cmap = None
computatation_description_dict = {'Absolute': {'Historical': 'AMY computed using the historical baseline for 1981-2010.', 'Warming Level Future': 'AMY computed using the 30-year future period centered around when the selected warming level is reached.'}, 'Difference': {'Severe AMY': 'AMY computed by taking the difference between the 90th percentile of the 30-year future period centered around the selected warming level and the historical baseline.', 'Warming Level Future': 'AMY computed by taking the difference between the 30-year future period centered around the selected warming level and the historical baseline.'}}
computation_method = None
name = 'AverageMetYearParameters'
reload_data()
tmy_advanced_options_dict = {'Absolute': {'default': 'Historical', 'objects': ['Historical', 'Warming Level Future']}, 'Difference': {'default': 'Warming Level Future', 'objects': ['Warming Level Future', 'Severe AMY']}}
tmy_computation_description = None
warming_year_average_range = {1.5: (2034, 2063), 2: (2047, 2076), 3: (2061, 2090)}
warmlevel = 1.5
climakitae.explore.amy.amy_visualize(self)

Creates a new AMY focus panel object to display user selections

climakitae.explore.amy.compute_amy(data, days_in_year=366, show_pbar=False)

Calculates the average meteorological year based on a designated period of time

Applicable for both the historical and future periods.

Parameters:
  • data (DataArray) – Hourly data for one variable

  • days_in_year (int, optional) – Either 366 or 365, depending on whether or not the year is a leap year. Default to 366 days (leap year)

  • show_pbar (bool, optional) – Show progress bar? Default to false. Progress bar is nice for using this function within a notebook.

Returns:

DataFrame – Average meteorological year table, with days of year as the index and hour of day as the columns.

climakitae.explore.amy.compute_mean_monthly_meteo_yr(tmy_df, col_name='mean_value')

Compute mean monthly values for input meteorological year data.

Parameters:
  • tmy_df (DataFrame) – Matrix with day of year as index and hour as columns Output of either compute_severe_yr or compute_meteo_yr

  • col_name (str, optional) – Name to give single output column It may be informative to assign this to the name of the data variable

Returns:

DataFrame – Table with month as index and monthly mean as column

climakitae.explore.amy.compute_severe_yr(data, days_in_year=366, show_pbar=False)

Calculate the severe meteorological year based on the 90th percentile of data.

Applicable for both the historical and future periods.

Parameters:
  • data (DataArray) – Hourly data for one variable

  • days_in_year (int, optional) – Either 366 or 365, depending on whether or not the year is a leap year. Default to 366 days (leap year)

  • show_pbar (bool, optional) – Show progress bar? Default to false. Progress bar is nice for using this function within a notebook.

Returns:

DataFrame – Severe meteorological year table, with days of year as the index and hour of day as the columns.

climakitae.explore.amy.lineplot_from_amy_data(amy_data, computation_method=None, location_subset=None, warmlevel=None, variable=None)

Generate a lineplot of meteorological year data, with mon-day-hr on the x-axis

Parameters:
  • amy_data (DataFrame) – Meteorological year dataframe, with hour of day as columns and day of year as index Output of either compute_severe_yr or compute_meteo_yr

  • computation_method (str, optional) – Method used to compute the meteorological year. Used to add descriptive information to the plot title.

  • location_subset (str, optional) – Location subset of data. Used to add descriptive information to the plot title.

  • warmlevel (str, optional) – Warming level used to generate data. Used to add descriptive information to the plot title.

  • variable (str, optional) – Name of data variable. Used to add descriptive information to the plot title.

Returns:

matplotlib.figure.Figure – Lineplot of the data

climakitae.explore.amy.meteo_yr_heatmap(meteo_yr_df, title='Meteorological Year', cmap='ae_orange', clabel=None, width=500, height=250)

Create interactive (hvplot) meteorological year heatmap.

Parameters:
  • meteo_yr_df (DataFrame) – Meteorological year dataframe, with hour of day as columns and day of year as index Output of either compute_severe_yr or compute_meteo_yr

  • title (str, optional) – Title to give heatmap. Default to “Meteorological Year”

  • cmap (matplotlib colormap name or AE colormap names, optional) – Colormap to apply to heatmap. Default to “ae_orange”

  • clabel (str, optional) – Name of variable being plotted. Default to None. Will be applied to label of colorbar.

  • width (int, optional) – Width of heatmap. Default to 500

  • height (int, optional) – Height of heatmap. Default to 250.

Returns:

holoviews.element.raster.HeatMap – Interactive heatmap

climakitae.explore.amy.meteo_yr_heatmap_static(meteo_yr_df, title='Meteorological Year', cmap='ae_orange', clabel=None)

Create static (matplotlib) meteorological year heatmap

Parameters:
  • meteo_yr_df (DataFrame) – Meteorological year dataframe, with hour of day as columns and day of year as index Output of either compute_severe_yr or compute_meteo_yr

  • title (str, optional) – Title to give heatmap. Default to “Meteorological Year”

  • cmap (matplotlib colormap name or AE colormap names, optional) – Colormap to apply to heatmap. Default to “ae_orange”

  • clabel (str, optional) – Name of variable being plotted. Default to None. Will be applied to label of colorbar.

Returns:

matplotlib.figure.Figure – Static heatmap

climakitae.explore.threshold_tools module#

Helper functions for performing analyses related to thresholds

climakitae.explore.threshold_tools.calculate_ess(data, nlags=None)#

Function for calculating the effective sample size (ESS) of the provided data.

Parameters:
  • data (DataArray) – Input array is assumed to be timeseries data with potential autocorrelation.

  • nlags (int, optional) – Number of lags to use in the autocorrelation function, defaults to the length of the timeseries.

Returns:

DataArray – Effective sample size. Returned as a DataArray object so it can be utilized by xr.groupby and xr.resample.

climakitae.explore.threshold_tools.exceedance_plot_subtitle(exceedance_count)#

Function of build exceedance plot subtitle

Helper function for making the subtile for exceedance plots.

Parameters:

exceedance_count (xarray.DataArray)

Returns:

string

Examples

‘Number of hours per year’ ‘Number of 4-hour events per 3-months’ ‘Number of days per year with conditions lasting at least 4-hours’

climakitae.explore.threshold_tools.exceedance_plot_title(exceedance_count)#

Function to build title for exceedance plots

Helper function for making the title for exceedance plots.

Parameters:

exceedance_count (xarray.DataArray)

Returns:

string

Examples

‘Air Temperatue at 2m: events above 35C’ ‘Preciptation (total): events below 10mm’

climakitae.explore.threshold_tools.get_block_maxima(da_series, extremes_type='max', duration=None, groupby=None, grouped_duration=None, check_ess=True, block_size=1)#

Function that converts data into block maximums, defaulting to annual maximums (default block size = 1 year).

Takes input array and resamples by taking the maximum value over the specified block size.

Optional arguments duration, groupby, and grouped_duration define the type of event to find the annual maximums of. These correspond to the event types defined in the get_exceedance_count function.

Parameters:
  • da (xarray.DataArray) – DataArray from retrieve

  • extremes_type (str) – option for max or min Defaults to max

  • duration (tuple) – length of extreme event, specified as (4, ‘hour’)

  • groupby (tuple) – group over which to look for max occurance, specified as (1, ‘day’)

  • grouped_duration (tuple) – length of event after grouping, specified as (5, ‘day’)

  • check_ess (boolean) – optional flag specifying whether to check the effective sample size (ESS) within the blocks of data, and throw a warning if the average ESS is too small. can be silenced with check_ess=False.

  • block_size (int) – block size in years. default is 1 year.

Returns:

xarray.DataArray

climakitae.explore.threshold_tools.get_exceedance_count(da, threshold_value, duration1=None, period=(1, 'year'), threshold_direction='above', duration2=None, groupby=None, smoothing=None)#

Calculate the number of occurances of exceeding the specified threshold within each period.

Returns an xarray.DataArray with the same coordinates as the input data except for the time dimension, which will be collapsed to one value per period (equal to the number of event occurances in each period).

Parameters:
  • da (xarray.DataArray) – array of some climate variable. Can have multiple scenarios, simulations, or x and y coordinates.

  • threshold_value (float) – value against which to test exceedance

  • period (int) – amount of time across which to sum the number of occurances, default is (1, “year”). Specified as a tuple: (x, time) where x is an integer, and time is one of: [“day”, “month”, “year”]

  • threshold_direction (str) – either “above” or “below”, default is above.

  • duration1 (tuple) – length of exceedance in order to qualify as an event (before grouping)

  • groupby (tuple) – see examples for explanation. Typical grouping could be (1, “day”)

  • duration2 (tuple) – length of exceedance in order to qualify as an event (after grouping)

  • smoothing (int) – option to average the result across multiple periods with a rolling average; value is either None or the number of timesteps to use as the window size

Returns:

xarray.DataArray

climakitae.explore.threshold_tools.get_geospatial_plot(ds, data_variable, bar_min=None, bar_max=None, border_color='black', line_width=0.5, cmap='ae_orange', hover_fill_color='blue')#

Returns an interactive map from inputed dataset and selected data variable.

Parameters:
  • ds (Dataset) – Data to plot

  • data_variable (str) – Valid variable option in input dataset Valid options: “d_statistic”,”p_value”,”return_value”,”return_prob”,”return_period”

  • bar_min (float, optional) – Colorbar minimum value

  • bar_max (float, optional) – Colorbar maximum value

  • border_color (str, optional) – Color for state lines and international borders Default to black

  • cmap (matplotlib colormap name or AE colormap names, optional) – Colormap to apply to data Default to “ae_orange” for mapped data or color-blind friendly “categorical_cb” for timeseries data.

  • hover_fill_color (str, optional) – Default to “blue”

Returns:

holoviews.core.overlay.Overlay – Map of input data

climakitae.explore.threshold_tools.get_ks_stat(bms, distr='gev', multiple_points=True)#

Function to perform kstest on input DataArray

Creates a dataset of ks test d-statistics and p-values from an inputed maximum series.

Parameters:
  • bms (xarray.DataArray) – Block maximum series, can be output from the function get_block_maxima()

  • distr (str)

  • multiple_points (boolean)

Returns:

xarray.Dataset

climakitae.explore.threshold_tools.get_return_period(bms, return_value, distr='gev', bootstrap_runs=100, conf_int_lower_bound=2.5, conf_int_upper_bound=97.5, multiple_points=True)#

Creates xarray Dataset with return periods and confidence intervals from maximum series.

Parameters:
  • bms (xarray.DataArray) – Block maximum series, can be output from the function get_block_maxima()

  • return_value (float) – The threshold value for which to calculate the return period of occurance

  • distr (str) – The type of extreme value distribution to fit

  • bootstrap_runs (int) – Number of bootstrap samples

  • conf_int_lower_bound (float) – Confidence interval lower bound

  • conf_int_upper_bound (float) – Confidence interval upper bound

  • multiple_points (boolean) – Whether or not the data contains multiple points (has x, y dimensions)

Returns:

xarray.Dataset – Dataset with return periods and confidence intervals

climakitae.explore.threshold_tools.get_return_prob(bms, threshold, distr='gev', bootstrap_runs=100, conf_int_lower_bound=2.5, conf_int_upper_bound=97.5, multiple_points=True)#

Creates xarray Dataset with return probabilities and confidence intervals from maximum series.

Parameters:
  • bms (xarray.DataArray) – Block maximum series, can be output from the function get_block_maxima()

  • threshold (float) – The threshold value for which to calculate the probability of exceedance

  • distr (str) – The type of extreme value distribution to fit

  • bootstrap_runs (int) – Number of bootstrap samples

  • conf_int_lower_bound (float) – Confidence interval lower bound

  • conf_int_upper_bound (float) – Confidence interval upper bound

  • multiple_points (boolean) – Whether or not the data contains multiple points (has x, y dimensions)

Returns:

xarray.Dataset – Dataset with return probabilities and confidence intervals

climakitae.explore.threshold_tools.get_return_value(bms, return_period=10, distr='gev', bootstrap_runs=100, conf_int_lower_bound=2.5, conf_int_upper_bound=97.5, multiple_points=True)#

Creates xarray Dataset with return values and confidence intervals from maximum series.

Parameters:
  • bms (xarray.DataArray) – Block maximum series, can be output from the function get_block_maxima()

  • return_period (float) – The recurrence interval (in years) for which to calculate the return value

  • distr (str) – The type of extreme value distribution to fit

  • bootstrap_runs (int) – Number of bootstrap samples

  • conf_int_lower_bound (float) – Confidence interval lower bound

  • conf_int_upper_bound (float) – Confidence interval upper bound

  • multiple_points (boolean) – Whether or not the data contains multiple points (has x, y dimensions)

Returns:

xarray.Dataset – Dataset with return values and confidence intervals

climakitae.explore.threshold_tools.plot_exceedance_count(exceedance_count)#

Create panel column object with embedded plots

Plots each simulation as a different color line. Drop down option to select different scenario. Currently can only plot for one location, so is expecting input to already be subsetted or an area average.

Parameters:

exceedance_count (xarray.DataArray)

Returns:

panel.Column

climakitae.explore.thresholds module#

Backend functions and classes for building the thresholds GUI.

class climakitae.explore.thresholds.ThresholdParameters(*args, **params)

Bases: DataParametersWithPanes

params(changed_loc_and_var=Boolean, changed_units=Boolean, duration1_length=Integer, duration1_type=Selector, duration2_length=Integer, duration2_type=Selector, group_length=Integer, group_type=Selector, num_timesteps=Integer, period_length=Integer, period_type=Selector, reload_data=Action, reload_plot=Action, smoothing=Selector, threshold_direction=Selector, threshold_value=Number, _data_warning=String, _station_data_info=String, area_average=Selector, area_subset=Selector, cached_area=ListSelector, data_type=Selector, downscaling_method=Selector, extended_description=Selector, latitude=Range, longitude=Range, resolution=Selector, scenario_historical=ListSelector, scenario_ssp=ListSelector, simulation=ListSelector, station=ListSelector, time_slice=Range, timescale=Selector, units=Selector, variable=Selector, variable_id=ListSelector, variable_type=Selector, name=String) An object that holds the data options parameters for theexplore.thresholds panel. Parameters of ‘ThresholdParameters’ ===================================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Bounds Mode 

area_subset None Selector V RW cached_area None ListSelector V RW latitude (32.5, 42) Range (10, 67) V RW longitude (-125.5, -114) Range (-156.82317, -84.18701) V RW variable_type ‘Variable’ Selector V RW time_slice (1980, 2015) Range (1950, 2100) V RW resolution ‘9 km’ Selector V RW timescale ‘monthly’ Selector V RW scenario_historical [‘Historical Climate’] ListSelector V RW area_average ‘No’ Selector V RW downscaling_method ‘Dynamical’ Selector V RW data_type ‘Gridded’ Selector V RW station None ListSelector V RW _station_data_info ‘’ String V RW scenario_ssp None ListSelector V RW simulation None ListSelector V RW variable None Selector V RW units None Selector V RW extended_description None Selector V RW variable_id None ListSelector V RW _data_warning ‘’ String V RW threshold_direction ‘above’ Selector V RW threshold_value 0 Number V RW duration1_length 1 Integer (0, None) V RW duration1_type ‘hour’ Selector V RW period_length 1 Integer (0, None) V RW period_type ‘year’ Selector V RW group_length 1 Integer (0, None) V RW group_type ‘hour’ Selector V RW duration2_length 1 Integer (0, None) V RW duration2_type ‘hour’ Selector V RW smoothing ‘None’ Selector V RW num_timesteps 10 Integer (0, None) V RW reload_plot <function ThresholdParameters.<lambda… Action V RW reload_data <function ThresholdParameters.<lambda… Action V RW changed_loc_and_var True Boolean (0, 1) V RW changed_units False Boolean (0, 1) V RW

Parameter docstrings: =====================

area_subset: < No docstring available > cached_area: < No docstring available > latitude: < No docstring available > longitude: < No docstring available > variable_type: Choose between variable or AE derived index time_slice: < No docstring available > resolution: < No docstring available > timescale: < No docstring available > scenario_historical: < No docstring available > area_average: Compute an area average? downscaling_method: < No docstring available > data_type: < No docstring available > station: < No docstring available > _station_data_info: Information about the bias correction process and resolution scenario_ssp: < No docstring available > simulation: < No docstring available > variable: < No docstring available > units: < No docstring available > extended_description: < No docstring available > variable_id: < No docstring available > _data_warning: Warning if user has made a bad selection threshold_direction: < No docstring available > threshold_value: < No docstring available > duration1_length: < No docstring available > duration1_type: < No docstring available > period_length: < No docstring available > period_type: < No docstring available > group_length: < No docstring available > group_type: < No docstring available > duration2_length: < No docstring available > duration2_type: < No docstring available > smoothing: < No docstring available > num_timesteps: < No docstring available > reload_plot: < No docstring available > reload_data: < No docstring available > changed_loc_and_var: < No docstring available > changed_units: < No docstring available >

changed_loc_and_var = True
changed_units = False
duration1_length = 1
duration1_type = 'hour'
duration2_length = 1
duration2_row()

A reactive row for duration2 options that updates if group is updated

duration2_type = 'hour'
group_length = 1
group_row()

A reactive row for duration2 options that updates if group is updated

group_type = 'hour'
name = 'ThresholdParameters'
num_timesteps = 10
period_length = 1
period_type = 'year'
reload_data()
reload_plot()
smoothing = 'None'
smoothing_card()

A reactive panel card used by _exceedance_visualize that only displays the num_timesteps option if smoothing is selected.

threshold_direction = 'above'
threshold_value = 0
transform_data()
view()
climakitae.explore.thresholds.thresholds_visualize(self, option=1)

Function for constructing and displaying the explore.thresholds() panel.

climakitae.explore.timeseries module#

class climakitae.explore.timeseries.TimeSeries(data)#

Bases: object

Holds the instance of TimeSeriesParameters that is used for the following purposes: 1) to display a panel that previews various time-series transforms (explore), and 2) to save the transform represented by the current state of that preview into a new variable (output_current).

explore()#

Create an interactive visualization of the timeseries data, dependant on the attributes set in previous steps. Allows user to directly modify the data in the GUI. Only works in a jupyter notebook environment.

Returns:

panel.layout.base.Column

output_current()#

Output the current attributes of the class to a DataArray object. Allows the data to be easily accessed by the user after modifying the attributes directly in the explore panel, for example.

Returns:

DataArray

class climakitae.explore.timeseries.TimeSeriesParameters(dataset, **params)#

Bases: Parameterized

params(anomaly=Boolean, extremes=ListSelector, num_timesteps=Integer, percentile=Number, reference_range=CalendarDateRange, remove_seasonal_cycle=Boolean, resample_period=Selector, resample_window=Integer, separate_seasons=Boolean, smoothing=Selector, name=String) Class of python Param to hold parameters for Time Series. Parameters of ‘TimeSeriesParameters’ ====================================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Bounds Mode 

resample_period ‘years’ Selector V RW anomaly True Boolean (0, 1) V RW reference_range (datetime.datetime(1981, 1, 1, 0, 0),… CalendarDateRange (1980-01-01 00:00:00, 2021-12-31 00:00:00) V RW remove_seasonal_cycle False Boolean (0, 1) V RW smoothing ‘None’ Selector V RW num_timesteps 0 Integer (0, 240) V RW separate_seasons False Boolean (0, 1) V RW extremes [] ListSelector V RW resample_window 1 Integer (1, 30) V RW percentile 0 Number (0, 1) V RW

Parameter docstrings: =====================

resample_period: < No docstring available > anomaly: < No docstring available > reference_range: < No docstring available > remove_seasonal_cycle: < No docstring available > smoothing: < No docstring available > num_timesteps: < No docstring available > separate_seasons: < No docstring available > extremes: < No docstring available > resample_window: < No docstring available > percentile: Relevant if ‘running extremes’ is ‘percentile.

anomaly = True#
extremes = []#
name = 'TimeSeriesParameters'#
num_timesteps = 0#
percentile = 0#
reference_range = (datetime.datetime(1981, 1, 1, 0, 0), datetime.datetime(2010, 12, 31, 0, 0))#
remove_seasonal_cycle = False#
resample_period = 'years'#
resample_window = 1#
separate_seasons = False#
smoothing = 'None'#
transform_data()#

Returns a dataset that has been transformed in the ways that the params indicate, ready to plot in the preview window (“view” method of this class), or be saved out.

update_anom()#
update_seasonal_cycle()#
view()#

Does the main work of timeseries.explore(). Updating a plot in real-time to enable the user to preview the results of any timeseries transforms.

climakitae.explore.timeseries.timeseries_visualize(choices)#

Uses holoviz ‘panel’ library to display the parameters and view defined in an instance of _TimeSeriesParams.

climakitae.explore.uncertainty module#

class climakitae.explore.uncertainty.CmipOpt(variable='tas', area_subset='states', location='California', timescale='monthly', area_average=True)#

Bases: object

A class for holding relevant data options for cmip preprocessing

Parameters:
  • variable (str) – variable name, cf-compliant (or cmip6 variable name)

  • area_subset (str) – geographic boundary name (states/counties)

  • location (str) – geographic area name (name of county/state)

  • timescale (str) – frequency of data

  • area_average (bool) – average computed across domain

_cmip_clip()#

CMIP6-specific subsetting

climakitae.explore.uncertainty.calc_anom(ds_yr, base_start, base_end)#

Calculates the difference relative to a historical baseline.

First calculates a baseline per simulation using input (base_start, base_end). Then calculates the anomaly from baseline per simulation.

Parameters:
  • ds_yr (Dataset) – must be the output from cmip_annual

  • base_start (int) – start year of baseline to calculate

  • base_end (int) – end year of the baseline to calculate

Returns:

mdl_temp_anom (Dataset) – Anomaly data calculated with input baseline start and end

climakitae.explore.uncertainty.cmip_mmm(ds)#

Calculate the CMIP6 multi-model mean by collapsing across simulations.

Parameters:

ds (Dataset) – Input data, multiple simulations

Returns:

ds_mmm (Dataset) – Mean across input data taken on simulation dim

climakitae.explore.uncertainty.compute_vmin_vmax(da_min, da_max)#

Computes min, max, and center for plotting.

Parameters:
  • da_min (Dataset) – data input to calculate the minimum

  • da_max (Dataset) – data input to calculate the maximum

Returns:

  • vmin (int) – minimum value

  • vmax (int) – maximum value

  • sopt (bool) – indicates symmetry if vmin and vmax have opposite signs

climakitae.explore.uncertainty.get_ensemble_data(variable, selections, cmip_names, warm_level=3.0)#

Returns processed data from multiple CMIP6 models for uncertainty analysis.

Searches the CMIP6 data catalog for data from models that have specific ensemble member id in the historical and ssp370 runs. Preprocessing includes subsetting for specific location and dropping the member_id for easier analysis.

Get’s future data at warming level range. Slices historical period to 1981-2010.

Parameters:
  • variable (str) – Name of variable

  • cmip_names (list of str) – Name of CMIP6 simulations

  • selections (_DataSelector) – Data and location settings

  • warm_level (float, optional) – Global warming level to use, default to 3.0

Returns:

hist_ds, warm_ds (list of Dataset)

climakitae.explore.uncertainty.get_ks_pval_df(sample1, sample2, sig_lvl=0.05)#

Performs a Kolmogorov-Smirnov test at all lat, lon points

Parameters:
  • sample1 (Dataset) – first sample for comparison

  • sample2 (Dataset) – sample against which to compare sample1

  • sig_lvl (float) – alpha level for statistical significance

Returns:

p_df (DataFrame) – columns are lat, lon, and p_value; only retains spatial points where p_value < sig_lvl

climakitae.explore.uncertainty.get_warm_level(warm_level, ds, multi_ens=False, ipcc=True)#

Subsets projected data centered to the year that the selected warming level is reached for a particular simulation/member_id

Parameters:
  • warm_level (float or int) – options: 1.5, 2.0, 3.0, 4.0

  • ds (Dataset) – Can only have one ‘simulation’ coordinate

  • multi_ens (bool, default False) – Set to True if passing a simulation with multiple member_id

  • ipcc (bool, default True) – Set to False if performing warming level analysis with respect to IPCC standard baseline (1850-1900)

Returns:

Dataset – Subset of projected data -14/+15 years from warming level threshold

climakitae.explore.uncertainty.grab_multimodel_data(copt, alpha_sort=False)#

Returns processed data from multiple CMIP6 models for uncertainty analysis.

Searches the CMIP6 data catalog for data from models that have specific ensemble member id in the historical and ssp370 runs. Preprocessing includes subsetting for specific location and dropping the member_id for easier analysis.

Parameters:
  • copt (CmipOpt) – Selections: variable, area_subset, location, area_average, timescale

  • alpha_sort (bool, default False) – Set to True if sorting model names alphabetically is desired

Returns:

mdls_ds (Dataset) – Processed CMIP6 models concatenated into a single ds

climakitae.explore.uncertainty.weighted_temporal_mean(ds)#

weight by days in each month

Function for calculating annual averages pulled + adapted from NCAR Link: https://ncar.github.io/esds/posts/2021/yearly-averages-xarray/

Parameters:

ds (xarray.DataArray)

Returns:

obs_sum / ones_out (xarray.Dataset)

climakitae.explore.timeseries module#

class climakitae.explore.timeseries.TimeSeries(data)#

Bases: object

Holds the instance of TimeSeriesParameters that is used for the following purposes: 1) to display a panel that previews various time-series transforms (explore), and 2) to save the transform represented by the current state of that preview into a new variable (output_current).

explore()#

Create an interactive visualization of the timeseries data, dependant on the attributes set in previous steps. Allows user to directly modify the data in the GUI. Only works in a jupyter notebook environment.

Returns:

panel.layout.base.Column

output_current()#

Output the current attributes of the class to a DataArray object. Allows the data to be easily accessed by the user after modifying the attributes directly in the explore panel, for example.

Returns:

DataArray

class climakitae.explore.timeseries.TimeSeriesParameters(dataset, **params)#

Bases: Parameterized

params(anomaly=Boolean, extremes=ListSelector, num_timesteps=Integer, percentile=Number, reference_range=CalendarDateRange, remove_seasonal_cycle=Boolean, resample_period=Selector, resample_window=Integer, separate_seasons=Boolean, smoothing=Selector, name=String) Class of python Param to hold parameters for Time Series. Parameters of ‘TimeSeriesParameters’ ====================================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Bounds Mode 

resample_period ‘years’ Selector V RW anomaly True Boolean (0, 1) V RW reference_range (datetime.datetime(1981, 1, 1, 0, 0),… CalendarDateRange (1980-01-01 00:00:00, 2021-12-31 00:00:00) V RW remove_seasonal_cycle False Boolean (0, 1) V RW smoothing ‘None’ Selector V RW num_timesteps 0 Integer (0, 240) V RW separate_seasons False Boolean (0, 1) V RW extremes [] ListSelector V RW resample_window 1 Integer (1, 30) V RW percentile 0 Number (0, 1) V RW

Parameter docstrings: =====================

resample_period: < No docstring available > anomaly: < No docstring available > reference_range: < No docstring available > remove_seasonal_cycle: < No docstring available > smoothing: < No docstring available > num_timesteps: < No docstring available > separate_seasons: < No docstring available > extremes: < No docstring available > resample_window: < No docstring available > percentile: Relevant if ‘running extremes’ is ‘percentile.

anomaly = True#
extremes = []#
name = 'TimeSeriesParameters'#
num_timesteps = 0#
percentile = 0#
reference_range = (datetime.datetime(1981, 1, 1, 0, 0), datetime.datetime(2010, 12, 31, 0, 0))#
remove_seasonal_cycle = False#
resample_period = 'years'#
resample_window = 1#
separate_seasons = False#
smoothing = 'None'#
transform_data()#

Returns a dataset that has been transformed in the ways that the params indicate, ready to plot in the preview window (“view” method of this class), or be saved out.

update_anom()#
update_seasonal_cycle()#
view()#

Does the main work of timeseries.explore(). Updating a plot in real-time to enable the user to preview the results of any timeseries transforms.

climakitae.explore.timeseries.timeseries_visualize(choices)#

Uses holoviz ‘panel’ library to display the parameters and view defined in an instance of _TimeSeriesParams.

climakitae.explore.uncertainty module#

class climakitae.explore.uncertainty.CmipOpt(variable='tas', area_subset='states', location='California', timescale='monthly', area_average=True)#

Bases: object

A class for holding relevant data options for cmip preprocessing

Parameters:
  • variable (str) – variable name, cf-compliant (or cmip6 variable name)

  • area_subset (str) – geographic boundary name (states/counties)

  • location (str) – geographic area name (name of county/state)

  • timescale (str) – frequency of data

  • area_average (bool) – average computed across domain

_cmip_clip()#

CMIP6-specific subsetting

climakitae.explore.uncertainty.calc_anom(ds_yr, base_start, base_end)#

Calculates the difference relative to a historical baseline.

First calculates a baseline per simulation using input (base_start, base_end). Then calculates the anomaly from baseline per simulation.

Parameters:
  • ds_yr (Dataset) – must be the output from cmip_annual

  • base_start (int) – start year of baseline to calculate

  • base_end (int) – end year of the baseline to calculate

Returns:

mdl_temp_anom (Dataset) – Anomaly data calculated with input baseline start and end

climakitae.explore.uncertainty.cmip_mmm(ds)#

Calculate the CMIP6 multi-model mean by collapsing across simulations.

Parameters:

ds (Dataset) – Input data, multiple simulations

Returns:

ds_mmm (Dataset) – Mean across input data taken on simulation dim

climakitae.explore.uncertainty.compute_vmin_vmax(da_min, da_max)#

Computes min, max, and center for plotting.

Parameters:
  • da_min (Dataset) – data input to calculate the minimum

  • da_max (Dataset) – data input to calculate the maximum

Returns:

  • vmin (int) – minimum value

  • vmax (int) – maximum value

  • sopt (bool) – indicates symmetry if vmin and vmax have opposite signs

climakitae.explore.uncertainty.get_ensemble_data(variable, selections, cmip_names, warm_level=3.0)#

Returns processed data from multiple CMIP6 models for uncertainty analysis.

Searches the CMIP6 data catalog for data from models that have specific ensemble member id in the historical and ssp370 runs. Preprocessing includes subsetting for specific location and dropping the member_id for easier analysis.

Get’s future data at warming level range. Slices historical period to 1981-2010.

Parameters:
  • variable (str) – Name of variable

  • cmip_names (list of str) – Name of CMIP6 simulations

  • selections (_DataSelector) – Data and location settings

  • warm_level (float, optional) – Global warming level to use, default to 3.0

Returns:

hist_ds, warm_ds (list of Dataset)

climakitae.explore.uncertainty.get_ks_pval_df(sample1, sample2, sig_lvl=0.05)#

Performs a Kolmogorov-Smirnov test at all lat, lon points

Parameters:
  • sample1 (Dataset) – first sample for comparison

  • sample2 (Dataset) – sample against which to compare sample1

  • sig_lvl (float) – alpha level for statistical significance

Returns:

p_df (DataFrame) – columns are lat, lon, and p_value; only retains spatial points where p_value < sig_lvl

climakitae.explore.uncertainty.get_warm_level(warm_level, ds, multi_ens=False, ipcc=True)#

Subsets projected data centered to the year that the selected warming level is reached for a particular simulation/member_id

Parameters:
  • warm_level (float or int) – options: 1.5, 2.0, 3.0, 4.0

  • ds (Dataset) – Can only have one ‘simulation’ coordinate

  • multi_ens (bool, default False) – Set to True if passing a simulation with multiple member_id

  • ipcc (bool, default True) – Set to False if performing warming level analysis with respect to IPCC standard baseline (1850-1900)

Returns:

Dataset – Subset of projected data -14/+15 years from warming level threshold

climakitae.explore.uncertainty.grab_multimodel_data(copt, alpha_sort=False)#

Returns processed data from multiple CMIP6 models for uncertainty analysis.

Searches the CMIP6 data catalog for data from models that have specific ensemble member id in the historical and ssp370 runs. Preprocessing includes subsetting for specific location and dropping the member_id for easier analysis.

Parameters:
  • copt (CmipOpt) – Selections: variable, area_subset, location, area_average, timescale

  • alpha_sort (bool, default False) – Set to True if sorting model names alphabetically is desired

Returns:

mdls_ds (Dataset) – Processed CMIP6 models concatenated into a single ds

climakitae.explore.uncertainty.weighted_temporal_mean(ds)#

weight by days in each month

Function for calculating annual averages pulled + adapted from NCAR Link: https://ncar.github.io/esds/posts/2021/yearly-averages-xarray/

Parameters:

ds (xarray.DataArray)

Returns:

obs_sum / ones_out (xarray.Dataset)

climakitae.explore.warming module#

Helper functions for performing analyses related to global warming levels, along with backend code for building the warming levels GUI

climakitae.explore.warming.GCM_PostageStamps_MAIN_compute(wl_viz)#

Compute helper for main postage stamps. Returns dictionary of warming levels to stats visuals.

climakitae.explore.warming.GCM_PostageStamps_STATS_compute(wl_viz)#

Compute helper for stats postage stamps. Returns dictionary of warming levels to stats visuals.

class climakitae.explore.warming.WarmingLevelChoose(*args, **params)#

Bases: DataParametersWithPanes

params(anom=Selector, window=Integer, _data_warning=String, _station_data_info=String, area_average=Selector, area_subset=Selector, cached_area=ListSelector, data_type=Selector, downscaling_method=Selector, extended_description=Selector, latitude=Range, longitude=Range, resolution=Selector, scenario_historical=ListSelector, scenario_ssp=ListSelector, simulation=ListSelector, station=ListSelector, time_slice=Range, timescale=Selector, units=Selector, variable=Selector, variable_id=ListSelector, variable_type=Selector, name=String) Parameters of ‘WarmingLevelChoose’ ==================================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Bounds Mode 

area_subset None Selector V RW cached_area None ListSelector V RW latitude (32.5, 42) Range (10, 67) V RW longitude (-125.5, -114) Range (-156.82317, -84.18701) V RW variable_type ‘Variable’ Selector V RW time_slice (1980, 2015) Range (1950, 2100) V RW resolution ‘9 km’ Selector V RW timescale ‘monthly’ Selector V RW scenario_historical [‘Historical Climate’] ListSelector V RW area_average ‘No’ Selector V RW downscaling_method ‘Dynamical’ Selector V RW data_type ‘Gridded’ Selector V RW station None ListSelector V RW _station_data_info ‘’ String V RW scenario_ssp None ListSelector V RW simulation None ListSelector V RW variable None Selector V RW units None Selector V RW extended_description None Selector V RW variable_id None ListSelector V RW _data_warning ‘’ String V RW window 15 Integer (5, 25) V RW anom ‘Yes’ Selector V RW

Parameter docstrings: =====================

area_subset: < No docstring available > cached_area: < No docstring available > latitude: < No docstring available > longitude: < No docstring available > variable_type: Choose between variable or AE derived index time_slice: < No docstring available > resolution: < No docstring available > timescale: < No docstring available > scenario_historical: < No docstring available > area_average: Compute an area average? downscaling_method: < No docstring available > data_type: < No docstring available > station: < No docstring available > _station_data_info: Information about the bias correction process and resolution scenario_ssp: < No docstring available > simulation: < No docstring available > variable: < No docstring available > units: < No docstring available > extended_description: < No docstring available > variable_id: < No docstring available > _data_warning: Warning if user has made a bad selection window: Years around Global Warming Level (+/-)   (e.g. 15 means a 30yr window) anom: Return an anomaly   (difference from historical reference period)?

anom = 'Yes'#
name = 'WarmingLevelChoose'#
window = 15#
class climakitae.explore.warming.WarmingLevelVisualize(gwl_snapshots, wl_params, cmap, warming_levels)#

Bases: Parameterized

params(ssp=Selector, warmlevel=Selector, name=String) Create Warming Levels panel GUI Parameters of ‘WarmingLevelVisualize’ =====================================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Mode 

warmlevel 1.5 Selector V RW ssp ‘All’ Selector V RW

Parameter docstrings: =====================

warmlevel: Warming level in degrees Celcius. ssp: Shared Socioeconomic Pathway.

GCM_PostageStamps_MAIN()#
GCM_PostageStamps_STATS()#
GMT_context_plot()#

Display GMT plot using package data that updates whenever the warming level or SSP is changed by the user.

compute_stamps()#
hist_data = 5%      Mean       95% Year                               1950 -0.060030  0.252242  0.608546 1951 -0.055686  0.274715  0.525308 1952 -0.042891  0.274303  0.540725 1953 -0.020530  0.253376  0.535419 1954 -0.127657  0.246369  0.553914 ...        ...       ...       ... 2010  0.836971  1.002620  1.280120 2011  0.842644  1.036330  1.189250 2012  0.882825  1.061300  1.240670 2013  0.913046  1.084920  1.285700 2014  0.930436  1.100040  1.331640  [65 rows x 3 columns]#
name = 'WarmingLevelVisualize'#
ssp = 'All'#
ssp119_data = 5%      Mean       95% Year                                 2015.0  1.015465  1.098807  1.187129 2016.0  1.032164  1.123234  1.219922 2017.0  1.049922  1.148856  1.253968 2018.0  1.068048  1.175205  1.289161 2019.0  1.084379  1.200604  1.324116 ...          ...       ...       ... 2095.0  1.075387  1.399596  1.791378 2096.0  1.070570  1.395932  1.787640 2097.0  1.065703  1.392231  1.782751 2098.0  1.061259  1.388403  1.778048 2099.0  1.056233  1.384914  1.774195  [85 rows x 3 columns]#
ssp126_data = 5%      Mean       95% Year                               2015  1.010286  1.099248  1.196469 2016  1.027754  1.124936  1.232381 2017  1.045768  1.151127  1.267277 2018  1.063368  1.176867  1.302330 2019  1.081301  1.202266  1.340351 ...        ...       ...       ... 2095  1.338565  1.738994  2.330311 2096  1.333901  1.734825  2.329501 2097  1.328776  1.731581  2.328148 2098  1.324557  1.727423  2.326610 2099  1.319652  1.723633  2.324613  [85 rows x 3 columns]#
ssp245_data = 5%      Mean       95% Year                                 2015.0  1.011145  1.103229  1.194782 2016.0  1.029888  1.126902  1.229157 2017.0  1.047698  1.151919  1.264238 2018.0  1.064357  1.177257  1.300236 2019.0  1.081322  1.202911  1.336965 ...          ...       ...       ... 2095.0  2.121174  2.709810  3.504371 2096.0  2.126581  2.721367  3.520522 2097.0  2.132023  2.730281  3.536066 2098.0  2.138236  2.739834  3.550991 2099.0  2.144144  2.748134  3.565741  [85 rows x 3 columns]#
ssp370_data = 5%      Mean       95% Year                               2015  1.004820  1.094355  1.191357 2016  1.020226  1.117929  1.223911 2017  1.037919  1.143451  1.257962 2018  1.055631  1.169831  1.293766 2019  1.072719  1.194816  1.333081 ...        ...       ...       ... 2095  2.959685  3.758452  4.812138 2096  2.986875  3.796472  4.867173 2097  3.014037  3.835124  4.922075 2098  3.040392  3.872383  4.975588 2099  3.066457  3.908723  5.027863  [85 rows x 3 columns]#
ssp585_data = 5%      Mean       95% Year                                 2015.0  1.020885  1.110088  1.214465 2016.0  1.040535  1.136830  1.251050 2017.0  1.060933  1.166139  1.289023 2018.0  1.079272  1.195275  1.329559 2019.0  1.099179  1.223858  1.373857 ...          ...       ...       ... 2095.0  3.429178  4.548681  5.950025 2096.0  3.462596  4.596716  6.018712 2097.0  3.494458  4.644481  6.086626 2098.0  3.526018  4.689658  6.153901 2099.0  3.556016  4.734679  6.219621  [85 rows x 3 columns]#
warmlevel = 1.5#
class climakitae.explore.warming.WarmingLevels(**params)#

Bases: object

A container for all of the warming levels-related functionality: - A pared-down Select panel, under “choose_data” - a “calculate” step where most of the waiting occurs - an optional “visualize” panel, as an instance of WarmingLevelVisualize - postage stamps from visualize “main” tab are accessible via “gwl_snapshots” - data sliced around gwl window retrieved from “sliced_data”

calculate()#
catalog_data = <xarray.DataArray ()> array(nan)#
choose_data()#
find_warming_slice(level, gwl_times)#

Find the warming slice data for the current level from the catalog data.

gwl_snapshots = <xarray.DataArray ()> array(nan)#
sliced_data = <xarray.DataArray ()> array(nan)#
visualize()#
climakitae.explore.warming.clean_list(data, gwl_times)#
climakitae.explore.warming.clean_warm_data(warm_data)#
Cleaning the warming levels data in 3 parts:
  1. Removing simulations where this warming level is not crossed. (centered_year)

  2. Removing timestamps at the end to account for leap years (time)

  3. Removing simulations that go past 2100 for its warming level window (all_sims)

climakitae.explore.warming.fit_models_and_plots(new_data, trad_data, dist_name)#

Given a xr.DataArray and a distribution name, fit the distribution to the data, and generate a plot denoting a histogram of the data and the fitted distribution to the data.

climakitae.explore.warming.get_sliced_data(y, level, years, window=15, anom='Yes')#

Calculating warming level anomalies.

Parameters:
  • y (DataArray) – Data to compute warming level anomolies, one simulation at a time via groupby

  • level (str) – Warming level amount

  • years (DataFrame) – Lookup table for the date a given simulation reaches each warming level.

  • window (int, optional) – Number of years to generate time window for. Default to 15 years. For example, a 15 year window would generate a window of 15 years in the past from the central warming level date, and 15 years into the future. I.e. if a warming level is reached in 2030, the window would be (2015,2045).

  • scenario (str, one of "ssp370", "ssp585", "ssp245") – Shared Socioeconomic Pathway. Default to SSP 3-7.0

Returns:

anomaly_da (DataArray) – Warming level anomalies at all warming levels for a scenario

climakitae.explore.warming.process_item(y)#
climakitae.explore.warming.relabel_axis(all_sims_dim)#
climakitae.explore.warming.warming_levels_select(self)#

An initial pared-down version of the Select panel, with fewer options exposed, to help the user select a variable and location for further warming level steps.

climakitae.explore.warming.warming_levels_visualize(wl_viz)#

Module contents#

Contains source code for the explore tools, used to access panel GUIs for exploring several climatological topics of interest: 1. Average meteorological year 2. Thresholds 3. Global warming levels

class climakitae.explore.AverageMetYear(*args, **params)#

Bases: AverageMetYearParameters

params(amy_type=Selector, cmap=Selector, computation_method=Selector, reload_data=Action, tmy_computation_description=Selector, warmlevel=Selector, _data_warning=String, _station_data_info=String, area_average=Selector, area_subset=Selector, cached_area=ListSelector, data_type=Selector, downscaling_method=Selector, extended_description=Selector, latitude=Range, longitude=Range, resolution=Selector, scenario_historical=ListSelector, scenario_ssp=ListSelector, simulation=ListSelector, station=ListSelector, time_slice=Range, timescale=Selector, units=Selector, variable=Selector, variable_id=ListSelector, variable_type=Selector, name=String) Display AMY panel. Parameters of ‘AverageMetYear’ ==============================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Bounds Mode 

area_subset None Selector V RW cached_area None ListSelector V RW latitude (32.5, 42) Range (10, 67) V RW longitude (-125.5, -114) Range (-156.82317, -84.18701) V RW variable_type ‘Variable’ Selector V RW time_slice (1980, 2015) Range (1950, 2100) V RW resolution ‘9 km’ Selector V RW timescale ‘monthly’ Selector V RW scenario_historical [‘Historical Climate’] ListSelector V RW area_average ‘No’ Selector V RW downscaling_method ‘Dynamical’ Selector V RW data_type ‘Gridded’ Selector V RW station None ListSelector V RW _station_data_info ‘’ String V RW scenario_ssp None ListSelector V RW simulation None ListSelector V RW variable None Selector V RW units None Selector V RW extended_description None Selector V RW variable_id None ListSelector V RW _data_warning ‘’ String V RW amy_type ‘Absolute’ Selector V RW computation_method None Selector V RW tmy_computation_description None Selector V RW cmap None Selector V RW warmlevel 1.5 Selector V RW reload_data <function AverageMetYearParameters.<l… Action V RW

Parameter docstrings: =====================

area_subset: < No docstring available > cached_area: < No docstring available > latitude: < No docstring available > longitude: < No docstring available > variable_type: Choose between variable or AE derived index time_slice: < No docstring available > resolution: < No docstring available > timescale: < No docstring available > scenario_historical: < No docstring available > area_average: Compute an area average? downscaling_method: < No docstring available > data_type: < No docstring available > station: < No docstring available > _station_data_info: Information about the bias correction process and resolution scenario_ssp: < No docstring available > simulation: < No docstring available > variable: < No docstring available > units: < No docstring available > extended_description: < No docstring available > variable_id: < No docstring available > _data_warning: Warning if user has made a bad selection amy_type: < No docstring available > computation_method: < No docstring available > tmy_computation_description: < No docstring available > cmap: < No docstring available > warmlevel: < No docstring available > reload_data: < No docstring available >

name = 'AverageMetYear'#
show()#
class climakitae.explore.Thresholds(*args, **params)#

Bases: ThresholdParameters

params(changed_loc_and_var=Boolean, changed_units=Boolean, duration1_length=Integer, duration1_type=Selector, duration2_length=Integer, duration2_type=Selector, group_length=Integer, group_type=Selector, num_timesteps=Integer, period_length=Integer, period_type=Selector, reload_data=Action, reload_plot=Action, smoothing=Selector, threshold_direction=Selector, threshold_value=Number, _data_warning=String, _station_data_info=String, area_average=Selector, area_subset=Selector, cached_area=ListSelector, data_type=Selector, downscaling_method=Selector, extended_description=Selector, latitude=Range, longitude=Range, resolution=Selector, scenario_historical=ListSelector, scenario_ssp=ListSelector, simulation=ListSelector, station=ListSelector, time_slice=Range, timescale=Selector, units=Selector, variable=Selector, variable_id=ListSelector, variable_type=Selector, name=String) Display Thresholds panel. Parameters of ‘Thresholds’ ==========================  Parameters changed from their default values are marked in red. Soft bound values are marked in cyan. C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name Value Type Bounds Mode 

area_subset None Selector V RW cached_area None ListSelector V RW latitude (32.5, 42) Range (10, 67) V RW longitude (-125.5, -114) Range (-156.82317, -84.18701) V RW variable_type ‘Variable’ Selector V RW time_slice (1980, 2015) Range (1950, 2100) V RW resolution ‘9 km’ Selector V RW timescale ‘monthly’ Selector V RW scenario_historical [‘Historical Climate’] ListSelector V RW area_average ‘No’ Selector V RW downscaling_method ‘Dynamical’ Selector V RW data_type ‘Gridded’ Selector V RW station None ListSelector V RW _station_data_info ‘’ String V RW scenario_ssp None ListSelector V RW simulation None ListSelector V RW variable None Selector V RW units None Selector V RW extended_description None Selector V RW variable_id None ListSelector V RW _data_warning ‘’ String V RW threshold_direction ‘above’ Selector V RW threshold_value 0 Number V RW duration1_length 1 Integer (0, None) V RW duration1_type ‘hour’ Selector V RW period_length 1 Integer (0, None) V RW period_type ‘year’ Selector V RW group_length 1 Integer (0, None) V RW group_type ‘hour’ Selector V RW duration2_length 1 Integer (0, None) V RW duration2_type ‘hour’ Selector V RW smoothing ‘None’ Selector V RW num_timesteps 10 Integer (0, None) V RW reload_plot <function ThresholdParameters.<lambda… Action V RW reload_data <function ThresholdParameters.<lambda… Action V RW changed_loc_and_var True Boolean (0, 1) V RW changed_units False Boolean (0, 1) V RW

Parameter docstrings: =====================

area_subset: < No docstring available > cached_area: < No docstring available > latitude: < No docstring available > longitude: < No docstring available > variable_type: Choose between variable or AE derived index time_slice: < No docstring available > resolution: < No docstring available > timescale: < No docstring available > scenario_historical: < No docstring available > area_average: Compute an area average? downscaling_method: < No docstring available > data_type: < No docstring available > station: < No docstring available > _station_data_info: Information about the bias correction process and resolution scenario_ssp: < No docstring available > simulation: < No docstring available > variable: < No docstring available > units: < No docstring available > extended_description: < No docstring available > variable_id: < No docstring available > _data_warning: Warning if user has made a bad selection threshold_direction: < No docstring available > threshold_value: < No docstring available > duration1_length: < No docstring available > duration1_type: < No docstring available > period_length: < No docstring available > period_type: < No docstring available > group_length: < No docstring available > group_type: < No docstring available > duration2_length: < No docstring available > duration2_type: < No docstring available > smoothing: < No docstring available > num_timesteps: < No docstring available > reload_plot: < No docstring available > reload_data: < No docstring available > changed_loc_and_var: < No docstring available > changed_units: < No docstring available >

name = 'Thresholds'#
show()#
climakitae.explore.amy()#
climakitae.explore.thresholds(option=1)#
climakitae.explore.warming_levels()#