What exactly are you trying to do - p1 + r1
p1 + r2
p1 + r3
p2 + r1
p2 + r2
...or:p1 + r1
p2 + r2
p3 + r3
If it's the second, a much more straightforward method to do this is to iterate on one set (say, the precip folder you showed) and use the Calculate Value tool to generate the pathname of the other one. Here's an example expression:[INDENT]expression: r_path(r"%P_raster%")code block:
rfolder = r"C:\myfolder\rrasters"
pname = os.path.basename(praster) # P_srg10.tif
pname = os.path.splitext(pname) # P_srg10
rname = pname.replace("P_","R_") + "_ols.tif" # R_srg10_ols.tif
return os.path.join(rfolder, rname) # "C:\myfolder\rrasters\R_rgs10_ols.tif"type: Raster Dataset[/INDENT]Set the output of the Calculate Value to type Raster Dataset and then then both raster variables will be available in the Raster Calculator.For your output name, you probably want to do another Calculate Value to create a name for your output raster that isn't so long:[INDENT]expression: get_number(r"%P_raster%")code block:
pname = os.path.basename(praster)
pname = os.path.splitext(pname) # "P_srg10"
pnum = pname.replace("P_srg","") # "10"
return pnumtype: String[/INDENT]Use the output raster name PR%value%.tif for the output from the Raster Calculator. Make sure this second calculate value is a precondition to the Raster Calculator so the name will be ready when the Raster Calculator runs.You could simplify the above functions by incorporating the model builder tool Parse Path and perhaps using the raster name output of the iterator instead of the full path.