I'm new to ModelBuilder.
I have a large series of rasters divided into two categories, let's call it Type A & Type B, a pair for each of a few hundred date/time snapshots. The date/time for the snapshot is in the file name (roughly in the middle with a standard structure), and the Type is in the filename (near but not at the end). They're all in a folder together. I need to calculate a new raster for each date/time snapshot using the Type A raster & Type B raster to do so.
I know how to iterate rasters, and I know how to use raster calculator but how can I can store a raster while I'm iterating so that I can use both A & B?
The way the file names are, Iterate Rasters will run through Type A then Type B for each date before moving on to A for the next date, which I think is exactly what I want.
I just don't know much about how the variables work in ModelBuilder or ArcPy or even Python for that matter, so this is where I'm stuck.
I figure there's a few different ways to do it, and two that I've tried and failed (due to my limited knowledge of how to set it up) are:
- Storing Raster A in a variable and when Iterate Rasters hits raster B, having it realize it's B (through a count variable or through a substring in the file name, etc.) and using the pulled-up raster B and stored raster A to calculate a new raster, then clearing both my raster storage and whatever other variables I have.
- Using a built-in function like Collect Values and clearing that every two iterations. I'd have to know how to clear that and also how to calculate a raster using a reference to its position or whatever in Collect Values.
Can anyone explain in more detail (variable type, path, setup, code for things, etc.) how I could do either of those?
Can anyone tell me the code necessary in a Calculate Value function (or whatever else) to extract the characters between two known strings in a filename, that would give me the date?