X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Oct 2015 05:36 PM by  anon
NaN interplation
 7 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
29 Oct 2015 05:36 PM
    <p>Hello,</p> <p>I'm currently using MODIS data and am running into problems with NaN values in the final product caused by clouds. &nbsp;I'm interesting in a simple way to spatially interpolate (fill in) these NaN values. &nbsp;Is there a menu function that can easily/simply do this without delving into the intricacies IDL?</p> <p>Thanks</p>

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    02 Nov 2015 06:35 AM
    You can create a mask of the NaN values and set them to a value such as 0 or&nbsp; -9999.&nbsp; Then perhaps try the "Replace Bad Values" tool which can interpolate across the 'bad data' value using the surrounding values.&nbsp; However, if the gaps are large, these interpolated values will not look very realistic.&nbsp; Another option is to use another MODIS image and fill in the gaps using this dataset using Mosaicking.

    Deleted User



    New Member


    Posts:
    New Member


    --
    02 Nov 2015 03:00 PM
    <p>Thanks Mari, that helped alot. &nbsp;Your help and this other post here cleared it up:</p> <p>http://www.exelisvis.com/...fault.aspx</p> <p>The interpolation function does give some funny results if the holes are too big and you can see the triangle/pyramids.</p>

    Deleted User



    New Member


    Posts:
    New Member


    --
    02 Nov 2015 03:09 PM
    <p>Your last comment about mosaicking the gaps is interesting and really the ideal way to do this since I have two sets of data temporally and geographically overlapping (MODIS from Terra and Aqua). &nbsp;I've only used mosaicking to geographically pair images together but not to replace certain pixel values. &nbsp;Can you give more details on how to use mosaicking ona second MODIS image to replace NaN pixel values?</p>

    Deleted User



    New Member


    Posts:
    New Member


    --
    03 Nov 2015 01:05 AM
    <p>If I understand correctly what you need to do is mask out the locations of the clouds.</p> <p>So if image one has clouds and image two doesn't you can create a mask (make a mask of pixels = 0 or -9999 or whatever your NaN value is) of the cloud locations in image one, and then use that mask to extract the values in those locations for image 2. &nbsp;Once you have done this you can mosaic the extracted values from image 2 back into image 1 and you will have the clouds filled. You could also subset image 2 with the locations of the clouds and then mosaic from there as well.</p>

    Deleted User



    New Member


    Posts:
    New Member


    --
    03 Nov 2015 12:25 PM
    <p>Thanks. &nbsp;I follow everything you are saying and I have extracted the values from image two pertaining to clouds in image 1. &nbsp;While I have mosaicked two geographically adjacent images, I have not mosaicked geographically overlapping images.</p> <p>I'm thinking I need to do this:</p> <p>Map &gt; Mosaicking &gt;Georeferenced</p> <p>And then :</p> <p>Import &gt; Import Files and Edit Properties</p> <p>My background values have been set to NaN (both the holes and regions not captured by the sensor of either image 1/2). &nbsp;Therefore these values have been set to ignore when importing/editing the data. &nbsp;When I have imported both images and then:</p> <p>File &gt; Apply</p> <p>The output image does NOT fill the holes. &nbsp;Would it be better if I set the background value to -9999? &nbsp;When I did this with the interpolation function (Topographic &gt; Replace Bad Values) it would not work when background values were NaN but did work when they were a finite value (-9999).</p> <p>Thanks</p>

    Deleted User



    New Member


    Posts:
    New Member


    --
    03 Nov 2015 02:48 PM
    <p>I have always had problems with NaN values in ENVI GUI and because of this I default to using IDL, but are you able to successfully make a mask of where your clouds or located or no? &nbsp;Before you mosaic you should have 1 file that is the location of the clouds from the cloud free image and contains actual values, and 1 file that is an image with the clouds set as NaN and then mosaic those two together. I can probably help better if I can actually look at the files for your two images, feel free to email me at potte137@yahoo.com</p>

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2015 04:22 PM
    <p>Thanks for the help. &nbsp;I have created the mask successfully. &nbsp;I have the two images described but I am not sure how to do this type of mosaicking using the menu functions. &nbsp;From ENVI classic, wouldn't I do this:</p> <p>Map &gt; Mosaicking &gt;Georeferenced</p> <p>And then from the Map Based Mosaic Window</p> <p>Import &gt; Import Files and Edit Properties</p> <p>Assuming that the previous two steps are correct, this is where I am becoming confused when it is asking for background see through and feathering for each image (I tried to set the background see through to NaN but it didn't mosaic correctly). &nbsp;I'll try and send the files to you by email. &nbsp;</p> <p>P.S. I wish I could do this only in IDL but for the time being, I am stuck using the menus.</p>
    You are not authorized to post a reply.