Changeset 26901 for issm/trunk-jpl/test/NightlyRun/runme.py
- Timestamp:
- 02/25/22 00:11:37 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/test/NightlyRun/runme.py
r26857 r26901 18 18 try: 19 19 from arch import archread 20 except: # ISSM_DIR is not on path20 except: # ISSM_DIR is not on path 21 21 import devpath 22 22 … … 133 133 test_ids = test_ids.difference(exclude_ids) 134 134 # }}} 135 if procedure == 'runFromNC': 136 #That is a bamg test 137 test_ids = test_ids.difference([119, 514]) 138 # that is smbGEMB format is weird for the test 139 test_ids = test_ids.difference([243, 244, 252, 253]) 140 #those are amr runs where the index is missing from fieldnames 141 test_ids = test_ids.difference([462, 463, 464, 465]) 142 #test247 solves for thermal and transient which makes it complex to check 143 test_ids = test_ids.difference([247]) 144 #test 902 is running two models with different stepping 145 test_ids = test_ids.difference([902]) 146 #I have a size issue in 517 needs investigation 147 test_ids = test_ids.difference([517]) 148 135 149 #Process Ids according to benchmarks {{{ 136 150 if benchmark == 'nightly': … … 200 214 if 'Solution' in key: 201 215 solvetype = split('Solution', key)[0] 216 217 #we save the results, scrap them and solve. 218 loaded_res = mdl.results 202 219 mdl.results = [] 203 220 mdl = solve(mdl, solvetype) 221 222 #we loop on the field_names from the nghtly test 204 223 for k, fieldname in enumerate(Tmod.field_names): 205 224 try: 225 #first look for indexing 206 226 if search(r'\d+$', fieldname): 207 227 index = int(search(r'\d+$', fieldname).group()) - 1 208 228 fieldname = fieldname[:search(r'\d+$', fieldname).start()] 209 el se:229 elif 'FirstStep' in fieldname: 210 230 index = 0 211 #Get field from nc run 231 fieldname = fieldname[:search('FirstStep', fieldname).start()] 232 elif 'SecondStep' in fieldname: 233 index = 1 234 fieldname = fieldname[:search('SecondStep', fieldname).start()] 235 elif 'ThirdStep' in fieldname: 236 index = 2 237 fieldname = fieldname[:search('ThirdStep', fieldname).start()] 238 else: 239 index = 0 240 241 #Then check if the key exists in the loaded results 242 try: 243 reskeys = mdl.results.__dict__[solvetype + 'Solution'][index].__dict__.keys() 244 except TypeError: 245 # most probably a steady state so no subscripting 246 reskeys = mdl.results.__dict__[solvetype + 'Solution'].__dict__.keys() 247 if fieldname not in reskeys: 248 sufixes = ["P1bubble", "P1bubbleCondensed", "LliboutryDuval", "CuffeyTemperate", "SSA", "HO", "FS", "P1xP", "P2xP", 249 'MINI', 'MINIcondensed', 'TaylorHood', 'XTaylorHood', 'LATaylorHood', 'CrouzeixRaviart', 'LACrouzeixRaviart'] 250 namedifs = {'Misfits': 'J', 251 'D': 'DamageDbar', 252 'F': 'DamageF', 253 'MaterialsRheologyB': 'MaterialsRheologyBbar', 254 'SedimentWaterHead': 'SedimentHead', 255 'EplWaterHead': 'EplHead', 256 'SedimentWaterHeadSubstep': 'SedimentHeadSubstep', 257 'EplWaterHeadSubstep': 'EplHeadSubstep', 258 'Volume': 'IceVolume', 259 'Bed': 'Base', 260 'SMB': 'SmbMassBalance'} 261 262 if fieldname in namedifs.keys(): 263 #Some fields are not consistent 264 fieldname = namedifs[fieldname] 265 elif any([suf in fieldname for suf in sufixes]): 266 #some test have loops that mess up with naming 267 try: 268 sufix = sufixes[np.squeeze(np.where([suf in fieldname for suf in sufixes]))] 269 except TypeError: 270 #probably severalmatches, we take the last one which should be the good one (Needs to be controled in the list above) 271 sufix = sufixes[np.squeeze(np.where([suf in fieldname for suf in sufixes]))[-1]] 272 fieldname = fieldname[:search(sufix, fieldname).start()] 273 elif fieldname.endswith("P") and index == 1: 274 #we are looking for P2 but 2 as been considered as an index and so shifted by -1 275 fieldname = fieldname[:-1] 276 else: 277 # could be that the index selected above is part of the name 278 fieldname = fieldname + str(index + 1) 212 279 try: 213 280 field = mdl.results.__dict__[solvetype + 'Solution'][index].__dict__[fieldname] 281 loaded_field = loaded_res.__dict__[solvetype + 'Solution'][index].__dict__[fieldname] 282 except TypeError: 283 # most probably a steady state so no subscripting 284 try: 285 field = mdl.results.__dict__[solvetype + 'Solution'].__dict__[fieldname] 286 loaded_field = loaded_res.__dict__[solvetype + 'Solution'].__dict__[fieldname] 287 except KeyError: 288 print("WARNING: {}{} does not exist and checking will be skipped".format(fieldname, index + 1)) 289 continue 214 290 except KeyError: 215 print("WARNING: {} does not exist and checking will be skipped".format(fieldname))291 print("WARNING: {}{} does not exist and checking will be skipped".format(fieldname, index + 1)) 216 292 continue 217 #Get reference from std run 293 218 294 ref = Tmod.field_values[k] 219 295 #Get tolerance 220 296 tolerance = Tmod.field_tolerances[k] 297 #compute differences for the results computed from the nc file 221 298 error_diff = np.amax(np.abs(ref - field), axis=0) / (np.amax(np.abs(ref), axis=0) + float_info.epsilon) 222 299 if not np.isscalar(error_diff): 223 300 error_diff = error_diff[0] 224 301 302 #compute the differences for the results of the nc file 303 load_diff = np.amax(np.abs(np.squeeze(ref) - loaded_field), axis=0) / (np.amax(np.abs(np.squeeze(ref)), axis=0) + float_info.epsilon) 304 if not np.isscalar(load_diff): 305 load_diff = load_diff[0] 306 225 307 #disp test result 226 if (np.any(error_diff > tolerance) or np.isnan(error_diff)): 227 print(('ERROR difference: {:7.2g} > {:7.2g} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname))) 308 if (np.any(error_diff > tolerance) or np.isnan(error_diff)) and (np.any(load_diff > tolerance) or np.isnan(load_diff)): 309 if abs(error_diff - load_diff) < tolerance: 310 print(('WARNING difference: {:7.2g} > {:7.2g} test id: {} field: {}{} differs from computation but equal to saved results'.format(error_diff, tolerance, id, fieldname, index + 1))) 311 else: 312 print(('ERROR difference: {:7.2g} > {:7.2g} test id: {} field: {}{} is false in both loaded and computed results'.format(error_diff, tolerance, id, fieldname, index + 1))) 313 errorcount += 1 314 erroredtest_list.append(id) 315 elif (np.any(error_diff > tolerance) or np.isnan(error_diff)): 316 print(('ERROR difference: {:7.2g} > {:7.2g} test id: {} test name: {} field: {}{}'.format(error_diff, tolerance, id, id_string, fieldname, index + 1))) 228 317 errorcount += 1 229 318 erroredtest_list.append(id) 230 else: 231 print(('SUCCESS difference: {:7.2g} < {:7.2g} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname))) 319 elif (np.any(load_diff > tolerance) or np.isnan(load_diff)): 320 print(('SAVEERROR difference: {:7.2g} > {:7.2g} test id: {} test name: {} saved result : {}{}'.format(load_diff, tolerance, id, id_string, fieldname, index + 1))) 321 errorcount += 1 322 erroredtest_list.append(id) 323 else: 324 print(('SUCCESS difference: {:7.2g} < {:7.2g} test id: {} test name: {} field: {}{}'.format(error_diff, tolerance, id, id_string, fieldname, index + 1))) 325 #disp only if errors for the results 232 326 233 327 except Exception as message:
Note:
See TracChangeset
for help on using the changeset viewer.