Comments (6)
Thanks, I wonder if I introduced an error in #931. I'll do some further testing.
from grass-addons.
@ecodiv You can link the issue from the PR using "Closes #XYZ". Merging PR with this in the commit message will close the issue automatically. You can also link them from the web interface under Development. That may save you some writing and clicks overall. This will also ensure the standard behavior: it is customary to close the issue only after the PR was merged.
from grass-addons.
Using code from August 22, rebuilt grass + grass-addons from main, using the blue band of BMNG https://visibleearth.nasa.gov/images/57752/blue-marble-land-surface-shallow-water-and-shaded-topography.
Make it Float
r.mapcalc expression="bmngfloat=bmng.blue/100.0"
Map 1
r.fuzzy.set --overwrite input=bmngfloat@PERMANENT output=out1 points=0.5,0.6 side=left shape=0.5
Map 2
r.fuzzy.set --overwrite input=bmngfloat@PERMANENT output=out points=0.5,0.6 side=left shape=0.1
from grass-addons.
Hi @YannChemin, below a reproducible example.
The example data used in this example is the landsat layer lsat5_1987_10@landsat from the North Carolina full dataset (https://grass.osgeo.org/download/data/).
Step 1. Set the region to match the raster layer and create a floating raster layer.
g.region raster=lsat5_1987_10
r.mapcalc "inputmap = lsat5_1987_10 / 10.0"
Step 2. Install the r.fuzzy_set addon, if not done already.
g.extension extension=r.fuzzy.set
Step 3. Run the function using as input the lsat5_1987_10 raster layer as input. Fill in the output name test01, set minimum (A) and maximum inflection points to match the minimum and maximum value of the raster layer and the side to left. Keep the default input for the other parameters. That is, shape modifier (shape) = 0 and membership height (height) = 1.
# Get the minimum, maximum and mean values
r.univar map=inputmap
The minimum = 4.5 and maximum = 25.4. Use this to set the A (lower boundary) and B (upper boundary) inflection points.
r.fuzzy.set input=inputmap output=test00 points=4.5,25.4 side=left
Step 4. Repeat the above twice, changing the shape modifier (shape) to 0.1, 0.5 and 0.9.
r.fuzzy.set input=inputmap output=test01 points=4.5,25.4 side=left shape=0.1 --overwrite
r.fuzzy.set input=inputmap output=test05 points=4.5,25.4 side=left shape=0.5 --overwrite
r.fuzzy.set input=inputmap output=test09 points=4.5,25.4 side=left shape=0.9 --overwrite
Check if there are differences between the output maps.
r.mapcalc "diff00_01 = test00 - test01"
r.univar map=diff00_01
r.mapcalc "diff00_05 = test00 - test05"
r.univar map=diff00_05
r.mapcalc "diff01_05 = test01 - test05"
r.univar map=diff00_05
r.mapcalc "diff01_09 = test01 - test09"
r.univar map=diff01_09
The r.univar outcomes show that the maps are identical. Results correspond to what one would expect when using the shape=0 parameter.
Step 5. Now, let's try with negative values for the shape parameter.
r.fuzzy.set input=inputmap output=testmin01 points=4.5,25.4 side=left shape=-0.1 --overwrite
r.fuzzy.set input=inputmap output=testmin05 points=4.5,25.4 side=left shape=-0.5 --overwrite
r.fuzzy.set input=inputmap output=testmin09 points=4.5,25.4 side=left shape=-0.9 --overwrite
Check if there are differences between the output maps.
r.mapcalc "diffmin09_09 = testmin09 - test09"
r.univar map=diffmin09_09
r.mapcalc "diffmin01_min05 = testmin01 - testmin05"
r.univar map=diffmin01_min05
r.mapcalc "diffmin01_min09 = testmin01 - testmin09"
r.univar map=diffmin01_min09
Results based on negative shape values differ from those based on positive shape values. But, results show that outcomes for negative shape values are all the same, corresponding to what one would expect when using the shape=-1 parameter (note that there is a unrelated error in how the values are calculated as described in #931).
I am on Ubuntu 22.04, GRASS GIS 8.3.1dev (ce5a0a5694). Results are the same on Windows 10, GRASS GIS 8.3.
from grass-addons.
The problem was the use of the abs
function, which works for integer values. Replacing it with the fabs
function, which works with floating and double values, solves the problem. Tested using the code above. Solution included in the PR #931
from grass-addons.
Closing since the issue is solved with PR #931
from grass-addons.
Related Issues (20)
- [Bug] i.fusion.hpf can longer be installed with g.extension HOT 5
- v.db.pyupdate warning during installation
- [Feat] i.sentinel.import: handle processing baselines HOT 3
- [Bug] Add concurrency groups/cancel in progress for skipping outdated CI runs
- Add tests to i.modis, i.landsat, i.sentinel download HOT 23
- Addons for plotting: Standardize parameters and flags HOT 3
- r.hydro.flatten: separate footprint of the impoundment from the downstream river
- Dependency Dashboard
- [Bug] Installing v.kriging fails HOT 2
- [Bug] v.surf.nnbathy: NameError: `StandardError` is not defined HOT 8
- Add per-test timeout for grass.gunittest tests
- Require the tests to pass in CI
- v.rast.move: empty keywords break addon overview script HOT 2
- [Bug] i.sentinel.download: give warning instead of errors if single files are corrupt
- v.surf.mass: Input should be vector "area" map? HOT 1
- [Bug] testsuite: do not run tests for deprecated module HOT 4
- [Bug] m.tnm.download and m.cdo.download fail to build on Windows server due to using external Python library requests
- r.stream.distance elevations with value of -1 [Bug]
- [Bug] Remove r.sim.water.mp from addons
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grass-addons.