Changeset 26902


Ignore:
Timestamp:
02/25/22 00:14:27 (3 years ago)
Author:
bdef
Message:

CHG:relaxing some formating requirement on checkfield

File:
1 edited

Legend:

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

    r26856 r26902  
    114114        else:
    115115            if len(np.shape(field)) < len(fieldsize):
    116                 md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize)))
     116                if fieldsize[-1] > 1:
     117                    md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize)))
     118                else:
     119                    #The last dimension is one that follows matlab 2D array regulation but usually not what we do in python, we allow the difference in shape only if the number of element is equal
     120                    if np.prod(np.shape(field)) != np.prod(fieldsize):
     121                        md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize)))
    117122            else:
    118123                for i in range(np.size(fieldsize)):
Note: See TracChangeset for help on using the changeset viewer.