Skip to main content
deleted 36 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I have two sets of rasters (in the same gdb), representing "loss" and "forestmask".

I would like to multiply each forestmask raster (value 1 = forest) with its corresponding loss raster (value 1=loss) to create a raster that shows deforestation (in which value 1 = deforestation).

Each loss raster should be linked to one corresponding forestmask raster (they have the same extent):
e.g.

GFC2014_forestmask_00N_020E * GFC2014_loss_00N_020E = GFC2014_deforestation_00N_020E (=output filename)

I guess this should not be too hard to do, and I tried to do this with the ArcGIS modelbuilder, iterating through the "forest mask" rasters using a wildcard, but I got stuck when I wanted to make use of the Parse Path tool and in-line variable tricks for defining the second input file (i.e. the loss raster). Right now, I tried to add a new variable (=file) in the model, called loss below, with input:

"GFC_2014_loss_"+ "%Name%"[21:]

But this is not working: the Times tool does not accept the loss variable as it is as the second input. (not sure if the syntax is correct like this, and if this can be used in a "file" variable).

model screenshot

I think I know how to do this in R with the raster package, but I heard Python is faster for these kind of calculations, so any help is welcome. Preferably I would like to do this in the model builder so that I can easily link it to other models I created.

Thanks in advance for your help!

I have two sets of rasters (in the same gdb), representing "loss" and "forestmask".

I would like to multiply each forestmask raster (value 1 = forest) with its corresponding loss raster (value 1=loss) to create a raster that shows deforestation (in which value 1 = deforestation).

Each loss raster should be linked to one corresponding forestmask raster (they have the same extent):
e.g.

GFC2014_forestmask_00N_020E * GFC2014_loss_00N_020E = GFC2014_deforestation_00N_020E (=output filename)

I guess this should not be too hard to do, and I tried to do this with the ArcGIS modelbuilder, iterating through the "forest mask" rasters using a wildcard, but I got stuck when I wanted to make use of the Parse Path tool and in-line variable tricks for defining the second input file (i.e. the loss raster). Right now, I tried to add a new variable (=file) in the model, called loss below, with input:

"GFC_2014_loss_"+ "%Name%"[21:]

But this is not working: the Times tool does not accept the loss variable as it is as the second input. (not sure if the syntax is correct like this, and if this can be used in a "file" variable).

model screenshot

I think I know how to do this in R with the raster package, but I heard Python is faster for these kind of calculations, so any help is welcome. Preferably I would like to do this in the model builder so that I can easily link it to other models I created.

Thanks in advance for your help!

I have two sets of rasters (in the same gdb), representing "loss" and "forestmask".

I would like to multiply each forestmask raster (value 1 = forest) with its corresponding loss raster (value 1=loss) to create a raster that shows deforestation (in which value 1 = deforestation).

Each loss raster should be linked to one corresponding forestmask raster (they have the same extent):
e.g.

GFC2014_forestmask_00N_020E * GFC2014_loss_00N_020E = GFC2014_deforestation_00N_020E (=output filename)

I guess this should not be too hard to do, and I tried to do this with the ArcGIS modelbuilder, iterating through the "forest mask" rasters using a wildcard, but I got stuck when I wanted to make use of the Parse Path tool and in-line variable tricks for defining the second input file (i.e. the loss raster). Right now, I tried to add a new variable (=file) in the model, called loss below, with input:

"GFC_2014_loss_"+ "%Name%"[21:]

But this is not working: the Times tool does not accept the loss variable as it is as the second input. (not sure if the syntax is correct like this, and if this can be used in a "file" variable).

model screenshot

I think I know how to do this in R with the raster package, but I heard Python is faster for these kind of calculations, so any help is welcome. Preferably I would like to do this in the model builder so that I can easily link it to other models I created.

added tag
Link
Source Link

How to use the math tool ("times") in ArcGIS modelbuilder to multiply two raster sets while using an iterator?

I have two sets of rasters (in the same gdb), representing "loss" and "forestmask".

I would like to multiply each forestmask raster (value 1 = forest) with its corresponding loss raster (value 1=loss) to create a raster that shows deforestation (in which value 1 = deforestation).

Each loss raster should be linked to one corresponding forestmask raster (they have the same extent):
e.g.

GFC2014_forestmask_00N_020E * GFC2014_loss_00N_020E = GFC2014_deforestation_00N_020E (=output filename)

I guess this should not be too hard to do, and I tried to do this with the ArcGIS modelbuilder, iterating through the "forest mask" rasters using a wildcard, but I got stuck when I wanted to make use of the Parse Path tool and in-line variable tricks for defining the second input file (i.e. the loss raster). Right now, I tried to add a new variable (=file) in the model, called loss below, with input:

"GFC_2014_loss_"+ "%Name%"[21:]

But this is not working: the Times tool does not accept the loss variable as it is as the second input. (not sure if the syntax is correct like this, and if this can be used in a "file" variable).

model screenshot

I think I know how to do this in R with the raster package, but I heard Python is faster for these kind of calculations, so any help is welcome. Preferably I would like to do this in the model builder so that I can easily link it to other models I created.

Thanks in advance for your help!