Ignore:
Timestamp:
Mar 19, 2009, 1:43:34 PM (16 years ago)
Author:
rwilson
Message:

Merged trunk into numpy, all tests and validations work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/coordinate_transforms/redfearn.py

    r6533 r6553  
    3737    return sign*dd, mm, ss
    3838
    39 def redfearn(lat, lon, false_easting=None, false_northing=None, zone=None):
     39def redfearn(lat, lon, false_easting=None, false_northing=None,
     40             zone=None, central_meridian=None, scale_factor=None):
    4041    """Compute UTM projection using Redfearn's formula
    4142
     
    4748    If zone is specified reproject lat and long to specified zone instead of
    4849    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
    4954    """
    5055
     
    5762    a = 6378137.0                       #Semi major axis
    5863    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
    6069    zone_width = 6                      #Degrees
    6170
     
    138147    m = term1 + term2 + term3 + term4 #OK
    139148
    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
    141154    if zone is None:
    142155        zone = int((lon - longitude_of_western_edge_zone0)/zone_width)
    143156
    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
    145162
    146163    omega = (lon-central_meridian)*pi/180 #Relative longitude (radians)
Note: See TracChangeset for help on using the changeset viewer.