BSQ to BIL [message #69587] |
Fri, 05 February 2010 11:46  |
jtmcahill
Messages: 26 Registered: October 2007
|
Junior Member |
|
|
Hi,
I'm trying to convert a BSQ to BIL and then make an ISIS .cub file
using some of the ENVI Doit functions and a write_isis command.
Converting to BIL appears to work when I run the program below
(meaning it is identified as a BIL when I open it in ENVI) but I'm
having trouble making an ISIS .cub file out of the product. I realize
my mistake may be in ISIS but I want to make sure I've converted it to
BIL correctly first.
Second, the write_isis command isn't being recognized by idl.
I'd appreciate any help with either topic.
pro bsq2isis,filename
envi, /restore_base_save_files
envi_batch_init, log_file='batch.txt'
envi_open_file, filename, r_fid=fid
envi_file_query, fid, dims=dims, nb=nb
pos = lindgen(nb)
out_name = out_name
envi_doit, 'convert_doit', $
fid=fid, pos=pos, dims=dims, $
o_interleave=1, out_name=filename + '_bil.img', $
r_fid=r_fid
a=isis_write, r_fid,filename + '_bil.cub'
end
|
|
|
Re: BSQ to BIL [message #69755 is a reply to message #69587] |
Mon, 08 February 2010 12:59   |
jtmcahill
Messages: 26 Registered: October 2007
|
Junior Member |
|
|
On Feb 8, 3:53 pm, pp <pp.pente...@gmail.com> wrote:
> On Feb 6, 7:00 pm, Maxwell Peck <maxjp...@gmail.com> wrote:
>
>>> a=isis_write, r_fid,filename + '_bil.cub'
>
>> Hi,
>
>> I'm not sure where ISIS_WRITE comes from (it's not an ENVI function as
>> far as i know), or what your actual error is, but it is unlikely it
>> will accept the r_fid keyword. You will probably need to use the
>> ENVI_GET_DATA function to put the band in an IDL variable and output
>> it from that. If there is a lot of data you may need to use tiling
>> (all in the ENVI Programmers guide).
>
>> Max
>
> This is not directly related to the original question, but if anyone
> is interested, I have a reader and writer for ISIS cubes. The main
> reasons I wrote them are the awkward interface of the ISIS routines,
> their lack of ability to do more complicated things than just reading
> or writing core bands, and to not need to install ISIS just to read
> and write cubes from IDL. However, my routines presently only support
> BSQ.
pp,
I'd be very interested to see what you have. I was under the
impression ISIS files had to be in BIL format. Are you saying they
don't necessarily need to?
Josh
|
|
|
|
|
|
|
Re: BSQ to BIL [message #69858 is a reply to message #69587] |
Mon, 15 February 2010 13:13  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Feb 15, 5:11 pm, David Fanning <n...@dfanning.com> wrote:
> Sorry. This was a joke. I think I went through the same thing
> back in 1987 or whenever widgets were first introduced. It's
> just damn hard to move astronomers(or scientists, generally)
> off the dime. This is why most of my objects have procedural
> interfaces. I don't have the strength to fight the good
> fight a second time. :-)
I have noticed that difficulty, too. Even at much more basic things
than widgets, such as good programming practices. It seems to me that
there is a tendency to keep things frozen into naive, impractical,
programming, because that is the way that each generation is thought
to do it, and passes it on, unaltered, to the next. Just because they
were never thought any better, and made to think that is all that
there is to programming.
That particular class happened to be designed that way primarily to be
used by much more complicated applications, some with a compound
widget that examines a cube's contents (written using Catalyst),
others that use it to process and store many cubes into a sav file, in
a way that they can be easily used later, even allowing to recreate
the ISIS cube files.
|
|
|
Re: BSQ to BIL [message #69859 is a reply to message #69587] |
Mon, 15 February 2010 11:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
pp writes:
> No, there are not widgets there. Only one the pp_editablecube class,
> that provides an API for reading, editing and writing a cube. Which
> seemed the most proper choice for editing, so that the setproperty
> methods take care of keeping the cube valid when one thing is changed.
Sorry. This was a joke. I think I went through the same thing
back in 1987 or whenever widgets were first introduced. It's
just damn hard to move astronomers(or scientists, generally)
off the dime. This is why most of my objects have procedural
interfaces. I don't have the strength to fight the good
fight a second time. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
Re: BSQ to BIL [message #69860 is a reply to message #69587] |
Mon, 15 February 2010 11:01  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Feb 15, 3:21 pm, David Fanning <n...@dfanning.com> wrote:
>
> Huh!? Are these anything like widgets? Don't use 'em. ;-)
No, there are not widgets there. Only one the pp_editablecube class,
that provides an API for reading, editing and writing a cube. Which
seemed the most proper choice for editing, so that the setproperty
methods take care of keeping the cube valid when one thing is changed.
|
|
|
Re: BSQ to BIL [message #69863 is a reply to message #69587] |
Mon, 15 February 2010 09:21  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
pp writes:
> No, do not change the file names. Those with __define in their name
> are files that define classes. The routines with :: in their names are
> methods of those classes, and that is the way they should be.
Huh!? Are these anything like widgets? Don't use 'em. ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
Re: BSQ to BIL [message #69864 is a reply to message #69587] |
Mon, 15 February 2010 09:04  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Feb 15, 2:42 pm, Hawaiianite <jtmcah...@gmail.com> wrote:
> I'm having trouble getting your code to run. Why are the .pro files
> labeled "_define.pro"? Do I need to remove that and put them in the
> IDL library to run. Because right now it isn't recognizing them and
> keeps giving me a syntax error. IDL appears to not like the "::"
> before init before I try to run pp_readcube.pro.
No, do not change the file names. Those with __define in their name
are files that define classes. The routines with :: in their names are
methods of those classes, and that is the way they should be.
First, make sure you have in your IDL path all the source code files:
http://www.ppenteado.net/idl/pp_editablecube__define.pro
http://www.ppenteado.net/idl/pp_readcube__define.pro
http://www.ppenteado.net/idl/pp_setcubeheadervalue.pro
http://www.ppenteado.net/idl/pp_extractfields.pro
http://www.ppenteado.net/idl/pp_getcubeheadervalue.pro
http://www.ppenteado.net/idl/pp_buffered_vector__define.pro
Then, what exactly were you trying to do?
This (copied from the file pp_editablecube__define.html) is one
example of how to use it to read, edit and write a cube:
To initialize from the cube CM_1553510065_1_ir.cub:
a=obj_new('pp_editablecube',file='CM_1553510065_1_ir.cub')
To add a dummy backplane:
a-
> getproperty,backplanes=back,backnames=bnames,lines=lines,sam ples=samples
backplanes=[[[backplanes]],[[findgen(lines,samples)]]]
backnames=[backnames,'DUMMY']
a->setproperty,backplanes=back,backnames=bnames
To remove the first core band:
a->getproperty,core=core,wavelengths=wavs
core=core[*,*,1:*] & wavs=wavs[1:*]
a->setproperty,core=core,wavelengths=wavs
To add lines to the history part of the header:
app=['GROUP = testedit','date = '+strcompress(systime(),/
remove),'END_GROUP = testdate']
a->headerset,append=app
To write the edited cube to 'testedit.cub':
a->write,'testedit.cub'
Destroy the object when done with it:
obj_destroy,a
There are more examples, for reading thing from a cube, in the file
pp_readcube__define.html.
|
|
|
|