Changeset 4107


Ignore:
Timestamp:
Dec 20, 2006, 3:53:24 PM (18 years ago)
Author:
duncan
Message:

load .xya using geospatial

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py

    r3956 r4107  
    1818     argmax, allclose, take, reshape
    1919from anuga.utilities.numerical_tools import ensure_numeric, is_scalar
     20from anuga.geospatial_data.geospatial_data import Geospatial_data
    2021
    2122class Quantity:
     
    219220
    220221        filename:
    221           Name of a .pts file containing data points and attributes for
     222          Name of a points file containing data points and attributes for
    222223          use with fit_interpolate.fit.
    223224
     
    718719                             verbose = False,
    719720                             use_cache = False):
    720         """Set quantity based on arbitrary points in .pts file
     721        """Set quantity based on arbitrary points in a points file
    721722        using attribute_name selects name of attribute
    722723        present in file.
     
    736737        # FIXME (Ole): This function should really return a
    737738        # Geospatial_data object.
    738         points_dict = import_points_file(filename)
    739         points = points_dict['pointlist']
    740         attributes = points_dict['attributelist']
    741 
    742         if attribute_name is None:
    743             names = attributes.keys()
    744             attribute_name = names[0]
    745 
    746         msg = 'Attribute_name must be a text string'
    747         assert type(attribute_name) == StringType, msg
     739        geospatial_data = Geospatial_data(filename)
     740       
     741        #points_dict = import_points_file(filename)
     742        #points_dict['pointlist'] = None
     743        #points_dict['attributelist'] = None
     744        #points = points_dict['pointlist']
     745        #attributes = points_dict['attributelist']
     746
     747
     748        #Take care of georeferencing
     749        # this doesn't do anything....
     750        #if points_dict.has_key('geo_reference') and \
     751        #       points_dict['geo_reference'] is not None:
     752        #    data_georef = points_dict['geo_reference']
     753        #else:
     754        #    data_georef = None
     755           
     756        # if there is no attribute name, use the 1st key?
     757        # This isn't so good..., if there is more than 1 key
     758        # since it will not always be the 1 column
     759        # or anything predictable...       
     760
     761        #if attribute_name is None:
     762        #    names = attributes.keys()
     763        #    attribute_name = names[0]
     764
     765        #msg = 'Attribute_name must be a text string'
     766        #assert type(attribute_name) == StringType, msg
    748767
    749768
     
    758777        #          %(attribute_name, filename)
    759778        #    raise msg
    760 
    761 
    762         #Take care of georeferencing
    763         if points_dict.has_key('geo_reference') and \
    764                points_dict['geo_reference'] is not None:
    765             data_georef = points_dict['geo_reference']
    766         else:
    767             data_georef = None
    768 
    769 
    770 
     779       
    771780        #Call underlying method for geospatial data
    772         geospatial_data = points_dictionary2geospatial_data(points_dict)
    773         geospatial_data.set_default_attribute_name(attribute_name)
     781        #geospatial_data = points_dictionary2geospatial_data(points_dict)
     782        # geospatial_data.set_default_attribute_name(attribute_name)
    774783
    775784        self.set_values_from_geospatial_data(geospatial_data,
Note: See TracChangeset for help on using the changeset viewer.