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

Home » Public Forums » archive » Re: IDL/ENVI SPOT-5 Level 1a (DIMAP format) - simple(?) gain problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDL/ENVI SPOT-5 Level 1a (DIMAP format) - simple(?) gain problem [message #72213] Sun, 22 August 2010 14:15 Go to next message
Maxwell Peck is currently offline  Maxwell Peck
Messages: 61
Registered: February 2010
Member
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.
Re: IDL/ENVI SPOT-5 Level 1a (DIMAP format) - simple(?) gain problem [message #72309 is a reply to message #72213] Mon, 23 August 2010 09:53 Go to previous message
jeffnettles4870 is currently offline  jeffnettles4870
Messages: 111
Registered: October 2006
Senior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Open webpage
Next Topic: Re: jpeg exif

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

Current Time: Wed Oct 08 09:13:55 PDT 2025

Total time taken to generate the page: 0.00519 seconds