Opened 13 years ago

Closed 9 years ago

Last modified 9 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 13 years ago.
tasscap.2.diff (3.9 KB ) - added by sprice 13 years ago.
updated to format floats
i.tasscap.py (4.9 KB ) - added by sprice 13 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 12 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 12 years ago.
diff of latest i.tasscap.2.py vs svn trunk r55670.
i.tasscap.diff (4.8 KB ) - added by lucadelu 11 years ago.
update to the last svn versione and fix indentation according to PEP8

Download all attachments as: .zip

Change History (13)

by sprice, 13 years ago

Attachment: tasscap.diff added

by sprice, 13 years ago

Attachment: tasscap.2.diff added

updated to format floats

by sprice, 13 years ago

Attachment: i.tasscap.py added

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

by sprice, 12 years ago

Attachment: i.tasscap.2.py added

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

by hamish, 12 years ago

Attachment: i.tasscap.seth.diff added

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

comment:1 by hamish, 12 years ago

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

comment:2 by hamish, 12 years ago

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

in reply to:  1 comment:3 by neteler, 12 years ago

Replying to hamish:

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

See #1832

by lucadelu, 11 years ago

Attachment: i.tasscap.diff added

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

in reply to:  description comment:4 by lucadelu, 11 years ago

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 by lucadelu, 10 years ago

Keywords: needinfo added

comment:6 by lucadelu, 9 years ago

Resolution: fixed
Status: newclosed

After two years no additional info was provided.

Closing ticket, please reopen if needed

comment:7 by neteler, 9 years ago

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.