def _regionToCellHead(region): cell_head = struct_Cell_head() G_get_window(pointer(cell_head)) convert_dict = { 'n': 'north', 'e': 'east', 'w': 'west', 's': 'south', 'nsres': 'ns_res', 'ewres': 'ew_res' } for k, v in region.iteritems(): if k in ["rows", "cols", "cells"]: v = int(v) else: v = float(v) if convert_dict.has_key(k): k = convert_dict[k] setattr(cell_head, k, v) return cell_head
def _regionToCellHead(region): cell_head = struct_Cell_head() G_get_window(pointer(cell_head)) convert_dict = { "n": "north", "e": "east", "w": "west", "s": "south", "nsres": "ns_res", "ewres": "ew_res", } for k, v in six.iteritems(region): if k in ["rows", "cols", "cells", "zone"]: # zone added in r65224 v = int(v) else: v = float(v) if k in convert_dict: k = convert_dict[k] setattr(cell_head, k, v) return cell_head