Changeset 25028


Ignore:
Timestamp:
06/12/20 09:29:22 (5 years ago)
Author:
jdquinn
Message:

CHG: More fixes for QMU

Location:
issm/trunk-jpl/src/m
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/qmu/normal_uncertain.m

    r25025 r25028  
    3131                        self.stddev=getfieldvalue(options,'stddev');
    3232
    33                         %if the variable is scaled,  a partition vector should have been supplied, and
    34                         %that partition vector should have as many partitions as the mean and stddev
    35                         %vectors:
     33                        %if the variable is scaled,  a partition vector should have been
     34                        %supplied, and that partition vector should have as many partitions
     35                        %as the mean and stddev vectors:
    3636                        if self.isscaled(),
    3737                                self.partition=getfieldvalue(options,'partition');
  • issm/trunk-jpl/src/m/classes/qmu/uniform_uncertain.m

    r25025 r25028  
    3232
    3333                        %if the variable is scaled, a partition vector should have been
    34                         %supplied, and  that partition vector should have as many
    35                         %partitions as the lower and upper vectors:
     34                        %supplied, and that partition vector should have as many partitions
     35                        %as the lower and upper vectors:
    3636                        if self.isscaled(),
    3737                                self.partition=getfieldvalue(options,'partition');
     
    8080                                        error('uniform_uncertain error message: row size of lower and partition size should be identical');
    8181                                end
    82                                 %we need as steps in stddev and mean as there are time steps:
     82                                %we need as steps in upper and lower as there are time steps:
    8383                                if size(self.upper,2)~=self.nsteps,
    8484                                        error('uniform_uncertain error message: col size of upper and number of time steps should be identical');
  • issm/trunk-jpl/src/m/classes/qmu/uniform_uncertain.py

    r24873 r25028  
    66from pairoptions import pairoptions
    77from partition_npart import *
     8from qmupart2npart import qmupart2npart
    89
    910
     
    4344        self.upper      = np.Inf
    4445        self.partition  = []
     46        self.nsteps     = 0
    4547
    4648    @staticmethod
     
    6769
    6870            #initialize fields:
    69             uuv.descriptor = options.getfieldvalue('descriptor', '')
    70             uuv.lower      = options.getfieldvalue('lower', -np.Inf)
    71             uuv.upper      = options.getfieldvalue('upper', np.Inf)
     71            uuv.descriptor = options.getfieldvalue('descriptor')
     72            uuv.lower      = options.getfieldvalue('lower')
     73            uuv.upper      = options.getfieldvalue('upper')
    7274
    7375            #if the variable is scaled, a partition vector should have been
     
    7678            if uuv.isscaled():
    7779                uuv.partition = options.getfieldvalue('partition')
    78                 npart = partition_npart(uuv.partition)
    79                 if npart != len(uuv.upper):
     80                nuv.nsteps = options.getfieldvalue('nsteps', 1)
     81                npart = qmupart2npart(uuv.partition)
     82                if npart != nuv.upper.shape[0]:
    8083                    raise RuntimeError("uniform_uncertain constructor: for the scaled variable %s the upper field is not currently a vector of values for all the partitions described in the partition vector" % uuv.descriptor)
    81                 if npart != len(uuv.lower):
     84                if npart != nuv.lower.shape[0]:
    8285                    raise RuntimeError("uniform_uncertain constructor: for the scaled variable %s the lower field is not currently a vector of values for all the partitions described in the partition vector" % uuv.descriptor)
     86                if nuv.nsteps != nuv.upper.shape[1]:
     87                    raise RuntimeError("uniform_uncertain constructor: for the scaled variable %s the col size of the upper field should be identical to the number of time steps" % nuv.descriptor)
     88                if nuv.nsteps != nuv.lower.shape[1]:
     89                    raise RuntimeError("uniform_uncertain constructor: for the scaled variable %s the col size of the lower field should be identical to the number of time steps" % nuv.descriptor)
    8390
    8491        return [uuv] # Always return a list, so we have something akin to a MATLAB single row matrix
     
    9198        if self.partition != []:
    9299            string = "%s\n%s" % (string, fielddisplay(self, 'partition', 'partition vector defining where sampling will occur'))
     100        string = "%s\n%s" % (string, fielddisplay(self, 'nsteps', 'number of time steps'))
     101
    93102        return string
    94103    #}}}
     
    107116            if self.partition == []:
    108117                raise RuntimeError("uniform_uncertain is a scaled variable, but it's missing a partition vector")
    109             #better have a partition vector that has as many partitions as upper and lower's size:
    110             if len(self.upper) != partition_npart(self.partititon):
    111                 raise RuntimeError("uniform_uncertain error message: upper and partition should be vectors of identical size")
    112             if len(self.lower) != partition_npart(self.partition):
    113                 raise RuntimeError("uniform_uncertain error message: lower and partition should be vectors of identical size")
     118            #better have a partition vector that has as many partitions as
     119            #upper and lower's size:
     120            if self.upper.shape[0] != partition_npart(self.partititon):
     121                raise RuntimeError("uniform_uncertain error message: row size of upper and partition size should be identical")
     122            if self.lower.shape[0] != partition_npart(self.partition):
     123                raise RuntimeError("uniform_uncertain error message: row size of lower and partition size should be identical")
     124            #we need as steps in upper and lower as there are time steps
     125            if self.stddev.shape[1] != self.nsteps:
     126                raise RuntimeError("uniform_uncertain error message: col size of upper and partition size should be identical")
     127            if self.mean.shape[1] != self.nsteps:
     128                raise RuntimeError("uniform_uncertain error message: col size of lower and partition size should be identical")
    114129            md = checkfield(md, 'field', self.partition, 'fieldname', 'uniform_uncertain.partition', 'NaN', 1, 'Inf', 1, '>=', -1, 'numel', [md.mesh.numberofvertices, md.mesh.numberofvertices])
    115130            if self.partition.shape[1] > 1:
  • issm/trunk-jpl/src/m/qmu/setupdesign/QmuSetupVariables.m

    r25025 r25028  
    2424                nlower=length(variables.lower,2);
    2525                nupper=length(variables.upper,2);
    26                 if (nstddev ~= nt || nmean ~=nt),
     26                if (nlower ~= nt || nupper ~= nt),
    2727                        error('QmuSetupVariables error message: upper and lower fields should have the same number of cols as the number of time steps');
    2828                end
  • issm/trunk-jpl/src/m/qmu/setupdesign/QmuSetupVariables.py

    r25022 r25028  
    2626
    2727        if isinstance(variables, uniform_uncertain):
    28             nlower = len(variables.lower)
    29             nupper = len(variables.upper)
     28            nlower = variables.lower.shape[0]
     29            nupper = variables.upper.shape[0]
    3030            if nlower != npart or nupper != npart:
    31                 raise RuntimeError('QmuSetupVariables error message: upper and lower fields should be same size as the number of partitions')
     31                raise RuntimeError('QmuSetupVariables error message: upper and lower fields should have the same number of rows as the number of partitions')
     32            nlower = variables.lower.shape[1]
     33            nupper = variables.upper.shape[1]
     34            if nlower != npart or nupper != npart:
     35                raise RuntimeError('QmuSetupVariables error message: upper and lower fields should have the same number of cols as the number of time steps')
    3236        elif isinstance(variables, normal_uncertain):
    3337            nstddev = variables.stddev.shape[0]
     
    3842            nmean = variables.mean.shape[1]
    3943            if nstddev != nt or nmean != nt:
    40                 raise RuntimeError('QmuSetupVariables error message: stddev and mean fields should have the same number of cols as the number of partitions')
     44                raise RuntimeError('QmuSetupVariables error message: stddev and mean fields should have the same number of cols as the number of time steps')
    4145
    4246        #ok, dealing with semi-discrete distributed variable. Distribute according to how many
Note: See TracChangeset for help on using the changeset viewer.