repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
hydpy-dev/hydpy
hydpy/core/objecttools.py
extract
def extract(values, types, skip=False): """Return a generator that extracts certain objects from `values`. This function is thought for supporting the definition of functions with arguments, that can be objects of of contain types or that can be iterables containing these objects. The following ex...
python
def extract(values, types, skip=False): """Return a generator that extracts certain objects from `values`. This function is thought for supporting the definition of functions with arguments, that can be objects of of contain types or that can be iterables containing these objects. The following ex...
[ "def", "extract", "(", "values", ",", "types", ",", "skip", "=", "False", ")", ":", "if", "isinstance", "(", "values", ",", "types", ")", ":", "yield", "values", "elif", "skip", "and", "(", "values", "is", "None", ")", ":", "return", "else", ":", "...
Return a generator that extracts certain objects from `values`. This function is thought for supporting the definition of functions with arguments, that can be objects of of contain types or that can be iterables containing these objects. The following examples show that function |extract| basical...
[ "Return", "a", "generator", "that", "extracts", "certain", "objects", "from", "values", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1378-L1428
hydpy-dev/hydpy
hydpy/core/objecttools.py
enumeration
def enumeration(values, converter=str, default=''): """Return an enumeration string based on the given values. The following four examples show the standard output of function |enumeration|: >>> from hydpy.core.objecttools import enumeration >>> enumeration(('text', 3, [])) 'text, 3, and []' ...
python
def enumeration(values, converter=str, default=''): """Return an enumeration string based on the given values. The following four examples show the standard output of function |enumeration|: >>> from hydpy.core.objecttools import enumeration >>> enumeration(('text', 3, [])) 'text, 3, and []' ...
[ "def", "enumeration", "(", "values", ",", "converter", "=", "str", ",", "default", "=", "''", ")", ":", "values", "=", "tuple", "(", "converter", "(", "value", ")", "for", "value", "in", "values", ")", "if", "not", "values", ":", "return", "default", ...
Return an enumeration string based on the given values. The following four examples show the standard output of function |enumeration|: >>> from hydpy.core.objecttools import enumeration >>> enumeration(('text', 3, [])) 'text, 3, and []' >>> enumeration(('text', 3)) 'text and 3' >>> en...
[ "Return", "an", "enumeration", "string", "based", "on", "the", "given", "values", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/objecttools.py#L1431-L1468
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
Ic.trim
def trim(self, lower=None, upper=None): """Trim upper values in accordance with :math:`IC \\leq ICMAX`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(5) >>> icmax(2.0) >>> states.ic(-1.0, 0.0, 1.0, 2.0, 3.0) >>> states.ic ic(0....
python
def trim(self, lower=None, upper=None): """Trim upper values in accordance with :math:`IC \\leq ICMAX`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(5) >>> icmax(2.0) >>> states.ic(-1.0, 0.0, 1.0, 2.0, 3.0) >>> states.ic ic(0....
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "if", "upper", "is", "None", ":", "control", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", "upper", "=", "contr...
Trim upper values in accordance with :math:`IC \\leq ICMAX`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(5) >>> icmax(2.0) >>> states.ic(-1.0, 0.0, 1.0, 2.0, 3.0) >>> states.ic ic(0.0, 0.0, 1.0, 2.0, 2.0)
[ "Trim", "upper", "values", "in", "accordance", "with", ":", "math", ":", "IC", "\\\\", "leq", "ICMAX", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L20-L34
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
SP.trim
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.wc.values = -1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0 >>> stat...
python
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.wc.values = -1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0 >>> stat...
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "whc", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", ".", "whc", "wc", "=", "self", ".", "subseqs", ".", "wc"...
Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.wc.values = -1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0 >>> states.sp(-1., 0., 0., 5., 5., 5., 5.) >>> stat...
[ "Trim", "values", "in", "accordance", "with", ":", "math", ":", "WC", "\\\\", "leq", "WHC", "\\\\", "cdot", "SP", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L42-L62
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
WC.trim
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.sp = 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0 >>> states.wc(-1....
python
def trim(self, lower=None, upper=None): """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.sp = 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0 >>> states.wc(-1....
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "whc", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", ".", "whc", "sp", "=", "self", ".", "subseqs", ".", "sp"...
Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(7) >>> whc(0.1) >>> states.sp = 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0 >>> states.wc(-1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0) >>> state...
[ "Trim", "values", "in", "accordance", "with", ":", "math", ":", "WC", "\\\\", "leq", "WHC", "\\\\", "cdot", "SP", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L70-L86
hydpy-dev/hydpy
hydpy/models/hland/hland_states.py
LZ.trim
def trim(self, lower=None, upper=None): """Trim negative value whenever there is no internal lake within the respective subbasin. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(2) >>> zonetype(FIELD, ILAKE) >>> states.lz(-1.0) >...
python
def trim(self, lower=None, upper=None): """Trim negative value whenever there is no internal lake within the respective subbasin. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(2) >>> zonetype(FIELD, ILAKE) >>> states.lz(-1.0) >...
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "if", "upper", "is", "None", ":", "control", "=", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "parameters", ".", "control", "if", "not", "any", ...
Trim negative value whenever there is no internal lake within the respective subbasin. >>> from hydpy.models.hland import * >>> parameterstep('1d') >>> nmbzones(2) >>> zonetype(FIELD, ILAKE) >>> states.lz(-1.0) >>> states.lz lz(-1.0) >>> zonetype(...
[ "Trim", "negative", "value", "whenever", "there", "is", "no", "internal", "lake", "within", "the", "respective", "subbasin", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_states.py#L119-L142
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.load_data
def load_data(self, idx): """Call method |InputSequences.load_data| of all handled |InputSequences| objects.""" for subseqs in self: if isinstance(subseqs, abctools.InputSequencesABC): subseqs.load_data(idx)
python
def load_data(self, idx): """Call method |InputSequences.load_data| of all handled |InputSequences| objects.""" for subseqs in self: if isinstance(subseqs, abctools.InputSequencesABC): subseqs.load_data(idx)
[ "def", "load_data", "(", "self", ",", "idx", ")", ":", "for", "subseqs", "in", "self", ":", "if", "isinstance", "(", "subseqs", ",", "abctools", ".", "InputSequencesABC", ")", ":", "subseqs", ".", "load_data", "(", "idx", ")" ]
Call method |InputSequences.load_data| of all handled |InputSequences| objects.
[ "Call", "method", "|InputSequences", ".", "load_data|", "of", "all", "handled", "|InputSequences|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L113-L118
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.save_data
def save_data(self, idx): """Call method `save_data|` of all handled |IOSequences| objects registered under |OutputSequencesABC|.""" for subseqs in self: if isinstance(subseqs, abctools.OutputSequencesABC): subseqs.save_data(idx)
python
def save_data(self, idx): """Call method `save_data|` of all handled |IOSequences| objects registered under |OutputSequencesABC|.""" for subseqs in self: if isinstance(subseqs, abctools.OutputSequencesABC): subseqs.save_data(idx)
[ "def", "save_data", "(", "self", ",", "idx", ")", ":", "for", "subseqs", "in", "self", ":", "if", "isinstance", "(", "subseqs", ",", "abctools", ".", "OutputSequencesABC", ")", ":", "subseqs", ".", "save_data", "(", "idx", ")" ]
Call method `save_data|` of all handled |IOSequences| objects registered under |OutputSequencesABC|.
[ "Call", "method", "save_data|", "of", "all", "handled", "|IOSequences|", "objects", "registered", "under", "|OutputSequencesABC|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L120-L125
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.conditions
def conditions(self) -> Dict[str, Dict[str, Union[float, numpy.ndarray]]]: """Nested dictionary containing the values of all condition sequences. See the documentation on property |HydPy.conditions| for further information. """ conditions = {} for subname in NAME...
python
def conditions(self) -> Dict[str, Dict[str, Union[float, numpy.ndarray]]]: """Nested dictionary containing the values of all condition sequences. See the documentation on property |HydPy.conditions| for further information. """ conditions = {} for subname in NAME...
[ "def", "conditions", "(", "self", ")", "->", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "Union", "[", "float", ",", "numpy", ".", "ndarray", "]", "]", "]", ":", "conditions", "=", "{", "}", "for", "subname", "in", "NAMES_CONDITIONSEQUENCES", "...
Nested dictionary containing the values of all condition sequences. See the documentation on property |HydPy.conditions| for further information.
[ "Nested", "dictionary", "containing", "the", "values", "of", "all", "condition", "sequences", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L149-L163
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.load_conditions
def load_conditions(self, filename=None): """Read the initial conditions from a file and assign them to the respective |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object. If no filename or dirname is passed, the ones defined by the |ConditionMa...
python
def load_conditions(self, filename=None): """Read the initial conditions from a file and assign them to the respective |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object. If no filename or dirname is passed, the ones defined by the |ConditionMa...
[ "def", "load_conditions", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "self", ".", "hasconditions", ":", "if", "not", "filename", ":", "filename", "=", "self", ".", "_conditiondefaultfilename", "namespace", "=", "locals", "(", ")", "for", "s...
Read the initial conditions from a file and assign them to the respective |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object. If no filename or dirname is passed, the ones defined by the |ConditionManager| stored in module |pub| are used.
[ "Read", "the", "initial", "conditions", "from", "a", "file", "and", "assign", "them", "to", "the", "respective", "|StateSequence|", "and", "/", "or", "|LogSequence|", "objects", "handled", "by", "the", "actual", "|Sequences|", "object", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L198-L222
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sequences.save_conditions
def save_conditions(self, filename=None): """Query the actual conditions of the |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object and write them into a initial condition file. If no filename or dirname is passed, the ones defined by the |Condi...
python
def save_conditions(self, filename=None): """Query the actual conditions of the |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object and write them into a initial condition file. If no filename or dirname is passed, the ones defined by the |Condi...
[ "def", "save_conditions", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "self", ".", "hasconditions", ":", "if", "filename", "is", "None", ":", "filename", "=", "self", ".", "_conditiondefaultfilename", "con", "=", "hydpy", ".", "pub", ".", ...
Query the actual conditions of the |StateSequence| and/or |LogSequence| objects handled by the actual |Sequences| object and write them into a initial condition file. If no filename or dirname is passed, the ones defined by the |ConditionManager| stored in module |pub| are used.
[ "Query", "the", "actual", "conditions", "of", "the", "|StateSequence|", "and", "/", "or", "|LogSequence|", "objects", "handled", "by", "the", "actual", "|Sequences|", "object", "and", "write", "them", "into", "a", "initial", "condition", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L224-L242
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.dirpath_int
def dirpath_int(self): """Absolute path of the directory of the internal data file. Normally, each sequence queries its current "internal" directory path from the |SequenceManager| object stored in module |pub|: >>> from hydpy import pub, repr_, TestIO >>> from hydpy.core.filet...
python
def dirpath_int(self): """Absolute path of the directory of the internal data file. Normally, each sequence queries its current "internal" directory path from the |SequenceManager| object stored in module |pub|: >>> from hydpy import pub, repr_, TestIO >>> from hydpy.core.filet...
[ "def", "dirpath_int", "(", "self", ")", ":", "try", ":", "return", "hydpy", ".", "pub", ".", "sequencemanager", ".", "tempdirpath", "except", "RuntimeError", ":", "raise", "RuntimeError", "(", "f'For sequence {objecttools.devicephrase(self)} '", "f'the directory of the ...
Absolute path of the directory of the internal data file. Normally, each sequence queries its current "internal" directory path from the |SequenceManager| object stored in module |pub|: >>> from hydpy import pub, repr_, TestIO >>> from hydpy.core.filetools import SequenceManager ...
[ "Absolute", "path", "of", "the", "directory", "of", "the", "internal", "data", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L677-L738
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.disk2ram
def disk2ram(self): """Move internal data from disk to RAM.""" values = self.series self.deactivate_disk() self.ramflag = True self.__set_array(values) self.update_fastaccess()
python
def disk2ram(self): """Move internal data from disk to RAM.""" values = self.series self.deactivate_disk() self.ramflag = True self.__set_array(values) self.update_fastaccess()
[ "def", "disk2ram", "(", "self", ")", ":", "values", "=", "self", ".", "series", "self", ".", "deactivate_disk", "(", ")", "self", ".", "ramflag", "=", "True", "self", ".", "__set_array", "(", "values", ")", "self", ".", "update_fastaccess", "(", ")" ]
Move internal data from disk to RAM.
[ "Move", "internal", "data", "from", "disk", "to", "RAM", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L856-L862
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.ram2disk
def ram2disk(self): """Move internal data from RAM to disk.""" values = self.series self.deactivate_ram() self.diskflag = True self._save_int(values) self.update_fastaccess()
python
def ram2disk(self): """Move internal data from RAM to disk.""" values = self.series self.deactivate_ram() self.diskflag = True self._save_int(values) self.update_fastaccess()
[ "def", "ram2disk", "(", "self", ")", ":", "values", "=", "self", ".", "series", "self", ".", "deactivate_ram", "(", ")", "self", ".", "diskflag", "=", "True", "self", ".", "_save_int", "(", "values", ")", "self", ".", "update_fastaccess", "(", ")" ]
Move internal data from RAM to disk.
[ "Move", "internal", "data", "from", "RAM", "to", "disk", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L864-L870
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.seriesshape
def seriesshape(self): """Shape of the whole time series (time being the first dimension).""" seriesshape = [len(hydpy.pub.timegrids.init)] seriesshape.extend(self.shape) return tuple(seriesshape)
python
def seriesshape(self): """Shape of the whole time series (time being the first dimension).""" seriesshape = [len(hydpy.pub.timegrids.init)] seriesshape.extend(self.shape) return tuple(seriesshape)
[ "def", "seriesshape", "(", "self", ")", ":", "seriesshape", "=", "[", "len", "(", "hydpy", ".", "pub", ".", "timegrids", ".", "init", ")", "]", "seriesshape", ".", "extend", "(", "self", ".", "shape", ")", "return", "tuple", "(", "seriesshape", ")" ]
Shape of the whole time series (time being the first dimension).
[ "Shape", "of", "the", "whole", "time", "series", "(", "time", "being", "the", "first", "dimension", ")", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L910-L914
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.numericshape
def numericshape(self): """Shape of the array of temporary values required for the numerical solver actually being selected.""" try: numericshape = [self.subseqs.seqs.model.numconsts.nmb_stages] except AttributeError: objecttools.augment_excmessage( ...
python
def numericshape(self): """Shape of the array of temporary values required for the numerical solver actually being selected.""" try: numericshape = [self.subseqs.seqs.model.numconsts.nmb_stages] except AttributeError: objecttools.augment_excmessage( ...
[ "def", "numericshape", "(", "self", ")", ":", "try", ":", "numericshape", "=", "[", "self", ".", "subseqs", ".", "seqs", ".", "model", ".", "numconsts", ".", "nmb_stages", "]", "except", "AttributeError", ":", "objecttools", ".", "augment_excmessage", "(", ...
Shape of the array of temporary values required for the numerical solver actually being selected.
[ "Shape", "of", "the", "array", "of", "temporary", "values", "required", "for", "the", "numerical", "solver", "actually", "being", "selected", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L917-L931
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.series
def series(self) -> InfoArray: """Internal time series data within an |numpy.ndarray|.""" if self.diskflag: array = self._load_int() elif self.ramflag: array = self.__get_array() else: raise AttributeError( f'Sequence {objecttools.devic...
python
def series(self) -> InfoArray: """Internal time series data within an |numpy.ndarray|.""" if self.diskflag: array = self._load_int() elif self.ramflag: array = self.__get_array() else: raise AttributeError( f'Sequence {objecttools.devic...
[ "def", "series", "(", "self", ")", "->", "InfoArray", ":", "if", "self", ".", "diskflag", ":", "array", "=", "self", ".", "_load_int", "(", ")", "elif", "self", ".", "ramflag", ":", "array", "=", "self", ".", "__get_array", "(", ")", "else", ":", "...
Internal time series data within an |numpy.ndarray|.
[ "Internal", "time", "series", "data", "within", "an", "|numpy", ".", "ndarray|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L934-L944
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.load_ext
def load_ext(self): """Read the internal data from an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be loaded. Firstly, ' 'you have...
python
def load_ext(self): """Read the internal data from an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be loaded. Firstly, ' 'you have...
[ "def", "load_ext", "(", "self", ")", ":", "try", ":", "sequencemanager", "=", "hydpy", ".", "pub", ".", "sequencemanager", "except", "AttributeError", ":", "raise", "RuntimeError", "(", "'The time series of sequence %s cannot be loaded. Firstly, '", "'you have to prepare...
Read the internal data from an external data file.
[ "Read", "the", "internal", "data", "from", "an", "external", "data", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L966-L975
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.adjust_short_series
def adjust_short_series(self, timegrid, values): """Adjust a short time series to a longer timegrid. Normally, time series data to be read from a external data files should span (at least) the whole initialization time period of a HydPy project. However, for some variables which are on...
python
def adjust_short_series(self, timegrid, values): """Adjust a short time series to a longer timegrid. Normally, time series data to be read from a external data files should span (at least) the whole initialization time period of a HydPy project. However, for some variables which are on...
[ "def", "adjust_short_series", "(", "self", ",", "timegrid", ",", "values", ")", ":", "idxs", "=", "[", "timegrid", "[", "hydpy", ".", "pub", ".", "timegrids", ".", "init", ".", "firstdate", "]", ",", "timegrid", "[", "hydpy", ".", "pub", ".", "timegrid...
Adjust a short time series to a longer timegrid. Normally, time series data to be read from a external data files should span (at least) the whole initialization time period of a HydPy project. However, for some variables which are only used for comparison (e.g. observed runoff used fo...
[ "Adjust", "a", "short", "time", "series", "to", "a", "longer", "timegrid", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1005-L1088
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.check_completeness
def check_completeness(self): """Raise a |RuntimeError| if the |IOSequence.series| contains at least one |numpy.nan| value, if option |Options.checkseries| is enabled. >>> from hydpy import pub >>> pub.timegrids = '2000-01-01', '2000-01-11', '1d' >>> from hydpy.core.sequ...
python
def check_completeness(self): """Raise a |RuntimeError| if the |IOSequence.series| contains at least one |numpy.nan| value, if option |Options.checkseries| is enabled. >>> from hydpy import pub >>> pub.timegrids = '2000-01-01', '2000-01-11', '1d' >>> from hydpy.core.sequ...
[ "def", "check_completeness", "(", "self", ")", ":", "if", "hydpy", ".", "pub", ".", "options", ".", "checkseries", ":", "isnan", "=", "numpy", ".", "isnan", "(", "self", ".", "series", ")", "if", "numpy", ".", "any", "(", "isnan", ")", ":", "nmb", ...
Raise a |RuntimeError| if the |IOSequence.series| contains at least one |numpy.nan| value, if option |Options.checkseries| is enabled. >>> from hydpy import pub >>> pub.timegrids = '2000-01-01', '2000-01-11', '1d' >>> from hydpy.core.sequencetools import IOSequence >>> c...
[ "Raise", "a", "|RuntimeError|", "if", "the", "|IOSequence", ".", "series|", "contains", "at", "least", "one", "|numpy", ".", "nan|", "value", "if", "option", "|Options", ".", "checkseries|", "is", "enabled", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1090-L1127
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.save_ext
def save_ext(self): """Write the internal data into an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be saved. Firstly,' 'you have ...
python
def save_ext(self): """Write the internal data into an external data file.""" try: sequencemanager = hydpy.pub.sequencemanager except AttributeError: raise RuntimeError( 'The time series of sequence %s cannot be saved. Firstly,' 'you have ...
[ "def", "save_ext", "(", "self", ")", ":", "try", ":", "sequencemanager", "=", "hydpy", ".", "pub", ".", "sequencemanager", "except", "AttributeError", ":", "raise", "RuntimeError", "(", "'The time series of sequence %s cannot be saved. Firstly,'", "'you have to prepare `...
Write the internal data into an external data file.
[ "Write", "the", "internal", "data", "into", "an", "external", "data", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1129-L1138
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence._load_int
def _load_int(self): """Load internal data from file and return it.""" values = numpy.fromfile(self.filepath_int) if self.NDIM > 0: values = values.reshape(self.seriesshape) return values
python
def _load_int(self): """Load internal data from file and return it.""" values = numpy.fromfile(self.filepath_int) if self.NDIM > 0: values = values.reshape(self.seriesshape) return values
[ "def", "_load_int", "(", "self", ")", ":", "values", "=", "numpy", ".", "fromfile", "(", "self", ".", "filepath_int", ")", "if", "self", ".", "NDIM", ">", "0", ":", "values", "=", "values", ".", "reshape", "(", "self", ".", "seriesshape", ")", "retur...
Load internal data from file and return it.
[ "Load", "internal", "data", "from", "file", "and", "return", "it", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1148-L1153
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.average_series
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....
python
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", ":", "try", ":", "if", "not", "self", ".", "NDIM", ":", "array", "=", "self", ".", "series", "else", ":", "mask", "=", "self", ".", "get_submas...
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 ...
[ "Average", "the", "actual", "time", "series", "of", "the", "|Variable|", "object", "for", "all", "time", "points", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1158-L1237
hydpy-dev/hydpy
hydpy/core/sequencetools.py
IOSequence.aggregate_series
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...
python
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", ":", "mode", "=", "self", ".", "aggregation_ext", "if", "mode", "==", "'none'", ":", "return", "self", ".", "series", "elif", "mode", "==", "'mea...
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...
[ "Aggregates", "time", "series", "data", "based", "on", "the", "actual", "|FluxSequence", ".", "aggregation_ext|", "attribute", "of", "|IOSequence|", "subclasses", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1239-L1296
hydpy-dev/hydpy
hydpy/core/sequencetools.py
StateSequence.old
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...
python
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", ")", ":", "value", "=", "getattr", "(", "self", ".", "fastaccess_old", ",", "self", ".", "name", ",", "None", ")", "if", "value", "is", "None", ":", "raise", "RuntimeError", "(", "'No value/values of sequence %s has/have '", "'not ...
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.
[ "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",...
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1523-L1538
hydpy-dev/hydpy
hydpy/core/sequencetools.py
Sim.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| ...
python
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", ")", ":", "try", ":", "super", "(", ")", ".", "load_ext", "(", ")", "except", "BaseException", ":", "if", "hydpy", ".", "pub", ".", "options", ".", "warnmissingsimfile", ":", "warnings", ".", "warn", "(", "str", "(", "...
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 ...
[ "Read", "time", "series", "data", "like", "method", "|IOSequence", ".", "load_ext|", "of", "class", "|IOSequence|", "but", "with", "special", "handling", "of", "missing", "data", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1750-L1816
hydpy-dev/hydpy
hydpy/core/sequencetools.py
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. When reading incomplete time series data, *HydPy* usually raises a |RuntimeError| to prevent from performing erroneous calculations. F...
python
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", ")", ":", "try", ":", "super", "(", ")", ".", "load_ext", "(", ")", "except", "OSError", ":", "del", "self", ".", "memoryflag", "if", "hydpy", ".", "pub", ".", "options", ".", "warnmissingobsfile", ":", "warnings", ".", ...
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...
[ "Read", "time", "series", "data", "like", "method", "|IOSequence", ".", "load_ext|", "of", "class", "|IOSequence|", "but", "with", "special", "handling", "of", "missing", "data", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1823-L1923
hydpy-dev/hydpy
hydpy/core/sequencetools.py
FastAccess.open_files
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) ...
python
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", ")", ":", "for", "name", "in", "self", ":", "if", "getattr", "(", "self", ",", "'_%s_diskflag'", "%", "name", ")", ":", "path", "=", "getattr", "(", "self", ",", "'_%s_path'", "%", "name", ")", "file_", ...
Open all files with an activated disk flag.
[ "Open", "all", "files", "with", "an", "activated", "disk", "flag", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1985-L1997
hydpy-dev/hydpy
hydpy/core/sequencetools.py
FastAccess.close_files
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()
python
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", ")", ":", "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.
[ "Close", "all", "files", "with", "an", "activated", "disk", "flag", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L1999-L2004
hydpy-dev/hydpy
hydpy/core/sequencetools.py
FastAccess.load_data
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) ...
python
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", ")", ":", "for", "name", "in", "self", ":", "ndim", "=", "getattr", "(", "self", ",", "'_%s_ndim'", "%", "name", ")", "diskflag", "=", "getattr", "(", "self", ",", "'_%s_diskflag'", "%", "name", ")", "ramf...
Load the internal data of all sequences. Load from file if the corresponding disk flag is activated, otherwise load from RAM.
[ "Load", "the", "internal", "data", "of", "all", "sequences", ".", "Load", "from", "file", "if", "the", "corresponding", "disk", "flag", "is", "activated", "otherwise", "load", "from", "RAM", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2006-L2034
hydpy-dev/hydpy
hydpy/core/sequencetools.py
FastAccess.save_data
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) ...
python
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", ")", ":", "for", "name", "in", "self", ":", "actual", "=", "getattr", "(", "self", ",", "name", ")", "diskflag", "=", "getattr", "(", "self", ",", "'_%s_diskflag'", "%", "name", ")", "ramflag", "=", "getat...
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.
[ "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"...
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2036-L2058
hydpy-dev/hydpy
hydpy/core/sequencetools.py
FastAccessNode.load_simdata
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)
python
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", ":", "if", "self", ".", "_sim_ramflag", ":", "self", ".", "sim", "[", "0", "]", "=", "self", ".", "_sim_array", "[", "idx", "]", "elif", "self", ".", "_sim_diskflag", ":...
Load the next sim sequence value (of the given index).
[ "Load", "the", "next", "sim", "sequence", "value", "(", "of", "the", "given", "index", ")", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2100-L2106
hydpy-dev/hydpy
hydpy/core/sequencetools.py
FastAccessNode.save_simdata
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)
python
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", ":", "if", "self", ".", "_sim_ramflag", ":", "self", ".", "_sim_array", "[", "idx", "]", "=", "self", ".", "sim", "[", "0", "]", "elif", "self", ".", "_sim_diskflag", ":...
Save the last sim sequence value (of the given index).
[ "Save", "the", "last", "sim", "sequence", "value", "(", "of", "the", "given", "index", ")", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2108-L2114
hydpy-dev/hydpy
hydpy/core/sequencetools.py
FastAccessNode.load_obsdata
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)
python
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", ":", "if", "self", ".", "_obs_ramflag", ":", "self", ".", "obs", "[", "0", "]", "=", "self", ".", "_obs_array", "[", "idx", "]", "elif", "self", ".", "_obs_diskflag", ":...
Load the next obs sequence value (of the given index).
[ "Load", "the", "next", "obs", "sequence", "value", "(", "of", "the", "given", "index", ")", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2116-L2122
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
AbsFHRU.update
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...
python
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", ")", ":", "control", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "control", ".", "ft", "*", "control", ".", "fhru", ")" ]
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)
[ "Update", "|AbsFHRU|", "based", "on", "|FT|", "and", "|FHRU|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L21-L35
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
KInz.update
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...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "hinz", "*", "con", ".", "lai", ")" ]
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...
[ "Update", "|KInz|", "based", "on", "|HInz|", "and", "|LAI|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L43-L60
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
WB.update
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)...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "relwb", "*", "con", ".", "nfk", ")" ]
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|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L68-L82
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
WZ.update
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...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "relwz", "*", "con", ".", "nfk", ")" ]
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|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L90-L104
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
KB.update
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...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "eqb", "*", "con", ".", "tind", ")" ]
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)
[ "Update", "|KB|", "based", "on", "|EQB|", "and", "|TInd|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L112-L124
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
KI1.update
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...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "eqi1", "*", "con", ".", "tind", ")" ]
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)
[ "Update", "|KI1|", "based", "on", "|EQI1|", "and", "|TInd|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L132-L144
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
KI2.update
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...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "eqi2", "*", "con", ".", "tind", ")" ]
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)
[ "Update", "|KI2|", "based", "on", "|EQI2|", "and", "|TInd|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L152-L164
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
KD1.update
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...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "eqd1", "*", "con", ".", "tind", ")" ]
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)
[ "Update", "|KD1|", "based", "on", "|EQD1|", "and", "|TInd|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L172-L184
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
KD2.update
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...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "eqd2", "*", "con", ".", "tind", ")" ]
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)
[ "Update", "|KD2|", "based", "on", "|EQD2|", "and", "|TInd|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L192-L204
hydpy-dev/hydpy
hydpy/models/lland/lland_derived.py
QFactor.update
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)...
python
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", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "self", "(", "con", ".", "ft", "*", "1000.", "/", "self", ".", "simulationstep", ".", "seconds", ")" ]
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", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_derived.py#L211-L223
hydpy-dev/hydpy
hydpy/auxs/networktools.py
RiverBasinNumbers2Selection._router_numbers
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())
python
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", ")", ":", "return", "tuple", "(", "up", "for", "up", "in", "self", ".", "_up2down", ".", "keys", "(", ")", "if", "up", "in", "self", ".", "_up2down", ".", "values", "(", ")", ")" ]
A tuple of the numbers of all "routing" basins.
[ "A", "tuple", "of", "the", "numbers", "of", "all", "routing", "basins", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L268-L271
hydpy-dev/hydpy
hydpy/auxs/networktools.py
RiverBasinNumbers2Selection.supplier_elements
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( ... ...
python
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", ")", ":", "elements", "=", "devicetools", ".", "Elements", "(", ")", "for", "supplier", "in", "self", ".", "_supplier_numbers", ":", "element", "=", "self", ".", "_get_suppliername", "(", "supplier", ")", "try", ":", ...
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...
[ "A", "|Elements|", "collection", "of", "all", "supplying", "basins", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L283-L340
hydpy-dev/hydpy
hydpy/auxs/networktools.py
RiverBasinNumbers2Selection.router_elements
def router_elements(self): """A |Elements| collection of all "routing" basins. (Only river basins with a upstream basin are assumed to route something to the downstream basin.) >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ....
python
def router_elements(self): """A |Elements| collection of all "routing" basins. (Only river basins with a upstream basin are assumed to route something to the downstream basin.) >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ....
[ "def", "router_elements", "(", "self", ")", ":", "elements", "=", "devicetools", ".", "Elements", "(", ")", "for", "router", "in", "self", ".", "_router_numbers", ":", "element", "=", "self", ".", "_get_routername", "(", "router", ")", "inlet", "=", "self"...
A |Elements| collection of all "routing" basins. (Only river basins with a upstream basin are assumed to route something to the downstream basin.) >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 11...
[ "A", "|Elements|", "collection", "of", "all", "routing", "basins", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L343-L394
hydpy-dev/hydpy
hydpy/auxs/networktools.py
RiverBasinNumbers2Selection.nodes
def nodes(self): """A |Nodes| collection of all required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ... 11262, 1123, 1124, 1122...
python
def nodes(self): """A |Nodes| collection of all required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ... 11262, 1123, 1124, 1122...
[ "def", "nodes", "(", "self", ")", ":", "return", "(", "devicetools", ".", "Nodes", "(", "self", ".", "node_prefix", "+", "routers", "for", "routers", "in", "self", ".", "_router_numbers", ")", "+", "devicetools", ".", "Node", "(", "self", ".", "last_node...
A |Nodes| collection of all required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ... 11262, 1123, 1124, 1122, 1121)) Note that ...
[ "A", "|Nodes|", "collection", "of", "all", "required", "nodes", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L402-L427
hydpy-dev/hydpy
hydpy/auxs/networktools.py
RiverBasinNumbers2Selection.selection
def selection(self): """A complete |Selection| object of all "supplying" and "routing" elements and required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ...
python
def selection(self): """A complete |Selection| object of all "supplying" and "routing" elements and required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ...
[ "def", "selection", "(", "self", ")", ":", "return", "selectiontools", ".", "Selection", "(", "self", ".", "selection_name", ",", "self", ".", "nodes", ",", "self", ".", "elements", ")" ]
A complete |Selection| object of all "supplying" and "routing" elements and required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ... ...
[ "A", "complete", "|Selection|", "object", "of", "all", "supplying", "and", "routing", "elements", "and", "required", "nodes", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L430-L460
hydpy-dev/hydpy
hydpy/core/netcdftools.py
str2chars
def str2chars(strings) -> numpy.ndarray: """Return |numpy.ndarray| containing the byte characters (second axis) of all given strings (first axis). >>> from hydpy.core.netcdftools import str2chars >>> str2chars(['zeros', 'ones']) array([[b'z', b'e', b'r', b'o', b's'], [b'o', b'n', b'e', b...
python
def str2chars(strings) -> numpy.ndarray: """Return |numpy.ndarray| containing the byte characters (second axis) of all given strings (first axis). >>> from hydpy.core.netcdftools import str2chars >>> str2chars(['zeros', 'ones']) array([[b'z', b'e', b'r', b'o', b's'], [b'o', b'n', b'e', b...
[ "def", "str2chars", "(", "strings", ")", "->", "numpy", ".", "ndarray", ":", "maxlen", "=", "0", "for", "name", "in", "strings", ":", "maxlen", "=", "max", "(", "maxlen", ",", "len", "(", "name", ")", ")", "# noinspection PyTypeChecker", "chars", "=", ...
Return |numpy.ndarray| containing the byte characters (second axis) of all given strings (first axis). >>> from hydpy.core.netcdftools import str2chars >>> str2chars(['zeros', 'ones']) array([[b'z', b'e', b'r', b'o', b's'], [b'o', b'n', b'e', b's', b'']], dtype='|S1') >>> str2...
[ "Return", "|numpy", ".", "ndarray|", "containing", "the", "byte", "characters", "(", "second", "axis", ")", "of", "all", "given", "strings", "(", "first", "axis", ")", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L261-L284
hydpy-dev/hydpy
hydpy/core/netcdftools.py
chars2str
def chars2str(chars) -> List[str]: """Inversion function of function |str2chars|. >>> from hydpy.core.netcdftools import chars2str >>> chars2str([[b'z', b'e', b'r', b'o', b's'], ... [b'o', b'n', b'e', b's', b'']]) ['zeros', 'ones'] >>> chars2str([]) [] """ strings = col...
python
def chars2str(chars) -> List[str]: """Inversion function of function |str2chars|. >>> from hydpy.core.netcdftools import chars2str >>> chars2str([[b'z', b'e', b'r', b'o', b's'], ... [b'o', b'n', b'e', b's', b'']]) ['zeros', 'ones'] >>> chars2str([]) [] """ strings = col...
[ "def", "chars2str", "(", "chars", ")", "->", "List", "[", "str", "]", ":", "strings", "=", "collections", ".", "deque", "(", ")", "for", "subchars", "in", "chars", ":", "substrings", "=", "collections", ".", "deque", "(", ")", "for", "char", "in", "s...
Inversion function of function |str2chars|. >>> from hydpy.core.netcdftools import chars2str >>> chars2str([[b'z', b'e', b'r', b'o', b's'], ... [b'o', b'n', b'e', b's', b'']]) ['zeros', 'ones'] >>> chars2str([]) []
[ "Inversion", "function", "of", "function", "|str2chars|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L287-L308
hydpy-dev/hydpy
hydpy/core/netcdftools.py
create_dimension
def create_dimension(ncfile, name, length) -> None: """Add a new dimension with the given name and length to the given NetCDF file. Essentially, |create_dimension| just calls the equally named method of the NetCDF library, but adds information to possible error messages: >>> from hydpy import Test...
python
def create_dimension(ncfile, name, length) -> None: """Add a new dimension with the given name and length to the given NetCDF file. Essentially, |create_dimension| just calls the equally named method of the NetCDF library, but adds information to possible error messages: >>> from hydpy import Test...
[ "def", "create_dimension", "(", "ncfile", ",", "name", ",", "length", ")", "->", "None", ":", "try", ":", "ncfile", ".", "createDimension", "(", "name", ",", "length", ")", "except", "BaseException", ":", "objecttools", ".", "augment_excmessage", "(", "'Whil...
Add a new dimension with the given name and length to the given NetCDF file. Essentially, |create_dimension| just calls the equally named method of the NetCDF library, but adds information to possible error messages: >>> from hydpy import TestIO >>> from hydpy.core.netcdftools import netcdf4 >...
[ "Add", "a", "new", "dimension", "with", "the", "given", "name", "and", "length", "to", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L311-L343
hydpy-dev/hydpy
hydpy/core/netcdftools.py
create_variable
def create_variable(ncfile, name, datatype, dimensions) -> None: """Add a new variable with the given name, datatype, and dimensions to the given NetCDF file. Essentially, |create_variable| just calls the equally named method of the NetCDF library, but adds information to possible error messages: ...
python
def create_variable(ncfile, name, datatype, dimensions) -> None: """Add a new variable with the given name, datatype, and dimensions to the given NetCDF file. Essentially, |create_variable| just calls the equally named method of the NetCDF library, but adds information to possible error messages: ...
[ "def", "create_variable", "(", "ncfile", ",", "name", ",", "datatype", ",", "dimensions", ")", "->", "None", ":", "default", "=", "fillvalue", "if", "(", "datatype", "==", "'f8'", ")", "else", "None", "try", ":", "ncfile", ".", "createVariable", "(", "na...
Add a new variable with the given name, datatype, and dimensions to the given NetCDF file. Essentially, |create_variable| just calls the equally named method of the NetCDF library, but adds information to possible error messages: >>> from hydpy import TestIO >>> from hydpy.core.netcdftools import ...
[ "Add", "a", "new", "variable", "with", "the", "given", "name", "datatype", "and", "dimensions", "to", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L346-L384
hydpy-dev/hydpy
hydpy/core/netcdftools.py
query_variable
def query_variable(ncfile, name) -> netcdf4.Variable: """Return the variable with the given name from the given NetCDF file. Essentially, |query_variable| just performs a key assess via the used NetCDF library, but adds information to possible error messages: >>> from hydpy.core.netcdftools import que...
python
def query_variable(ncfile, name) -> netcdf4.Variable: """Return the variable with the given name from the given NetCDF file. Essentially, |query_variable| just performs a key assess via the used NetCDF library, but adds information to possible error messages: >>> from hydpy.core.netcdftools import que...
[ "def", "query_variable", "(", "ncfile", ",", "name", ")", "->", "netcdf4", ".", "Variable", ":", "try", ":", "return", "ncfile", "[", "name", "]", "except", "(", "IndexError", ",", "KeyError", ")", ":", "raise", "OSError", "(", "'NetCDF file `%s` does not co...
Return the variable with the given name from the given NetCDF file. Essentially, |query_variable| just performs a key assess via the used NetCDF library, but adds information to possible error messages: >>> from hydpy.core.netcdftools import query_variable >>> from hydpy import TestIO >>> from hyd...
[ "Return", "the", "variable", "with", "the", "given", "name", "from", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L387-L415
hydpy-dev/hydpy
hydpy/core/netcdftools.py
query_timegrid
def query_timegrid(ncfile) -> timetools.Timegrid: """Return the |Timegrid| defined by the given NetCDF file. >>> from hydpy.core.examples import prepare_full_example_1 >>> prepare_full_example_1() >>> from hydpy import TestIO >>> from hydpy.core.netcdftools import netcdf4 >>> from hydpy.core.ne...
python
def query_timegrid(ncfile) -> timetools.Timegrid: """Return the |Timegrid| defined by the given NetCDF file. >>> from hydpy.core.examples import prepare_full_example_1 >>> prepare_full_example_1() >>> from hydpy import TestIO >>> from hydpy.core.netcdftools import netcdf4 >>> from hydpy.core.ne...
[ "def", "query_timegrid", "(", "ncfile", ")", "->", "timetools", ".", "Timegrid", ":", "timepoints", "=", "ncfile", "[", "varmapping", "[", "'timepoints'", "]", "]", "refdate", "=", "timetools", ".", "Date", ".", "from_cfunits", "(", "timepoints", ".", "units...
Return the |Timegrid| defined by the given NetCDF file. >>> from hydpy.core.examples import prepare_full_example_1 >>> prepare_full_example_1() >>> from hydpy import TestIO >>> from hydpy.core.netcdftools import netcdf4 >>> from hydpy.core.netcdftools import query_timegrid >>> filepath = 'LahnH...
[ "Return", "the", "|Timegrid|", "defined", "by", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L418-L439
hydpy-dev/hydpy
hydpy/core/netcdftools.py
query_array
def query_array(ncfile, name) -> numpy.ndarray: """Return the data of the variable with the given name from the given NetCDF file. The following example shows that |query_array| returns |nan| entries to represent missing values even when the respective NetCDF variable defines a different fill value...
python
def query_array(ncfile, name) -> numpy.ndarray: """Return the data of the variable with the given name from the given NetCDF file. The following example shows that |query_array| returns |nan| entries to represent missing values even when the respective NetCDF variable defines a different fill value...
[ "def", "query_array", "(", "ncfile", ",", "name", ")", "->", "numpy", ".", "ndarray", ":", "variable", "=", "query_variable", "(", "ncfile", ",", "name", ")", "maskedarray", "=", "variable", "[", ":", "]", "fillvalue_", "=", "getattr", "(", "variable", "...
Return the data of the variable with the given name from the given NetCDF file. The following example shows that |query_array| returns |nan| entries to represent missing values even when the respective NetCDF variable defines a different fill value: >>> from hydpy import TestIO >>> from hydpy....
[ "Return", "the", "data", "of", "the", "variable", "with", "the", "given", "name", "from", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L442-L471
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFInterface.log
def log(self, sequence, infoarray) -> None: """Prepare a |NetCDFFile| object suitable for the given |IOSequence| object, when necessary, and pass the given arguments to its |NetCDFFile.log| method.""" if isinstance(sequence, sequencetools.ModelSequence): descr = sequence.desc...
python
def log(self, sequence, infoarray) -> None: """Prepare a |NetCDFFile| object suitable for the given |IOSequence| object, when necessary, and pass the given arguments to its |NetCDFFile.log| method.""" if isinstance(sequence, sequencetools.ModelSequence): descr = sequence.desc...
[ "def", "log", "(", "self", ",", "sequence", ",", "infoarray", ")", "->", "None", ":", "if", "isinstance", "(", "sequence", ",", "sequencetools", ".", "ModelSequence", ")", ":", "descr", "=", "sequence", ".", "descr_model", "else", ":", "descr", "=", "'no...
Prepare a |NetCDFFile| object suitable for the given |IOSequence| object, when necessary, and pass the given arguments to its |NetCDFFile.log| method.
[ "Prepare", "a", "|NetCDFFile|", "object", "suitable", "for", "the", "given", "|IOSequence|", "object", "when", "necessary", "and", "pass", "the", "given", "arguments", "to", "its", "|NetCDFFile", ".", "log|", "method", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L662-L691
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFInterface.read
def read(self) -> None: """Call method |NetCDFFile.read| of all handled |NetCDFFile| objects. """ for folder in self.folders.values(): for file_ in folder.values(): file_.read()
python
def read(self) -> None: """Call method |NetCDFFile.read| of all handled |NetCDFFile| objects. """ for folder in self.folders.values(): for file_ in folder.values(): file_.read()
[ "def", "read", "(", "self", ")", "->", "None", ":", "for", "folder", "in", "self", ".", "folders", ".", "values", "(", ")", ":", "for", "file_", "in", "folder", ".", "values", "(", ")", ":", "file_", ".", "read", "(", ")" ]
Call method |NetCDFFile.read| of all handled |NetCDFFile| objects.
[ "Call", "method", "|NetCDFFile", ".", "read|", "of", "all", "handled", "|NetCDFFile|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L693-L698
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFInterface.write
def write(self) -> None: """Call method |NetCDFFile.write| of all handled |NetCDFFile| objects. """ if self.folders: init = hydpy.pub.timegrids.init timeunits = init.firstdate.to_cfunits('hours') timepoints = init.to_timepoints('hours') for folder ...
python
def write(self) -> None: """Call method |NetCDFFile.write| of all handled |NetCDFFile| objects. """ if self.folders: init = hydpy.pub.timegrids.init timeunits = init.firstdate.to_cfunits('hours') timepoints = init.to_timepoints('hours') for folder ...
[ "def", "write", "(", "self", ")", "->", "None", ":", "if", "self", ".", "folders", ":", "init", "=", "hydpy", ".", "pub", ".", "timegrids", ".", "init", "timeunits", "=", "init", ".", "firstdate", ".", "to_cfunits", "(", "'hours'", ")", "timepoints", ...
Call method |NetCDFFile.write| of all handled |NetCDFFile| objects.
[ "Call", "method", "|NetCDFFile", ".", "write|", "of", "all", "handled", "|NetCDFFile|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L700-L709
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFInterface.filenames
def filenames(self) -> Tuple[str, ...]: """A |tuple| of names of all handled |NetCDFFile| objects.""" return tuple(sorted(set(itertools.chain( *(_.keys() for _ in self.folders.values())))))
python
def filenames(self) -> Tuple[str, ...]: """A |tuple| of names of all handled |NetCDFFile| objects.""" return tuple(sorted(set(itertools.chain( *(_.keys() for _ in self.folders.values())))))
[ "def", "filenames", "(", "self", ")", "->", "Tuple", "[", "str", ",", "...", "]", ":", "return", "tuple", "(", "sorted", "(", "set", "(", "itertools", ".", "chain", "(", "*", "(", "_", ".", "keys", "(", ")", "for", "_", "in", "self", ".", "fold...
A |tuple| of names of all handled |NetCDFFile| objects.
[ "A", "|tuple|", "of", "names", "of", "all", "handled", "|NetCDFFile|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L718-L721
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFFile.log
def log(self, sequence, infoarray) -> None: """Pass the given |IoSequence| to a suitable instance of a |NetCDFVariableBase| subclass. When writing data, the second argument should be an |InfoArray|. When reading data, this argument is ignored. Simply pass |None|. (1) We prepare...
python
def log(self, sequence, infoarray) -> None: """Pass the given |IoSequence| to a suitable instance of a |NetCDFVariableBase| subclass. When writing data, the second argument should be an |InfoArray|. When reading data, this argument is ignored. Simply pass |None|. (1) We prepare...
[ "def", "log", "(", "self", ",", "sequence", ",", "infoarray", ")", "->", "None", ":", "aggregated", "=", "(", "(", "infoarray", "is", "not", "None", ")", "and", "(", "infoarray", ".", "info", "[", "'type'", "]", "!=", "'unmodified'", ")", ")", "descr...
Pass the given |IoSequence| to a suitable instance of a |NetCDFVariableBase| subclass. When writing data, the second argument should be an |InfoArray|. When reading data, this argument is ignored. Simply pass |None|. (1) We prepare some devices handling some sequences by applying ...
[ "Pass", "the", "given", "|IoSequence|", "to", "a", "suitable", "instance", "of", "a", "|NetCDFVariableBase|", "subclass", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L845-L970
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFFile.filepath
def filepath(self) -> str: """The NetCDF file path.""" return os.path.join(self._dirpath, self.name + '.nc')
python
def filepath(self) -> str: """The NetCDF file path.""" return os.path.join(self._dirpath, self.name + '.nc')
[ "def", "filepath", "(", "self", ")", "->", "str", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "_dirpath", ",", "self", ".", "name", "+", "'.nc'", ")" ]
The NetCDF file path.
[ "The", "NetCDF", "file", "path", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L973-L975
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFFile.read
def read(self) -> None: """Open an existing NetCDF file temporarily and call method |NetCDFVariableDeep.read| of all handled |NetCDFVariableBase| objects.""" try: with netcdf4.Dataset(self.filepath, "r") as ncfile: timegrid = query_timegrid(ncfile) ...
python
def read(self) -> None: """Open an existing NetCDF file temporarily and call method |NetCDFVariableDeep.read| of all handled |NetCDFVariableBase| objects.""" try: with netcdf4.Dataset(self.filepath, "r") as ncfile: timegrid = query_timegrid(ncfile) ...
[ "def", "read", "(", "self", ")", "->", "None", ":", "try", ":", "with", "netcdf4", ".", "Dataset", "(", "self", ".", "filepath", ",", "\"r\"", ")", "as", "ncfile", ":", "timegrid", "=", "query_timegrid", "(", "ncfile", ")", "for", "variable", "in", "...
Open an existing NetCDF file temporarily and call method |NetCDFVariableDeep.read| of all handled |NetCDFVariableBase| objects.
[ "Open", "an", "existing", "NetCDF", "file", "temporarily", "and", "call", "method", "|NetCDFVariableDeep", ".", "read|", "of", "all", "handled", "|NetCDFVariableBase|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L977-L988
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFFile.write
def write(self, timeunit, timepoints) -> None: """Open a new NetCDF file temporarily and call method |NetCDFVariableBase.write| of all handled |NetCDFVariableBase| objects.""" with netcdf4.Dataset(self.filepath, "w") as ncfile: ncfile.Conventions = 'CF-1.6' self._...
python
def write(self, timeunit, timepoints) -> None: """Open a new NetCDF file temporarily and call method |NetCDFVariableBase.write| of all handled |NetCDFVariableBase| objects.""" with netcdf4.Dataset(self.filepath, "w") as ncfile: ncfile.Conventions = 'CF-1.6' self._...
[ "def", "write", "(", "self", ",", "timeunit", ",", "timepoints", ")", "->", "None", ":", "with", "netcdf4", ".", "Dataset", "(", "self", ".", "filepath", ",", "\"w\"", ")", "as", "ncfile", ":", "ncfile", ".", "Conventions", "=", "'CF-1.6'", "self", "."...
Open a new NetCDF file temporarily and call method |NetCDFVariableBase.write| of all handled |NetCDFVariableBase| objects.
[ "Open", "a", "new", "NetCDF", "file", "temporarily", "and", "call", "method", "|NetCDFVariableBase", ".", "write|", "of", "all", "handled", "|NetCDFVariableBase|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L990-L998
hydpy-dev/hydpy
hydpy/core/netcdftools.py
Subdevice2Index.get_index
def get_index(self, name_subdevice) -> int: """Item access to the wrapped |dict| object with a specialized error message.""" try: return self.dict_[name_subdevice] except KeyError: raise OSError( 'No data for sequence `%s` and (sub)device `%s` ' ...
python
def get_index(self, name_subdevice) -> int: """Item access to the wrapped |dict| object with a specialized error message.""" try: return self.dict_[name_subdevice] except KeyError: raise OSError( 'No data for sequence `%s` and (sub)device `%s` ' ...
[ "def", "get_index", "(", "self", ",", "name_subdevice", ")", "->", "int", ":", "try", ":", "return", "self", ".", "dict_", "[", "name_subdevice", "]", "except", "KeyError", ":", "raise", "OSError", "(", "'No data for sequence `%s` and (sub)device `%s` '", "'in Net...
Item access to the wrapped |dict| object with a specialized error message.
[ "Item", "access", "to", "the", "wrapped", "|dict|", "object", "with", "a", "specialized", "error", "message", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1046-L1057
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableBase.log
def log(self, sequence, infoarray) -> None: """Log the given |IOSequence| object either for reading or writing data. The optional `array` argument allows for passing alternative data in an |InfoArray| object replacing the series of the |IOSequence| object, which is useful for wr...
python
def log(self, sequence, infoarray) -> None: """Log the given |IOSequence| object either for reading or writing data. The optional `array` argument allows for passing alternative data in an |InfoArray| object replacing the series of the |IOSequence| object, which is useful for wr...
[ "def", "log", "(", "self", ",", "sequence", ",", "infoarray", ")", "->", "None", ":", "descr_device", "=", "sequence", ".", "descr_device", "self", ".", "sequences", "[", "descr_device", "]", "=", "sequence", "self", ".", "arrays", "[", "descr_device", "]"...
Log the given |IOSequence| object either for reading or writing data. The optional `array` argument allows for passing alternative data in an |InfoArray| object replacing the series of the |IOSequence| object, which is useful for writing modified (e.g. spatially averaged) time s...
[ "Log", "the", "given", "|IOSequence|", "object", "either", "for", "reading", "or", "writing", "data", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1096-L1130
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableBase.insert_subdevices
def insert_subdevices(self, ncfile) -> None: """Insert a variable of the names of the (sub)devices of the logged sequences into the given NetCDF file (1) We prepare a |NetCDFVariableBase| subclass with fixed (sub)device names: >>> from hydpy.core.netcdftools import NetCDFVariab...
python
def insert_subdevices(self, ncfile) -> None: """Insert a variable of the names of the (sub)devices of the logged sequences into the given NetCDF file (1) We prepare a |NetCDFVariableBase| subclass with fixed (sub)device names: >>> from hydpy.core.netcdftools import NetCDFVariab...
[ "def", "insert_subdevices", "(", "self", ",", "ncfile", ")", "->", "None", ":", "prefix", "=", "self", ".", "prefix", "nmb_subdevices", "=", "'%s%s'", "%", "(", "prefix", ",", "dimmapping", "[", "'nmb_subdevices'", "]", ")", "nmb_characters", "=", "'%s%s'", ...
Insert a variable of the names of the (sub)devices of the logged sequences into the given NetCDF file (1) We prepare a |NetCDFVariableBase| subclass with fixed (sub)device names: >>> from hydpy.core.netcdftools import NetCDFVariableBase, chars2str >>> from hydpy import make_abc...
[ "Insert", "a", "variable", "of", "the", "names", "of", "the", "(", "sub", ")", "devices", "of", "the", "logged", "sequences", "into", "the", "given", "NetCDF", "file" ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1168-L1223
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableBase.query_subdevices
def query_subdevices(self, ncfile) -> List[str]: """Query the names of the (sub)devices of the logged sequences from the given NetCDF file (1) We apply function |NetCDFVariableBase.query_subdevices| on an empty NetCDF file. The error message shows that the method tries to query...
python
def query_subdevices(self, ncfile) -> List[str]: """Query the names of the (sub)devices of the logged sequences from the given NetCDF file (1) We apply function |NetCDFVariableBase.query_subdevices| on an empty NetCDF file. The error message shows that the method tries to query...
[ "def", "query_subdevices", "(", "self", ",", "ncfile", ")", "->", "List", "[", "str", "]", ":", "tests", "=", "[", "'%s%s'", "%", "(", "prefix", ",", "varmapping", "[", "'subdevices'", "]", ")", "for", "prefix", "in", "(", "'%s_'", "%", "self", ".", ...
Query the names of the (sub)devices of the logged sequences from the given NetCDF file (1) We apply function |NetCDFVariableBase.query_subdevices| on an empty NetCDF file. The error message shows that the method tries to query the (sub)device names both under the assumptions th...
[ "Query", "the", "names", "of", "the", "(", "sub", ")", "devices", "of", "the", "logged", "sequences", "from", "the", "given", "NetCDF", "file" ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1225-L1274
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableBase.query_subdevice2index
def query_subdevice2index(self, ncfile) -> Subdevice2Index: """Return a |Subdevice2Index| that maps the (sub)device names to their position within the given NetCDF file. Method |NetCDFVariableBase.query_subdevice2index| is based on |NetCDFVariableBase.query_subdevices|. The returned ...
python
def query_subdevice2index(self, ncfile) -> Subdevice2Index: """Return a |Subdevice2Index| that maps the (sub)device names to their position within the given NetCDF file. Method |NetCDFVariableBase.query_subdevice2index| is based on |NetCDFVariableBase.query_subdevices|. The returned ...
[ "def", "query_subdevice2index", "(", "self", ",", "ncfile", ")", "->", "Subdevice2Index", ":", "subdevices", "=", "self", ".", "query_subdevices", "(", "ncfile", ")", "self", ".", "_test_duplicate_exists", "(", "ncfile", ",", "subdevices", ")", "subdev2index", "...
Return a |Subdevice2Index| that maps the (sub)device names to their position within the given NetCDF file. Method |NetCDFVariableBase.query_subdevice2index| is based on |NetCDFVariableBase.query_subdevices|. The returned |Subdevice2Index| object remembers the NetCDF file the (s...
[ "Return", "a", "|Subdevice2Index|", "that", "maps", "the", "(", "sub", ")", "device", "names", "to", "their", "position", "within", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1276-L1322
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableBase.sort_timeplaceentries
def sort_timeplaceentries(self, timeentry, placeentry) -> Tuple[Any, Any]: """Return a |tuple| containing the given `timeentry` and `placeentry` sorted in agreement with the currently selected `timeaxis`. >>> from hydpy.core.netcdftools import NetCDFVariableBase >>> from hydpy import ma...
python
def sort_timeplaceentries(self, timeentry, placeentry) -> Tuple[Any, Any]: """Return a |tuple| containing the given `timeentry` and `placeentry` sorted in agreement with the currently selected `timeaxis`. >>> from hydpy.core.netcdftools import NetCDFVariableBase >>> from hydpy import ma...
[ "def", "sort_timeplaceentries", "(", "self", ",", "timeentry", ",", "placeentry", ")", "->", "Tuple", "[", "Any", ",", "Any", "]", ":", "if", "self", ".", "_timeaxis", ":", "return", "placeentry", ",", "timeentry", "return", "timeentry", ",", "placeentry" ]
Return a |tuple| containing the given `timeentry` and `placeentry` sorted in agreement with the currently selected `timeaxis`. >>> from hydpy.core.netcdftools import NetCDFVariableBase >>> from hydpy import make_abc_testable >>> NCVar = make_abc_testable(NetCDFVariableBase) >>> ...
[ "Return", "a", "|tuple|", "containing", "the", "given", "timeentry", "and", "placeentry", "sorted", "in", "agreement", "with", "the", "currently", "selected", "timeaxis", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1335-L1351
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableBase.get_timeplaceslice
def get_timeplaceslice(self, placeindex) -> \ Union[Tuple[slice, int], Tuple[int, slice]]: """Return a |tuple| for indexing a complete time series of a certain location available in |NetCDFVariableBase.array|. >>> from hydpy.core.netcdftools import NetCDFVariableBase >>> fro...
python
def get_timeplaceslice(self, placeindex) -> \ Union[Tuple[slice, int], Tuple[int, slice]]: """Return a |tuple| for indexing a complete time series of a certain location available in |NetCDFVariableBase.array|. >>> from hydpy.core.netcdftools import NetCDFVariableBase >>> fro...
[ "def", "get_timeplaceslice", "(", "self", ",", "placeindex", ")", "->", "Union", "[", "Tuple", "[", "slice", ",", "int", "]", ",", "Tuple", "[", "int", ",", "slice", "]", "]", ":", "return", "self", ".", "sort_timeplaceentries", "(", "slice", "(", "Non...
Return a |tuple| for indexing a complete time series of a certain location available in |NetCDFVariableBase.array|. >>> from hydpy.core.netcdftools import NetCDFVariableBase >>> from hydpy import make_abc_testable >>> NCVar = make_abc_testable(NetCDFVariableBase) >>> ncvar = NCV...
[ "Return", "a", "|tuple|", "for", "indexing", "a", "complete", "time", "series", "of", "a", "certain", "location", "available", "in", "|NetCDFVariableBase", ".", "array|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1353-L1368
hydpy-dev/hydpy
hydpy/core/netcdftools.py
DeepAndAggMixin.subdevicenames
def subdevicenames(self) -> Tuple[str, ...]: """A |tuple| containing the device names.""" self: NetCDFVariableBase return tuple(self.sequences.keys())
python
def subdevicenames(self) -> Tuple[str, ...]: """A |tuple| containing the device names.""" self: NetCDFVariableBase return tuple(self.sequences.keys())
[ "def", "subdevicenames", "(", "self", ")", "->", "Tuple", "[", "str", ",", "...", "]", ":", "self", ":", "NetCDFVariableBase", "return", "tuple", "(", "self", ".", "sequences", ".", "keys", "(", ")", ")" ]
A |tuple| containing the device names.
[ "A", "|tuple|", "containing", "the", "device", "names", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1396-L1399
hydpy-dev/hydpy
hydpy/core/netcdftools.py
DeepAndAggMixin.write
def write(self, ncfile) -> None: """Write the data to the given NetCDF file. See the general documentation on classes |NetCDFVariableDeep| and |NetCDFVariableAgg| for some examples. """ self: NetCDFVariableBase self.insert_subdevices(ncfile) dimensions = self.dim...
python
def write(self, ncfile) -> None: """Write the data to the given NetCDF file. See the general documentation on classes |NetCDFVariableDeep| and |NetCDFVariableAgg| for some examples. """ self: NetCDFVariableBase self.insert_subdevices(ncfile) dimensions = self.dim...
[ "def", "write", "(", "self", ",", "ncfile", ")", "->", "None", ":", "self", ":", "NetCDFVariableBase", "self", ".", "insert_subdevices", "(", "ncfile", ")", "dimensions", "=", "self", ".", "dimensions", "array", "=", "self", ".", "array", "for", "dimension...
Write the data to the given NetCDF file. See the general documentation on classes |NetCDFVariableDeep| and |NetCDFVariableAgg| for some examples.
[ "Write", "the", "data", "to", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1401-L1414
hydpy-dev/hydpy
hydpy/core/netcdftools.py
AggAndFlatMixin.dimensions
def dimensions(self) -> Tuple[str, ...]: """The dimension names of the NetCDF variable. Usually, the string defined by property |IOSequence.descr_sequence| prefixes the first dimension name related to the location, which allows storing different sequences types in one NetCDF file: ...
python
def dimensions(self) -> Tuple[str, ...]: """The dimension names of the NetCDF variable. Usually, the string defined by property |IOSequence.descr_sequence| prefixes the first dimension name related to the location, which allows storing different sequences types in one NetCDF file: ...
[ "def", "dimensions", "(", "self", ")", "->", "Tuple", "[", "str", ",", "...", "]", ":", "self", ":", "NetCDFVariableBase", "return", "self", ".", "sort_timeplaceentries", "(", "dimmapping", "[", "'nmb_timepoints'", "]", ",", "'%s%s'", "%", "(", "self", "."...
The dimension names of the NetCDF variable. Usually, the string defined by property |IOSequence.descr_sequence| prefixes the first dimension name related to the location, which allows storing different sequences types in one NetCDF file: >>> from hydpy.core.examples import prepare_io_e...
[ "The", "dimension", "names", "of", "the", "NetCDF", "variable", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1421-L1455
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableDeep.get_slices
def get_slices(self, idx, shape) -> Tuple[IntOrSlice, ...]: """Return a |tuple| of one |int| and some |slice| objects to accesses all values of a certain device within |NetCDFVariableDeep.array|. >>> from hydpy.core.netcdftools import NetCDFVariableDeep >>> ncvar = NetCDFVariabl...
python
def get_slices(self, idx, shape) -> Tuple[IntOrSlice, ...]: """Return a |tuple| of one |int| and some |slice| objects to accesses all values of a certain device within |NetCDFVariableDeep.array|. >>> from hydpy.core.netcdftools import NetCDFVariableDeep >>> ncvar = NetCDFVariabl...
[ "def", "get_slices", "(", "self", ",", "idx", ",", "shape", ")", "->", "Tuple", "[", "IntOrSlice", ",", "...", "]", ":", "slices", "=", "list", "(", "self", ".", "get_timeplaceslice", "(", "idx", ")", ")", "for", "length", "in", "shape", ":", "slices...
Return a |tuple| of one |int| and some |slice| objects to accesses all values of a certain device within |NetCDFVariableDeep.array|. >>> from hydpy.core.netcdftools import NetCDFVariableDeep >>> ncvar = NetCDFVariableDeep('test', isolate=False, timeaxis=1) >>> ncvar.get_slices(2...
[ "Return", "a", "|tuple|", "of", "one", "|int|", "and", "some", "|slice|", "objects", "to", "accesses", "all", "values", "of", "a", "certain", "device", "within", "|NetCDFVariableDeep", ".", "array|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1584-L1602
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableDeep.shape
def shape(self) -> Tuple[int, ...]: """Required shape of |NetCDFVariableDeep.array|. For the default configuration, the first axis corresponds to the number of devices, and the second one to the number of timesteps. We show this for the 0-dimensional input sequence |lland_inputs.Nied|: ...
python
def shape(self) -> Tuple[int, ...]: """Required shape of |NetCDFVariableDeep.array|. For the default configuration, the first axis corresponds to the number of devices, and the second one to the number of timesteps. We show this for the 0-dimensional input sequence |lland_inputs.Nied|: ...
[ "def", "shape", "(", "self", ")", "->", "Tuple", "[", "int", ",", "...", "]", ":", "nmb_place", "=", "len", "(", "self", ".", "sequences", ")", "nmb_time", "=", "len", "(", "hydpy", ".", "pub", ".", "timegrids", ".", "init", ")", "nmb_others", "=",...
Required shape of |NetCDFVariableDeep.array|. For the default configuration, the first axis corresponds to the number of devices, and the second one to the number of timesteps. We show this for the 0-dimensional input sequence |lland_inputs.Nied|: >>> from hydpy.core.examples import pr...
[ "Required", "shape", "of", "|NetCDFVariableDeep", ".", "array|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1605-L1649
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableDeep.array
def array(self) -> numpy.ndarray: """The series data of all logged |IOSequence| objects contained in one single |numpy.ndarray|. The documentation on |NetCDFVariableDeep.shape| explains how |NetCDFVariableDeep.array| is structured. The first example confirms that, for the defau...
python
def array(self) -> numpy.ndarray: """The series data of all logged |IOSequence| objects contained in one single |numpy.ndarray|. The documentation on |NetCDFVariableDeep.shape| explains how |NetCDFVariableDeep.array| is structured. The first example confirms that, for the defau...
[ "def", "array", "(", "self", ")", "->", "numpy", ".", "ndarray", ":", "array", "=", "numpy", ".", "full", "(", "self", ".", "shape", ",", "fillvalue", ",", "dtype", "=", "float", ")", "for", "idx", ",", "(", "descr", ",", "subarray", ")", "in", "...
The series data of all logged |IOSequence| objects contained in one single |numpy.ndarray|. The documentation on |NetCDFVariableDeep.shape| explains how |NetCDFVariableDeep.array| is structured. The first example confirms that, for the default configuration, the first axis defi...
[ "The", "series", "data", "of", "all", "logged", "|IOSequence|", "objects", "contained", "in", "one", "single", "|numpy", ".", "ndarray|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1652-L1705
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableDeep.dimensions
def dimensions(self) -> Tuple[str, ...]: """The dimension names of the NetCDF variable. Usually, the string defined by property |IOSequence.descr_sequence| prefixes all dimension names except the second one related to time, which allows storing different sequences in one NetCDF file: ...
python
def dimensions(self) -> Tuple[str, ...]: """The dimension names of the NetCDF variable. Usually, the string defined by property |IOSequence.descr_sequence| prefixes all dimension names except the second one related to time, which allows storing different sequences in one NetCDF file: ...
[ "def", "dimensions", "(", "self", ")", "->", "Tuple", "[", "str", ",", "...", "]", ":", "nmb_timepoints", "=", "dimmapping", "[", "'nmb_timepoints'", "]", "nmb_subdevices", "=", "'%s%s'", "%", "(", "self", ".", "prefix", ",", "dimmapping", "[", "'nmb_subde...
The dimension names of the NetCDF variable. Usually, the string defined by property |IOSequence.descr_sequence| prefixes all dimension names except the second one related to time, which allows storing different sequences in one NetCDF file: >>> from hydpy.core.examples import prepare_i...
[ "The", "dimension", "names", "of", "the", "NetCDF", "variable", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1708-L1745
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableDeep.read
def read(self, ncfile, timegrid_data) -> None: """Read the data from the given NetCDF file. The argument `timegrid_data` defines the data period of the given NetCDF file. See the general documentation on class |NetCDFVariableDeep| for some examples. """ array = ...
python
def read(self, ncfile, timegrid_data) -> None: """Read the data from the given NetCDF file. The argument `timegrid_data` defines the data period of the given NetCDF file. See the general documentation on class |NetCDFVariableDeep| for some examples. """ array = ...
[ "def", "read", "(", "self", ",", "ncfile", ",", "timegrid_data", ")", "->", "None", ":", "array", "=", "query_array", "(", "ncfile", ",", "self", ".", "name", ")", "subdev2index", "=", "self", ".", "query_subdevice2index", "(", "ncfile", ")", "for", "sub...
Read the data from the given NetCDF file. The argument `timegrid_data` defines the data period of the given NetCDF file. See the general documentation on class |NetCDFVariableDeep| for some examples.
[ "Read", "the", "data", "from", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1747-L1762
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableAgg.shape
def shape(self) -> Tuple[int, int]: """Required shape of |NetCDFVariableAgg.array|. For the default configuration, the first axis corresponds to the number of devices, and the second one to the number of timesteps. We show this for the 1-dimensional input sequence |lland_fluxes.NKor|: ...
python
def shape(self) -> Tuple[int, int]: """Required shape of |NetCDFVariableAgg.array|. For the default configuration, the first axis corresponds to the number of devices, and the second one to the number of timesteps. We show this for the 1-dimensional input sequence |lland_fluxes.NKor|: ...
[ "def", "shape", "(", "self", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "return", "self", ".", "sort_timeplaceentries", "(", "len", "(", "hydpy", ".", "pub", ".", "timegrids", ".", "init", ")", ",", "len", "(", "self", ".", "sequences", ...
Required shape of |NetCDFVariableAgg.array|. For the default configuration, the first axis corresponds to the number of devices, and the second one to the number of timesteps. We show this for the 1-dimensional input sequence |lland_fluxes.NKor|: >>> from hydpy.core.examples import pre...
[ "Required", "shape", "of", "|NetCDFVariableAgg", ".", "array|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1824-L1850
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableAgg.array
def array(self) -> numpy.ndarray: """The aggregated data of all logged |IOSequence| objects contained in one single |numpy.ndarray| object. The documentation on |NetCDFVariableAgg.shape| explains how |NetCDFVariableAgg.array| is structured. This first example confirms that, und...
python
def array(self) -> numpy.ndarray: """The aggregated data of all logged |IOSequence| objects contained in one single |numpy.ndarray| object. The documentation on |NetCDFVariableAgg.shape| explains how |NetCDFVariableAgg.array| is structured. This first example confirms that, und...
[ "def", "array", "(", "self", ")", "->", "numpy", ".", "ndarray", ":", "array", "=", "numpy", ".", "full", "(", "self", ".", "shape", ",", "fillvalue", ",", "dtype", "=", "float", ")", "for", "idx", ",", "subarray", "in", "enumerate", "(", "self", "...
The aggregated data of all logged |IOSequence| objects contained in one single |numpy.ndarray| object. The documentation on |NetCDFVariableAgg.shape| explains how |NetCDFVariableAgg.array| is structured. This first example confirms that, under default configuration (`timeaxis=1`), ...
[ "The", "aggregated", "data", "of", "all", "logged", "|IOSequence|", "objects", "contained", "in", "one", "single", "|numpy", ".", "ndarray|", "object", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1853-L1891
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableFlat.shape
def shape(self) -> Tuple[int, int]: """Required shape of |NetCDFVariableFlat.array|. For 0-dimensional sequences like |lland_inputs.Nied| and for the default configuration (`timeaxis=1`), the first axis corresponds to the number of devices, and the second one two the number of t...
python
def shape(self) -> Tuple[int, int]: """Required shape of |NetCDFVariableFlat.array|. For 0-dimensional sequences like |lland_inputs.Nied| and for the default configuration (`timeaxis=1`), the first axis corresponds to the number of devices, and the second one two the number of t...
[ "def", "shape", "(", "self", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "return", "self", ".", "sort_timeplaceentries", "(", "len", "(", "hydpy", ".", "pub", ".", "timegrids", ".", "init", ")", ",", "sum", "(", "len", "(", "seq", ")", ...
Required shape of |NetCDFVariableFlat.array|. For 0-dimensional sequences like |lland_inputs.Nied| and for the default configuration (`timeaxis=1`), the first axis corresponds to the number of devices, and the second one two the number of timesteps: >>> from hydpy.core.examples...
[ "Required", "shape", "of", "|NetCDFVariableFlat", ".", "array|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L1979-L2019
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableFlat.array
def array(self) -> numpy.ndarray: """The series data of all logged |IOSequence| objects contained in one single |numpy.ndarray| object. The documentation on |NetCDFVariableAgg.shape| explains how |NetCDFVariableAgg.array| is structured. The first example confirms that, under de...
python
def array(self) -> numpy.ndarray: """The series data of all logged |IOSequence| objects contained in one single |numpy.ndarray| object. The documentation on |NetCDFVariableAgg.shape| explains how |NetCDFVariableAgg.array| is structured. The first example confirms that, under de...
[ "def", "array", "(", "self", ")", "->", "numpy", ".", "ndarray", ":", "array", "=", "numpy", ".", "full", "(", "self", ".", "shape", ",", "fillvalue", ",", "dtype", "=", "float", ")", "idx0", "=", "0", "idxs", ":", "List", "[", "Any", "]", "=", ...
The series data of all logged |IOSequence| objects contained in one single |numpy.ndarray| object. The documentation on |NetCDFVariableAgg.shape| explains how |NetCDFVariableAgg.array| is structured. The first example confirms that, under default configuration (`timeaxis=1`), the ...
[ "The", "series", "data", "of", "all", "logged", "|IOSequence|", "objects", "contained", "in", "one", "single", "|numpy", ".", "ndarray|", "object", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L2022-L2081
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableFlat.subdevicenames
def subdevicenames(self) -> Tuple[str, ...]: """A |tuple| containing the (sub)device names. Property |NetCDFVariableFlat.subdevicenames| clarifies which row of |NetCDFVariableAgg.array| contains which time series. For 0-dimensional series like |lland_inputs.Nied|, the plain devi...
python
def subdevicenames(self) -> Tuple[str, ...]: """A |tuple| containing the (sub)device names. Property |NetCDFVariableFlat.subdevicenames| clarifies which row of |NetCDFVariableAgg.array| contains which time series. For 0-dimensional series like |lland_inputs.Nied|, the plain devi...
[ "def", "subdevicenames", "(", "self", ")", "->", "Tuple", "[", "str", ",", "...", "]", ":", "stats", ":", "List", "[", "str", "]", "=", "collections", ".", "deque", "(", ")", "for", "devicename", ",", "seq", "in", "self", ".", "sequences", ".", "it...
A |tuple| containing the (sub)device names. Property |NetCDFVariableFlat.subdevicenames| clarifies which row of |NetCDFVariableAgg.array| contains which time series. For 0-dimensional series like |lland_inputs.Nied|, the plain device names are returned >>> from hydpy.core.examp...
[ "A", "|tuple|", "containing", "the", "(", "sub", ")", "device", "names", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L2084-L2123
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableFlat._product
def _product(shape) -> Iterator[Tuple[int, ...]]: """Should return all "subdevice index combinations" for sequences with arbitrary dimensions: >>> from hydpy.core.netcdftools import NetCDFVariableFlat >>> _product = NetCDFVariableFlat.__dict__['_product'].__func__ >>> for comb i...
python
def _product(shape) -> Iterator[Tuple[int, ...]]: """Should return all "subdevice index combinations" for sequences with arbitrary dimensions: >>> from hydpy.core.netcdftools import NetCDFVariableFlat >>> _product = NetCDFVariableFlat.__dict__['_product'].__func__ >>> for comb i...
[ "def", "_product", "(", "shape", ")", "->", "Iterator", "[", "Tuple", "[", "int", ",", "...", "]", "]", ":", "return", "itertools", ".", "product", "(", "*", "(", "range", "(", "nmb", ")", "for", "nmb", "in", "shape", ")", ")" ]
Should return all "subdevice index combinations" for sequences with arbitrary dimensions: >>> from hydpy.core.netcdftools import NetCDFVariableFlat >>> _product = NetCDFVariableFlat.__dict__['_product'].__func__ >>> for comb in _product([1, 2, 3]): ... print(comb) (0...
[ "Should", "return", "all", "subdevice", "index", "combinations", "for", "sequences", "with", "arbitrary", "dimensions", ":" ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L2126-L2141
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableFlat.read
def read(self, ncfile, timegrid_data) -> None: """Read the data from the given NetCDF file. The argument `timegrid_data` defines the data period of the given NetCDF file. See the general documentation on class |NetCDFVariableFlat| for some examples. """ array = ...
python
def read(self, ncfile, timegrid_data) -> None: """Read the data from the given NetCDF file. The argument `timegrid_data` defines the data period of the given NetCDF file. See the general documentation on class |NetCDFVariableFlat| for some examples. """ array = ...
[ "def", "read", "(", "self", ",", "ncfile", ",", "timegrid_data", ")", "->", "None", ":", "array", "=", "query_array", "(", "ncfile", ",", "self", ".", "name", ")", "idxs", ":", "Tuple", "[", "Any", "]", "=", "(", "slice", "(", "None", ")", ",", "...
Read the data from the given NetCDF file. The argument `timegrid_data` defines the data period of the given NetCDF file. See the general documentation on class |NetCDFVariableFlat| for some examples.
[ "Read", "the", "data", "from", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L2143-L2170
hydpy-dev/hydpy
hydpy/core/netcdftools.py
NetCDFVariableFlat.write
def write(self, ncfile) -> None: """Write the data to the given NetCDF file. See the general documentation on class |NetCDFVariableFlat| for some examples. """ self.insert_subdevices(ncfile) create_variable(ncfile, self.name, 'f8', self.dimensions) ncfile[self.na...
python
def write(self, ncfile) -> None: """Write the data to the given NetCDF file. See the general documentation on class |NetCDFVariableFlat| for some examples. """ self.insert_subdevices(ncfile) create_variable(ncfile, self.name, 'f8', self.dimensions) ncfile[self.na...
[ "def", "write", "(", "self", ",", "ncfile", ")", "->", "None", ":", "self", ".", "insert_subdevices", "(", "ncfile", ")", "create_variable", "(", "ncfile", ",", "self", ".", "name", ",", "'f8'", ",", "self", ".", "dimensions", ")", "ncfile", "[", "self...
Write the data to the given NetCDF file. See the general documentation on class |NetCDFVariableFlat| for some examples.
[ "Write", "the", "data", "to", "the", "given", "NetCDF", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L2172-L2180
hydpy-dev/hydpy
hydpy/models/llake/llake_derived.py
NmbSubsteps.update
def update(self): """Determine the number of substeps. Initialize a llake model and assume a simulation step size of 12 hours: >>> from hydpy.models.llake import * >>> parameterstep('1d') >>> simulationstep('12h') If the maximum internal step size is also set to 12 hou...
python
def update(self): """Determine the number of substeps. Initialize a llake model and assume a simulation step size of 12 hours: >>> from hydpy.models.llake import * >>> parameterstep('1d') >>> simulationstep('12h') If the maximum internal step size is also set to 12 hou...
[ "def", "update", "(", "self", ")", ":", "maxdt", "=", "self", ".", "subpars", ".", "pars", ".", "control", ".", "maxdt", "seconds", "=", "self", ".", "simulationstep", ".", "seconds", "self", ".", "value", "=", "numpy", ".", "ceil", "(", "seconds", "...
Determine the number of substeps. Initialize a llake model and assume a simulation step size of 12 hours: >>> from hydpy.models.llake import * >>> parameterstep('1d') >>> simulationstep('12h') If the maximum internal step size is also set to 12 hours, there is only one...
[ "Determine", "the", "number", "of", "substeps", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/llake/llake_derived.py#L25-L67
hydpy-dev/hydpy
hydpy/models/llake/llake_derived.py
VQ.update
def update(self): """Calulate the auxilary term. >>> from hydpy.models.llake import * >>> parameterstep('1d') >>> simulationstep('12h') >>> n(3) >>> v(0., 1e5, 1e6) >>> q(_1=[0., 1., 2.], _7=[0., 2., 5.]) >>> maxdt('12h') >>> derived.seconds.updat...
python
def update(self): """Calulate the auxilary term. >>> from hydpy.models.llake import * >>> parameterstep('1d') >>> simulationstep('12h') >>> n(3) >>> v(0., 1e5, 1e6) >>> q(_1=[0., 1., 2.], _7=[0., 2., 5.]) >>> maxdt('12h') >>> derived.seconds.updat...
[ "def", "update", "(", "self", ")", ":", "con", "=", "self", ".", "subpars", ".", "pars", ".", "control", "der", "=", "self", ".", "subpars", "for", "(", "toy", ",", "qs", ")", "in", "con", ".", "q", ":", "setattr", "(", "self", ",", "str", "(",...
Calulate the auxilary term. >>> from hydpy.models.llake import * >>> parameterstep('1d') >>> simulationstep('12h') >>> n(3) >>> v(0., 1e5, 1e6) >>> q(_1=[0., 1., 2.], _7=[0., 2., 5.]) >>> maxdt('12h') >>> derived.seconds.update() >>> derived.nmbsu...
[ "Calulate", "the", "auxilary", "term", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/llake/llake_derived.py#L74-L95
hydpy-dev/hydpy
hydpy/core/examples.py
prepare_io_example_1
def prepare_io_example_1() -> Tuple[devicetools.Nodes, devicetools.Elements]: # noinspection PyUnresolvedReferences """Prepare an IO example configuration. >>> from hydpy.core.examples import prepare_io_example_1 >>> nodes, elements = prepare_io_example_1() (1) Prepares a short initialisation peri...
python
def prepare_io_example_1() -> Tuple[devicetools.Nodes, devicetools.Elements]: # noinspection PyUnresolvedReferences """Prepare an IO example configuration. >>> from hydpy.core.examples import prepare_io_example_1 >>> nodes, elements = prepare_io_example_1() (1) Prepares a short initialisation peri...
[ "def", "prepare_io_example_1", "(", ")", "->", "Tuple", "[", "devicetools", ".", "Nodes", ",", "devicetools", ".", "Elements", "]", ":", "# noinspection PyUnresolvedReferences", "from", "hydpy", "import", "TestIO", "TestIO", ".", "clear", "(", ")", "from", "hydp...
Prepare an IO example configuration. >>> from hydpy.core.examples import prepare_io_example_1 >>> nodes, elements = prepare_io_example_1() (1) Prepares a short initialisation period of five days: >>> from hydpy import pub >>> pub.timegrids Timegrids(Timegrid('2000-01-01 00:00:00', ...
[ "Prepare", "an", "IO", "example", "configuration", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/examples.py#L17-L156
hydpy-dev/hydpy
hydpy/core/examples.py
prepare_full_example_1
def prepare_full_example_1() -> None: """Prepare the complete `LahnH` project for testing. >>> from hydpy.core.examples import prepare_full_example_1 >>> prepare_full_example_1() >>> from hydpy import TestIO >>> import os >>> with TestIO(): ... print('root:', *sorted(os.listdir('.'))) ...
python
def prepare_full_example_1() -> None: """Prepare the complete `LahnH` project for testing. >>> from hydpy.core.examples import prepare_full_example_1 >>> prepare_full_example_1() >>> from hydpy import TestIO >>> import os >>> with TestIO(): ... print('root:', *sorted(os.listdir('.'))) ...
[ "def", "prepare_full_example_1", "(", ")", "->", "None", ":", "testtools", ".", "TestIO", ".", "clear", "(", ")", "shutil", ".", "copytree", "(", "os", ".", "path", ".", "join", "(", "data", ".", "__path__", "[", "0", "]", ",", "'LahnH'", ")", ",", ...
Prepare the complete `LahnH` project for testing. >>> from hydpy.core.examples import prepare_full_example_1 >>> prepare_full_example_1() >>> from hydpy import TestIO >>> import os >>> with TestIO(): ... print('root:', *sorted(os.listdir('.'))) ... for folder in ('control', 'conditi...
[ "Prepare", "the", "complete", "LahnH", "project", "for", "testing", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/examples.py#L159-L184
hydpy-dev/hydpy
hydpy/core/examples.py
prepare_full_example_2
def prepare_full_example_2(lastdate='1996-01-05') -> ( hydpytools.HydPy, hydpy.pub, testtools.TestIO): """Prepare the complete `LahnH` project for testing. |prepare_full_example_2| calls |prepare_full_example_1|, but also returns a readily prepared |HydPy| instance, as well as module |pub| and ...
python
def prepare_full_example_2(lastdate='1996-01-05') -> ( hydpytools.HydPy, hydpy.pub, testtools.TestIO): """Prepare the complete `LahnH` project for testing. |prepare_full_example_2| calls |prepare_full_example_1|, but also returns a readily prepared |HydPy| instance, as well as module |pub| and ...
[ "def", "prepare_full_example_2", "(", "lastdate", "=", "'1996-01-05'", ")", "->", "(", "hydpytools", ".", "HydPy", ",", "hydpy", ".", "pub", ",", "testtools", ".", "TestIO", ")", ":", "prepare_full_example_1", "(", ")", "with", "testtools", ".", "TestIO", "(...
Prepare the complete `LahnH` project for testing. |prepare_full_example_2| calls |prepare_full_example_1|, but also returns a readily prepared |HydPy| instance, as well as module |pub| and class |TestIO|, for convenience: >>> from hydpy.core.examples import prepare_full_example_2 >>> hp, pub, Test...
[ "Prepare", "the", "complete", "LahnH", "project", "for", "testing", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/examples.py#L187-L224
inkjet/pypostalcode
pypostalcode/__init__.py
PostalCodeDatabase.get_postalcodes_around_radius
def get_postalcodes_around_radius(self, pc, radius): postalcodes = self.get(pc) if postalcodes is None: raise PostalCodeNotFoundException("Could not find postal code you're searching for.") else: pc = postalcodes[0] radius = float(radius) ...
python
def get_postalcodes_around_radius(self, pc, radius): postalcodes = self.get(pc) if postalcodes is None: raise PostalCodeNotFoundException("Could not find postal code you're searching for.") else: pc = postalcodes[0] radius = float(radius) ...
[ "def", "get_postalcodes_around_radius", "(", "self", ",", "pc", ",", "radius", ")", ":", "postalcodes", "=", "self", ".", "get", "(", "pc", ")", "if", "postalcodes", "is", "None", ":", "raise", "PostalCodeNotFoundException", "(", "\"Could not find postal code you'...
Bounding box calculations updated from pyzipcode
[ "Bounding", "box", "calculations", "updated", "from", "pyzipcode" ]
train
https://github.com/inkjet/pypostalcode/blob/077c0085a57c2d24a0bb2596af56d701091fb9f4/pypostalcode/__init__.py#L71-L99
savvastj/nbashots
nbashots/api.py
get_all_player_ids
def get_all_player_ids(ids="shots"): """ Returns a pandas DataFrame containing the player IDs used in the stats.nba.com API. Parameters ---------- ids : { "shots" | "all_players" | "all_data" }, optional Passing in "shots" returns a DataFrame that contains the player IDs of all ...
python
def get_all_player_ids(ids="shots"): """ Returns a pandas DataFrame containing the player IDs used in the stats.nba.com API. Parameters ---------- ids : { "shots" | "all_players" | "all_data" }, optional Passing in "shots" returns a DataFrame that contains the player IDs of all ...
[ "def", "get_all_player_ids", "(", "ids", "=", "\"shots\"", ")", ":", "url", "=", "\"http://stats.nba.com/stats/commonallplayers?IsOnlyCurrentSeason=0&LeagueID=00&Season=2015-16\"", "# get the web page", "response", "=", "requests", ".", "get", "(", "url", ",", "headers", "=...
Returns a pandas DataFrame containing the player IDs used in the stats.nba.com API. Parameters ---------- ids : { "shots" | "all_players" | "all_data" }, optional Passing in "shots" returns a DataFrame that contains the player IDs of all players have shot chart data. It is the default ...
[ "Returns", "a", "pandas", "DataFrame", "containing", "the", "player", "IDs", "used", "in", "the", "stats", ".", "nba", ".", "com", "API", "." ]
train
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/api.py#L251-L320
savvastj/nbashots
nbashots/api.py
get_player_id
def get_player_id(player): """ Returns the player ID(s) associated with the player name that is passed in. There are instances where players have the same name so there are multiple player IDs associated with it. Parameters ---------- player : str The desired player's name in 'Last...
python
def get_player_id(player): """ Returns the player ID(s) associated with the player name that is passed in. There are instances where players have the same name so there are multiple player IDs associated with it. Parameters ---------- player : str The desired player's name in 'Last...
[ "def", "get_player_id", "(", "player", ")", ":", "players_df", "=", "get_all_player_ids", "(", "\"all_data\"", ")", "player", "=", "players_df", "[", "players_df", ".", "DISPLAY_LAST_COMMA_FIRST", "==", "player", "]", "# if there are no plyaers by the given name, raise an...
Returns the player ID(s) associated with the player name that is passed in. There are instances where players have the same name so there are multiple player IDs associated with it. Parameters ---------- player : str The desired player's name in 'Last Name, First Name' format. Passing in ...
[ "Returns", "the", "player", "ID", "(", "s", ")", "associated", "with", "the", "player", "name", "that", "is", "passed", "in", "." ]
train
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/api.py#L323-L350
savvastj/nbashots
nbashots/api.py
get_all_team_ids
def get_all_team_ids(): """Returns a pandas DataFrame with all Team IDs""" df = get_all_player_ids("all_data") df = pd.DataFrame({"TEAM_NAME": df.TEAM_NAME.unique(), "TEAM_ID": df.TEAM_ID.unique()}) return df
python
def get_all_team_ids(): """Returns a pandas DataFrame with all Team IDs""" df = get_all_player_ids("all_data") df = pd.DataFrame({"TEAM_NAME": df.TEAM_NAME.unique(), "TEAM_ID": df.TEAM_ID.unique()}) return df
[ "def", "get_all_team_ids", "(", ")", ":", "df", "=", "get_all_player_ids", "(", "\"all_data\"", ")", "df", "=", "pd", ".", "DataFrame", "(", "{", "\"TEAM_NAME\"", ":", "df", ".", "TEAM_NAME", ".", "unique", "(", ")", ",", "\"TEAM_ID\"", ":", "df", ".", ...
Returns a pandas DataFrame with all Team IDs
[ "Returns", "a", "pandas", "DataFrame", "with", "all", "Team", "IDs" ]
train
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/api.py#L353-L358
savvastj/nbashots
nbashots/api.py
get_team_id
def get_team_id(team_name): """ Returns the team ID associated with the team name that is passed in. Parameters ---------- team_name : str The team name whose ID we want. NOTE: Only pass in the team name (e.g. "Lakers"), not the city, or city and team name, or the team abbrevia...
python
def get_team_id(team_name): """ Returns the team ID associated with the team name that is passed in. Parameters ---------- team_name : str The team name whose ID we want. NOTE: Only pass in the team name (e.g. "Lakers"), not the city, or city and team name, or the team abbrevia...
[ "def", "get_team_id", "(", "team_name", ")", ":", "df", "=", "get_all_team_ids", "(", ")", "df", "=", "df", "[", "df", ".", "TEAM_NAME", "==", "team_name", "]", "if", "len", "(", "df", ")", "==", "0", ":", "er", "=", "\"Invalid team name or there is no t...
Returns the team ID associated with the team name that is passed in. Parameters ---------- team_name : str The team name whose ID we want. NOTE: Only pass in the team name (e.g. "Lakers"), not the city, or city and team name, or the team abbreviation. Returns ------- t...
[ "Returns", "the", "team", "ID", "associated", "with", "the", "team", "name", "that", "is", "passed", "in", "." ]
train
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/api.py#L361-L383
savvastj/nbashots
nbashots/api.py
get_player_img
def get_player_img(player_id): """ Returns the image of the player from stats.nba.com as a numpy array and saves the image as PNG file in the current directory. Parameters ---------- player_id: int The player ID used to find the image. Returns ------- player_img: ndarray ...
python
def get_player_img(player_id): """ Returns the image of the player from stats.nba.com as a numpy array and saves the image as PNG file in the current directory. Parameters ---------- player_id: int The player ID used to find the image. Returns ------- player_img: ndarray ...
[ "def", "get_player_img", "(", "player_id", ")", ":", "url", "=", "\"http://stats.nba.com/media/players/230x185/\"", "+", "str", "(", "player_id", ")", "+", "\".png\"", "img_file", "=", "str", "(", "player_id", ")", "+", "\".png\"", "pic", "=", "urlretrieve", "("...
Returns the image of the player from stats.nba.com as a numpy array and saves the image as PNG file in the current directory. Parameters ---------- player_id: int The player ID used to find the image. Returns ------- player_img: ndarray The multidimensional numpy array of t...
[ "Returns", "the", "image", "of", "the", "player", "from", "stats", ".", "nba", ".", "com", "as", "a", "numpy", "array", "and", "saves", "the", "image", "as", "PNG", "file", "in", "the", "current", "directory", "." ]
train
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/api.py#L386-L406
savvastj/nbashots
nbashots/api.py
TeamLog.get_game_logs
def get_game_logs(self): """Returns team game logs as a pandas DataFrame""" logs = self.response.json()['resultSets'][0]['rowSet'] headers = self.response.json()['resultSets'][0]['headers'] df = pd.DataFrame(logs, columns=headers) df.GAME_DATE = pd.to_datetime(df.GAME_DATE) ...
python
def get_game_logs(self): """Returns team game logs as a pandas DataFrame""" logs = self.response.json()['resultSets'][0]['rowSet'] headers = self.response.json()['resultSets'][0]['headers'] df = pd.DataFrame(logs, columns=headers) df.GAME_DATE = pd.to_datetime(df.GAME_DATE) ...
[ "def", "get_game_logs", "(", "self", ")", ":", "logs", "=", "self", ".", "response", ".", "json", "(", ")", "[", "'resultSets'", "]", "[", "0", "]", "[", "'rowSet'", "]", "headers", "=", "self", ".", "response", ".", "json", "(", ")", "[", "'result...
Returns team game logs as a pandas DataFrame
[ "Returns", "team", "game", "logs", "as", "a", "pandas", "DataFrame" ]
train
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/api.py#L36-L42
savvastj/nbashots
nbashots/api.py
TeamLog.get_game_id
def get_game_id(self, date): """Returns the Game ID associated with the date that is passed in. Parameters ---------- date : str The date associated with the game whose Game ID. The date that is passed in can take on a numeric format of MM/DD/YY (like "01/06/16" ...
python
def get_game_id(self, date): """Returns the Game ID associated with the date that is passed in. Parameters ---------- date : str The date associated with the game whose Game ID. The date that is passed in can take on a numeric format of MM/DD/YY (like "01/06/16" ...
[ "def", "get_game_id", "(", "self", ",", "date", ")", ":", "df", "=", "self", ".", "get_game_logs", "(", ")", "game_id", "=", "df", "[", "df", ".", "GAME_DATE", "==", "date", "]", ".", "Game_ID", ".", "values", "[", "0", "]", "return", "game_id" ]
Returns the Game ID associated with the date that is passed in. Parameters ---------- date : str The date associated with the game whose Game ID. The date that is passed in can take on a numeric format of MM/DD/YY (like "01/06/16" or "01/06/2016") or the expa...
[ "Returns", "the", "Game", "ID", "associated", "with", "the", "date", "that", "is", "passed", "in", "." ]
train
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/api.py#L44-L62