I have a set of models that use Calculate Value to store file locations as strings for use in model variables and outputs, and am having an issue with the model either hanging on to the first value it calculates for each, or not using the value properly later.
For example, my first model takes an input raster (Input DEM), parses its path (stores as DEMdirstr), feeds the path to a calculate value (expression = r"%DEMdirstr%"; not using the "r" would give us issues with files starting with "t"), which outputs the value as a folder data type to be used in Create Directory (which won't take DEMdirstr on its own), and the value from Create Output Directory is HYA_Workspace, which we attempt to use as in inline variable in output names throughout the model.
If I run the model by double-clicking it and supply parameters in the dialog box it will create the directory, but the first geoprocessing tool (Pit Remove) will fail because the inline variable for %HYA_Workspace% is being returned as a "1".
Executing (Pit Remove): PitRemove I:\InterpolationResearch\t03\TTR\t03dem.tif 12 1\P2v1_q02\q02_fel.tifIf I run the model by supplying the locations within the model it will complete, but it was ALWAYS use that first value calculated for HYA_Workspace. It will not recalculate that value.
We've feel like we've been careful to set preconditions as appropriate. I don't understand why the directory creation would work, but then the directory created couldn't be used by the next step in the model. I'm hoping there's a simple solution we're missing.
Please comment as necessary for clarification or edit the posting if things are unclear!
أكثر...
For example, my first model takes an input raster (Input DEM), parses its path (stores as DEMdirstr), feeds the path to a calculate value (expression = r"%DEMdirstr%"; not using the "r" would give us issues with files starting with "t"), which outputs the value as a folder data type to be used in Create Directory (which won't take DEMdirstr on its own), and the value from Create Output Directory is HYA_Workspace, which we attempt to use as in inline variable in output names throughout the model.

If I run the model by double-clicking it and supply parameters in the dialog box it will create the directory, but the first geoprocessing tool (Pit Remove) will fail because the inline variable for %HYA_Workspace% is being returned as a "1".
Executing (Pit Remove): PitRemove I:\InterpolationResearch\t03\TTR\t03dem.tif 12 1\P2v1_q02\q02_fel.tifIf I run the model by supplying the locations within the model it will complete, but it was ALWAYS use that first value calculated for HYA_Workspace. It will not recalculate that value.
We've feel like we've been careful to set preconditions as appropriate. I don't understand why the directory creation would work, but then the directory created couldn't be used by the next step in the model. I'm hoping there's a simple solution we're missing.
Please comment as necessary for clarification or edit the posting if things are unclear!
أكثر...