nsrdb.utilities.plots.Temporal
- class Temporal(f1, f2, gids1=None, gids2=None)[source]
Bases:
object
Framework to perform NSRDB temporal QA via timeseries plots.
- Parameters:
f1/f2 (str) – Two NSRDB h5 files to benchmark against each other (with paths).
gids1/gids2 (NoneType | str | list) – Optional file-specific GID’s to assign to each h5 file. None will default to the index in the h5 meta data. A string is interpreted as a meta data file with the first column being the GIDs.
Methods
attrs1
(dset)Get an attributes dictionary associated with dset in h1.
attrs2
(dset)Get an attributes dictionary associated with dset in h1.
plot_sites
(f1, f2[, gids1, gids2, dsets, ...])Plot sites in file1 against a baseline file2.
plot_timeseries
(df1, df2, title, ylabel, ...)Plot a single day timeseries for two timeseries-indexed dataframes.
Attributes
Get the gid list for h5 file 1.
Get the gid list for h5 file 2.
Get the h5 file #1 h5py file handler.
Get the h5 file #2 h5py file handler.
Get the meta data for file 1.
Get the meta data for file 2.
Get the time index for file 1.
Get the time index for file 2.
- property gids1
Get the gid list for h5 file 1.
- Returns:
_gids1 (list) – List of gids specific for h5 file 1.
- property gids2
Get the gid list for h5 file 2.
- Returns:
_gids2 (list) – List of gids specific for h5 file 2.
- property h1
Get the h5 file #1 h5py file handler.
- property h2
Get the h5 file #2 h5py file handler.
- property meta1
Get the meta data for file 1.
- Returns:
_meta1 (pd.DataFrame) – DataFrame representation of the ‘meta’ dataset in h1.
- property meta2
Get the meta data for file 2.
- Returns:
_meta1 (pd.DataFrame) – DataFrame representation of the ‘meta’ dataset in h2.
- property t1
Get the time index for file 1.
- Returns:
_t1 (pd.DateTime) – Get the timeseries index for h1 in pandas DateTime format.
- property t2
Get the time index for file 2.
- Returns:
_t2 (pd.DateTime) – Get the timeseries index for h2 in pandas DateTime format.
- static plot_timeseries(df1, df2, title, ylabel, legend, out_dir, month=1, day=1)[source]
Plot a single day timeseries for two timeseries-indexed dataframes.
- Parameters:
df1/df2 (pd.DataFrame) – Data from these two dataframes are plotted against each other. Each dataframe must have a pandas datetime index with day/month attributes. Only data in the 1st column (index 0) is plotted.
title (str) – Plot title and output filename.
ylabel (str) – Label for the y-axis.
legend (list | tuple) – Two-entry legend specification.
out_dir (str) – Location to dump plot image files.
month (int) – Month of the time index in df1/df2 to plot.
day (int) – Day of the time index in df1/df2 to plot.
- classmethod plot_sites(f1, f2, gids1=None, gids2=None, dsets=('dni',), sites=(0,), months=(1,), days=(1,), out_dir='./')[source]
Plot sites in file1 against a baseline file2.
- Parameters:
f1/f2 (str) – Two NSRDB h5 files to benchmark against each other (with paths). f2 is interpreted as the baseline full NSRDB file.
gids1/gids2 (NoneType | str | list) – Optional file-specific GID’s to assign to each h5 file. None will default to the index in the h5 meta data. A string is interpreted as a meta data file with the first column being the GIDs.
dsets (iterable) – Dataset names (str) to plot from each file.
sites (iterable) – Site indices to plot. This will be interpreted as the index in f1, with gids1 used to find the index in f2 (if the indices do not match between f1/f2).
months (iterable) – Months to plot.
days (iterable) – Days to plot.
out_dir (str) – Directory to dump output plot image files.