{"action":"created","issue":{"url":"https://api.github.com/repos/Unidata/netcdf4-python/issues/527","repository_url":"https://api.github.com/repos/Unidata/netcdf4-python","labels_url":"https://api.github.com/repos/Unidata/netcdf4-python/issues/527/labels{/name}","comments_url":"https://api.github.com/repos/Unidata/netcdf4-python/issues/527/comments","events_url":"https://api.github.com/repos/Unidata/netcdf4-python/issues/527/events","html_url":"https://github.com/Unidata/netcdf4-python/issues/527","id":132994880,"number":527,"title":"accessing unset entries in VLEN variable causes crash","user":{"login":"jhprinz","id":5091934,"avatar_url":"https://avatars.githubusercontent.com/u/5091934?v=3","gravatar_id":"","url":"https://api.github.com/users/jhprinz","html_url":"https://github.com/jhprinz","followers_url":"https://api.github.com/users/jhprinz/followers","following_url":"https://api.github.com/users/jhprinz/following{/other_user}","gists_url":"https://api.github.com/users/jhprinz/gists{/gist_id}","starred_url":"https://api.github.com/users/jhprinz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhprinz/subscriptions","organizations_url":"https://api.github.com/users/jhprinz/orgs","repos_url":"https://api.github.com/users/jhprinz/repos","events_url":"https://api.github.com/users/jhprinz/events{/privacy}","received_events_url":"https://api.github.com/users/jhprinz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-02-11T14:59:15Z","updated_at":"2016-02-19T20:43:06Z","closed_at":null,"body":"I created a VLEN variable for numpy.float64 like this with the first (and only) dimension unlimited.\r\n```\r\n<type 'netCDF4._netCDF4.Variable'>\r\nvlen test(mydim1)\r\n    var_type: numpy.float64\r\nvlen data type: float64\r\nunlimited dimensions: mydim1\r\ncurrent shape = (3,)\r\n```\r\nCurrently the dimension `mydim` has length 3 although I have only set values for entries 0 and 1 like\r\n```py\r\nvar = ncfile.variables['test']\r\n\r\nvar[0] = np.array([1.0, ...])\r\nvar[1] = np.array([0.1, ...])\r\n```\r\n\r\nwhen I try to load the content from `var[3]` this gives me the expected `KeyError` since there are only 3 and not 4 elements in the variable stored. However doing this\r\n\r\n```py\r\nprint var[2]\r\n\r\n>>> Crash\r\n```\r\n\r\nwill crash my ipython kernel. The same is true for slicing\r\n\r\n```py\r\nprint var[:]\r\n\r\n>>> Crash\r\n```\r\n\r\n\r\nI am not sure what the intended behavior is for reading unset values in VLEN variables and if this is also a problem in the wrapped netCDF library."},"comment":{"url":"https://api.github.com/repos/Unidata/netcdf4-python/issues/comments/186397507","html_url":"https://github.com/Unidata/netcdf4-python/issues/527#issuecomment-186397507","issue_url":"https://api.github.com/repos/Unidata/netcdf4-python/issues/527","id":186397507,"user":{"login":"WardF","id":4324946,"avatar_url":"https://avatars.githubusercontent.com/u/4324946?v=3","gravatar_id":"","url":"https://api.github.com/users/WardF","html_url":"https://github.com/WardF","followers_url":"https://api.github.com/users/WardF/followers","following_url":"https://api.github.com/users/WardF/following{/other_user}","gists_url":"https://api.github.com/users/WardF/gists{/gist_id}","starred_url":"https://api.github.com/users/WardF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardF/subscriptions","organizations_url":"https://api.github.com/users/WardF/orgs","repos_url":"https://api.github.com/users/WardF/repos","events_url":"https://api.github.com/users/WardF/events{/privacy}","received_events_url":"https://api.github.com/users/WardF/received_events","type":"User","site_admin":false},"created_at":"2016-02-19T20:43:06Z","updated_at":"2016-02-19T20:43:06Z","body":"The fix for this issue has been merged into `netcdf-c:master`; see https://github.com/Unidata/netcdf-c/pull/224 for details.  The issue was in reading the file, not writing it, so the same test file can be used with the new version.  I've closed the related `netcdf-c` issue, but will reopen if need be;  It's plausible I've missed an edge case.  Thanks again for the letting me know about the issue!"}}