I am attempting to do zonal statistics for multiple images and I need to add an extra field that will have the name of each raster file in each row to the finally appended file. I have added a field before appending but when I run the model it fails to do this. I get the following error:
General error executing calculator. ERROR 999999: Error executing function. Expected end of statement Failed to execute (Calculate Field).
The expression in the calculate field is %Name%
. I have followed the instructions on Iterate through multiple Raster files and compute statistics using Zonal Statistics and Iterate zonal statistics table model builder - add field and name each row by raster
The raster files are tiff files with long names e.g. MCD43B3.A2002001.h21v09.005.2007114212806.hdf.tif and I am interested in the name because it has the datestamp "A2002001". I need this included in the final appended Table so I can know for which date the zonal statistics belong.
In calculate field, under the expression I typed %Name%
and choose the calculate field that was added in the file bsa_20021. This follows the advice given in the threads Iterate through multiple Raster files and compute statistics using Zonal Statistics and Iterate zonal statistics table model builder - add field and name each row by raster
For some reason, it is not clear how this is supposed to work.