{"action":"created","issue":{"url":"https://api.github.com/repos/dutri001/bfastSpatial/issues/57","labels_url":"https://api.github.com/repos/dutri001/bfastSpatial/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/dutri001/bfastSpatial/issues/57/comments","events_url":"https://api.github.com/repos/dutri001/bfastSpatial/issues/57/events","html_url":"https://github.com/dutri001/bfastSpatial/issues/57","id":126854475,"number":57,"title":"Problem with cleanMODIS(), Cannot create a RasterLayer object from this file. (file does not exist)","user":{"login":"TimWeatherman","id":16590457,"avatar_url":"https://avatars.githubusercontent.com/u/16590457?v=3","gravatar_id":"","url":"https://api.github.com/users/TimWeatherman","html_url":"https://github.com/TimWeatherman","followers_url":"https://api.github.com/users/TimWeatherman/followers","following_url":"https://api.github.com/users/TimWeatherman/following{/other_user}","gists_url":"https://api.github.com/users/TimWeatherman/gists{/gist_id}","starred_url":"https://api.github.com/users/TimWeatherman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimWeatherman/subscriptions","organizations_url":"https://api.github.com/users/TimWeatherman/orgs","repos_url":"https://api.github.com/users/TimWeatherman/repos","events_url":"https://api.github.com/users/TimWeatherman/events{/privacy}","received_events_url":"https://api.github.com/users/TimWeatherman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-15T11:20:38Z","updated_at":"2016-01-15T12:43:47Z","closed_at":null,"body":"In cleanMODIS.r line 56, the call to raster() is on the subset string rather than the filename that is returned from readGDAL(), like on line 55. This causes an error, file does not exist.\r\n\r\n```\r\nError in .local(.Object, ...) : \r\n  `/home/tim/geoscripting/Project/data/HDF4_EOS:EOS_GRID:MCD15A2H.A2002193.h19v03.006.2015149105839.hdf:MOD_Grid_MOD15A2H:FparLai_QC' does not exist in the file system,\r\nand is not recognised as a supported dataset name.\r\n\r\n\r\nError in .rasterObjectFromFile(x, band = band, objecttype = \"RasterLayer\",  : \r\n  Cannot create a RasterLayer object from this file. (file does not exist)\r\n```\r\n\r\nA reproducible case is: \r\n```{r}\r\nlibrary(bfastSpatial)\r\ndownload.file(\"http://e4ftl01.cr.usgs.gov//MODV6_Cmp_A/MOTA/MCD15A2H.006/2002.07.04/MCD15A2H.A2002185.h19v03.006.2015149105834.hdf\", method = \"wget\", destfile = \"MCD15A2H.A2002193.h19v03.006.2015149105839.hdf\")\r\n\r\nQC <- raster(get_subdatasets(\"MCD15A2H.A2002193.h19v03.006.2015149105839.hdf\")[3])\r\nQC <- raster(readGDAL(get_subdatasets(\"MCD15A2H.A2002193.h19v03.006.2015149105839.hdf\")[3]))\r\n```\r\nThe first line fails, the second line works correctly."},"comment":{"url":"https://api.github.com/repos/dutri001/bfastSpatial/issues/comments/171951188","html_url":"https://github.com/dutri001/bfastSpatial/issues/57#issuecomment-171951188","issue_url":"https://api.github.com/repos/dutri001/bfastSpatial/issues/57","id":171951188,"user":{"login":"dutri001","id":5638829,"avatar_url":"https://avatars.githubusercontent.com/u/5638829?v=3","gravatar_id":"","url":"https://api.github.com/users/dutri001","html_url":"https://github.com/dutri001","followers_url":"https://api.github.com/users/dutri001/followers","following_url":"https://api.github.com/users/dutri001/following{/other_user}","gists_url":"https://api.github.com/users/dutri001/gists{/gist_id}","starred_url":"https://api.github.com/users/dutri001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dutri001/subscriptions","organizations_url":"https://api.github.com/users/dutri001/orgs","repos_url":"https://api.github.com/users/dutri001/repos","events_url":"https://api.github.com/users/dutri001/events{/privacy}","received_events_url":"https://api.github.com/users/dutri001/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T12:43:47Z","updated_at":"2016-01-15T12:43:47Z","body":"It works if you use full path."}}