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
RevLine 
[27032]1Index: ../trunk-jpl/src/m/consistency/checkfield.py
2===================================================================
3--- ../trunk-jpl/src/m/consistency/checkfield.py (revision 26901)
4+++ ../trunk-jpl/src/m/consistency/checkfield.py (revision 26902)
5@@ -113,7 +113,12 @@
6
7 else:
8 if len(np.shape(field)) < len(fieldsize):
9- md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize)))
10+ if fieldsize[-1] > 1:
11+ md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize)))
12+ else:
13+ #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
14+ if np.prod(np.shape(field)) != np.prod(fieldsize):
15+ md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize)))
16 else:
17 for i in range(np.size(fieldsize)):
18 if (not np.isnan(fieldsize[i])) and (np.shape(field)[i] != fieldsize[i]):
Note: See TracBrowser for help on using the repository browser.