{"action":"created","comment":{"url":"https://api.github.com/repos/gem/oq-engine/pulls/comments/165665418","pull_request_review_id":93644832,"id":165665418,"diff_hunk":"@@ -153,29 +157,80 @@ def extract_hazard(dstore, what):\n             yield key, arr\n \n \n-@extract.add('qgis-hazard')\n-def extract_hazard_for_qgis(dstore, what):\n+def get_mesh(sitecol, complete=True):\n     \"\"\"\n-    Extracts hazard curves and possibly hazard maps and/or uniform hazard\n-    spectra. Use it as /extract/qgis-hazard/rlz-0, etc\n+    :returns:\n+        a lon-lat or lon-lat-depth array depending if the site collection\n+        is at sea level or not\n     \"\"\"\n+    sc = sitecol.complete if complete else sitecol\n+    if sc.at_sea_level():\n+        mesh = numpy.zeros(len(sc), [('lon', F64), ('lat', F64)])\n+        mesh['lon'] = sc.lons\n+        mesh['lat'] = sc.lats\n+    else:\n+        mesh = numpy.zeros(len(sc), [('lon', F64), ('lat', F64),\n+                                     ('depth', F64)])\n+        mesh['lon'] = sc.lons\n+        mesh['lat'] = sc.lats\n+        mesh['depth'] = sc.depths\n+    return mesh\n+\n+\n+def hazard_items(dic, mesh, *extras, **kw):\n+    \"\"\"\n+    :param dic: dictionary of arrays of the same shape\n+    :param mesh: a mesh array with lon, lat fields of the same length\n+    :param extras: optional triples (field, dtype, values)\n+    :param kw: dictionary of parameters (like investigation_time)\n+    :returns: a list of pairs (key, value) suitable for storage in .nzp format","path":"openquake/calculators/extract.py","position":49,"original_position":49,"commit_id":"05429462eb4b72f4132c3a93be803294c320298a","original_commit_id":"05429462eb4b72f4132c3a93be803294c320298a","user":{"login":"ptormene","id":350930,"avatar_url":"https://avatars2.githubusercontent.com/u/350930?v=4","gravatar_id":"","url":"https://api.github.com/users/ptormene","html_url":"https://github.com/ptormene","followers_url":"https://api.github.com/users/ptormene/followers","following_url":"https://api.github.com/users/ptormene/following{/other_user}","gists_url":"https://api.github.com/users/ptormene/gists{/gist_id}","starred_url":"https://api.github.com/users/ptormene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptormene/subscriptions","organizations_url":"https://api.github.com/users/ptormene/orgs","repos_url":"https://api.github.com/users/ptormene/repos","events_url":"https://api.github.com/users/ptormene/events{/privacy}","received_events_url":"https://api.github.com/users/ptormene/received_events","type":"User","site_admin":false},"body":"Typo `nzp` -> `npz`","created_at":"2018-02-02T14:55:03Z","updated_at":"2018-02-02T14:55:03Z","html_url":"https://github.com/gem/oq-engine/pull/3408#discussion_r165665418","pull_request_url":"https://api.github.com/repos/gem/oq-engine/pulls/3408","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/gem/oq-engine/pulls/comments/165665418"},"html":{"href":"https://github.com/gem/oq-engine/pull/3408#discussion_r165665418"},"pull_request":{"href":"https://api.github.com/repos/gem/oq-engine/pulls/3408"}}},"pull_request":{"url":"https://api.github.com/repos/gem/oq-engine/pulls/3408","id":166746184,"html_url":"https://github.com/gem/oq-engine/pull/3408","diff_url":"https://github.com/gem/oq-engine/pull/3408.diff","patch_url":"https://github.com/gem/oq-engine/pull/3408.patch","issue_url":"https://api.github.com/repos/gem/oq-engine/issues/3408","number":3408,"state":"open","locked":false,"title":"Added an /extract/ API for the hazard outputs","user":{"login":"micheles","id":2463856,"avatar_url":"https://avatars1.githubusercontent.com/u/2463856?v=4","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":"and removed the old qgis-hcurves, qgis-hmaps, qgis-uhs API, which despite the name were not compatible with the QGIS plugin.\r\n\r\nPS: I am also extending `oq extract` so that it can call the web API too.","created_at":"2018-02-02T08:46:50Z","updated_at":"2018-02-02T14:55:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3d43fee39e0c02875665a7fad55e0b21e893146","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":{"url":"https://api.github.com/repos/gem/oq-engine/milestones/18","html_url":"https://github.com/gem/oq-engine/milestone/18","labels_url":"https://api.github.com/repos/gem/oq-engine/milestones/18/labels","id":2889904,"number":18,"title":"Engine 2.9.0","description":null,"creator":{"login":"micheles","id":2463856,"avatar_url":"https://avatars1.githubusercontent.com/u/2463856?v=4","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},"open_issues":14,"closed_issues":102,"state":"open","created_at":"2017-11-06T09:29:37Z","updated_at":"2018-02-02T09:05:36Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/gem/oq-engine/pulls/3408/commits","review_comments_url":"https://api.github.com/repos/gem/oq-engine/pulls/3408/comments","review_comment_url":"https://api.github.com/repos/gem/oq-engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gem/oq-engine/issues/3408/comments","statuses_url":"https://api.github.com/repos/gem/oq-engine/statuses/05429462eb4b72f4132c3a93be803294c320298a","head":{"label":"gem:extract-npz","ref":"extract-npz","sha":"05429462eb4b72f4132c3a93be803294c320298a","user":{"login":"gem","id":316546,"avatar_url":"https://avatars1.githubusercontent.com/u/316546?v=4","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":744916,"name":"oq-engine","full_name":"gem/oq-engine","owner":{"login":"gem","id":316546,"avatar_url":"https://avatars1.githubusercontent.com/u/316546?v=4","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-engine","description":"OpenQuake's Engine for Seismic Hazard and Risk Analysis","fork":false,"url":"https://api.github.com/repos/gem/oq-engine","forks_url":"https://api.github.com/repos/gem/oq-engine/forks","keys_url":"https://api.github.com/repos/gem/oq-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gem/oq-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gem/oq-engine/teams","hooks_url":"https://api.github.com/repos/gem/oq-engine/hooks","issue_events_url":"https://api.github.com/repos/gem/oq-engine/issues/events{/number}","events_url":"https://api.github.com/repos/gem/oq-engine/events","assignees_url":"https://api.github.com/repos/gem/oq-engine/assignees{/user}","branches_url":"https://api.github.com/repos/gem/oq-engine/branches{/branch}","tags_url":"https://api.github.com/repos/gem/oq-engine/tags","blobs_url":"https://api.github.com/repos/gem/oq-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gem/oq-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gem/oq-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/gem/oq-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gem/oq-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/gem/oq-engine/languages","stargazers_url":"https://api.github.com/repos/gem/oq-engine/stargazers","contributors_url":"https://api.github.com/repos/gem/oq-engine/contributors","subscribers_url":"https://api.github.com/repos/gem/oq-engine/subscribers","subscription_url":"https://api.github.com/repos/gem/oq-engine/subscription","commits_url":"https://api.github.com/repos/gem/oq-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/gem/oq-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/gem/oq-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/gem/oq-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/gem/oq-engine/contents/{+path}","compare_url":"https://api.github.com/repos/gem/oq-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gem/oq-engine/merges","archive_url":"https://api.github.com/repos/gem/oq-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gem/oq-engine/downloads","issues_url":"https://api.github.com/repos/gem/oq-engine/issues{/number}","pulls_url":"https://api.github.com/repos/gem/oq-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/gem/oq-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/gem/oq-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gem/oq-engine/labels{/name}","releases_url":"https://api.github.com/repos/gem/oq-engine/releases{/id}","deployments_url":"https://api.github.com/repos/gem/oq-engine/deployments","created_at":"2010-06-28T14:59:42Z","updated_at":"2018-02-02T07:47:36Z","pushed_at":"2018-02-02T13:51:20Z","git_url":"git://github.com/gem/oq-engine.git","ssh_url":"git@github.com:gem/oq-engine.git","clone_url":"https://github.com/gem/oq-engine.git","svn_url":"https://github.com/gem/oq-engine","homepage":"https://github.com/gem/oq-engine/#openquake-engine","size":637104,"stargazers_count":109,"watchers_count":109,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"archived":false,"open_issues_count":41,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":85,"open_issues":41,"watchers":109,"default_branch":"master"}},"base":{"label":"gem:master","ref":"master","sha":"18cde62a967ef9101dde821e45d51a0e6330c046","user":{"login":"gem","id":316546,"avatar_url":"https://avatars1.githubusercontent.com/u/316546?v=4","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":744916,"name":"oq-engine","full_name":"gem/oq-engine","owner":{"login":"gem","id":316546,"avatar_url":"https://avatars1.githubusercontent.com/u/316546?v=4","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-engine","description":"OpenQuake's Engine for Seismic Hazard and Risk Analysis","fork":false,"url":"https://api.github.com/repos/gem/oq-engine","forks_url":"https://api.github.com/repos/gem/oq-engine/forks","keys_url":"https://api.github.com/repos/gem/oq-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gem/oq-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gem/oq-engine/teams","hooks_url":"https://api.github.com/repos/gem/oq-engine/hooks","issue_events_url":"https://api.github.com/repos/gem/oq-engine/issues/events{/number}","events_url":"https://api.github.com/repos/gem/oq-engine/events","assignees_url":"https://api.github.com/repos/gem/oq-engine/assignees{/user}","branches_url":"https://api.github.com/repos/gem/oq-engine/branches{/branch}","tags_url":"https://api.github.com/repos/gem/oq-engine/tags","blobs_url":"https://api.github.com/repos/gem/oq-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gem/oq-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gem/oq-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/gem/oq-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gem/oq-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/gem/oq-engine/languages","stargazers_url":"https://api.github.com/repos/gem/oq-engine/stargazers","contributors_url":"https://api.github.com/repos/gem/oq-engine/contributors","subscribers_url":"https://api.github.com/repos/gem/oq-engine/subscribers","subscription_url":"https://api.github.com/repos/gem/oq-engine/subscription","commits_url":"https://api.github.com/repos/gem/oq-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/gem/oq-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/gem/oq-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/gem/oq-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/gem/oq-engine/contents/{+path}","compare_url":"https://api.github.com/repos/gem/oq-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gem/oq-engine/merges","archive_url":"https://api.github.com/repos/gem/oq-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gem/oq-engine/downloads","issues_url":"https://api.github.com/repos/gem/oq-engine/issues{/number}","pulls_url":"https://api.github.com/repos/gem/oq-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/gem/oq-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/gem/oq-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gem/oq-engine/labels{/name}","releases_url":"https://api.github.com/repos/gem/oq-engine/releases{/id}","deployments_url":"https://api.github.com/repos/gem/oq-engine/deployments","created_at":"2010-06-28T14:59:42Z","updated_at":"2018-02-02T07:47:36Z","pushed_at":"2018-02-02T13:51:20Z","git_url":"git://github.com/gem/oq-engine.git","ssh_url":"git@github.com:gem/oq-engine.git","clone_url":"https://github.com/gem/oq-engine.git","svn_url":"https://github.com/gem/oq-engine","homepage":"https://github.com/gem/oq-engine/#openquake-engine","size":637104,"stargazers_count":109,"watchers_count":109,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"archived":false,"open_issues_count":41,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":85,"open_issues":41,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gem/oq-engine/pulls/3408"},"html":{"href":"https://github.com/gem/oq-engine/pull/3408"},"issue":{"href":"https://api.github.com/repos/gem/oq-engine/issues/3408"},"comments":{"href":"https://api.github.com/repos/gem/oq-engine/issues/3408/comments"},"review_comments":{"href":"https://api.github.com/repos/gem/oq-engine/pulls/3408/comments"},"review_comment":{"href":"https://api.github.com/repos/gem/oq-engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gem/oq-engine/pulls/3408/commits"},"statuses":{"href":"https://api.github.com/repos/gem/oq-engine/statuses/05429462eb4b72f4132c3a93be803294c320298a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ptormene"}}