{"action":"created","comment":{"url":"https://api.github.com/repos/satellogic/telluric/pulls/comments/239421409","pull_request_review_id":182189293,"id":239421409,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTQyMTQwOQ==","diff_hunk":"@@ -56,11 +58,111 @@ def test_georaster_wms_vrt():\n     assert raster.resolution() == 1\n     assert raster.crs == constants.WEB_MERCATOR_CRS\n     assert raster.footprint().difference(vector).area < 0.9\n+    # this new assert doesn't pass\n+    # assert raster.pixel_crop((10, 10, 100, 100))\n+\n+\n+def test_georaster_wms_vrt_with_destination_file():\n+    vector = GeoFeature.from_record(record, crs=constants.WGS84_CRS).geometry\n+    with NamedTemporaryFile(suffix='.vrt') as f:\n+        raster = GeoRaster2.from_wms(\"tests/data/google.xml\", vector, resolution=1, destination_file=f.name)\n+        assert raster._filename == f.name\n+        assert os.path.exists(f.name)\n+        assert raster.resolution() == 1\n+        assert raster.crs == constants.WEB_MERCATOR_CRS\n+        assert raster.footprint().difference(vector).area < 0.9\n \n \n def test_boundless_vrt():\n     with rasterio.open(\"tests/data/raster/overlap2.tif\") as raster:\n-        doc = boundless_vrt_doc(raster)\n+        doc = boundless_vrt_doc(raster).tostring()\n     with open(\"tests/data/raster/overlap2.vrt\", 'rb') as expected_src:\n         expected = expected_src.read()\n         assert expected == doc\n+\n+\n+def test_raster_list_vrt_for_single_raster():\n+    rasters = [\n+        GeoRaster2.open(\"tests/data/raster/overlap1.tif\"),\n+    ]\n+    doc = raster_list_vrt(rasters, False).tostring()\n+    with TemporaryDirectory() as d:\n+        file_name = os.path.join(d, 'vrt_file.vrt')\n+        with open(file_name, 'wb') as f:\n+            f.write(doc)\n+        raster = GeoRaster2.open(file_name)\n+        assert raster.crs == rasters[0].crs\n+        assert raster.shape == rasters[0].shape\n+        assert raster.affine.almost_equals(rasters[0].affine)\n+        assert (raster.image.data == rasters[0].image.data).all()\n+\n+\n+def test_vrt_from_single_raster():\n+    rasters = [\n+        GeoRaster2.open(\"tests/data/raster/overlap1.tif\"),\n+    ]\n+    raster = GeoRaster2.from_rasters(rasters, False)\n+    assert raster.crs == rasters[0].crs\n+    assert raster.shape == rasters[0].shape\n+    assert raster.affine.almost_equals(rasters[0].affine)\n+    assert (raster.image.data == rasters[0].image.data).all()\n+\n+\n+def test_vrt_from_multi_raster():\n+    rasters = [\n+        GeoRaster2.open(\"tests/data/raster/overlap1.tif\"),\n+        GeoRaster2.open(\"tests/data/raster/overlap2.tif\")\n+    ]\n+    raster = GeoRaster2.from_rasters(rasters, False)\n+    # made by gdalbuildvrt\n+    expected = GeoRaster2.open(\"tests/data/raster/expected_overlaps.vrt\")\n+    assert raster.crs == expected.crs\n+    assert raster.shape == expected.shape\n+    # is this reasonable\n+    relative_precission = 10e-6 * expected.resolution()\n+    assert raster.affine.almost_equals(expected.affine, precision=relative_precission)\n+    assert (raster.image == expected.image).all()\n+\n+\n+def test_vrt_from_multi_raster_and_save_to_file():\n+    rasters = [\n+        GeoRaster2.open(\"tests/data/raster/overlap1.tif\"),\n+        GeoRaster2.open(\"tests/data/raster/overlap2.tif\")\n+    ]\n+    with NamedTemporaryFile(suffix='.vrt') as f:\n+\n+        raster = GeoRaster2.from_rasters(rasters, False, destination_file=f.name)\n+        assert raster._filename == f.name\n+        assert os.path.exists(f.name)\n+        # made by gdalbuildvrt\n+        expected = GeoRaster2.open(\"tests/data/raster/expected_overlaps.vrt\")\n+        assert raster.crs == expected.crs\n+        assert raster.shape == expected.shape\n+        # is this reasonable\n+        relative_precission = 10e-6 * expected.resolution()","path":"tests/test_vrt.py","position":110,"original_position":110,"commit_id":"d561aecd11f0ce861b5692ae09e881851a7b2ce8","original_commit_id":"d561aecd11f0ce861b5692ae09e881851a7b2ce8","user":{"login":"guydou","id":93029,"node_id":"MDQ6VXNlcjkzMDI5","avatar_url":"https://avatars0.githubusercontent.com/u/93029?v=4","gravatar_id":"","url":"https://api.github.com/users/guydou","html_url":"https://github.com/guydou","followers_url":"https://api.github.com/users/guydou/followers","following_url":"https://api.github.com/users/guydou/following{/other_user}","gists_url":"https://api.github.com/users/guydou/gists{/gist_id}","starred_url":"https://api.github.com/users/guydou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guydou/subscriptions","organizations_url":"https://api.github.com/users/guydou/orgs","repos_url":"https://api.github.com/users/guydou/repos","events_url":"https://api.github.com/users/guydou/events{/privacy}","received_events_url":"https://api.github.com/users/guydou/received_events","type":"User","site_admin":false},"body":"what is the logic of this calculation?","created_at":"2018-12-06T11:38:45Z","updated_at":"2018-12-06T11:56:04Z","html_url":"https://github.com/satellogic/telluric/pull/195#discussion_r239421409","pull_request_url":"https://api.github.com/repos/satellogic/telluric/pulls/195","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/satellogic/telluric/pulls/comments/239421409"},"html":{"href":"https://github.com/satellogic/telluric/pull/195#discussion_r239421409"},"pull_request":{"href":"https://api.github.com/repos/satellogic/telluric/pulls/195"}}},"pull_request":{"url":"https://api.github.com/repos/satellogic/telluric/pulls/195","id":236231593,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2MjMxNTkz","html_url":"https://github.com/satellogic/telluric/pull/195","diff_url":"https://github.com/satellogic/telluric/pull/195.diff","patch_url":"https://github.com/satellogic/telluric/pull/195.patch","issue_url":"https://api.github.com/repos/satellogic/telluric/issues/195","number":195,"state":"open","locked":false,"title":"Create a vrt from a list of rasters","user":{"login":"arielze","id":1247079,"node_id":"MDQ6VXNlcjEyNDcwNzk=","avatar_url":"https://avatars2.githubusercontent.com/u/1247079?v=4","gravatar_id":"","url":"https://api.github.com/users/arielze","html_url":"https://github.com/arielze","followers_url":"https://api.github.com/users/arielze/followers","following_url":"https://api.github.com/users/arielze/following{/other_user}","gists_url":"https://api.github.com/users/arielze/gists{/gist_id}","starred_url":"https://api.github.com/users/arielze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arielze/subscriptions","organizations_url":"https://api.github.com/users/arielze/orgs","repos_url":"https://api.github.com/users/arielze/repos","events_url":"https://api.github.com/users/arielze/events{/privacy}","received_events_url":"https://api.github.com/users/arielze/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-05T16:08:18Z","updated_at":"2018-12-06T11:56:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02921f6cef6fc92f0f2bf9178cd87851ca48c524","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/satellogic/telluric/pulls/195/commits","review_comments_url":"https://api.github.com/repos/satellogic/telluric/pulls/195/comments","review_comment_url":"https://api.github.com/repos/satellogic/telluric/pulls/comments{/number}","comments_url":"https://api.github.com/repos/satellogic/telluric/issues/195/comments","statuses_url":"https://api.github.com/repos/satellogic/telluric/statuses/d561aecd11f0ce861b5692ae09e881851a7b2ce8","head":{"label":"satellogic:raster_list_to_vrt","ref":"raster_list_to_vrt","sha":"d561aecd11f0ce861b5692ae09e881851a7b2ce8","user":{"login":"satellogic","id":5545050,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU1NDUwNTA=","avatar_url":"https://avatars2.githubusercontent.com/u/5545050?v=4","gravatar_id":"","url":"https://api.github.com/users/satellogic","html_url":"https://github.com/satellogic","followers_url":"https://api.github.com/users/satellogic/followers","following_url":"https://api.github.com/users/satellogic/following{/other_user}","gists_url":"https://api.github.com/users/satellogic/gists{/gist_id}","starred_url":"https://api.github.com/users/satellogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satellogic/subscriptions","organizations_url":"https://api.github.com/users/satellogic/orgs","repos_url":"https://api.github.com/users/satellogic/repos","events_url":"https://api.github.com/users/satellogic/events{/privacy}","received_events_url":"https://api.github.com/users/satellogic/received_events","type":"Organization","site_admin":false},"repo":{"id":128917083,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg5MTcwODM=","name":"telluric","full_name":"satellogic/telluric","private":false,"owner":{"login":"satellogic","id":5545050,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU1NDUwNTA=","avatar_url":"https://avatars2.githubusercontent.com/u/5545050?v=4","gravatar_id":"","url":"https://api.github.com/users/satellogic","html_url":"https://github.com/satellogic","followers_url":"https://api.github.com/users/satellogic/followers","following_url":"https://api.github.com/users/satellogic/following{/other_user}","gists_url":"https://api.github.com/users/satellogic/gists{/gist_id}","starred_url":"https://api.github.com/users/satellogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satellogic/subscriptions","organizations_url":"https://api.github.com/users/satellogic/orgs","repos_url":"https://api.github.com/users/satellogic/repos","events_url":"https://api.github.com/users/satellogic/events{/privacy}","received_events_url":"https://api.github.com/users/satellogic/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/satellogic/telluric","description":"telluric is a Python library to manage vector and raster geospatial data in an interactive and easy way","fork":false,"url":"https://api.github.com/repos/satellogic/telluric","forks_url":"https://api.github.com/repos/satellogic/telluric/forks","keys_url":"https://api.github.com/repos/satellogic/telluric/keys{/key_id}","collaborators_url":"https://api.github.com/repos/satellogic/telluric/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/satellogic/telluric/teams","hooks_url":"https://api.github.com/repos/satellogic/telluric/hooks","issue_events_url":"https://api.github.com/repos/satellogic/telluric/issues/events{/number}","events_url":"https://api.github.com/repos/satellogic/telluric/events","assignees_url":"https://api.github.com/repos/satellogic/telluric/assignees{/user}","branches_url":"https://api.github.com/repos/satellogic/telluric/branches{/branch}","tags_url":"https://api.github.com/repos/satellogic/telluric/tags","blobs_url":"https://api.github.com/repos/satellogic/telluric/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/satellogic/telluric/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/satellogic/telluric/git/refs{/sha}","trees_url":"https://api.github.com/repos/satellogic/telluric/git/trees{/sha}","statuses_url":"https://api.github.com/repos/satellogic/telluric/statuses/{sha}","languages_url":"https://api.github.com/repos/satellogic/telluric/languages","stargazers_url":"https://api.github.com/repos/satellogic/telluric/stargazers","contributors_url":"https://api.github.com/repos/satellogic/telluric/contributors","subscribers_url":"https://api.github.com/repos/satellogic/telluric/subscribers","subscription_url":"https://api.github.com/repos/satellogic/telluric/subscription","commits_url":"https://api.github.com/repos/satellogic/telluric/commits{/sha}","git_commits_url":"https://api.github.com/repos/satellogic/telluric/git/commits{/sha}","comments_url":"https://api.github.com/repos/satellogic/telluric/comments{/number}","issue_comment_url":"https://api.github.com/repos/satellogic/telluric/issues/comments{/number}","contents_url":"https://api.github.com/repos/satellogic/telluric/contents/{+path}","compare_url":"https://api.github.com/repos/satellogic/telluric/compare/{base}...{head}","merges_url":"https://api.github.com/repos/satellogic/telluric/merges","archive_url":"https://api.github.com/repos/satellogic/telluric/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/satellogic/telluric/downloads","issues_url":"https://api.github.com/repos/satellogic/telluric/issues{/number}","pulls_url":"https://api.github.com/repos/satellogic/telluric/pulls{/number}","milestones_url":"https://api.github.com/repos/satellogic/telluric/milestones{/number}","notifications_url":"https://api.github.com/repos/satellogic/telluric/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/satellogic/telluric/labels{/name}","releases_url":"https://api.github.com/repos/satellogic/telluric/releases{/id}","deployments_url":"https://api.github.com/repos/satellogic/telluric/deployments","created_at":"2018-04-10T10:43:15Z","updated_at":"2018-12-05T11:04:33Z","pushed_at":"2018-12-06T10:06:51Z","git_url":"git://github.com/satellogic/telluric.git","ssh_url":"git@github.com:satellogic/telluric.git","clone_url":"https://github.com/satellogic/telluric.git","svn_url":"https://github.com/satellogic/telluric","homepage":null,"size":22315,"stargazers_count":33,"watchers_count":33,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":44,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":9,"open_issues":44,"watchers":33,"default_branch":"master"}},"base":{"label":"satellogic:master","ref":"master","sha":"228784e29f9a8afc0c8f913604b1b472633c264b","user":{"login":"satellogic","id":5545050,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU1NDUwNTA=","avatar_url":"https://avatars2.githubusercontent.com/u/5545050?v=4","gravatar_id":"","url":"https://api.github.com/users/satellogic","html_url":"https://github.com/satellogic","followers_url":"https://api.github.com/users/satellogic/followers","following_url":"https://api.github.com/users/satellogic/following{/other_user}","gists_url":"https://api.github.com/users/satellogic/gists{/gist_id}","starred_url":"https://api.github.com/users/satellogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satellogic/subscriptions","organizations_url":"https://api.github.com/users/satellogic/orgs","repos_url":"https://api.github.com/users/satellogic/repos","events_url":"https://api.github.com/users/satellogic/events{/privacy}","received_events_url":"https://api.github.com/users/satellogic/received_events","type":"Organization","site_admin":false},"repo":{"id":128917083,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg5MTcwODM=","name":"telluric","full_name":"satellogic/telluric","private":false,"owner":{"login":"satellogic","id":5545050,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU1NDUwNTA=","avatar_url":"https://avatars2.githubusercontent.com/u/5545050?v=4","gravatar_id":"","url":"https://api.github.com/users/satellogic","html_url":"https://github.com/satellogic","followers_url":"https://api.github.com/users/satellogic/followers","following_url":"https://api.github.com/users/satellogic/following{/other_user}","gists_url":"https://api.github.com/users/satellogic/gists{/gist_id}","starred_url":"https://api.github.com/users/satellogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satellogic/subscriptions","organizations_url":"https://api.github.com/users/satellogic/orgs","repos_url":"https://api.github.com/users/satellogic/repos","events_url":"https://api.github.com/users/satellogic/events{/privacy}","received_events_url":"https://api.github.com/users/satellogic/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/satellogic/telluric","description":"telluric is a Python library to manage vector and raster geospatial data in an interactive and easy way","fork":false,"url":"https://api.github.com/repos/satellogic/telluric","forks_url":"https://api.github.com/repos/satellogic/telluric/forks","keys_url":"https://api.github.com/repos/satellogic/telluric/keys{/key_id}","collaborators_url":"https://api.github.com/repos/satellogic/telluric/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/satellogic/telluric/teams","hooks_url":"https://api.github.com/repos/satellogic/telluric/hooks","issue_events_url":"https://api.github.com/repos/satellogic/telluric/issues/events{/number}","events_url":"https://api.github.com/repos/satellogic/telluric/events","assignees_url":"https://api.github.com/repos/satellogic/telluric/assignees{/user}","branches_url":"https://api.github.com/repos/satellogic/telluric/branches{/branch}","tags_url":"https://api.github.com/repos/satellogic/telluric/tags","blobs_url":"https://api.github.com/repos/satellogic/telluric/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/satellogic/telluric/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/satellogic/telluric/git/refs{/sha}","trees_url":"https://api.github.com/repos/satellogic/telluric/git/trees{/sha}","statuses_url":"https://api.github.com/repos/satellogic/telluric/statuses/{sha}","languages_url":"https://api.github.com/repos/satellogic/telluric/languages","stargazers_url":"https://api.github.com/repos/satellogic/telluric/stargazers","contributors_url":"https://api.github.com/repos/satellogic/telluric/contributors","subscribers_url":"https://api.github.com/repos/satellogic/telluric/subscribers","subscription_url":"https://api.github.com/repos/satellogic/telluric/subscription","commits_url":"https://api.github.com/repos/satellogic/telluric/commits{/sha}","git_commits_url":"https://api.github.com/repos/satellogic/telluric/git/commits{/sha}","comments_url":"https://api.github.com/repos/satellogic/telluric/comments{/number}","issue_comment_url":"https://api.github.com/repos/satellogic/telluric/issues/comments{/number}","contents_url":"https://api.github.com/repos/satellogic/telluric/contents/{+path}","compare_url":"https://api.github.com/repos/satellogic/telluric/compare/{base}...{head}","merges_url":"https://api.github.com/repos/satellogic/telluric/merges","archive_url":"https://api.github.com/repos/satellogic/telluric/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/satellogic/telluric/downloads","issues_url":"https://api.github.com/repos/satellogic/telluric/issues{/number}","pulls_url":"https://api.github.com/repos/satellogic/telluric/pulls{/number}","milestones_url":"https://api.github.com/repos/satellogic/telluric/milestones{/number}","notifications_url":"https://api.github.com/repos/satellogic/telluric/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/satellogic/telluric/labels{/name}","releases_url":"https://api.github.com/repos/satellogic/telluric/releases{/id}","deployments_url":"https://api.github.com/repos/satellogic/telluric/deployments","created_at":"2018-04-10T10:43:15Z","updated_at":"2018-12-05T11:04:33Z","pushed_at":"2018-12-06T10:06:51Z","git_url":"git://github.com/satellogic/telluric.git","ssh_url":"git@github.com:satellogic/telluric.git","clone_url":"https://github.com/satellogic/telluric.git","svn_url":"https://github.com/satellogic/telluric","homepage":null,"size":22315,"stargazers_count":33,"watchers_count":33,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":44,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":9,"open_issues":44,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/satellogic/telluric/pulls/195"},"html":{"href":"https://github.com/satellogic/telluric/pull/195"},"issue":{"href":"https://api.github.com/repos/satellogic/telluric/issues/195"},"comments":{"href":"https://api.github.com/repos/satellogic/telluric/issues/195/comments"},"review_comments":{"href":"https://api.github.com/repos/satellogic/telluric/pulls/195/comments"},"review_comment":{"href":"https://api.github.com/repos/satellogic/telluric/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/satellogic/telluric/pulls/195/commits"},"statuses":{"href":"https://api.github.com/repos/satellogic/telluric/statuses/d561aecd11f0ce861b5692ae09e881851a7b2ce8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"guydou"}}