wiki:Geo_reference

Version 31 (modified by rwilson, 16 years ago) (diff)

--

ANUGA/Internal Architecture/Classes


Class Geo_reference

Defined in file coordinate_transforms/geo_reference.py.

Discussion

Class Attributes

zone The UTM zone the Geo_reference is based in.
false_easting ??
false_northing ??
datum The datum used (default is 'wsg84').
projection The projection used (default is 'UTM').
units The units of measure used (default is metres, 'm').
xllcorner The X coordinate of origin (default is 0.0 with respect to the UTM grid origin).
yllcorner The Y coordinate of origin (default is 0.0 with respect to the UTM grid origin).

Class Methods

get_xllcorner(self) Returns the .xllcorner attribute.
get_yllcorner(self) Returns the .yllcorner attribute.
get_zone(self) Returns the .zone attribute.
write_NetCDF(self, outfile) Write Geo_reference attributes to an open NetCDF file at outfile. The attributes written are .xllcorner, .yllcorner, .zone, .false_easting, false_northing, .datum, .projection and .units.
read_NetCDF(self, infile) Read Geo_reference attributes from an open NetCDF file at infile. The attributes read are .xllcorner, .yllcorner, .zone, .false_easting, false_northing, .datum, .projection and .units.
write_ASCII(self, fd) Write Geo_reference attributes to an open ASCII file at fd. The attributes written are .zone, .xllcorner and .yllcorner.
read_ASCII(self, fd, read_title=None) Read Geo_reference attributes from an open ASCII file at fd. The attributes read are .zone, .xllcorner and .yllcorner. If read_title is None then we expect the title line in the data file to match the standard title in the first two characters. Otherwise read_title is the assumed title in the file which must match the standard title in the first two characters, and the title line is not read from the file.
change_points_geo_ref(self, points, points_geo_ref=None) Change the coordinates of a list or array of Points to be relative to a new Geo_reference. The new Point data is returned. Note that the input Point is also changed. If points_geo_ref is None then the coordinates are changed to be absolute with respect to the current Geo_reference.
is_absolute(self) Returns True if the Geo_reference origin is close to the UTM origin.
get_absolute(self, points) Given a list (or array) of Points geo-referenced to this Geo_reference, return a list (or array) of Points with absolute coordinates (ie, relative to the UTM origin). Note: also changes the input Point list! The inverse of get_relative().
get_relative(self, points) Given a list (or array) of Points geo-referenced to this Geo_reference, return a list (or array) of Points with relative coordinates (ie, relative to the Geo_reference origin). Note: also changes the input Point list! The inverse of get_absolute().
reconcile_zones(self, other) Compare two Geo_reference instances and reconcile the .zone attributes. If either instance (but not both) have a .zone of DEFAULT_ZONE then copy the .zone attribute from the instance with a real zone. Note: if other is None then assume a default Geo_reference instance.
get_origin(self) Returns a tuple of (.zone, .xllcorner, .yllcorner) for the instance. Note: should use this method and delete methods get_xllcorner(), get_yllcorner() and get_zone().
_ _cmp_ _(self, other) Allows python code to directly compare two Geo_reference instances. Two instances are equal if their .zone, .xllcorner and yllcorner attributes are the same.

Notes

There is a lot of room for error in handling Point and Geo_reference instances. The Geo_spatial class includes instances of these two classes.

This class is defined in the 'old' way. Needs to be changed to the new method before moving to python 2.6.


ANUGA/Internal Architecture/Classes