- Timestamp:
- Feb 24, 2009, 6:13:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/coordinate_transforms/redfearn.py
r6149 r6404 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): 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 51 If meridian is specified, reproject lat and lon to that instead of zone. In this case 52 zone will be set to -1 to indicate non-UTM projection 53 54 Note that zone and meridian cannot both be specifed 49 55 """ 50 56 … … 54 60 55 61 56 # GDA Specifications62 # GDA Specifications 57 63 a = 6378137.0 #Semi major axis 58 64 inverse_flattening = 298.257222101 #1/f … … 73 79 74 80 75 # Derived constants81 # Derived constants 76 82 f = 1.0/inverse_flattening 77 83 b = a*(1-f) #Semi minor axis … … 84 90 e6 = e2*e4 85 91 86 # Foot point latitude92 # Foot point latitude 87 93 n = (a-b)/(a+b) #Same as e2 - why ? 88 94 n2 = n*n … … 114 120 t6 = t2*t4 115 121 116 # Radius of Curvature122 # Radius of Curvature 117 123 rho = a*(1-e2)/(1-e2*sinphi*sinphi)**1.5 118 124 nu = a/(1-e2*sinphi*sinphi)**0.5 … … 122 128 psi4 = psi2*psi2 123 129 124 125 126 #Meridian distance 127 130 # Meridian distance 128 131 A0 = 1 - e2/4 - 3*e4/64 - 5*e6/256 129 132 A2 = 3.0/8*(e2+e4/4+15*e6/128) … … 138 141 m = term1 + term2 + term3 + term4 #OK 139 142 140 #Zone 143 if zone is not None and central_meridian is not None: 144 msg = 'You specified both zone and central_meridian. Provide only one of them' 145 raise Exception, msg 146 147 # Zone 141 148 if zone is None: 142 149 zone = int((lon - longitude_of_western_edge_zone0)/zone_width) 143 150 144 central_meridian = zone*zone_width+longitude_of_central_meridian_zone0 151 # Central meridian 152 if central_meridian is None: 153 central_meridian = zone*zone_width+longitude_of_central_meridian_zone0 154 else: 155 zone = -1 145 156 146 157 omega = (lon-central_meridian)*pi/180 #Relative longitude (radians) … … 153 164 omega8 = omega4*omega4 154 165 155 # Northing166 # Northing 156 167 term1 = nu*sinphi*cosphi*omega2/2 157 168 term2 = nu*sinphi*cosphi3*(4*psi2+psi-t2)*omega4/24 … … 162 173 northing = false_northing + K0*(m + term1 + term2 + term3 + term4) 163 174 164 # Easting175 # Easting 165 176 term1 = nu*omega*cosphi 166 177 term2 = nu*cosphi3*(psi-t2)*omega3/6
Note: See TracChangeset
for help on using the changeset viewer.