Changeset 23705


Ignore:
Timestamp:
02/08/19 02:31:06 (6 years ago)
Author:
bdef
Message:

BUG: vlaues have never been check against field values (checked against string) this might break a few tests for good reasons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/consistency/checkfield.py

    r23562 r23705  
    22import os
    33from pairoptions import pairoptions
     4from operator import attrgetter
    45import MatlabFuncs as m
    56
     
    101102                                "NaN values found in field '%s'" % fieldname))
    102103
    103 
    104104        #check Inf
    105105        if options.getfieldvalue('Inf',0):
     
    107107                        md = md.checkmessage(options.getfieldvalue('message',\
    108108                                "Inf values found in field '%s'" % fieldname))
    109 
    110109
    111110        #check cell
     
    132131        if options.exist('>='):
    133132                lowerbound = options.getfieldvalue('>=')
     133                if type(lowerbound) is str:
     134                        lowerbound=attrgetter(lowerbound)(md)
    134135                if np.size(lowerbound)>1: #checking elementwise
    135136                        if any(field<upperbound):
     
    150151        if options.exist('>'):
    151152                lowerbound=options.getfieldvalue('>')
     153                if type(lowerbound) is str:
     154                        lowerbound=attrgetter(lowerbound)(md)
    152155                if np.size(lowerbound)>1: #checking elementwise
    153156                        if any(field<=upperbound):
     
    169172        if options.exist('<='):
    170173                upperbound=options.getfieldvalue('<=')
     174                if type(upperbound) is str:
     175                        upperbound=attrgetter(upperbound)(md)
    171176                if np.size(upperbound)>1: #checking elementwise
    172177                        if any(field>upperbound):
     
    186191        if options.exist('<'):
    187192                upperbound=options.getfieldvalue('<')
     193                if type(upperbound) is str:
     194                        upperbound=attrgetter(upperbound)(md)
    188195                if np.size(upperbound)>1: #checking elementwise
    189196                        if any(field>=upperbound):
     
    199206                                else:
    200207                                        maxval=np.nanmax(field[0])
    201 
    202208                                if maxval>=upperbound:
    203                                         md = md.checkmessage(options.getfieldvalue('message',"field '%s' should have values below %d" % (fieldname,upperbound)))
     209                                        md = md.checkmessage(options.getfieldvalue('message',"field '{}' should have values below {}".format(fieldname,upperbound)))
    204210
    205211        #check file
Note: See TracChangeset for help on using the changeset viewer.