GithubHelp home page GithubHelp logo

Compute Histogram about raster-functions HOT 5 CLOSED

esri avatar esri commented on May 23, 2024
Compute Histogram

from raster-functions.

Comments (5)

jdrisdelle avatar jdrisdelle commented on May 23, 2024

Hi @csap2109. What version of our software are you using? I just tried it on 10.4.1 and it is applying the colormap properly. @akferoz

from raster-functions.

Johannes-R-Schmid avatar Johannes-R-Schmid commented on May 23, 2024

I got the newest arcgis version. If 10.4.1 is actually the newest, then I have it

Did you subtract ndvi-raster from each other? If yes, does your ndvi have scientific values (-1 - 1) ?

@jdrisdelle

from raster-functions.

jdrisdelle avatar jdrisdelle commented on May 23, 2024

@csap2109

In this case the problem is likely with scaling and bit depth. Colormaps are only supported with 8 bit rasters. Colormaps in the Python raster functions are setup using 4 arrays.

[pixel value][Red][Green][Blue]

In the colormap you are using we are using a range of 0-255 in the pixel value array. In order for this to work on your output pixel block you will have to scale the values. You can to this by adding one then multiplying by 127.5.

You can also do scaling after applying the Python raster function in your function chain.

Add the stretch function on top of your Python raster function. When you do this go to the general tab in the function and set the output pixel type to 8 bit unsigned. Add the colormap function on top of the stretch function and you should be good.

Hope this helps

from raster-functions.

Johannes-R-Schmid avatar Johannes-R-Schmid commented on May 23, 2024

@jdrisdelle
Ich habe ersteres Versucht, da der Stretch im Nachhinein nicht mein Ziel war. Ich benötige ein einziges Script, damit ich dieses im Nachhinein online als Widget importieren kann. Deshalb kann ich auch keine bestehenden Funktionen verwenden.

Bei Ersterem funktioniert es leider nicht, aber vllt habe ich es auch falsch in das Script integriert.
Könntest du mir den 2-Zeiler Code zeigen, den du meintest und vllt wo du es in meinem Script einbaue würdest. Wie gesagt, ich habe es verschiedenst ausprobiert und das Ergebnis war nicht wie erwünscht.

from raster-functions.

jdrisdelle avatar jdrisdelle commented on May 23, 2024

@csap2109

You will be able to access both out of the box functions and Python raster functions using widgets in your web application so you can still use the workflow that i sent in my previous message. If you would still like to do everything in your Python raster function you can scale you can do the following in your updatePixels() method.

r1 = np.array(pixelBlocks['r1_pixels'], dtype='f4', copy=False)
r2 = np.array(pixelBlocks['r2_pixels'], dtype='f4', copy=False)

np.seterr(divide='ignore')

outblock = self.op(r1, r2).astype(props['pixelType'], copy=False)

outBlock = (outBlock + 1) * 127.5

pixelBlocks['output_pixels'] = outBlock.astype(props['pixelType'])
return pixelBlocks

from raster-functions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.