I have satellite data (HDF files) to bring into a GDB so we can analyse measurements across a season. I want to automate this as there are multiple measurements and multiple seasons, and sometimes multiple images in a day. The aim is to have a Mosaic Dataset per day with the files and the mosaic dataset having the date as part of their name.
I have tried to automate this or at least parts of it in Model Builder.
First attempt loops over all the dates where there is at least one image then calls a submodel that adds all HDF files for that day, but "Add Rasters to Mosaic Dataset" doesn't accept the Mosaic Dataset as an input (see example below).
Second attempt was to iterate on all the files and do "Add Rasters to Mosaic Dataset" to the Mosaic Dataset based on the filename; again had the problem that "Add Rasters to Mosaic Dataset" doesn't accept the Mosaic Dataset as an input.
I also tried collecting the files in a day in a submodel than passing this as a parameter as input to "Add Rasters to Mosaic Dataset"; that didn't work either.
How can I automate adding rasters to mosaic dataset in ArcGIS Pro Model Builder?
First attempt: this model iterates over all dates that I've got saved in a table (Mosaic Datasets are created for each date in a separate model)
The submodel is greyed out, the Mosaic Dataset passed (as per the open window) shows with a red cross.
The submodel "Add all HDFs in a day":
When I run this, the submodel doesn't get run.
I believe you have the nesting backwards. The inner model (Iterate Field Values) should be embedded in the outer model (Iterate Fields). I also don't see you using the Collect Values tool to gather the list of data for each day. You need Collect Values in the "inner" model.
Examples of using Model Only tools in ModelBuilder—Help | ArcGIS Desktop
Hope this helps you out.
Thanks for the reply.
I tried many variation including ones with collect values. The issue always remained that in Model Builder "Add Rasters to Mosaic Dataset" did not accept that the mosaic dataset was being created as part of one of the models. "Add Rasters to Mosaic Dataset" kept insisting that because the mosaic dataset did not already exit, it would always be greyed out so never get called.
In the end I had to develop Python code, took another week
Thanks anyway
This is sometimes an issue with Model Builder - if the parameter validation isn't happy, you may be stuck.
To get around validation roadblocks you can use a Python script (as you did) or run the tool using a Python function inside a Calculate Value tool, which bypasses the pre-run validation ModelBuilder does.