{"action":"created","comment":{"url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/comments/56807661","id":56807661,"diff_hunk":"@@ -33,6 +33,34 @@ def AdvectionEE(particle, grid, time, dt):\n     particle.lat += v1 * f_lat\n \n \n+def positions_from_density_field(pnum, startfield, mode='monte_carlo'):\n+    # initialise particles from a field\n+    print(\"Starting from \" + startfield.name + \" field\")\n+\n+    # Gradient ends up with overall negative sum of cells, not sure if this makes sense\n+    # so working with lat long points still for the moment\n+    # startcells = np.gradient(startfield.data[0,:,:])\n+    # total = np.sum(startcells)","path":"parcels/particle.py","position":11,"original_position":11,"commit_id":"0ea164fe849b7eaf862073dd128d4173cd1af2ab","original_commit_id":"0ea164fe849b7eaf862073dd128d4173cd1af2ab","user":{"login":"Jacketless","id":17003951,"avatar_url":"https://avatars.githubusercontent.com/u/17003951?v=3","gravatar_id":"","url":"https://api.github.com/users/Jacketless","html_url":"https://github.com/Jacketless","followers_url":"https://api.github.com/users/Jacketless/followers","following_url":"https://api.github.com/users/Jacketless/following{/other_user}","gists_url":"https://api.github.com/users/Jacketless/gists{/gist_id}","starred_url":"https://api.github.com/users/Jacketless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jacketless/subscriptions","organizations_url":"https://api.github.com/users/Jacketless/orgs","repos_url":"https://api.github.com/users/Jacketless/repos","events_url":"https://api.github.com/users/Jacketless/events{/privacy}","received_events_url":"https://api.github.com/users/Jacketless/received_events","type":"User","site_admin":false},"body":"No- these are a commented out attempts to move from assigning particle positions at lat-lon points to assigning them to cells (you remember we discussed using np.gradient to do this last week?). But it doesn't work out as I expected because of course we end up with some negative gradient values assigned to some cells, which is not what we wanted I think.\r\n\r\nThe print statement can be removed if you want, I thought it was just a useful line out for the user.","created_at":"2016-03-21T11:19:08Z","updated_at":"2016-03-21T11:19:08Z","html_url":"https://github.com/OceanPARCELS/parcels/pull/49#discussion_r56807661","pull_request_url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/comments/56807661"},"html":{"href":"https://github.com/OceanPARCELS/parcels/pull/49#discussion_r56807661"},"pull_request":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49","id":62901544,"html_url":"https://github.com/OceanPARCELS/parcels/pull/49","diff_url":"https://github.com/OceanPARCELS/parcels/pull/49.diff","patch_url":"https://github.com/OceanPARCELS/parcels/pull/49.patch","issue_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues/49","number":49,"state":"open","locked":false,"title":"Initial from density field and test","user":{"login":"Jacketless","id":17003951,"avatar_url":"https://avatars.githubusercontent.com/u/17003951?v=3","gravatar_id":"","url":"https://api.github.com/users/Jacketless","html_url":"https://github.com/Jacketless","followers_url":"https://api.github.com/users/Jacketless/followers","following_url":"https://api.github.com/users/Jacketless/following{/other_user}","gists_url":"https://api.github.com/users/Jacketless/gists{/gist_id}","starred_url":"https://api.github.com/users/Jacketless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jacketless/subscriptions","organizations_url":"https://api.github.com/users/Jacketless/orgs","repos_url":"https://api.github.com/users/Jacketless/repos","events_url":"https://api.github.com/users/Jacketless/events{/privacy}","received_events_url":"https://api.github.com/users/Jacketless/received_events","type":"User","site_admin":false},"body":"added static function to initial a given number of particles\nstochastically from a grid.field\nsmall utility method within grid to add fields\nshort test script to show things working. Envision that it will be\nadded to for future additions to particle release code","created_at":"2016-03-15T13:02:24Z","updated_at":"2016-03-21T11:19:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"676f003418912144eb5a347b43edf5eb68472074","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49/commits","review_comments_url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49/comments","review_comment_url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues/49/comments","statuses_url":"https://api.github.com/repos/OceanPARCELS/parcels/statuses/0ea164fe849b7eaf862073dd128d4173cd1af2ab","head":{"label":"OceanPARCELS:grid-field-convenience-additions","ref":"grid-field-convenience-additions","sha":"0ea164fe849b7eaf862073dd128d4173cd1af2ab","user":{"login":"OceanPARCELS","id":14887518,"avatar_url":"https://avatars.githubusercontent.com/u/14887518?v=3","gravatar_id":"","url":"https://api.github.com/users/OceanPARCELS","html_url":"https://github.com/OceanPARCELS","followers_url":"https://api.github.com/users/OceanPARCELS/followers","following_url":"https://api.github.com/users/OceanPARCELS/following{/other_user}","gists_url":"https://api.github.com/users/OceanPARCELS/gists{/gist_id}","starred_url":"https://api.github.com/users/OceanPARCELS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OceanPARCELS/subscriptions","organizations_url":"https://api.github.com/users/OceanPARCELS/orgs","repos_url":"https://api.github.com/users/OceanPARCELS/repos","events_url":"https://api.github.com/users/OceanPARCELS/events{/privacy}","received_events_url":"https://api.github.com/users/OceanPARCELS/received_events","type":"Organization","site_admin":false},"repo":{"id":43358723,"name":"parcels","full_name":"OceanPARCELS/parcels","owner":{"login":"OceanPARCELS","id":14887518,"avatar_url":"https://avatars.githubusercontent.com/u/14887518?v=3","gravatar_id":"","url":"https://api.github.com/users/OceanPARCELS","html_url":"https://github.com/OceanPARCELS","followers_url":"https://api.github.com/users/OceanPARCELS/followers","following_url":"https://api.github.com/users/OceanPARCELS/following{/other_user}","gists_url":"https://api.github.com/users/OceanPARCELS/gists{/gist_id}","starred_url":"https://api.github.com/users/OceanPARCELS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OceanPARCELS/subscriptions","organizations_url":"https://api.github.com/users/OceanPARCELS/orgs","repos_url":"https://api.github.com/users/OceanPARCELS/repos","events_url":"https://api.github.com/users/OceanPARCELS/events{/privacy}","received_events_url":"https://api.github.com/users/OceanPARCELS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OceanPARCELS/parcels","description":"Main code for PARCELS","fork":false,"url":"https://api.github.com/repos/OceanPARCELS/parcels","forks_url":"https://api.github.com/repos/OceanPARCELS/parcels/forks","keys_url":"https://api.github.com/repos/OceanPARCELS/parcels/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OceanPARCELS/parcels/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OceanPARCELS/parcels/teams","hooks_url":"https://api.github.com/repos/OceanPARCELS/parcels/hooks","issue_events_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues/events{/number}","events_url":"https://api.github.com/repos/OceanPARCELS/parcels/events","assignees_url":"https://api.github.com/repos/OceanPARCELS/parcels/assignees{/user}","branches_url":"https://api.github.com/repos/OceanPARCELS/parcels/branches{/branch}","tags_url":"https://api.github.com/repos/OceanPARCELS/parcels/tags","blobs_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/refs{/sha}","trees_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OceanPARCELS/parcels/statuses/{sha}","languages_url":"https://api.github.com/repos/OceanPARCELS/parcels/languages","stargazers_url":"https://api.github.com/repos/OceanPARCELS/parcels/stargazers","contributors_url":"https://api.github.com/repos/OceanPARCELS/parcels/contributors","subscribers_url":"https://api.github.com/repos/OceanPARCELS/parcels/subscribers","subscription_url":"https://api.github.com/repos/OceanPARCELS/parcels/subscription","commits_url":"https://api.github.com/repos/OceanPARCELS/parcels/commits{/sha}","git_commits_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/commits{/sha}","comments_url":"https://api.github.com/repos/OceanPARCELS/parcels/comments{/number}","issue_comment_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues/comments{/number}","contents_url":"https://api.github.com/repos/OceanPARCELS/parcels/contents/{+path}","compare_url":"https://api.github.com/repos/OceanPARCELS/parcels/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OceanPARCELS/parcels/merges","archive_url":"https://api.github.com/repos/OceanPARCELS/parcels/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OceanPARCELS/parcels/downloads","issues_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues{/number}","pulls_url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls{/number}","milestones_url":"https://api.github.com/repos/OceanPARCELS/parcels/milestones{/number}","notifications_url":"https://api.github.com/repos/OceanPARCELS/parcels/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OceanPARCELS/parcels/labels{/name}","releases_url":"https://api.github.com/repos/OceanPARCELS/parcels/releases{/id}","deployments_url":"https://api.github.com/repos/OceanPARCELS/parcels/deployments","created_at":"2015-09-29T09:43:00Z","updated_at":"2016-01-11T08:56:07Z","pushed_at":"2016-03-21T09:24:25Z","git_url":"git://github.com/OceanPARCELS/parcels.git","ssh_url":"git@github.com:OceanPARCELS/parcels.git","clone_url":"https://github.com/OceanPARCELS/parcels.git","svn_url":"https://github.com/OceanPARCELS/parcels","homepage":null,"size":385,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":18,"forks":0,"open_issues":18,"watchers":0,"default_branch":"master"}},"base":{"label":"OceanPARCELS:master","ref":"master","sha":"c2e3d1b70bb267e0e30d7308ceafd0c3c8bfe53d","user":{"login":"OceanPARCELS","id":14887518,"avatar_url":"https://avatars.githubusercontent.com/u/14887518?v=3","gravatar_id":"","url":"https://api.github.com/users/OceanPARCELS","html_url":"https://github.com/OceanPARCELS","followers_url":"https://api.github.com/users/OceanPARCELS/followers","following_url":"https://api.github.com/users/OceanPARCELS/following{/other_user}","gists_url":"https://api.github.com/users/OceanPARCELS/gists{/gist_id}","starred_url":"https://api.github.com/users/OceanPARCELS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OceanPARCELS/subscriptions","organizations_url":"https://api.github.com/users/OceanPARCELS/orgs","repos_url":"https://api.github.com/users/OceanPARCELS/repos","events_url":"https://api.github.com/users/OceanPARCELS/events{/privacy}","received_events_url":"https://api.github.com/users/OceanPARCELS/received_events","type":"Organization","site_admin":false},"repo":{"id":43358723,"name":"parcels","full_name":"OceanPARCELS/parcels","owner":{"login":"OceanPARCELS","id":14887518,"avatar_url":"https://avatars.githubusercontent.com/u/14887518?v=3","gravatar_id":"","url":"https://api.github.com/users/OceanPARCELS","html_url":"https://github.com/OceanPARCELS","followers_url":"https://api.github.com/users/OceanPARCELS/followers","following_url":"https://api.github.com/users/OceanPARCELS/following{/other_user}","gists_url":"https://api.github.com/users/OceanPARCELS/gists{/gist_id}","starred_url":"https://api.github.com/users/OceanPARCELS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OceanPARCELS/subscriptions","organizations_url":"https://api.github.com/users/OceanPARCELS/orgs","repos_url":"https://api.github.com/users/OceanPARCELS/repos","events_url":"https://api.github.com/users/OceanPARCELS/events{/privacy}","received_events_url":"https://api.github.com/users/OceanPARCELS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OceanPARCELS/parcels","description":"Main code for PARCELS","fork":false,"url":"https://api.github.com/repos/OceanPARCELS/parcels","forks_url":"https://api.github.com/repos/OceanPARCELS/parcels/forks","keys_url":"https://api.github.com/repos/OceanPARCELS/parcels/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OceanPARCELS/parcels/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OceanPARCELS/parcels/teams","hooks_url":"https://api.github.com/repos/OceanPARCELS/parcels/hooks","issue_events_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues/events{/number}","events_url":"https://api.github.com/repos/OceanPARCELS/parcels/events","assignees_url":"https://api.github.com/repos/OceanPARCELS/parcels/assignees{/user}","branches_url":"https://api.github.com/repos/OceanPARCELS/parcels/branches{/branch}","tags_url":"https://api.github.com/repos/OceanPARCELS/parcels/tags","blobs_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/refs{/sha}","trees_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OceanPARCELS/parcels/statuses/{sha}","languages_url":"https://api.github.com/repos/OceanPARCELS/parcels/languages","stargazers_url":"https://api.github.com/repos/OceanPARCELS/parcels/stargazers","contributors_url":"https://api.github.com/repos/OceanPARCELS/parcels/contributors","subscribers_url":"https://api.github.com/repos/OceanPARCELS/parcels/subscribers","subscription_url":"https://api.github.com/repos/OceanPARCELS/parcels/subscription","commits_url":"https://api.github.com/repos/OceanPARCELS/parcels/commits{/sha}","git_commits_url":"https://api.github.com/repos/OceanPARCELS/parcels/git/commits{/sha}","comments_url":"https://api.github.com/repos/OceanPARCELS/parcels/comments{/number}","issue_comment_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues/comments{/number}","contents_url":"https://api.github.com/repos/OceanPARCELS/parcels/contents/{+path}","compare_url":"https://api.github.com/repos/OceanPARCELS/parcels/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OceanPARCELS/parcels/merges","archive_url":"https://api.github.com/repos/OceanPARCELS/parcels/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OceanPARCELS/parcels/downloads","issues_url":"https://api.github.com/repos/OceanPARCELS/parcels/issues{/number}","pulls_url":"https://api.github.com/repos/OceanPARCELS/parcels/pulls{/number}","milestones_url":"https://api.github.com/repos/OceanPARCELS/parcels/milestones{/number}","notifications_url":"https://api.github.com/repos/OceanPARCELS/parcels/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OceanPARCELS/parcels/labels{/name}","releases_url":"https://api.github.com/repos/OceanPARCELS/parcels/releases{/id}","deployments_url":"https://api.github.com/repos/OceanPARCELS/parcels/deployments","created_at":"2015-09-29T09:43:00Z","updated_at":"2016-01-11T08:56:07Z","pushed_at":"2016-03-21T09:24:25Z","git_url":"git://github.com/OceanPARCELS/parcels.git","ssh_url":"git@github.com:OceanPARCELS/parcels.git","clone_url":"https://github.com/OceanPARCELS/parcels.git","svn_url":"https://github.com/OceanPARCELS/parcels","homepage":null,"size":385,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":18,"forks":0,"open_issues":18,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49"},"html":{"href":"https://github.com/OceanPARCELS/parcels/pull/49"},"issue":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/issues/49"},"comments":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/OceanPARCELS/parcels/statuses/0ea164fe849b7eaf862073dd128d4173cd1af2ab"}}}}