{"action":"closed","issue":{"url":"https://api.github.com/repos/descarteslabs/descarteslabs-python/issues/49","repository_url":"https://api.github.com/repos/descarteslabs/descarteslabs-python","labels_url":"https://api.github.com/repos/descarteslabs/descarteslabs-python/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/descarteslabs/descarteslabs-python/issues/49/comments","events_url":"https://api.github.com/repos/descarteslabs/descarteslabs-python/issues/49/events","html_url":"https://github.com/descarteslabs/descarteslabs-python/issues/49","id":220059629,"number":49,"title":"metadata.search returns keys in new-to-old order","user":{"login":"rkeisler","id":4852957,"avatar_url":"https://avatars0.githubusercontent.com/u/4852957?v=3","gravatar_id":"","url":"https://api.github.com/users/rkeisler","html_url":"https://github.com/rkeisler","followers_url":"https://api.github.com/users/rkeisler/followers","following_url":"https://api.github.com/users/rkeisler/following{/other_user}","gists_url":"https://api.github.com/users/rkeisler/gists{/gist_id}","starred_url":"https://api.github.com/users/rkeisler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkeisler/subscriptions","organizations_url":"https://api.github.com/users/rkeisler/orgs","repos_url":"https://api.github.com/users/rkeisler/repos","events_url":"https://api.github.com/users/rkeisler/events{/privacy}","received_events_url":"https://api.github.com/users/rkeisler/received_events","type":"User","site_admin":false},"labels":[{"id":566687782,"url":"https://api.github.com/repos/descarteslabs/descarteslabs-python/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":{"login":"samskillman","id":3792514,"avatar_url":"https://avatars0.githubusercontent.com/u/3792514?v=3","gravatar_id":"","url":"https://api.github.com/users/samskillman","html_url":"https://github.com/samskillman","followers_url":"https://api.github.com/users/samskillman/followers","following_url":"https://api.github.com/users/samskillman/following{/other_user}","gists_url":"https://api.github.com/users/samskillman/gists{/gist_id}","starred_url":"https://api.github.com/users/samskillman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samskillman/subscriptions","organizations_url":"https://api.github.com/users/samskillman/orgs","repos_url":"https://api.github.com/users/samskillman/repos","events_url":"https://api.github.com/users/samskillman/events{/privacy}","received_events_url":"https://api.github.com/users/samskillman/received_events","type":"User","site_admin":false},"assignees":[{"login":"samskillman","id":3792514,"avatar_url":"https://avatars0.githubusercontent.com/u/3792514?v=3","gravatar_id":"","url":"https://api.github.com/users/samskillman","html_url":"https://github.com/samskillman","followers_url":"https://api.github.com/users/samskillman/followers","following_url":"https://api.github.com/users/samskillman/following{/other_user}","gists_url":"https://api.github.com/users/samskillman/gists{/gist_id}","starred_url":"https://api.github.com/users/samskillman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samskillman/subscriptions","organizations_url":"https://api.github.com/users/samskillman/orgs","repos_url":"https://api.github.com/users/samskillman/repos","events_url":"https://api.github.com/users/samskillman/events{/privacy}","received_events_url":"https://api.github.com/users/samskillman/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2017-04-06T23:07:02Z","updated_at":"2017-04-07T22:52:41Z","closed_at":"2017-04-07T22:52:41Z","body":"```\nimport json\nimport imagery\nimport descarteslabs as dl\ndlk = dl.raster.dlkey_from_latlon(31.42417852, -96.24699805, 30., 512, 0)\n\n# get scenes using imagery.search\nscenes1 = imagery.search(satellite='L8', shape=json.dumps(dlk['geometry']), start_time='2014-01-01', end_time='2014-03-01')\n\n# get scenes using metadata.search\nscenes2 = dl.metadata.search(const_id=['L8'], geom=json.dumps(dlk['geometry']), start_time='2014-01-01', end_time='2014-03-01')\n```\n\n`imagery.search` returns keys in old-to-new order.\n```\n[u'meta_LC80260382014015_v1',\n u'meta_LC80260382014031_v1',\n u'meta_LC80260382014047_v1']\n```\n\n\n`metadata.search` returns keys in new-to-old order.\n```\n[u'meta_LC80260382014047_v1',\n u'meta_LC80260382014031_v1',\n u'meta_LC80260382014015_v1']\n```\n\nIMO, old-to-new order is preferable, because then `.raster(multiple_scenes)` will make a mosaic image with the most recent imagery on top.\n\nNow, things get more complicated when you pass multiple `const_id`s to `metadata.search`.  The results come back grouped by `const_id`, and are sorted new-to-old within each `const_id`.  For example, searching L7 and L8 yields:\n\n```\n[u'meta_LE70260382014055_v1',\n u'meta_LE70260382014039_v1',\n u'meta_LE70260382014023_v1',\n u'meta_LE70260382014007_v1',\n u'meta_LC80260382014047_v1',\n u'meta_LC80260382014031_v1',\n u'meta_LC80260382014015_v1']\n```\n\nI don't know how difficult this would be to implement, but I propose that we return the scenes with a global ordering based explicitly on the scene acquisition time, going from old-to-new.  In that case, `.raster(multiple_scenes)` would make a mosaic image with the most recent imagery on top."}}
{"actor":{"display_login":"samskillman"}}