Hexagon Geospatial
MENU

ERDAS IMAGINE

Discuss and share topics of interest using ERDAS IMAGINE the world’s leading geospatial data authoring system.
Showing results for 
Search instead for 
Do you mean 
Reply
New Contributor
Posts: 4
Registered: ‎09-10-2017
Accepted Solution

Problems in band rationing with 0 values in denominator

Dear All,

            I  need a/b, if b != 0 otherwise 0,

 

How to perform in model maker? Band rationing with 0 values in denominator. All the possible combinations (4 attempts) have been made as below.

 

1]    EITHER $n1_sr(4) / $n1_sr(1) IF ( $n1_sr(1) != 0 ) OR 0 OTHERWISE

       model did not run.

 

2]    EITHER $n1_sr(4) / $n1_sr(1) IF ( $n1_sr(1)  NE  0 ) OR 0 OTHERWISE

      (showing divided by 0 message while opening image in viewer it is a completely white out image on pseudo color displaying. while displaying attribute table, Error message is- calloc could not allocate space for Egda_baseData data in gray.

 

3]   EITHER 0 IF ( $n1_sr(1)   ==   0 ) OR $n1_sr(4) / $n1_sr(1) OTHERWISE

       model got run but getting divided by 0 message while opening image in viewer it is a completely white out image on pseudo color displaying.

 

4]   EITHER 0 IF ( $n1_sr(1)  EQ 0 ) OR $n1_sr(4) / $n1_sr(1) OTHERWISE

      model did not run.

 

Please tell me how to write this code in model maker.

Highlighted
Regular Contributor
Posts: 219
Registered: ‎11-16-2015

Re: Problems in band rationing with 0 values in denominator

Hiya,

 

Make sure that you declare your input data as Float; you're dividing integers so you'll get float output:

2017-09-12 15_09_13-New_Model.png

Similarly, make sure your output is Float as well. Don't try and display this as Pseudocolor; use greyscale as it's a continuous dataset.

 

I tried your option 3 and it worked fine with the above tweaks. This is a lot easier in the new Spatial Model!

 

Cheers,

 

Johnnie

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.