{"action":"created","comment":{"url":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/comments/58121620","id":58121620,"diff_hunk":"@@ -0,0 +1,974 @@\n+#!/usr/bin/env python\n+# -*- coding: utf-8 -*-\n+from __future__ import print_function\n+from __future__ import unicode_literals\n+from __future__ import division\n+\n+import csv\n+import logging\n+\n+from collections import defaultdict\n+\n+\n+log = logging.getLogger(__name__)\n+log.setLevel(logging.DEBUG)\n+\n+\n+EOL = '<EOL>'\n+\n+\n+class YesOrNo(object):\n+    NO = '<No>'\n+    YES = '<Yes>'\n+\n+    @staticmethod\n+    def parse(value):\n+        if value in ('0', 'N'):\n+            return YesOrNo.NO\n+        elif value in ('1', 'Y'):\n+            return YesOrNo.YES\n+        raise ValueError('Unexpected value: ' + str(value))\n+\n+\n+class ETflag(object):\n+    HAMMON_METHOD = '<Hammon method>'\n+    BLAINY_CRIDDLE_METHOD = '<Blainy-Criddle method>'\n+\n+    @staticmethod\n+    def parse(value):\n+        value = int(value)\n+        if value == 0:\n+            return ETflag.HAMMON_METHOD\n+        elif value == 1:\n+            return ETflag.BLAINY_CRIDDLE_METHOD\n+        raise ValueError('Unexpected value: ' + str(value))\n+\n+\n+class GrowFlag(object):\n+    NON_GROWING_SEASON = '<Non-growing season>'\n+    GROWING_SEASON = '<Growing season>'\n+\n+    @staticmethod\n+    def parse(value):\n+        value = int(value)\n+        if value == 0:\n+            return GrowFlag.NON_GROWING_SEASON\n+        elif value == 1:\n+            return GrowFlag.GROWING_SEASON\n+        raise ValueError('Unexpected value: ' + str(value))\n+\n+\n+# TODO: Use actual NLCD values\n+# Reference: https://drive.google.com/a/azavea.com/file/d/0B3v0QxIOuR_nX3Rnekp0NGUyOGM/view\n+class LandUse(object):\n+    WATER = '<Water>'\n+    HAY_PAST = '<Hay/Past>'\n+    CROPLAND = '<Cropland>'\n+    FOREST = '<Forest>'\n+    WETLAND = '<Wetland>'\n+    DISTURBED = '<Disturbed>'\n+    TURFGRASS = '<Turfgrass>'\n+    OPEN_LAND = '<Open_Land>'\n+    BARE_ROCK = '<Bare_Rock>'\n+    SANDY_AREAS = '<Sandy_Areas>'\n+    UNPAVED_ROAD = '<Unpaved_Road>'\n+    LD_MIXED = '<Ld_Mixed>'\n+    MD_MIXED = '<Md_Mixed>'\n+    HD_MIXED = '<Hd_Mixed>'\n+    LD_RESIDENTIAL = '<Ld_Residential>'\n+    MD_RESIDENTIAL = '<Md_Residential>'\n+    HD_RESIDENTIAL = '<Hd_Residential>'\n+\n+    @staticmethod\n+    def parse(value):\n+        if value == 'Water':\n+            return LandUse.WATER\n+        if value in ('Hay/Past', 'Hay'):\n+            return LandUse.HAY_PAST\n+        elif value == 'Cropland':\n+            return LandUse.CROPLAND\n+        elif value == 'Forest':\n+            return LandUse.FOREST\n+        elif value == 'Wetland':\n+            return LandUse.WETLAND\n+        elif value in ('Disturbed', 'Disturbed Land'):\n+            return LandUse.DISTURBED\n+        elif value == 'Turfgrass':\n+            return LandUse.TURFGRASS\n+        elif value in ('Open_Land', 'Open Land'):\n+            return LandUse.OPEN_LAND\n+        elif value in ('Bare_Rock', 'Bare Rock'):\n+            return LandUse.BARE_ROCK\n+        elif value in ('Sandy_Areas', 'Sandy Areas'):\n+            return LandUse.SANDY_AREAS\n+        elif value in ('Unpaved_Road', 'Unpaved Roads'):\n+            return LandUse.UNPAVED_ROAD\n+        elif value in ('Ld_Mixed', 'LD Mixed'):\n+            return LandUse.LD_MIXED\n+        elif value in ('Md_Mixed', 'MD Mixed'):\n+            return LandUse.MD_MIXED\n+        elif value in ('Hd_Mixed', 'HD Mixed'):\n+            return LandUse.HD_MIXED\n+        elif value in ('Ld_Residential', 'LD Residential'):\n+            return LandUse.LD_RESIDENTIAL\n+        elif value in ('Md_Residential', 'MD Residential'):\n+            return LandUse.MD_RESIDENTIAL\n+        elif value in ('Hd_Residential', 'HD Residential'):\n+            return LandUse.HD_RESIDENTIAL\n+        raise ValueError('Unexpected value: ' + str(value))\n+\n+\n+def iterate_csv_values(fp):\n+    \"\"\"\n+    Yield values as a continuous stream for each line in a\n+    file-like object.\n+    \"\"\"\n+    fp = csv.reader(fp)","path":"gwlfe/gwlfe.py","position":null,"original_position":126,"commit_id":"a1362d731a3d96f8152db018f90a4efddb75b5da","original_commit_id":"940d6bff4741a409f711ae5cd366772811ae9d84","user":{"login":"kdeloach","id":43062,"avatar_url":"https://avatars.githubusercontent.com/u/43062?v=3","gravatar_id":"","url":"https://api.github.com/users/kdeloach","html_url":"https://github.com/kdeloach","followers_url":"https://api.github.com/users/kdeloach/followers","following_url":"https://api.github.com/users/kdeloach/following{/other_user}","gists_url":"https://api.github.com/users/kdeloach/gists{/gist_id}","starred_url":"https://api.github.com/users/kdeloach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdeloach/subscriptions","organizations_url":"https://api.github.com/users/kdeloach/orgs","repos_url":"https://api.github.com/users/kdeloach/repos","events_url":"https://api.github.com/users/kdeloach/events{/privacy}","received_events_url":"https://api.github.com/users/kdeloach/received_events","type":"User","site_admin":false},"body":"Updated.","created_at":"2016-03-31T20:25:53Z","updated_at":"2016-03-31T20:25:53Z","html_url":"https://github.com/WikiWatershed/gwlf-e/pull/9#discussion_r58121620","pull_request_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/comments/58121620"},"html":{"href":"https://github.com/WikiWatershed/gwlf-e/pull/9#discussion_r58121620"},"pull_request":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9","id":64548612,"html_url":"https://github.com/WikiWatershed/gwlf-e/pull/9","diff_url":"https://github.com/WikiWatershed/gwlf-e/pull/9.diff","patch_url":"https://github.com/WikiWatershed/gwlf-e/pull/9.patch","issue_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/issues/9","number":9,"state":"open","locked":false,"title":"Add GMS Parser","user":{"login":"kdeloach","id":43062,"avatar_url":"https://avatars.githubusercontent.com/u/43062?v=3","gravatar_id":"","url":"https://api.github.com/users/kdeloach","html_url":"https://github.com/kdeloach","followers_url":"https://api.github.com/users/kdeloach/followers","following_url":"https://api.github.com/users/kdeloach/following{/other_user}","gists_url":"https://api.github.com/users/kdeloach/gists{/gist_id}","starred_url":"https://api.github.com/users/kdeloach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdeloach/subscriptions","organizations_url":"https://api.github.com/users/kdeloach/orgs","repos_url":"https://api.github.com/users/kdeloach/repos","events_url":"https://api.github.com/users/kdeloach/events{/privacy}","received_events_url":"https://api.github.com/users/kdeloach/received_events","type":"User","site_admin":false},"body":"This adds a class called `GmsReader` which is able to parse version\r\n1.4.0 GMS files into a dictionary object.\r\n\r\nConnects #4\r\nConnects #8","created_at":"2016-03-29T23:07:27Z","updated_at":"2016-03-31T20:25:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"178a7831ce9250668b5dad745b8f20d0551fa8c3","assignee":{"login":"kdeloach","id":43062,"avatar_url":"https://avatars.githubusercontent.com/u/43062?v=3","gravatar_id":"","url":"https://api.github.com/users/kdeloach","html_url":"https://github.com/kdeloach","followers_url":"https://api.github.com/users/kdeloach/followers","following_url":"https://api.github.com/users/kdeloach/following{/other_user}","gists_url":"https://api.github.com/users/kdeloach/gists{/gist_id}","starred_url":"https://api.github.com/users/kdeloach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdeloach/subscriptions","organizations_url":"https://api.github.com/users/kdeloach/orgs","repos_url":"https://api.github.com/users/kdeloach/repos","events_url":"https://api.github.com/users/kdeloach/events{/privacy}","received_events_url":"https://api.github.com/users/kdeloach/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9/commits","review_comments_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9/comments","review_comment_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/issues/9/comments","statuses_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/statuses/a1362d731a3d96f8152db018f90a4efddb75b5da","head":{"label":"kdeloach:feature/gms-parser","ref":"feature/gms-parser","sha":"a1362d731a3d96f8152db018f90a4efddb75b5da","user":{"login":"kdeloach","id":43062,"avatar_url":"https://avatars.githubusercontent.com/u/43062?v=3","gravatar_id":"","url":"https://api.github.com/users/kdeloach","html_url":"https://github.com/kdeloach","followers_url":"https://api.github.com/users/kdeloach/followers","following_url":"https://api.github.com/users/kdeloach/following{/other_user}","gists_url":"https://api.github.com/users/kdeloach/gists{/gist_id}","starred_url":"https://api.github.com/users/kdeloach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdeloach/subscriptions","organizations_url":"https://api.github.com/users/kdeloach/orgs","repos_url":"https://api.github.com/users/kdeloach/repos","events_url":"https://api.github.com/users/kdeloach/events{/privacy}","received_events_url":"https://api.github.com/users/kdeloach/received_events","type":"User","site_admin":false},"repo":{"id":54050496,"name":"gwlf-e","full_name":"kdeloach/gwlf-e","owner":{"login":"kdeloach","id":43062,"avatar_url":"https://avatars.githubusercontent.com/u/43062?v=3","gravatar_id":"","url":"https://api.github.com/users/kdeloach","html_url":"https://github.com/kdeloach","followers_url":"https://api.github.com/users/kdeloach/followers","following_url":"https://api.github.com/users/kdeloach/following{/other_user}","gists_url":"https://api.github.com/users/kdeloach/gists{/gist_id}","starred_url":"https://api.github.com/users/kdeloach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdeloach/subscriptions","organizations_url":"https://api.github.com/users/kdeloach/orgs","repos_url":"https://api.github.com/users/kdeloach/repos","events_url":"https://api.github.com/users/kdeloach/events{/privacy}","received_events_url":"https://api.github.com/users/kdeloach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kdeloach/gwlf-e","description":"Port of Generalized Watersheds Loading Functions - Enhanced (MapShed)","fork":true,"url":"https://api.github.com/repos/kdeloach/gwlf-e","forks_url":"https://api.github.com/repos/kdeloach/gwlf-e/forks","keys_url":"https://api.github.com/repos/kdeloach/gwlf-e/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kdeloach/gwlf-e/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kdeloach/gwlf-e/teams","hooks_url":"https://api.github.com/repos/kdeloach/gwlf-e/hooks","issue_events_url":"https://api.github.com/repos/kdeloach/gwlf-e/issues/events{/number}","events_url":"https://api.github.com/repos/kdeloach/gwlf-e/events","assignees_url":"https://api.github.com/repos/kdeloach/gwlf-e/assignees{/user}","branches_url":"https://api.github.com/repos/kdeloach/gwlf-e/branches{/branch}","tags_url":"https://api.github.com/repos/kdeloach/gwlf-e/tags","blobs_url":"https://api.github.com/repos/kdeloach/gwlf-e/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kdeloach/gwlf-e/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kdeloach/gwlf-e/git/refs{/sha}","trees_url":"https://api.github.com/repos/kdeloach/gwlf-e/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kdeloach/gwlf-e/statuses/{sha}","languages_url":"https://api.github.com/repos/kdeloach/gwlf-e/languages","stargazers_url":"https://api.github.com/repos/kdeloach/gwlf-e/stargazers","contributors_url":"https://api.github.com/repos/kdeloach/gwlf-e/contributors","subscribers_url":"https://api.github.com/repos/kdeloach/gwlf-e/subscribers","subscription_url":"https://api.github.com/repos/kdeloach/gwlf-e/subscription","commits_url":"https://api.github.com/repos/kdeloach/gwlf-e/commits{/sha}","git_commits_url":"https://api.github.com/repos/kdeloach/gwlf-e/git/commits{/sha}","comments_url":"https://api.github.com/repos/kdeloach/gwlf-e/comments{/number}","issue_comment_url":"https://api.github.com/repos/kdeloach/gwlf-e/issues/comments{/number}","contents_url":"https://api.github.com/repos/kdeloach/gwlf-e/contents/{+path}","compare_url":"https://api.github.com/repos/kdeloach/gwlf-e/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kdeloach/gwlf-e/merges","archive_url":"https://api.github.com/repos/kdeloach/gwlf-e/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kdeloach/gwlf-e/downloads","issues_url":"https://api.github.com/repos/kdeloach/gwlf-e/issues{/number}","pulls_url":"https://api.github.com/repos/kdeloach/gwlf-e/pulls{/number}","milestones_url":"https://api.github.com/repos/kdeloach/gwlf-e/milestones{/number}","notifications_url":"https://api.github.com/repos/kdeloach/gwlf-e/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kdeloach/gwlf-e/labels{/name}","releases_url":"https://api.github.com/repos/kdeloach/gwlf-e/releases{/id}","deployments_url":"https://api.github.com/repos/kdeloach/gwlf-e/deployments","created_at":"2016-03-16T16:56:36Z","updated_at":"2016-02-25T18:03:17Z","pushed_at":"2016-03-31T20:25:50Z","git_url":"git://github.com/kdeloach/gwlf-e.git","ssh_url":"git@github.com:kdeloach/gwlf-e.git","clone_url":"https://github.com/kdeloach/gwlf-e.git","svn_url":"https://github.com/kdeloach/gwlf-e","homepage":null,"size":32,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"WikiWatershed:develop","ref":"develop","sha":"0afbd9a603838c795f0ebacf95d533ca0285b1ed","user":{"login":"WikiWatershed","id":8520008,"avatar_url":"https://avatars.githubusercontent.com/u/8520008?v=3","gravatar_id":"","url":"https://api.github.com/users/WikiWatershed","html_url":"https://github.com/WikiWatershed","followers_url":"https://api.github.com/users/WikiWatershed/followers","following_url":"https://api.github.com/users/WikiWatershed/following{/other_user}","gists_url":"https://api.github.com/users/WikiWatershed/gists{/gist_id}","starred_url":"https://api.github.com/users/WikiWatershed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WikiWatershed/subscriptions","organizations_url":"https://api.github.com/users/WikiWatershed/orgs","repos_url":"https://api.github.com/users/WikiWatershed/repos","events_url":"https://api.github.com/users/WikiWatershed/events{/privacy}","received_events_url":"https://api.github.com/users/WikiWatershed/received_events","type":"Organization","site_admin":false},"repo":{"id":52545716,"name":"gwlf-e","full_name":"WikiWatershed/gwlf-e","owner":{"login":"WikiWatershed","id":8520008,"avatar_url":"https://avatars.githubusercontent.com/u/8520008?v=3","gravatar_id":"","url":"https://api.github.com/users/WikiWatershed","html_url":"https://github.com/WikiWatershed","followers_url":"https://api.github.com/users/WikiWatershed/followers","following_url":"https://api.github.com/users/WikiWatershed/following{/other_user}","gists_url":"https://api.github.com/users/WikiWatershed/gists{/gist_id}","starred_url":"https://api.github.com/users/WikiWatershed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WikiWatershed/subscriptions","organizations_url":"https://api.github.com/users/WikiWatershed/orgs","repos_url":"https://api.github.com/users/WikiWatershed/repos","events_url":"https://api.github.com/users/WikiWatershed/events{/privacy}","received_events_url":"https://api.github.com/users/WikiWatershed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WikiWatershed/gwlf-e","description":"Port of Generalized Watersheds Loading Functions - Enhanced (MapShed)","fork":false,"url":"https://api.github.com/repos/WikiWatershed/gwlf-e","forks_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/forks","keys_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/teams","hooks_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/hooks","issue_events_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/issues/events{/number}","events_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/events","assignees_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/assignees{/user}","branches_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/branches{/branch}","tags_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/tags","blobs_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/git/refs{/sha}","trees_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/statuses/{sha}","languages_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/languages","stargazers_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/stargazers","contributors_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/contributors","subscribers_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/subscribers","subscription_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/subscription","commits_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/commits{/sha}","git_commits_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/git/commits{/sha}","comments_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/comments{/number}","issue_comment_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/issues/comments{/number}","contents_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/contents/{+path}","compare_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/merges","archive_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/downloads","issues_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/issues{/number}","pulls_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls{/number}","milestones_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/milestones{/number}","notifications_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/labels{/name}","releases_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/releases{/id}","deployments_url":"https://api.github.com/repos/WikiWatershed/gwlf-e/deployments","created_at":"2016-02-25T18:03:17Z","updated_at":"2016-03-22T18:16:20Z","pushed_at":"2016-03-31T20:25:52Z","git_url":"git://github.com/WikiWatershed/gwlf-e.git","ssh_url":"git@github.com:WikiWatershed/gwlf-e.git","clone_url":"https://github.com/WikiWatershed/gwlf-e.git","svn_url":"https://github.com/WikiWatershed/gwlf-e","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":7,"forks":5,"open_issues":7,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9"},"html":{"href":"https://github.com/WikiWatershed/gwlf-e/pull/9"},"issue":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/issues/9"},"comments":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/WikiWatershed/gwlf-e/statuses/a1362d731a3d96f8152db018f90a4efddb75b5da"}}}}