Changeset 7308 for anuga_core/source/anuga/shallow_water/data_manager.py
- Timestamp:
- Jul 12, 2009, 10:53:38 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r7276 r7308 3083 3083 else: 3084 3084 jmin = num.searchsorted(times, mint) 3085 3086 # numpy.int32 didn't work in slicing of amplitude below 3087 jmin = int(jmin) 3085 3088 3086 3089 if maxt is None: … … 3089 3092 else: 3090 3093 jmax = num.searchsorted(times, maxt) 3094 3095 # numpy.int32 didn't work in slicing of amplitude below 3096 jmax = int(jmax) 3091 3097 3092 3098 kmin, kmax, lmin, lmax = _get_min_max_indexes(latitudes[:], … … 3123 3129 # 'print hmmm' 3124 3130 3125 # Get missing values3131 # Get missing values 3126 3132 nan_ha = file_h.variables['HA'].missing_value[0] 3127 3133 nan_ua = file_u.variables['UA'].missing_value[0] … … 3132 3138 nan_e = None 3133 3139 3134 # Cleanup3140 # Cleanup 3135 3141 missing = (amplitudes == nan_ha) 3136 3142 if num.sometrue (missing): … … 3828 3834 if verbose: print 'Reading DEM from %s' % inname 3829 3835 3830 # Read metadata3831 ncols = in file.ncols[0]3832 nrows = in file.nrows[0]3836 # Read metadata (convert from numpy.int32 to int where appropriate) 3837 ncols = int(infile.ncols[0]) 3838 nrows = int(infile.nrows[0]) 3833 3839 xllcorner = infile.xllcorner[0] 3834 3840 yllcorner = infile.yllcorner[0] 3835 cellsize = in file.cellsize[0]3836 NODATA_value = in file.NODATA_value[0]3837 zone = in file.zone[0]3841 cellsize = int(infile.cellsize[0]) 3842 NODATA_value = int(infile.NODATA_value[0]) 3843 zone = int(infile.zone[0]) 3838 3844 false_easting = infile.false_easting[0] 3839 3845 false_northing = infile.false_northing[0] … … 3860 3866 nrows_new = 1 + (nrows - nrows_stencil) / cellsize_ratio 3861 3867 3868 #print type(ncols_new), ncols_new 3869 3862 3870 #Open netcdf file for output 3863 3871 outfile = NetCDFFile(outname, netcdf_mode_w) … … 3885 3893 3886 3894 # dimension definition 3895 #print nrows_new, ncols_new, nrows_new*ncols_new 3896 #print type(nrows_new), type(ncols_new), type(nrows_new*ncols_new) 3887 3897 outfile.createDimension('number_of_points', nrows_new*ncols_new) 3888 3898 … … 6102 6112 Maybe make this general, but the viewer assumes these quantities, 6103 6113 so maybe we don't want it general - unless the viewer is general 6104 6105 precon 6106 triangulation and 6107 header have been called. 6114 6115 The argument sww_precision allows for storing as either 6116 * single precision (default): num.float32 6117 * double precision: num.float64 or num.float 6118 6119 Precondition: 6120 triangulation and 6121 header have been called. 6108 6122 """ 6109 6123 … … 6112 6126 slice_index = len(file_time) 6113 6127 file_time[slice_index] = time 6128 else: 6129 slice_index = int(slice_index) # In case it was numpy.int 6114 6130 6115 6131 # Write the conserved quantities from Domain. … … 6124 6140 else: 6125 6141 q_values = quant[q] 6126 outfile.variables[q][slice_index] = \ 6127 q_values.astype(sww_precision) 6142 6143 x = q_values.astype(sww_precision) 6144 outfile.variables[q][slice_index] = x 6145 6128 6146 6129 6147 # This updates the _range values
Note: See TracChangeset
for help on using the changeset viewer.