source: issm/oecreview/Archive/26740-27031/ISSM-26901-26902.diff@ 27032

Last change on this file since 27032 was 27032, checked in by Mathieu Morlighem, 3 years ago

CHG: added 26740-27031

File size: 1.3 KB
  • ../trunk-jpl/src/m/consistency/checkfield.py

     
    113113
    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)):
    119124                    if (not np.isnan(fieldsize[i])) and (np.shape(field)[i] != fieldsize[i]):
Note: See TracBrowser for help on using the repository browser.