I'm using ArcMap version 10.4.1. I'm attempting to create a model which almost works perfectly but I can't figure out the last bit.

Ultimately I want to run the "extract by mask" tool multiple times. However, the input for the raster layer is in one folder and the input for the mask layer is in another folder. Each raster/mask combination represents one day; the data differs for each day. There are an equal number of raster and mask files in each folder.

This is the full model which I created. The model runs the whole way through without throwing any errors. When the model finishes I get different raster layers but all extracted to the same mask. Everything else works correctly- I get a folder of different masks, and I get another folder of different rasters. I want to extract each raster to the mask for that day.

Full Model

The submodel on the top left creates the mask, while the submodel on the bottom left iterates through the folder which I'm populating the masks with. The submodel on the top right re-scales the raster layer. The submodel on the bottom right iterates through the folder where I put all the raster layers, and then runs the extract by mask tool. I put in pre-conditions (the dashed lines), so that the submodel on the bottom right, with the extract by mask tool, runs last.

The submodel on the top left, to create the cloud masks:

Mask Model, top left

The submodel on the top right, to re-scale the rasters:

Submodel top right, to process the rasters Submodel from the bottom left, to iterate through the folder of masks:

Iterate through the mask folder

The submodel from the bottom right. This iterates through the folder of rasters and runs extract by mask. The white "input raster" bubble connects to the output from the model that iterates through the folder of masks. Iterate through NDVI folder and run extract by mask

marked as duplicate by If you do not know- just GIS, Andre Silva, BBG_GIS, Jochen Schwarze, J.R Mar 11 at 12:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The suggestion to add a model within a model is correct; this is how I can use two iterators. However, I still get incorrect results, as I discuss here after placing the NNDVI model within the iterate_masks model, as suggested by Hornbydd: community.esri.com/message/837318 Ultimately, I feel that I'll need to do this in python and that I've hit something that cannot be done solely with model builder. – user5858 Mar 12 at 2:42
  • As an addendum, I'm able to do what I want with a few lines of Python code. I wasn't able to figure out how to do this solely using model builder. Rather, I saved the Python code as a script which I incorporated in the larger model. – user5858 Jun 11 at 1:39

I believe your bottom right (iterate_nndvi) model needs to be a sub-model in your bottom left (iterate_masks).

If you think about it, you enter iterate_masks, this loops as many times as needed then passes out a single mask raster, hence you are only extracting with one unchanging raster. Place iterate_nndvi inside iterate_masks and connect will ensure iterate_masks is run on every loop in iterate_nndvi .

Not the answer you're looking for? Browse other questions tagged or ask your own question.