Ignore:
Timestamp:
Apr 3, 2009, 12:11:24 PM (16 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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.