|
Re: How to correct errors an IDL [message #82371 is a reply to message #82368] |
Sat, 08 December 2012 07:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Dry in water writes:
> It can be read in ARCGIS but cannot be read in Matlab,too. Originally this image extracted from interpolation method in ARCGIS. I converted it into tiff file using ARCGIS as well. When I see the values of whole image by displaying values in command window of matlab, all values was -3.4028. Then I checked the values by subsetting 10-by-10 array. In this case, the values were correct.
>
> Maybe it is not a proper tiff file. How can I ckeck or correct this?
I would say if MatLab and IDL won't read the file as a TIFF file,
more evidence that it is not a proper TIFF file is not going
to help that much.
I'd have another go at converting to a TIFF file in ARCGIS,
paying careful attention to all the details. If that fails
again, then I suspect the only other alternative you have
is frequent and ardent prayer. (I suppose a quick call to
ARCGIS technical support wouldn't hurt, either.)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: How to correct errors an IDL [message #82372 is a reply to message #82371] |
Sat, 08 December 2012 07:07  |
Dry in water
Messages: 18 Registered: October 2012
|
Junior Member |
|
|
It can be read in ARCGIS but cannot be read in Matlab,too. Originally this image extracted from interpolation method in ARCGIS. I converted it into tiff file using ARCGIS as well. When I see the values of whole image by displaying values in command window of matlab, all values was -3.4028. Then I checked the values by subsetting 10-by-10 array. In this case, the values were correct.
Maybe it is not a proper tiff file. How can I ckeck or correct this?
|
|
|
Re: How to correct errors an IDL [message #82373 is a reply to message #82372] |
Sat, 08 December 2012 06:00  |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den lördagen den 8:e december 2012 kl. 11:55:54 UTC+1 skrev Dry in water:
> I tried to read the image using the way you suggested:
>
> temper = READ_TIFF ( 'temp_2000.tif')
>
>
>
> The following error displayed:
>
> READ_TIFF: D:\tmp\temp\temp_2000.tif: Cannot open
>
> % Execution halted at: $MAIN$
>
>
>
> Have you experienced this kind of error for reading file?
Maybe it's not a proper tiff file? Can you read it into any other program, like photoshop or ImageMagick or whatever you might have installed on your computer?
|
|
|
Re: How to correct errors an IDL [message #82374 is a reply to message #82373] |
Sat, 08 December 2012 05:48  |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den lördagen den 8:e december 2012 kl. 13:12:58 UTC+1 skrev Dry in water:
> It seems I found out the reason why it cannot open. Null value (Nodata) of this image is -3.4028234663e+038. Pixel type is float-point, 32 bit. So the number is out of range of float-point. So how can I set null value into 0. Is there any way to do this in IDL.
IDL> help,-3.4028234663e+038
<Expression> FLOAT = -3.40282e+38
IDL seems to be fine with representing that number as a float. It probably will not keep all the decimals, though.
|
|
|
Re: How to correct errors an IDL [message #82375 is a reply to message #82374] |
Sat, 08 December 2012 05:44  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Saturday, December 8, 2012 1:12:58 PM UTC+1, Dry in water wrote:
> It seems I found out the reason why it cannot open. Null value (Nodata) of this image is -3.4028234663e+038. Pixel type is float-point, 32 bit. So the number is out of range of float-point. So how can I set null value into 0. Is there any way to do this in IDL.
I guess that you could use the where command. Something like:
LowestValue = 1.0e+030
BadPoints = where((temper gt (-1.0*LowestValue)) && (temper lt LowestValue), Count)
if count ge 0 then temper[BadPoints] = 0.0
This will set to zero all value of Temper within -1.0e+030 and +1.0e+030. You might change LowestValue accordingly to what you consider too small or to what does not give an error anymore.
Given your image size, the "where" method might be slow... I think there were quite a few posts in the past about this.
Cheers,
Helder
|
|
|
Re: How to correct errors an IDL [message #82376 is a reply to message #82375] |
Sat, 08 December 2012 04:12  |
Dry in water
Messages: 18 Registered: October 2012
|
Junior Member |
|
|
It seems I found out the reason why it cannot open. Null value (Nodata) of this image is -3.4028234663e+038. Pixel type is float-point, 32 bit. So the number is out of range of float-point. So how can I set null value into 0. Is there any way to do this in IDL.
|
|
|
Re: How to correct errors an IDL [message #82377 is a reply to message #82376] |
Sat, 08 December 2012 02:55  |
Dry in water
Messages: 18 Registered: October 2012
|
Junior Member |
|
|
I tried to read the image using the way you suggested:
temper = READ_TIFF ( 'temp_2000.tif')
The following error displayed:
READ_TIFF: D:\tmp\temp\temp_2000.tif: Cannot open
% Execution halted at: $MAIN$
Have you experienced this kind of error for reading file?
|
|
|
Re: How to correct errors an IDL [message #82379 is a reply to message #82377] |
Sat, 08 December 2012 00:57  |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den lördagen den 8:e december 2012 kl. 09:24:38 UTC+1 skrev Dry in water:
> Hello all,
>
>
>
> when I imported an image with 4 bands into IDL using 'import image file' tool, but 'Program caused arithmetic error: Floating illegal operand' error appeared on command history window. So I imported this image using openr command.
>
>
>
> openr,1, 'D:\tmp\temp\temp_2000.tif'
>
> temper=fltarr(2894,4584,4)
>
> readu,1,temper
>
> close,1
I don't know anything about the "import image tool". Do you know that it supports tiff files?
Reading an image with openr and readu like you do works only if the file has no header. Surely tiff files start with at least some meta information? Did you display the images and do they look anything like you expect them to? If not, you may want to try using
temper = READ_TIFF ( Filename )
instead.
> Then I wanted to find out the indices of 'temper' that are not valid float-point numbers using finite command. But this command gave me just a number(-1). So I want to ask why finite command didn't show me all the location of not valid float-point numbers.
>
> Here is a command;
>
>
>
> print, where(~finite(temper))
>
> -1
>
> % Program caused arithmetic error: Floating underflow
If you get different results from reading the file in two different ways, there is a good chance at least one of those ways of reading is wrong.
|
|
|