def utmupsZoneBand5(lat, lon, cmoff=False): '''Return the UTM/UPS zone number, Band letter, hemisphere/pole and clipped lat- and longitude for a given location. @arg lat: Latitude in degrees (C{scalar} or C{str}). @arg lon: Longitude in degrees (C{scalar} or C{str}). @kwarg cmoff: Offset longitude from the zone's central meridian, for UTM only (C{bool}). @return: A L{UtmUpsLatLon5Tuple}C{(zone, band, hemipole, lat, lon)} where C{hemipole} is C{'N'|'S'}, the UTM hemisphere or UPS pole, the UPS projection top/center. @raise RangeError: If B{C{lat}} outside the valid UTM or UPS bands or if B{C{lat}} or B{C{lon}} outside the valid range and L{rangerrors} set to C{True}. @raise ValueError: Invalid B{C{lat}} or B{C{lon}}. @see: Functions L{utmZoneBand5} and L{upsZoneBand5}. ''' try: return utmZoneBand5(lat, lon, cmoff=cmoff) except RangeError: return upsZoneBand5(lat, lon)
def utmZoneBand2(lat, lon): '''DEPRECATED, use function L{utmZoneBand5}. @return: 2-Tuple C{(zone, band)}. ''' from pygeodesy.utm import utmZoneBand5 r = utmZoneBand5(lat, lon) # UtmUpsLatLon5Tuple return r.zone, r.band