#!/usr/bin/env python

from __future__ import print_function

import sys
import numpy as np

from bmi import MyBMI

def print_var_values (bmi, var_name):
    s = ', '.join ([str (x) for x in bmi.get_value (var_name)])
    print ('%s' % s)

def run ():
    bmi = MyBMI ()

    bmi.initialize (None)

    print ('%s' % bmi.get_component_name ())

    for i in range (10):
        print ('Time %d: ' % i, end='')
        print_var_values (bmi, 'height_above_sea_floor')
        bmi.update ()

    print ('Time %d: ' % i, end='')
    print_var_values (bmi, 'height_above_sea_floor')

    bmi.finalize ()

if __name__ == '__main__':
    run ()


@@ -95,19 +95,23 @@
 rom 
-bmi
+poisson
  import 
 MyBM
@@ -110,155 +110,37 @@
 ort 
-MyBMI%0A%0Adef print_var_values (bmi, var_name):%0A    s = ', '.join (%5Bstr (x) for x in bmi.get_value (var_name)%5D)%0A    print ('%25s' %25 s)
+BmiPoisson%0A
 %0A%0Adef 
-run 
+main
 ():%0A    
 bmi 
@@ -139,28 +139,34 @@
     
-bmi = MyBMI 
+model = BmiPoisson
 ()%0A%0A    
 bmi.
@@ -161,19 +161,21 @@
 ()%0A%0A    
-bmi
+model
 .initial
@@ -181,14 +181,9 @@
 lize
- (None
+(
 )%0A%0A 
@@ -194,17 +194,16 @@
 rint
- 
 ('%25s' %25 
 bmi.
@@ -198,19 +198,21 @@
 ('%25s' %25 
-bmi
+model
 .get_com
@@ -245,14 +245,14 @@
  in 
+x
 range
- 
 (10)
@@ -258,33 +258,32 @@
 ):%0A        print
- 
 ('Time %25d: ' %25 i
@@ -271,39 +271,29 @@
 int('Time %25d
-: 
 ' %25 i
-, end=''
 )%0A        pr
@@ -294,56 +294,74 @@
     
-print_var_values (bmi, 'height_above_sea_floor
+np.savetxt(sys.stdout, model.get_value('land_surface__elevation
 ')
+,
 %0A   
@@ -369,19 +369,51 @@
     
-bmi
+           fmt='%25.3f')%0A        model
 .update
- 
 ()%0A%0A
@@ -421,17 +421,16 @@
    print
- 
 ('Time %25
@@ -434,83 +434,118 @@
 e %25d
-: 
 ' %25 i
-, end='')%0A    print_var_values (bmi, 'height_above_sea_floor
+)%0A    np.savetxt(sys.stdout, model.get_value('land_surface__elevation'),%0A               fmt='%25.3f
 ')%0A%0A    
 bmi.
@@ -544,11 +544,13 @@
     
-bmi
+model
 .fin
@@ -554,21 +554,21 @@
 finalize
- 
 ()%0A%0A
+%0A
 if __nam
@@ -594,12 +594,11 @@
     
-run 
+main
 ()%0A
-%0A

Update to use new bmi model.