Changeset 2521


Ignore:
Timestamp:
Mar 10, 2006, 12:45:04 PM (18 years ago)
Author:
sexton
Message:

fixed dem2pts AGAIN!!! (memory issue with too many pts, so removed saving indices which weren't needed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/data_manager.py

    r2520 r2521  
    12031203    #FIXME: use array operations to do faster
    12041204    nn = 0
    1205     indices = []
     1205    k = 0
    12061206    for i in range(nrows):
    12071207        y = (nrows-i)*cellsize + yllcorner
     
    12091209            x = j*cellsize + xllcorner
    12101210            if easting_min <= x <= easting_max and \
    1211                northing_min <= y <= northing_max and \
    1212                dem_elevation_r[i,j] == NODATA_value:
    1213                 nn += 1
    1214 
    1215             if easting_min <= x <= easting_max and \
    12161211               northing_min <= y <= northing_max:
    1217                 indices.append([i,j])
    1218 
    1219     # finding indices of the clipped region
    1220     if len(indices) > 0:
    1221         firstpoint = indices[0]
    1222         index1 = firstpoint[0]
    1223         lastpoint = indices[len(indices)-1]
    1224         index2 = lastpoint[0]+1 #?
    1225     else:
    1226         index1 = 1
    1227         index2 = ncols
     1212                if dem_elevation_r[i,j] == NODATA_value: nn += 1
     1213
     1214                if k == 0:
     1215                    i1_0 = i
     1216                    j1_0 = j
     1217                k += 1   
     1218         
     1219
     1220    index1 = j1_0
     1221    index2 = i + 1
    12281222       
    12291223    # dimension definitions
    12301224    nrows_in_bounding_box = int(round((northing_max-northing_min)/cellsize))
    12311225    ncols_in_bounding_box = int(round((easting_max-easting_min)/cellsize))
    1232 
     1226   
    12331227    clippednopoints = nrows_in_bounding_box*ncols_in_bounding_box
    12341228    nopoints = clippednopoints-nn
     
    12361230    if verbose and nn > 0:
    12371231        print 'There are %d values in the elevation' %totalnopoints
    1238         print 'There are %d values in the clipped elevation' %clippednopoints
     1232        #print 'There are %d values in the clipped elevation' %clippednopoints
    12391233        print 'There are %d NODATA_values in the clipped elevation' %nn
    12401234       
Note: See TracChangeset for help on using the changeset viewer.