Changeset 2553 for inundation/pyvolution/data_manager.py
 Timestamp:
 Mar 16, 2006, 5:35:18 PM (17 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

inundation/pyvolution/data_manager.py
r2541 r2553 1206 1206 i1_0 = 0 1207 1207 j1_0 = 0 1208 thisj = 0 1209 thisi = 0 1208 1210 for i in range(nrows): 1209 y = (nrowsi )*cellsize + yllcorner1211 y = (nrowsi1)*cellsize + yllcorner 1210 1212 for j in range(ncols): 1211 1213 x = j*cellsize + xllcorner 1212 1214 if easting_min <= x <= easting_max and \ 1213 1215 northing_min <= y <= northing_max: 1216 thisj = j 1217 thisi = i 1214 1218 if dem_elevation_r[i,j] == NODATA_value: nn += 1 1215 1219 1216 1220 if k == 0: 1217 1221 i1_0 = i 1218 j1_0 = j 1222 j1_0 = j 1219 1223 k += 1 1220 1224 1221 index1 = j1_0 1222 index2 = j 1223 index3 = i1_0 1224 index4 = i 1225 1226 1227 index2 += 1 1228 nrows2 = index4  index3 1229 ncols2 = index2  index1 + 1 1225 index1 = j1_0 1226 index2 = thisj 1230 1227 1231 1228 # dimension definitions … … 1233 1230 ncols_in_bounding_box = int(round((easting_maxeasting_min)/cellsize)) 1234 1231 1235 clippednopoints = nrows_in_bounding_box*ncols_in_bounding_box1232 clippednopoints = (thisi+1i1_0)*(thisj+1j1_0) 1236 1233 nopoints = clippednopointsnn 1237 1234 1235 clipped_dem_elev = dem_elevation_r[i1_0:thisi+1,j1_0:thisj+1] 1236 1238 1237 if verbose and nn > 0: 1239 1238 print 'There are %d values in the elevation' %totalnopoints 1240 #print 'There are %d values in the clipped elevation' %clippednopoints1239 print 'There are %d values in the clipped elevation' %clippednopoints 1241 1240 print 'There are %d NODATA_values in the clipped elevation' %nn 1242 1241 … … 1253 1252 elevation = outfile.variables['elevation'] 1254 1253 1255 1254 lenv = index2index1+1 1256 1255 #Store data 1257 1256 global_index = 0 1258 for i in range(nrows): 1257 #for i in range(nrows): 1258 for i in range(i1_0,thisi+1,1): 1259 1259 if verbose and i%((nrows+10)/10)==0: 1260 1260 print 'Processing row %d of %d' %(i, nrows) … … 1262 1262 lower_index = global_index 1263 1263 1264 v = dem_elevation_r[i,index1:index2 ]1264 v = dem_elevation_r[i,index1:index2+1] 1265 1265 no_NODATA = sum(v == NODATA_value) 1266 1266 if no_NODATA > 0: 1267 newcols = len (v) no_NODATA #ncols_in_bounding_box  no_NODATA1267 newcols = lenv  no_NODATA #ncols_in_bounding_box  no_NODATA 1268 1268 else: 1269 newcols = len(v) #ncols_in_bounding_box 1270 1271 #print 'here', len(v), no_NODATA, newcols, v 1272 #print 'here again', dem_elevation_r[i,:] 1269 newcols = lenv #ncols_in_bounding_box 1270 1273 1271 telev = zeros(newcols, Float) 1274 1272 tpoints = zeros((newcols, 2), Float) … … 1276 1274 local_index = 0 1277 1275 1278 y = (nrowsi)*cellsize + yllcorner 1279 for j in range(ncols): 1276 y = (nrowsi1)*cellsize + yllcorner 1277 #for j in range(ncols): 1278 for j in range(j1_0,index2+1,1): 1280 1279 1281 1280 x = j*cellsize + xllcorner
Note: See TracChangeset
for help on using the changeset viewer.