{"action":"created","comment":{"url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/comments/33888343","id":33888343,"diff_hunk":"@@ -976,3 +978,180 @@ def __getitem__(self, imt):\n             (co, (min_above[co] - max_below[co]) * ratio + max_below[co])\n             for co in max_below.keys()\n         )\n+\n+\n+class GMPETable(GMPE):\n+    \"\"\"","path":"openquake/hazardlib/gsim/base.py","position":18,"original_position":18,"commit_id":"9653028a5babfc67071b4bad57ef933679df5b99","original_commit_id":"9653028a5babfc67071b4bad57ef933679df5b99","user":{"login":"micheles","id":2463856,"avatar_url":"https://avatars.githubusercontent.com/u/2463856?v=3","gravatar_id":"","url":"https://api.github.com/users/micheles","html_url":"https://github.com/micheles","followers_url":"https://api.github.com/users/micheles/followers","following_url":"https://api.github.com/users/micheles/following{/other_user}","gists_url":"https://api.github.com/users/micheles/gists{/gist_id}","starred_url":"https://api.github.com/users/micheles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micheles/subscriptions","organizations_url":"https://api.github.com/users/micheles/orgs","repos_url":"https://api.github.com/users/micheles/repos","events_url":"https://api.github.com/users/micheles/events{/privacy}","received_events_url":"https://api.github.com/users/micheles/received_events","type":"User","site_admin":false},"body":"There is a serious problem with the approach used here in a cluster situation. The .hdf5 files are generally not visible to the workers (they are visible only if they live in a shared directory) so the GMPE cannot read the data. However it looks like the tables are small (~50k): that means that you can read the whole hdf5 file at instantiation time in the controller node, save it as an attribute of the GMPE instance (for instance as a dictionary of arrays), and then send the GMPE instance to the workers.\r\n\r\nAlso, do you really want to define so many classes? It looks like we could define a single class GSCCanada2015 and have different instances reading from different tables. For the user the difference would be that instead of writing in the GMPE logic tree file something like\r\n\r\n`<uncertaintyModel>GSCCanada2015WOffshoreMed</uncertaintyModel>`\r\n\r\nshe would write\r\n\r\n`<uncertaintyModel>GSCCanada2015(\"Woffshore_rhypo_med\")</uncertaintyModel>`\r\n\r\nLet's discuss our options on Monday.","created_at":"2015-07-04T15:53:28Z","updated_at":"2015-07-04T15:53:28Z","html_url":"https://github.com/gem/oq-hazardlib/pull/353#discussion_r33888343","pull_request_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/353","_links":{"self":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/comments/33888343"},"html":{"href":"https://github.com/gem/oq-hazardlib/pull/353#discussion_r33888343"},"pull_request":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/353"}}},"pull_request":{"url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/353","id":39208521,"html_url":"https://github.com/gem/oq-hazardlib/pull/353","diff_url":"https://github.com/gem/oq-hazardlib/pull/353.diff","patch_url":"https://github.com/gem/oq-hazardlib/pull/353.patch","issue_url":"https://api.github.com/repos/gem/oq-hazardlib/issues/353","number":353,"state":"open","locked":false,"title":"Adds support for GMPE Tables and Canadian GMPEs","user":{"login":"g-weatherill","id":496400,"avatar_url":"https://avatars.githubusercontent.com/u/496400?v=3","gravatar_id":"","url":"https://api.github.com/users/g-weatherill","html_url":"https://github.com/g-weatherill","followers_url":"https://api.github.com/users/g-weatherill/followers","following_url":"https://api.github.com/users/g-weatherill/following{/other_user}","gists_url":"https://api.github.com/users/g-weatherill/gists{/gist_id}","starred_url":"https://api.github.com/users/g-weatherill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g-weatherill/subscriptions","organizations_url":"https://api.github.com/users/g-weatherill/orgs","repos_url":"https://api.github.com/users/g-weatherill/repos","events_url":"https://api.github.com/users/g-weatherill/events{/privacy}","received_events_url":"https://api.github.com/users/g-weatherill/received_events","type":"User","site_admin":false},"body":"Implements two new features:\r\n\r\n1. Support for GMPEs in the form of binary tables, which give the predicted value of ground motion for an exhaustive set of Magnitude, Distance and IMT conditions. These are then interpolated to give the expected IML and standard deviations for the input rupture and distance conditions. Site conditions are not included but will be added in future.\r\n\r\n2. Implements the full suite of GMPEs for the 2015 National Seismic Hazard Map of Canada. These GMPEs are only available in the form of the tables described here.\r\n\r\nGMPE implementations tested against tables provided by Geological Survey of Canada. ","created_at":"2015-07-04T14:30:37Z","updated_at":"2015-07-04T15:53:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f883a8c2dfeddac395edd322470b03cf98f85db1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/353/commits","review_comments_url":"https://api.github.com/repos/gem/oq-hazardlib/pulls/353/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/353/comments","statuses_url":"https://api.github.com/repos/gem/oq-hazardlib/statuses/9653028a5babfc67071b4bad57ef933679df5b99","head":{"label":"g-weatherill:gsc_gmpes","ref":"gsc_gmpes","sha":"9653028a5babfc67071b4bad57ef933679df5b99","user":{"login":"g-weatherill","id":496400,"avatar_url":"https://avatars.githubusercontent.com/u/496400?v=3","gravatar_id":"","url":"https://api.github.com/users/g-weatherill","html_url":"https://github.com/g-weatherill","followers_url":"https://api.github.com/users/g-weatherill/followers","following_url":"https://api.github.com/users/g-weatherill/following{/other_user}","gists_url":"https://api.github.com/users/g-weatherill/gists{/gist_id}","starred_url":"https://api.github.com/users/g-weatherill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g-weatherill/subscriptions","organizations_url":"https://api.github.com/users/g-weatherill/orgs","repos_url":"https://api.github.com/users/g-weatherill/repos","events_url":"https://api.github.com/users/g-weatherill/events{/privacy}","received_events_url":"https://api.github.com/users/g-weatherill/received_events","type":"User","site_admin":false},"repo":{"id":10355577,"name":"oq-hazardlib","full_name":"g-weatherill/oq-hazardlib","owner":{"login":"g-weatherill","id":496400,"avatar_url":"https://avatars.githubusercontent.com/u/496400?v=3","gravatar_id":"","url":"https://api.github.com/users/g-weatherill","html_url":"https://github.com/g-weatherill","followers_url":"https://api.github.com/users/g-weatherill/followers","following_url":"https://api.github.com/users/g-weatherill/following{/other_user}","gists_url":"https://api.github.com/users/g-weatherill/gists{/gist_id}","starred_url":"https://api.github.com/users/g-weatherill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g-weatherill/subscriptions","organizations_url":"https://api.github.com/users/g-weatherill/orgs","repos_url":"https://api.github.com/users/g-weatherill/repos","events_url":"https://api.github.com/users/g-weatherill/events{/privacy}","received_events_url":"https://api.github.com/users/g-weatherill/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/g-weatherill/oq-hazardlib","description":"","fork":true,"url":"https://api.github.com/repos/g-weatherill/oq-hazardlib","forks_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/forks","keys_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/teams","hooks_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/hooks","issue_events_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/issues/events{/number}","events_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/events","assignees_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/assignees{/user}","branches_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/branches{/branch}","tags_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/tags","blobs_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/statuses/{sha}","languages_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/languages","stargazers_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/stargazers","contributors_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/contributors","subscribers_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/subscribers","subscription_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/subscription","commits_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/contents/{+path}","compare_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/merges","archive_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/downloads","issues_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/issues{/number}","pulls_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/pulls{/number}","milestones_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/milestones{/number}","notifications_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/labels{/name}","releases_url":"https://api.github.com/repos/g-weatherill/oq-hazardlib/releases{/id}","created_at":"2013-05-29T08:48:20Z","updated_at":"2015-04-28T15:21:53Z","pushed_at":"2015-07-03T17:08:30Z","git_url":"git://github.com/g-weatherill/oq-hazardlib.git","ssh_url":"git@github.com:g-weatherill/oq-hazardlib.git","clone_url":"https://github.com/g-weatherill/oq-hazardlib.git","svn_url":"https://github.com/g-weatherill/oq-hazardlib","homepage":"","size":37747,"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":"05c9bec6e92ba262c4bead1ada5843809180e10f","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-05-26T15:31:17Z","pushed_at":"2015-07-04T14:30:37Z","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":46765,"stargazers_count":19,"watchers_count":19,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":4,"forks":31,"open_issues":4,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/353"},"html":{"href":"https://github.com/gem/oq-hazardlib/pull/353"},"issue":{"href":"https://api.github.com/repos/gem/oq-hazardlib/issues/353"},"comments":{"href":"https://api.github.com/repos/gem/oq-hazardlib/issues/353/comments"},"review_comments":{"href":"https://api.github.com/repos/gem/oq-hazardlib/pulls/353/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/353/commits"},"statuses":{"href":"https://api.github.com/repos/gem/oq-hazardlib/statuses/9653028a5babfc67071b4bad57ef933679df5b99"}}}}