Changeset 868
- Timestamp:
- Feb 11, 2005, 3:38:42 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution/coordinate_transforms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/coordinate_transforms/redfearn.py
r865 r868 1 1 2 2 3 def degminsec s2decimal_degrees(dd,mm,ss):3 def degminsec2decimal_degrees(dd,mm,ss): 4 4 assert abs(mm) == mm 5 5 assert abs(ss) == ss … … 12 12 return sign * (abs(dd) + mm/60. + ss/3600.) 13 13 14 def decimal_degrees2degminsec(dec): 15 16 if dec < 0: 17 sign = -1 18 else: 19 sign = 1 20 21 dec = abs(dec) 22 dd = int(dec) 23 f = dec-dd 24 25 mm = int(f*60) 26 ss = (f*60-mm)*60 27 28 return sign*dd, mm, ss 14 29 15 30 def redfearn(lat, lon): … … 32 47 zone_width = 6 #Degrees 33 48 false_easting = 500000 34 false_northing = 10000000 #In the southern hemisphere (0 in the northern) 49 50 if lat < 0: 51 false_northing = 10000000 #Southern hemisphere 52 else: 53 false_northing = 0 #Northern hemisphere) 35 54 longitude_of_central_meridian_zone1 = -177 #Needed??? 36 55 longitude_of_central_meridian_zone0 = -183 … … 116 135 #Northing 117 136 term1 = nu*sinphi*cosphi*omega2/2 118 term2 = nu*sinphi*cosphi3* omega4/24*(4*psi2+psi-t2)119 term3 = nu*sinphi*cosphi5* omega6/720*\137 term2 = nu*sinphi*cosphi3*(4*psi2+psi-t2)*omega4/24 138 term3 = nu*sinphi*cosphi5*\ 120 139 (8*psi4*(11-24*t2)-28*psi3*(1-6*t2)+\ 121 psi2*(1-32*t2)-psi*2*t2+t4-t2) 122 term4 = nu*sinphi*cosphi7*omega8/40320*(1385-3111*t2+543*t4-t6) 123 sum = m + term1 + term2 + term3 + term4 124 northing = false_northing + K0*sum 140 psi2*(1-32*t2)-psi*2*t2+t4-t2)*omega6/720 141 term4 = nu*sinphi*cosphi7*(1385-3111*t2+543*t4-t6)*omega8/40320 142 northing = false_northing + K0*(m + term1 + term2 + term3 + term4) 125 143 126 print northing, zone 127 128 import sys; sys.exit() 144 #Easting 145 term1 = nu*omega*cosphi 146 term2 = nu*cosphi3*(psi-t2)*omega3/6 147 term3 = nu*cosphi5*(4*psi3*(1-6*t2)+psi2*(1+8*t2)-2*psi*t2+t4)*omega5/120 148 term4 = nu*cosphi7*(61-479*t2+179*t4-t6)*omega7/5040 149 sum = term1 + term2 + term3 + term4 150 easting = false_easting + K0*sum 129 151 130 152 return zone, easting, northing -
inundation/ga/storm_surge/pyvolution/coordinate_transforms/test_redfearn.py
r865 r868 1 2 3 4 #Latitude: -37 57 03.72035 #Longitude: 144 25 29.52446 #Zone: 557 #Easting: 273741.297 Northing: 5796489.7778 #Latitude: -37 57 ' 3.72030 '' Longitude: 144 25 ' 29.52440 ''9 #Grid Convergence: -1 35 ' 3.65 '' Point Scale: 1.0002305610 11 1 12 2 from redfearn import * 13 3 from Numeric import allclose 4 5 #http://www.cellspark.com/UTM.html 6 #http://www.ga.gov.au/nmd/geodesy/datums/redfearn_geo_to_grid.jsp 7 14 8 15 9 #TEST 1 … … 23 17 #Grid Convergence: 1 47 ' 19.36 '' Point Scale: 1.00042107 24 18 25 lat = degminsecs2decimal_degrees(-37,39,10.15610) 26 lon = degminsecs2decimal_degrees(143,55,35.38390) 19 lat = degminsec2decimal_degrees(-37,39,10.15610) 20 lon = degminsec2decimal_degrees(143,55,35.38390) 21 assert allclose(lat, -37.65282114) 22 assert allclose(lon, 143.9264955) 23 24 dd,mm,ss = decimal_degrees2degminsec(-37.65282114) 25 assert dd==-37 26 assert mm==39 27 assert allclose(ss, 10.15610) 28 29 dd,mm,ss = decimal_degrees2degminsec(143.9264955) 30 assert dd==143 31 assert mm==55 32 assert allclose(ss, 35.38390) 33 34 #print dd,mm,ss 35 36 zone, easting, northing = redfearn(lat,lon) 37 38 assert zone == 54 39 assert allclose(easting, 758173.797) 40 assert allclose(northing, 5828674.340) 27 41 28 42 29 assert allclose(lat, -37.65282114)30 43 44 #TEST 2 45 46 #Latitude: -37 57 03.7203 47 #Longitude: 144 25 29.5244 48 #Zone: 55 49 #Easting: 273741.297 Northing: 5796489.777 50 #Latitude: -37 57 ' 3.72030 '' Longitude: 144 25 ' 29.52440 '' 51 #Grid Convergence: -1 35 ' 3.65 '' Point Scale: 1.00023056 52 53 lat = degminsec2decimal_degrees(-37,57,03.7203) 54 lon = degminsec2decimal_degrees(144,25,29.5244) 55 print lat, lon 56 57 zone, easting, northing = redfearn(lat,lon) 58 59 assert zone == 55 60 assert allclose(easting, 273741.297) 61 assert allclose(northing, 5796489.777) 62 63 64 65 #Test 3 66 lat = degminsec2decimal_degrees(-60,0,0) 67 lon = degminsec2decimal_degrees(130,0,0) 68 69 zone, easting, northing = redfearn(lat,lon) 70 #print zone, easting, northing 71 72 assert zone == 52 73 assert allclose(easting, 555776.267) 74 assert allclose(northing, 3348167.264) 75 76 77 #Test 4 (Kobenhavn) 78 lat = 55.70248 79 dd,mm,ss = decimal_degrees2degminsec(lat) 80 print dd, mm, ss 81 82 lon = 12.58364 83 dd,mm,ss = decimal_degrees2degminsec(lon) 84 print dd, mm, ss 31 85 32 86 zone, easting, northing = redfearn(lat,lon) 33 87 print zone, easting, northing 34 88 35 assert zone == 54 36 assert easting == 758173.797 37 assert northing == 5828674.340 89 assert zone == 33 90 assert allclose(easting, 348157.631) 91 #assert allclose(northing, 16175612.993) #With false_norting 10000000 92 assert allclose(northing, 6175612.993) 93 94
Note: See TracChangeset
for help on using the changeset viewer.