comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: read/writing tiff files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: read/writing tiff files [message #35630 is a reply to message #35629] Sat, 28 June 2003 07:26 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Alexandra Panton writes:

> my code so far...
>
> stuff = ('f:\ftp_web_root\Recent\hawaii\GOES_9\all')
> store = ('d:\goes\hawaii')
>
> cd, stuff
> ...
> outname=input+'bt' ;output file name;
> cd, store
> openw,1, outname ;opens a file with outname filename;
> write_tiff,input ;writes a tiff file of input array
> close,1
> free_lun,1
> x=x+1 ;loops round to next image;
> endwhile
> end
>
> When i run this it stops at the openw command with a type conversion
> error: Unable to convert given STRING to Byte.

When you get the error message, you should read it carefully
to see what line the error occurs on. They you go to that
line in the program and stare at it for a period of time that
is inversely proportional to the time you have been working
with IDL (or sometimes, in rare cases, or if you are under
a tight deadline, a hell of a lot longer).

In your case, you will probably be looking at this line:

outname=input+'bt' ;output file name;

What's wrong with it? Hard to say on the surface. The
code looks good, no quotes missing or anything. Everything's
spelled OK. But what are you trying to do? Create an output
filename, right? A string. Are your arguments strings? Well,
don't know. Let's see.

IDL> Help, input
INPUT BYTE = Array[360, 360]

A byte array!? That's not what I thought input was!

Uh, huh. And that's the problem. In fact, now the
error message makes some sense. You are trying to
add apples and oranges and the computer is telling you
it doesn't know how to do that.

You probably meant something like this:

outname = files[x] + 'bl'

Or, perhaps something more sophisticated, like this:

name = StrSplit(files[x], '.', /Extract)
outname = name[0] + 'bl.' + name[1]
Print, files[x], outname
picture123.tif picture123bl.tif

OK, fix that, then recompile and run it again.

What!? Another error! Oh, oh. This is too much like
work. No wonder I don't write programs for a living.
This kind of stuff drives me crazy!!!

What the hell is the matter with that WRITE_TIFF line!?
I copied that from Mike's program and *his* works!

Oh, wait a minute. Maybe I copied that from his
program that didn't work. :-(

In any case, I would turn this (which surely won't work):

cd, store
openw,1, outname ;opens a file with outname filename;
write_tiff,input ;writes a tiff file of input array
close,1
free_lun,1

Into this:

cd, store
write_tiff, outname, input

*Then* we might get somewhere! :-)

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Jeffries-Matusita(JM) distance
Next Topic: NUFT code... not working

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 15:10:28 PDT 2025

Total time taken to generate the page: 1.35972 seconds