# Cell counts and flow direction

Recently, as I was playing around with the DEM for what I will undoubtedly inadvertently refer to as “my watershed”, as if I own it. The watershed in question is a small one…I don’t know the area off the top of my head but on my other screen here I have ArcMap open, so…looks like 707392.5 square meters, according to the Shape_Area field of the watershed polygon I converted from the basin computed from the flow direction based on the filled 1/3″ NED. Bit of false precision there, I’d guess…for convenience and because really what I wanted to express is the order of magnitude, let’s just call it 707000 sq m, which I guess is what… 0.7 square km, as a ballpark figure. It’s at the upper part of the Laguna Canyon watershed, in the sort of northeastern San Joaquin Hills, conceptually defined as the area draining to Barbara’s Lake.
I was looking at the DEM for a squarish area covering an area several times larger than the watershed. Again, I have Arc open, so…about 800 cells on a side, so about 8 km on an edge, 64 sq km overall. And I was looking at the flow direction raster for the area of the watershed and thinking that because the bulk of drainage, that is, the accumulated overland flow, should go southwest toward Laguna Canyon and out to the Pacific, to the adjacent parallel canyon and in the same direction, or to the northeast corner of the map where it goes out onto the plain and turns south, ultimately to the Pacific as well. Clipped in tight, it should all go southwest. But how does the flow accumulation, I wondered, compare with the flow direction. So I opened up the attribute tables and took a look at the count of each cell classification in the flow direction raster. I won’t go deep into the various tools I mention here…rather, I would refer you to ESRI’s online desktop help page http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z00000052000000.htm, where you can find more detail. I copied the numbers over to Excel and made first something that looked kind of like a scree plot, for those who know what that is. The labels below the horizontal axis were ordered highest count to lowest. To my initial surprise, the majority of cells were classified east, followed by west. The other directions all had much lower values, but north and south were next. I could see most of the flow being east and west, perpendicular to the ridges and the channels–that makes perfect sense, but why then north and south, rather than northeast, southeast, northwest, southwest? I sorted in numerical order so that the axis began with due east and went around in a circle clockwise. With a smooth line fit through the numbers, it looks a bit like a sin wave with some kind of amplitude boost every other upward peak. Really, because ArcGIS calculates flow to the 8 neighboring cells, a more appropriate graph would reflect the discrete nature of the possible values, but I include the graph here uncorrected in this regard.
I posted a note on facebook showing this graph, and pondering whether this pattern, each peak corresponding to one of the cardinal directions (E, S, W, N) and each trough one of the ordinal (SE, SW, NW, NE), was an artifact of the gridded data, perhaps bias introduced by something in the flow direction algorithm. I received some feedback from colleagues at Long Beach, Brian Nagy and Greg Ziolkowski, stimulating and combining with some of my own evolving thoughts on the matter, which I well get into next blog.