- Timestamp:
- Sep 5, 2007, 4:42:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r4663 r4704 431 431 raise ValueError, msg 432 432 433 434 def get_textual_float(value, format = '%.2f'): 435 """Get textual representation of floating point numbers 436 and accept None as valid entry 437 438 format is a string - default = '%.2f' 439 """ 440 441 if value is None: 442 return 'None' 443 else: 444 try: 445 float(value) 446 except: 447 # May this is a vector 448 if len(value) > 1: 449 s = '(' 450 for v in value: 451 s += get_textual_float(v, format) + ', ' 452 453 s = s[:-2] + ')' # Strip trailing comma and close 454 return s 455 else: 456 raise 'Illegal input to get_textual_float:', value 457 else: 458 return format %float(value) 433 459 434 460
Note: See TracChangeset
for help on using the changeset viewer.