New answers tagged

4

A "True" condition evaluates numerically to 1, and a "False" condition to zero, so if you add up the result of multiplying the test conditions by the value expressions for those tests, you get the result you are after. So: ("slope@1" < 9 ) * (10.8 * sin("theta@1")+0.03) + ("slope@1" >=9 ) * (16.8 * sin(&...


0

(("Landcover_raster"=9)+("Landcover_raster"=10))*.21 should work. It multiplies X by .21 where X is either 0 or 1, depending on whether it is land cover (9 or 10). It is helpful to remember that with 1 and 0, OR is +, AND is *


3

The variable lulc1 is an image collection with 5 elements (images between years 2015 and 2019). If you want to reclassify it, it is preferable to map entire collection with a function. Following code fix up your issues and add your image collection to the Map View of GEE. // lulc var lulc1 = ee.ImageCollection("COPERNICUS/Landcover/100m/Proba-V-C3/...


0

According to the Python help file: If both x and y are finite, x is negative, and y is not an integer then Power(x, y) is undefined, and results to NoData. As such, the x needs to be a positive integer if you want y to be a double. Examples that I tried: Power(Sin("%Slope_degrees_clipped (2)%"), 1.5) --> results in NoData values when the sinθ is ...


0

Try (1.8 * ("NIR"-"Green") -3.75 * ("Red"-"Green")) / (SquareRoot(Square(2 * "NIR" + 1)-(6 * "NIR" - 5 * sqrt("Red")) - 0.5)) based on Bagheri, Ahmadi, Alavipanah & Omid 2013.


0

At the end I done like this: Computed the 0/1 Indicator Variable of the range gdal_calc.py -A fileLUse.tif --outfile=natVegIndicator2019.tif --calc="logical_and(A>=40,A<=140)" For some reason this created a 8GB map out of a 300MB original tif map. Used the following simple Python script vectorBoundariesFile = "gadm36_1.shp" ...


0

The Python package osgeo.gdal is not really "Pythonic", so there are several quirks and gotchas to be aware of. The NoneType returned from Open means that the file could not be opened. Here's a quick demo: from osgeo import gdal ds = gdal.Open("NETCDF:file.nc:velocity") # you may see the following message in a console: # ERROR 4: `NETCDF:...


2

You might need more brackets, and you can replace logical AND with numerical *. (layer1_null = 0) * (layer2 != 0) selects the pixels that meet the criteria. (layer1_null = 0) * (layer2 != 0) * (layer2 - layer1) gets the difference for the relevant pixels. To choose between layers, you could use: (layer1 = 0) * layer2 + (layer1 != 0) * layer3 For example, ...


2

Use the Reclassify tool on your Euclidean Distance output raster to set all values greater than 100 to be equal to 100. As long as you keep the default missing_values parameter set to DATA you can ignore all you values less than 100 - the original value will carry through unchanged. This way you can also play around with if 100m is actually the appropriate ...


0

Perhaps terra::ifel is what you are looking for library(terra) A <- rast(ncol=5, nrow=5) values(A) <- sample(10, ncell(A), replace=TRUE) B <- rast(ncol=5, nrow=5) values(B) <- runif(ncell(B)) x <- ifel(A > 6, B / 10, ifel(A < 3, B * 10, 5))


0

The answer from @wingnut does not account for points which are above water at the lower level but below water for the higher level. I do no think a simple point-by-point raster calculation will address these points. You will need a two-phase process. In phase 1 you compute the interpolated value of wingnut's solution for points that are flooded in both cases....


6

This seems to happen by default. The maximum you see is an estimate based on sampling. You want the actual maximum of all samples in the raster. In the Layer Styling panel, under Accuracy, select Actual(slower). The legend should then display 255 as required. Raster Calculator This produces the bad range, like this: But if you look at the Layer Styling ...


0

Raster Calculator. Try something like: (layer1@Z + layer2@Z) / 2.0 That just calculates the average of the two layers, and isn't very interesting (just calculates the middle surface. l1@Z + k(l2@Z-l1@Z) , k in [0,1] is more flexible. Set k to give various height values between the layers. For example, if l1 is 4 and l2 is 10 and you want 8, k = (8-4)/...


2

I'm not familiar with raster format manipulation with QGIS but indeed, it sounds strange. Anyway, you can get the wanted result by using grass r.rescale command (using Processing Tools) : The r.rescale program rescales the range of category values appearing in a raster map layer. A new raster map layer, and an appropriate category file and color table based ...


0

It is really unclear what you want to do. Please provide some minimal reproducible examples, the code you've tested yet, and the output you expect. Without this information, it is impossible to understand what you want. Here I put a reproducible example so you can tell the community clearly what you want: library(raster) #landuse (raster A) r <- raster(...


1

you can use the rastercalculator for that with an expression like this one: ("raster@1" >= "raster@2" AND "raster@1" >= "raster@3" AND "raster@1" >= "raster@4") * "raster@1" + ("raster@2" > "raster@1" AND "raster@2" > "raster@3" AND &...


Top 50 recent answers are included