{"action":"created","comment":{"url":"https://api.github.com/repos/metoppv/improver/pulls/comments/151926422","pull_request_review_id":77708968,"id":151926422,"diff_hunk":"@@ -0,0 +1,228 @@\n+# -*- coding: utf-8 -*-\n+# -----------------------------------------------------------------------------\n+# (C) British Crown Copyright 2017 Met Office.\n+# All rights reserved.\n+#\n+# Redistribution and use in source and binary forms, with or without\n+# modification, are permitted provided that the following conditions are met:\n+#\n+# * Redistributions of source code must retain the above copyright notice, this\n+#   list of conditions and the following disclaimer.\n+#\n+# * Redistributions in binary form must reproduce the above copyright notice,\n+#   this list of conditions and the following disclaimer in the documentation\n+#   and/or other materials provided with the distribution.\n+#\n+# * Neither the name of the copyright holder nor the names of its\n+#   contributors may be used to endorse or promote products derived from\n+#   this software without specific prior written permission.\n+#\n+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+# POSSIBILITY OF SUCH DAMAGE.\n+\"\"\"Module to contain mathematical operations.\"\"\"\n+\n+import numpy as np\n+\n+import iris\n+\n+from improver.utilities.cube_manipulation import sort_coord_in_cube\n+\n+\n+class Integration(object):\n+    \"\"\"Perform integration along a chosen coordinate.\"\"\"\n+\n+    def __init__(self, coord_name_to_integrate,\n+                 start_point=None, end_point=None,\n+                 direction_of_integration=\"negative\"):\n+        \"\"\"\n+        Initialise class.\n+\n+        Args:\n+            coord_name_to_integrate (iris.cube.Cube):\n+                Name of the coordinate to be integrated.\n+            start_point (float or None):\n+                Point at which to start the integration.\n+                Default is None.\n+            end_point (float or None):\n+                Point at which to end the integration.\n+                Default is None.\n+            direction_of_integration (string):\n+                Description of the direction in which to integrate.\n+                Options are 'positive' or 'negative'.\n+                'positive' corresponds to the values within the array\n+                increasing as the array index increases.\n+                'negative' corresponds to the values within the array\n+                decreasing as the array index increases.\n+        \"\"\"\n+        self.coord_name_to_integrate = coord_name_to_integrate\n+        self.start_point = start_point\n+        self.end_point = end_point\n+        self.direction_of_integration = direction_of_integration\n+        if self.direction_of_integration not in [\"positive\", \"negative\"]:\n+            msg = (\"The specified direction of integration should be either \"\n+                   \"'positive' or 'negative'. {} was specified.\".format(\n+                       self.direction_of_integration))\n+            raise ValueError(msg)\n+\n+    def __repr__(self):\n+        \"\"\"Represent the configured plugin instance as a string.\"\"\"\n+        result = ('<Integration: coord_name_to_integrate: {}, '\n+                  'start_point: {}, end_point: {}, '\n+                  'direction_of_integration: {}>'.format(\n+                      self.coord_name_to_integrate, self.start_point,\n+                      self.end_point, self.direction_of_integration))\n+        return result\n+\n+    def ensure_monotonic_increase_in_chosen_direction(self, cube):\n+        \"\"\"Ensure that the chosen coordinate is monotonically increasing in\n+        the specified direction.\n+\n+        Args:\n+            cube (Iris.cube.Cube):\n+                The cube containing the coordinate to check.\n+\n+        Returns:\n+            cube (Iris.cube.Cube):\n+                The cube containing a coordinate that is monotonically\n+                increasing in the desired direction.\n+\n+        Raises:\n+            ValueError: The chosen coordinate is not monotonic.","path":"lib/improver/utilities/mathematical_operations.py","position":null,"original_position":99,"commit_id":"379ff03541dcd20316b4c8994548f06cf099ab68","original_commit_id":"c4e42ffbfbb459ba51f5ecf38349e7ea30d8c69a","user":{"login":"gavinevans","id":26933341,"avatar_url":"https://avatars3.githubusercontent.com/u/26933341?v=4","gravatar_id":"","url":"https://api.github.com/users/gavinevans","html_url":"https://github.com/gavinevans","followers_url":"https://api.github.com/users/gavinevans/followers","following_url":"https://api.github.com/users/gavinevans/following{/other_user}","gists_url":"https://api.github.com/users/gavinevans/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinevans/subscriptions","organizations_url":"https://api.github.com/users/gavinevans/orgs","repos_url":"https://api.github.com/users/gavinevans/repos","events_url":"https://api.github.com/users/gavinevans/events{/privacy}","received_events_url":"https://api.github.com/users/gavinevans/received_events","type":"User","site_admin":false},"body":"This error isn't actually being raised, so I've removed this from the docstring.","created_at":"2017-11-20T08:32:44Z","updated_at":"2017-11-20T08:32:44Z","html_url":"https://github.com/metoppv/improver/pull/339#discussion_r151926422","pull_request_url":"https://api.github.com/repos/metoppv/improver/pulls/339","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/metoppv/improver/pulls/comments/151926422"},"html":{"href":"https://github.com/metoppv/improver/pull/339#discussion_r151926422"},"pull_request":{"href":"https://api.github.com/repos/metoppv/improver/pulls/339"}},"in_reply_to_id":151712398},"pull_request":{"url":"https://api.github.com/repos/metoppv/improver/pulls/339","id":153270742,"html_url":"https://github.com/metoppv/improver/pull/339","diff_url":"https://github.com/metoppv/improver/pull/339.diff","patch_url":"https://github.com/metoppv/improver/pull/339.patch","issue_url":"https://api.github.com/repos/metoppv/improver/issues/339","number":339,"state":"open","locked":false,"title":"Wet bulb temperature integral","user":{"login":"gavinevans","id":26933341,"avatar_url":"https://avatars3.githubusercontent.com/u/26933341?v=4","gravatar_id":"","url":"https://api.github.com/users/gavinevans","html_url":"https://github.com/gavinevans","followers_url":"https://api.github.com/users/gavinevans/followers","following_url":"https://api.github.com/users/gavinevans/following{/other_user}","gists_url":"https://api.github.com/users/gavinevans/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinevans/subscriptions","organizations_url":"https://api.github.com/users/gavinevans/orgs","repos_url":"https://api.github.com/users/gavinevans/repos","events_url":"https://api.github.com/users/gavinevans/events{/privacy}","received_events_url":"https://api.github.com/users/gavinevans/received_events","type":"User","site_admin":false},"body":"#195 \r\n\r\nTesting:\r\n - [x] Ran tests and they passed OK\r\n - [x] Added new tests for the new feature(s)\r\n","created_at":"2017-11-17T11:03:52Z","updated_at":"2017-11-20T08:32:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8ec8900b88cbc989733aa05f02fdc3dde25bcf7","assignee":{"login":"gavinevans","id":26933341,"avatar_url":"https://avatars3.githubusercontent.com/u/26933341?v=4","gravatar_id":"","url":"https://api.github.com/users/gavinevans","html_url":"https://github.com/gavinevans","followers_url":"https://api.github.com/users/gavinevans/followers","following_url":"https://api.github.com/users/gavinevans/following{/other_user}","gists_url":"https://api.github.com/users/gavinevans/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinevans/subscriptions","organizations_url":"https://api.github.com/users/gavinevans/orgs","repos_url":"https://api.github.com/users/gavinevans/repos","events_url":"https://api.github.com/users/gavinevans/events{/privacy}","received_events_url":"https://api.github.com/users/gavinevans/received_events","type":"User","site_admin":false},"assignees":[{"login":"gavinevans","id":26933341,"avatar_url":"https://avatars3.githubusercontent.com/u/26933341?v=4","gravatar_id":"","url":"https://api.github.com/users/gavinevans","html_url":"https://github.com/gavinevans","followers_url":"https://api.github.com/users/gavinevans/followers","following_url":"https://api.github.com/users/gavinevans/following{/other_user}","gists_url":"https://api.github.com/users/gavinevans/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinevans/subscriptions","organizations_url":"https://api.github.com/users/gavinevans/orgs","repos_url":"https://api.github.com/users/gavinevans/repos","events_url":"https://api.github.com/users/gavinevans/events{/privacy}","received_events_url":"https://api.github.com/users/gavinevans/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/metoppv/improver/pulls/339/commits","review_comments_url":"https://api.github.com/repos/metoppv/improver/pulls/339/comments","review_comment_url":"https://api.github.com/repos/metoppv/improver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/metoppv/improver/issues/339/comments","statuses_url":"https://api.github.com/repos/metoppv/improver/statuses/379ff03541dcd20316b4c8994548f06cf099ab68","head":{"label":"gavinevans:wet_bulb_temperature_integral","ref":"wet_bulb_temperature_integral","sha":"379ff03541dcd20316b4c8994548f06cf099ab68","user":{"login":"gavinevans","id":26933341,"avatar_url":"https://avatars3.githubusercontent.com/u/26933341?v=4","gravatar_id":"","url":"https://api.github.com/users/gavinevans","html_url":"https://github.com/gavinevans","followers_url":"https://api.github.com/users/gavinevans/followers","following_url":"https://api.github.com/users/gavinevans/following{/other_user}","gists_url":"https://api.github.com/users/gavinevans/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinevans/subscriptions","organizations_url":"https://api.github.com/users/gavinevans/orgs","repos_url":"https://api.github.com/users/gavinevans/repos","events_url":"https://api.github.com/users/gavinevans/events{/privacy}","received_events_url":"https://api.github.com/users/gavinevans/received_events","type":"User","site_admin":false},"repo":{"id":87411485,"name":"improver","full_name":"gavinevans/improver","owner":{"login":"gavinevans","id":26933341,"avatar_url":"https://avatars3.githubusercontent.com/u/26933341?v=4","gravatar_id":"","url":"https://api.github.com/users/gavinevans","html_url":"https://github.com/gavinevans","followers_url":"https://api.github.com/users/gavinevans/followers","following_url":"https://api.github.com/users/gavinevans/following{/other_user}","gists_url":"https://api.github.com/users/gavinevans/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinevans/subscriptions","organizations_url":"https://api.github.com/users/gavinevans/orgs","repos_url":"https://api.github.com/users/gavinevans/repos","events_url":"https://api.github.com/users/gavinevans/events{/privacy}","received_events_url":"https://api.github.com/users/gavinevans/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gavinevans/improver","description":"IMPROVER","fork":true,"url":"https://api.github.com/repos/gavinevans/improver","forks_url":"https://api.github.com/repos/gavinevans/improver/forks","keys_url":"https://api.github.com/repos/gavinevans/improver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gavinevans/improver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gavinevans/improver/teams","hooks_url":"https://api.github.com/repos/gavinevans/improver/hooks","issue_events_url":"https://api.github.com/repos/gavinevans/improver/issues/events{/number}","events_url":"https://api.github.com/repos/gavinevans/improver/events","assignees_url":"https://api.github.com/repos/gavinevans/improver/assignees{/user}","branches_url":"https://api.github.com/repos/gavinevans/improver/branches{/branch}","tags_url":"https://api.github.com/repos/gavinevans/improver/tags","blobs_url":"https://api.github.com/repos/gavinevans/improver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gavinevans/improver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gavinevans/improver/git/refs{/sha}","trees_url":"https://api.github.com/repos/gavinevans/improver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gavinevans/improver/statuses/{sha}","languages_url":"https://api.github.com/repos/gavinevans/improver/languages","stargazers_url":"https://api.github.com/repos/gavinevans/improver/stargazers","contributors_url":"https://api.github.com/repos/gavinevans/improver/contributors","subscribers_url":"https://api.github.com/repos/gavinevans/improver/subscribers","subscription_url":"https://api.github.com/repos/gavinevans/improver/subscription","commits_url":"https://api.github.com/repos/gavinevans/improver/commits{/sha}","git_commits_url":"https://api.github.com/repos/gavinevans/improver/git/commits{/sha}","comments_url":"https://api.github.com/repos/gavinevans/improver/comments{/number}","issue_comment_url":"https://api.github.com/repos/gavinevans/improver/issues/comments{/number}","contents_url":"https://api.github.com/repos/gavinevans/improver/contents/{+path}","compare_url":"https://api.github.com/repos/gavinevans/improver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gavinevans/improver/merges","archive_url":"https://api.github.com/repos/gavinevans/improver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gavinevans/improver/downloads","issues_url":"https://api.github.com/repos/gavinevans/improver/issues{/number}","pulls_url":"https://api.github.com/repos/gavinevans/improver/pulls{/number}","milestones_url":"https://api.github.com/repos/gavinevans/improver/milestones{/number}","notifications_url":"https://api.github.com/repos/gavinevans/improver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gavinevans/improver/labels{/name}","releases_url":"https://api.github.com/repos/gavinevans/improver/releases{/id}","deployments_url":"https://api.github.com/repos/gavinevans/improver/deployments","created_at":"2017-04-06T09:28:43Z","updated_at":"2017-04-06T10:19:29Z","pushed_at":"2017-11-20T08:27:05Z","git_url":"git://github.com/gavinevans/improver.git","ssh_url":"git@github.com:gavinevans/improver.git","clone_url":"https://github.com/gavinevans/improver.git","svn_url":"https://github.com/gavinevans/improver","homepage":null,"size":2120,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"metoppv:master","ref":"master","sha":"fa2b5fee8cde99d6907babe22d89eef941edff07","user":{"login":"metoppv","id":26465485,"avatar_url":"https://avatars2.githubusercontent.com/u/26465485?v=4","gravatar_id":"","url":"https://api.github.com/users/metoppv","html_url":"https://github.com/metoppv","followers_url":"https://api.github.com/users/metoppv/followers","following_url":"https://api.github.com/users/metoppv/following{/other_user}","gists_url":"https://api.github.com/users/metoppv/gists{/gist_id}","starred_url":"https://api.github.com/users/metoppv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metoppv/subscriptions","organizations_url":"https://api.github.com/users/metoppv/orgs","repos_url":"https://api.github.com/users/metoppv/repos","events_url":"https://api.github.com/users/metoppv/events{/privacy}","received_events_url":"https://api.github.com/users/metoppv/received_events","type":"Organization","site_admin":false},"repo":{"id":85334761,"name":"improver","full_name":"metoppv/improver","owner":{"login":"metoppv","id":26465485,"avatar_url":"https://avatars2.githubusercontent.com/u/26465485?v=4","gravatar_id":"","url":"https://api.github.com/users/metoppv","html_url":"https://github.com/metoppv","followers_url":"https://api.github.com/users/metoppv/followers","following_url":"https://api.github.com/users/metoppv/following{/other_user}","gists_url":"https://api.github.com/users/metoppv/gists{/gist_id}","starred_url":"https://api.github.com/users/metoppv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metoppv/subscriptions","organizations_url":"https://api.github.com/users/metoppv/orgs","repos_url":"https://api.github.com/users/metoppv/repos","events_url":"https://api.github.com/users/metoppv/events{/privacy}","received_events_url":"https://api.github.com/users/metoppv/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/metoppv/improver","description":"IMPROVER is a library of algorithms for meteorological post-processing and verification.","fork":false,"url":"https://api.github.com/repos/metoppv/improver","forks_url":"https://api.github.com/repos/metoppv/improver/forks","keys_url":"https://api.github.com/repos/metoppv/improver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/metoppv/improver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/metoppv/improver/teams","hooks_url":"https://api.github.com/repos/metoppv/improver/hooks","issue_events_url":"https://api.github.com/repos/metoppv/improver/issues/events{/number}","events_url":"https://api.github.com/repos/metoppv/improver/events","assignees_url":"https://api.github.com/repos/metoppv/improver/assignees{/user}","branches_url":"https://api.github.com/repos/metoppv/improver/branches{/branch}","tags_url":"https://api.github.com/repos/metoppv/improver/tags","blobs_url":"https://api.github.com/repos/metoppv/improver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/metoppv/improver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/metoppv/improver/git/refs{/sha}","trees_url":"https://api.github.com/repos/metoppv/improver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/metoppv/improver/statuses/{sha}","languages_url":"https://api.github.com/repos/metoppv/improver/languages","stargazers_url":"https://api.github.com/repos/metoppv/improver/stargazers","contributors_url":"https://api.github.com/repos/metoppv/improver/contributors","subscribers_url":"https://api.github.com/repos/metoppv/improver/subscribers","subscription_url":"https://api.github.com/repos/metoppv/improver/subscription","commits_url":"https://api.github.com/repos/metoppv/improver/commits{/sha}","git_commits_url":"https://api.github.com/repos/metoppv/improver/git/commits{/sha}","comments_url":"https://api.github.com/repos/metoppv/improver/comments{/number}","issue_comment_url":"https://api.github.com/repos/metoppv/improver/issues/comments{/number}","contents_url":"https://api.github.com/repos/metoppv/improver/contents/{+path}","compare_url":"https://api.github.com/repos/metoppv/improver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/metoppv/improver/merges","archive_url":"https://api.github.com/repos/metoppv/improver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/metoppv/improver/downloads","issues_url":"https://api.github.com/repos/metoppv/improver/issues{/number}","pulls_url":"https://api.github.com/repos/metoppv/improver/pulls{/number}","milestones_url":"https://api.github.com/repos/metoppv/improver/milestones{/number}","notifications_url":"https://api.github.com/repos/metoppv/improver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/metoppv/improver/labels{/name}","releases_url":"https://api.github.com/repos/metoppv/improver/releases{/id}","deployments_url":"https://api.github.com/repos/metoppv/improver/deployments","created_at":"2017-03-17T16:51:29Z","updated_at":"2017-10-25T21:54:21Z","pushed_at":"2017-11-20T08:27:06Z","git_url":"git://github.com/metoppv/improver.git","ssh_url":"git@github.com:metoppv/improver.git","clone_url":"https://github.com/metoppv/improver.git","svn_url":"https://github.com/metoppv/improver","homepage":"","size":1979,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":108,"forks":19,"open_issues":108,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/metoppv/improver/pulls/339"},"html":{"href":"https://github.com/metoppv/improver/pull/339"},"issue":{"href":"https://api.github.com/repos/metoppv/improver/issues/339"},"comments":{"href":"https://api.github.com/repos/metoppv/improver/issues/339/comments"},"review_comments":{"href":"https://api.github.com/repos/metoppv/improver/pulls/339/comments"},"review_comment":{"href":"https://api.github.com/repos/metoppv/improver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/metoppv/improver/pulls/339/commits"},"statuses":{"href":"https://api.github.com/repos/metoppv/improver/statuses/379ff03541dcd20316b4c8994548f06cf099ab68"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gavinevans"}}