partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | PyxWriter.iosequence | Special declaration lines for the given |IOSequence| object. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Special",
"declaration",
"lines",
"for",
"the",
"given",
"|IOSequence|",
"object",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L455-L465 | [
"def",
"iosequence",
"(",
"seq",
")",
":",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cdef public bint _%s_diskflag'",
"%",
"seq",
".",
"name",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cdef public str _%s_path'",
"%",
"seq",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.open_files | Open file statements. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Open",
"file",
"statements",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L468-L483 | [
"def",
"open_files",
"(",
"subseqs",
")",
":",
"print",
"(",
"' . open_files'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef open_files(self, int idx):'",
")",
"for",
"seq",
"in",
"subseqs",
":",
"lines",
".",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.close_files | Close file statements. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Close",
"file",
"statements",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L486-L494 | [
"def",
"close_files",
"(",
"subseqs",
")",
":",
"print",
"(",
"' . close_files'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef inline close_files(self):'",
")",
"for",
"seq",
"in",
"subseqs",
":",
"lines",
".",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.load_data | Load data statements. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Load",
"data",
"statements",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L497-L523 | [
"def",
"load_data",
"(",
"subseqs",
")",
":",
"print",
"(",
"' . load_data'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef inline void load_data(self, int idx) %s:'",
"%",
"_nogil",
")",
"lines",
".",
"add",
"(",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.set_pointer | Set_pointer functions for link sequences. | hydpy/cythons/modelutils.py | 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):
"""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:
... | [
"Set_pointer",
"functions",
"for",
"link",
"sequences",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L554-L567 | [
"def",
"set_pointer",
"(",
"self",
",",
"subseqs",
")",
":",
"lines",
"=",
"Lines",
"(",
")",
"for",
"seq",
"in",
"subseqs",
":",
"if",
"seq",
".",
"NDIM",
"==",
"0",
":",
"lines",
".",
"extend",
"(",
"self",
".",
"set_pointer0d",
"(",
"subseqs",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.set_pointer0d | Set_pointer function for 0-dimensional link sequences. | hydpy/cythons/modelutils.py | 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):
"""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:
... | [
"Set_pointer",
"function",
"for",
"0",
"-",
"dimensional",
"link",
"sequences",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L570-L579 | [
"def",
"set_pointer0d",
"(",
"subseqs",
")",
":",
"print",
"(",
"' . set_pointer0d'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef inline set_pointer0d'",
"'(self, str name, pointerutils.PDouble value):'",
")",
"for",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.alloc | Allocate memory for 1-dimensional link sequences. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Allocate",
"memory",
"for",
"1",
"-",
"dimensional",
"link",
"sequences",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L582-L592 | [
"def",
"alloc",
"(",
"subseqs",
")",
":",
"print",
"(",
"' . setlength'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef inline alloc(self, name, int length):'",
")",
"for",
"seq",
"in",
"subseqs",
":",
"lines",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.dealloc | Deallocate memory for 1-dimensional link sequences. | hydpy/cythons/modelutils.py | 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):
"""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 | [
"Deallocate",
"memory",
"for",
"1",
"-",
"dimensional",
"link",
"sequences",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L595-L602 | [
"def",
"dealloc",
"(",
"subseqs",
")",
":",
"print",
"(",
"' . dealloc'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef inline dealloc(self):'",
")",
"for",
"seq",
"in",
"subseqs",
":",
"lines",
".",
"add",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.set_pointer1d | Set_pointer function for 1-dimensional link sequences. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Set_pointer",
"function",
"for",
"1",
"-",
"dimensional",
"link",
"sequences",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L605-L614 | [
"def",
"set_pointer1d",
"(",
"subseqs",
")",
":",
"print",
"(",
"' . set_pointer1d'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef inline set_pointer1d'",
"'(self, str name, pointerutils.PDouble value, int idx):'",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.numericalparameters | Numeric parameter declaration lines. | hydpy/cythons/modelutils.py | 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):
"""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(... | [
"Numeric",
"parameter",
"declaration",
"lines",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L617-L636 | [
"def",
"numericalparameters",
"(",
"self",
")",
":",
"lines",
"=",
"Lines",
"(",
")",
"if",
"self",
".",
"model",
".",
"NUMERICAL",
":",
"lines",
".",
"add",
"(",
"0",
",",
"'@cython.final'",
")",
"lines",
".",
"add",
"(",
"0",
",",
"'cdef class NumCon... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.modeldeclarations | Attribute declarations of the model class. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Attribute",
"declarations",
"of",
"the",
"model",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L639-L651 | [
"def",
"modeldeclarations",
"(",
"self",
")",
":",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"0",
",",
"'@cython.final'",
")",
"lines",
".",
"add",
"(",
"0",
",",
"'cdef class Model(object):'",
")",
"lines",
".",
"add",
"(",
"1",
",",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.modelstandardfunctions | Standard functions of the model class. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Standard",
"functions",
"of",
"the",
"model",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L654-L665 | [
"def",
"modelstandardfunctions",
"(",
"self",
")",
":",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"extend",
"(",
"self",
".",
"doit",
")",
"lines",
".",
"extend",
"(",
"self",
".",
"iofunctions",
")",
"lines",
".",
"extend",
"(",
"self",
".",
"n... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.modelnumericfunctions | Numerical functions of the model class. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Numerical",
"functions",
"of",
"the",
"model",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L668-L685 | [
"def",
"modelnumericfunctions",
"(",
"self",
")",
":",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"extend",
"(",
"self",
".",
"solve",
")",
"lines",
".",
"extend",
"(",
"self",
".",
"calculate_single_terms",
")",
"lines",
".",
"extend",
"(",
"self",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.doit | Do (most of) it function of the model class. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Do",
"(",
"most",
"of",
")",
"it",
"function",
"of",
"the",
"model",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L688-L706 | [
"def",
"doit",
"(",
"self",
")",
":",
"print",
"(",
"' . doit'",
")",
"lines",
"=",
"Lines",
"(",
")",
"lines",
".",
"add",
"(",
"1",
",",
"'cpdef inline void doit(self, int idx) %s:'",
"%",
"_nogil",
")",
"lines",
".",
"add",
"(",
"2",
",",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.iofunctions | Input/output functions of the model class. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"Input",
"/",
"output",
"functions",
"of",
"the",
"model",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L709-L739 | [
"def",
"iofunctions",
"(",
"self",
")",
":",
"lines",
"=",
"Lines",
"(",
")",
"for",
"func",
"in",
"(",
"'open_files'",
",",
"'close_files'",
",",
"'load_data'",
",",
"'save_data'",
")",
":",
"if",
"(",
"(",
"func",
"==",
"'load_data'",
")",
"and",
"("... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.calculate_single_terms | Lines of model method with the same name. | hydpy/cythons/modelutils.py | 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 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 ='
... | [
"Lines",
"of",
"model",
"method",
"with",
"the",
"same",
"name",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L818-L825 | [
"def",
"calculate_single_terms",
"(",
"self",
")",
":",
"lines",
"=",
"self",
".",
"_call_methods",
"(",
"'calculate_single_terms'",
",",
"self",
".",
"model",
".",
"PART_ODE_METHODS",
")",
"if",
"lines",
":",
"lines",
".",
"insert",
"(",
"1",
",",
"(",
"'... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | PyxWriter.listofmodeluserfunctions | User functions of the model class. | hydpy/cythons/modelutils.py | 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):
"""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... | [
"User",
"functions",
"of",
"the",
"model",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L834-L849 | [
"def",
"listofmodeluserfunctions",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"]",
"for",
"(",
"name",
",",
"member",
")",
"in",
"vars",
"(",
"self",
".",
"model",
".",
"__class__",
")",
".",
"items",
"(",
")",
":",
"if",
"(",
"inspect",
".",
"isfun... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FuncConverter.cleanlines | 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... | hydpy/cythons/modelutils.py | 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):
"""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
... | [
"Cleaned",
"code",
"lines",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1142-L1168 | [
"def",
"cleanlines",
"(",
"self",
")",
":",
"code",
"=",
"inspect",
".",
"getsource",
"(",
"self",
".",
"func",
")",
"code",
"=",
"'\\n'",
".",
"join",
"(",
"code",
".",
"split",
"(",
"'\"\"\"'",
")",
"[",
":",
":",
"2",
"]",
")",
"code",
"=",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FuncConverter.remove_linebreaks_within_equations | 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)' | hydpy/cythons/modelutils.py | 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):
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... | [
"r",
"Remove",
"line",
"breaks",
"within",
"equations",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1171-L1191 | [
"def",
"remove_linebreaks_within_equations",
"(",
"code",
")",
":",
"code",
"=",
"code",
".",
"replace",
"(",
"'\\\\\\n'",
",",
"''",
")",
"chars",
"=",
"[",
"]",
"counter",
"=",
"0",
"for",
"char",
"in",
"code",
":",
"if",
"char",
"in",
"(",
"'('",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FuncConverter.remove_imath_operators | 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... | hydpy/cythons/modelutils.py | 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):
"""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
... | [
"Remove",
"mathematical",
"expressions",
"that",
"require",
"Pythons",
"global",
"interpreter",
"locking",
"mechanism",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1194-L1215 | [
"def",
"remove_imath_operators",
"(",
"lines",
")",
":",
"for",
"idx",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"for",
"operator",
"in",
"(",
"'+='",
",",
"'-='",
",",
"'**='",
",",
"'*='",
",",
"'//='",
",",
"'/='",
",",
"'%='",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FuncConverter.pyxlines | 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... | hydpy/cythons/modelutils.py | 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):
"""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`
... | [
"Cython",
"code",
"lines",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1218-L1240 | [
"def",
"pyxlines",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"' '",
"+",
"line",
"for",
"line",
"in",
"self",
".",
"cleanlines",
"]",
"lines",
"[",
"0",
"]",
"=",
"lines",
"[",
"0",
"]",
".",
"replace",
"(",
"'def '",
",",
"'cpdef inline void '",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | calc_smoothpar_logistic2 | 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)
... | hydpy/auxs/smoothtools.py | 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):
"""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
... | [
"Return",
"the",
"smoothing",
"parameter",
"corresponding",
"to",
"the",
"given",
"meta",
"parameter",
"when",
"using",
"|smooth_logistic2|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/smoothtools.py#L78-L114 | [
"def",
"calc_smoothpar_logistic2",
"(",
"metapar",
")",
":",
"if",
"metapar",
"<=",
"0.",
":",
"return",
"0.",
"return",
"optimize",
".",
"newton",
"(",
"_error_smoothpar_logistic2",
",",
".3",
"*",
"metapar",
"**",
".84",
",",
"_smooth_logistic2_derivative",
",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Date.from_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, 10, 8, 15, 15, 42, 999])
>>> ... | hydpy/core/timetools.py | 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):
"""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... | [
"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|",
"."... | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L256-L281 | [
"def",
"from_array",
"(",
"cls",
",",
"array",
")",
":",
"intarray",
"=",
"numpy",
".",
"array",
"(",
"array",
",",
"dtype",
"=",
"int",
")",
"for",
"dummy",
"in",
"range",
"(",
"1",
",",
"array",
".",
"ndim",
")",
":",
"intarray",
"=",
"intarray",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Date.to_array | 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::
... | hydpy/core/timetools.py | 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 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.])... | [
"Return",
"a",
"1",
"-",
"dimensional",
"|numpy|",
"|numpy",
".",
"ndarray|",
"with",
"six",
"entries",
"defining",
"the",
"actual",
"date",
"(",
"year",
"month",
"day",
"hour",
"minute",
"second",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L283-L298 | [
"def",
"to_array",
"(",
"self",
")",
":",
"return",
"numpy",
".",
"array",
"(",
"[",
"self",
".",
"year",
",",
"self",
".",
"month",
",",
"self",
".",
"day",
",",
"self",
".",
"hour",
",",
"self",
".",
"minute",
",",
"self",
".",
"second",
"]",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Date.from_cfunits | 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... | hydpy/core/timetools.py | 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':
"""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... | [
"Return",
"a",
"|Date|",
"object",
"representing",
"the",
"reference",
"date",
"of",
"the",
"given",
"units",
"string",
"agreeing",
"with",
"the",
"NetCDF",
"-",
"CF",
"conventions",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L301-L361 | [
"def",
"from_cfunits",
"(",
"cls",
",",
"units",
")",
"->",
"'Date'",
":",
"try",
":",
"string",
"=",
"units",
"[",
"units",
".",
"find",
"(",
"'since'",
")",
"+",
"6",
":",
"]",
"idx",
"=",
"string",
".",
"find",
"(",
"'.'",
")",
"if",
"idx",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Date.to_cfunits | 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... | hydpy/core/timetools.py | 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):
"""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
... | [
"Return",
"a",
"units",
"string",
"agreeing",
"with",
"the",
"NetCDF",
"-",
"CF",
"conventions",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L363-L389 | [
"def",
"to_cfunits",
"(",
"self",
",",
"unit",
"=",
"'hours'",
",",
"utcoffset",
"=",
"None",
")",
":",
"if",
"utcoffset",
"is",
"None",
":",
"utcoffset",
"=",
"hydpy",
".",
"pub",
".",
"options",
".",
"utcoffset",
"string",
"=",
"self",
".",
"to_strin... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Date._set_thing | Convenience method for `_set_year`, `_set_month`... | hydpy/core/timetools.py | 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):
"""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... | [
"Convenience",
"method",
"for",
"_set_year",
"_set_month",
"..."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L455-L468 | [
"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... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Date.wateryear | 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
... | hydpy/core/timetools.py | 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):
"""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
... | [
"The",
"actual",
"hydrological",
"year",
"according",
"to",
"the",
"selected",
"reference",
"month",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L582-L610 | [
"def",
"wateryear",
"(",
"self",
")",
":",
"if",
"self",
".",
"month",
"<",
"self",
".",
"_firstmonth_wateryear",
":",
"return",
"self",
".",
"year",
"return",
"self",
".",
"year",
"+",
"1"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Date.to_string | 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
... | hydpy/core/timetools.py | 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):
"""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... | [
"Return",
"a",
"|str|",
"object",
"representing",
"the",
"actual",
"date",
"in",
"accordance",
"with",
"the",
"given",
"style",
"and",
"the",
"eventually",
"given",
"UTC",
"offset",
"(",
"in",
"minutes",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L686-L734 | [
"def",
"to_string",
"(",
"self",
",",
"style",
"=",
"None",
",",
"utcoffset",
"=",
"None",
")",
":",
"if",
"not",
"style",
":",
"style",
"=",
"self",
".",
"style",
"if",
"utcoffset",
"is",
"None",
":",
"string",
"=",
"''",
"date",
"=",
"self",
".",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Period.fromseconds | Return a |Period| instance based on a given number of seconds. | hydpy/core/timetools.py | 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):
"""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))) | [
"Return",
"a",
"|Period|",
"instance",
"based",
"on",
"a",
"given",
"number",
"of",
"seconds",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L945-L951 | [
"def",
"fromseconds",
"(",
"cls",
",",
"seconds",
")",
":",
"try",
":",
"seconds",
"=",
"int",
"(",
"seconds",
")",
"except",
"TypeError",
":",
"seconds",
"=",
"int",
"(",
"seconds",
".",
"flatten",
"(",
")",
"[",
"0",
"]",
")",
"return",
"cls",
"(... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Period._guessunit | Guess the unit of the period as the largest one, which results in
an integer duration. | hydpy/core/timetools.py | 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):
"""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 ... | [
"Guess",
"the",
"unit",
"of",
"the",
"period",
"as",
"the",
"largest",
"one",
"which",
"results",
"in",
"an",
"integer",
"duration",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L972-L987 | [
"def",
"_guessunit",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"days",
"%",
"1",
":",
"return",
"'d'",
"elif",
"not",
"self",
".",
"hours",
"%",
"1",
":",
"return",
"'h'",
"elif",
"not",
"self",
".",
"minutes",
"%",
"1",
":",
"return",
"'m... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrid.from_array | Returns a |Timegrid| instance based on two date and one period
information stored in the first 13 rows of a |numpy.ndarray| object. | hydpy/core/timetools.py | 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):
"""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]),
... | [
"Returns",
"a",
"|Timegrid|",
"instance",
"based",
"on",
"two",
"date",
"and",
"one",
"period",
"information",
"stored",
"in",
"the",
"first",
"13",
"rows",
"of",
"a",
"|numpy",
".",
"ndarray|",
"object",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1285-L1297 | [
"def",
"from_array",
"(",
"cls",
",",
"array",
")",
":",
"try",
":",
"return",
"cls",
"(",
"Date",
".",
"from_array",
"(",
"array",
"[",
":",
"6",
"]",
")",
",",
"Date",
".",
"from_array",
"(",
"array",
"[",
"6",
":",
"12",
"]",
")",
",",
"Peri... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrid.to_array | 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. | hydpy/core/timetools.py | 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):
"""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(... | [
"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",
... | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1299-L1308 | [
"def",
"to_array",
"(",
"self",
")",
":",
"values",
"=",
"numpy",
".",
"empty",
"(",
"13",
",",
"dtype",
"=",
"float",
")",
"values",
"[",
":",
"6",
"]",
"=",
"self",
".",
"firstdate",
".",
"to_array",
"(",
")",
"values",
"[",
"6",
":",
"12",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrid.from_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... | hydpy/core/timetools.py | 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'):
"""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... | [
"Return",
"a",
"|Timegrid|",
"object",
"representing",
"the",
"given",
"starting",
"timepoints",
"in",
"relation",
"to",
"the",
"given",
"refdate",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1311-L1354 | [
"def",
"from_timepoints",
"(",
"cls",
",",
"timepoints",
",",
"refdate",
",",
"unit",
"=",
"'hours'",
")",
":",
"refdate",
"=",
"Date",
"(",
"refdate",
")",
"unit",
"=",
"Period",
".",
"from_cfunits",
"(",
"unit",
")",
"delta",
"=",
"timepoints",
"[",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrid.to_timepoints | 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... | hydpy/core/timetools.py | 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):
"""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... | [
"Return",
"an",
"|numpy",
".",
"ndarray|",
"representing",
"the",
"starting",
"time",
"points",
"of",
"the",
"|Timegrid|",
"object",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1356-L1397 | [
"def",
"to_timepoints",
"(",
"self",
",",
"unit",
"=",
"'hours'",
",",
"offset",
"=",
"None",
")",
":",
"unit",
"=",
"Period",
".",
"from_cfunits",
"(",
"unit",
")",
"if",
"offset",
"is",
"None",
":",
"offset",
"=",
"0.",
"else",
":",
"try",
":",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrid.array2series | 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
... | hydpy/core/timetools.py | 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):
"""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... | [
"Prefix",
"the",
"information",
"of",
"the",
"actual",
"Timegrid",
"object",
"to",
"the",
"given",
"array",
"and",
"return",
"it",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1399-L1496 | [
"def",
"array2series",
"(",
"self",
",",
"array",
")",
":",
"try",
":",
"array",
"=",
"numpy",
".",
"array",
"(",
"array",
",",
"dtype",
"=",
"float",
")",
"except",
"BaseException",
":",
"objecttools",
".",
"augment_excmessage",
"(",
"'While trying to prefi... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrid.verify | Raise an |ValueError| if the dates or the step size of the time
frame are inconsistent. | hydpy/core/timetools.py | 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):
"""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... | [
"Raise",
"an",
"|ValueError|",
"if",
"the",
"dates",
"or",
"the",
"step",
"size",
"of",
"the",
"time",
"frame",
"are",
"inconsistent",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1498-L1510 | [
"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... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrid.assignrepr | 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',
... ... | hydpy/core/timetools.py | 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):
"""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',
... ... | [
"Return",
"a",
"|repr|",
"string",
"with",
"an",
"prefixed",
"assignement",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1562-L1591 | [
"def",
"assignrepr",
"(",
"self",
",",
"prefix",
",",
"style",
"=",
"None",
",",
"utcoffset",
"=",
"None",
")",
":",
"skip",
"=",
"len",
"(",
"prefix",
")",
"+",
"9",
"blanks",
"=",
"' '",
"*",
"skip",
"return",
"(",
"f\"{prefix}Timegrid('\"",
"f\"{sel... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrids.verify | Raise an |ValueError| it the different time grids are
inconsistent. | hydpy/core/timetools.py | 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):
"""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 '
... | [
"Raise",
"an",
"|ValueError|",
"it",
"the",
"different",
"time",
"grids",
"are",
"inconsistent",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1786-L1814 | [
"def",
"verify",
"(",
"self",
")",
":",
"self",
".",
"init",
".",
"verify",
"(",
")",
"self",
".",
"sim",
".",
"verify",
"(",
")",
"if",
"self",
".",
"init",
".",
"firstdate",
">",
"self",
".",
"sim",
".",
"firstdate",
":",
"raise",
"ValueError",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Timegrids.assignrepr | Return a |repr| string with a prefixed assignment. | hydpy/core/timetools.py | 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):
"""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... | [
"Return",
"a",
"|repr|",
"string",
"with",
"a",
"prefixed",
"assignment",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L1847-L1856 | [
"def",
"assignrepr",
"(",
"self",
",",
"prefix",
")",
":",
"caller",
"=",
"'Timegrids('",
"blanks",
"=",
"' '",
"*",
"(",
"len",
"(",
"prefix",
")",
"+",
"len",
"(",
"caller",
")",
")",
"prefix",
"=",
"f'{prefix}{caller}'",
"lines",
"=",
"[",
"f'{self.... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | TOY.seconds_passed | 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 ... | hydpy/core/timetools.py | 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):
"""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 ... | [
"Amount",
"of",
"time",
"passed",
"in",
"seconds",
"since",
"the",
"beginning",
"of",
"the",
"year",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L2080-L2096 | [
"def",
"seconds_passed",
"(",
"self",
")",
":",
"return",
"int",
"(",
"(",
"Date",
"(",
"self",
")",
".",
"datetime",
"-",
"self",
".",
"_STARTDATE",
".",
"datetime",
")",
".",
"total_seconds",
"(",
")",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | TOY.seconds_left | 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:... | hydpy/core/timetools.py | 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):
"""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... | [
"Remaining",
"part",
"of",
"the",
"year",
"in",
"seconds",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L2099-L2115 | [
"def",
"seconds_left",
"(",
"self",
")",
":",
"return",
"int",
"(",
"(",
"self",
".",
"_ENDDATE",
".",
"datetime",
"-",
"Date",
"(",
"self",
")",
".",
"datetime",
")",
".",
"total_seconds",
"(",
")",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | TOY.centred_timegrid | 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') | hydpy/core/timetools.py | 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):
"""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... | [
"Return",
"a",
"|Timegrid|",
"object",
"defining",
"the",
"central",
"time",
"points",
"of",
"the",
"year",
"2000",
"for",
"the",
"given",
"simulation",
"step",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/timetools.py#L2118-L2132 | [
"def",
"centred_timegrid",
"(",
"cls",
",",
"simulationstep",
")",
":",
"simulationstep",
"=",
"Period",
"(",
"simulationstep",
")",
"return",
"Timegrid",
"(",
"cls",
".",
"_STARTDATE",
"+",
"simulationstep",
"/",
"2",
",",
"cls",
".",
"_ENDDATE",
"+",
"simu... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | dir_ | 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
>>>... | hydpy/core/objecttools.py | 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):
"""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... | [
"The",
"prefered",
"way",
"for",
"HydPy",
"objects",
"to",
"respond",
"to",
"|dir|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L20-L59 | [
"def",
"dir_",
"(",
"self",
")",
":",
"names",
"=",
"set",
"(",
")",
"for",
"thing",
"in",
"list",
"(",
"inspect",
".",
"getmro",
"(",
"type",
"(",
"self",
")",
")",
")",
"+",
"[",
"self",
"]",
":",
"for",
"key",
"in",
"vars",
"(",
"thing",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | classname | 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 | hydpy/core/objecttools.py | 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):
"""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 = ... | [
"Return",
"the",
"class",
"name",
"of",
"the",
"given",
"instance",
"object",
"or",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L62-L80 | [
"def",
"classname",
"(",
"self",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"self",
")",
":",
"string",
"=",
"str",
"(",
"self",
")",
"else",
":",
"string",
"=",
"str",
"(",
"type",
"(",
"self",
")",
")",
"try",
":",
"string",
"=",
"string",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | name | 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):
... ... | hydpy/core/objecttools.py | 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):
"""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 ... | [
"Name",
"of",
"the",
"class",
"of",
"the",
"given",
"instance",
"in",
"lower",
"case",
"letters",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L109-L137 | [
"def",
"name",
"(",
"self",
")",
":",
"cls",
"=",
"type",
"(",
"self",
")",
"try",
":",
"return",
"cls",
".",
"__dict__",
"[",
"'_name'",
"]",
"except",
"KeyError",
":",
"setattr",
"(",
"cls",
",",
"'_name'",
",",
"instancename",
"(",
"self",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | valid_variable_identifier | 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:
... | hydpy/core/objecttools.py | 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):
"""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... | [
"Raises",
"an",
"|ValueError|",
"if",
"the",
"given",
"name",
"is",
"not",
"a",
"valid",
"Python",
"identifier",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L272-L309 | [
"def",
"valid_variable_identifier",
"(",
"string",
")",
":",
"string",
"=",
"str",
"(",
"string",
")",
"try",
":",
"exec",
"(",
"'%s = None'",
"%",
"string",
")",
"if",
"string",
"in",
"dir",
"(",
"builtins",
")",
":",
"raise",
"SyntaxError",
"(",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | augment_excmessage | 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... | hydpy/core/objecttools.py | 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:
"""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... | [
"Augment",
"an",
"exception",
"message",
"with",
"additional",
"information",
"while",
"keeping",
"the",
"original",
"traceback",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L312-L366 | [
"def",
"augment_excmessage",
"(",
"prefix",
"=",
"None",
",",
"suffix",
"=",
"None",
")",
"->",
"NoReturn",
":",
"exc_old",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"message",
"=",
"str",
"(",
"exc_old",
")",
"if",
"prefix",
"is",
"not",... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | excmessage_decorator | 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 ... | hydpy/core/objecttools.py | 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:
"""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:... | [
"Wrap",
"a",
"function",
"with",
"|augment_excmessage|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L369-L494 | [
"def",
"excmessage_decorator",
"(",
"description",
")",
"->",
"Callable",
":",
"@",
"wrapt",
".",
"decorator",
"def",
"wrapper",
"(",
"wrapped",
",",
"instance",
",",
"args",
",",
"kwargs",
")",
":",
"\"\"\"Apply |augment_excmessage| when the wrapped function fails.\"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | print_values | 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... | hydpy/core/objecttools.py | 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):
"""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,
... | [
"Print",
"the",
"given",
"values",
"in",
"multiple",
"lines",
"with",
"a",
"certain",
"maximum",
"width",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L801-L820 | [
"def",
"print_values",
"(",
"values",
",",
"width",
"=",
"70",
")",
":",
"for",
"line",
"in",
"textwrap",
".",
"wrap",
"(",
"repr_values",
"(",
"values",
")",
",",
"width",
"=",
"width",
")",
":",
"print",
"(",
"line",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | assignrepr_values | 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... | hydpy/core/objecttools.py | 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):
"""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... | [
"Return",
"a",
"prefixed",
"wrapped",
"and",
"properly",
"aligned",
"string",
"representation",
"of",
"the",
"given",
"values",
"using",
"function",
"|repr|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L871-L930 | [
"def",
"assignrepr_values",
"(",
"values",
",",
"prefix",
",",
"width",
"=",
"None",
",",
"_fakeend",
"=",
"0",
")",
":",
"ellipsis_",
"=",
"hydpy",
".",
"pub",
".",
"options",
".",
"ellipsis",
"if",
"(",
"ellipsis_",
">",
"0",
")",
"and",
"(",
"len"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | assignrepr_values2 | 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.... | hydpy/core/objecttools.py | 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):
"""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(') + ')'... | [
"Return",
"a",
"prefixed",
"and",
"properly",
"aligned",
"string",
"representation",
"of",
"the",
"given",
"2",
"-",
"dimensional",
"value",
"matrix",
"using",
"function",
"|repr|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1050-L1074 | [
"def",
"assignrepr_values2",
"(",
"values",
",",
"prefix",
")",
":",
"lines",
"=",
"[",
"]",
"blanks",
"=",
"' '",
"*",
"len",
"(",
"prefix",
")",
"for",
"(",
"idx",
",",
"subvalues",
")",
"in",
"enumerate",
"(",
"values",
")",
":",
"if",
"idx",
"=... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | _assignrepr_bracketed2 | Return a prefixed, wrapped and properly aligned bracketed string
representation of the given 2-dimensional value matrix using function
|repr|. | hydpy/core/objecttools.py | 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):
"""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... | [
"Return",
"a",
"prefixed",
"wrapped",
"and",
"properly",
"aligned",
"bracketed",
"string",
"representation",
"of",
"the",
"given",
"2",
"-",
"dimensional",
"value",
"matrix",
"using",
"function",
"|repr|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1077-L1094 | [
"def",
"_assignrepr_bracketed2",
"(",
"assignrepr_bracketed1",
",",
"values",
",",
"prefix",
",",
"width",
"=",
"None",
")",
":",
"brackets",
"=",
"getattr",
"(",
"assignrepr_bracketed1",
",",
"'_brackets'",
")",
"prefix",
"+=",
"brackets",
"[",
"0",
"]",
"lin... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | round_ | 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 ... | hydpy/core/objecttools.py | 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):
"""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... | [
"Prints",
"values",
"with",
"a",
"maximum",
"number",
"of",
"digits",
"in",
"doctests",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1324-L1375 | [
"def",
"round_",
"(",
"values",
",",
"decimals",
"=",
"None",
",",
"width",
"=",
"0",
",",
"lfill",
"=",
"None",
",",
"rfill",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"decimals",
"is",
"None",
":",
"decimals",
"=",
"hydpy",
".",
"pu... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | extract | 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... | hydpy/core/objecttools.py | 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):
"""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... | [
"Return",
"a",
"generator",
"that",
"extracts",
"certain",
"objects",
"from",
"values",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1378-L1428 | [
"def",
"extract",
"(",
"values",
",",
"types",
",",
"skip",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"values",
",",
"types",
")",
":",
"yield",
"values",
"elif",
"skip",
"and",
"(",
"values",
"is",
"None",
")",
":",
"return",
"else",
":",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | enumeration | 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... | hydpy/core/objecttools.py | 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=''):
"""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 []'
... | [
"Return",
"an",
"enumeration",
"string",
"based",
"on",
"the",
"given",
"values",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1431-L1468 | [
"def",
"enumeration",
"(",
"values",
",",
"converter",
"=",
"str",
",",
"default",
"=",
"''",
")",
":",
"values",
"=",
"tuple",
"(",
"converter",
"(",
"value",
")",
"for",
"value",
"in",
"values",
")",
"if",
"not",
"values",
":",
"return",
"default",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Ic.trim | 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) | hydpy/models/hland/hland_states.py | 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):
"""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.... | [
"Trim",
"upper",
"values",
"in",
"accordance",
"with",
":",
"math",
":",
"IC",
"\\\\",
"leq",
"ICMAX",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L20-L34 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"upper",
"is",
"None",
":",
"control",
"=",
"self",
".",
"subseqs",
".",
"seqs",
".",
"model",
".",
"parameters",
".",
"control",
"upper",
"=",
"contr... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | SP.trim | 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... | hydpy/models/hland/hland_states.py | 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):
"""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... | [
"Trim",
"values",
"in",
"accordance",
"with",
":",
"math",
":",
"WC",
"\\\\",
"leq",
"WHC",
"\\\\",
"cdot",
"SP",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L42-L62 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"whc",
"=",
"self",
".",
"subseqs",
".",
"seqs",
".",
"model",
".",
"parameters",
".",
"control",
".",
"whc",
"wc",
"=",
"self",
".",
"subseqs",
".",
"wc"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | WC.trim | 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... | hydpy/models/hland/hland_states.py | 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):
"""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.... | [
"Trim",
"values",
"in",
"accordance",
"with",
":",
"math",
":",
"WC",
"\\\\",
"leq",
"WHC",
"\\\\",
"cdot",
"SP",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L70-L86 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"whc",
"=",
"self",
".",
"subseqs",
".",
"seqs",
".",
"model",
".",
"parameters",
".",
"control",
".",
"whc",
"sp",
"=",
"self",
".",
"subseqs",
".",
"sp"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | LZ.trim | 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(... | hydpy/models/hland/hland_states.py | 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):
"""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)
>... | [
"Trim",
"negative",
"value",
"whenever",
"there",
"is",
"no",
"internal",
"lake",
"within",
"the",
"respective",
"subbasin",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L119-L142 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"upper",
"is",
"None",
":",
"control",
"=",
"self",
".",
"subseqs",
".",
"seqs",
".",
"model",
".",
"parameters",
".",
"control",
"if",
"not",
"any",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Sequences.load_data | Call method |InputSequences.load_data| of all handled
|InputSequences| objects. | hydpy/core/sequencetools.py | 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):
"""Call method |InputSequences.load_data| of all handled
|InputSequences| objects."""
for subseqs in self:
if isinstance(subseqs, abctools.InputSequencesABC):
subseqs.load_data(idx) | [
"Call",
"method",
"|InputSequences",
".",
"load_data|",
"of",
"all",
"handled",
"|InputSequences|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L113-L118 | [
"def",
"load_data",
"(",
"self",
",",
"idx",
")",
":",
"for",
"subseqs",
"in",
"self",
":",
"if",
"isinstance",
"(",
"subseqs",
",",
"abctools",
".",
"InputSequencesABC",
")",
":",
"subseqs",
".",
"load_data",
"(",
"idx",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Sequences.save_data | Call method `save_data|` of all handled |IOSequences|
objects registered under |OutputSequencesABC|. | hydpy/core/sequencetools.py | 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):
"""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) | [
"Call",
"method",
"save_data|",
"of",
"all",
"handled",
"|IOSequences|",
"objects",
"registered",
"under",
"|OutputSequencesABC|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L120-L125 | [
"def",
"save_data",
"(",
"self",
",",
"idx",
")",
":",
"for",
"subseqs",
"in",
"self",
":",
"if",
"isinstance",
"(",
"subseqs",
",",
"abctools",
".",
"OutputSequencesABC",
")",
":",
"subseqs",
".",
"save_data",
"(",
"idx",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Sequences.conditions | Nested dictionary containing the values of all condition
sequences.
See the documentation on property |HydPy.conditions| for further
information. | hydpy/core/sequencetools.py | 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]]]:
"""Nested dictionary containing the values of all condition
sequences.
See the documentation on property |HydPy.conditions| for further
information.
"""
conditions = {}
for subname in NAME... | [
"Nested",
"dictionary",
"containing",
"the",
"values",
"of",
"all",
"condition",
"sequences",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L149-L163 | [
"def",
"conditions",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"Union",
"[",
"float",
",",
"numpy",
".",
"ndarray",
"]",
"]",
"]",
":",
"conditions",
"=",
"{",
"}",
"for",
"subname",
"in",
"NAMES_CONDITIONSEQUENCES",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Sequences.load_conditions | 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. | hydpy/core/sequencetools.py | 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):
"""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... | [
"Read",
"the",
"initial",
"conditions",
"from",
"a",
"file",
"and",
"assign",
"them",
"to",
"the",
"respective",
"|StateSequence|",
"and",
"/",
"or",
"|LogSequence|",
"objects",
"handled",
"by",
"the",
"actual",
"|Sequences|",
"object",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L198-L222 | [
"def",
"load_conditions",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"self",
".",
"hasconditions",
":",
"if",
"not",
"filename",
":",
"filename",
"=",
"self",
".",
"_conditiondefaultfilename",
"namespace",
"=",
"locals",
"(",
")",
"for",
"s... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Sequences.save_conditions | 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. | hydpy/core/sequencetools.py | 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):
"""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... | [
"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",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L224-L242 | [
"def",
"save_conditions",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"self",
".",
"hasconditions",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"self",
".",
"_conditiondefaultfilename",
"con",
"=",
"hydpy",
".",
"pub",
".",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.dirpath_int | 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
... | hydpy/core/sequencetools.py | 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):
"""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... | [
"Absolute",
"path",
"of",
"the",
"directory",
"of",
"the",
"internal",
"data",
"file",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L677-L738 | [
"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 ... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.disk2ram | Move internal data from disk to RAM. | hydpy/core/sequencetools.py | 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):
"""Move internal data from disk to RAM."""
values = self.series
self.deactivate_disk()
self.ramflag = True
self.__set_array(values)
self.update_fastaccess() | [
"Move",
"internal",
"data",
"from",
"disk",
"to",
"RAM",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L856-L862 | [
"def",
"disk2ram",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"series",
"self",
".",
"deactivate_disk",
"(",
")",
"self",
".",
"ramflag",
"=",
"True",
"self",
".",
"__set_array",
"(",
"values",
")",
"self",
".",
"update_fastaccess",
"(",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.ram2disk | Move internal data from RAM to disk. | hydpy/core/sequencetools.py | 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):
"""Move internal data from RAM to disk."""
values = self.series
self.deactivate_ram()
self.diskflag = True
self._save_int(values)
self.update_fastaccess() | [
"Move",
"internal",
"data",
"from",
"RAM",
"to",
"disk",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L864-L870 | [
"def",
"ram2disk",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"series",
"self",
".",
"deactivate_ram",
"(",
")",
"self",
".",
"diskflag",
"=",
"True",
"self",
".",
"_save_int",
"(",
"values",
")",
"self",
".",
"update_fastaccess",
"(",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.seriesshape | Shape of the whole time series (time being the first dimension). | hydpy/core/sequencetools.py | 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):
"""Shape of the whole time series (time being the first dimension)."""
seriesshape = [len(hydpy.pub.timegrids.init)]
seriesshape.extend(self.shape)
return tuple(seriesshape) | [
"Shape",
"of",
"the",
"whole",
"time",
"series",
"(",
"time",
"being",
"the",
"first",
"dimension",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L910-L914 | [
"def",
"seriesshape",
"(",
"self",
")",
":",
"seriesshape",
"=",
"[",
"len",
"(",
"hydpy",
".",
"pub",
".",
"timegrids",
".",
"init",
")",
"]",
"seriesshape",
".",
"extend",
"(",
"self",
".",
"shape",
")",
"return",
"tuple",
"(",
"seriesshape",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.numericshape | Shape of the array of temporary values required for the numerical
solver actually being selected. | hydpy/core/sequencetools.py | 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):
"""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(
... | [
"Shape",
"of",
"the",
"array",
"of",
"temporary",
"values",
"required",
"for",
"the",
"numerical",
"solver",
"actually",
"being",
"selected",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L917-L931 | [
"def",
"numericshape",
"(",
"self",
")",
":",
"try",
":",
"numericshape",
"=",
"[",
"self",
".",
"subseqs",
".",
"seqs",
".",
"model",
".",
"numconsts",
".",
"nmb_stages",
"]",
"except",
"AttributeError",
":",
"objecttools",
".",
"augment_excmessage",
"(",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.series | Internal time series data within an |numpy.ndarray|. | hydpy/core/sequencetools.py | 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:
"""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... | [
"Internal",
"time",
"series",
"data",
"within",
"an",
"|numpy",
".",
"ndarray|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L934-L944 | [
"def",
"series",
"(",
"self",
")",
"->",
"InfoArray",
":",
"if",
"self",
".",
"diskflag",
":",
"array",
"=",
"self",
".",
"_load_int",
"(",
")",
"elif",
"self",
".",
"ramflag",
":",
"array",
"=",
"self",
".",
"__get_array",
"(",
")",
"else",
":",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.load_ext | Read the internal data from an external data file. | hydpy/core/sequencetools.py | 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):
"""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... | [
"Read",
"the",
"internal",
"data",
"from",
"an",
"external",
"data",
"file",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L966-L975 | [
"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... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.adjust_short_series | 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... | hydpy/core/sequencetools.py | 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):
"""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... | [
"Adjust",
"a",
"short",
"time",
"series",
"to",
"a",
"longer",
"timegrid",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1005-L1088 | [
"def",
"adjust_short_series",
"(",
"self",
",",
"timegrid",
",",
"values",
")",
":",
"idxs",
"=",
"[",
"timegrid",
"[",
"hydpy",
".",
"pub",
".",
"timegrids",
".",
"init",
".",
"firstdate",
"]",
",",
"timegrid",
"[",
"hydpy",
".",
"pub",
".",
"timegrid... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.check_completeness | 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... | hydpy/core/sequencetools.py | 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):
"""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... | [
"Raise",
"a",
"|RuntimeError|",
"if",
"the",
"|IOSequence",
".",
"series|",
"contains",
"at",
"least",
"one",
"|numpy",
".",
"nan|",
"value",
"if",
"option",
"|Options",
".",
"checkseries|",
"is",
"enabled",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1090-L1127 | [
"def",
"check_completeness",
"(",
"self",
")",
":",
"if",
"hydpy",
".",
"pub",
".",
"options",
".",
"checkseries",
":",
"isnan",
"=",
"numpy",
".",
"isnan",
"(",
"self",
".",
"series",
")",
"if",
"numpy",
".",
"any",
"(",
"isnan",
")",
":",
"nmb",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.save_ext | Write the internal data into an external data file. | hydpy/core/sequencetools.py | 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):
"""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 ... | [
"Write",
"the",
"internal",
"data",
"into",
"an",
"external",
"data",
"file",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1129-L1138 | [
"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 `... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence._load_int | Load internal data from file and return it. | hydpy/core/sequencetools.py | 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):
"""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 | [
"Load",
"internal",
"data",
"from",
"file",
"and",
"return",
"it",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1148-L1153 | [
"def",
"_load_int",
"(",
"self",
")",
":",
"values",
"=",
"numpy",
".",
"fromfile",
"(",
"self",
".",
"filepath_int",
")",
"if",
"self",
".",
"NDIM",
">",
"0",
":",
"values",
"=",
"values",
".",
"reshape",
"(",
"self",
".",
"seriesshape",
")",
"retur... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.average_series | Average the actual time series of the |Variable| object for all
time points.
Method |IOSequence.average_series| works similarly as method
|Variable.average_values| of class |Variable|, from which we
borrow some examples. However, firstly, we have to prepare a
|Timegrids| object ... | hydpy/core/sequencetools.py | def average_series(self, *args, **kwargs) -> InfoArray:
"""Average the actual time series of the |Variable| object for all
time points.
Method |IOSequence.average_series| works similarly as method
|Variable.average_values| of class |Variable|, from which we
borrow some examples.... | def average_series(self, *args, **kwargs) -> InfoArray:
"""Average the actual time series of the |Variable| object for all
time points.
Method |IOSequence.average_series| works similarly as method
|Variable.average_values| of class |Variable|, from which we
borrow some examples.... | [
"Average",
"the",
"actual",
"time",
"series",
"of",
"the",
"|Variable|",
"object",
"for",
"all",
"time",
"points",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1158-L1237 | [
"def",
"average_series",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"->",
"InfoArray",
":",
"try",
":",
"if",
"not",
"self",
".",
"NDIM",
":",
"array",
"=",
"self",
".",
"series",
"else",
":",
"mask",
"=",
"self",
".",
"get_submas... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IOSequence.aggregate_series | Aggregates time series data based on the actual
|FluxSequence.aggregation_ext| attribute of |IOSequence|
subclasses.
We prepare some nodes and elements with the help of
method |prepare_io_example_1| and select a 1-dimensional
flux sequence of type |lland_fluxes.NKor| as an examp... | hydpy/core/sequencetools.py | def aggregate_series(self, *args, **kwargs) -> InfoArray:
"""Aggregates time series data based on the actual
|FluxSequence.aggregation_ext| attribute of |IOSequence|
subclasses.
We prepare some nodes and elements with the help of
method |prepare_io_example_1| and select a 1-dime... | def aggregate_series(self, *args, **kwargs) -> InfoArray:
"""Aggregates time series data based on the actual
|FluxSequence.aggregation_ext| attribute of |IOSequence|
subclasses.
We prepare some nodes and elements with the help of
method |prepare_io_example_1| and select a 1-dime... | [
"Aggregates",
"time",
"series",
"data",
"based",
"on",
"the",
"actual",
"|FluxSequence",
".",
"aggregation_ext|",
"attribute",
"of",
"|IOSequence|",
"subclasses",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1239-L1296 | [
"def",
"aggregate_series",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"->",
"InfoArray",
":",
"mode",
"=",
"self",
".",
"aggregation_ext",
"if",
"mode",
"==",
"'none'",
":",
"return",
"self",
".",
"series",
"elif",
"mode",
"==",
"'mea... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | StateSequence.old | Assess to the state value(s) at beginning of the time step, which
has been processed most recently. When using *HydPy* in the
normal manner. But it can be helpful for demonstration and debugging
purposes. | hydpy/core/sequencetools.py | def old(self):
"""Assess to the state value(s) at beginning of the time step, which
has been processed most recently. When using *HydPy* in the
normal manner. But it can be helpful for demonstration and debugging
purposes.
"""
value = getattr(self.fastaccess_old, self.n... | def old(self):
"""Assess to the state value(s) at beginning of the time step, which
has been processed most recently. When using *HydPy* in the
normal manner. But it can be helpful for demonstration and debugging
purposes.
"""
value = getattr(self.fastaccess_old, self.n... | [
"Assess",
"to",
"the",
"state",
"value",
"(",
"s",
")",
"at",
"beginning",
"of",
"the",
"time",
"step",
"which",
"has",
"been",
"processed",
"most",
"recently",
".",
"When",
"using",
"*",
"HydPy",
"*",
"in",
"the",
"normal",
"manner",
".",
"But",
"it",... | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1523-L1538 | [
"def",
"old",
"(",
"self",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
".",
"fastaccess_old",
",",
"self",
".",
"name",
",",
"None",
")",
"if",
"value",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'No value/values of sequence %s has/have '",
"'not ... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Sim.load_ext | Read time series data like method |IOSequence.load_ext| of class
|IOSequence|, but with special handling of missing data.
The method's "special handling" is to convert errors to warnings.
We explain the reasons in the documentation on method |Obs.load_ext|
of class |Obs|, from which we ... | hydpy/core/sequencetools.py | def load_ext(self):
"""Read time series data like method |IOSequence.load_ext| of class
|IOSequence|, but with special handling of missing data.
The method's "special handling" is to convert errors to warnings.
We explain the reasons in the documentation on method |Obs.load_ext|
... | def load_ext(self):
"""Read time series data like method |IOSequence.load_ext| of class
|IOSequence|, but with special handling of missing data.
The method's "special handling" is to convert errors to warnings.
We explain the reasons in the documentation on method |Obs.load_ext|
... | [
"Read",
"time",
"series",
"data",
"like",
"method",
"|IOSequence",
".",
"load_ext|",
"of",
"class",
"|IOSequence|",
"but",
"with",
"special",
"handling",
"of",
"missing",
"data",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1750-L1816 | [
"def",
"load_ext",
"(",
"self",
")",
":",
"try",
":",
"super",
"(",
")",
".",
"load_ext",
"(",
")",
"except",
"BaseException",
":",
"if",
"hydpy",
".",
"pub",
".",
"options",
".",
"warnmissingsimfile",
":",
"warnings",
".",
"warn",
"(",
"str",
"(",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Obs.load_ext | Read time series data like method |IOSequence.load_ext| of class
|IOSequence|, but with special handling of missing data.
When reading incomplete time series data, *HydPy* usually raises
a |RuntimeError| to prevent from performing erroneous calculations.
For instance, this makes sense f... | hydpy/core/sequencetools.py | def load_ext(self):
"""Read time series data like method |IOSequence.load_ext| of class
|IOSequence|, but with special handling of missing data.
When reading incomplete time series data, *HydPy* usually raises
a |RuntimeError| to prevent from performing erroneous calculations.
F... | def load_ext(self):
"""Read time series data like method |IOSequence.load_ext| of class
|IOSequence|, but with special handling of missing data.
When reading incomplete time series data, *HydPy* usually raises
a |RuntimeError| to prevent from performing erroneous calculations.
F... | [
"Read",
"time",
"series",
"data",
"like",
"method",
"|IOSequence",
".",
"load_ext|",
"of",
"class",
"|IOSequence|",
"but",
"with",
"special",
"handling",
"of",
"missing",
"data",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1823-L1923 | [
"def",
"load_ext",
"(",
"self",
")",
":",
"try",
":",
"super",
"(",
")",
".",
"load_ext",
"(",
")",
"except",
"OSError",
":",
"del",
"self",
".",
"memoryflag",
"if",
"hydpy",
".",
"pub",
".",
"options",
".",
"warnmissingobsfile",
":",
"warnings",
".",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FastAccess.open_files | Open all files with an activated disk flag. | hydpy/core/sequencetools.py | def open_files(self, idx):
"""Open all files with an activated disk flag."""
for name in self:
if getattr(self, '_%s_diskflag' % name):
path = getattr(self, '_%s_path' % name)
file_ = open(path, 'rb+')
ndim = getattr(self, '_%s_ndim' % name)
... | def open_files(self, idx):
"""Open all files with an activated disk flag."""
for name in self:
if getattr(self, '_%s_diskflag' % name):
path = getattr(self, '_%s_path' % name)
file_ = open(path, 'rb+')
ndim = getattr(self, '_%s_ndim' % name)
... | [
"Open",
"all",
"files",
"with",
"an",
"activated",
"disk",
"flag",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1985-L1997 | [
"def",
"open_files",
"(",
"self",
",",
"idx",
")",
":",
"for",
"name",
"in",
"self",
":",
"if",
"getattr",
"(",
"self",
",",
"'_%s_diskflag'",
"%",
"name",
")",
":",
"path",
"=",
"getattr",
"(",
"self",
",",
"'_%s_path'",
"%",
"name",
")",
"file_",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FastAccess.close_files | Close all files with an activated disk flag. | hydpy/core/sequencetools.py | def close_files(self):
"""Close all files with an activated disk flag."""
for name in self:
if getattr(self, '_%s_diskflag' % name):
file_ = getattr(self, '_%s_file' % name)
file_.close() | def close_files(self):
"""Close all files with an activated disk flag."""
for name in self:
if getattr(self, '_%s_diskflag' % name):
file_ = getattr(self, '_%s_file' % name)
file_.close() | [
"Close",
"all",
"files",
"with",
"an",
"activated",
"disk",
"flag",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1999-L2004 | [
"def",
"close_files",
"(",
"self",
")",
":",
"for",
"name",
"in",
"self",
":",
"if",
"getattr",
"(",
"self",
",",
"'_%s_diskflag'",
"%",
"name",
")",
":",
"file_",
"=",
"getattr",
"(",
"self",
",",
"'_%s_file'",
"%",
"name",
")",
"file_",
".",
"close... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FastAccess.load_data | Load the internal data of all sequences. Load from file if the
corresponding disk flag is activated, otherwise load from RAM. | hydpy/core/sequencetools.py | def load_data(self, idx):
"""Load the internal data of all sequences. Load from file if the
corresponding disk flag is activated, otherwise load from RAM."""
for name in self:
ndim = getattr(self, '_%s_ndim' % name)
diskflag = getattr(self, '_%s_diskflag' % name)
... | def load_data(self, idx):
"""Load the internal data of all sequences. Load from file if the
corresponding disk flag is activated, otherwise load from RAM."""
for name in self:
ndim = getattr(self, '_%s_ndim' % name)
diskflag = getattr(self, '_%s_diskflag' % name)
... | [
"Load",
"the",
"internal",
"data",
"of",
"all",
"sequences",
".",
"Load",
"from",
"file",
"if",
"the",
"corresponding",
"disk",
"flag",
"is",
"activated",
"otherwise",
"load",
"from",
"RAM",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2006-L2034 | [
"def",
"load_data",
"(",
"self",
",",
"idx",
")",
":",
"for",
"name",
"in",
"self",
":",
"ndim",
"=",
"getattr",
"(",
"self",
",",
"'_%s_ndim'",
"%",
"name",
")",
"diskflag",
"=",
"getattr",
"(",
"self",
",",
"'_%s_diskflag'",
"%",
"name",
")",
"ramf... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FastAccess.save_data | Save the internal data of all sequences with an activated flag.
Write to file if the corresponding disk flag is activated; store
in working memory if the corresponding ram flag is activated. | hydpy/core/sequencetools.py | def save_data(self, idx):
"""Save the internal data of all sequences with an activated flag.
Write to file if the corresponding disk flag is activated; store
in working memory if the corresponding ram flag is activated."""
for name in self:
actual = getattr(self, name)
... | def save_data(self, idx):
"""Save the internal data of all sequences with an activated flag.
Write to file if the corresponding disk flag is activated; store
in working memory if the corresponding ram flag is activated."""
for name in self:
actual = getattr(self, name)
... | [
"Save",
"the",
"internal",
"data",
"of",
"all",
"sequences",
"with",
"an",
"activated",
"flag",
".",
"Write",
"to",
"file",
"if",
"the",
"corresponding",
"disk",
"flag",
"is",
"activated",
";",
"store",
"in",
"working",
"memory",
"if",
"the",
"corresponding"... | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2036-L2058 | [
"def",
"save_data",
"(",
"self",
",",
"idx",
")",
":",
"for",
"name",
"in",
"self",
":",
"actual",
"=",
"getattr",
"(",
"self",
",",
"name",
")",
"diskflag",
"=",
"getattr",
"(",
"self",
",",
"'_%s_diskflag'",
"%",
"name",
")",
"ramflag",
"=",
"getat... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FastAccessNode.load_simdata | Load the next sim sequence value (of the given index). | hydpy/core/sequencetools.py | def load_simdata(self, idx: int) -> None:
"""Load the next sim sequence value (of the given index)."""
if self._sim_ramflag:
self.sim[0] = self._sim_array[idx]
elif self._sim_diskflag:
raw = self._sim_file.read(8)
self.sim[0] = struct.unpack('d', raw) | def load_simdata(self, idx: int) -> None:
"""Load the next sim sequence value (of the given index)."""
if self._sim_ramflag:
self.sim[0] = self._sim_array[idx]
elif self._sim_diskflag:
raw = self._sim_file.read(8)
self.sim[0] = struct.unpack('d', raw) | [
"Load",
"the",
"next",
"sim",
"sequence",
"value",
"(",
"of",
"the",
"given",
"index",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2100-L2106 | [
"def",
"load_simdata",
"(",
"self",
",",
"idx",
":",
"int",
")",
"->",
"None",
":",
"if",
"self",
".",
"_sim_ramflag",
":",
"self",
".",
"sim",
"[",
"0",
"]",
"=",
"self",
".",
"_sim_array",
"[",
"idx",
"]",
"elif",
"self",
".",
"_sim_diskflag",
":... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FastAccessNode.save_simdata | Save the last sim sequence value (of the given index). | hydpy/core/sequencetools.py | def save_simdata(self, idx: int) -> None:
"""Save the last sim sequence value (of the given index)."""
if self._sim_ramflag:
self._sim_array[idx] = self.sim[0]
elif self._sim_diskflag:
raw = struct.pack('d', self.sim[0])
self._sim_file.write(raw) | def save_simdata(self, idx: int) -> None:
"""Save the last sim sequence value (of the given index)."""
if self._sim_ramflag:
self._sim_array[idx] = self.sim[0]
elif self._sim_diskflag:
raw = struct.pack('d', self.sim[0])
self._sim_file.write(raw) | [
"Save",
"the",
"last",
"sim",
"sequence",
"value",
"(",
"of",
"the",
"given",
"index",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2108-L2114 | [
"def",
"save_simdata",
"(",
"self",
",",
"idx",
":",
"int",
")",
"->",
"None",
":",
"if",
"self",
".",
"_sim_ramflag",
":",
"self",
".",
"_sim_array",
"[",
"idx",
"]",
"=",
"self",
".",
"sim",
"[",
"0",
"]",
"elif",
"self",
".",
"_sim_diskflag",
":... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | FastAccessNode.load_obsdata | Load the next obs sequence value (of the given index). | hydpy/core/sequencetools.py | def load_obsdata(self, idx: int) -> None:
"""Load the next obs sequence value (of the given index)."""
if self._obs_ramflag:
self.obs[0] = self._obs_array[idx]
elif self._obs_diskflag:
raw = self._obs_file.read(8)
self.obs[0] = struct.unpack('d', raw) | def load_obsdata(self, idx: int) -> None:
"""Load the next obs sequence value (of the given index)."""
if self._obs_ramflag:
self.obs[0] = self._obs_array[idx]
elif self._obs_diskflag:
raw = self._obs_file.read(8)
self.obs[0] = struct.unpack('d', raw) | [
"Load",
"the",
"next",
"obs",
"sequence",
"value",
"(",
"of",
"the",
"given",
"index",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2116-L2122 | [
"def",
"load_obsdata",
"(",
"self",
",",
"idx",
":",
"int",
")",
"->",
"None",
":",
"if",
"self",
".",
"_obs_ramflag",
":",
"self",
".",
"obs",
"[",
"0",
"]",
"=",
"self",
".",
"_obs_array",
"[",
"idx",
"]",
"elif",
"self",
".",
"_obs_diskflag",
":... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | AbsFHRU.update | Update |AbsFHRU| based on |FT| and |FHRU|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> ft(100.0)
>>> fhru(0.2, 0.8)
>>> derived.absfhru.update()
>>> derived.absfhru
absfhru(20.0, 80.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |AbsFHRU| based on |FT| and |FHRU|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> ft(100.0)
>>> fhru(0.2, 0.8)
>>> derived.absfhru.update()
>>> derived.absfhru
absfh... | def update(self):
"""Update |AbsFHRU| based on |FT| and |FHRU|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> ft(100.0)
>>> fhru(0.2, 0.8)
>>> derived.absfhru.update()
>>> derived.absfhru
absfh... | [
"Update",
"|AbsFHRU|",
"based",
"on",
"|FT|",
"and",
"|FHRU|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L21-L35 | [
"def",
"update",
"(",
"self",
")",
":",
"control",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"control",
".",
"ft",
"*",
"control",
".",
"fhru",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | KInz.update | Update |KInz| based on |HInz| and |LAI|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> hinz(0.2)
>>> lai.acker_jun = 1.0
>>> lai.vers_dec = 2.0
>>> derived.kinz.update()
>>> from hydpy import round_
>>> round_(derive... | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |KInz| based on |HInz| and |LAI|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> hinz(0.2)
>>> lai.acker_jun = 1.0
>>> lai.vers_dec = 2.0
>>> derived.kinz.update()
>>> from hydpy import rou... | def update(self):
"""Update |KInz| based on |HInz| and |LAI|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> hinz(0.2)
>>> lai.acker_jun = 1.0
>>> lai.vers_dec = 2.0
>>> derived.kinz.update()
>>> from hydpy import rou... | [
"Update",
"|KInz|",
"based",
"on",
"|HInz|",
"and",
"|LAI|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L43-L60 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"hinz",
"*",
"con",
".",
"lai",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | WB.update | Update |WB| based on |RelWB| and |NFk|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> relwb(0.2)
>>> nfk(100.0, 200.0)
>>> derived.wb.update()
>>> derived.wb
wb(20.0, 40.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |WB| based on |RelWB| and |NFk|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> relwb(0.2)
>>> nfk(100.0, 200.0)
>>> derived.wb.update()
>>> derived.wb
wb(20.0, 40.0)... | def update(self):
"""Update |WB| based on |RelWB| and |NFk|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> relwb(0.2)
>>> nfk(100.0, 200.0)
>>> derived.wb.update()
>>> derived.wb
wb(20.0, 40.0)... | [
"Update",
"|WB|",
"based",
"on",
"|RelWB|",
"and",
"|NFk|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L68-L82 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"relwb",
"*",
"con",
".",
"nfk",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | WZ.update | Update |WZ| based on |RelWZ| and |NFk|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> relwz(0.8)
>>> nfk(100.0, 200.0)
>>> derived.wz.update()
>>> derived.wz
wz(80.0, 160.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |WZ| based on |RelWZ| and |NFk|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> relwz(0.8)
>>> nfk(100.0, 200.0)
>>> derived.wz.update()
>>> derived.wz
wz(80.0, 160.0... | def update(self):
"""Update |WZ| based on |RelWZ| and |NFk|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> relwz(0.8)
>>> nfk(100.0, 200.0)
>>> derived.wz.update()
>>> derived.wz
wz(80.0, 160.0... | [
"Update",
"|WZ|",
"based",
"on",
"|RelWZ|",
"and",
"|NFk|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L90-L104 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"relwz",
"*",
"con",
".",
"nfk",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | KB.update | Update |KB| based on |EQB| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqb(10.0)
>>> tind.value = 10.0
>>> derived.kb.update()
>>> derived.kb
kb(100.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |KB| based on |EQB| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqb(10.0)
>>> tind.value = 10.0
>>> derived.kb.update()
>>> derived.kb
kb(100.0)
"""
con = self.subpars.pars.contr... | def update(self):
"""Update |KB| based on |EQB| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqb(10.0)
>>> tind.value = 10.0
>>> derived.kb.update()
>>> derived.kb
kb(100.0)
"""
con = self.subpars.pars.contr... | [
"Update",
"|KB|",
"based",
"on",
"|EQB|",
"and",
"|TInd|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L112-L124 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"eqb",
"*",
"con",
".",
"tind",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | KI1.update | Update |KI1| based on |EQI1| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi1(5.0)
>>> tind.value = 10.0
>>> derived.ki1.update()
>>> derived.ki1
ki1(50.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |KI1| based on |EQI1| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi1(5.0)
>>> tind.value = 10.0
>>> derived.ki1.update()
>>> derived.ki1
ki1(50.0)
"""
con = self.subpars.pars.c... | def update(self):
"""Update |KI1| based on |EQI1| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi1(5.0)
>>> tind.value = 10.0
>>> derived.ki1.update()
>>> derived.ki1
ki1(50.0)
"""
con = self.subpars.pars.c... | [
"Update",
"|KI1|",
"based",
"on",
"|EQI1|",
"and",
"|TInd|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L132-L144 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"eqi1",
"*",
"con",
".",
"tind",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | KI2.update | Update |KI2| based on |EQI2| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi2(1.0)
>>> tind.value = 10.0
>>> derived.ki2.update()
>>> derived.ki2
ki2(10.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |KI2| based on |EQI2| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi2(1.0)
>>> tind.value = 10.0
>>> derived.ki2.update()
>>> derived.ki2
ki2(10.0)
"""
con = self.subpars.pars.c... | def update(self):
"""Update |KI2| based on |EQI2| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi2(1.0)
>>> tind.value = 10.0
>>> derived.ki2.update()
>>> derived.ki2
ki2(10.0)
"""
con = self.subpars.pars.c... | [
"Update",
"|KI2|",
"based",
"on",
"|EQI2|",
"and",
"|TInd|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L152-L164 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"eqi2",
"*",
"con",
".",
"tind",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | KD1.update | Update |KD1| based on |EQD1| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqd1(0.5)
>>> tind.value = 10.0
>>> derived.kd1.update()
>>> derived.kd1
kd1(5.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |KD1| based on |EQD1| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqd1(0.5)
>>> tind.value = 10.0
>>> derived.kd1.update()
>>> derived.kd1
kd1(5.0)
"""
con = self.subpars.pars.co... | def update(self):
"""Update |KD1| based on |EQD1| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqd1(0.5)
>>> tind.value = 10.0
>>> derived.kd1.update()
>>> derived.kd1
kd1(5.0)
"""
con = self.subpars.pars.co... | [
"Update",
"|KD1|",
"based",
"on",
"|EQD1|",
"and",
"|TInd|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L172-L184 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"eqd1",
"*",
"con",
".",
"tind",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | KD2.update | Update |KD2| based on |EQD2| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqd2(0.1)
>>> tind.value = 10.0
>>> derived.kd2.update()
>>> derived.kd2
kd2(1.0) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |KD2| based on |EQD2| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqd2(0.1)
>>> tind.value = 10.0
>>> derived.kd2.update()
>>> derived.kd2
kd2(1.0)
"""
con = self.subpars.pars.co... | def update(self):
"""Update |KD2| based on |EQD2| and |TInd|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqd2(0.1)
>>> tind.value = 10.0
>>> derived.kd2.update()
>>> derived.kd2
kd2(1.0)
"""
con = self.subpars.pars.co... | [
"Update",
"|KD2|",
"based",
"on",
"|EQD2|",
"and",
"|TInd|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L192-L204 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"eqd2",
"*",
"con",
".",
"tind",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | QFactor.update | Update |QFactor| based on |FT| and the current simulation step size.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> simulationstep('1d')
>>> ft(10.0)
>>> derived.qfactor.update()
>>> derived.qfactor
qfactor(0.115741) | hydpy/models/lland/lland_derived.py | def update(self):
"""Update |QFactor| based on |FT| and the current simulation step size.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> simulationstep('1d')
>>> ft(10.0)
>>> derived.qfactor.update()
>>> derived.qfactor
qfactor(0.115741)... | def update(self):
"""Update |QFactor| based on |FT| and the current simulation step size.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> simulationstep('1d')
>>> ft(10.0)
>>> derived.qfactor.update()
>>> derived.qfactor
qfactor(0.115741)... | [
"Update",
"|QFactor|",
"based",
"on",
"|FT|",
"and",
"the",
"current",
"simulation",
"step",
"size",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L211-L223 | [
"def",
"update",
"(",
"self",
")",
":",
"con",
"=",
"self",
".",
"subpars",
".",
"pars",
".",
"control",
"self",
"(",
"con",
".",
"ft",
"*",
"1000.",
"/",
"self",
".",
"simulationstep",
".",
"seconds",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | RiverBasinNumbers2Selection._router_numbers | A tuple of the numbers of all "routing" basins. | hydpy/auxs/networktools.py | def _router_numbers(self):
"""A tuple of the numbers of all "routing" basins."""
return tuple(up for up in self._up2down.keys()
if up in self._up2down.values()) | def _router_numbers(self):
"""A tuple of the numbers of all "routing" basins."""
return tuple(up for up in self._up2down.keys()
if up in self._up2down.values()) | [
"A",
"tuple",
"of",
"the",
"numbers",
"of",
"all",
"routing",
"basins",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L268-L271 | [
"def",
"_router_numbers",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"up",
"for",
"up",
"in",
"self",
".",
"_up2down",
".",
"keys",
"(",
")",
"if",
"up",
"in",
"self",
".",
"_up2down",
".",
"values",
"(",
")",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | RiverBasinNumbers2Selection.supplier_elements | A |Elements| collection of all "supplying" basins.
(All river basins are assumed to supply something to the downstream
basin.)
>>> from hydpy import RiverBasinNumbers2Selection
>>> rbns2s = RiverBasinNumbers2Selection(
... (111, 113, 1129, 11269, 1125... | hydpy/auxs/networktools.py | def supplier_elements(self):
"""A |Elements| collection of all "supplying" basins.
(All river basins are assumed to supply something to the downstream
basin.)
>>> from hydpy import RiverBasinNumbers2Selection
>>> rbns2s = RiverBasinNumbers2Selection(
... ... | def supplier_elements(self):
"""A |Elements| collection of all "supplying" basins.
(All river basins are assumed to supply something to the downstream
basin.)
>>> from hydpy import RiverBasinNumbers2Selection
>>> rbns2s = RiverBasinNumbers2Selection(
... ... | [
"A",
"|Elements|",
"collection",
"of",
"all",
"supplying",
"basins",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L283-L340 | [
"def",
"supplier_elements",
"(",
"self",
")",
":",
"elements",
"=",
"devicetools",
".",
"Elements",
"(",
")",
"for",
"supplier",
"in",
"self",
".",
"_supplier_numbers",
":",
"element",
"=",
"self",
".",
"_get_suppliername",
"(",
"supplier",
")",
"try",
":",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.