20

Using GRASS and the r.reclass module, yes. However, you actually need to use the keyword "thru". Example: For a raster elevation grid, to be reclassified into values based on 100m-intervals: 500 thru 599.99 = 500 600 thru 699.99 = 600 700 thru 799.99 = 700 Etc.. And you save that into a notepad text document(with no spaces between lines). Then when ...


15

Instead of doing the reclassification as a double for loop described by dmh126, do it using np.where: # reclassification lista[np.where( lista < 200 )] = 1 lista[np.where((200 < lista) & (lista < 400)) ] = 2 lista[np.where((400 < lista) & (lista < 600)) ] = 3 lista[np.where((600 < lista) & (lista < 800)) ] = 4 lista[np....


13

beside @R.K. answer, you can use r.null in grass too. r.null - Manages NULL-values of given raster map. EXAMPLES Set specific values of a classified map to NULL: r.null map=landcover.30m setnull=21,22 Set NULL-values of a map to a specific value: r.null map=fields null=99 i hope it helps you...


12

yes, r.reclass is for reclassing thematic rasters, like the Corine Land Cover. It will work for your data, but the routine will cast the float numbers to integers before doing the reclass, so it might lead to unexpected results. What you are looking for is r.recode The rules are defined in many formats, one of those is the following: old_low:old_high:...


12

you can do more with Con than with Reclass, for example you can have continuous output value with Con. You can also use some map algebra within your statement, and you can have multiple inputs. However, if you need an output with a large number of classes, reclass is easier to use because you can use the built-in partitioning methods based on the histogram. ...


10

you can do this with arcpy, if you want. In this code, any input cell with a value 9999 will be set to NoData in the output raster, and the remaining cells will retain their original value. import arcpy from arcpy import env from arcpy.sa import * env.workspace = "C:/sapyexamples/data" outSetNull = SetNull("elevation", "elevation", "VALUE = 9999") ...


9

I think the RasterCalc plugin should be able to solve your problem. Once you've installed it, you can use the following query (assuming that NULL values corresponds to -9999; you can check this value in Transparency tab of the Layer Properties): eq( [your_raster]@1, -9999, 0 ) eq means equal to. This tells RasterCalc that all pixels in your raster with ...


9

With the Advanced Interface option of the toolbox, I use the Reclassify Grid Values from the SAGA GIS, It a really intuitive tool with options of reclassification by single value, range and using a table. I prefer this over the r.reclass because you do not have to create additional files.


9

The first attached script successfully reclassified your AK NLCD data in about 15 minutes (i7, 12GB RAM machine). Since the original dataset is almost 7GB you may be encountering memory issues. If you cannot process the entire dataset in one chunk, try splitting it up with the second script prior to reclassification. My recommendation is to take a small ...


9

Yes another way exists. Just use gdal_calc.py For example, below will convert the values below 3 to 0 and above 3 to 1. You can use equals as well. gdal_calc.py -A C:temp\raster.tif --outfile=result.tiff --calc="0*(A<3)" --calc="1*(A>3)"


8

This is a Job for the Field Calculator. See this Python example at Calculate Field examples Parser: Python Expression: Reclass(!WELL_YIELD!) Code Block: def Reclass(WellYield): if (WellYield >= 0 and WellYield <= 10): return 1 elif (WellYield > 10 and WellYield <= 20): return 2 elif (WellYield > 20 and WellYield <= 30): ...


8

I was able to reclassify a raster using the raster calculator Here the "Habitat" raster is reclassed from continuous values (0-1) to discrete values of 1,2,3 ("Habitat@1" < 0.3)* 1 + (("Habitat@1" >= 0.3) AND ("Habitat@1" < 0.6)) *2 + ("Habitat@1" >=0.6)* 3


8

Simply write "raster_name@1" != 0 AND "raster_name@1" <= 15 in order to set all values between 1 and 15 to 1, and everything else to 0.


7

You could use the Raster Calculator to do this. Square the pixel values to ensure all values are positive, and then extract the square roots to get back original number. Something like this: sqrt ( myraster@1 * myraster@1 )


7

You simply need to use following expression raster A insularis_1@1 > 0 The expression means , set all values greater than 0 as 1 and others as 0.


7

Because the Raster Calculator is a spatial analyst tool, you can utilize the Mask environment. From there, you can use a variety of commands to perform the reclassification: common ones include Con, Pick, Is Null and Set Null, based on your needs. To check if a specific spatial analyst tool honors the Mask environment, simply scroll down to the bottom ...


7

gdal_reclassify is an unofficial Python tool, based on Python GDAL bindings, able to reclassify according to several classes of values. Requirements: python numpy gdal binaries python-gdal bindings Example: python gdal_reclassify.py source_dataset.tif destination_dataset.tif -c "<30, <50, <80, ==130, <210" -r "1, 2, 3, 4, 5" -d 0 -n true -p "...


7

gdal_calc can be used for a reclassification of many classes. For example, you can change values below (and equal) 12 to 10, values of 20, 30, 40, 50 stays the same, and values between above 50 and 62 are changed to 60: python gdal_calc.py -A input.tif --outfile=output.file --calc="10*(A<=12)+20*(A==20)+30*(A==30)+40*(A==40)+50*(A==50)+60*((A>50)*(...


6

All of the detailed information about MOD12 data can be found in the Algorithm Theoretical Basis Document (ATBD). On page 23, it says that the forest classes require >60% coverage of the pixel.


6

In Python: def function(field): if field>4: return "0.5" else: return "A" And below: function(!choose from Fields!)


6

You can use the reclassify function in the raster package to reclassify the DEM. The general idea is to generate a reclass matrix which provides the instructions on how to reclassify the continuous DEM elevation values. require(rgdal) require(raster) # Read DEM and convert to raster layer object dem = raster("C:/temp/dem.tif") # Generate a reclass ...


6

Here you have a simple python script for reclassification, I wrote it and it works for me: from osgeo import gdal driver = gdal.GetDriverByName('GTiff') file = gdal.Open('/home/user/workspace/raster.tif') band = file.GetRasterBand(1) lista = band.ReadAsArray() # reclassification for j in range(file.RasterXSize): for i in range(file.RasterYSize): ...


6

Here's a basic example using rasterio and numpy: import rasterio as rio import numpy as np with rio.open('~/rasterio/tests/data/rgb1.tif') as src: # Read the raster into a (rows, cols, depth) array, # dstack this into a (depth, rows, cols) array, # the sum along the last axis (~= grayscale) grey = np.mean(np.dstack(src.read()), axis=2) ...


6

If it is just for visualisation, then you can adjust how the raster is displayed in QGIS, by choosing single band pseudo colour with discrete colour interpretation - you can then adjust the boundaries between each colour yourself. If you actually need to produce an output raster classified by percentile, then it may or may not be possible to do so with the ...


5

Depending on how complex your raster is, you could run Region Group over the raster (assuming Spatial Analyst here). Then reclassify any region with a Count <= 30 as the black value. Unforunately though Region Group is limited in the number of groups to the size of a table entry an ArcInfo Raster can have. Alternately you can try the same thing in Python ...


5

The easier way is to use GRASS (also using the QGIS/GRASS plugin) and the r.reclass module. You will need to create a reclassification rule file, where you can use the keyword "through" or the wildcard "*" to reclassify multiple values in one rule.


5

If I understand well, you have one class that needs to be changed only if it is located off the coast So what you need to do is convert your ZIP code boundaries to raster (feature to raster): this will produce a raster that is Null (NoData) where you are not on inland. Then apply a conditional statement in order to change your wetland values. In the ...


5

Multiply everything by orders of magnitude until you are working with integers rather than decimals. In other words, if your raster has values of 1-10, and you want to reclassify some of those values to 0.003, multiply your integer raster by 1000 so that its values range between 1000 and 10000. Then instead of reclassifying to 0.003, reclassify to 3. After ...


5

This is an example (please modify as necessary). "landuse" should be your actual field name of original class. CASE WHEN "landuse" = 1 THEN 5 WHEN "landuse" = 2 THEN 0 WHEN "landuse" = 3 THEN 10 WHEN "landuse" = 4 THEN 3 WHEN "landuse" = 5 THEN 9 WHEN "landuse" = 6 THEN 4 WHEN "landuse" = 7 THEN 0 ELSE NULL END


5

There are some syntax errors. If you run this code from the Python Console: import processing processing.alghelp("grass7:r.reclass") you will get: ALGORITHM: r.reclass - Creates a new map layer whose category values are based upon a reclassification of the categories in an existing raster map layer. input <ParameterRaster> rules <...


Only top voted, non community-wiki answers of a minimum length are eligible