class WC(hland_sequences.State2DSequence): """Liquid water content of the snow layer [mm].""" SPAN = (0.0, None) mask = hland_masks.Snow() CONTROLPARAMETERS = (hland_control.WHC, ) def trim(self, lower=None, upper=None): """Trim |WC| following :math:`WC \\leq WHC \\cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep("1d") >>> nmbzones(7) >>> sclass(2) >>> whc(0.1) >>> states.sp = [[0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0], ... [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], ... [-0.2, 0.0, 0.2, -0.2, 0.0, 0.1, 0.2]]) >>> states.wc wc([[0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5], [0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.2]]) """ whc = self.subseqs.seqs.model.parameters.control.whc sp = self.subseqs.sp if upper is None: upper = whc * sp super().trim(lower, upper)
class SP(hland_sequences.State2DSequence): """Frozen water stored in the snow layer [mm].""" SPAN = (None, None) mask = hland_masks.Snow() CONTROLPARAMETERS = (hland_control.WHC, ) def trim(self, lower=None, upper=None): r"""Trim |SP| following :math:`WC \leq WHC \cdot SP`. >>> from hydpy.models.hland import * >>> parameterstep("1d") >>> nmbzones(7) >>> sclass(2) >>> whc(0.1) >>> states.sp([[-1.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0], ... [-2.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0]]) >>> states.sp sp([[0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0], [0.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0]]) >>> states.wc.values = [[-1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0], ... [-1.0, 0.0, 1.0, -1.0, 0.0, 0.5, 1.0]] >>> states.sp([[-1.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0], ... [-2.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0]]) >>> states.sp sp([[0.0, 0.0, 10.0, 5.0, 5.0, 5.0, 10.0], [0.0, 0.0, 10.0, 6.0, 6.0, 6.0, 10.0]]) >>> whc(0.0) >>> states.wc.values = 0.0 >>> states.sp([[-1.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0], ... [-2.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0]]) >>> states.sp sp([[0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0], [0.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0]]) """ whc = self.subseqs.seqs.model.parameters.control.whc wc = self.subseqs.wc if lower is None: wc_values = wc.values.copy() wc_values[numpy.isnan(wc_values)] = 0.0 with numpy.errstate(divide="ignore", invalid="ignore"): lower = numpy.clip(wc_values / whc.values, 0.0, numpy.inf) lower[:, whc.values == 0.0] = 0.0 super().trim(lower, upper)
class In_(hland_sequences.Flux1DSequence): """Snow module release/soil module inflow [mm/T].""" mask = hland_masks.Snow()
class Refr(hland_sequences.Flux2DSequence): """Actual (re)freezing of liquid water stored in the snow layer [mm/T].""" mask = hland_masks.Snow()
class Melt(hland_sequences.Flux2DSequence): """Actual melting of frozen water stored in the snow layer [mm/T].""" mask = hland_masks.Snow()
class WCG(hland_sequences.Flux1DSequence): """Subbasin-internal redistribution gain of the snow's water content [mm/T].""" mask = hland_masks.Snow()
class SPL(hland_sequences.Flux1DSequence): """Subbasin-internal redistribution loss of the snow's ice content [mm/T].""" mask = hland_masks.Snow()