Changeset 2521
- Timestamp:
- Mar 10, 2006, 12:45:04 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/data_manager.py
r2520 r2521 1203 1203 #FIXME: use array operations to do faster 1204 1204 nn = 0 1205 indices = []1205 k = 0 1206 1206 for i in range(nrows): 1207 1207 y = (nrows-i)*cellsize + yllcorner … … 1209 1209 x = j*cellsize + xllcorner 1210 1210 if easting_min <= x <= easting_max and \ 1211 northing_min <= y <= northing_max and \1212 dem_elevation_r[i,j] == NODATA_value:1213 nn += 11214 1215 if easting_min <= x <= easting_max and \1216 1211 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 1228 1222 1229 1223 # dimension definitions 1230 1224 nrows_in_bounding_box = int(round((northing_max-northing_min)/cellsize)) 1231 1225 ncols_in_bounding_box = int(round((easting_max-easting_min)/cellsize)) 1232 1226 1233 1227 clippednopoints = nrows_in_bounding_box*ncols_in_bounding_box 1234 1228 nopoints = clippednopoints-nn … … 1236 1230 if verbose and nn > 0: 1237 1231 print 'There are %d values in the elevation' %totalnopoints 1238 print 'There are %d values in the clipped elevation' %clippednopoints1232 #print 'There are %d values in the clipped elevation' %clippednopoints 1239 1233 print 'There are %d NODATA_values in the clipped elevation' %nn 1240 1234
Note: See TracChangeset
for help on using the changeset viewer.