Hexagon Geospatial
MENU

Spatial Modeler

Discuss topics with other Hexagon Geospatial Product pioneers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
New Contributor
Posts: 3
Registered: ‎07-25-2018

Re: Handling NoData in Spatial Modeler

[ Edited ]

(Moved here formt he NoData article thread: http://community.hexagongeospatial.com/t5/Spatial-Recipes/Handling-NoData-in-Spatial-Modeler/ta-p/95... )

 

Hi, I wonder if you could advise me on using the set to nodata for a range of values.

 

I am having trouble with the data ranges in the Landsat 8 surface reflectance product which I downloaded from USGS. The Lansat 8 surface reflectance handbook says the valid range is 0 - 10,000 range but the product may come with values between -2000 to 16000. I am using the level 2 landsat 8 surface reflectance product with a view to detecting sediment plumes exiting glaciers by thresholding.

I want to know how to do the following on Erdas Imagine 2015 to:

  1. exclude the values outwith the valid range (0 - 10,000)

  2. apply the scale factor of 0.0001 in order to convert reflectance values to a scale from 0 to 1.

Is there a way to apply the Set to NoData function in the Spatial Model Maker to multiple values - say those values that are < 0 and > 10,000 ?

 

Technical Evangelist
Posts: 673
Registered: ‎10-01-2015

Re: Handling NoData in Spatial Modeler

Hi Kristina,

 

First step would be to upgrade to ERDAS IMAGINE 2018! You can probably do this in 2015, but I cant guarantee it.

 

Next, fire up the Spatial Model Editor. Use a Raster Input operator to access your Landsat data and remember to declare it as Float (since the scaling step will require floating point calculations).

 

Create a "outside valid range" mask by selecting all pixels <0 or > 10000 and setting those locations to 10001. Bear in mind that this will be a per-band selection, so you might want to get more complex with the selection criteria if you want to exclude an entire pixel if any of the bands at that location are outside the range.

 

Use Set to NoData operator to set 10001 to NoData.

 

Multiply by 0.0001 to scale 0 - 1

 

Send to a Raster Output.

 

Something like the following would do it (model also attached). Note that the data I tested with had a valid range of 0 - 20,000, so you'll need to adjust the numbers to match what level pre-processing data you have.

 

scale_nodata.PNG

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
New Contributor
Posts: 3
Registered: ‎07-25-2018

Re: Handling NoData in Spatial Modeler

Hi Ian,

 

I tried implementing roughly the model you sent however when I try to run it the raster output has an error appear (see print screen).

 

Do you think it might be related to the multiple bands included ? I wasn't entirely sure what you meant r.e. making selection criteria more complex. Would that mean splitting the model into 7 component parts executing the same function for each then merging them after ?

 

Thanks again for the advice and apologies for the questions - I'm new to erdas imagine !

 

Untitled.png

Technical Evangelist
Posts: 673
Registered: ‎10-01-2015

Re: Handling NoData in Spatial Modeler

[ Edited ]

What does it say in the Messages panel? The Messages panel will show you the reason for the error. 

 

Oh - you've connected the AttributeTable port of Raster Input to the Either/Or. You need to feed it the Raster from Raster Input. 

 

(You may also want to remove a zero from your NoData value - you've used 100,001 rather than 10,001. Shouldn't make a difference, but you never know) 

 

" I wasn't entirely sure what you meant r.e. making selection criteria more complex. " - I took care of that with the Stack Max operator. That'll make sure that any pixel location where 1 or more band values are outside the valid range will have all band values set to NoData. If you don't want that to happen just remove the Stack Max operator (and reconnect the model, of course) 

 

Cheers

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.