{"action":"created","comment":{"url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/comments/27019047","id":27019047,"diff_hunk":"@@ -0,0 +1,476 @@\n+# The Hazard Library\n+# Copyright (C) 2012-2014, GEM Foundation\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU Affero General Public License as\n+# published by the Free Software Foundation, either version 3 of the\n+# License, or (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU Affero General Public License for more details.\n+#\n+# You should have received a copy of the GNU Affero General Public License\n+# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+\"\"\"\n+Module :mod:`openquake.hazardlib.nearfault` provides methods for near fault\n+PSHA calculation.\n+\"\"\"\n+\n+import math\n+import numpy as np\n+from openquake.hazardlib.geo import geodetic as geod\n+import scipy.spatial.distance as dst\n+\n+\n+def get_xyz_from_ll(projected, reference):\n+    \"\"\"\n+    This method computes the x ,y and z coordinates of a set of points\n+    provided a reference point\n+\n+    :param projected:\n+        :class:`~openquake.hazardlib.geo.point.Point` object\n+        representing the coordinates of target point to be projected\n+    :param reference:\n+        :class:`~openquake.hazardlib.geo.point.Point` object\n+        representing the coordinates of the reference point.\n+\n+    :returns:\n+            x\n+            y\n+            z\n+    \"\"\"\n+\n+    azims = geod.azimuth(reference.longitude, reference.latitude,\n+                         projected.longitude, projected.latitude)\n+    depths = np.subtract(reference.depth, projected.depth)\n+    dists = geod.geodetic_distance(reference.longitude,\n+                                   reference.latitude,\n+                                   projected.longitude,\n+                                   projected.latitude)\n+    return (dists * math.sin(math.radians(azims)),\n+            dists * math.cos(math.radians(azims)),\n+            depths)\n+\n+\n+def get_plane_equation(p0, p1, p2, reference):\n+    '''\n+    Define plane equation by 3 given points, p0, p1, p2, which format in\n+    class:`~openquake.hazardlib.geo.point.Point` object\n+\n+    :param p0:\n+        :class:`~openquake.hazardlib.geo.point.Point` object\n+        representing the location of the one vertex of the fault patch.\n+    :param p1:\n+        :class:`~openquake.hazardlib.geo.point.Point` object\n+        representing the location of the one vertex of the fault patch.\n+        Note: the order of the vertex should give\n+        in clockwise.\n+    :param p2:\n+        :class:`~openquake.hazardlib.geo.point.Point` object\n+        representing the location of the one vertex of the fault patch.\n+        Note: the order of the vertex should give","path":"openquake/hazardlib/near_fault.py","position":73,"original_position":73,"commit_id":"982253a2a8d6057fddbe5a36109b0724aa262f1d","original_commit_id":"982253a2a8d6057fddbe5a36109b0724aa262f1d","user":{"login":"mmpagani","id":318811,"avatar_url":"https://avatars.githubusercontent.com/u/318811?v=3","gravatar_id":"","url":"https://api.github.com/users/mmpagani","html_url":"https://github.com/mmpagani","followers_url":"https://api.github.com/users/mmpagani/followers","following_url":"https://api.github.com/users/mmpagani/following{/other_user}","gists_url":"https://api.github.com/users/mmpagani/gists{/gist_id}","starred_url":"https://api.github.com/users/mmpagani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmpagani/subscriptions","organizations_url":"https://api.github.com/users/mmpagani/orgs","repos_url":"https://api.github.com/users/mmpagani/repos","events_url":"https://api.github.com/users/mmpagani/events{/privacy}","received_events_url":"https://api.github.com/users/mmpagani/received_events","type":"User","site_admin":false},"body":"Same as above","created_at":"2015-03-24T11:23:49Z","updated_at":"2015-03-24T11:23:49Z","html_url":"https://github.com/gem/oq-hazardlib/pull/301#discussion_r27019047","pull_request_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301","_links":{"self":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/comments/27019047"},"html":{"href":"https://github.com/gem/oq-hazardlib/pull/301#discussion_r27019047"},"pull_request":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301"}}},"pull_request":{"url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301","id":30265962,"html_url":"https://github.com/gem/oq-hazardlib/pull/301","diff_url":"https://github.com/gem/oq-hazardlib/pull/301.diff","patch_url":"https://github.com/gem/oq-hazardlib/pull/301.patch","issue_url":"https://api.github.com/repos/gem/oq-hazardlib/issues/301","number":301,"state":"open","locked":false,"title":"methods of Chiou and Spudich 2014 directivity model","user":{"login":"vup1120","id":3910909,"avatar_url":"https://avatars.githubusercontent.com/u/3910909?v=3","gravatar_id":"","url":"https://api.github.com/users/vup1120","html_url":"https://github.com/vup1120","followers_url":"https://api.github.com/users/vup1120/followers","following_url":"https://api.github.com/users/vup1120/following{/other_user}","gists_url":"https://api.github.com/users/vup1120/gists{/gist_id}","starred_url":"https://api.github.com/users/vup1120/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vup1120/subscriptions","organizations_url":"https://api.github.com/users/vup1120/orgs","repos_url":"https://api.github.com/users/vup1120/repos","events_url":"https://api.github.com/users/vup1120/events{/privacy}","received_events_url":"https://api.github.com/users/vup1120/received_events","type":"User","site_admin":false},"body":"This PR gives the methods for computing Chiou and Spudich 2014 DPP directivity model.\r\nThe test shows green in https://ci.openquake.org/job/zdevel_oq-hazardlib/239/","created_at":"2015-03-02T08:37:29Z","updated_at":"2015-03-24T11:23:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bdde59cdb8b0cdd534f9849d19357cfec5874149","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301/commits","review_comments_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301/comments","review_comment_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gem/oq-hazardlib/issues/301/comments","statuses_url":"https://api.github.com/repos/gem/oq-hazardlib/statuses/982253a2a8d6057fddbe5a36109b0724aa262f1d","head":{"label":"vup1120:nearfault","ref":"nearfault","sha":"982253a2a8d6057fddbe5a36109b0724aa262f1d","user":{"login":"vup1120","id":3910909,"avatar_url":"https://avatars.githubusercontent.com/u/3910909?v=3","gravatar_id":"","url":"https://api.github.com/users/vup1120","html_url":"https://github.com/vup1120","followers_url":"https://api.github.com/users/vup1120/followers","following_url":"https://api.github.com/users/vup1120/following{/other_user}","gists_url":"https://api.github.com/users/vup1120/gists{/gist_id}","starred_url":"https://api.github.com/users/vup1120/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vup1120/subscriptions","organizations_url":"https://api.github.com/users/vup1120/orgs","repos_url":"https://api.github.com/users/vup1120/repos","events_url":"https://api.github.com/users/vup1120/events{/privacy}","received_events_url":"https://api.github.com/users/vup1120/received_events","type":"User","site_admin":false},"repo":{"id":25962586,"name":"oq-hazardlib","full_name":"vup1120/oq-hazardlib","owner":{"login":"vup1120","id":3910909,"avatar_url":"https://avatars.githubusercontent.com/u/3910909?v=3","gravatar_id":"","url":"https://api.github.com/users/vup1120","html_url":"https://github.com/vup1120","followers_url":"https://api.github.com/users/vup1120/followers","following_url":"https://api.github.com/users/vup1120/following{/other_user}","gists_url":"https://api.github.com/users/vup1120/gists{/gist_id}","starred_url":"https://api.github.com/users/vup1120/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vup1120/subscriptions","organizations_url":"https://api.github.com/users/vup1120/orgs","repos_url":"https://api.github.com/users/vup1120/repos","events_url":"https://api.github.com/users/vup1120/events{/privacy}","received_events_url":"https://api.github.com/users/vup1120/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vup1120/oq-hazardlib","description":"Openquake Hazard Library","fork":true,"url":"https://api.github.com/repos/vup1120/oq-hazardlib","forks_url":"https://api.github.com/repos/vup1120/oq-hazardlib/forks","keys_url":"https://api.github.com/repos/vup1120/oq-hazardlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vup1120/oq-hazardlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vup1120/oq-hazardlib/teams","hooks_url":"https://api.github.com/repos/vup1120/oq-hazardlib/hooks","issue_events_url":"https://api.github.com/repos/vup1120/oq-hazardlib/issues/events{/number}","events_url":"https://api.github.com/repos/vup1120/oq-hazardlib/events","assignees_url":"https://api.github.com/repos/vup1120/oq-hazardlib/assignees{/user}","branches_url":"https://api.github.com/repos/vup1120/oq-hazardlib/branches{/branch}","tags_url":"https://api.github.com/repos/vup1120/oq-hazardlib/tags","blobs_url":"https://api.github.com/repos/vup1120/oq-hazardlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vup1120/oq-hazardlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vup1120/oq-hazardlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/vup1120/oq-hazardlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vup1120/oq-hazardlib/statuses/{sha}","languages_url":"https://api.github.com/repos/vup1120/oq-hazardlib/languages","stargazers_url":"https://api.github.com/repos/vup1120/oq-hazardlib/stargazers","contributors_url":"https://api.github.com/repos/vup1120/oq-hazardlib/contributors","subscribers_url":"https://api.github.com/repos/vup1120/oq-hazardlib/subscribers","subscription_url":"https://api.github.com/repos/vup1120/oq-hazardlib/subscription","commits_url":"https://api.github.com/repos/vup1120/oq-hazardlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/vup1120/oq-hazardlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/vup1120/oq-hazardlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/vup1120/oq-hazardlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/vup1120/oq-hazardlib/contents/{+path}","compare_url":"https://api.github.com/repos/vup1120/oq-hazardlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vup1120/oq-hazardlib/merges","archive_url":"https://api.github.com/repos/vup1120/oq-hazardlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vup1120/oq-hazardlib/downloads","issues_url":"https://api.github.com/repos/vup1120/oq-hazardlib/issues{/number}","pulls_url":"https://api.github.com/repos/vup1120/oq-hazardlib/pulls{/number}","milestones_url":"https://api.github.com/repos/vup1120/oq-hazardlib/milestones{/number}","notifications_url":"https://api.github.com/repos/vup1120/oq-hazardlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vup1120/oq-hazardlib/labels{/name}","releases_url":"https://api.github.com/repos/vup1120/oq-hazardlib/releases{/id}","created_at":"2014-10-30T09:00:56Z","updated_at":"2015-03-20T15:04:33Z","pushed_at":"2015-03-23T10:22:38Z","git_url":"git://github.com/vup1120/oq-hazardlib.git","ssh_url":"git@github.com:vup1120/oq-hazardlib.git","clone_url":"https://github.com/vup1120/oq-hazardlib.git","svn_url":"https://github.com/vup1120/oq-hazardlib","homepage":"http://www.globalquakemodel.org/openquake/","size":35699,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"gem:master","ref":"master","sha":"555af519884d8ca8a57418219979945e4baf8a68","user":{"login":"gem","id":316546,"avatar_url":"https://avatars.githubusercontent.com/u/316546?v=3","gravatar_id":"","url":"https://api.github.com/users/gem","html_url":"https://github.com/gem","followers_url":"https://api.github.com/users/gem/followers","following_url":"https://api.github.com/users/gem/following{/other_user}","gists_url":"https://api.github.com/users/gem/gists{/gist_id}","starred_url":"https://api.github.com/users/gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gem/subscriptions","organizations_url":"https://api.github.com/users/gem/orgs","repos_url":"https://api.github.com/users/gem/repos","events_url":"https://api.github.com/users/gem/events{/privacy}","received_events_url":"https://api.github.com/users/gem/received_events","type":"Organization","site_admin":false},"repo":{"id":2986762,"name":"oq-hazardlib","full_name":"gem/oq-hazardlib","owner":{"login":"gem","id":316546,"avatar_url":"https://avatars.githubusercontent.com/u/316546?v=3","gravatar_id":"","url":"https://api.github.com/users/gem","html_url":"https://github.com/gem","followers_url":"https://api.github.com/users/gem/followers","following_url":"https://api.github.com/users/gem/following{/other_user}","gists_url":"https://api.github.com/users/gem/gists{/gist_id}","starred_url":"https://api.github.com/users/gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gem/subscriptions","organizations_url":"https://api.github.com/users/gem/orgs","repos_url":"https://api.github.com/users/gem/repos","events_url":"https://api.github.com/users/gem/events{/privacy}","received_events_url":"https://api.github.com/users/gem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gem/oq-hazardlib","description":"Openquake Hazard Library","fork":false,"url":"https://api.github.com/repos/gem/oq-hazardlib","forks_url":"https://api.github.com/repos/gem/oq-hazardlib/forks","keys_url":"https://api.github.com/repos/gem/oq-hazardlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gem/oq-hazardlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gem/oq-hazardlib/teams","hooks_url":"https://api.github.com/repos/gem/oq-hazardlib/hooks","issue_events_url":"https://api.github.com/repos/gem/oq-hazardlib/issues/events{/number}","events_url":"https://api.github.com/repos/gem/oq-hazardlib/events","assignees_url":"https://api.github.com/repos/gem/oq-hazardlib/assignees{/user}","branches_url":"https://api.github.com/repos/gem/oq-hazardlib/branches{/branch}","tags_url":"https://api.github.com/repos/gem/oq-hazardlib/tags","blobs_url":"https://api.github.com/repos/gem/oq-hazardlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gem/oq-hazardlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gem/oq-hazardlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/gem/oq-hazardlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gem/oq-hazardlib/statuses/{sha}","languages_url":"https://api.github.com/repos/gem/oq-hazardlib/languages","stargazers_url":"https://api.github.com/repos/gem/oq-hazardlib/stargazers","contributors_url":"https://api.github.com/repos/gem/oq-hazardlib/contributors","subscribers_url":"https://api.github.com/repos/gem/oq-hazardlib/subscribers","subscription_url":"https://api.github.com/repos/gem/oq-hazardlib/subscription","commits_url":"https://api.github.com/repos/gem/oq-hazardlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/gem/oq-hazardlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/gem/oq-hazardlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/gem/oq-hazardlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/gem/oq-hazardlib/contents/{+path}","compare_url":"https://api.github.com/repos/gem/oq-hazardlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gem/oq-hazardlib/merges","archive_url":"https://api.github.com/repos/gem/oq-hazardlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gem/oq-hazardlib/downloads","issues_url":"https://api.github.com/repos/gem/oq-hazardlib/issues{/number}","pulls_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls{/number}","milestones_url":"https://api.github.com/repos/gem/oq-hazardlib/milestones{/number}","notifications_url":"https://api.github.com/repos/gem/oq-hazardlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gem/oq-hazardlib/labels{/name}","releases_url":"https://api.github.com/repos/gem/oq-hazardlib/releases{/id}","created_at":"2011-12-15T10:14:46Z","updated_at":"2015-03-24T10:50:50Z","pushed_at":"2015-03-24T10:50:49Z","git_url":"git://github.com/gem/oq-hazardlib.git","ssh_url":"git@github.com:gem/oq-hazardlib.git","clone_url":"https://github.com/gem/oq-hazardlib.git","svn_url":"https://github.com/gem/oq-hazardlib","homepage":"http://www.globalquakemodel.org/openquake/","size":45338,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":2,"forks":32,"open_issues":2,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301"},"html":{"href":"https://github.com/gem/oq-hazardlib/pull/301"},"issue":{"href":"https://api.github.com/repos/gem/oq-hazardlib/issues/301"},"comments":{"href":"https://api.github.com/repos/gem/oq-hazardlib/issues/301/comments"},"review_comments":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301/comments"},"review_comment":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/301/commits"},"statuses":{"href":"https://api.github.com/repos/gem/oq-hazardlib/statuses/982253a2a8d6057fddbe5a36109b0724aa262f1d"}}}}