Changeset 3820 for anuga_core/source/anuga/shallow_water/data_manager.py
- Timestamp:
- Oct 18, 2006, 11:04:59 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r3750 r3820 64 64 65 65 from Numeric import concatenate, array, Float, Int, Int32, resize, sometrue, \ 66 searchsorted, zeros, allclose, around, reshape 66 searchsorted, zeros, allclose, around, reshape, transpose 67 67 from Scientific.IO.NetCDF import NetCDFFile 68 68 … … 4200 4200 files_out, 4201 4201 quantities): 4202 lonlatdep, lon, lat = _binary_c2nc(file_in,4202 lonlatdep, lon, lat, depth = _binary_c2nc(file_in, 4203 4203 file_out, 4204 4204 quantity) … … 4210 4210 lon, 4211 4211 lat, 4212 lonlatdep[:,2])4212 depth) 4213 4213 hashed_elevation = myhash(lonlatdep) 4214 4214 else: … … 4251 4251 lonlatdep = reshape(lonlatdep, ( points_num, columns)) 4252 4252 4253 lon, lat = lon_lat2grid(lonlatdep) 4253 #print "lonlatdep", lonlatdep 4254 4255 lon, lat, depth = lon_lat2grid(lonlatdep) 4254 4256 lon_sorted = lon[:] 4255 4257 lon_sorted.sort() … … 4275 4277 hz_p_array.read(f, points_num) 4276 4278 hz_p = array(hz_p_array, typecode=Float) 4277 hz_p = reshape(hz_p, ( len(lat), len(lon))) 4279 hz_p = reshape(hz_p, (len(lon), len(lat))) 4280 hz_p = transpose(hz_p) #mux has lat varying fastest, nc has long v.f. 4278 4281 4279 4282 nc_file.store_timestep(hz_p) … … 4281 4284 nc_file.close() 4282 4285 4283 return lonlatdep, lon, lat 4286 return lonlatdep, lon, lat, depth 4284 4287 4285 4288 … … 4336 4339 The first column is longitudes. 4337 4340 The second column is latitudes. 4341 4342 The latitude is the fastest varying dimension - in mux files 4338 4343 """ 4339 4344 LONG = 0 4340 4345 LAT = 1 4346 QUANTITY = 2 4341 4347 points_num = len(long_lat_dep) 4342 4348 lat = [long_lat_dep[0][LAT]] 4343 4349 this_rows_long = long_lat_dep[0][LONG] 4344 i = 1 # Index of long_lat_dep 4345 4350 i = 1 # Index of long_lat_dep 4351 4346 4352 #Working out the lat's 4347 4353 while long_lat_dep[i][LONG] == this_rows_long and i < points_num: … … 4362 4368 for l in lat:assert -90 < l < 90 , msg 4363 4369 for l in long:assert -180 < l < 180 , msg 4364 4365 return long, lat 4370 4371 #changing quantity from lat being the fastest varying dimension to 4372 # long being the fastest varying dimension 4373 # FIXME - make this faster/do this a better way 4374 # use numeric transpose, after reshaping the quantity vector 4375 quantity = zeros(len(long_lat_dep), Float) 4376 lenlong = len(long) 4377 lenlat = len(lat) 4378 for lat_i, _ in enumerate(lat): 4379 for long_i, _ in enumerate(long): 4380 q_index = lat_i*lenlong+long_i 4381 lld_index = long_i*lenlat+lat_i 4382 quantity[q_index] = long_lat_dep[lld_index][QUANTITY] 4383 4384 return long, lat, quantity 4366 4385 4367 4386 #### END URS 2 SWW ###
Note: See TracChangeset
for help on using the changeset viewer.