Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Mosaic to New Raster (too simple, but yet wont work)

$
0
0
Greetings All

I've been stuck on this for most of this evening and would really like to know why its not working.

I'm doing a MosaicToNewRaster with a bunch of rasters that need to be mosaiced with a particular raster.

All I need is a simple ListRasters to get each raster from the bunch, keep the particular raster in a separate variable, feed the two to the Mosaic tool and it should be sweet.

But no.

At first, the loop script ran without errors, but the results were empty.

So I decided to go back to basics and try to get that to work with two fixed variables
Here's the code:

Code:

bathtub = "C:/Temp/dustin.gdb/Coastal_WD_2040"
inRas = "C:/Temp/dustin.gdb/depth_2040"

arcpy.MosaicToNewRaster_management("bathub;inRas","C:/Temp/dustin.gdb", "new_test", "#","32_BIT_FLOAT","#", "1", "MAXIMUM", "REJECT")

But it keeps returning a generic "ERROR 000582: Error occurred during execution"

If I put in the full paths then of course it works...but I need it to loop.

I thought I'd be smart about and get ModelBuilder to show me where I was going wrong.
I built the same two variables and feed it to the tool and it ran with full success.

So I exported the model to python script and guess what? it creates the necessary variables but then does not use them in the tool. Instead it uses the full path #ESRIFAIL

In past readings on this forum, I came across arcpy.Raster() which creates a Raster object from the raster.
I tried that too...and that didn't work.

I subsituted the # for just "" for the optional values and that didn't work either.

I tried every combination of r"", \ and even // for the file paths but still nothing.

Any suggestions?

Viewing all articles
Browse latest Browse all 2485

Trending Articles