Generic

The generic module contains functionality that works for all types of dfs (dfs0, dfs1, dfs2, dfs3, dfsu) files:

  • concat() - Concatenates files along the time axis
  • extract() - Extract timesteps and/or items to a new dfs file
  • diff() - Calculate difference between two dfs files with identical geometry
  • sum() - Calculate the sum of two dfs files
  • scale() - Apply scaling to any dfs file
  • avg_time() - Create a temporally averaged dfs file
  • quantile() - Create a dfs file with temporal quantiles

When to use the generic module

  • The processing is not tied to the spatial dimension of the data
  • When the files are large and you want to avoid reading the entire file into memory

When not to use the generic module

  • When you need processing depending on the spatial information in the file. For example, spatial interpolation, subsetting, etc.
  • When you need more complex processing, not covered by the generic module
  • When the input files data are not dfs files
  • When the end result is not a dfs file

Example

>>> from mikeio import generic
>>> generic.concat(["fileA.dfs2", "fileB.dfs2"], "new_file.dfs2")

More examples

See the Generic notebook for more examples.