pyiem.dep module#

Utilities for the Daily Erosion Project

pyiem.dep.load_scenarios()[source]#

Build a dataframe of DEP scenarios.

Return type:

DataFrame

pyiem.dep.get_cli_fname(lon, lat, scenario=0)[source]#

Get the climate file name for the given lon, lat, and scenario

pyiem.dep.read_yld(filename)[source]#

read WEPP yld file with some local mods to include a year

Parameters:

filename (str) – Filename to read

Returns:

pandas.DataFrame

pyiem.dep.read_slp(filename)[source]#

read WEPP slp file.

Parameters:

filename (str) – Filename to read

Returns:

list of slope profiles

pyiem.dep.man2df(mandict, year1=1)[source]#

Convert nasty dictionary returned from read_man into pd.DataFrame.

The DataFrame is oriented with OFE, year.

Parameters:
  • mandict (dict) – Dictionary populated from read_man.

  • year1 (int,optional) – What does WEPP year index 1 equate to in the real world! The default of 1 just uses what WEPP does.

Returns:

pd.DataFrame

Return type:

DataFrame

pyiem.dep.read_man(filename)[source]#

Implements WEPP’s INFILE.for for reading management file

Parameters:

filename (str) – Filename to read

Returns:

dict of management info

pyiem.dep.rfactor(times, points, return_rfactor_metric=True)[source]#

Compute the R-factor.

https://www.hydrol-earth-syst-sci.net/19/4113/2015/hess-19-4113-2015.pdf It would appear that a strict implementation would need to have a six hour dry period around events and require more then 12mm of precipitation.

Parameters:
  • times (list) – List of decimal time values for a date.

  • points (list) – list of accumulated precip values (mm).

  • return_rfactor_metric (bool, optional) – Should this return a metric (default) or english unit R value.

Returns:

Units of MJ mm ha-1 h-1

Return type:

rfactor (float)

pyiem.dep.read_cli(filename, compute_rfactor=False, return_rfactor_metric=True)[source]#

Read WEPP CLI File, Return DataFrame

Parameters:
  • filename (str) – Filename to read

  • compute_rfactor (bool, optional) – Should the R-factor be computed as well, adds computational expense and default is False.

  • return_rfactor_metric (bool, optional) – should the R-factor be computed as the common metric value. Default is True.

Returns:

pandas.DataFrame

pyiem.dep.read_env(filename, year0=2006)[source]#

Read WEPP .env file, return a dataframe

Parameters:
  • filename (str) – Filename to read

  • year0 (int,optional) – The simulation start year minus 1

Returns:

pd.DataFrame

pyiem.dep.read_ofe(filename, year0=2006)[source]#

Read OFE .ofe file, return a dataframe

Parameters:
  • filename (str) – Filename to read

  • year0 (int,optional) – The simulation start year minus 1

Returns:

pd.DataFrame

pyiem.dep.read_wb(filename)[source]#

Read a custom WEPP .wb file into Pandas Data Table

pyiem.dep.read_crop(filename)[source]#

Read WEPP’s plant and residue output file.

Parameters:

filename (str) – The file to read in.

Returns:

pandas.DataFrame