nsrdb.tmy.cdf.Cdf
- class Cdf(my_arr, my_time_index, time_masks=None)[source]
Bases:
object
Class for handling cumulative distribution function methods for TMY.
- Parameters:
my_arr (np.ndarray) – Multi-year (my) daily timeseries 2D array (time, sites) for one variable (daily total GHI, daily mean temp, etc…).
my_time_index (pd.datetimeindex) – Daily datetime index corresponding to the rows in my_arr
time_masks (dict) – Lookup of boolean masks for a daily timeseries keyed by month and year integer.
Methods
plot_tmy_selection
([month, site, fig_size, ...])Plot a single site's TMY CDFs for one month.
Attributes
Get the multi-year cdf array with daily values sorted within each year and month.
Get all FS statistics for all months/years/sites.
Get the multi-year long term sorted array (values are sorted within monthly masks across all years).
Get the multi-year daily non-leap time index.
Get the list of years included in this multi-year cdf.
- property time_index
Get the multi-year daily non-leap time index.
- Returns:
time_index (pd.datetimeindex) – Daily datetime index corresponding to the rows in cdf.
- property cdf
Get the multi-year cdf array with daily values sorted within each year and month.
- Returns:
cdf (np.ndarray) – Multi-year daily timeseries array with sorted values resetting each month.
- property lt_cdf
Get the multi-year long term sorted array (values are sorted within monthly masks across all years).
- Returns:
lt_cdf (np.ndarray) – Array with the same shape as arr but with monthly values sorted across all years.
- property years
Get the list of years included in this multi-year cdf.
- Returns:
years (list) – List of years included in this cdf analysis.
- property fs_all
Get all FS statistics for all months/years/sites.
- Returns:
fs (dict) – Dictionary with month keys. Each dict value is a (y, n) array where y is years and n is sites. Each array entry is the FS metric.
- plot_tmy_selection(month=1, site=0, fig_size=(12, 9), fout=None, xlabel='Cumulative Value', ylabel='CDF', plot_years=None)[source]
Plot a single site’s TMY CDFs for one month.
- Parameters:
month (int) – Month number to plot (1-indexed)
site (int) – Site index to plot (0-indexed)
fig_size (tuple) – Figure size (height, width)
fout (str | None) – Filepath to save image to.
xlabel (str) – Xlabel string (cumulative data value).
ylabel (str) – Ylabel string (CDF fraction).
plot_years (list | None) – Optional set of years to plot (makes the plot less busy)