How to use the pastas.stressmodels.StressModelBase.__init__ function in pastas

To help you get started, we’ve selected a few pastas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pastas / pastas / pastas / stressmodels.py View on Github external
def __init__(self, name="constant", initial=0.0):
        StressModelBase.__init__(self, One, name, pd.Timestamp.min,
                                 pd.Timestamp.max, None, initial, 0)
        self.set_init_parameters()
github pastas / pastas / pastas / stressmodels.py View on Github external
def __init__(self, stress, rfunc, name, up=True, cutoff=0.999,
                 settings=None, metadata=None, meanstress=None):
        if isinstance(stress, list):
            stress = stress[0]  # Temporary fix Raoul, 2017-10-24

        stress = TimeSeries(stress, settings=settings, metadata=metadata)

        if meanstress is None:
            meanstress = stress.series.std()

        StressModelBase.__init__(self, rfunc, name, stress.series.index.min(),
                                 stress.series.index.max(), up, meanstress,
                                 cutoff)
        self.freq = stress.settings["freq"]
        self.stress = [stress]
        self.set_init_parameters()
github pastas / pastas / pastas / stressmodels.py View on Github external
def __init__(self, name="linear_trend", start=0, end=0):
        StressModelBase.__init__(self, One, name, pd.Timestamp.min,
                                 pd.Timestamp.max, 1, 0, 0)
        self.start = start
        self.end = end
        self.set_init_parameters()
github pastas / pastas / pastas / stressmodels.py View on Github external
def __init__(self, name, value=0.0, pmin=np.nan, pmax=np.nan):
        self.nparam = 1
        self.value = value
        self.pmin = pmin
        self.pmax = pmax
        self.name = "constant"
        StressModelBase.__init__(self, One, name, pd.Timestamp.min,
                                 pd.Timestamp.max, 1, 0, 0)
        self.set_init_parameters()
github pastas / pastas / pastas / stressmodels.py View on Github external
# Select indices from validated stress where both series are available.
        index = self.prec.series.index.intersection(self.evap.series.index)
        if index.empty:
            msg = ('The stresses that were provided have no overlapping '
                   'time indices. Please make sure the indices of the time '
                   'series overlap.')
            logger.error(msg)
            raise Exception(msg)

        # Calculate initial recharge estimation for initial rfunc parameters
        p = self.recharge.get_init_parameters().initial.values
        meanstress = self.get_stress(p=p, tmin=index.min(), tmax=index.max(),
                                     freq=self.prec.settings["freq"]).std()

        StressModelBase.__init__(self, rfunc=rfunc, name=name,
                                 tmin=index.min(), tmax=index.max(),
                                 meanstress=meanstress, cutoff=cutoff,
                                 up=True)

        self.stress = [self.prec, self.evap]
        if self.temp:
            self.stress.append(self.temp)
        self.freq = self.prec.settings["freq"]
        self.set_init_parameters()

        self.nsplit = 1
github pastas / pastas / pastas / stressmodels.py View on Github external
self.sort_wells = sort_wells
        if self.sort_wells:
            stress = [s for _, s in sorted(zip(distances, stress),
                                           key=lambda pair: pair[0])]
            if isinstance(settings, list):
                settings = [s for _, s in sorted(zip(distances, settings),
                                                 key=lambda pair: pair[0])]
            distances.sort()

        # get largest std for meanstress
        meanstress = np.max([s.series.std() for s in stress])

        tmin = pd.Timestamp.max
        tmax = pd.Timestamp.min

        StressModelBase.__init__(self, rfunc, name, tmin, tmax,
                                 up, meanstress, cutoff)

        if settings is None or isinstance(settings, str):
            settings = len(stress) * [None]

        self.stress = self.handle_stress(stress, settings)

        # Check if number of stresses and distances match
        if len(self.stress) != len(distances):
            msg = "The number of stresses applied does not match the  number" \
                  "of distances provided."
            logger.error(msg)
            raise ValueError(msg)
        else:
            self.distances = distances
github pastas / pastas / pastas / stressmodels.py View on Github external
def __init__(self, tstart, name, rfunc=One, up=None):
        StressModelBase.__init__(self, rfunc, name, pd.Timestamp.min,
                                 pd.Timestamp.max, up, 1.0, 0.99)
        self.tstart = pd.Timestamp(tstart)
        self.set_init_parameters()
github pastas / pastas / pastas / stressmodels.py View on Github external
def __init__(self, stress, name="factor", settings=None, metadata=None):
        if isinstance(stress, list):
            stress = stress[0]  # Temporary fix Raoul, 2017-10-24
        tmin = stress.series_original.index.min()
        tmax = stress.series_original.index.max()
        StressModelBase.__init__(self, One, name, tmin=tmin, tmax=tmax,
                                 up=True, meanstress=1, cutoff=0.999)
        self.value = 1.  # Initial value
        stress = TimeSeries(stress, settings=settings, metadata=metadata)
        self.stress = [stress]
        self.set_init_parameters()
github pastas / pastas / pastas / stressmodels.py View on Github external
def __init__(self, t_step, name, rfunc=One, up=True):
        assert t_step is not None, 'Error: Need to specify time of step (for now this will not be optimized)'
        StressModelBase.__init__(self, rfunc, name, pd.Timestamp.min,
                                 pd.Timestamp.max, up, 1.0, None)
        self.t_step = t_step
        self.set_init_parameters()