gfdlvitals package
gfdlvitals - a package for computing global mean metrics
- class gfdlvitals.VitalsDataFrame(data=None, index: Axes | None = None, columns: Axes | None = None, dtype: Dtype | None = None, copy: bool | None = None)
Bases:
DataFramePandas class extension for holding the Vitals data
- Parameters:
pd (pandas.DataFrame) – Input Pandas DataFrame object
- Returns:
Class extension object
- Return type:
- areasum()
Returns the area integrated variable based on the cell_measure method
- build_netrad_toa()
Constructs netrad_toa from component terms if available
- Parameters:
self (VitalsDataFrame)
- Return type:
- detrend(reference=None, order=1, anomaly=True, return_coefs=False)
Detrend VitalsDataFrame object
- Parameters:
reference (gfdlvitals.DataFrame, optional) – Reference VitalsDataFrame, by default None
order (int, optional) – Polynomial order to use for fitting, by default 1
anomaly (bool, optional) – Results as anomalies from the fit, by default True
return_coefs (bool, optional) – Return polynomial fit coeffiecients, by default False
- Returns:
Extended dataset
- Return type:
self
- extend(maxlen)
Extend VitalsDataFrame to a set length and pad with NaNs
- Parameters:
maxlen (int) – New length of the VitalsDataFrame
- Returns:
Extended dataset
- Return type:
self
- smooth(window, extrap=False)
Apply a smoother to the dataset
- Parameters:
window (int) – Smoothing filter length
extrap (bool, optional) – Extrapolate data on the ends, by default False
- Returns:
Smoothed dataset
- Return type:
self
- trend(order=1)
Fits a trend to the VitalsDataFrame object
- Parameters:
order (int, optional) – Polynomial order to use for fitting, by default 1
- Returns:
Fitted trend dataset
- Return type:
self
- ttest(df2)
Performs t-test between two instances of VitalsDataFrame
- Parameters:
df2 (VitalsDataFrame) – Comparison data set
- Returns:
Contains p-values for variables common between the two VitalsDataFrames
- Return type:
pandas.DataFrame
- gfdlvitals.open_db(dbfile, variables=None, yearshift=0.0, legacy_land=False, start=None, end=None)
Function to read sqlite dbfile
- gfdlvitals.plot_timeseries(dsets, var, trend=False, align_times=False, plottype='average', smooth=None, nyears=None, labels=None, legend=True, means=True, title='both')
Standardized function to make a timeseries plot
- Parameters:
dsets (gfdlvitals.VitalsDataFrame or list) – Dataframe or list of dataframes to plot
var (str) – Variable name to plot
trend (bool, optional) – Plot linear trend line if True, by default False
align_times (bool, optional) – H, by default False
plottype (str, optional) – Defines plot type as either “average” or “sum”, by default “average”
smooth (int, optional) – Integer number of years to apply smoothing, by default None
nyears (int, optional) – Limit the x-axis to nyears number of points, by default None
labels (str, optional) – Comma-separated list of dataset labels, by default None
legend (bool, optional) – Display a legend for the plot, by default True
means (bool, optional) – Add variable means to the legend, by default True
title (str, optional) – Specify “varname”, “longname”, “both”, or “none”, by default “both”
- Returns:
Matplotlib figure handle and dictionary of axes/dataset mappings
- Return type:
matplotlib.pyplot.figure, dict
Subpackages
- gfdlvitals.averagers package
- gfdlvitals.diags package
- gfdlvitals.models package
- gfdlvitals.util package