Diive

Latest version: v0.85.5

Safety actively analyzes 707607 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 15

0.85.5

Updates to MDS gap-filling

The community-standard MDS gap-filling method for eddy covariance ecosystem fluxes (e.g., CO2 flux) is now integrated
into the `FluxProcessingChain`. MDS is used during gap-filling in flux Level-4.1.

- **Example notebook** using MDS as part of the flux processing chain where it is used together with random
forest: [Flux Processing Chain](/notebooks/FluxProcessingChain/FluxProcessingChain.ipynb)
- **Example notebook** using MDS as stand alone class
`FluxMDS`: [MDS gap-filling of ecosystem fluxes](/notebooks/GapFilling/FluxMDSGapFilling.ipynb)

The `diive` implementation of the MDS gap-filling method adheres to the descriptions in Reichstein et al. (2005) and
Vekuri et al. (2023), similar to the standard gap-filling procedures used by FLUXNET, ICOS, ReddyProc, and other similar
platforms. This method fills gaps by substituting missing flux values with average flux values observed under comparable
meteorological conditions.

![DIIVE](images/plotMDS_diive_v0.85.5.png)

Background: different flux levels

- The class `FluxProcessingChain` in `diive` follows the flux processing steps as shown in
the [Flux Processing Chain](https://www.swissfluxnet.ethz.ch/index.php/data/ecosystem-fluxes/flux-processing-chain/)
outlined by [Swiss FluxNet](https://www.swissfluxnet.ethz.ch/).
-
- The flux processing chain uses different levels for different steps in the chain:
- Level-0: preliminary flux calculations, e.g. during the year,
using [EddyPro](https://www.licor.com/products/eddy-covariance/eddypro)
- Level-1: final flux calculations, e.g. for complete year,
using [EddyPro](https://www.licor.com/products/eddy-covariance/eddypro)
- Level-2: quality flag expansion (flagging)
- Level-3.1: storage correction (using one point measurement only, from profile not included by default)
- Level-3.2: outlier removal (flagging)
- Level-3.3: USTAR filtering (constant threshold, must be known, detection process not included by default) (
flagging)
- Following Level 3.3, a comprehensive quality flag (`QCF`) is generated by combining individual quality flags.
Prior to subsequent processing steps, low-quality data (flag=2) is removed. Medium-quality data (flag=1) can be
retained if necessary, while the highest quality data (flag=0) is always kept.
- Level-4.1: gap-filling (MDS, long-term random forest)

Changes

- Changes in `FluxMDS`:
- Added parameter `avg_min_n_vals` in MDS gap-filling
- Renamed tolerance parameters for MDS gap-filling to `*_tol`
- (`diive.pkgs.gapfilling.mds.FluxMDS`)
- When reading a parquet file, sanitizing the timestamp is now optional (`diive.core.io.files.load_parquet`)
- The function for creating lagged variants is now found in `diive.pkgs.createvar.laggedvariants.lagged_variants`

Additions

- Added more text output for fill quality during gap-filling with MDS (`diive.pkgs.gapfilling.mds.FluxMDS`)
- Added MDS gap-filling to flux processing chain (
`diive.pkgs.fluxprocessingchain.fluxprocessingchain.FluxProcessingChain`)
- Allow fitting to unbinned data (`diive.pkgs.fits.fitter.BinFitterCP`)
- Added parameter to edit y-label (`diive.core.plotting.dielcycle.DielCycle`)
- Added preliminary USTAR filtering for NEE to quick flux processing chain (
`diive.pkgs.fluxprocessingchain.fluxprocessingchain.QuickFluxProcessingChain`)
- `FileSplitter`:
- Added parameter to directly output splits as `parquet` files in `FileSplitter` and `FileSplitterMulti`. These two
classes split longer time series files (e.g., 6 hours) into several smaller splits (e.g., 12 half-hourly files).
Usage of parquet speeds up not only the splitting part, but also the process when later re-reading the files for
other processing steps.
- After splitting, missing values in the split files are numpy NAN (`diive.core.io.filesplitter.FileSplitter`)
- Added parameter to hide default plot when called. The method `defaultplot` is used e.g. by outlier detection methods
to plot the data after outlier removal, to show flagged vs. unflagged values. (
`diive.core.base.flagbase.FlagBase.defaultplot`)
- Added new filetype `ETH-SONICREAD-BICO-MOD-CSV-20HZ`
- Added `fig` property that contains the default plot for outlier removal methods. This is useful when the default plot
is needed elsewhere, e.g. saved to a file. At the moment, the parameter `showplot` must be `True` for the property to
be accessible. (`diive.core.base.flagbase.FlagBase`)
- Example for class `zScoreRolling`:

zsr = zScoreRolling(..., showplot=True, ...)
zsr.calc(repeat=True)
fig = zsr.fig Contains the figure instance
fig.savefig(...) Figure can then be saved to a file etc.


Notebooks

- Added notebook example for creating lagged variants of variables (
`notebooks/CalculateVariable/Create_lagged_variants.ipynb`)
- Updated flux processing chain notebook to `v9.0`: added option for MDS gap-filling, more descriptions
- Bugfix: import for loading from `Path` was missing in flux processing chain notebook
- Updated MDS gap-filling notebook to `v1.1`, added more descriptions and example for `min_n_vals_nt` parameter
- Updated quick flux processing chain notebook

Unittests

- Added test case `tests.test_createvar.TestCreateVar.test_lagged_variants`
- Updated test case `tests.test_gapfilling.TestGapFilling.test_fluxmds`
- Updated test case `tests.test_fluxprocessingchain.TestFluxProcessingChain.test_fluxprocessingchain`
- 53/53 unittests ran successfully

Bugfixes

- The setting for features that should not be lagged was not properly implemented (
`diive.pkgs.fluxprocessingchain.fluxprocessingchain.FluxProcessingChain._get_ml_feature_settings`)
- Fixed bug when plotting (`diive.pkgs.outlierdetection.localsd.LocalSD`)

0.84.2

Changes

- Adjust version number to avoid publishing conflict

0.84.1

Bugfixes

- Removed invalid imports

Tests

- Added test case for `diive` imports (`tests.test_imports.TestImports.test_imports`)
- 52/52 unittests ran successfully

0.84.0

New features

- New class `BinFitterCP` for fitting function to binned data, includes confidence interval and prediction interval (
`diive.pkgs.fits.fitter.BinFitterCP`)

![DIIVE](images/BinFitterCP_diive_v0.84.0.png)

Additions

- Added small function to detect duplicate entries in lists (`diive.core.funcs.funcs.find_duplicates_in_list`)
- Added new filetype (`diive/configs/filetypes/ETH-MERCURY-CSV-20HZ.yml`)
- Added new filetype (`diive/configs/filetypes/GENERIC-CSV-HEADER-1ROW-TS-END-FULL-NS-20HZ.yml`)

Bugfixes

- Not directly a bug fix, but when reading EddyPro fluxnet files with `LoadEddyProOutputFiles` (e.g., in the flux
processing chain) duplicate columns are now automatically renamed by adding a numbered suffix. For example, if two
variables are named `CUSTOM_CH4_MEAN` in the output file, they are automatically renamed to `CUSTOM_CH4_MEAN_1` and
`CUSTOM_CH4_MEAN_2` (`diive.core.dfun.frames.compare_len_header_vs_data`)

Notebooks

- Added notebook example for `BinFitterCP` (`notebooks/Fits/BinFitterCP.ipynb`)
- Updated flux processing chain notebook to `v8.6`, import for loading EddyPro fluxnet output files was missing

Tests

- Added test case for `BinFitterCP` (`tests.test_fits.TestFits.test_binfittercp`)
- 51/51 unittests ran successfully

0.83.2

From now on Python version `3.11.10` is used for developing Python (up to now, version `3.9` was used). All unittests
were successfully executed with this new Python version. In addition, all notebooks were re-run, all looked good.

[JupyterLab](https://jupyterlab.readthedocs.io/en/4.2.x/index.html) is now included in the environment, which makes it
easier to quickly install `diive` (`pip install diive`) in an environment and directly use its notebooks, without the
need to install JupyterLab separately.

Environment

- `diive` will now be developed using Python version `3.11.10`
- Added [JupyterLab](https://jupyterlab.readthedocs.io/en/4.2.x/index.html)
- Added [jupyter bokeh](https://github.com/bokeh/jupyter_bokeh)

Notebooks

- All notebooks were re-run and updated using Python version `3.11.10`

Tests

- 50/50 unittests ran successfully with Python version `3.11.10`

Changes

- Adjusted flags check in QCF flag report, the progressive flag must be the same as the previously calculated overall
flag (`diive.pkgs.qaqc.qcf.FlagQCF.report_qcf_evolution`)

0.83.1

Changes

- When detecting the frequency from the time delta of records, the inferred frequency is accepted if the most frequent
timedelta was found for more than 50% of records (`diive.core.times.times.timestamp_infer_freq_from_timedelta`)
- Storage terms are now gap-filled using the rolling median in an expanding time window (
`FluxStorageCorrectionSinglePointEddyPro._gapfill_storage_term`)

Notebooks

- Added notebook example for using the flux processing chain for CH4 flux from a subcanopy eddy covariance station (
`notebooks/Workbench/CH-DAS_2023_FluxProcessingChain/FluxProcessingChain_NEE_CH-DAS_2023.ipynb`)

Bugfixes

- Fixed info for storage term correction report to account for cases when more storage terms than flux records are
available (`FluxStorageCorrectionSinglePointEddyPro.report`)

Tests

- 50/50 unittests ran successfully

Page 1 of 15

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.