How to overwrite a raster data?

564
4
08-27-2013 04:48 AM
ZuoqiChen
New Contributor
tempId = Raster(dsm_file)*0
tempId = SRTran.GetId(tempId)


the line 1 means that I create a empty raste, named tempId.
and the line 2 means that i use the 'tempId' to do a Map algebra, and i hope the same raster file (e.g. 'tempId') can be used to store the return value. But actually, the raster can not be overwrited. How can i do?
Tags (2)
0 Kudos
4 Replies
markdenil
Occasional Contributor III
I am not sure what you are trying to do, but I don't think you can do it that way.
You cannot have the same raster on both sides of a map algebra statement.

Try making an intermediate raster, and using it on the left in line 1
and on the right in line 2

One of the dreary things about map algebra is that you end up with a lot of intermediate rasters
which you have to (that is to say, really want to) clean up afterwards (or as you finish with each one).
0 Kudos
ZuoqiChen
New Contributor
I am not sure what you are trying to do, but I don't think you can do it that way.
You cannot have the same raster on both sides of a map algebra statement.

Try making an intermediate raster, and using it on the left in line 1
and on the right in line 2

One of the dreary things about map algebra is that you end up with a lot of intermediate rasters
which you have to (that is to say, really want to) clean up afterwards (or as you finish with each one).


Thank u. I try used an intermediate raster,  and it has already been done!
But there is one more problem when i clean up the intermediate raster.
If i clean up it before output the final raster, the program will be closed by error when i output the raster. And IDLE did't output any messages.
If i clean up it after output the final raster, the program is work.
Why?
0 Kudos
markdenil
Occasional Contributor III
Unless I am mistaking your workflow,
You are starting with a raster (call it A)
and want an output raster we will call C
and need an intermediate raster we will call B

so if you make B using B = Function(A),
and make C using C = AnotherFunction(B)

you want to know why making B from A
and then deleting B before
making C from B
does not work?
0 Kudos
ZuoqiChen
New Contributor
Unless I am mistaking your workflow,
You are starting with a raster (call it A)
and want an output raster we will call C
and need an intermediate raster we will call B

so if you make B using B = Function(A),
and make C using C = AnotherFunction(B)

you want to know why making B from A
and then deleting B before
making C from B
does not work?


No. My workflow is
Start with a raster (call A), and making an intermediate raster (call B1,B2,B3......) from A.
Then, I make another raster (call C1,C2,C3.....) from B1,B2,B3..... respectively.
finally, i want an output raster (call D) is D = C1 + C2 + C3.....

If I delete Raster B1,B2,B3... after making C1,C2,C3... and before making D, the program does not work.
I want to know why?
0 Kudos