[GRASS-user] unexpected i.pansharpen results
Yann Chemin
yann.chemin at gmail.com
Thu Jan 31 20:06:16 PST 2013
from the code in trunk:
if sproc:
# serial processing
e = '''eval(k = "$ms1" + "$ms2" + "$ms3")
"$outr" = "$ms3" * "$panmatch3" / k
"$outg" = "$ms2" * "$panmatch2" / k
"$outb" = "$ms1" * "$panmatch1" / k'''
grass.mapcalc(e, outr=outr, outg=outg, outb=outb,
panmatch1=panmatch1, panmatch2=panmatch2,
panmatch3=panmatch3,
ms1=ms1, ms2=ms2, ms3=ms3, overwrite=True)
else:
# parallel processing
pb = grass.mapcalc_start('%s_blue = (%s * %s) / (%s + %s + %s)'
%
(out, ms1, panmatch1, ms1, ms2, ms3),
overwrite=True)
pg = grass.mapcalc_start('%s_green = (%s * %s) / (%s + %s +
%s)' %
(out, ms2, panmatch2, ms1, ms2, ms3),
overwrite=True)
pr = grass.mapcalc_start('%s_red = (%s * %s) / (%s + %s + %s)' %
(out, ms3, panmatch3, ms1, ms2, ms3),
overwrite=True)
It is a mapcalc process started using Python wrapper lib "grass.script",
the process comes to debug a mapcalc command as described by the expression
"e" initialized at the beginning of the copied code.
Run in it mapcalc with float() casting and see if it is a problem.
On 31 January 2013 23:36, Michael Barton <Michael.Barton at asu.edu> wrote:
> i.pansharpen uses Python, not Bash. So it is not an integer math
> problem.
>
> However, you might try changing your input maps to float or DCELL. See
> if that changes things.
>
> Michael
> ______________________________
> C. Michael Barton
> Director, Center for Social Dynamics & Complexity
> Professor of Anthropology, School of Human Evolution & Social Change
> Arizona State University
> Tempe, AZ 85287-2402
> USA
>
> voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
> fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
> www: http://csdc.asu.edu, http://shesc.asu.edu
> http://www.public.asu.edu/~cmbarton
>
> On Jan 31, 2013, at 2:11 AM, <grass-user-request at lists.osgeo.org>
> wrote:
>
> *From: *Yann Chemin <yann.chemin at gmail.com>
> *Subject: **Re: [GRASS-user] unexpected i.pansharpen results*
> *Date: *January 31, 2013 2:11:33 AM MST
> *To: *Hamish <hamish_b at yahoo.com>
> *Cc: *GRASS user list <grass-user at lists.osgeo.org>
>
>
> hmmm, yes that looks like an old friend to check...
>
>
> On 31 January 2013 14:06, Hamish <hamish_b at yahoo.com> wrote:
>
>> (sorry for the html,top posting)
>>
>> I wonder if the script is doing integer division when it should be doing
>> floating point division?
>>
>>
>> http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py
>>
>>
>> Hamish
>>
>> --- On *Wed, 1/30/13, Eric Goddard <egoddard1010 at gmail.com>* wrote:
>>
>>
>> From: Eric Goddard <egoddard1010 at gmail.com>
>> Subject: [GRASS-user] unexpected i.pansharpen results
>> To: grass-user at lists.osgeo.org
>> Date: Wednesday, January 30, 2013, 8:30 AM
>>
>>
>> Hi all,
>>
>> I'm attempting to pansharpen some ikonos imagery using the i.pansharpen
>> tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range
>> for the sharpened red, green, and blue outputs are 0-30, which seems
>> suspicious given the 16bit range of the input bands. The command I used was:
>>
>> i.pansharpen.py "sharpen=ihs" "ms3=ik_mss.4 at eric" "ms2=ik_mss.3 at eric"
>> "ms1=ik_mss.2 at eric" "pan=ik_pan at eric" "output_prefix=ik_ihs"
>>
>> The input bands are linked via r.external, would that matter?
>>
>> The output from my test area is below. Any assistance would be greatly
>> appreciated.<image.png>
>>
>>
>> Thanks,
>> Eric
>>
>> -----Inline Attachment Follows-----
>>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org<http://mc/compose?to=grass-user@lists.osgeo.org>
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
>>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
--
Yann Chemin
Researcher at IWMI
Skype/FB: yann.chemin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130201/328e7009/attachment-0001.html>
More information about the grass-user
mailing list