Search Comments and Ratings

go

Comments and Ratings

   
Date File Comment by Comment Rating
26 Oct 2009 ENVI file reader, version 2 Read ENVI raster files. Supports all interleaves, data types (except complex) and byte orders. Author: Ian Howat Esquerre, Carlos

It works pretty good. I made a small modification to read files without geographical information since I work with hyperspectral image of mushrooms.

26 Sep 2009 SORTFIELDS SORTFIELDS sort values in all fields within a structure. Author: Ian Howat Fetterman, Matt

Seems quite useful !

24 Nov 2008 SORTFIELDS SORTFIELDS sort values in all fields within a structure. Author: Ian Howat Shlomi

It'll be also useful if you return the parameter 'I' in the same manner that the sort function does. 'I' should be an array or cell array in the case that 'SORTBYFIELDS' was not used.

24 Nov 2008 SORTFIELDS SORTFIELDS sort values in all fields within a structure. Author: Ian Howat Shlomi

This function is just what I looked for. Thanks.
I suggest you add another option to sort the fields according to a supplied variable and not only according to one of the fields.
It is a complimentary option to 'SORTBYFIELD' and can be called 'SORTBYVAR'.

13 Aug 2008 DATEPART Extract decimal yr/month/day/hr/min/sec from a datenum. More versatile than datevec. Author: Ian Howat Howat, Ian

Cory,
Please give some more details of your error *BEFORE* trashing the function with a 1-star rating so that I can fix it. You say a that the function is failing in returning the correct month with a 1-day time series. If I create such as time series with:
>t = datenum('jan-0-2008')+(1:365);
and then sample this time series about once a month:
>> ts = t(1:30:end);
>> datestr(ts)
ans =
01-Jan-2008
31-Jan-2008
01-Mar-2008
31-Mar-2008
30-Apr-2008
30-May-2008
29-Jun-2008
29-Jul-2008
28-Aug-2008
27-Sep-2008
27-Oct-2008
26-Nov-2008
26-Dec-2008

and then get the decimal month using datepart:
>> datepart(ts,'month')
ans =
  Columns 1 through 9
    1.0000 1.9677 3.0000 3.9677 4.9667 5.9355 6.9333 7.9032 8.8710
  Columns 10 through 13
    9.8667 10.8387 11.8333 12.8065
Looks good to me ... sure you're using it correctly??????

06 Aug 2008 DATEPART Extract decimal yr/month/day/hr/min/sec from a datenum. More versatile than datevec. Author: Ian Howat Sieg, Cory

Doesn't pick out the month accurately from a daily time series.

19 May 2008 FILLNANS FILLNANS replaces all NaNs in array using inverse-distance weighting between non-NaN values. Author: Ian Howat Janiczek, Janusz

16 May 2008 TIMESPLITRINEX Break up a RINEX GPS file by a length of time Author: Ian Howat Rogula, Stanislaw

16 May 2008 TIMESPLITRINEX Break up a RINEX GPS file by a length of time Author: Ian Howat Rogo, Stan

18 Jan 2008 ENVI file reader, version 2 Read ENVI raster files. Supports all interleaves, data types (except complex) and byte orders. Author: Ian Howat Utku, Cuneyt

Very useful. Code is easy to follow.
I downloaded it on Jan 18, 2008. It is version 1, dated 11-Jul-2007 and apparently still has the bugs mentioned above.

25 Jul 2007 ENVI file reader, version 2 Read ENVI raster files. Supports all interleaves, data types (except complex) and byte orders. Author: Ian Howat Howat, Ian

If the map/image coordinates in the map info in the header are not the upper left corner (1.5,1.5), the program will not create the correct X Y vectors. I've uploaded a fix for this.

20 Jul 2007 ENVI file reader, version 2 Read ENVI raster files. Supports all interleaves, data types (except complex) and byte orders. Author: Ian Howat Howat, Ian

Notice (7/19/2007) There's a bug in the current version that keeps it from loading 1-band images correctly. I've uploaded an update, so you'll want to wait and download when the system posts the revised version on 7/20/2007.

19 Jul 2007 FILLNANS FILLNANS replaces all NaNs in array using inverse-distance weighting between non-NaN values. Author: Ian Howat D'Errico, John

My thanks to the author for his continued modifications. Along the way, he has considerably improved this code. With those enhancements, perhaps it is now time to revise my own rating.

18 Jul 2007 FILLNANS FILLNANS replaces all NaNs in array using inverse-distance weighting between non-NaN values. Author: Ian Howat Howat, Ian

I thank John for his thorough and informative review below. I would like to respond to his point about the relative "accuracy" of FILLNANS and INPAINT_NANS. In the example John used, he interpolated between gaps in a smooth sinusoidal function and tested the accuracy by cross-validation of the interpolated points with the missing functions. Since INPAINT_NANS uses linear least-squares, it will do the best job of interpolating smooth gradients. However, as an Earth Scientist, I deal a lot with interpolating data with messy (ie. highly peaked) variograms that do not follow smooth functions with even gradients. Ideally I use Kriging to interpolate these data so I can get some sense of the spatial variance and therefore some idea of the confidence of my interpolation. However, kriging takes too long on big datasets and doesnt do well with edges of arrays, thus inverse-distance interpolation is simple and keeps a tight bound on the interpolated values. To gain some insight into the relative accuracy of methods, I applied and compared FILLNANS and INPAINT_NANS to some "real" data - in this case gridded altimetry measurements over the coast of Greenland. This is the same data that's in the screen shot.
For each method I set 200 random data values in the grid to NaN, applied the fill methods, and then compared the std. deviations between the original data values and the interpolated values. I did this 10 times per method, and used every INPAINT_NANS method and the "best" radius/power settings for FILLNANS.

For FILLNANS(A,'power',6,'radius',20) the average standard deviation for all the tests was 78.7083m with a range of 59.2604 to 105.1010. It took 2.790790 seconds to complete each interpolation.
For INPAINT_NANS(A) (the default appeared to give the best result) the average standard deviation was 68.5119m with a range of 46.2669m to 112.6178m. INPAINT_NANS took 4.948645 seconds for each interpolation.
So we see that INPAINT_NANS still provides, on average, a more "accurate" cross-validation result than FILLNANS, but this accuracy is more sensitive to which data is left out for validation and not more accurate than FILLNANS in every case. FILLNANS is 1.7732 times faster for this example (17391 NAN's, 1698 Non-NaN's), which is a different result than John’s below and likely reflects his and Urs's efficiency recommendations. Finally, INPAINT_NANS results in wild peaks where it extrapolates to the edges while FILL-NANS relaxes to the, in this case, more realistic mean or to where it's too far from a value and returns NaN (probably the most realistic result).
In conclusion, these results support John's point that these methods are suited to different tasks.
For big arrays with sparse data on the edges and strongly peaked variograms, or where you want added control through the radius cut-off function and tighter bounding of values , I would go with FILLNANS. Otherwise, INPAINT_NANS.
Probably the best thing to do is to use both and do a comparison like this. - Ian

16 Jul 2007 FILLNANS FILLNANS replaces all NaNs in array using inverse-distance weighting between non-NaN values. Author: Ian Howat D'Errico, John

I did like the help in fillnans. There is no error checking, but relatively little to check. ;-) It has an H1 line, although part of it spills over into a second line. The code is quite simple.

I did some testing to compare fillnans with my own inpaint_nans tool. The first test has a moderately sparse sampling, with fully 98% of it a NaN.

[X,Y] = meshgrid(0:.02:2);
Z = sin((X+Y)*3).*cos((X-Y)*5);
B = rand(size(X))>.02;
Z(B) = NaN;

tic,Zip = inpaint_nans(Z);toc
% Elapsed time is 8.266630 seconds.

tic,Zf = fillnans(Z);toc
% Elapsed time is 59.740188 seconds.

figure
surf(Z0)
title 'Original surface'

figure
surf(Zip)
title 'Inpaint_nans surface'

figure
surf(Zf)
title 'Fillnans surface'

There is a significant difference in speed between the two, as you should see. You should also note the spiky-ness of the fillnans result. This is a characteristic of an inverse distance interpolation. Changing the value of p will have significant influence on your results. For example:

Zf = fillnans(Z,6);
surf(Zf)
title 'Fillnans surface, p == 6'

This was a bit less spiky.

Lets see what happens for more densely populated arrays.
This time I'll make 40% of it NaNs.

[X,Y] = meshgrid(0:.02:2);
Z = sin((X+Y)*3).*cos((X-Y)*5);
B = rand(size(X))>.6;
Z(B) = NaN;

tic,Zip = inpaint_nans(Z);toc
% Elapsed time is 0.821078 seconds.

tic,Zf = fillnans(Z);toc
% Elapsed time is 47.494882 seconds.

figure
surf(Zip)
title 'Inpaint_nans surface'

figure
surf(Zf)
title 'Fillnans surface'

Inpaint_nans was very much faster here, and nicely smoother. How accurate is fillnans? For the problem above, where Z0 is a well behaved, smooth function, inpaint_nans replicates its surface well, better by almost a factor of 200.

std(Z0(:) - Zip(:))
ans =
    0.0007134

std(Z0(:) - Zf(:))
ans =
      0.13365

Can the speed of fillnans be improved? Sadly, the use of waitbar is itself a real time eater.

>> tic,Zf = fillnans(Z);toc
Elapsed time is 47.233541 seconds.

Next, I modified the code to call waitbar only 100 times over the entire main loop. This just took an extra rem call in an if statement. The waitbar is still updated often enough to see it move, but not too often that it was a time hog.

>> tic,Zf = fillnans(Z);toc
Elapsed time is 18.823048 seconds.

It turns out that the calls to waitbar actually wasted roughly 60% of the entire time running. I'll bet the author makes this enhancement quickly.

One behavior of fillnans that is useful is based on its being a convex combination of the data. So at any location, the predicted value must be bounded by the min and max of the data itself. (Method 4 of inpaint_nans should have a similar behavior, for those who must minimize extrapolation
at all costs.)

Another property of fillnans that may be more useful is based on its underlying algorithm. While fillnans is moderately slow, the time required for its solution is
O(K*L), where K is the number of NaN elements to be interpolated, and L is the number of non-NaN elements. Since inpaint_nans is based on the solution of a sparse system of linear equations, that system may grow huge, making the solution of a truly huge problem impossible in the RAM available. However, fillnans may still succeed eventually, as long as you have the RAM to make a copy of the original array.

So for those who may read my review, your own rating of this tool will be a function of the problems that you pose to it. If your problems are simply too large for inpaint_nans, and you are not too worried about a lesser accuracy, then fillnans may be worth a 5 rating for you. For those of you who have smaller problems, who need more accuracy/smoothness, then your rating will be lower. I've chosen to rate it as a 4.

16 Jul 2007 FILLNANS FILLNANS replaces all NaNs in array using inverse-distance weighting between non-NaN values. Author: Ian Howat Howat, Ian

This error comes from a call to a non-standard toolbox function. I've uploaded a corrected version. (Make sure the revision is noted on this page before re-uploading).

16 Jul 2007 INVDISTGRID Simple, robust gridding using inverse-distance interpolation. Author: Ian Howat Howat, Ian

This error comes from a call to a non-standard toolbox function. I've uploaded a corrected version. (Make sure the revision is noted on this page before re-uploading).

16 Jul 2007 INVDISTGRID Simple, robust gridding using inverse-distance interpolation. Author: Ian Howat Stevens, Andrew

Doesn't work as provided...

??? Undefined function or method 'vsum' for input arguments of type 'double'.

Error in ==> invdistgrid at 39
        D = repmat(vsum(XYZ(fs(k),1) - XYZ(fs(k):fe(k),3),...

16 Jul 2007 FILLNANS FILLNANS replaces all NaNs in array using inverse-distance weighting between non-NaN values. Author: Ian Howat D'Errico, John

>> Af = fillnans(A);
??? Undefined function or method 'vsum' for input arguments of type 'double'.

Error in ==> fillnans at 34
    D = vsum(rn(k)-r,cn(k)-c);

04 Oct 2006 squiggle SQUIGGLE stacked-line plot, typically used for plotting seismic and radar profiler data. Author: Ian Howat B, R

Good starting point for my plotting needs

23 Jul 2005 squiggle SQUIGGLE stacked-line plot, typically used for plotting seismic and radar profiler data. Author: Ian Howat j, y

ok,thanks

 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com