amforte / Topographic-Analysis-Kit

Set of matlab based tools for topographic analysis, built on top of TopoToolbox.
GNU General Public License v3.0
42 stars 35 forks source link

Example dataset and instruction manual? #32

Closed abn-codes closed 4 years ago

abn-codes commented 4 years ago

Hi Adam, I'm working through some topographic analysis on a lidar-derived dem from a small watershed in the Guadalupe Mountains. These tools look great, but I am running into some issues working with Matlab2019a (passes the 'CheckDependencies' check). I'm not sure if it's just the DEM I'm using and the way I am using these functions, or if something is off.

I guess first thing: The instruction manual has a lot of detail, and for someone who is familiar with Topotoolbox they can get on their way.. but to start out, I would rather work through a guided example DEM exercise that pairs with the instruction manual. Is there something like this written up?

Something like a tutorial of each function with an example DEM? I know the profiler toolbar had this option with an example DEM from big Tujunga... so an example that works from a large regional DEM, clip out watersheds for analysis, perform Basin-wide analysis for clipped basins, then perform analysis on individual tributaries and reaches?

For example, I'm stuck on the 'ProcessingRiverBasins' step (trying to index out the few watersheds that I want to study). This step is taking very long on my machine and has not completed, although the DEM can 'MakeStreams' and do 'BasinPicker' fine to get pourpoints. (I attach a dropbox link to the .7z file that contains my working directory, a processing script, and the DEM I am using). Maybe you can take a look at debug?

https://www.dropbox.com/s/eh0c9mxfo9u3r15/Guads_TAK_analysis.7z?dl=0

Error_process_river_basins

I am pretty sure something is wrong, because this ^^ function never finishes, but I've never used these functions before on an example DEM, so I can't tell and I don't know what to ask.

Ok well let me know what you think, or if there are examples that I can download somewhere.

Thanks,

-Al

amforte commented 4 years ago

Hi Al, There will be something like you're looking for in a few days actually as I've been working on preparing this for a short course on TAK I'm running at GSA. I'll try to make those files available to everyone after the short course is done.

In the meantime, can you provide the outlet file you created and provided to ProcessRiverBasins? Without that, it's hard to reproduce what's happening (as I don't know how many outlets there were). I'm also confused as you said it didn't complete but you have 1 result in the 'Processed_basins' folder and the screenshot shows that you only had 1 basin?

As for the error on processing the geotiff, that's a TopoToolbox issue. Something about the projection you're using (or the way the projection information is stored) is not being ready by TopoToolbox. What is the projection and how did you process the data before bringing it into Matlab?

-Adam

abn-codes commented 4 years ago

Hey Adam thanks for the quick response,

Adding the tutorial from the TAK course sounds great. It'd be nice to have this to pass on to undergraduates here too (thesis students) and maybe incorporate into our geomorphology labs.

Here is the outlets file, the processed_basins result, and snap of the clipped DEM. Sorry, I thought it was included in the prior .7z

https://www.dropbox.com/s/tww2uukeluu57nb/TAK.7z?dl=0

Ok but yes so double checking, it looks like the 'Processed_basins' result includes the clipped DEM and products (nice!), but for some reason the 'ProcessRiverBasins' function would not run to completion on one of our newer desktops (process time >10 minutes on a small DEM (1000 x 1000) and I would have to crash-exit matlab). It looks like the results stored in the Processed_basins folder have what I would need to keep going, but I wasn't sure if the processing time for this routine was unreasonably long?

Or is there an option to just clip the DEM to the watershed using the pourpoint and skip the relief, ksn, ect.. calculations that might be tedious? -- there might be a routine in topotoolbox that does this already. My workflow is usually to pick watersheds, clip the DEMs from pourpoints to the drainage divide, and then do the targeted river analyses.

This input DEM was clipped to its non-rectangular shape using ArcGIS 10.6.1 from a 1-m resolution lidar DEM. It is in a .tif format. It is projected in NAD83 Utm13N with a vertical coordinate system of NAVD88.

Hope preparing for the course is going well.. This seems like a really great set of tools, and I'm looking forward to getting familiar with them!

Cheers,

-Al

amforte commented 4 years ago

Ok, so there are two things happening here, neither of them technically errors (and thankfully not newer versions of Matlab breaking everything, phew).

1) The reason you were getting the warnings about 'no stream network meeting your criteria' is that when ProcessRiverBasins clips a basin, it then regenerates the stream network based on the provided threshold area. If you do not give it a value for this optional parameter, it will use 1e6, but in this case, this basin is so small that there are no streams defined if the threshold area is 1e6. The code is set up to not break in this instance and it progressively lowers the threshold area until it creates a non empty stream network. That was what generated the warning text, but not the apparent hang up of the code, for that...

2) The code by default uses a radius of 5 km to generate an interpolated ksn map. With with resolution (1m) and size of your DEM being small, that meant it was finding the average of every pixel for as many pixels as there was. The code will eventually complete if left, but takes an unreasonably long time in this case. The solution (without updating or editing your version) is to set this value to something small, like 100m, and then your basin is extracted and the code completes very quickly. So your call would like like:

ProcessRiverBains(DEM,FD,A,S,Outlets,'name_of_basin_folder','threshold_area',10000,'ksn_radius',100);

I just updated the code to accept an empty value for this ksn_radius that will suppress creating it all together if you wish.

In regards to a stripped down version of ProcessRiverBasins, the problem is that a lot of the other codes depend on a standard output of ProcessRiverBasins so setting up a way to suppress those outputs starts to have ripple effects (or starts requiring endless series of logical flags saved along with outputs or constant querying of files for the presence or absence of things). Generally, I've restricted it to doing relatively quick things (like ksn) and making things like relief optional (and off by default). Now with the ability to turn off the interpolated ksn map, that should allow things to happen even more quickly, assuming you don't want an interpolated ksn map.

If you want to make a slimmed down version (and understand that it will break Basin2Shape, Basin2Raster, CompileBasinStats, and BasinStatsPlots), you could just comment out the relevant bits in the code. The guts that does the clipping is basically line 255-266. You could use just a version of that do just chop out basins if that's all you want.

As I think this is resolved now, I'm going to go ahead and close this issue.

-Adam