Changeset 6553 for branches/numpy/anuga/coordinate_transforms/redfearn.py
- Timestamp:
- Mar 19, 2009, 1:43:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/coordinate_transforms/redfearn.py
r6533 r6553 37 37 return sign*dd, mm, ss 38 38 39 def redfearn(lat, lon, false_easting=None, false_northing=None, zone=None): 39 def redfearn(lat, lon, false_easting=None, false_northing=None, 40 zone=None, central_meridian=None, scale_factor=None): 40 41 """Compute UTM projection using Redfearn's formula 41 42 … … 47 48 If zone is specified reproject lat and long to specified zone instead of 48 49 standard zone 50 If meridian is specified, reproject lat and lon to that instead of zone. In this case 51 zone will be set to -1 to indicate non-UTM projection 52 53 Note that zone and meridian cannot both be specifed 49 54 """ 50 55 … … 57 62 a = 6378137.0 #Semi major axis 58 63 inverse_flattening = 298.257222101 #1/f 59 K0 = 0.9996 #Central scale factor 64 if scale_factor is None: 65 K0 = 0.9996 #Central scale factor 66 else: 67 K0 = scale_factor 68 #print 'scale', K0 60 69 zone_width = 6 #Degrees 61 70 … … 138 147 m = term1 + term2 + term3 + term4 #OK 139 148 140 #Zone 149 if zone is not None and central_meridian is not None: 150 msg = 'You specified both zone and central_meridian. Provide only one of them' 151 raise Exception, msg 152 153 # Zone 141 154 if zone is None: 142 155 zone = int((lon - longitude_of_western_edge_zone0)/zone_width) 143 156 144 central_meridian = zone*zone_width+longitude_of_central_meridian_zone0 157 # Central meridian 158 if central_meridian is None: 159 central_meridian = zone*zone_width+longitude_of_central_meridian_zone0 160 else: 161 zone = -1 145 162 146 163 omega = (lon-central_meridian)*pi/180 #Relative longitude (radians)
Note: See TracChangeset
for help on using the changeset viewer.