Changeset 4284
- Timestamp:
- Feb 27, 2007, 4:48:19 PM (18 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r4283 r4284 4383 4383 4384 4384 ### PRODUCING THE POINTS NEEDED FILE ### 4385 def URS_points_needed_to_file(file_name, boundary_polygon, ll_lat, ll_long, 4386 grid_spacing, 4387 lat_amount, long_amount, zone=None): 4385 LL_LAT = -50.0 4386 LL_LONG = 80.0 4387 GRID_SPACING = 1.0/60.0 4388 LAT_AMOUNT = 4800 4389 LONG_AMOUNT = 3600 4390 def URS_points_needed_to_file(file_name, boundary_polygon, 4391 ll_lat=LL_LAT, ll_long=LL_LONG, 4392 grid_spacing=GRID_SPACING, 4393 lat_amount=LAT_AMOUNT, long_amount=LONG_AMOUNT, 4394 zone=None, export_csv=False, use_cache=False, 4395 verbose=False): 4388 4396 """ 4389 4397 file_name - name of the urs file produced for David. … … 4400 4408 """ 4401 4409 geo = URS_points_needed(boundary_polygon, ll_lat, ll_long, grid_spacing, 4402 lat_amount, long_amount, zone =zone)4410 lat_amount, long_amount, zone, use_cache, verbose) 4403 4411 if not file_name[-4:] == ".urs": 4404 4412 file_name += ".urs" 4405 4413 geo.export_points_file(file_name) 4406 4407 def URS_points_needed(boundary_polygon, ll_lat=-50.0, 4408 ll_long=80.0, grid_spacing=1.0/60.0, 4409 lat_amount=4800, long_amount=3600, zone=None): 4414 if export_csv: 4415 if file_name[-4:] == ".urs": 4416 file_name = file_name[:-4] + ".csv" 4417 geo.export_points_file(file_name) 4418 4419 def URS_points_needed(boundary_polygon, ll_lat=LL_LAT, 4420 ll_long=LL_LONG, grid_spacing=GRID_SPACING, 4421 lat_amount=LAT_AMOUNT, long_amount=LONG_AMOUNT, 4422 zone=None, use_cache=False, verbose=False): 4423 args = (boundary_polygon) 4424 kwargs = {'ll_lat': ll_lat, 4425 'll_long': ll_long, 4426 'grid_spacing': grid_spacing, 4427 'lat_amount': lat_amount, 4428 'long_amount': long_amount, 4429 'zone': zone} 4430 if use_cache is True: 4431 try: 4432 from anuga.caching import cache 4433 except: 4434 msg = 'Caching was requested, but caching module'+\ 4435 'could not be imported' 4436 raise msg 4437 4438 4439 geo = cache(_URS_points_needed, 4440 args, kwargs, 4441 verbose=verbose, 4442 compression=False) 4443 else: 4444 #I was getting 'got multiple values for keyword argument' errors 4445 #geo = apply(_URS_points_needed, args, kwargs) 4446 geo = _URS_points_needed(boundary_polygon, ll_lat, 4447 ll_long, grid_spacing, 4448 lat_amount, long_amount, 4449 zone) 4450 4451 return geo 4452 def _URS_points_needed(boundary_polygon, ll_lat=LL_LAT, 4453 ll_long=LL_LONG, grid_spacing=GRID_SPACING, 4454 lat_amount=LAT_AMOUNT, long_amount=LONG_AMOUNT, 4455 zone=None): 4410 4456 """ 4411 4457 -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r4281 r4284 5459 5459 self.delete_mux(files) 5460 5460 os.remove( base_name + '.sww') 5461 5462 def cache_test_URS_points_needed_and_urs_ungridded2sww(self): 5463 5464 ll_lat = -21.5 5465 ll_long = 114.5 5466 grid_spacing = 1./60. 5467 lat_amount = 30 5468 long_amount = 30 5469 time_step_count = 2 5470 time_step = 400 5471 tide = -200000 5472 5473 boundary_polygon = [[250000,7660000],[270000,7650000], 5474 [280000,7630000],[250000,7630000]] 5475 geo=URS_points_needed(boundary_polygon, 5476 ll_lat, ll_long, grid_spacing, 5477 lat_amount, long_amount, use_cache=True, 5478 verbose=True) 5461 5479 5462 5480 def visual_test_URS_points_needed_and_urs_ungridded2sww(self): … … 5495 5513 if __name__ == "__main__": 5496 5514 #suite = unittest.makeSuite(Test_Data_Manager,'davids_test_points_urs_ungridded2sww') 5497 #suite = unittest.makeSuite(Test_Data_Manager,' test_urs_ungridded2swwII')5515 #suite = unittest.makeSuite(Test_Data_Manager,'cache_test_URS_points_needed_and_urs_ungridded2sww') 5498 5516 #suite = unittest.makeSuite(Test_Data_Manager,'visual_test_URS_points_needed_and_urs_ungridded2sww') 5499 5517 suite = unittest.makeSuite(Test_Data_Manager,'test')
Note: See TracChangeset
for help on using the changeset viewer.