GitHub PullRequestReviewCommentEvent at 2014-02-11 16:32:47
Repository: iris
Actor: bjlittle
Payload: {"comment":{"url":"https://api.github.com/repos/SciTools/iris/pulls/comments/9630711","id":9630711,"diff_hunk":"@@ -1276,3 +1276,32 @@ def regular_step(coord):\n         msg = \"Coord %s is not regular\" % coord.name()\n         raise iris.exceptions.CoordinateNotRegularError(msg)\n     return avdiff.astype(coord.points.dtype)\n+\n+\n+def unify_time_units(cubes):\n+    \"\"\"\n+    Convert the time units of all time coords in the cubes in a given\n+    iterable to have a common epoch, defined from the first suitable time\n+    coordinate found in the input cubes.\n+\n+    Arg:\n+\n+    * cubes:\n+        An iterable of :class:`iris.cube.Cube`s.\n+\n+    Returns: an iterable of :class:`iris.cube.Cube`s.\n+\n+    \"\"\"\n+    new_epoch = None\n+\n+    for cube in cubes:\n+        for time_coord in cube.coords():\n+            if time_coord.units.is_time_reference():\n+                if new_epoch is None:\n+                    new_epoch = time_coord.units.origin\n+                else:\n+                    new_unit = iris.unit.Unit(new_epoch,\n+                                              time_coord.units.calendar)\n+                    time_coord.convert_units(new_unit)\n+\n+    return cubes","path":"lib/iris/util.py","position":32,"original_position":32,"commit_id":"d14d8ba9ab92ab773ed1616e1439d21baffb659c","original_commit_id":"d14d8ba9ab92ab773ed1616e1439d21baffb659c","user":{"login":"bjlittle","id":2051656,"avatar_url":"https://gravatar.com/avatar/907798185f1ed99aead3bb410977197b?d=https%3A%2F%2Fidenticons.github.com%2Fdb3f48893678f13c66be6bc13ba5b0dd.png&r=x","gravatar_id":"907798185f1ed99aead3bb410977197b","url":"https://api.github.com/users/bjlittle","html_url":"https://github.com/bjlittle","followers_url":"https://api.github.com/users/bjlittle/followers","following_url":"https://api.github.com/users/bjlittle/following{/other_user}","gists_url":"https://api.github.com/users/bjlittle/gists{/gist_id}","starred_url":"https://api.github.com/users/bjlittle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjlittle/subscriptions","organizations_url":"https://api.github.com/users/bjlittle/orgs","repos_url":"https://api.github.com/users/bjlittle/repos","events_url":"https://api.github.com/users/bjlittle/events{/privacy}","received_events_url":"https://api.github.com/users/bjlittle/received_events","type":"User","site_admin":false},"body":"Does this work properly across different calendars?","created_at":"2014-02-11T16:32:47Z","updated_at":"2014-02-11T16:32:47Z","html_url":"https://github.com/SciTools/iris/pull/1003#discussion_r9630711","pull_request_url":"https://api.github.com/repos/SciTools/iris/pulls/1003","_links":{"self":{"href":"https://api.github.com/repos/SciTools/iris/pulls/comments/9630711"},"html":{"href":"https://github.com/SciTools/iris/pull/1003#discussion_r9630711"},"pull_request":{"href":"https://api.github.com/repos/SciTools/iris/pulls/1003"}}}}