{"action":"created","issue":{"url":"https://api.github.com/repos/spectralpython/spectral/issues/42","repository_url":"https://api.github.com/repos/spectralpython/spectral","labels_url":"https://api.github.com/repos/spectralpython/spectral/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/spectralpython/spectral/issues/42/comments","events_url":"https://api.github.com/repos/spectralpython/spectral/issues/42/events","html_url":"https://github.com/spectralpython/spectral/issues/42","id":144838054,"number":42,"title":"Add protection to all ENVI omitted header labels","user":{"login":"kidpixo","id":2255209,"avatar_url":"https://avatars.githubusercontent.com/u/2255209?v=3","gravatar_id":"","url":"https://api.github.com/users/kidpixo","html_url":"https://github.com/kidpixo","followers_url":"https://api.github.com/users/kidpixo/followers","following_url":"https://api.github.com/users/kidpixo/following{/other_user}","gists_url":"https://api.github.com/users/kidpixo/gists{/gist_id}","starred_url":"https://api.github.com/users/kidpixo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kidpixo/subscriptions","organizations_url":"https://api.github.com/users/kidpixo/orgs","repos_url":"https://api.github.com/users/kidpixo/repos","events_url":"https://api.github.com/users/kidpixo/events{/privacy}","received_events_url":"https://api.github.com/users/kidpixo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spectralpython/spectral/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/spectralpython/spectral/milestones/7","html_url":"https://github.com/spectralpython/spectral/milestones/v0.18.0","labels_url":"https://api.github.com/repos/spectralpython/spectral/milestones/7/labels","id":1676149,"number":7,"title":"v0.18.0","description":null,"creator":{"login":"tboggs","id":4976161,"avatar_url":"https://avatars.githubusercontent.com/u/4976161?v=3","gravatar_id":"","url":"https://api.github.com/users/tboggs","html_url":"https://github.com/tboggs","followers_url":"https://api.github.com/users/tboggs/followers","following_url":"https://api.github.com/users/tboggs/following{/other_user}","gists_url":"https://api.github.com/users/tboggs/gists{/gist_id}","starred_url":"https://api.github.com/users/tboggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tboggs/subscriptions","organizations_url":"https://api.github.com/users/tboggs/orgs","repos_url":"https://api.github.com/users/tboggs/repos","events_url":"https://api.github.com/users/tboggs/events{/privacy}","received_events_url":"https://api.github.com/users/tboggs/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2016-03-31T14:16:04Z","updated_at":"2016-03-31T14:16:04Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-03-31T09:17:45Z","updated_at":"2016-03-31T14:34:21Z","closed_at":null,"body":"Following #41, add protection for all the ENVI header label with a default values, in case they are not in the Header file.\r\n\r\nOfficial documentation : \r\n\r\n- [ENVI Header Files (Using ENVI) | Exelis VIS Docs Center](http://www.harrisgeospatial.com/docs/ENVIHeaderFiles.html)\r\n- [Enter Optional Header Information (Using ENVI) | Exelis VIS Docs Center](http://www.harrisgeospatial.com/docs/enteroptionalheaderinformation.html)\r\n\r\nI'll try to do on my fork and PR soon.\r\n"},"comment":{"url":"https://api.github.com/repos/spectralpython/spectral/issues/comments/203967092","html_url":"https://github.com/spectralpython/spectral/issues/42#issuecomment-203967092","issue_url":"https://api.github.com/repos/spectralpython/spectral/issues/42","id":203967092,"user":{"login":"kidpixo","id":2255209,"avatar_url":"https://avatars.githubusercontent.com/u/2255209?v=3","gravatar_id":"","url":"https://api.github.com/users/kidpixo","html_url":"https://github.com/kidpixo","followers_url":"https://api.github.com/users/kidpixo/followers","following_url":"https://api.github.com/users/kidpixo/following{/other_user}","gists_url":"https://api.github.com/users/kidpixo/gists{/gist_id}","starred_url":"https://api.github.com/users/kidpixo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kidpixo/subscriptions","organizations_url":"https://api.github.com/users/kidpixo/orgs","repos_url":"https://api.github.com/users/kidpixo/repos","events_url":"https://api.github.com/users/kidpixo/events{/privacy}","received_events_url":"https://api.github.com/users/kidpixo/received_events","type":"User","site_admin":false},"created_at":"2016-03-31T14:34:21Z","updated_at":"2016-03-31T14:34:21Z","body":"Sounds reasonable, I would then put in a bare minimum set. \r\nAt least all the parameter implicitly defined in `spectral/io/envi.py`\r\nin the function `gen_params()` should have a default , otherwise the reader will crash.\r\n\r\nTherefore all the the parameter in this snippet of code should be have a fallback status, if not defined.\r\n\r\n```python\r\n    p.nbands = int(h[\"bands\"])\r\n    p.nrows = int(h[\"lines\"])\r\n    p.ncols = int(h[\"samples\"])\r\n    p.offset = int(h[\"header offset\"]) if \"header offset\" in h else int(0)\r\n    p.byte_order = int(h[\"byte order\"])\r\n    p.dtype = np.dtype(envi_to_dtype[str(h[\"data type\"])]).str\r\n```\r\nBut maybe make sense to crash for some missing keyword, I put a question mark fot those parameter here above.\r\n\r\nWhat to do with a label with missing \"bands\" keyword?\r\n\r\n| local name | envi header | default | \r\n|---|---|---|\r\n|nbands     | \"bands\"| ? |\r\n|nrows      | \"lines\"| ? |\r\n|ncols      | \"samples\" | ? |\r\n|offset     | \"header offset\"| 0 |\r\n|byte_order | \"byte order\"| 0? |\r\n|dtype      | \"data type\"| ? |\r\n\r\n"}}