Changeset 6711


Ignore:
Timestamp:
Apr 3, 2009, 12:11:24 PM (15 years ago)
Author:
ole
Message:

Reverted (manually) changeset:6215 and thus reinstated storage of the _range information. It turned out the MIRONE relies on this. Apologies to all.

Location:
anuga_core/source/anuga/shallow_water
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r6595 r6711  
    35713571    other_quantities.remove('z')
    35723572    other_quantities.remove('volumes')
    3573     #try:
    3574     #    other_quantities.remove('stage_range')
    3575     #    other_quantities.remove('xmomentum_range')
    3576     #    other_quantities.remove('ymomentum_range')
    3577     #    other_quantities.remove('elevation_range')
    3578     #except:
    3579     #    pass
     3573    try:
     3574        other_quantities.remove('stage_range')
     3575        other_quantities.remove('xmomentum_range')
     3576        other_quantities.remove('ymomentum_range')
     3577        other_quantities.remove('elevation_range')
     3578    except:
     3579        pass
    35803580
    35813581    conserved_quantities.remove('time')
     
    53385338        j += 1
    53395339
    5340     #if verbose: sww.verbose_quantities(outfile)
     5340    if verbose: sww.verbose_quantities(outfile)
    53415341
    53425342    outfile.close()
     
    59385938                               ('number_of_points',))
    59395939        q = 'elevation'
    5940         #outfile.createVariable(q + Write_sww.RANGE, sww_precision,
    5941         #                       ('numbers_in_range',))
    5942 
    5943 
    5944         ## Initialise ranges with small and large sentinels.
    5945         ## If this was in pure Python we could have used None sensibly
    5946         #outfile.variables[q+Write_sww.RANGE][0] = max_float  # Min
    5947         #outfile.variables[q+Write_sww.RANGE][1] = -max_float # Max
     5940        outfile.createVariable(q + Write_sww.RANGE, sww_precision,
     5941                               ('numbers_in_range',))
     5942
     5943
     5944        # Initialise ranges with small and large sentinels.
     5945        # If this was in pure Python we could have used None sensibly
     5946        outfile.variables[q+Write_sww.RANGE][0] = max_float  # Min
     5947        outfile.variables[q+Write_sww.RANGE][1] = -max_float # Max
    59485948
    59495949        # FIXME: Backwards compatibility
     
    59605960            outfile.createVariable(q, sww_precision, ('number_of_timesteps',
    59615961                                                      'number_of_points'))
    5962             #outfile.createVariable(q + Write_sww.RANGE, sww_precision,
    5963             #                       ('numbers_in_range',))
     5962            outfile.createVariable(q + Write_sww.RANGE, sww_precision,
     5963                                   ('numbers_in_range',))
    59645964
    59655965            # Initialise ranges with small and large sentinels.
    59665966            # If this was in pure Python we could have used None sensibly
    5967             #outfile.variables[q+Write_sww.RANGE][0] = max_float  # Min
    5968             #outfile.variables[q+Write_sww.RANGE][1] = -max_float # Max
     5967            outfile.variables[q+Write_sww.RANGE][0] = max_float  # Min
     5968            outfile.variables[q+Write_sww.RANGE][1] = -max_float # Max
    59695969
    59705970        if type(times) is list or type(times) is num.ArrayType:
     
    60756075        q = 'elevation'
    60766076        # This updates the _range values
    6077         #outfile.variables[q + Write_sww.RANGE][0] = min(elevation)
    6078         #outfile.variables[q + Write_sww.RANGE][1] = max(elevation)
     6077        outfile.variables[q + Write_sww.RANGE][0] = min(elevation)
     6078        outfile.variables[q + Write_sww.RANGE][1] = max(elevation)
    60796079
    60806080
     
    61286128                                q_values.astype(sww_precision)
    61296129       
    6130         #        # This updates the _range values
    6131         #        q_range = outfile.variables[q + Write_sww.RANGE][:]
    6132         #        q_values_min = min(q_values)
    6133         #        if q_values_min < q_range[0]:
    6134         #            outfile.variables[q + Write_sww.RANGE][0] = q_values_min
    6135         #        q_values_max = max(q_values)
    6136         #        if q_values_max > q_range[1]:
    6137         #            outfile.variables[q + Write_sww.RANGE][1] = q_values_max
     6130                # This updates the _range values
     6131                q_range = outfile.variables[q + Write_sww.RANGE][:]
     6132                q_values_min = min(q_values)
     6133                if q_values_min < q_range[0]:
     6134                    outfile.variables[q + Write_sww.RANGE][0] = q_values_min
     6135                q_values_max = max(q_values)
     6136                if q_values_max > q_range[1]:
     6137                    outfile.variables[q + Write_sww.RANGE][1] = q_values_max
    61386138
    61396139    ##
    61406140    # @brief Print the quantities in the underlying file.
    61416141    # @param outfile UNUSED.
    6142     #def verbose_quantities(self, outfile):
    6143     #    print '------------------------------------------------'
    6144     #    print 'More Statistics:'
    6145     #    for q in Write_sww.sww_quantities:
    6146     #        print '  %s in [%f, %f]' % (q,
    6147     #                                    outfile.variables[q+Write_sww.RANGE][0],
    6148     #                                    outfile.variables[q+Write_sww.RANGE][1])
    6149     #    print '------------------------------------------------'
     6142    def verbose_quantities(self, outfile):
     6143        print '------------------------------------------------'
     6144        print 'More Statistics:'
     6145        for q in Write_sww.sww_quantities:
     6146            print '  %s in [%f, %f]' % (q,
     6147                                        outfile.variables[q+Write_sww.RANGE][0],
     6148                                        outfile.variables[q+Write_sww.RANGE][1])
     6149        print '------------------------------------------------'
    61506150
    61516151
     
    64986498
    64996499                # This updates the _range values
    6500                 #q_range = outfile.variables[q + Write_sts.RANGE][:]
    6501                 #q_values_min = min(q_values)
    6502                 #if q_values_min < q_range[0]:
    6503                 #    outfile.variables[q + Write_sts.RANGE][0] = q_values_min
    6504                 #q_values_max = max(q_values)
    6505                 #if q_values_max > q_range[1]:
    6506                 #    outfile.variables[q + Write_sts.RANGE][1] = q_values_max
     6500                q_range = outfile.variables[q + Write_sts.RANGE][:]
     6501                q_values_min = min(q_values)
     6502                if q_values_min < q_range[0]:
     6503                    outfile.variables[q + Write_sts.RANGE][0] = q_values_min
     6504                q_values_max = max(q_values)
     6505                if q_values_max > q_range[1]:
     6506                    outfile.variables[q + Write_sts.RANGE][1] = q_values_max
    65076507
    65086508
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r6595 r6711  
    251251
    252252        # Get the variables
    253         #range = fid.variables['stage_range'][:]
     253        range = fid.variables['stage_range'][:]
    254254        #print range
    255         #assert num.allclose(range,[-0.93519, 0.15]) or\
    256         #       num.allclose(range,[-0.9352743, 0.15]) or\
    257         #       num.allclose(range,[-0.93522203, 0.15000001]) # Old slope limiters
    258        
    259         #range = fid.variables['xmomentum_range'][:]
     255        assert num.allclose(range,[-0.93519, 0.15]) or\
     256               num.allclose(range,[-0.9352743, 0.15]) or\
     257               num.allclose(range,[-0.93522203, 0.15000001]) # Old slope limiters
     258       
     259        range = fid.variables['xmomentum_range'][:]
    260260        ##print range
    261         #assert num.allclose(range,[0,0.4695096]) or \
    262         #       num.allclose(range,[0,0.47790655]) or\
    263         #       num.allclose(range,[0,0.46941957]) or\
    264         #       num.allclose(range,[0,0.47769409])
    265 
    266        
    267         #range = fid.variables['ymomentum_range'][:]
     261        assert num.allclose(range,[0,0.4695096]) or \
     262               num.allclose(range,[0,0.47790655]) or\
     263               num.allclose(range,[0,0.46941957]) or\
     264               num.allclose(range,[0,0.47769409])
     265
     266       
     267        range = fid.variables['ymomentum_range'][:]
    268268        ##print range
    269         #assert num.allclose(range,[0,0.02174380]) or\
    270         #       num.allclose(range,[0,0.02174439]) or\
    271         #       num.allclose(range,[0,0.02283983]) or\
    272         #       num.allclose(range,[0,0.0217342]) or\
    273         #       num.allclose(range,[0,0.0227564]) # Old slope limiters
     269        assert num.allclose(range,[0,0.02174380]) or\
     270               num.allclose(range,[0,0.02174439]) or\
     271               num.allclose(range,[0,0.02283983]) or\
     272               num.allclose(range,[0,0.0217342]) or\
     273               num.allclose(range,[0,0.0227564]) # Old slope limiters
    274274       
    275275        fid.close()
Note: See TracChangeset for help on using the changeset viewer.