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

Home » Public Forums » archive » IDL/ENVI SPOT-5 Level 1a (DIMAP format) - simple(?) gain problem
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: IDL/ENVI SPOT-5 Level 1a (DIMAP format) - simple(?) gain problem [message #72308 is a reply to message #72214] Mon, 23 August 2010 11:44 Go to previous message
D2 is currently offline  D2
Messages: 3
Registered: August 2010
Junior Member
On Aug 23, 12:53 pm, "Jeff N." <jeffnettles4...@gmail.com> wrote:
> On Aug 22, 5:15 pm, Maxwell Peck <maxjp...@gmail.com> wrote:
>
>
>
>> On Aug 23, 2:31 am, D2 <dennis.d...@gmail.com> wrote:
>
>>> Hi all,
>
>>> It's a Sunday afternoon and I'm pulling my hair out trying to do
>>> something I thought was going to be relatively easy, but instead has
>>> turned into a bit of a nightmare for a beginner at IDL/ENVI.
>
>>> I've got a geotiff of SPOT-5 level 1a imagery that I bring in by
>>> opening up the supplied *.DIM file so that I get most of the important
>>> metadata (e.g., band wavelengths, standard gains and offsets, etc).
>
>>> So, the question is this: how can I apply separate gains and offsets
>>> to each of my 4-bands, and then write those new results together into
>>> a separate file, or even the original file? In other words, the
>>> original file + 4 new "bands" added to it, or new file (with all
>>> projection metadata, etc. intact) with 4 new band).
>
>>> The original file is in 8bit "digital number" (aren't they all
>>> "digital"?? heh.) and I'm calculating 32-bit floating point values, so
>>> it's your standard "radiometric calibration" process.
>
>>> I've tried using the "apply gain and offsets" module, but that
>>> multiples when I want to divide values. I've also tried using band
>>> math, but I seem to be only able to apply one equation to one band at
>>> a time, and then it only outputs the results to a single file. I'd
>>> like to apply 4 separate equations to their respective bands, and then
>>> output these new results to a single file, or just write them into the
>>> original file.
>
>>> There's a user submitted code on the ENVI user forum that basically
>>> does what I need to do (calibrate_spot.sav), but I'd like to get under
>>> the hood to tweak parameters and begin to teach myself to understand
>>> IDL. What I'm looking to do is apply my own custom gains and offsets
>>> instead of using those supplied in the metadata file.
>
>>> I do want to learn, and I'm eagerly awaiting my Morton Canty book to
>>> arrive, but I'd like to make some headway on this now.
>
>>> Any pointers (and sample code) would be immensely appreciated!
>
>>> Cheers,
>
>>> Dennis
>
>> From memory the gain/offset routine applies them in the 'remote
>> sensing' sense, that is GAIN* (DN - OFFSET) . If you adjust your
>> offset accordingly the routines will do what you want.
>
> I've used envi's gain/offset very little, and a long time ago at that,
> so i could be wrong but i think that that routine applies the same
> gain/offset to every band, and the OP mentioned a different gain/
> offset for every band.
>
> Assuming that's the case, what I would do is assemble all the gain's
> into a "spectrum" (a linear array with one element per band containing
> all the gains), and then do the same thing for the offsets.  From that
> point what you'd want to do is actually spectral math:
>
> s1*s2+s3  ;adjust equation as you need to
>
> where:
>
> s1 - input file (use "Map variable to input file" button)
> s2 - gain "spectrum"
> s3 - offset "spectrum"
>
> Of course, if you were going to be doing this several times, and have
> ENVI+IDL, i'd just write code to do this.
>
> Jeff

Thanks Jeff. Much appreciated.

Originally, I wanted to use the the gain/offset module as it outputs
the calculated bands into a single file, but I don't think there's a
way of reusing it to meet my needs. It calculates TOA radiance (and
applies separate gains and offsets to each band) like so:

TOA Radiance = (DN*GAIN)-offset

but I need:

TOA Radiance = (DN/GAIN)-offset

However, your solution does provide me with an option, so thanks for
that. I'd like to program it all in IDL, but I'm a complete beginner.
Thankfully, my "Practical IDL Programming" book has just arrived, so
hopefully there will be some tips in there.

Let me know if you have any suggestions/caveats about how to use ENVI
specific functions to accomplish this (I'm still waiting for my Morton
Canty ENVI//IDL book to arrive).

Thanks again!

Dennis
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: jpeg exif
Next Topic: Re: IDLdoc 3.3alpha1

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

Current Time: Wed Oct 08 19:58:51 PDT 2025

Total time taken to generate the page: 0.00428 seconds