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

Error saving workspace after running MakeStreams #15

Closed jessezondervan closed 5 years ago

jessezondervan commented 5 years ago

I've run the following code and tried to save my workspace:

PRECIP=GRIDobj ( 'Precip_filename' ) ;

saved workspace, 588 KB

2 [DEM,FD,A, S]=MakeStreams ( 'DEM_filename' ,1 e6 , ' precip_grid ' ,PRECIP)

successful, objects appear in the workspace.

Saved workspace, but hear the alert sound on a continuous loop and my workspace file has gone to 1 KB. Windows Task Manager's Physical Memory Usage History shows a fluctuating curve (continued start and stop of activity) This only stops when I close Matlab.

Best,

Jesse

PS: my DEM is 113 MB, 30 m ALOS

amforte commented 5 years ago

That certainly is a bit odd and I'm not sure what would be causing that (and the DEM certainly is a manageable size for Matlab). Is there a reason you're not using the built in aspect of MakeStreams that will save a MAT file containing the DEM, FD, A, and S outputs if you provide an entry to the optional 'file_name' parameter? In general, saving workspaces directly as opposed to saving specific or all variables in a workspace by name appears to be problematic sometimes (https://www.mathworks.com/matlabcentral/answers/56813-problem-saving-workspace-no-error-message) so this could be a general Matlab problem. I'll see what I can do in terms of investigating further.

jessezondervan commented 5 years ago

Hi Adam, I usually save the workspace in one file, rather than separate Matlab files for each object. I could give this a try.

Best, Jesse

amforte commented 5 years ago

Just to clarify, as you are likely aware, a single mat file can contain an arbitrary number of variables (eg the single mat file output from MakeStreams contains the DEM, FD, A, and S objects) so there is no need to have seperate mat files. I have generally avoided saving the workspace directly, and instead use the save command to save out whatever variables I wish to include. Generally the matlab forum is full of people reporting various issues with trying to save the workspace in its entirety and various other users (and mathworks employees) telling them it’s a bad idea to do so, albeit without much explanation of why.

jessezondervan commented 5 years ago

Aha, that's interesting. Very peculiar indeed. Thanks Adam!

amforte commented 5 years ago

I'm going to go ahead and close this issue since I don't think it's necessarily (or at least demonstrably) a problem with the TAK codes.