pymarthe.utils.pest_utils

Attributes

encoding

FFMT

IFMT

FMT_DIC

Functions

SFMT(item)

write_mgp_parfile(parfile, param_df, trans[, ptype])

parse_mgp_parfile(parfile, btrans)

write_mgp_tplfile(tplfile, param_df[, ptype])

write_mlp_tplfile(tplfile, param_df)

write_mlp_parfile(parfile, param_df[, trans, value_col])

parse_mlp_parfile(parfile, keys, value_col, btrans)

transform(it, trans[, fail])

is_valid_trans(trans)

check_trans(trans[, btrans, test_on])

read_config(configfile)

get_kmi(mobj, keys, **kwargs)

Return standard Keys Multi Index from a marthe object data.

compute_weight(lambda_i, lambda_n, m, n, sigma_i)

write_insfile(obsnmes, insfile)

write_simfile(dates, values, simfile)

read_simfile(simfile)

extract_prn(prn, name[, dates_out, trans, ...])

run_from_config(configfile[, run_model])

Module Contents

pymarthe.utils.pest_utils.encoding = 'latin-1'
pymarthe.utils.pest_utils.SFMT(item)
pymarthe.utils.pest_utils.FFMT
pymarthe.utils.pest_utils.IFMT
pymarthe.utils.pest_utils.FMT_DIC
pymarthe.utils.pest_utils.write_mgp_parfile(parfile, param_df, trans, ptype='zpc')
pymarthe.utils.pest_utils.parse_mgp_parfile(parfile, btrans)
pymarthe.utils.pest_utils.write_mgp_tplfile(tplfile, param_df, ptype='zpc')
pymarthe.utils.pest_utils.write_mlp_tplfile(tplfile, param_df)
pymarthe.utils.pest_utils.write_mlp_parfile(parfile, param_df, trans='none', value_col='defaultvalue')
pymarthe.utils.pest_utils.parse_mlp_parfile(parfile, keys, value_col, btrans)
pymarthe.utils.pest_utils.transform(it, trans, fail='raise')
pymarthe.utils.pest_utils.is_valid_trans(trans)
pymarthe.utils.pest_utils.check_trans(trans, btrans=None, test_on=None)
pymarthe.utils.pest_utils.read_config(configfile)
pymarthe.utils.pest_utils.get_kmi(mobj, keys, **kwargs)

Return standard Keys Multi Index from a marthe object data. keys >= 2.

pymarthe.utils.pest_utils.compute_weight(lambda_i, lambda_n, m, n, sigma_i)

Description

Compute weigth for a single observation

param - lambda_i (int):

type - lambda_i (int):

tuning factor for current observation data type

param - lambda_n (int):

type - lambda_n (int):

sum of all tuning factors

param - m (int):

type - m (int):

number of station for a given data type

param - n (int):

type - n (int):

number of records for a given data type at a given station

param - sigma (float):

type - sigma (float):

the expected variance between simulated and observed data

param ———–:

returns:
  • w (float) (weight of a given observation)

  • ———–

Examples

w = compute_weight(lambda_i = 10, lambda_n = 14, m = 22, n = 365, sigma = 0.01)

pymarthe.utils.pest_utils.write_insfile(obsnmes, insfile)

Description

Write pest instruction file. Format:

pif ~ l1 (obsnme0)21:40 l1 (obsnme1)21:40

Values start at character 12. Values is 21 characters long.

type - obsnmes (list/Series):

observation names

param - insfile (str):

type - insfile (str):

path to instruction file to write.

param ———–:

returns:
  • Write instruction file inplace.

  • ———–

Examples

obsnmes = [‘loc001n{}’.format(str(i).zfill(3)) for i in range(250)] write_insfile(obsnmes, insfile = ‘myinsfile.ins’)

pymarthe.utils.pest_utils.write_simfile(dates, values, simfile)

Description

Write simulated values (Can be extract from .prn file) Format:

1972-12-31 12.755 1973-12-31 12.746 1974-12-31 12.523

param - values (list/Series):

type - values (list/Series):

simulated values.

param - simfile (str):

type - simfile (str):

path to simulated file to write.

param ———–:

returns:
  • Write simulated file inplace.

  • ———–

Examples

sim = marthe_utils.read_prn(‘historiq.prn’)[‘loc_name’] write_simfile(dates = sim.index, sim, ‘mysimfile.dat’)

pymarthe.utils.pest_utils.read_simfile(simfile)

Description

Read simulated values Expected format (no header):

1972-12-31 12.755 1973-12-31 12.746 1974-12-31 12.523

param ———–:

rtype:

df

pymarthe.utils.pest_utils.extract_prn(prn, name, dates_out=None, trans='none', interp_method='index', fluc_dic=dict(), sim_dir='.')
pymarthe.utils.pest_utils.run_from_config(configfile, run_model=True, **kwargs)