![]() ![]() Or put Float() around the entire equation. Assign the ‘Float(“rasterName”)’ expression around each input floating point raster and or the entire equation.Below are some tips for tying to get a floating point output raster: The output raster is either in integer form (such as -1 0 or 1) or a floating point raster is created with all NoData or 0 digital numbers. The problem I typically encounter is that an integer raster is created instead of the floating point raster I want. The syntax in the expression has been updated from the layer syntax ( "Reclass Landuse") to the variable syntax ( "%Reclass Landuse%").Īn example of the Raster Calculator tool with an expression using variables is shown.I have trouble just about every time I work with floating point rasters in the Raster Calculator. ![]() The Reclass Landuse variable is added to the list.When the Raster Calculator tool dialog box is reopened, be aware of the following: The Raster Calculator tool with an expression using variables and layers is shown.Īfter clicking OK to close the Raster Calculator tool dialog box, a variable representing the Reclass Landuse layer will be added to your model as a model variable. Place the pointer at the appropriate location in the expression box.To have inputs added with the correct syntax, complete the following steps: How syntax first appears in the expression Notice that the different variables have slightly different syntax: In this example, Raster Dataset Variable, a Long Variable, and a Raster Layer are being used. The example below shows the Map Algebra expression syntax of a Raster Calculator tool being used in a model. How variables and layers appear in the expression For more information regarding the syntax, what types of variables can be used, and the connectivity behavior of the Raster Calculator tool in ModelBuilder, see the Raster Calculator tool help. When using the Raster Calculator tool in ModelBuilder, the only difference is that variables can be used as input as well as layers. Con("inRas" = 45) & ("inRas" = 47)&("inRas" = 49,4))))Īn example Raster Calculator expression in ModelBuilder.In these expressions, the raster layer names are contained within quotes, for example, "dist". Raster Calculator tool dialog box examplesįollowing are several examples of Map Algebra expressions that can be executed in the Raster Calculator tool. Similarly, only on the tool dialog box can Raster Calculator variables be contained within percent signs ( %) or quotation marks ( ").When working in Python itself, layers must first be cast as Raster objects. Only on the Raster Calculator tool dialog box can layer names be used directly with operators.Since there is a specific output parameter on the Raster Calculator tool dialog box, Map Algebra expressions do not include an output name and an equals sign ( =) when using the Raster Calculator. ![]() While Map Algebra is used both in the Raster Calculator and directly in Python, the following are differences in the syntax that you should be aware of: Example expressions for the Raster Calculator tool For more information, refer to the usage tips listed in the Raster Calculator tool help. When multiple Relational or Boolean operators are used in a sequence, the expression requires parentheses. For example, to use the IsNull tool, be sure to type it as IsNull, instead of Isnull or isnull. Since the expression entered in the Raster Calculator tool will be executed in Python, and Python is case sensitive, it is important to use the correct capitalization of the tool name. When building expressions in the Raster Calculator tool, clicking and double-clicking the various layers, variables, buttons, and tool names on the dialog box will help you to avoid syntax errors that may otherwise be made while typing.
0 Comments
Leave a Reply. |