Changeset 4569
- Timestamp:
- Jun 28, 2007, 5:29:12 PM (18 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py
r4565 r4569 960 960 # self.timestep is calculated from speed of characteristics 961 961 # Apply CFL condition here 962 timestep = min(self.CFL*self.timestep, max_timestep)962 timestep = min(self.CFL*self.timestep, max_timestep) 963 963 964 964 #Record maximal and minimal values of timestep for reporting -
anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r4541 r4569 692 692 693 693 694 # Call fit_interpolate.fit function694 # Call fit_interpolate.fit function 695 695 args = (coordinates, triangles, points, values) 696 696 kwargs = {'data_origin': data_georef.get_origin(), … … 699 699 'verbose': verbose} 700 700 701 #print kwargs 702 703 #FIXME(dsg):Why is this catched? fit_to_mesh handles caching. 704 if use_cache is True: 705 try: 706 from caching import cache 707 except: 708 msg = 'Caching was requested, but caching module'+\ 709 'could not be imported' 710 raise msg 711 712 vertex_attributes = cache(fit_to_mesh, 713 args, kwargs, 714 verbose=verbose, 715 compression=False) 716 else: 717 vertex_attributes = apply(fit_to_mesh, 718 args, kwargs) 719 720 #Call underlying method using array values 701 702 # FIXME(dsg):Why is this catched? fit_to_mesh handles caching. 703 # Fair enough - I have commented it out 28/6/7 (Ole) 704 #if use_cache is True: 705 # try: 706 # from caching import cache 707 # except: 708 # msg = 'Caching was requested, but caching module'+\ 709 # 'could not be imported' 710 # raise msg 711 # 712 # vertex_attributes = cache(fit_to_mesh, 713 # args, kwargs, 714 # verbose=verbose, 715 # compression=False) 716 #else: 717 # vertex_attributes = apply(fit_to_mesh, 718 # args, kwargs) 719 720 vertex_attributes = apply(fit_to_mesh, 721 args, kwargs) 722 723 # Call underlying method using array values 721 724 self.set_values_from_array(vertex_attributes, 722 725 location, indices, verbose) … … 747 750 triangles = self.domain.triangles #FIXME 748 751 749 vertex_attributes = fit_to_mesh(coordinates, triangles, filename,752 vertex_attributes = fit_to_mesh(coordinates, triangles, filename, 750 753 alpha=alpha, 751 754 attribute_name=attribute_name, … … 754 757 max_read_lines=max_read_lines) 755 758 756 # Call underlying method using array values759 # Call underlying method using array values 757 760 self.set_values_from_array(vertex_attributes, 758 761 location, indices, verbose) -
anuga_core/source/anuga/fit_interpolate/fit.py
r4535 r4569 316 316 List of coordinate pairs [x, y] of 317 317 data points or an nx2 Numeric array or a Geospatial_data object 318 or filename (txt, csv, pts?) 318 319 z: Single 1d vector or array of data at the point_coordinates. 319 320 … … 324 325 assert point_origin is None, msg 325 326 filename = point_coordinates_or_filename 326 for i,geo_block in enumerate(Geospatial_data(filename, 327 328 for i, geo_block in enumerate(Geospatial_data(filename, 327 329 max_read_lines=max_read_lines, 328 330 load_file_now=False, … … 468 470 469 471 def _fit_to_mesh(vertex_coordinates, 470 triangles,471 point_coordinates, # this can also be a .csv/.txt file name472 point_attributes=None,473 alpha=DEFAULT_ALPHA,474 verbose=False,475 acceptable_overshoot=1.01,476 mesh_origin=None,477 data_origin=None,478 max_read_lines=None,479 attribute_name=None,480 use_cache = False):472 triangles, 473 point_coordinates, # this can also be a .csv/.txt file name 474 point_attributes=None, 475 alpha=DEFAULT_ALPHA, 476 verbose=False, 477 acceptable_overshoot=1.01, 478 mesh_origin=None, 479 data_origin=None, 480 max_read_lines=None, 481 attribute_name=None, 482 use_cache = False): 481 483 """ 482 484 Fit a smooth surface to a triangulation, … … 495 497 496 498 point_coordinates: List of coordinate pairs [x, y] of data points 497 (or an nx2 Numeric array) 499 (or an nx2 Numeric array). This can also be a .csv/.txt file name 500 FIXME (Ole): Can't it be a pts file too? 498 501 499 502 alpha: Smoothing parameter. -
anuga_core/source/anuga/geospatial_data/geospatial_data.py
r4549 r4569 49 49 data_points: x,y coordinates in meters. Type must be either a 50 50 sequence of 2-tuples or an Mx2 Numeric array of floats. A file name 51 can also be passed in here.51 with extension .txt, .cvs or .pts can also be passed in here. 52 52 53 53 attributes: Associated values for each data point. The type … … 147 147 msg = 'No file specified yet a delimiter is provided!' 148 148 raise ValueError, msg 149 file_name = None 149 file_name = None #FIXME (Ole): Isn't this line superfluous 150 150 151 if latitudes is not None or longitudes is not None or \ 151 152 points_are_lats_longs: … … 748 749 749 750 def __iter__(self): 750 """ 751 read in the header and save thefile pointer position751 """Read in the header, number_of_points and save the 752 file pointer position 752 753 """ 753 754 … … 756 757 #FIXME - what to do if the file isn't there 757 758 758 if self.file_name[-4:]== ".xya": 759 if self.file_name[-4:] == ".xya": 760 # FIXME (Ole): shouldn't the xya format be replaced by txt/csv? 761 759 762 #let's just read it all 760 763 pass 761 elif self.file_name[-4:] == ".pts":764 elif self.file_name[-4:] == ".pts": 762 765 763 766 # see if the file is there. Throw a QUIET IO error if it isn't … … 770 773 self.blocking_georef, self.blocking_keys, self.last_row = \ 771 774 _read_pts_file_header(self.fid, self.verbose) 772 self.start_row =0775 self.start_row = 0 773 776 self.show_verbose = 0 774 self.verbose_block_size = (self.last_row +10) /10 777 self.verbose_block_size = (self.last_row + 10)/10 778 779 if self.verbose is True: 780 print 'Reading %d points (blocking) from file %s'\ 781 %(self.last_row, 782 self.file_name) 783 775 784 else: 785 # It looks like the file is assumed to be a csv file 776 786 file_pointer = open(self.file_name) 777 787 self.header, self.file_pointer = \ 778 788 _read_csv_file_header(file_pointer) 779 789 self.blocking_georef = None # Used for reconciling zones 790 780 791 if self.max_read_lines is None: 781 792 self.max_read_lines = MAX_READ_LINES … … 783 794 784 795 def next(self): 785 # read a block, instanciate a new geospatial and return it 796 """ read a block, instanciate a new geospatial and return it""" 797 786 798 if self.file_name[-4:]== ".xya" : 799 # FIXME (Ole): shouldn't the xya format be replaced by txt/csv? 800 787 801 if not hasattr(self,'finished_reading') or \ 788 802 self.finished_reading is False: … … 814 828 if self.verbose is True: 815 829 if self.show_verbose >= self.start_row and \ 816 830 self.show_verbose < fin_row: 817 831 print 'Doing %d of %d' %(self.start_row, self.last_row+10) 818 832 self.show_verbose += max(self.max_read_lines, … … 820 834 #call stuff 821 835 pointlist, att_dict, = \ 822 _read_pts_file_blocking( 823 824 825 self.blocking_keys826 )836 _read_pts_file_blocking(self.fid, 837 self.start_row, 838 fin_row, 839 self.blocking_keys) 840 827 841 geo = Geospatial_data(pointlist, att_dict, self.blocking_georef) 828 842 self.start_row = fin_row … … 923 937 longitudes=longitudes) 924 938 return data_points, Geo_reference(zone=zone) 939 925 940 926 941 def _read_pts_file(file_name, verbose=False): … … 1089 1104 def _read_pts_file_header(fid, verbose=False): 1090 1105 1091 """ 1092 Read the geo_reference of a .pts file 1106 """Read the geo_reference and number_of_points from a .pts file 1093 1107 """ 1094 1108
Note: See TracChangeset
for help on using the changeset viewer.