Opened 8 years ago

Closed 4 years ago

Last modified 4 years ago

#1624 closed enhancement (fixed)

i.tasscap speedup

Reported by: sprice Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Python Version: svn-trunk
Keywords: needinfo, i.tasscap Cc:
CPU: All Platform: All

Description

I made two changes to the i.tasscap script for a nice speedup. First I combined all outputs into one mapcalc() call, resulting in a ~9% speedup. Then I added an option to skip outputting the 'haze' raster for a total ~41% speedup. I also converted all tabs to spaces for consistency. Attached is the diff.

Attachments (6)

tasscap.diff (3.9 KB) - added by sprice 8 years ago.
tasscap.2.diff (3.9 KB) - added by sprice 8 years ago.
updated to format floats
i.tasscap.py (4.9 KB) - added by sprice 8 years ago.
bugfix for L4 and changed it to floats, because double precision doesn't make sense with the given constants
i.tasscap.2.py (4.7 KB) - added by sprice 8 years ago.
Updated the syntax to work correctly under Mac 10.8.2's python install
i.tasscap.seth.diff (1.6 KB) - added by hamish 7 years ago.
diff of latest i.tasscap.2.py vs svn trunk r55670.
i.tasscap.diff (4.8 KB) - added by lucadelu 6 years ago.
update to the last svn versione and fix indentation according to PEP8

Download all attachments as: .zip

Change History (13)

Changed 8 years ago by sprice

Attachment: tasscap.diff added

Changed 8 years ago by sprice

Attachment: tasscap.2.diff added

updated to format floats

Changed 8 years ago by sprice

Attachment: i.tasscap.py added

bugfix for L4 and changed it to floats, because double precision doesn't make sense with the given constants

Changed 8 years ago by sprice

Attachment: i.tasscap.2.py added

Updated the syntax to work correctly under Mac 10.8.2's python install

Changed 7 years ago by hamish

Attachment: i.tasscap.seth.diff added

diff of latest i.tasscap.2.py vs svn trunk r55670.

comment:1 Changed 7 years ago by hamish

ps- where do we stand on 8 spaces vs. 1 tab in python scripts?

comment:2 Changed 7 years ago by hamish

Component: DefaultPython
CPU: UnspecifiedAll
Keywords: i.tasscap added
Platform: UnspecifiedAll

comment:3 in reply to:  1 Changed 7 years ago by neteler

Replying to hamish:

ps- where do we stand on 8 spaces vs. 1 tab in python scripts?

See #1832

Changed 6 years ago by lucadelu

Attachment: i.tasscap.diff added

update to the last svn versione and fix indentation according to PEP8

comment:4 in reply to:  description Changed 6 years ago by lucadelu

Replying to sprice:

I made two changes to the i.tasscap script for a nice speedup. First I combined all outputs into one mapcalc() call, resulting in a ~9% speedup. Then I added an option to skip outputting the 'haze' raster for a total ~41% speedup. I also converted all tabs to spaces for consistency. Attached is the diff.

I tested the patch, with the updates of indentation that you can find in the last attachment, but in my case the script is slower then the old one, I'm using time to test the speed.

With the North Carolina landsat I obtain this value with the old version

real 0.84
user 0.70
sys 0.09

and this with the new one

real 0.85
user 0.73
sys 0.08

With bigger files the result is this, old

real 166.72
user 145.94
sys 4.79

new

real 169.69
user 146.95
sys 4.70

Please can you test again and send us your results?

comment:5 Changed 6 years ago by lucadelu

Keywords: needinfo added

comment:6 Changed 4 years ago by lucadelu

Resolution: fixed
Status: newclosed

After two years no additional info was provided.

Closing ticket, please reopen if needed

comment:7 Changed 4 years ago by neteler

For the record:

from what I see, most improvements where included except for the option to skip outputting the 'haze' raster map (I compared the proposed i.tasscap.2.py​ to current trunk r67875).

The indicated major speed gain would probably come from skiping the output of the Landsat related 'haze' raster map. If that's important, please reopen.

Note: See TracTickets for help on using tickets.