RASTER ITERATION AND RASTER CALCULATOR

2906
15
07-29-2013 06:49 AM
anTonialcaraz
Occasional Contributor II
Hi,

I'm trying to calculate Maximum Oxygen Content (MOC) from Temperature and Salinity raster layers in Model Builder.
I have 15 different sea depth layers and 12 different months making a total of 180 rasters calculated using an equation within Raster Calculator.
I've done two sub-models with and Iterator each (one for Temperature and one for Salinity) and put them into a model with the Raster Calculator tool added (see graphic). I'm also using variable substitution in the output (%Name%) but I'm only getting one single output.

Any suggestions would be greatly appreciated.

Thanks
0 Kudos
15 Replies
DanielHall_Ballester
New Contributor III
Hi,
you will only get one output in this model as there is no iterator in the main model.
So your O2a and O2b models will run (with their iterators), however you will only get a single output from each (I'm guessing the last temperature and the last salinity)
If you could attach an image of the 2 submodels, I may be able to help you re-design these.
Thanks
Dan
0 Kudos
anTonialcaraz
Occasional Contributor II
Hi Dan,

Thanks a lot for you reply.

Please see the two sub-models attached.

Many thanks

Toni
0 Kudos
DanielHall_Ballester
New Contributor III
Hi Toni,
attached are 2 screenshots which should be enough to guide you to your solution.  I have fewer inputs into my field calculator, but the principle is the same.
I hope this helps!
Dan
0 Kudos
anTonialcaraz
Occasional Contributor II
Hi Dan,

I'm very grateful, thanks. I think it works fine but I have a couple of doubts:

1: Is it picking up the right layers when doing the calculation? Please see the attachments. For example "t_1389_apr" needs to go with "sl1389_apr" in the equation calculation; t_1389_jan" with "sl1389_jan" and so on...

2: In the outputs I'm getting (for example): "MOC_t_1389_apr_mol" and I want "MOC_1389_apr_mol" (see final model attached)


Thanks a lot Dan

Toni
0 Kudos
DanielHall_Ballester
New Contributor III
Hi Toni,
it should work through your rasters sequentially, so as long as they are in the same order in your workspace it should be fine.
One way to test this, would be to make the Name variable within your salinity model a parameter (rename it to something else as you're already using Name as a temperature output variable), and then add it to your final file name.
i.e. so your final output is "MOC_%TName%_%SName%_mol where %TName% is the Name variable from the temperature output, and %SName% is the Name variable from the salinity output.
If this doesn't work, try putting your temperature and salinity input rasters into 2 different workspaces (it looks like you currently have them all in the same workspace).
Thanks
Dan
0 Kudos
anTonialcaraz
Occasional Contributor II
Hi Dan,

I tested it and indeed uses the right layers.
Any thoughts on how to get rid of the "t" in the final output names? "MOC_1389_apr_mol" instead of "MOC_t_1389_apr_mol"

Thanks very much

Toni
0 Kudos
anTonialcaraz
Occasional Contributor II
Sorry Dan,

I was wrong before. It actually uses always the last Salinity layer in the list to do the calculation.

Thanks
0 Kudos
anTonialcaraz
Occasional Contributor II
Hi again,

I tried also putting the Temperature and Salinity layers in different workspaces but is still picking up the last Salinity layer in the list.

Cheers
0 Kudos
DanielHall_Ballester
New Contributor III
Hi Toni,
is there a chance you could send me some of the data?  I don't actually have any sensible raster data I could use to trial this. Just 2 files of each would do.
Thanks
0 Kudos