gfdlvitals package¶
gfdlvitals - a package for computing global mean metrics
-
class
gfdlvitals.VitalsDataFrame(data=None, index: Optional[Collection] = None, columns: Optional[Collection] = None, dtype: Optional[Union[ExtensionDtype, str, numpy.dtype, Type[Union[str, float, int, complex, bool, object]]]] = None, copy: bool = False)¶ Bases:
pandas.core.frame.DataFramePandas class extension for holding the Vitals data
- Parameters
pd (pandas.DataFrame) – Input Pandas DataFrame object
- Returns
Class extension object
- 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, smooth=None, nyears=None, labels=None, legend=True)¶ 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
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
- Returns
Matplotlib figure handle and dictionary of axes/dataset mappings
- Return type
matplotlib.pyplot.figure, dict