Upload
jade-mcdonald
View
214
Download
2
Embed Size (px)
Citation preview
Generating hollow or pit free DEMs
The How
The Problem As Stated By Chris
• From a cell in the channel of my DEM I need to be able to trace uphill and find every cell
• Another way to look at it is that from every cell in my DEM I need to be able to go downhill in any way and reach the channel and not get stuck in a hollow
• …basically, my DEM has hollows and for a model I am using I effectively need to get rid of the hollows by filling them in…
• …actually what I need is for the maximum flow direction path from every cell to eventually end up in the channel…
Immediate questions
• What constitutes a contiguity?– What sort of neighbourhoods are we dealing
with?• In this case all cells in a 3x3 so diagonals are allowed
– NB. This is a special case of a circle so an extension might be to relax the contiguity condition to a neighbourhood defined by some function
• Is your DEM one block and does it roughly represent a catchment?– If so pick a cell where to cal the outflow
• Why an earth would you want to do this?– What is the result to be used for?
• Modelling floods?– Concentrate on how
How to fill in the hollows?
• The first thing to do is find them• This involves going through the
entire dataset analysing differences height (flows) 10 9 8
11 10 9
12 6
Identify the hollows
• A cell that is not noData and is surrounded by cells which are either higher or noData or the same height10 10 11
11 10 12
12 11
Fill hollows quickly and efficiently
• Easy?– Simply raise all the hollows height to be
equal to the minimum height of their neighbours plus a little bit
• Done?– No because new hollows may have been
created
• So repeat everything until there are no more
– That should work … eventually, but it may take a very very long time!
Anyway what is a little bit?
• From now on lets call it tollerance:– The smallest number that can be
added to (subtracted from) the number so that I have a number that is recognisably larger (smaller) than the number I started with given the precision of numbers I am dealing with
– The minimum y such thatx + y > x and x - y < x
Ding dong hollows
• Consider the following part of the DEM
13 14 14 31
11 6 7 32
10 51 15 42
An agent based approach
• If we knew that a hollow at this iteration is next to a hollow at the last iteration then they could be treated as part of the same hollow
• Likewise if we knew that a hollow at this iteration is next to another hollow then we can also treat them as part of the same hollow
• We can use cellular agents to trace out the bottom of each hollow and raise it to the height of its minimum neighbours adding those neighbours to the hollow until we find a downhill
• This can be explained with a wiggly line
A wiggly line
Channel
Initial Hollows
1 2 34
Another HollowTop
The basic algorithm
1. Calculate initial hollows and add these to a set of known hollows
2. Select a hollow that has not yet been treated3. Trace the bottom of the hollow finding all adjoining
hollows4. Calculate the minimum height of the neighbours of
the traced hollow and add these neighbours to the hollow set so long as they are not lower than the current height of the hollow
5. Raise all cells in the hollow set to the calculated minimum height + tollerance
6. Repeat Steps 2 to 6 until all hollows treated7. Check every cell visited to see if it is now a hollow8. Repeat steps 2 to 8 until there are no more hollows
Simple?
• Easy to implement?– When you know how
• The code was written in Java as part of a grids package that can do all sorts of other interesting and useful things
• The whole thing is based on collections– These are what remember things (like
where we have been and what the hollow set is) by containing the IDs of cells
• Think of the IDs as the row column index
Java Collections
• What is so good about them?– Convenience
• It is easy to add to them and remove from them other collections and individual objects• It is easy to iterate through the elements (objects) in the collection• It is easy to test whether they contain something
– They are fast, efficient and reliable• There are many different sorts of collections
– HashTables– HashTrees– Lists etc…
• The main collections used were HashSets and the following snippet ofJava code instantiates (creates a new) one
HashSet hs = new HashSet();
• The following Java code adds a cellID object to it
hs.add( cell );
• The following Java code removes all the elements (objects) in hs from another collection c
hs.removeAll( c );
Questions
• How fast is the implementation?– Fast enough?– Quantifying just how fast is a non-trivial task
and to do it well we need• A standard set of datasets for testing• To test on different machines with different
processors and different sizes and types of memory
• Is the implementation scaleable?– Yes, you do not have to rely on that RAM
stuff it works efficiently with files on disc• What other methods for DEMs are in the
grids package?
Discussion
• Would any extensions or modifications be useful?– Identifying the catchments– Identifying the channel etc like Peter Fisher
• Surely this agent based approach has been done and written about before– If we think it is worth writing up we should
refer to where and when
• Do we think it is worth writing up yet or do we need something more first, and if so what?