{"action":"created","issue":{"url":"https://api.github.com/repos/dtarb/TauDEM/issues/195","repository_url":"https://api.github.com/repos/dtarb/TauDEM","labels_url":"https://api.github.com/repos/dtarb/TauDEM/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/dtarb/TauDEM/issues/195/comments","events_url":"https://api.github.com/repos/dtarb/TauDEM/issues/195/events","html_url":"https://github.com/dtarb/TauDEM/issues/195","id":394291534,"node_id":"MDU6SXNzdWUzOTQyOTE1MzQ=","number":195,"title":"taudem returns no value on some cells","user":{"login":"WindingWinter","id":13161574,"node_id":"MDQ6VXNlcjEzMTYxNTc0","avatar_url":"https://avatars3.githubusercontent.com/u/13161574?v=4","gravatar_id":"","url":"https://api.github.com/users/WindingWinter","html_url":"https://github.com/WindingWinter","followers_url":"https://api.github.com/users/WindingWinter/followers","following_url":"https://api.github.com/users/WindingWinter/following{/other_user}","gists_url":"https://api.github.com/users/WindingWinter/gists{/gist_id}","starred_url":"https://api.github.com/users/WindingWinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WindingWinter/subscriptions","organizations_url":"https://api.github.com/users/WindingWinter/orgs","repos_url":"https://api.github.com/users/WindingWinter/repos","events_url":"https://api.github.com/users/WindingWinter/events{/privacy}","received_events_url":"https://api.github.com/users/WindingWinter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-27T04:31:37Z","updated_at":"2018-12-27T12:32:48Z","closed_at":null,"author_association":"NONE","body":"I have a `tif` file, that, when runs with taudem command below:\r\n\r\n```\r\n1. PitRemove.exe drhow.tif\r\n2. D8FlowDir.exe -p drhow.tif -sd8 drhowsd8.tif -fel drhowfel.tif\r\n3. aread8.exe -p drhowp.tif -ad8 drhowad8.tif\r\n4. Gridnet.exe -p drhowp.tif -plen drhowplen.tif -tlen drhowtlen.tif -gord drhowgord.tif\r\n5. PeukerDouglas.exe -fel drhowfel.tif -ss drhowss.tif\r\n6. aread8.exe -p drhowp.tif -wg drhowss.tif -ad8 drhowssa.tif\r\n7.  Threshold.exe -ssa drhowssa.tif -src drhowsrc.tif -thresh 5\r\n8.  Streamnet.exe -fel drhowfel.tif  -p drhowp.tif  -ad8 drhowad8.tif -src drhowsrc.tif -ord drhoword.tif -tree drhowtree.dat -coord drhowcoord.dat -net drhownet.shp -w drhoww.tif\r\n```\r\n\r\nWill result in a lot of missing values in the output, as shown below:\r\n\r\n![many kinks](https://user-images.githubusercontent.com/13161574/50465448-6263ca80-09d2-11e9-91fc-66895f12c2f2.png)\r\n\r\n\r\nChanging the threshold value will result in different topology, with missing values appearing at maybe different other places.\r\n\r\nI understand that my [rendering engine might occasionally produce holes](https://github.com/dtarb/TauDEM/issues/194), but I believe that those missing cell values are not the artifacts of the rendering engine, rather, the taudem outputs as such. I did a calculation on the invalid geometries and found that they only consist of less than 1% of the total area, so the large scale missing values must come from elsewhere.\r\n\r\nIs this the normal behavior? How can I tune the taudem engine so that it returns some values for all input cells that originally have values?\r\n\r\n[drhow.zip](https://github.com/dtarb/TauDEM/files/2711422/drhow.zip)\r\n\r\n\r\n### One thing I discovered: \r\n\r\nIf I compare the area of the cells that have value in the input (`drhow.tif`) and ones in the output (`drhoww.tif`), I find that the output consists only of 63% of the input. Which means that there are some 37% missing after running the taudem. Can those cell be recovered?\r\n\r\nI use GDAL to count the number of cell and then calculate the cell area.  Code in C# ( it should be trivial to convert it to C++ or Python or any other languages)\r\n\r\n```\r\n        public static double ComputeArea(Dataset ds)\r\n        {\r\n            var nCol = ds.RasterXSize;\r\n            var nRow = ds.RasterYSize;\r\n            double[] geoTransform = new double[6];\r\n            ds.GetGeoTransform(geoTransform);\r\n            var cellSize = Math.Abs(geoTransform[5]);\r\n            Band band = ds.GetRasterBand(1);\r\n            var allValues = new int[nCol * nRow];\r\n            double noData;\r\n            int hasVal;\r\n            band.GetNoDataValue(out noData, out hasVal);\r\n            band.ReadRaster(0, 0, nCol, nRow, allValues, nCol, nRow, 0, 0);\r\n            var goValueCount =allValues.Count(val => val != noData);\r\n            return goValueCount * cellSize * cellSize;\r\n\r\n        }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dtarb/TauDEM/issues/comments/450142541","html_url":"https://github.com/dtarb/TauDEM/issues/195#issuecomment-450142541","issue_url":"https://api.github.com/repos/dtarb/TauDEM/issues/195","id":450142541,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDE0MjU0MQ==","user":{"login":"dtarb","id":3456833,"node_id":"MDQ6VXNlcjM0NTY4MzM=","avatar_url":"https://avatars1.githubusercontent.com/u/3456833?v=4","gravatar_id":"","url":"https://api.github.com/users/dtarb","html_url":"https://github.com/dtarb","followers_url":"https://api.github.com/users/dtarb/followers","following_url":"https://api.github.com/users/dtarb/following{/other_user}","gists_url":"https://api.github.com/users/dtarb/gists{/gist_id}","starred_url":"https://api.github.com/users/dtarb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtarb/subscriptions","organizations_url":"https://api.github.com/users/dtarb/orgs","repos_url":"https://api.github.com/users/dtarb/repos","events_url":"https://api.github.com/users/dtarb/events{/privacy}","received_events_url":"https://api.github.com/users/dtarb/received_events","type":"User","site_admin":false},"created_at":"2018-12-27T12:32:48Z","updated_at":"2018-12-27T12:32:48Z","author_association":"OWNER","body":"There are a lot of no data values in results from AreaD8 and any following results that depend on them due to edge contamination.  See http://hydrology.usu.edu/taudem/taudem5/help53/D8ContributingArea.html.  Edge contamination occurs when drainage is inwards from the boundaries or areas with no data values for elevation. The algorithm recognizes this and reports \"no data\" for the contributing area. It is common to see streaks of \"no data\" values extending inwards from boundaries along flow paths that enter the domain at a boundary. This is the desired effect and indicates that contributing area for these grid cells is unknown due to it being dependent on terrain outside of the domain of data available. Edge contamination checking may be turned off in cases where you know this is not an issue or want to ignore these problems, if for example, the DEM has been clipped along a watershed outline.\r\n\r\nIf you use the -nc flag with the AreaD8 function you can turn off edge contamination checking.  There will then be fewer no data value results.  You will always get some no data value results due to flow direction not being evaluated on the edge rows."}}
{"actor":{"display_login":"dtarb"}}