Esempio n. 1
0
    def getParamsForNewEntry(self):

        l = []
        not_empty = lambda s: s != ""

        pset = self.getDataModel().getParameterSet()

        p = Parameter(HEADERS[ELEMENT], "", 'Specie Name')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(Parameter(HEADERS[FORMULA], "",
                           "Formula for Species formed at the sorption surface"
                           , not_empty) )

        l.append(Parameter(HEADERS[EQUATION], "",
                           'Association reaction for exchange species.'
                           'The defined species must be the first species to the right of the equal sign.'
                           , self.equationCallback) )

        l.append(Parameter(HEADERS[LOGK], "",
                           'log of the equilibrium constant at 25 Celcius degrees'
                           , IS_NUMBER)  )

        l.append(Parameter(HEADERS[ACTIVITY_LAW], ACTIVITY_LAW_NONE,'Activity Law', values=ACTIVITY_LAWS) )

        l.append( pset.getParam(parameters.DebyeHuckel_a).clone())
        l.append( pset.getParam(parameters.DebyeHuckel_b).clone())

        return l
Esempio n. 2
0
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""
        is_number_or_empty = lambda s: s == "" or IS_NUMBER(s)


        p = Parameter(HEADERS[NAME], "", 'Name')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(Parameter(HEADERS[FORMULA], "",
                           "Chemical Formula for the defined phase. It is extracted from the dissolution reaction."
                           , not_empty) )

        l.append(Parameter(HEADERS[EQUATION], "",
"""
Dissolution reaction for mineral phase to aqueous species.
The phase in the chemical reaction must be the first term of the left member and
has necessary 1 as stoichiometric coefficient.
Aqueous species ( including e-) are given with stoichiometric coefficients and valence.
Example: Forsterite Mg2SiO4 + 4 H+ = SiO2 + 2 H2O + 2 Mg++
""" ,
         self.equationCallback) )

        l.append(Parameter(HEADERS[LOGK], "",
                           'Equilibrium Constant at 25 Celsius degrees.'
                           , IS_NUMBER) )

        l.append(Parameter(HEADERS[DENSITY], "",
                           'Density, leave it empty if not applicable'
                           , is_number_or_empty) )

        return l
Esempio n. 3
0
    def getParamsForNewEntry(self):
        """
        return a list of Parameter instances, intented to create a new entry from scratch
        """

        l = []
        not_empty = lambda s: s != ""

        p = Parameter(HEADERS[ELEMENT], "",
                           'An element name: the element name must begin with a capital letter,\n followed by small ones.\nExamples: Ca or K')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(Parameter(HEADERS[SPECIES], "",
                           'Primary species name, including valence.\nExamples:\n   - For Na: Na+\n   - For Si: H4SiO4'
                           , not_empty) )
        l.append(Parameter(HEADERS[FORMULA], "",
                           'Solution master species formula.\nExamples:\n   - For Na: Na\n   - For Si: SiO2'
                           , not_empty) )

        is_empty_or_positive_number = lambda x: x == "" or IS_POSITIVE_NUMBER(x)
        l.append(Parameter(HEADERS[GFW], "",
                           'gram formula weight of the primary master species (leave it empty if unknown)'
                           , is_empty_or_positive_number ) )

        l.append(Parameter(HEADERS[LOGK], "",
                           'Alkalinity contribution of the master species (0 if N/A)'
                           , IS_NUMBER) )

        return l
Esempio n. 4
0
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""

        p = Parameter(HEADERS[NAME], "","Name of an exchange site, it must begin with a capital letter,"+
        "followed by zero or more lower case letters or underscores (\"_\").")
        p.setCheckFunction(lambda s : re.match("^[A-Z][a-z_]*$", s)  and  self.entryNameCallback(p, s))
        l.append(p)

        l.append(Parameter(HEADERS[FORMULA], "",
                           "Formula for the master exchange species: X- as an example"
                           , not_empty) )

        return l
Esempio n. 5
0
    def getParamsForNewEntry(self):
        l = []

        not_empty = lambda s: s != ""

        p = Parameter(HEADERS[NAME], "", "surface master species name to define or to change\n")
        p.setCheckFunction(lambda s: s != ""  and self.entryNameCallback(p, s))
        l.append(p)

        l.append(Parameter(HEADERS[FORMULA], "",
                           'Formula for the surface master species,\n'
                            ' usually the OH-form of the binding site'
                           , not_empty) )

        return l
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""

        p = Parameter(HEADERS[ELEMENT], "", 'Species Name')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(
            Parameter(
                HEADERS[FORMULA], "",
                "Aqueous Species formula. It is the first right member of the "
                "formation reaction.", not_empty))

        l.append(
            Parameter(
                HEADERS[EQUATION], "",
                'Chemical Formation Reaction : specie is the first term of right member\n'
                ' and so should have a coefficient equals to 1',
                self.equationCallback))

        l.append(
            Parameter(HEADERS[LOGK], "",
                      'Alkalinity contribution of the specie (0 if N/A)',
                      IS_NUMBER))

        return l
Esempio n. 7
0
    def getParamsForNewEntry(self):

        l = []
        not_empty = lambda s: s != ""

#        p = Parameter(HEADERS[ELEMENT], "", 'Specie Name')
#        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
#        l.append(p)

        p = Parameter(HEADERS[EQUATION], "", "Association reaction for surface species.\n"+\
                                             "The defined species must be the first species\n"+\
                                             "to the right of the equal sign.\n")
                                             
        p.setCheckFunction(lambda s: s != "" and self.entryNameCallback(p, s))
        l.append(p)

        l.append(Parameter(HEADERS[LOGK], "","Log K for a master species is 0.0. Default is 0.0.", not_empty))

        return l
Esempio n. 8
0
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""

        p = Parameter(
            HEADERS[NAME], "",
            "Name of an exchange site, it must begin with a capital letter," +
            "followed by zero or more lower case letters or underscores (\"_\")."
        )
        p.setCheckFunction(lambda s: re.match("^[A-Z][a-z_]*$", s) and self.
                           entryNameCallback(p, s))
        l.append(p)

        l.append(
            Parameter(
                HEADERS[FORMULA], "",
                "Formula for the master exchange species: X- as an example",
                not_empty))

        return l
Esempio n. 9
0
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""
        is_number_or_empty = lambda s: s == "" or IS_NUMBER(s)

        p = Parameter(HEADERS[MaterialName], "",
                           'name: name of the material to be given\n in association with an aqeous state\nover a part f the mesh')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(Parameter(HEADERS[EffectivePorosity], "1.0","Eff. Porosity: dimensionless", IS_POSITIVE_NUMBER) )
        l.append(Parameter(HEADERS[EffectiveDiffusion], "4.e-10","Eff. Diffusion in S.I. units: [m2/s]", IS_POSITIVE_NUMBER) )
        l.append(Parameter(HEADERS[LongitudinalDispersivity], "0.0","Long. Dispersivity in S.I. units: [m]", IS_POSITIVE_NUMBER) )
        l.append(Parameter(HEADERS[TransverseDispersivity], "0.0","Trans. Dispersivity in S.I. units: [m]", IS_POSITIVE_NUMBER) )
        l.append(Parameter(HEADERS[MaterialConductivity], "0.0","Thermal Conductivity in S.I. units: [W/m/K]", IS_POSITIVE_NUMBER) )
        l.append(Parameter(HEADERS[SpecificHeatCapacity], "0","Specific Heat Capacity in S.I. units [J/kg/K]", IS_POSITIVE_NUMBER) )
        l.append(Parameter(HEADERS[HydraulicConductivity], "0","Hydraulic Conductivity in S.I. units [m/s]", IS_POSITIVE_NUMBER) )


        return l
Esempio n. 10
0
    def getParamsForNewEntry(self):

        l = []
        not_empty = lambda s: s != ""

        #        p = Parameter(HEADERS[ELEMENT], "", 'Specie Name')
        #        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        #        l.append(p)

        p = Parameter(HEADERS[EQUATION], "", "Association reaction for surface species.\n"+\
                                             "The defined species must be the first species\n"+\
                                             "to the right of the equal sign.\n")

        p.setCheckFunction(lambda s: s != "" and self.entryNameCallback(p, s))
        l.append(p)

        l.append(
            Parameter(HEADERS[LOGK], "",
                      "Log K for a master species is 0.0. Default is 0.0.",
                      not_empty))

        return l
Esempio n. 11
0
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""

        p = Parameter(HEADERS[ELEMENT], "", 'Species Name')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(Parameter(HEADERS[FORMULA], "",
                           "Aqueous Species formula. It is the first right member of the "
                           "formation reaction."
                           , not_empty) )

        l.append(Parameter(HEADERS[EQUATION], "",
                           'Chemical Formation Reaction : specie is the first term of right member\n'
                           ' and so should have a coefficient equals to 1'
                           , self.equationCallback) )

        l.append(Parameter(HEADERS[LOGK], "",
                           'Alkalinity contribution of the specie (0 if N/A)'
                           , IS_NUMBER) )

        return l
Esempio n. 12
0
    def getParamsForNewEntry(self):
        """
        return a list of Parameter instances, intented to create a new entry from scratch
        """

        l = []
        not_empty = lambda s: s != ""

        p = Parameter(
            HEADERS[ELEMENT], "",
            'An element name: the element name must begin with a capital letter,\n followed by small ones.\nExamples: Ca or K'
        )
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(
            Parameter(
                HEADERS[SPECIES], "",
                'Primary species name, including valence.\nExamples:\n   - For Na: Na+\n   - For Si: H4SiO4',
                not_empty))
        l.append(
            Parameter(
                HEADERS[FORMULA], "",
                'Solution master species formula.\nExamples:\n   - For Na: Na\n   - For Si: SiO2',
                not_empty))

        is_empty_or_positive_number = lambda x: x == "" or IS_POSITIVE_NUMBER(x
                                                                              )
        l.append(
            Parameter(
                HEADERS[GFW], "",
                'gram formula weight of the primary master species (leave it empty if unknown)',
                is_empty_or_positive_number))

        l.append(
            Parameter(
                HEADERS[LOGK], "",
                'Alkalinity contribution of the master species (0 if N/A)',
                IS_NUMBER))

        return l
Esempio n. 13
0
    def getParamsForNewEntry(self):

        l = []
        not_empty = lambda s: s != ""

        pset = self.getDataModel().getParameterSet()

        p = Parameter(HEADERS[ELEMENT], "", 'Specie Name')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(
            Parameter(HEADERS[FORMULA], "",
                      "Formula for Species formed at the sorption surface",
                      not_empty))

        l.append(
            Parameter(
                HEADERS[EQUATION], "",
                'Association reaction for exchange species.'
                'The defined species must be the first species to the right of the equal sign.',
                self.equationCallback))

        l.append(
            Parameter(HEADERS[LOGK], "",
                      'log of the equilibrium constant at 25 Celcius degrees',
                      IS_NUMBER))

        l.append(
            Parameter(HEADERS[ACTIVITY_LAW],
                      ACTIVITY_LAW_NONE,
                      'Activity Law',
                      values=ACTIVITY_LAWS))

        l.append(pset.getParam(parameters.DebyeHuckel_a).clone())
        l.append(pset.getParam(parameters.DebyeHuckel_b).clone())

        return l
Esempio n. 14
0
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""
        is_number_or_empty = lambda s: s == "" or IS_NUMBER(s)

        p = Parameter(HEADERS[NAME], "", 'Name')
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(
            Parameter(
                HEADERS[FORMULA], "",
                "Chemical Formula for the defined phase. It is extracted from the dissolution reaction.",
                not_empty))

        l.append(
            Parameter(
                HEADERS[EQUATION], "", """
Dissolution reaction for mineral phase to aqueous species.
The phase in the chemical reaction must be the first term of the left member and
has necessary 1 as stoichiometric coefficient.
Aqueous species ( including e-) are given with stoichiometric coefficients and valence.
Example: Forsterite Mg2SiO4 + 4 H+ = SiO2 + 2 H2O + 2 Mg++
""", self.equationCallback))

        l.append(
            Parameter(HEADERS[LOGK], "",
                      'Equilibrium Constant at 25 Celsius degrees.',
                      IS_NUMBER))

        l.append(
            Parameter(HEADERS[DENSITY], "",
                      'Density, leave it empty if not applicable',
                      is_number_or_empty))

        return l
Esempio n. 15
0
    def getParamsForNewEntry(self):
        l = []
        not_empty = lambda s: s != ""
        is_number_or_empty = lambda s: s == "" or IS_NUMBER(s)

        p = Parameter(
            HEADERS[MaterialName], "",
            'name: name of the material to be given\n in association with an aqeous state\nover a part f the mesh'
        )
        p.setCheckFunction(lambda v: self.entryNameCallback(p, v))
        l.append(p)

        l.append(
            Parameter(HEADERS[EffectivePorosity], "1.0",
                      "Eff. Porosity: dimensionless", IS_POSITIVE_NUMBER))
        l.append(
            Parameter(HEADERS[EffectiveDiffusion], "4.e-10",
                      "Eff. Diffusion in S.I. units: [m2/s]",
                      IS_POSITIVE_NUMBER))
        l.append(
            Parameter(HEADERS[LongitudinalDispersivity], "0.0",
                      "Long. Dispersivity in S.I. units: [m]",
                      IS_POSITIVE_NUMBER))
        l.append(
            Parameter(HEADERS[TransverseDispersivity], "0.0",
                      "Trans. Dispersivity in S.I. units: [m]",
                      IS_POSITIVE_NUMBER))
        l.append(
            Parameter(HEADERS[MaterialConductivity], "0.0",
                      "Thermal Conductivity in S.I. units: [W/m/K]",
                      IS_POSITIVE_NUMBER))
        l.append(
            Parameter(HEADERS[SpecificHeatCapacity], "0",
                      "Specific Heat Capacity in S.I. units [J/kg/K]",
                      IS_POSITIVE_NUMBER))
        l.append(
            Parameter(HEADERS[HydraulicConductivity], "0",
                      "Hydraulic Conductivity in S.I. units [m/s]",
                      IS_POSITIVE_NUMBER))

        return l
Esempio n. 16
0
        edit.SetToolTipString(p.getDescription())
        return edit


if __name__ == '__main__':

    from geoi.parameter import Parameter, IS_POSITIVE_NUMBER

    app = wx.App(0)
    f = wx.Frame(None, -1, "test")

    l = []
    not_empty = lambda s: s != ""
    l.append(
        Parameter(
            "blahblah", "fefedfgdgdddddddddddddddddddddddddf",
            'Species Name: the element name must begin with a capital letter',
            not_empty))

    l.append(
        Parameter("FORMULA", "",
                  'Aqueous Species formula.\nExamples:\n   BF2(OH)2-',
                  not_empty))

    l.append(
        Parameter("Alkalinity", 12.46464645,
                  'Alkalinity contribution of the specie (0 if N/A)',
                  IS_POSITIVE_NUMBER))

    l.append(
        Parameter(
            "equation", "dsfqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",