lair.air.background#
Calculate background concentrations.
Functions
|
Subset the data to the well-mixed hours of the day. |
|
Derive a baseline concentration using a low quantile approach to minimize phase shift effects. |
|
Calculate the baseline concentration as the {q} quantile of a rolling window of size {window} hours. |
|
Thonning curve fitting. |
- lair.air.background.get_well_mixed(data: Series | DataFrame, hours: list[int] = [12, 13, 14, 15, 16]) Series | DataFrame [source]#
Subset the data to the well-mixed hours of the day.
- Parameters:
- datapd.Series | pd.DataFrame
Time series data to subset. Must have a datetime index.
- hourslist[int], optional
Hours of the day to subset. Default is LST afternoon hours.
- Returns:
- pd.Series | pd.DataFrame
Subset of the data for the well-mixed hours.
- lair.air.background.rolling_baseline(data: Series, window: int = 24, q: float = 0.01) Series [source]#
Calculate the baseline concentration as the {q} quantile of a rolling window of size {window} hours.
- Parameters:
- datapd.Series
Time series of data to calculate the baseline from.
- windowint, optional
Size of the rolling window in hours.
- qfloat, optional
Quantile to calculate the baseline from.
- Returns:
- pd.Series
Baseline concentration
- lair.air.background.phase_shift_corrected_baseline(data: Series, n: int = 3600, q: float = 0.01) Series [source]#
Derive a baseline concentration using a low quantile approach to minimize phase shift effects. This method uses forward-looking and backward-looking windows to better represent the lowest observed concentrations during periods of rapid change.
Note
Original developed by Ben Fasoli for the Google Street View project. See supplementary material in: https://doi.org/10.1016/j.atmosenv.2023.119995
- Parameters:
- datapd.Series
Signal time series with local datetime index.
- nint
Window size in seconds.
- qfloat
Quantile to extract from signal.
- timezonestr, optional
Timezone to convert the datetime index to.
- Returns:
- pd.Series
Baseline concentration
- lair.air.background.thonning(data: Series, return_filt: bool = False, **kwargs) ccgFilter | Series [source]#
Thonning curve fitting.
Wraps code published by NOAA GML: https://gml.noaa.gov/ccgg/mbl/crvfit/crvfit.html
- Thoning, K.W., P.P. Tans, and W.D. Komhyr, 1989,
Atmospheric carbon dioxide at Mauna Loa Observatory, 2. Analysis of the NOAA/GMCC data, 1974 1985., J. Geophys. Res. ,94, 8549 8565.
- Parameters:
- datapd.Series
Time series of data to be smoothed. Must have a datetime index.
- return_filtbool, optional
Return the filter object instead of the smoothed data.
- **kwargs
Additional keyword arguments to pass to the ccgFilter class.
- Returns:
- ccgFilter | pd.Series
If return_filt is True, returns the filter object. Otherwise, returns the smoothed data as a pandas series.