repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.effective_max_ar_order
def effective_max_ar_order(self): """The maximum number of AR coefficients that shall or can be determined. It is the minimum of |ARMA.max_ar_order| and the number of coefficients of the pure |MA| after their turning point. """ return min(self.max_ar_order, self.ma.order...
python
def effective_max_ar_order(self): """The maximum number of AR coefficients that shall or can be determined. It is the minimum of |ARMA.max_ar_order| and the number of coefficients of the pure |MA| after their turning point. """ return min(self.max_ar_order, self.ma.order...
[ "def", "effective_max_ar_order", "(", "self", ")", ":", "return", "min", "(", "self", ".", "max_ar_order", ",", "self", ".", "ma", ".", "order", "-", "self", ".", "ma", ".", "turningpoint", "[", "0", "]", "-", "1", ")" ]
The maximum number of AR coefficients that shall or can be determined. It is the minimum of |ARMA.max_ar_order| and the number of coefficients of the pure |MA| after their turning point.
[ "The", "maximum", "number", "of", "AR", "coefficients", "that", "shall", "or", "can", "be", "determined", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L548-L555
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.update_ar_coefs
def update_ar_coefs(self): """Determine the AR coefficients. The number of AR coefficients is subsequently increased until the required precision |ARMA.max_rel_rmse| is reached. Otherwise, a |RuntimeError| is raised. """ del self.ar_coefs for ar_order in range(1...
python
def update_ar_coefs(self): """Determine the AR coefficients. The number of AR coefficients is subsequently increased until the required precision |ARMA.max_rel_rmse| is reached. Otherwise, a |RuntimeError| is raised. """ del self.ar_coefs for ar_order in range(1...
[ "def", "update_ar_coefs", "(", "self", ")", ":", "del", "self", ".", "ar_coefs", "for", "ar_order", "in", "range", "(", "1", ",", "self", ".", "effective_max_ar_order", "+", "1", ")", ":", "self", ".", "calc_all_ar_coefs", "(", "ar_order", ",", "self", "...
Determine the AR coefficients. The number of AR coefficients is subsequently increased until the required precision |ARMA.max_rel_rmse| is reached. Otherwise, a |RuntimeError| is raised.
[ "Determine", "the", "AR", "coefficients", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L557-L578
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.dev_moments
def dev_moments(self): """Sum of the absolute deviations between the central moments of the instantaneous unit hydrograph and the ARMA approximation.""" return numpy.sum(numpy.abs(self.moments-self.ma.moments))
python
def dev_moments(self): """Sum of the absolute deviations between the central moments of the instantaneous unit hydrograph and the ARMA approximation.""" return numpy.sum(numpy.abs(self.moments-self.ma.moments))
[ "def", "dev_moments", "(", "self", ")", ":", "return", "numpy", ".", "sum", "(", "numpy", ".", "abs", "(", "self", ".", "moments", "-", "self", ".", "ma", ".", "moments", ")", ")" ]
Sum of the absolute deviations between the central moments of the instantaneous unit hydrograph and the ARMA approximation.
[ "Sum", "of", "the", "absolute", "deviations", "between", "the", "central", "moments", "of", "the", "instantaneous", "unit", "hydrograph", "and", "the", "ARMA", "approximation", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L581-L584
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.norm_coefs
def norm_coefs(self): """Multiply all coefficients by the same factor, so that their sum becomes one.""" sum_coefs = self.sum_coefs self.ar_coefs /= sum_coefs self.ma_coefs /= sum_coefs
python
def norm_coefs(self): """Multiply all coefficients by the same factor, so that their sum becomes one.""" sum_coefs = self.sum_coefs self.ar_coefs /= sum_coefs self.ma_coefs /= sum_coefs
[ "def", "norm_coefs", "(", "self", ")", ":", "sum_coefs", "=", "self", ".", "sum_coefs", "self", ".", "ar_coefs", "/=", "sum_coefs", "self", ".", "ma_coefs", "/=", "sum_coefs" ]
Multiply all coefficients by the same factor, so that their sum becomes one.
[ "Multiply", "all", "coefficients", "by", "the", "same", "factor", "so", "that", "their", "sum", "becomes", "one", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L586-L591
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.sum_coefs
def sum_coefs(self): """The sum of all AR and MA coefficients""" return numpy.sum(self.ar_coefs) + numpy.sum(self.ma_coefs)
python
def sum_coefs(self): """The sum of all AR and MA coefficients""" return numpy.sum(self.ar_coefs) + numpy.sum(self.ma_coefs)
[ "def", "sum_coefs", "(", "self", ")", ":", "return", "numpy", ".", "sum", "(", "self", ".", "ar_coefs", ")", "+", "numpy", ".", "sum", "(", "self", ".", "ma_coefs", ")" ]
The sum of all AR and MA coefficients
[ "The", "sum", "of", "all", "AR", "and", "MA", "coefficients" ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L594-L596
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.calc_all_ar_coefs
def calc_all_ar_coefs(self, ar_order, ma_model): """Determine the AR coeffcients based on a least squares approach. The argument `ar_order` defines the number of AR coefficients to be determined. The argument `ma_order` defines a pure |MA| model. The least squares approach is applied o...
python
def calc_all_ar_coefs(self, ar_order, ma_model): """Determine the AR coeffcients based on a least squares approach. The argument `ar_order` defines the number of AR coefficients to be determined. The argument `ma_order` defines a pure |MA| model. The least squares approach is applied o...
[ "def", "calc_all_ar_coefs", "(", "self", ",", "ar_order", ",", "ma_model", ")", ":", "turning_idx", ",", "_", "=", "ma_model", ".", "turningpoint", "values", "=", "ma_model", ".", "coefs", "[", "turning_idx", ":", "]", "self", ".", "ar_coefs", ",", "residu...
Determine the AR coeffcients based on a least squares approach. The argument `ar_order` defines the number of AR coefficients to be determined. The argument `ma_order` defines a pure |MA| model. The least squares approach is applied on all those coefficents of the pure MA model, which ...
[ "Determine", "the", "AR", "coeffcients", "based", "on", "a", "least", "squares", "approach", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L603-L624
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.get_a
def get_a(values, n): """Extract the independent variables of the given values and return them as a matrix with n columns in a form suitable for the least squares approach applied in method |ARMA.update_ar_coefs|. """ m = len(values)-n a = numpy.empty((m, n), dtype=float)...
python
def get_a(values, n): """Extract the independent variables of the given values and return them as a matrix with n columns in a form suitable for the least squares approach applied in method |ARMA.update_ar_coefs|. """ m = len(values)-n a = numpy.empty((m, n), dtype=float)...
[ "def", "get_a", "(", "values", ",", "n", ")", ":", "m", "=", "len", "(", "values", ")", "-", "n", "a", "=", "numpy", ".", "empty", "(", "(", "m", ",", "n", ")", ",", "dtype", "=", "float", ")", "for", "i", "in", "range", "(", "m", ")", ":...
Extract the independent variables of the given values and return them as a matrix with n columns in a form suitable for the least squares approach applied in method |ARMA.update_ar_coefs|.
[ "Extract", "the", "independent", "variables", "of", "the", "given", "values", "and", "return", "them", "as", "a", "matrix", "with", "n", "columns", "in", "a", "form", "suitable", "for", "the", "least", "squares", "approach", "applied", "in", "method", "|ARMA...
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L627-L638
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.update_ma_coefs
def update_ma_coefs(self): """Determine the MA coefficients. The number of MA coefficients is subsequently increased until the required precision |ARMA.max_dev_coefs| is reached. Otherwise, a |RuntimeError| is raised. """ self.ma_coefs = [] for ma_order in range...
python
def update_ma_coefs(self): """Determine the MA coefficients. The number of MA coefficients is subsequently increased until the required precision |ARMA.max_dev_coefs| is reached. Otherwise, a |RuntimeError| is raised. """ self.ma_coefs = [] for ma_order in range...
[ "def", "update_ma_coefs", "(", "self", ")", ":", "self", ".", "ma_coefs", "=", "[", "]", "for", "ma_order", "in", "range", "(", "1", ",", "self", ".", "ma", ".", "order", "+", "1", ")", ":", "self", ".", "calc_next_ma_coef", "(", "ma_order", ",", "...
Determine the MA coefficients. The number of MA coefficients is subsequently increased until the required precision |ARMA.max_dev_coefs| is reached. Otherwise, a |RuntimeError| is raised.
[ "Determine", "the", "MA", "coefficients", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L648-L674
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.calc_next_ma_coef
def calc_next_ma_coef(self, ma_order, ma_model): """Determine the MA coefficients of the ARMA model based on its predetermined AR coefficients and the MA ordinates of the given |MA| model. The MA coefficients are determined one at a time, beginning with the first one. Each ARMA...
python
def calc_next_ma_coef(self, ma_order, ma_model): """Determine the MA coefficients of the ARMA model based on its predetermined AR coefficients and the MA ordinates of the given |MA| model. The MA coefficients are determined one at a time, beginning with the first one. Each ARMA...
[ "def", "calc_next_ma_coef", "(", "self", ",", "ma_order", ",", "ma_model", ")", ":", "idx", "=", "ma_order", "-", "1", "coef", "=", "ma_model", ".", "coefs", "[", "idx", "]", "for", "jdx", ",", "ar_coef", "in", "enumerate", "(", "self", ".", "ar_coefs"...
Determine the MA coefficients of the ARMA model based on its predetermined AR coefficients and the MA ordinates of the given |MA| model. The MA coefficients are determined one at a time, beginning with the first one. Each ARMA MA coefficient in set in a manner that allows for t...
[ "Determine", "the", "MA", "coefficients", "of", "the", "ARMA", "model", "based", "on", "its", "predetermined", "AR", "coefficients", "and", "the", "MA", "ordinates", "of", "the", "given", "|MA|", "model", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L676-L692
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.response
def response(self): """Return the response to a standard dt impulse.""" values = [] sum_values = 0. ma_coefs = self.ma_coefs ar_coefs = self.ar_coefs ma_order = self.ma_order for idx in range(len(self.ma.delays)): value = 0. if idx < ma_ord...
python
def response(self): """Return the response to a standard dt impulse.""" values = [] sum_values = 0. ma_coefs = self.ma_coefs ar_coefs = self.ar_coefs ma_order = self.ma_order for idx in range(len(self.ma.delays)): value = 0. if idx < ma_ord...
[ "def", "response", "(", "self", ")", ":", "values", "=", "[", "]", "sum_values", "=", "0.", "ma_coefs", "=", "self", ".", "ma_coefs", "ar_coefs", "=", "self", ".", "ar_coefs", "ma_order", "=", "self", ".", "ma_order", "for", "idx", "in", "range", "(", ...
Return the response to a standard dt impulse.
[ "Return", "the", "response", "to", "a", "standard", "dt", "impulse", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L695-L712
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.moments
def moments(self): """The first two time delay weighted statistical moments of the ARMA response.""" timepoints = self.ma.delays response = self.response moment1 = statstools.calc_mean_time(timepoints, response) moment2 = statstools.calc_mean_time_deviation( t...
python
def moments(self): """The first two time delay weighted statistical moments of the ARMA response.""" timepoints = self.ma.delays response = self.response moment1 = statstools.calc_mean_time(timepoints, response) moment2 = statstools.calc_mean_time_deviation( t...
[ "def", "moments", "(", "self", ")", ":", "timepoints", "=", "self", ".", "ma", ".", "delays", "response", "=", "self", ".", "response", "moment1", "=", "statstools", ".", "calc_mean_time", "(", "timepoints", ",", "response", ")", "moment2", "=", "statstool...
The first two time delay weighted statistical moments of the ARMA response.
[ "The", "first", "two", "time", "delay", "weighted", "statistical", "moments", "of", "the", "ARMA", "response", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L715-L723
train
hydpy-dev/hydpy
hydpy/auxs/armatools.py
ARMA.plot
def plot(self, threshold=None, **kwargs): """Barplot of the ARMA response.""" try: # Works under matplotlib 3. pyplot.bar(x=self.ma.delays+.5, height=self.response, width=1., fill=False, **kwargs) except TypeError: # pragma: no cover #...
python
def plot(self, threshold=None, **kwargs): """Barplot of the ARMA response.""" try: # Works under matplotlib 3. pyplot.bar(x=self.ma.delays+.5, height=self.response, width=1., fill=False, **kwargs) except TypeError: # pragma: no cover #...
[ "def", "plot", "(", "self", ",", "threshold", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "# Works under matplotlib 3.", "pyplot", ".", "bar", "(", "x", "=", "self", ".", "ma", ".", "delays", "+", ".5", ",", "height", "=", "self", "...
Barplot of the ARMA response.
[ "Barplot", "of", "the", "ARMA", "response", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/armatools.py#L725-L740
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
method_header
def method_header(method_name, nogil=False, idx_as_arg=False): """Returns the Cython method header for methods without arguments except `self`.""" if not config.FASTCYTHON: nogil = False header = 'cpdef inline void %s(self' % method_name header += ', int idx)' if idx_as_arg else ')' head...
python
def method_header(method_name, nogil=False, idx_as_arg=False): """Returns the Cython method header for methods without arguments except `self`.""" if not config.FASTCYTHON: nogil = False header = 'cpdef inline void %s(self' % method_name header += ', int idx)' if idx_as_arg else ')' head...
[ "def", "method_header", "(", "method_name", ",", "nogil", "=", "False", ",", "idx_as_arg", "=", "False", ")", ":", "if", "not", "config", ".", "FASTCYTHON", ":", "nogil", "=", "False", "header", "=", "'cpdef inline void %s(self'", "%", "method_name", "header",...
Returns the Cython method header for methods without arguments except `self`.
[ "Returns", "the", "Cython", "method", "header", "for", "methods", "without", "arguments", "except", "self", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L80-L88
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
decorate_method
def decorate_method(wrapped): """The decorated method will return a |Lines| object including a method header. However, the |Lines| object will be empty if the respective model does not implement a method with the same name as the wrapped method. """ def wrapper(self): lines = Lines() ...
python
def decorate_method(wrapped): """The decorated method will return a |Lines| object including a method header. However, the |Lines| object will be empty if the respective model does not implement a method with the same name as the wrapped method. """ def wrapper(self): lines = Lines() ...
[ "def", "decorate_method", "(", "wrapped", ")", ":", "def", "wrapper", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "if", "hasattr", "(", "self", ".", "model", ",", "wrapped", ".", "__name__", ")", ":", "print", "(", "' . %s'", "%"...
The decorated method will return a |Lines| object including a method header. However, the |Lines| object will be empty if the respective model does not implement a method with the same name as the wrapped method.
[ "The", "decorated", "method", "will", "return", "a", "|Lines|", "object", "including", "a", "method", "header", ".", "However", "the", "|Lines|", "object", "will", "be", "empty", "if", "the", "respective", "model", "does", "not", "implement", "a", "method", ...
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L91-L107
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
Lines.add
def add(self, indent, line): """Appends the given text line with prefixed spaces in accordance with the given number of indentation levels. """ if isinstance(line, str): list.append(self, indent*4*' ' + line) else: for subline in line: list...
python
def add(self, indent, line): """Appends the given text line with prefixed spaces in accordance with the given number of indentation levels. """ if isinstance(line, str): list.append(self, indent*4*' ' + line) else: for subline in line: list...
[ "def", "add", "(", "self", ",", "indent", ",", "line", ")", ":", "if", "isinstance", "(", "line", ",", "str", ")", ":", "list", ".", "append", "(", "self", ",", "indent", "*", "4", "*", "' '", "+", "line", ")", "else", ":", "for", "subline", "i...
Appends the given text line with prefixed spaces in accordance with the given number of indentation levels.
[ "Appends", "the", "given", "text", "line", "with", "prefixed", "spaces", "in", "accordance", "with", "the", "given", "number", "of", "indentation", "levels", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L66-L74
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
Cythonizer.pyname
def pyname(self): """Name of the compiled module.""" if self.pymodule.endswith('__init__'): return self.pymodule.split('.')[-2] else: return self.pymodule.split('.')[-1]
python
def pyname(self): """Name of the compiled module.""" if self.pymodule.endswith('__init__'): return self.pymodule.split('.')[-2] else: return self.pymodule.split('.')[-1]
[ "def", "pyname", "(", "self", ")", ":", "if", "self", ".", "pymodule", ".", "endswith", "(", "'__init__'", ")", ":", "return", "self", ".", "pymodule", ".", "split", "(", "'.'", ")", "[", "-", "2", "]", "else", ":", "return", "self", ".", "pymodule...
Name of the compiled module.
[ "Name", "of", "the", "compiled", "module", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L147-L152
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
Cythonizer.pyxwriter
def pyxwriter(self): """Update the pyx file.""" model = self.Model() if hasattr(self, 'Parameters'): model.parameters = self.Parameters(vars(self)) else: model.parameters = parametertools.Parameters(vars(self)) if hasattr(self, 'Sequences'): mo...
python
def pyxwriter(self): """Update the pyx file.""" model = self.Model() if hasattr(self, 'Parameters'): model.parameters = self.Parameters(vars(self)) else: model.parameters = parametertools.Parameters(vars(self)) if hasattr(self, 'Sequences'): mo...
[ "def", "pyxwriter", "(", "self", ")", ":", "model", "=", "self", ".", "Model", "(", ")", "if", "hasattr", "(", "self", ",", "'Parameters'", ")", ":", "model", ".", "parameters", "=", "self", ".", "Parameters", "(", "vars", "(", "self", ")", ")", "e...
Update the pyx file.
[ "Update", "the", "pyx", "file", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L185-L197
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
Cythonizer.pysourcefiles
def pysourcefiles(self): """All source files of the actual models Python classes and their respective base classes.""" sourcefiles = set() for (name, child) in vars(self).items(): try: parents = inspect.getmro(child) except AttributeError: ...
python
def pysourcefiles(self): """All source files of the actual models Python classes and their respective base classes.""" sourcefiles = set() for (name, child) in vars(self).items(): try: parents = inspect.getmro(child) except AttributeError: ...
[ "def", "pysourcefiles", "(", "self", ")", ":", "sourcefiles", "=", "set", "(", ")", "for", "(", "name", ",", "child", ")", "in", "vars", "(", "self", ")", ".", "items", "(", ")", ":", "try", ":", "parents", "=", "inspect", ".", "getmro", "(", "ch...
All source files of the actual models Python classes and their respective base classes.
[ "All", "source", "files", "of", "the", "actual", "models", "Python", "classes", "and", "their", "respective", "base", "classes", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L200-L215
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
Cythonizer.outdated
def outdated(self): """True if at least one of the |Cythonizer.pysourcefiles| is newer than the compiled file under |Cythonizer.pyxfilepath|, otherwise False. """ if hydpy.pub.options.forcecompiling: return True if os.path.split(hydpy.__path__[0])[-2].endswith...
python
def outdated(self): """True if at least one of the |Cythonizer.pysourcefiles| is newer than the compiled file under |Cythonizer.pyxfilepath|, otherwise False. """ if hydpy.pub.options.forcecompiling: return True if os.path.split(hydpy.__path__[0])[-2].endswith...
[ "def", "outdated", "(", "self", ")", ":", "if", "hydpy", ".", "pub", ".", "options", ".", "forcecompiling", ":", "return", "True", "if", "os", ".", "path", ".", "split", "(", "hydpy", ".", "__path__", "[", "0", "]", ")", "[", "-", "2", "]", ".", ...
True if at least one of the |Cythonizer.pysourcefiles| is newer than the compiled file under |Cythonizer.pyxfilepath|, otherwise False.
[ "True", "if", "at", "least", "one", "of", "the", "|Cythonizer", ".", "pysourcefiles|", "is", "newer", "than", "the", "compiled", "file", "under", "|Cythonizer", ".", "pyxfilepath|", "otherwise", "False", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L218-L234
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
Cythonizer.compile_
def compile_(self): """Translate cython code to C code and compile it.""" from Cython import Build argv = copy.deepcopy(sys.argv) sys.argv = [sys.argv[0], 'build_ext', '--build-lib='+self.buildpath] exc_modules = [ distutils.extension.Extension( ...
python
def compile_(self): """Translate cython code to C code and compile it.""" from Cython import Build argv = copy.deepcopy(sys.argv) sys.argv = [sys.argv[0], 'build_ext', '--build-lib='+self.buildpath] exc_modules = [ distutils.extension.Extension( ...
[ "def", "compile_", "(", "self", ")", ":", "from", "Cython", "import", "Build", "argv", "=", "copy", ".", "deepcopy", "(", "sys", ".", "argv", ")", "sys", ".", "argv", "=", "[", "sys", ".", "argv", "[", "0", "]", ",", "'build_ext'", ",", "'--build-l...
Translate cython code to C code and compile it.
[ "Translate", "cython", "code", "to", "C", "code", "and", "compile", "it", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L236-L247
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
Cythonizer.move_dll
def move_dll(self): """Try to find the resulting dll file and to move it into the `cythons` package. Things to be aware of: * The file extension either `pyd` (Window) or `so` (Linux). * The folder containing the dll file is system dependent, but is always a subfo...
python
def move_dll(self): """Try to find the resulting dll file and to move it into the `cythons` package. Things to be aware of: * The file extension either `pyd` (Window) or `so` (Linux). * The folder containing the dll file is system dependent, but is always a subfo...
[ "def", "move_dll", "(", "self", ")", ":", "dirinfos", "=", "os", ".", "walk", "(", "self", ".", "buildpath", ")", "next", "(", "dirinfos", ")", "system_dependent_filename", "=", "None", "for", "dirinfo", "in", "dirinfos", ":", "for", "filename", "in", "d...
Try to find the resulting dll file and to move it into the `cythons` package. Things to be aware of: * The file extension either `pyd` (Window) or `so` (Linux). * The folder containing the dll file is system dependent, but is always a subfolder of the `cythons` package. ...
[ "Try", "to", "find", "the", "resulting", "dll", "file", "and", "to", "move", "it", "into", "the", "cythons", "package", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L249-L295
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.constants
def constants(self): """Constants declaration lines.""" lines = Lines() for (name, member) in vars(self.cythonizer).items(): if (name.isupper() and (not inspect.isclass(member)) and (type(member) in TYPE2STR)): ndim = numpy.arra...
python
def constants(self): """Constants declaration lines.""" lines = Lines() for (name, member) in vars(self.cythonizer).items(): if (name.isupper() and (not inspect.isclass(member)) and (type(member) in TYPE2STR)): ndim = numpy.arra...
[ "def", "constants", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "for", "(", "name", ",", "member", ")", "in", "vars", "(", "self", ".", "cythonizer", ")", ".", "items", "(", ")", ":", "if", "(", "name", ".", "isupper", "(", ")", "an...
Constants declaration lines.
[ "Constants", "declaration", "lines", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L361-L372
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.parameters
def parameters(self): """Parameter declaration lines.""" lines = Lines() lines.add(0, '@cython.final') lines.add(0, 'cdef class Parameters(object):') for subpars in self.model.parameters: if subpars: lines.add(1, 'cdef public %s %s' ...
python
def parameters(self): """Parameter declaration lines.""" lines = Lines() lines.add(0, '@cython.final') lines.add(0, 'cdef class Parameters(object):') for subpars in self.model.parameters: if subpars: lines.add(1, 'cdef public %s %s' ...
[ "def", "parameters", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "0", ",", "'@cython.final'", ")", "lines", ".", "add", "(", "0", ",", "'cdef class Parameters(object):'", ")", "for", "subpars", "in", "self", ".", "...
Parameter declaration lines.
[ "Parameter", "declaration", "lines", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L375-L396
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.sequences
def sequences(self): """Sequence declaration lines.""" lines = Lines() lines.add(0, '@cython.final') lines.add(0, 'cdef class Sequences(object):') for subseqs in self.model.sequences: lines.add(1, 'cdef public %s %s' % (objecttools.classname(s...
python
def sequences(self): """Sequence declaration lines.""" lines = Lines() lines.add(0, '@cython.final') lines.add(0, 'cdef class Sequences(object):') for subseqs in self.model.sequences: lines.add(1, 'cdef public %s %s' % (objecttools.classname(s...
[ "def", "sequences", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "0", ",", "'@cython.final'", ")", "lines", ".", "add", "(", "0", ",", "'cdef class Sequences(object):'", ")", "for", "subseqs", "in", "self", ".", "mo...
Sequence declaration lines.
[ "Sequence", "declaration", "lines", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L399-L452
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.iosequence
def iosequence(seq): """Special declaration lines for the given |IOSequence| object. """ lines = Lines() lines.add(1, 'cdef public bint _%s_diskflag' % seq.name) lines.add(1, 'cdef public str _%s_path' % seq.name) lines.add(1, 'cdef FILE *_%s_file' % seq.name) lin...
python
def iosequence(seq): """Special declaration lines for the given |IOSequence| object. """ lines = Lines() lines.add(1, 'cdef public bint _%s_diskflag' % seq.name) lines.add(1, 'cdef public str _%s_path' % seq.name) lines.add(1, 'cdef FILE *_%s_file' % seq.name) lin...
[ "def", "iosequence", "(", "seq", ")", ":", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cdef public bint _%s_diskflag'", "%", "seq", ".", "name", ")", "lines", ".", "add", "(", "1", ",", "'cdef public str _%s_path'", "%", "seq",...
Special declaration lines for the given |IOSequence| object.
[ "Special", "declaration", "lines", "for", "the", "given", "|IOSequence|", "object", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L455-L465
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.open_files
def open_files(subseqs): """Open file statements.""" print(' . open_files') lines = Lines() lines.add(1, 'cpdef open_files(self, int idx):') for seq in subseqs: lines.add(2, 'if self._%s_diskflag:' % seq.name) lines.add(3, 'self._%s_file = fopen...
python
def open_files(subseqs): """Open file statements.""" print(' . open_files') lines = Lines() lines.add(1, 'cpdef open_files(self, int idx):') for seq in subseqs: lines.add(2, 'if self._%s_diskflag:' % seq.name) lines.add(3, 'self._%s_file = fopen...
[ "def", "open_files", "(", "subseqs", ")", ":", "print", "(", "' . open_files'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef open_files(self, int idx):'", ")", "for", "seq", "in", "subseqs", ":", "lines", ".", ...
Open file statements.
[ "Open", "file", "statements", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L468-L483
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.close_files
def close_files(subseqs): """Close file statements.""" print(' . close_files') lines = Lines() lines.add(1, 'cpdef inline close_files(self):') for seq in subseqs: lines.add(2, 'if self._%s_diskflag:' % seq.name) lines.add(3, 'fclose(self._%s_fil...
python
def close_files(subseqs): """Close file statements.""" print(' . close_files') lines = Lines() lines.add(1, 'cpdef inline close_files(self):') for seq in subseqs: lines.add(2, 'if self._%s_diskflag:' % seq.name) lines.add(3, 'fclose(self._%s_fil...
[ "def", "close_files", "(", "subseqs", ")", ":", "print", "(", "' . close_files'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef inline close_files(self):'", ")", "for", "seq", "in", "subseqs", ":", "lines", ".",...
Close file statements.
[ "Close", "file", "statements", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L486-L494
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.load_data
def load_data(subseqs): """Load data statements.""" print(' . load_data') lines = Lines() lines.add(1, 'cpdef inline void load_data(self, int idx) %s:' % _nogil) lines.add(2, 'cdef int jdx0, jdx1, jdx2, jdx3, jdx4, jdx5') for seq in subseqs: lines.a...
python
def load_data(subseqs): """Load data statements.""" print(' . load_data') lines = Lines() lines.add(1, 'cpdef inline void load_data(self, int idx) %s:' % _nogil) lines.add(2, 'cdef int jdx0, jdx1, jdx2, jdx3, jdx4, jdx5') for seq in subseqs: lines.a...
[ "def", "load_data", "(", "subseqs", ")", ":", "print", "(", "' . load_data'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef inline void load_data(self, int idx) %s:'", "%", "_nogil", ")", "lines", ".", "add", "(",...
Load data statements.
[ "Load", "data", "statements", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L497-L523
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.set_pointer
def set_pointer(self, subseqs): """Set_pointer functions for link sequences.""" lines = Lines() for seq in subseqs: if seq.NDIM == 0: lines.extend(self.set_pointer0d(subseqs)) break for seq in subseqs: if seq.NDIM == 1: ...
python
def set_pointer(self, subseqs): """Set_pointer functions for link sequences.""" lines = Lines() for seq in subseqs: if seq.NDIM == 0: lines.extend(self.set_pointer0d(subseqs)) break for seq in subseqs: if seq.NDIM == 1: ...
[ "def", "set_pointer", "(", "self", ",", "subseqs", ")", ":", "lines", "=", "Lines", "(", ")", "for", "seq", "in", "subseqs", ":", "if", "seq", ".", "NDIM", "==", "0", ":", "lines", ".", "extend", "(", "self", ".", "set_pointer0d", "(", "subseqs", "...
Set_pointer functions for link sequences.
[ "Set_pointer", "functions", "for", "link", "sequences", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L554-L567
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.set_pointer0d
def set_pointer0d(subseqs): """Set_pointer function for 0-dimensional link sequences.""" print(' . set_pointer0d') lines = Lines() lines.add(1, 'cpdef inline set_pointer0d' '(self, str name, pointerutils.PDouble value):') for seq in subseqs: ...
python
def set_pointer0d(subseqs): """Set_pointer function for 0-dimensional link sequences.""" print(' . set_pointer0d') lines = Lines() lines.add(1, 'cpdef inline set_pointer0d' '(self, str name, pointerutils.PDouble value):') for seq in subseqs: ...
[ "def", "set_pointer0d", "(", "subseqs", ")", ":", "print", "(", "' . set_pointer0d'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef inline set_pointer0d'", "'(self, str name, pointerutils.PDouble value):'", ")", "for", ...
Set_pointer function for 0-dimensional link sequences.
[ "Set_pointer", "function", "for", "0", "-", "dimensional", "link", "sequences", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L570-L579
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.alloc
def alloc(subseqs): """Allocate memory for 1-dimensional link sequences.""" print(' . setlength') lines = Lines() lines.add(1, 'cpdef inline alloc(self, name, int length):') for seq in subseqs: lines.add(2, 'if name == "%s":' % seq.name) lines.a...
python
def alloc(subseqs): """Allocate memory for 1-dimensional link sequences.""" print(' . setlength') lines = Lines() lines.add(1, 'cpdef inline alloc(self, name, int length):') for seq in subseqs: lines.add(2, 'if name == "%s":' % seq.name) lines.a...
[ "def", "alloc", "(", "subseqs", ")", ":", "print", "(", "' . setlength'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef inline alloc(self, name, int length):'", ")", "for", "seq", "in", "subseqs", ":", "lines", ...
Allocate memory for 1-dimensional link sequences.
[ "Allocate", "memory", "for", "1", "-", "dimensional", "link", "sequences", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L582-L592
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.dealloc
def dealloc(subseqs): """Deallocate memory for 1-dimensional link sequences.""" print(' . dealloc') lines = Lines() lines.add(1, 'cpdef inline dealloc(self):') for seq in subseqs: lines.add(2, 'PyMem_Free(self.%s)' % seq.name) return lines
python
def dealloc(subseqs): """Deallocate memory for 1-dimensional link sequences.""" print(' . dealloc') lines = Lines() lines.add(1, 'cpdef inline dealloc(self):') for seq in subseqs: lines.add(2, 'PyMem_Free(self.%s)' % seq.name) return lines
[ "def", "dealloc", "(", "subseqs", ")", ":", "print", "(", "' . dealloc'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef inline dealloc(self):'", ")", "for", "seq", "in", "subseqs", ":", "lines", ".", "add", ...
Deallocate memory for 1-dimensional link sequences.
[ "Deallocate", "memory", "for", "1", "-", "dimensional", "link", "sequences", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L595-L602
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.set_pointer1d
def set_pointer1d(subseqs): """Set_pointer function for 1-dimensional link sequences.""" print(' . set_pointer1d') lines = Lines() lines.add(1, 'cpdef inline set_pointer1d' '(self, str name, pointerutils.PDouble value, int idx):') for seq in subseq...
python
def set_pointer1d(subseqs): """Set_pointer function for 1-dimensional link sequences.""" print(' . set_pointer1d') lines = Lines() lines.add(1, 'cpdef inline set_pointer1d' '(self, str name, pointerutils.PDouble value, int idx):') for seq in subseq...
[ "def", "set_pointer1d", "(", "subseqs", ")", ":", "print", "(", "' . set_pointer1d'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef inline set_pointer1d'", "'(self, str name, pointerutils.PDouble value, int idx):'", ")", ...
Set_pointer function for 1-dimensional link sequences.
[ "Set_pointer", "function", "for", "1", "-", "dimensional", "link", "sequences", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L605-L614
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.numericalparameters
def numericalparameters(self): """Numeric parameter declaration lines.""" lines = Lines() if self.model.NUMERICAL: lines.add(0, '@cython.final') lines.add(0, 'cdef class NumConsts(object):') for name in ('nmb_methods', 'nmb_stages'): lines.add(...
python
def numericalparameters(self): """Numeric parameter declaration lines.""" lines = Lines() if self.model.NUMERICAL: lines.add(0, '@cython.final') lines.add(0, 'cdef class NumConsts(object):') for name in ('nmb_methods', 'nmb_stages'): lines.add(...
[ "def", "numericalparameters", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "if", "self", ".", "model", ".", "NUMERICAL", ":", "lines", ".", "add", "(", "0", ",", "'@cython.final'", ")", "lines", ".", "add", "(", "0", ",", "'cdef class NumCon...
Numeric parameter declaration lines.
[ "Numeric", "parameter", "declaration", "lines", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L617-L636
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.modeldeclarations
def modeldeclarations(self): """Attribute declarations of the model class.""" lines = Lines() lines.add(0, '@cython.final') lines.add(0, 'cdef class Model(object):') lines.add(1, 'cdef public int idx_sim') lines.add(1, 'cdef public Parameters parameters') lines.ad...
python
def modeldeclarations(self): """Attribute declarations of the model class.""" lines = Lines() lines.add(0, '@cython.final') lines.add(0, 'cdef class Model(object):') lines.add(1, 'cdef public int idx_sim') lines.add(1, 'cdef public Parameters parameters') lines.ad...
[ "def", "modeldeclarations", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "0", ",", "'@cython.final'", ")", "lines", ".", "add", "(", "0", ",", "'cdef class Model(object):'", ")", "lines", ".", "add", "(", "1", ",", ...
Attribute declarations of the model class.
[ "Attribute", "declarations", "of", "the", "model", "class", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L639-L651
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.modelstandardfunctions
def modelstandardfunctions(self): """Standard functions of the model class.""" lines = Lines() lines.extend(self.doit) lines.extend(self.iofunctions) lines.extend(self.new2old) lines.extend(self.run) lines.extend(self.update_inlets) lines.extend(self.updat...
python
def modelstandardfunctions(self): """Standard functions of the model class.""" lines = Lines() lines.extend(self.doit) lines.extend(self.iofunctions) lines.extend(self.new2old) lines.extend(self.run) lines.extend(self.update_inlets) lines.extend(self.updat...
[ "def", "modelstandardfunctions", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "lines", ".", "extend", "(", "self", ".", "doit", ")", "lines", ".", "extend", "(", "self", ".", "iofunctions", ")", "lines", ".", "extend", "(", "self", ".", "n...
Standard functions of the model class.
[ "Standard", "functions", "of", "the", "model", "class", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L654-L665
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.modelnumericfunctions
def modelnumericfunctions(self): """Numerical functions of the model class.""" lines = Lines() lines.extend(self.solve) lines.extend(self.calculate_single_terms) lines.extend(self.calculate_full_terms) lines.extend(self.get_point_states) lines.extend(self.set_poin...
python
def modelnumericfunctions(self): """Numerical functions of the model class.""" lines = Lines() lines.extend(self.solve) lines.extend(self.calculate_single_terms) lines.extend(self.calculate_full_terms) lines.extend(self.get_point_states) lines.extend(self.set_poin...
[ "def", "modelnumericfunctions", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "lines", ".", "extend", "(", "self", ".", "solve", ")", "lines", ".", "extend", "(", "self", ".", "calculate_single_terms", ")", "lines", ".", "extend", "(", "self", ...
Numerical functions of the model class.
[ "Numerical", "functions", "of", "the", "model", "class", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L668-L685
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.doit
def doit(self): """Do (most of) it function of the model class.""" print(' . doit') lines = Lines() lines.add(1, 'cpdef inline void doit(self, int idx) %s:' % _nogil) lines.add(2, 'self.idx_sim = idx') if getattr(self.model.sequences, 'inputs', None) is not...
python
def doit(self): """Do (most of) it function of the model class.""" print(' . doit') lines = Lines() lines.add(1, 'cpdef inline void doit(self, int idx) %s:' % _nogil) lines.add(2, 'self.idx_sim = idx') if getattr(self.model.sequences, 'inputs', None) is not...
[ "def", "doit", "(", "self", ")", ":", "print", "(", "' . doit'", ")", "lines", "=", "Lines", "(", ")", "lines", ".", "add", "(", "1", ",", "'cpdef inline void doit(self, int idx) %s:'", "%", "_nogil", ")", "lines", ".", "add", "(", "2", ",",...
Do (most of) it function of the model class.
[ "Do", "(", "most", "of", ")", "it", "function", "of", "the", "model", "class", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L688-L706
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.iofunctions
def iofunctions(self): """Input/output functions of the model class.""" lines = Lines() for func in ('open_files', 'close_files', 'load_data', 'save_data'): if ((func == 'load_data') and (getattr(self.model.sequences, 'inputs', None) is None)): con...
python
def iofunctions(self): """Input/output functions of the model class.""" lines = Lines() for func in ('open_files', 'close_files', 'load_data', 'save_data'): if ((func == 'load_data') and (getattr(self.model.sequences, 'inputs', None) is None)): con...
[ "def", "iofunctions", "(", "self", ")", ":", "lines", "=", "Lines", "(", ")", "for", "func", "in", "(", "'open_files'", ",", "'close_files'", ",", "'load_data'", ",", "'save_data'", ")", ":", "if", "(", "(", "func", "==", "'load_data'", ")", "and", "("...
Input/output functions of the model class.
[ "Input", "/", "output", "functions", "of", "the", "model", "class", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L709-L739
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.calculate_single_terms
def calculate_single_terms(self): """Lines of model method with the same name.""" lines = self._call_methods('calculate_single_terms', self.model.PART_ODE_METHODS) if lines: lines.insert(1, (' self.numvars.nmb_calls =' ...
python
def calculate_single_terms(self): """Lines of model method with the same name.""" lines = self._call_methods('calculate_single_terms', self.model.PART_ODE_METHODS) if lines: lines.insert(1, (' self.numvars.nmb_calls =' ...
[ "def", "calculate_single_terms", "(", "self", ")", ":", "lines", "=", "self", ".", "_call_methods", "(", "'calculate_single_terms'", ",", "self", ".", "model", ".", "PART_ODE_METHODS", ")", "if", "lines", ":", "lines", ".", "insert", "(", "1", ",", "(", "'...
Lines of model method with the same name.
[ "Lines", "of", "model", "method", "with", "the", "same", "name", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L818-L825
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.listofmodeluserfunctions
def listofmodeluserfunctions(self): """User functions of the model class.""" lines = [] for (name, member) in vars(self.model.__class__).items(): if (inspect.isfunction(member) and (name not in ('run', 'new2old')) and ('fastaccess' in inspect.g...
python
def listofmodeluserfunctions(self): """User functions of the model class.""" lines = [] for (name, member) in vars(self.model.__class__).items(): if (inspect.isfunction(member) and (name not in ('run', 'new2old')) and ('fastaccess' in inspect.g...
[ "def", "listofmodeluserfunctions", "(", "self", ")", ":", "lines", "=", "[", "]", "for", "(", "name", ",", "member", ")", "in", "vars", "(", "self", ".", "model", ".", "__class__", ")", ".", "items", "(", ")", ":", "if", "(", "inspect", ".", "isfun...
User functions of the model class.
[ "User", "functions", "of", "the", "model", "class", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L834-L849
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
FuncConverter.cleanlines
def cleanlines(self): """Cleaned code lines. Implemented cleanups: * eventually remove method version * remove docstrings * remove comments * remove empty lines * remove line brackes within brackets * replace `modelutils` with nothing ...
python
def cleanlines(self): """Cleaned code lines. Implemented cleanups: * eventually remove method version * remove docstrings * remove comments * remove empty lines * remove line brackes within brackets * replace `modelutils` with nothing ...
[ "def", "cleanlines", "(", "self", ")", ":", "code", "=", "inspect", ".", "getsource", "(", "self", ".", "func", ")", "code", "=", "'\\n'", ".", "join", "(", "code", ".", "split", "(", "'\"\"\"'", ")", "[", ":", ":", "2", "]", ")", "code", "=", ...
Cleaned code lines. Implemented cleanups: * eventually remove method version * remove docstrings * remove comments * remove empty lines * remove line brackes within brackets * replace `modelutils` with nothing * remove complete lines contain...
[ "Cleaned", "code", "lines", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1142-L1168
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
FuncConverter.remove_linebreaks_within_equations
def remove_linebreaks_within_equations(code): r"""Remove line breaks within equations. This is not a exhaustive test, but shows how the method works: >>> code = 'asdf = \\\n(a\n+b)' >>> from hydpy.cythons.modelutils import FuncConverter >>> FuncConverter.remove_linebreaks_withi...
python
def remove_linebreaks_within_equations(code): r"""Remove line breaks within equations. This is not a exhaustive test, but shows how the method works: >>> code = 'asdf = \\\n(a\n+b)' >>> from hydpy.cythons.modelutils import FuncConverter >>> FuncConverter.remove_linebreaks_withi...
[ "def", "remove_linebreaks_within_equations", "(", "code", ")", ":", "code", "=", "code", ".", "replace", "(", "'\\\\\\n'", ",", "''", ")", "chars", "=", "[", "]", "counter", "=", "0", "for", "char", "in", "code", ":", "if", "char", "in", "(", "'('", ...
r"""Remove line breaks within equations. This is not a exhaustive test, but shows how the method works: >>> code = 'asdf = \\\n(a\n+b)' >>> from hydpy.cythons.modelutils import FuncConverter >>> FuncConverter.remove_linebreaks_within_equations(code) 'asdf = (a+b)'
[ "r", "Remove", "line", "breaks", "within", "equations", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1171-L1191
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
FuncConverter.remove_imath_operators
def remove_imath_operators(lines): """Remove mathematical expressions that require Pythons global interpreter locking mechanism. This is not a exhaustive test, but shows how the method works: >>> lines = [' x += 1*1'] >>> from hydpy.cythons.modelutils import FuncConverter ...
python
def remove_imath_operators(lines): """Remove mathematical expressions that require Pythons global interpreter locking mechanism. This is not a exhaustive test, but shows how the method works: >>> lines = [' x += 1*1'] >>> from hydpy.cythons.modelutils import FuncConverter ...
[ "def", "remove_imath_operators", "(", "lines", ")", ":", "for", "idx", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "for", "operator", "in", "(", "'+='", ",", "'-='", ",", "'**='", ",", "'*='", ",", "'//='", ",", "'/='", ",", "'%='", ")", ...
Remove mathematical expressions that require Pythons global interpreter locking mechanism. This is not a exhaustive test, but shows how the method works: >>> lines = [' x += 1*1'] >>> from hydpy.cythons.modelutils import FuncConverter >>> FuncConverter.remove_imath_operators...
[ "Remove", "mathematical", "expressions", "that", "require", "Pythons", "global", "interpreter", "locking", "mechanism", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1194-L1215
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
FuncConverter.pyxlines
def pyxlines(self): """Cython code lines. Assumptions: * Function shall be a method * Method shall be inlined * Method returns nothing * Method arguments are of type `int` (except self) * Local variables are generally of type `int` but of type `double` ...
python
def pyxlines(self): """Cython code lines. Assumptions: * Function shall be a method * Method shall be inlined * Method returns nothing * Method arguments are of type `int` (except self) * Local variables are generally of type `int` but of type `double` ...
[ "def", "pyxlines", "(", "self", ")", ":", "lines", "=", "[", "' '", "+", "line", "for", "line", "in", "self", ".", "cleanlines", "]", "lines", "[", "0", "]", "=", "lines", "[", "0", "]", ".", "replace", "(", "'def '", ",", "'cpdef inline void '", ...
Cython code lines. Assumptions: * Function shall be a method * Method shall be inlined * Method returns nothing * Method arguments are of type `int` (except self) * Local variables are generally of type `int` but of type `double` when their name sta...
[ "Cython", "code", "lines", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1218-L1240
train
hydpy-dev/hydpy
hydpy/auxs/smoothtools.py
calc_smoothpar_logistic2
def calc_smoothpar_logistic2(metapar): """Return the smoothing parameter corresponding to the given meta parameter when using |smooth_logistic2|. Calculate the smoothing parameter value corresponding the meta parameter value 2.5: >>> from hydpy.auxs.smoothtools import calc_smoothpar_logistic2 ...
python
def calc_smoothpar_logistic2(metapar): """Return the smoothing parameter corresponding to the given meta parameter when using |smooth_logistic2|. Calculate the smoothing parameter value corresponding the meta parameter value 2.5: >>> from hydpy.auxs.smoothtools import calc_smoothpar_logistic2 ...
[ "def", "calc_smoothpar_logistic2", "(", "metapar", ")", ":", "if", "metapar", "<=", "0.", ":", "return", "0.", "return", "optimize", ".", "newton", "(", "_error_smoothpar_logistic2", ",", ".3", "*", "metapar", "**", ".84", ",", "_smooth_logistic2_derivative", ",...
Return the smoothing parameter corresponding to the given meta parameter when using |smooth_logistic2|. Calculate the smoothing parameter value corresponding the meta parameter value 2.5: >>> from hydpy.auxs.smoothtools import calc_smoothpar_logistic2 >>> smoothpar = calc_smoothpar_logistic2(2.5) ...
[ "Return", "the", "smoothing", "parameter", "corresponding", "to", "the", "given", "meta", "parameter", "when", "using", "|smooth_logistic2|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/smoothtools.py#L78-L114
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Date.from_array
def from_array(cls, array): """Return a |Date| instance based on date information (year, month, day, hour, minute, second) stored as the first entries of the successive rows of a |numpy.ndarray|. >>> from hydpy import Date >>> import numpy >>> array1d = numpy.array([1992...
python
def from_array(cls, array): """Return a |Date| instance based on date information (year, month, day, hour, minute, second) stored as the first entries of the successive rows of a |numpy.ndarray|. >>> from hydpy import Date >>> import numpy >>> array1d = numpy.array([1992...
[ "def", "from_array", "(", "cls", ",", "array", ")", ":", "intarray", "=", "numpy", ".", "array", "(", "array", ",", "dtype", "=", "int", ")", "for", "dummy", "in", "range", "(", "1", ",", "array", ".", "ndim", ")", ":", "intarray", "=", "intarray",...
Return a |Date| instance based on date information (year, month, day, hour, minute, second) stored as the first entries of the successive rows of a |numpy.ndarray|. >>> from hydpy import Date >>> import numpy >>> array1d = numpy.array([1992, 10, 8, 15, 15, 42, 999]) >>> ...
[ "Return", "a", "|Date|", "instance", "based", "on", "date", "information", "(", "year", "month", "day", "hour", "minute", "second", ")", "stored", "as", "the", "first", "entries", "of", "the", "successive", "rows", "of", "a", "|numpy", ".", "ndarray|", "."...
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L256-L281
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Date.to_array
def to_array(self): """Return a 1-dimensional |numpy| |numpy.ndarray| with six entries defining the actual date (year, month, day, hour, minute, second). >>> from hydpy import Date >>> Date('1992-10-8 15:15:42').to_array() array([ 1992., 10., 8., 15., 15., 42.])...
python
def to_array(self): """Return a 1-dimensional |numpy| |numpy.ndarray| with six entries defining the actual date (year, month, day, hour, minute, second). >>> from hydpy import Date >>> Date('1992-10-8 15:15:42').to_array() array([ 1992., 10., 8., 15., 15., 42.])...
[ "def", "to_array", "(", "self", ")", ":", "return", "numpy", ".", "array", "(", "[", "self", ".", "year", ",", "self", ".", "month", ",", "self", ".", "day", ",", "self", ".", "hour", ",", "self", ".", "minute", ",", "self", ".", "second", "]", ...
Return a 1-dimensional |numpy| |numpy.ndarray| with six entries defining the actual date (year, month, day, hour, minute, second). >>> from hydpy import Date >>> Date('1992-10-8 15:15:42').to_array() array([ 1992., 10., 8., 15., 15., 42.]) .. note:: ...
[ "Return", "a", "1", "-", "dimensional", "|numpy|", "|numpy", ".", "ndarray|", "with", "six", "entries", "defining", "the", "actual", "date", "(", "year", "month", "day", "hour", "minute", "second", ")", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L283-L298
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Date.from_cfunits
def from_cfunits(cls, units) -> 'Date': """Return a |Date| object representing the reference date of the given `units` string agreeing with the NetCDF-CF conventions. The following example string is taken from the `Time Coordinate`_ chapter of the NetCDF-CF conventions documentation (mo...
python
def from_cfunits(cls, units) -> 'Date': """Return a |Date| object representing the reference date of the given `units` string agreeing with the NetCDF-CF conventions. The following example string is taken from the `Time Coordinate`_ chapter of the NetCDF-CF conventions documentation (mo...
[ "def", "from_cfunits", "(", "cls", ",", "units", ")", "->", "'Date'", ":", "try", ":", "string", "=", "units", "[", "units", ".", "find", "(", "'since'", ")", "+", "6", ":", "]", "idx", "=", "string", ".", "find", "(", "'.'", ")", "if", "idx", ...
Return a |Date| object representing the reference date of the given `units` string agreeing with the NetCDF-CF conventions. The following example string is taken from the `Time Coordinate`_ chapter of the NetCDF-CF conventions documentation (modified). Note that the first entry (the uni...
[ "Return", "a", "|Date|", "object", "representing", "the", "reference", "date", "of", "the", "given", "units", "string", "agreeing", "with", "the", "NetCDF", "-", "CF", "conventions", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L301-L361
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Date.to_cfunits
def to_cfunits(self, unit='hours', utcoffset=None): """Return a `units` string agreeing with the NetCDF-CF conventions. By default, |Date.to_cfunits| takes `hours` as time unit, and the the actual value of |Options.utcoffset| as time zone information: >>> from hydpy import Date ...
python
def to_cfunits(self, unit='hours', utcoffset=None): """Return a `units` string agreeing with the NetCDF-CF conventions. By default, |Date.to_cfunits| takes `hours` as time unit, and the the actual value of |Options.utcoffset| as time zone information: >>> from hydpy import Date ...
[ "def", "to_cfunits", "(", "self", ",", "unit", "=", "'hours'", ",", "utcoffset", "=", "None", ")", ":", "if", "utcoffset", "is", "None", ":", "utcoffset", "=", "hydpy", ".", "pub", ".", "options", ".", "utcoffset", "string", "=", "self", ".", "to_strin...
Return a `units` string agreeing with the NetCDF-CF conventions. By default, |Date.to_cfunits| takes `hours` as time unit, and the the actual value of |Options.utcoffset| as time zone information: >>> from hydpy import Date >>> date = Date('1992-10-08 15:15:42') >>> date.to_cfu...
[ "Return", "a", "units", "string", "agreeing", "with", "the", "NetCDF", "-", "CF", "conventions", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L363-L389
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Date._set_thing
def _set_thing(self, thing, value): """Convenience method for `_set_year`, `_set_month`...""" try: value = int(value) except (TypeError, ValueError): raise TypeError( f'Changing the {thing} of a `Date` instance is only ' f'allowed via numbe...
python
def _set_thing(self, thing, value): """Convenience method for `_set_year`, `_set_month`...""" try: value = int(value) except (TypeError, ValueError): raise TypeError( f'Changing the {thing} of a `Date` instance is only ' f'allowed via numbe...
[ "def", "_set_thing", "(", "self", ",", "thing", ",", "value", ")", ":", "try", ":", "value", "=", "int", "(", "value", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "raise", "TypeError", "(", "f'Changing the {thing} of a `Date` instance is only...
Convenience method for `_set_year`, `_set_month`...
[ "Convenience", "method", "for", "_set_year", "_set_month", "..." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L455-L468
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Date.wateryear
def wateryear(self): """The actual hydrological year according to the selected reference month. The reference mont reference |Date.refmonth| defaults to November: >>> october = Date('1996.10.01') >>> november = Date('1996.11.01') >>> october.wateryear 1996 ...
python
def wateryear(self): """The actual hydrological year according to the selected reference month. The reference mont reference |Date.refmonth| defaults to November: >>> october = Date('1996.10.01') >>> november = Date('1996.11.01') >>> october.wateryear 1996 ...
[ "def", "wateryear", "(", "self", ")", ":", "if", "self", ".", "month", "<", "self", ".", "_firstmonth_wateryear", ":", "return", "self", ".", "year", "return", "self", ".", "year", "+", "1" ]
The actual hydrological year according to the selected reference month. The reference mont reference |Date.refmonth| defaults to November: >>> october = Date('1996.10.01') >>> november = Date('1996.11.01') >>> october.wateryear 1996 >>> november.wateryear ...
[ "The", "actual", "hydrological", "year", "according", "to", "the", "selected", "reference", "month", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L582-L610
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Date.to_string
def to_string(self, style=None, utcoffset=None): """Return a |str| object representing the actual date in accordance with the given style and the eventually given UTC offset (in minutes). Without any input arguments, the actual |Date.style| is used to return a date string in you...
python
def to_string(self, style=None, utcoffset=None): """Return a |str| object representing the actual date in accordance with the given style and the eventually given UTC offset (in minutes). Without any input arguments, the actual |Date.style| is used to return a date string in you...
[ "def", "to_string", "(", "self", ",", "style", "=", "None", ",", "utcoffset", "=", "None", ")", ":", "if", "not", "style", ":", "style", "=", "self", ".", "style", "if", "utcoffset", "is", "None", ":", "string", "=", "''", "date", "=", "self", ".",...
Return a |str| object representing the actual date in accordance with the given style and the eventually given UTC offset (in minutes). Without any input arguments, the actual |Date.style| is used to return a date string in your local time zone: >>> from hydpy import Date ...
[ "Return", "a", "|str|", "object", "representing", "the", "actual", "date", "in", "accordance", "with", "the", "given", "style", "and", "the", "eventually", "given", "UTC", "offset", "(", "in", "minutes", ")", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L686-L734
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Period.fromseconds
def fromseconds(cls, seconds): """Return a |Period| instance based on a given number of seconds.""" try: seconds = int(seconds) except TypeError: seconds = int(seconds.flatten()[0]) return cls(datetime.timedelta(0, int(seconds)))
python
def fromseconds(cls, seconds): """Return a |Period| instance based on a given number of seconds.""" try: seconds = int(seconds) except TypeError: seconds = int(seconds.flatten()[0]) return cls(datetime.timedelta(0, int(seconds)))
[ "def", "fromseconds", "(", "cls", ",", "seconds", ")", ":", "try", ":", "seconds", "=", "int", "(", "seconds", ")", "except", "TypeError", ":", "seconds", "=", "int", "(", "seconds", ".", "flatten", "(", ")", "[", "0", "]", ")", "return", "cls", "(...
Return a |Period| instance based on a given number of seconds.
[ "Return", "a", "|Period|", "instance", "based", "on", "a", "given", "number", "of", "seconds", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L945-L951
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Period._guessunit
def _guessunit(self): """Guess the unit of the period as the largest one, which results in an integer duration. """ if not self.days % 1: return 'd' elif not self.hours % 1: return 'h' elif not self.minutes % 1: return 'm' elif ...
python
def _guessunit(self): """Guess the unit of the period as the largest one, which results in an integer duration. """ if not self.days % 1: return 'd' elif not self.hours % 1: return 'h' elif not self.minutes % 1: return 'm' elif ...
[ "def", "_guessunit", "(", "self", ")", ":", "if", "not", "self", ".", "days", "%", "1", ":", "return", "'d'", "elif", "not", "self", ".", "hours", "%", "1", ":", "return", "'h'", "elif", "not", "self", ".", "minutes", "%", "1", ":", "return", "'m...
Guess the unit of the period as the largest one, which results in an integer duration.
[ "Guess", "the", "unit", "of", "the", "period", "as", "the", "largest", "one", "which", "results", "in", "an", "integer", "duration", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L972-L987
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrid.from_array
def from_array(cls, array): """Returns a |Timegrid| instance based on two date and one period information stored in the first 13 rows of a |numpy.ndarray| object. """ try: return cls(Date.from_array(array[:6]), Date.from_array(array[6:12]), ...
python
def from_array(cls, array): """Returns a |Timegrid| instance based on two date and one period information stored in the first 13 rows of a |numpy.ndarray| object. """ try: return cls(Date.from_array(array[:6]), Date.from_array(array[6:12]), ...
[ "def", "from_array", "(", "cls", ",", "array", ")", ":", "try", ":", "return", "cls", "(", "Date", ".", "from_array", "(", "array", "[", ":", "6", "]", ")", ",", "Date", ".", "from_array", "(", "array", "[", "6", ":", "12", "]", ")", ",", "Peri...
Returns a |Timegrid| instance based on two date and one period information stored in the first 13 rows of a |numpy.ndarray| object.
[ "Returns", "a", "|Timegrid|", "instance", "based", "on", "two", "date", "and", "one", "period", "information", "stored", "in", "the", "first", "13", "rows", "of", "a", "|numpy", ".", "ndarray|", "object", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1285-L1297
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrid.to_array
def to_array(self): """Returns a 1-dimensional |numpy| |numpy.ndarray| with thirteen entries first defining the start date, secondly defining the end date and thirdly the step size in seconds. """ values = numpy.empty(13, dtype=float) values[:6] = self.firstdate.to_array(...
python
def to_array(self): """Returns a 1-dimensional |numpy| |numpy.ndarray| with thirteen entries first defining the start date, secondly defining the end date and thirdly the step size in seconds. """ values = numpy.empty(13, dtype=float) values[:6] = self.firstdate.to_array(...
[ "def", "to_array", "(", "self", ")", ":", "values", "=", "numpy", ".", "empty", "(", "13", ",", "dtype", "=", "float", ")", "values", "[", ":", "6", "]", "=", "self", ".", "firstdate", ".", "to_array", "(", ")", "values", "[", "6", ":", "12", "...
Returns a 1-dimensional |numpy| |numpy.ndarray| with thirteen entries first defining the start date, secondly defining the end date and thirdly the step size in seconds.
[ "Returns", "a", "1", "-", "dimensional", "|numpy|", "|numpy", ".", "ndarray|", "with", "thirteen", "entries", "first", "defining", "the", "start", "date", "secondly", "defining", "the", "end", "date", "and", "thirdly", "the", "step", "size", "in", "seconds", ...
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1299-L1308
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrid.from_timepoints
def from_timepoints(cls, timepoints, refdate, unit='hours'): """Return a |Timegrid| object representing the given starting `timepoints` in relation to the given `refdate`. The following examples identical with the ones of |Timegrid.to_timepoints| but reversed. At least two give...
python
def from_timepoints(cls, timepoints, refdate, unit='hours'): """Return a |Timegrid| object representing the given starting `timepoints` in relation to the given `refdate`. The following examples identical with the ones of |Timegrid.to_timepoints| but reversed. At least two give...
[ "def", "from_timepoints", "(", "cls", ",", "timepoints", ",", "refdate", ",", "unit", "=", "'hours'", ")", ":", "refdate", "=", "Date", "(", "refdate", ")", "unit", "=", "Period", ".", "from_cfunits", "(", "unit", ")", "delta", "=", "timepoints", "[", ...
Return a |Timegrid| object representing the given starting `timepoints` in relation to the given `refdate`. The following examples identical with the ones of |Timegrid.to_timepoints| but reversed. At least two given time points must be increasing and equidistant. By default, t...
[ "Return", "a", "|Timegrid|", "object", "representing", "the", "given", "starting", "timepoints", "in", "relation", "to", "the", "given", "refdate", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1311-L1354
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrid.to_timepoints
def to_timepoints(self, unit='hours', offset=None): """Return an |numpy.ndarray| representing the starting time points of the |Timegrid| object. The following examples identical with the ones of |Timegrid.from_timepoints| but reversed. By default, the time points are given in h...
python
def to_timepoints(self, unit='hours', offset=None): """Return an |numpy.ndarray| representing the starting time points of the |Timegrid| object. The following examples identical with the ones of |Timegrid.from_timepoints| but reversed. By default, the time points are given in h...
[ "def", "to_timepoints", "(", "self", ",", "unit", "=", "'hours'", ",", "offset", "=", "None", ")", ":", "unit", "=", "Period", ".", "from_cfunits", "(", "unit", ")", "if", "offset", "is", "None", ":", "offset", "=", "0.", "else", ":", "try", ":", "...
Return an |numpy.ndarray| representing the starting time points of the |Timegrid| object. The following examples identical with the ones of |Timegrid.from_timepoints| but reversed. By default, the time points are given in hours: >>> from hydpy import Timegrid >>> timeg...
[ "Return", "an", "|numpy", ".", "ndarray|", "representing", "the", "starting", "time", "points", "of", "the", "|Timegrid|", "object", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1356-L1397
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrid.array2series
def array2series(self, array): """Prefix the information of the actual Timegrid object to the given array and return it. The Timegrid information is stored in the first thirteen values of the first axis of the returned series. Initialize a Timegrid object and apply its `array2s...
python
def array2series(self, array): """Prefix the information of the actual Timegrid object to the given array and return it. The Timegrid information is stored in the first thirteen values of the first axis of the returned series. Initialize a Timegrid object and apply its `array2s...
[ "def", "array2series", "(", "self", ",", "array", ")", ":", "try", ":", "array", "=", "numpy", ".", "array", "(", "array", ",", "dtype", "=", "float", ")", "except", "BaseException", ":", "objecttools", ".", "augment_excmessage", "(", "'While trying to prefi...
Prefix the information of the actual Timegrid object to the given array and return it. The Timegrid information is stored in the first thirteen values of the first axis of the returned series. Initialize a Timegrid object and apply its `array2series` method on a simple list containing ...
[ "Prefix", "the", "information", "of", "the", "actual", "Timegrid", "object", "to", "the", "given", "array", "and", "return", "it", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1399-L1496
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrid.verify
def verify(self): """Raise an |ValueError| if the dates or the step size of the time frame are inconsistent. """ if self.firstdate >= self.lastdate: raise ValueError( f'Unplausible timegrid. The first given date ' f'{self.firstdate}, the second...
python
def verify(self): """Raise an |ValueError| if the dates or the step size of the time frame are inconsistent. """ if self.firstdate >= self.lastdate: raise ValueError( f'Unplausible timegrid. The first given date ' f'{self.firstdate}, the second...
[ "def", "verify", "(", "self", ")", ":", "if", "self", ".", "firstdate", ">=", "self", ".", "lastdate", ":", "raise", "ValueError", "(", "f'Unplausible timegrid. The first given date '", "f'{self.firstdate}, the second given date is {self.lastdate}.'", ")", "if", "(", "s...
Raise an |ValueError| if the dates or the step size of the time frame are inconsistent.
[ "Raise", "an", "|ValueError|", "if", "the", "dates", "or", "the", "step", "size", "of", "the", "time", "frame", "are", "inconsistent", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1498-L1510
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrid.assignrepr
def assignrepr(self, prefix, style=None, utcoffset=None): """Return a |repr| string with an prefixed assignement. Without option arguments given, printing the returned string looks like: >>> from hydpy import Timegrid >>> timegrid = Timegrid('1996-11-01 00:00:00', ... ...
python
def assignrepr(self, prefix, style=None, utcoffset=None): """Return a |repr| string with an prefixed assignement. Without option arguments given, printing the returned string looks like: >>> from hydpy import Timegrid >>> timegrid = Timegrid('1996-11-01 00:00:00', ... ...
[ "def", "assignrepr", "(", "self", ",", "prefix", ",", "style", "=", "None", ",", "utcoffset", "=", "None", ")", ":", "skip", "=", "len", "(", "prefix", ")", "+", "9", "blanks", "=", "' '", "*", "skip", "return", "(", "f\"{prefix}Timegrid('\"", "f\"{sel...
Return a |repr| string with an prefixed assignement. Without option arguments given, printing the returned string looks like: >>> from hydpy import Timegrid >>> timegrid = Timegrid('1996-11-01 00:00:00', ... '1997-11-01 00:00:00', ... ...
[ "Return", "a", "|repr|", "string", "with", "an", "prefixed", "assignement", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1562-L1591
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrids.verify
def verify(self): """Raise an |ValueError| it the different time grids are inconsistent.""" self.init.verify() self.sim.verify() if self.init.firstdate > self.sim.firstdate: raise ValueError( f'The first date of the initialisation period ' ...
python
def verify(self): """Raise an |ValueError| it the different time grids are inconsistent.""" self.init.verify() self.sim.verify() if self.init.firstdate > self.sim.firstdate: raise ValueError( f'The first date of the initialisation period ' ...
[ "def", "verify", "(", "self", ")", ":", "self", ".", "init", ".", "verify", "(", ")", "self", ".", "sim", ".", "verify", "(", ")", "if", "self", ".", "init", ".", "firstdate", ">", "self", ".", "sim", ".", "firstdate", ":", "raise", "ValueError", ...
Raise an |ValueError| it the different time grids are inconsistent.
[ "Raise", "an", "|ValueError|", "it", "the", "different", "time", "grids", "are", "inconsistent", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1786-L1814
train
hydpy-dev/hydpy
hydpy/core/timetools.py
Timegrids.assignrepr
def assignrepr(self, prefix): """Return a |repr| string with a prefixed assignment.""" caller = 'Timegrids(' blanks = ' ' * (len(prefix) + len(caller)) prefix = f'{prefix}{caller}' lines = [f'{self.init.assignrepr(prefix)},'] if self.sim != self.init: lines.ap...
python
def assignrepr(self, prefix): """Return a |repr| string with a prefixed assignment.""" caller = 'Timegrids(' blanks = ' ' * (len(prefix) + len(caller)) prefix = f'{prefix}{caller}' lines = [f'{self.init.assignrepr(prefix)},'] if self.sim != self.init: lines.ap...
[ "def", "assignrepr", "(", "self", ",", "prefix", ")", ":", "caller", "=", "'Timegrids('", "blanks", "=", "' '", "*", "(", "len", "(", "prefix", ")", "+", "len", "(", "caller", ")", ")", "prefix", "=", "f'{prefix}{caller}'", "lines", "=", "[", "f'{self....
Return a |repr| string with a prefixed assignment.
[ "Return", "a", "|repr|", "string", "with", "a", "prefixed", "assignment", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1847-L1856
train
hydpy-dev/hydpy
hydpy/core/timetools.py
TOY.seconds_passed
def seconds_passed(self): """Amount of time passed in seconds since the beginning of the year. In the first example, the year is only one minute and thirty seconds old: >>> from hydpy.core.timetools import TOY >>> TOY('1_1_0_1_30').seconds_passed 90 The second ...
python
def seconds_passed(self): """Amount of time passed in seconds since the beginning of the year. In the first example, the year is only one minute and thirty seconds old: >>> from hydpy.core.timetools import TOY >>> TOY('1_1_0_1_30').seconds_passed 90 The second ...
[ "def", "seconds_passed", "(", "self", ")", ":", "return", "int", "(", "(", "Date", "(", "self", ")", ".", "datetime", "-", "self", ".", "_STARTDATE", ".", "datetime", ")", ".", "total_seconds", "(", ")", ")" ]
Amount of time passed in seconds since the beginning of the year. In the first example, the year is only one minute and thirty seconds old: >>> from hydpy.core.timetools import TOY >>> TOY('1_1_0_1_30').seconds_passed 90 The second example shows that the 29th February ...
[ "Amount", "of", "time", "passed", "in", "seconds", "since", "the", "beginning", "of", "the", "year", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L2080-L2096
train
hydpy-dev/hydpy
hydpy/core/timetools.py
TOY.seconds_left
def seconds_left(self): """Remaining part of the year in seconds. In the first example, only one minute and thirty seconds of the year remain: >>> from hydpy.core.timetools import TOY >>> TOY('12_31_23_58_30').seconds_left 90 The second example shows that the 2...
python
def seconds_left(self): """Remaining part of the year in seconds. In the first example, only one minute and thirty seconds of the year remain: >>> from hydpy.core.timetools import TOY >>> TOY('12_31_23_58_30').seconds_left 90 The second example shows that the 2...
[ "def", "seconds_left", "(", "self", ")", ":", "return", "int", "(", "(", "self", ".", "_ENDDATE", ".", "datetime", "-", "Date", "(", "self", ")", ".", "datetime", ")", ".", "total_seconds", "(", ")", ")" ]
Remaining part of the year in seconds. In the first example, only one minute and thirty seconds of the year remain: >>> from hydpy.core.timetools import TOY >>> TOY('12_31_23_58_30').seconds_left 90 The second example shows that the 29th February is generally included:...
[ "Remaining", "part", "of", "the", "year", "in", "seconds", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L2099-L2115
train
hydpy-dev/hydpy
hydpy/core/timetools.py
TOY.centred_timegrid
def centred_timegrid(cls, simulationstep): """Return a |Timegrid| object defining the central time points of the year 2000 for the given simulation step. >>> from hydpy.core.timetools import TOY >>> TOY.centred_timegrid('1d') Timegrid('2000-01-01 12:00:00', '200...
python
def centred_timegrid(cls, simulationstep): """Return a |Timegrid| object defining the central time points of the year 2000 for the given simulation step. >>> from hydpy.core.timetools import TOY >>> TOY.centred_timegrid('1d') Timegrid('2000-01-01 12:00:00', '200...
[ "def", "centred_timegrid", "(", "cls", ",", "simulationstep", ")", ":", "simulationstep", "=", "Period", "(", "simulationstep", ")", "return", "Timegrid", "(", "cls", ".", "_STARTDATE", "+", "simulationstep", "/", "2", ",", "cls", ".", "_ENDDATE", "+", "simu...
Return a |Timegrid| object defining the central time points of the year 2000 for the given simulation step. >>> from hydpy.core.timetools import TOY >>> TOY.centred_timegrid('1d') Timegrid('2000-01-01 12:00:00', '2001-01-01 12:00:00', '1d')
[ "Return", "a", "|Timegrid|", "object", "defining", "the", "central", "time", "points", "of", "the", "year", "2000", "for", "the", "given", "simulation", "step", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L2118-L2132
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
dir_
def dir_(self): """The prefered way for HydPy objects to respond to |dir|. Note the depencence on the `pub.options.dirverbose`. If this option is set `True`, all attributes and methods of the given instance and its class (including those inherited from the parent classes) are returned: >>> from h...
python
def dir_(self): """The prefered way for HydPy objects to respond to |dir|. Note the depencence on the `pub.options.dirverbose`. If this option is set `True`, all attributes and methods of the given instance and its class (including those inherited from the parent classes) are returned: >>> from h...
[ "def", "dir_", "(", "self", ")", ":", "names", "=", "set", "(", ")", "for", "thing", "in", "list", "(", "inspect", ".", "getmro", "(", "type", "(", "self", ")", ")", ")", "+", "[", "self", "]", ":", "for", "key", "in", "vars", "(", "thing", "...
The prefered way for HydPy objects to respond to |dir|. Note the depencence on the `pub.options.dirverbose`. If this option is set `True`, all attributes and methods of the given instance and its class (including those inherited from the parent classes) are returned: >>> from hydpy import pub >>>...
[ "The", "prefered", "way", "for", "HydPy", "objects", "to", "respond", "to", "|dir|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L20-L59
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
classname
def classname(self): """Return the class name of the given instance object or class. >>> from hydpy.core.objecttools import classname >>> from hydpy import pub >>> print(classname(float)) float >>> print(classname(pub.options)) Options """ if inspect.isclass(self): string = ...
python
def classname(self): """Return the class name of the given instance object or class. >>> from hydpy.core.objecttools import classname >>> from hydpy import pub >>> print(classname(float)) float >>> print(classname(pub.options)) Options """ if inspect.isclass(self): string = ...
[ "def", "classname", "(", "self", ")", ":", "if", "inspect", ".", "isclass", "(", "self", ")", ":", "string", "=", "str", "(", "self", ")", "else", ":", "string", "=", "str", "(", "type", "(", "self", ")", ")", "try", ":", "string", "=", "string",...
Return the class name of the given instance object or class. >>> from hydpy.core.objecttools import classname >>> from hydpy import pub >>> print(classname(float)) float >>> print(classname(pub.options)) Options
[ "Return", "the", "class", "name", "of", "the", "given", "instance", "object", "or", "class", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L62-L80
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
name
def name(self): """Name of the class of the given instance in lower case letters. This function is thought to be implemented as a property. Otherwise it would violate the principle not to access or manipulate private attributes ("_name"): >>> from hydpy.core.objecttools import name >>> class ...
python
def name(self): """Name of the class of the given instance in lower case letters. This function is thought to be implemented as a property. Otherwise it would violate the principle not to access or manipulate private attributes ("_name"): >>> from hydpy.core.objecttools import name >>> class ...
[ "def", "name", "(", "self", ")", ":", "cls", "=", "type", "(", "self", ")", "try", ":", "return", "cls", ".", "__dict__", "[", "'_name'", "]", "except", "KeyError", ":", "setattr", "(", "cls", ",", "'_name'", ",", "instancename", "(", "self", ")", ...
Name of the class of the given instance in lower case letters. This function is thought to be implemented as a property. Otherwise it would violate the principle not to access or manipulate private attributes ("_name"): >>> from hydpy.core.objecttools import name >>> class Test(object): ... ...
[ "Name", "of", "the", "class", "of", "the", "given", "instance", "in", "lower", "case", "letters", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L109-L137
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
valid_variable_identifier
def valid_variable_identifier(string): """Raises an |ValueError| if the given name is not a valid Python identifier. For example, the string `test_1` (with underscore) is valid... >>> from hydpy.core.objecttools import valid_variable_identifier >>> valid_variable_identifier('test_1') ...but t...
python
def valid_variable_identifier(string): """Raises an |ValueError| if the given name is not a valid Python identifier. For example, the string `test_1` (with underscore) is valid... >>> from hydpy.core.objecttools import valid_variable_identifier >>> valid_variable_identifier('test_1') ...but t...
[ "def", "valid_variable_identifier", "(", "string", ")", ":", "string", "=", "str", "(", "string", ")", "try", ":", "exec", "(", "'%s = None'", "%", "string", ")", "if", "string", "in", "dir", "(", "builtins", ")", ":", "raise", "SyntaxError", "(", ")", ...
Raises an |ValueError| if the given name is not a valid Python identifier. For example, the string `test_1` (with underscore) is valid... >>> from hydpy.core.objecttools import valid_variable_identifier >>> valid_variable_identifier('test_1') ...but the string `test 1` (with white space) is not: ...
[ "Raises", "an", "|ValueError|", "if", "the", "given", "name", "is", "not", "a", "valid", "Python", "identifier", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L272-L309
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
augment_excmessage
def augment_excmessage(prefix=None, suffix=None) -> NoReturn: """Augment an exception message with additional information while keeping the original traceback. You can prefix and/or suffix text. If you prefix something (which happens much more often in the HydPy framework), the sub-clause ', the follo...
python
def augment_excmessage(prefix=None, suffix=None) -> NoReturn: """Augment an exception message with additional information while keeping the original traceback. You can prefix and/or suffix text. If you prefix something (which happens much more often in the HydPy framework), the sub-clause ', the follo...
[ "def", "augment_excmessage", "(", "prefix", "=", "None", ",", "suffix", "=", "None", ")", "->", "NoReturn", ":", "exc_old", "=", "sys", ".", "exc_info", "(", ")", "[", "1", "]", "message", "=", "str", "(", "exc_old", ")", "if", "prefix", "is", "not",...
Augment an exception message with additional information while keeping the original traceback. You can prefix and/or suffix text. If you prefix something (which happens much more often in the HydPy framework), the sub-clause ', the following error occurred:' is automatically included: >>> from hy...
[ "Augment", "an", "exception", "message", "with", "additional", "information", "while", "keeping", "the", "original", "traceback", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L312-L366
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
excmessage_decorator
def excmessage_decorator(description) -> Callable: """Wrap a function with |augment_excmessage|. Function |excmessage_decorator| is a means to apply function |augment_excmessage| more efficiently. Suppose you would apply function |augment_excmessage| in a function that adds and returns to numbers:...
python
def excmessage_decorator(description) -> Callable: """Wrap a function with |augment_excmessage|. Function |excmessage_decorator| is a means to apply function |augment_excmessage| more efficiently. Suppose you would apply function |augment_excmessage| in a function that adds and returns to numbers:...
[ "def", "excmessage_decorator", "(", "description", ")", "->", "Callable", ":", "@", "wrapt", ".", "decorator", "def", "wrapper", "(", "wrapped", ",", "instance", ",", "args", ",", "kwargs", ")", ":", "\"\"\"Apply |augment_excmessage| when the wrapped function fails.\"...
Wrap a function with |augment_excmessage|. Function |excmessage_decorator| is a means to apply function |augment_excmessage| more efficiently. Suppose you would apply function |augment_excmessage| in a function that adds and returns to numbers: >>> from hydpy.core import objecttools >>> def ...
[ "Wrap", "a", "function", "with", "|augment_excmessage|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L369-L494
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
print_values
def print_values(values, width=70): """Print the given values in multiple lines with a certain maximum width. By default, each line contains at most 70 characters: >>> from hydpy import print_values >>> print_values(range(21)) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...
python
def print_values(values, width=70): """Print the given values in multiple lines with a certain maximum width. By default, each line contains at most 70 characters: >>> from hydpy import print_values >>> print_values(range(21)) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...
[ "def", "print_values", "(", "values", ",", "width", "=", "70", ")", ":", "for", "line", "in", "textwrap", ".", "wrap", "(", "repr_values", "(", "values", ")", ",", "width", "=", "width", ")", ":", "print", "(", "line", ")" ]
Print the given values in multiple lines with a certain maximum width. By default, each line contains at most 70 characters: >>> from hydpy import print_values >>> print_values(range(21)) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 You can change this default beha...
[ "Print", "the", "given", "values", "in", "multiple", "lines", "with", "a", "certain", "maximum", "width", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L801-L820
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
assignrepr_values
def assignrepr_values(values, prefix, width=None, _fakeend=0): """Return a prefixed, wrapped and properly aligned string representation of the given values using function |repr|. >>> from hydpy.core.objecttools import assignrepr_values >>> print(assignrepr_values(range(1, 13), 'test(', 20) + ')') t...
python
def assignrepr_values(values, prefix, width=None, _fakeend=0): """Return a prefixed, wrapped and properly aligned string representation of the given values using function |repr|. >>> from hydpy.core.objecttools import assignrepr_values >>> print(assignrepr_values(range(1, 13), 'test(', 20) + ')') t...
[ "def", "assignrepr_values", "(", "values", ",", "prefix", ",", "width", "=", "None", ",", "_fakeend", "=", "0", ")", ":", "ellipsis_", "=", "hydpy", ".", "pub", ".", "options", ".", "ellipsis", "if", "(", "ellipsis_", ">", "0", ")", "and", "(", "len"...
Return a prefixed, wrapped and properly aligned string representation of the given values using function |repr|. >>> from hydpy.core.objecttools import assignrepr_values >>> print(assignrepr_values(range(1, 13), 'test(', 20) + ')') test(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) If n...
[ "Return", "a", "prefixed", "wrapped", "and", "properly", "aligned", "string", "representation", "of", "the", "given", "values", "using", "function", "|repr|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L871-L930
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
assignrepr_values2
def assignrepr_values2(values, prefix): """Return a prefixed and properly aligned string representation of the given 2-dimensional value matrix using function |repr|. >>> from hydpy.core.objecttools import assignrepr_values2 >>> import numpy >>> print(assignrepr_values2(numpy.eye(3), 'test(') + ')'...
python
def assignrepr_values2(values, prefix): """Return a prefixed and properly aligned string representation of the given 2-dimensional value matrix using function |repr|. >>> from hydpy.core.objecttools import assignrepr_values2 >>> import numpy >>> print(assignrepr_values2(numpy.eye(3), 'test(') + ')'...
[ "def", "assignrepr_values2", "(", "values", ",", "prefix", ")", ":", "lines", "=", "[", "]", "blanks", "=", "' '", "*", "len", "(", "prefix", ")", "for", "(", "idx", ",", "subvalues", ")", "in", "enumerate", "(", "values", ")", ":", "if", "idx", "=...
Return a prefixed and properly aligned string representation of the given 2-dimensional value matrix using function |repr|. >>> from hydpy.core.objecttools import assignrepr_values2 >>> import numpy >>> print(assignrepr_values2(numpy.eye(3), 'test(') + ')') test(1.0, 0.0, 0.0, 0.0, 1.0, 0....
[ "Return", "a", "prefixed", "and", "properly", "aligned", "string", "representation", "of", "the", "given", "2", "-", "dimensional", "value", "matrix", "using", "function", "|repr|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1050-L1074
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
_assignrepr_bracketed2
def _assignrepr_bracketed2(assignrepr_bracketed1, values, prefix, width=None): """Return a prefixed, wrapped and properly aligned bracketed string representation of the given 2-dimensional value matrix using function |repr|.""" brackets = getattr(assignrepr_bracketed1, '_brackets') prefix += bracket...
python
def _assignrepr_bracketed2(assignrepr_bracketed1, values, prefix, width=None): """Return a prefixed, wrapped and properly aligned bracketed string representation of the given 2-dimensional value matrix using function |repr|.""" brackets = getattr(assignrepr_bracketed1, '_brackets') prefix += bracket...
[ "def", "_assignrepr_bracketed2", "(", "assignrepr_bracketed1", ",", "values", ",", "prefix", ",", "width", "=", "None", ")", ":", "brackets", "=", "getattr", "(", "assignrepr_bracketed1", ",", "'_brackets'", ")", "prefix", "+=", "brackets", "[", "0", "]", "lin...
Return a prefixed, wrapped and properly aligned bracketed string representation of the given 2-dimensional value matrix using function |repr|.
[ "Return", "a", "prefixed", "wrapped", "and", "properly", "aligned", "bracketed", "string", "representation", "of", "the", "given", "2", "-", "dimensional", "value", "matrix", "using", "function", "|repr|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1077-L1094
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
round_
def round_(values, decimals=None, width=0, lfill=None, rfill=None, **kwargs): """Prints values with a maximum number of digits in doctests. See the documentation on function |repr| for more details. And note thate the option keyword arguments are passed to the print function. Usually one w...
python
def round_(values, decimals=None, width=0, lfill=None, rfill=None, **kwargs): """Prints values with a maximum number of digits in doctests. See the documentation on function |repr| for more details. And note thate the option keyword arguments are passed to the print function. Usually one w...
[ "def", "round_", "(", "values", ",", "decimals", "=", "None", ",", "width", "=", "0", ",", "lfill", "=", "None", ",", "rfill", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "decimals", "is", "None", ":", "decimals", "=", "hydpy", ".", "pu...
Prints values with a maximum number of digits in doctests. See the documentation on function |repr| for more details. And note thate the option keyword arguments are passed to the print function. Usually one would apply function |round_| on a single or a vector of numbers: >>> from hydpy import ...
[ "Prints", "values", "with", "a", "maximum", "number", "of", "digits", "in", "doctests", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1324-L1375
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
extract
def extract(values, types, skip=False): """Return a generator that extracts certain objects from `values`. This function is thought for supporting the definition of functions with arguments, that can be objects of of contain types or that can be iterables containing these objects. The following ex...
python
def extract(values, types, skip=False): """Return a generator that extracts certain objects from `values`. This function is thought for supporting the definition of functions with arguments, that can be objects of of contain types or that can be iterables containing these objects. The following ex...
[ "def", "extract", "(", "values", ",", "types", ",", "skip", "=", "False", ")", ":", "if", "isinstance", "(", "values", ",", "types", ")", ":", "yield", "values", "elif", "skip", "and", "(", "values", "is", "None", ")", ":", "return", "else", ":", "...
Return a generator that extracts certain objects from `values`. This function is thought for supporting the definition of functions with arguments, that can be objects of of contain types or that can be iterables containing these objects. The following examples show that function |extract| basical...
[ "Return", "a", "generator", "that", "extracts", "certain", "objects", "from", "values", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1378-L1428
train
hydpy-dev/hydpy
hydpy/core/objecttools.py
enumeration
def enumeration(values, converter=str, default=''): """Return an enumeration string based on the given values. The following four examples show the standard output of function |enumeration|: >>> from hydpy.core.objecttools import enumeration >>> enumeration(('text', 3, [])) 'text, 3, and []' ...
python
def enumeration(values, converter=str, default=''): """Return an enumeration string based on the given values. The following four examples show the standard output of function |enumeration|: >>> from hydpy.core.objecttools import enumeration >>> enumeration(('text', 3, [])) 'text, 3, and []' ...
[ "def", "enumeration", "(", "values", ",", "converter", "=", "str", ",", "default", "=", "''", ")", ":", "values", "=", "tuple", "(", "converter", "(", "value", ")", "for", "value", "in", "values", ")", "if", "not", "values", ":", "return", "default", ...
Return an enumeration string based on the given values. The following four examples show the standard output of function |enumeration|: >>> from hydpy.core.objecttools import enumeration >>> enumeration(('text', 3, [])) 'text, 3, and []' >>> enumeration(('text', 3)) 'text and 3' >>> en...
[ "Return", "an", "enumeration", "string", "based", "on", "the", "given", "values", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1431-L1468
train
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
Ic.trim
def trim(self, lower=None, upper=None): """Trim upper values in accordance with :math:`IC \\leq ICMAX`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(5) >>> icmax(2.0) >>> states.ic(-1.0, 0.0, 1.0, 2.0, 3.0) >>> states.ic ic(0....
python
def trim(self, lower=None, upper=None): """Trim upper values in accordance with :math:`IC \\leq ICMAX`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(5) >>> icmax(2.0) >>> states.ic(-1.0, 0.0, 1.0, 2.0, 3.0) >>> states.ic ic(0....
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "if", "upper", "is", "None", ":", "control", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", "upper", "=", "contr...
Trim upper values in accordance with :math:`IC \\leq ICMAX`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(5) >>> icmax(2.0) >>> states.ic(-1.0, 0.0, 1.0, 2.0, 3.0) >>> states.ic ic(0.0, 0.0, 1.0, 2.0, 2.0)
[ "Trim", "upper", "values", "in", "accordance", "with", ":", "math", ":", "IC", "\\\\", "leq", "ICMAX", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L20-L34
train
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
SP.trim
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.wc.values = -1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0 >>> stat...
python
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.wc.values = -1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0 >>> stat...
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "whc", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", ".", "whc", "wc", "=", "self", ".", "subseqs", ".", "wc"...
Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.wc.values = -1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0 >>> states.sp(-1., 0., 0., 5., 5., 5., 5.) >>> stat...
[ "Trim", "values", "in", "accordance", "with", ":", "math", ":", "WC", "\\\\", "leq", "WHC", "\\\\", "cdot", "SP", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L42-L62
train
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
WC.trim
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.sp = 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0 >>> states.wc(-1....
python
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.sp = 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0 >>> states.wc(-1....
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "whc", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", ".", "whc", "sp", "=", "self", ".", "subseqs", ".", "sp"...
Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.sp = 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0 >>> states.wc(-1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0) >>> state...
[ "Trim", "values", "in", "accordance", "with", ":", "math", ":", "WC", "\\\\", "leq", "WHC", "\\\\", "cdot", "SP", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L70-L86
train
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
LZ.trim
def trim(self, lower=None, upper=None): """Trim negative value whenever there is no internal lake within the respective subbasin. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(2) >>> zonetype(FIELD, ILAKE) >>> states.lz(-1.0) >...
python
def trim(self, lower=None, upper=None): """Trim negative value whenever there is no internal lake within the respective subbasin. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(2) >>> zonetype(FIELD, ILAKE) >>> states.lz(-1.0) >...
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "if", "upper", "is", "None", ":", "control", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", "if", "not", "any", ...
Trim negative value whenever there is no internal lake within the respective subbasin. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(2) >>> zonetype(FIELD, ILAKE) >>> states.lz(-1.0) >>> states.lz lz(-1.0) >>> zonetype(...
[ "Trim", "negative", "value", "whenever", "there", "is", "no", "internal", "lake", "within", "the", "respective", "subbasin", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L119-L142
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.load_data
def load_data(self, idx): """Call method |InputSequences.load_data| of all handled |InputSequences| objects.""" for subseqs in self: if isinstance(subseqs, abctools.InputSequencesABC): subseqs.load_data(idx)
python
def load_data(self, idx): """Call method |InputSequences.load_data| of all handled |InputSequences| objects.""" for subseqs in self: if isinstance(subseqs, abctools.InputSequencesABC): subseqs.load_data(idx)
[ "def", "load_data", "(", "self", ",", "idx", ")", ":", "for", "subseqs", "in", "self", ":", "if", "isinstance", "(", "subseqs", ",", "abctools", ".", "InputSequencesABC", ")", ":", "subseqs", ".", "load_data", "(", "idx", ")" ]
Call method |InputSequences.load_data| of all handled |InputSequences| objects.
[ "Call", "method", "|InputSequences", ".", "load_data|", "of", "all", "handled", "|InputSequences|", "objects", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L113-L118
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.save_data
def save_data(self, idx): """Call method `save_data|` of all handled |IOSequences| objects registered under |OutputSequencesABC|.""" for subseqs in self: if isinstance(subseqs, abctools.OutputSequencesABC): subseqs.save_data(idx)
python
def save_data(self, idx): """Call method `save_data|` of all handled |IOSequences| objects registered under |OutputSequencesABC|.""" for subseqs in self: if isinstance(subseqs, abctools.OutputSequencesABC): subseqs.save_data(idx)
[ "def", "save_data", "(", "self", ",", "idx", ")", ":", "for", "subseqs", "in", "self", ":", "if", "isinstance", "(", "subseqs", ",", "abctools", ".", "OutputSequencesABC", ")", ":", "subseqs", ".", "save_data", "(", "idx", ")" ]
Call method `save_data|` of all handled |IOSequences| objects registered under |OutputSequencesABC|.
[ "Call", "method", "save_data|", "of", "all", "handled", "|IOSequences|", "objects", "registered", "under", "|OutputSequencesABC|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L120-L125
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.conditions
def conditions(self) -> Dict[str, Dict[str, Union[float, numpy.ndarray]]]: """Nested dictionary containing the values of all condition sequences. See the documentation on property |HydPy.conditions| for further information. """ conditions = {} for subname in NAME...
python
def conditions(self) -> Dict[str, Dict[str, Union[float, numpy.ndarray]]]: """Nested dictionary containing the values of all condition sequences. See the documentation on property |HydPy.conditions| for further information. """ conditions = {} for subname in NAME...
[ "def", "conditions", "(", "self", ")", "->", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "Union", "[", "float", ",", "numpy", ".", "ndarray", "]", "]", "]", ":", "conditions", "=", "{", "}", "for", "subname", "in", "NAMES_CONDITIONSEQUENCES", "...
Nested dictionary containing the values of all condition sequences. See the documentation on property |HydPy.conditions| for further information.
[ "Nested", "dictionary", "containing", "the", "values", "of", "all", "condition", "sequences", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L149-L163
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.load_conditions
def load_conditions(self, filename=None): """Read the initial conditions from a file and assign them to the respective |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object. If no filename or dirname is passed, the ones defined by the |ConditionMa...
python
def load_conditions(self, filename=None): """Read the initial conditions from a file and assign them to the respective |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object. If no filename or dirname is passed, the ones defined by the |ConditionMa...
[ "def", "load_conditions", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "self", ".", "hasconditions", ":", "if", "not", "filename", ":", "filename", "=", "self", ".", "_conditiondefaultfilename", "namespace", "=", "locals", "(", ")", "for", "s...
Read the initial conditions from a file and assign them to the respective |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object. If no filename or dirname is passed, the ones defined by the |ConditionManager| stored in module |pub| are used.
[ "Read", "the", "initial", "conditions", "from", "a", "file", "and", "assign", "them", "to", "the", "respective", "|StateSequence|", "and", "/", "or", "|LogSequence|", "objects", "handled", "by", "the", "actual", "|Sequences|", "object", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L198-L222
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.save_conditions
def save_conditions(self, filename=None): """Query the actual conditions of the |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object and write them into a initial condition file. If no filename or dirname is passed, the ones defined by the |Condi...
python
def save_conditions(self, filename=None): """Query the actual conditions of the |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object and write them into a initial condition file. If no filename or dirname is passed, the ones defined by the |Condi...
[ "def", "save_conditions", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "self", ".", "hasconditions", ":", "if", "filename", "is", "None", ":", "filename", "=", "self", ".", "_conditiondefaultfilename", "con", "=", "hydpy", ".", "pub", ".", ...
Query the actual conditions of the |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object and write them into a initial condition file. If no filename or dirname is passed, the ones defined by the |ConditionManager| stored in module |pub| are used.
[ "Query", "the", "actual", "conditions", "of", "the", "|StateSequence|", "and", "/", "or", "|LogSequence|", "objects", "handled", "by", "the", "actual", "|Sequences|", "object", "and", "write", "them", "into", "a", "initial", "condition", "file", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L224-L242
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.dirpath_int
def dirpath_int(self): """Absolute path of the directory of the internal data file. Normally, each sequence queries its current "internal" directory path from the |SequenceManager| object stored in module |pub|: >>> from hydpy import pub, repr_, TestIO >>> from hydpy.core.filet...
python
def dirpath_int(self): """Absolute path of the directory of the internal data file. Normally, each sequence queries its current "internal" directory path from the |SequenceManager| object stored in module |pub|: >>> from hydpy import pub, repr_, TestIO >>> from hydpy.core.filet...
[ "def", "dirpath_int", "(", "self", ")", ":", "try", ":", "return", "hydpy", ".", "pub", ".", "sequencemanager", ".", "tempdirpath", "except", "RuntimeError", ":", "raise", "RuntimeError", "(", "f'For sequence {objecttools.devicephrase(self)} '", "f'the directory of the ...
Absolute path of the directory of the internal data file. Normally, each sequence queries its current "internal" directory path from the |SequenceManager| object stored in module |pub|: >>> from hydpy import pub, repr_, TestIO >>> from hydpy.core.filetools import SequenceManager ...
[ "Absolute", "path", "of", "the", "directory", "of", "the", "internal", "data", "file", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L677-L738
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.disk2ram
def disk2ram(self): """Move internal data from disk to RAM.""" values = self.series self.deactivate_disk() self.ramflag = True self.__set_array(values) self.update_fastaccess()
python
def disk2ram(self): """Move internal data from disk to RAM.""" values = self.series self.deactivate_disk() self.ramflag = True self.__set_array(values) self.update_fastaccess()
[ "def", "disk2ram", "(", "self", ")", ":", "values", "=", "self", ".", "series", "self", ".", "deactivate_disk", "(", ")", "self", ".", "ramflag", "=", "True", "self", ".", "__set_array", "(", "values", ")", "self", ".", "update_fastaccess", "(", ")" ]
Move internal data from disk to RAM.
[ "Move", "internal", "data", "from", "disk", "to", "RAM", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L856-L862
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.ram2disk
def ram2disk(self): """Move internal data from RAM to disk.""" values = self.series self.deactivate_ram() self.diskflag = True self._save_int(values) self.update_fastaccess()
python
def ram2disk(self): """Move internal data from RAM to disk.""" values = self.series self.deactivate_ram() self.diskflag = True self._save_int(values) self.update_fastaccess()
[ "def", "ram2disk", "(", "self", ")", ":", "values", "=", "self", ".", "series", "self", ".", "deactivate_ram", "(", ")", "self", ".", "diskflag", "=", "True", "self", ".", "_save_int", "(", "values", ")", "self", ".", "update_fastaccess", "(", ")" ]
Move internal data from RAM to disk.
[ "Move", "internal", "data", "from", "RAM", "to", "disk", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L864-L870
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.seriesshape
def seriesshape(self): """Shape of the whole time series (time being the first dimension).""" seriesshape = [len(hydpy.pub.timegrids.init)] seriesshape.extend(self.shape) return tuple(seriesshape)
python
def seriesshape(self): """Shape of the whole time series (time being the first dimension).""" seriesshape = [len(hydpy.pub.timegrids.init)] seriesshape.extend(self.shape) return tuple(seriesshape)
[ "def", "seriesshape", "(", "self", ")", ":", "seriesshape", "=", "[", "len", "(", "hydpy", ".", "pub", ".", "timegrids", ".", "init", ")", "]", "seriesshape", ".", "extend", "(", "self", ".", "shape", ")", "return", "tuple", "(", "seriesshape", ")" ]
Shape of the whole time series (time being the first dimension).
[ "Shape", "of", "the", "whole", "time", "series", "(", "time", "being", "the", "first", "dimension", ")", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L910-L914
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.numericshape
def numericshape(self): """Shape of the array of temporary values required for the numerical solver actually being selected.""" try: numericshape = [self.subseqs.seqs.model.numconsts.nmb_stages] except AttributeError: objecttools.augment_excmessage( ...
python
def numericshape(self): """Shape of the array of temporary values required for the numerical solver actually being selected.""" try: numericshape = [self.subseqs.seqs.model.numconsts.nmb_stages] except AttributeError: objecttools.augment_excmessage( ...
[ "def", "numericshape", "(", "self", ")", ":", "try", ":", "numericshape", "=", "[", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "numconsts", ".", "nmb_stages", "]", "except", "AttributeError", ":", "objecttools", ".", "augment_excmessage", "(", ...
Shape of the array of temporary values required for the numerical solver actually being selected.
[ "Shape", "of", "the", "array", "of", "temporary", "values", "required", "for", "the", "numerical", "solver", "actually", "being", "selected", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L917-L931
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.series
def series(self) -> InfoArray: """Internal time series data within an |numpy.ndarray|.""" if self.diskflag: array = self._load_int() elif self.ramflag: array = self.__get_array() else: raise AttributeError( f'Sequence {objecttools.devic...
python
def series(self) -> InfoArray: """Internal time series data within an |numpy.ndarray|.""" if self.diskflag: array = self._load_int() elif self.ramflag: array = self.__get_array() else: raise AttributeError( f'Sequence {objecttools.devic...
[ "def", "series", "(", "self", ")", "->", "InfoArray", ":", "if", "self", ".", "diskflag", ":", "array", "=", "self", ".", "_load_int", "(", ")", "elif", "self", ".", "ramflag", ":", "array", "=", "self", ".", "__get_array", "(", ")", "else", ":", "...
Internal time series data within an |numpy.ndarray|.
[ "Internal", "time", "series", "data", "within", "an", "|numpy", ".", "ndarray|", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L934-L944
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.load_ext
def load_ext(self): """Read the internal data from an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be loaded. Firstly, ' 'you have...
python
def load_ext(self): """Read the internal data from an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be loaded. Firstly, ' 'you have...
[ "def", "load_ext", "(", "self", ")", ":", "try", ":", "sequencemanager", "=", "hydpy", ".", "pub", ".", "sequencemanager", "except", "AttributeError", ":", "raise", "RuntimeError", "(", "'The time series of sequence %s cannot be loaded. Firstly, '", "'you have to prepare...
Read the internal data from an external data file.
[ "Read", "the", "internal", "data", "from", "an", "external", "data", "file", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L966-L975
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.adjust_short_series
def adjust_short_series(self, timegrid, values): """Adjust a short time series to a longer timegrid. Normally, time series data to be read from a external data files should span (at least) the whole initialization time period of a HydPy project. However, for some variables which are on...
python
def adjust_short_series(self, timegrid, values): """Adjust a short time series to a longer timegrid. Normally, time series data to be read from a external data files should span (at least) the whole initialization time period of a HydPy project. However, for some variables which are on...
[ "def", "adjust_short_series", "(", "self", ",", "timegrid", ",", "values", ")", ":", "idxs", "=", "[", "timegrid", "[", "hydpy", ".", "pub", ".", "timegrids", ".", "init", ".", "firstdate", "]", ",", "timegrid", "[", "hydpy", ".", "pub", ".", "timegrid...
Adjust a short time series to a longer timegrid. Normally, time series data to be read from a external data files should span (at least) the whole initialization time period of a HydPy project. However, for some variables which are only used for comparison (e.g. observed runoff used fo...
[ "Adjust", "a", "short", "time", "series", "to", "a", "longer", "timegrid", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1005-L1088
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.check_completeness
def check_completeness(self): """Raise a |RuntimeError| if the |IOSequence.series| contains at least one |numpy.nan| value, if option |Options.checkseries| is enabled. >>> from hydpy import pub >>> pub.timegrids = '2000-01-01', '2000-01-11', '1d' >>> from hydpy.core.sequ...
python
def check_completeness(self): """Raise a |RuntimeError| if the |IOSequence.series| contains at least one |numpy.nan| value, if option |Options.checkseries| is enabled. >>> from hydpy import pub >>> pub.timegrids = '2000-01-01', '2000-01-11', '1d' >>> from hydpy.core.sequ...
[ "def", "check_completeness", "(", "self", ")", ":", "if", "hydpy", ".", "pub", ".", "options", ".", "checkseries", ":", "isnan", "=", "numpy", ".", "isnan", "(", "self", ".", "series", ")", "if", "numpy", ".", "any", "(", "isnan", ")", ":", "nmb", ...
Raise a |RuntimeError| if the |IOSequence.series| contains at least one |numpy.nan| value, if option |Options.checkseries| is enabled. >>> from hydpy import pub >>> pub.timegrids = '2000-01-01', '2000-01-11', '1d' >>> from hydpy.core.sequencetools import IOSequence >>> c...
[ "Raise", "a", "|RuntimeError|", "if", "the", "|IOSequence", ".", "series|", "contains", "at", "least", "one", "|numpy", ".", "nan|", "value", "if", "option", "|Options", ".", "checkseries|", "is", "enabled", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1090-L1127
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.save_ext
def save_ext(self): """Write the internal data into an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be saved. Firstly,' 'you have ...
python
def save_ext(self): """Write the internal data into an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be saved. Firstly,' 'you have ...
[ "def", "save_ext", "(", "self", ")", ":", "try", ":", "sequencemanager", "=", "hydpy", ".", "pub", ".", "sequencemanager", "except", "AttributeError", ":", "raise", "RuntimeError", "(", "'The time series of sequence %s cannot be saved. Firstly,'", "'you have to prepare `...
Write the internal data into an external data file.
[ "Write", "the", "internal", "data", "into", "an", "external", "data", "file", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1129-L1138
train
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence._load_int
def _load_int(self): """Load internal data from file and return it.""" values = numpy.fromfile(self.filepath_int) if self.NDIM > 0: values = values.reshape(self.seriesshape) return values
python
def _load_int(self): """Load internal data from file and return it.""" values = numpy.fromfile(self.filepath_int) if self.NDIM > 0: values = values.reshape(self.seriesshape) return values
[ "def", "_load_int", "(", "self", ")", ":", "values", "=", "numpy", ".", "fromfile", "(", "self", ".", "filepath_int", ")", "if", "self", ".", "NDIM", ">", "0", ":", "values", "=", "values", ".", "reshape", "(", "self", ".", "seriesshape", ")", "retur...
Load internal data from file and return it.
[ "Load", "internal", "data", "from", "file", "and", "return", "it", "." ]
1bc6a82cf30786521d86b36e27900c6717d3348d
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1148-L1153
train