Ciao Roberta,

Thanks, that was exactly what I had in mind!

When you find the time you could consider the following further improvements:

  *   Scaling in the beginning: Currently input is scaled with a hard-coded 
factor, that is not necessarily generic. You could either:

  1.  Drop scaling completely and document in the manual how input should be 
scaled. Esp. if the input to your algorithm is output from i.atcorr, as 
i.atcorr has a scaling option for output.
  2.  Make scaling factor a parameter that users can provide (would be useful 
if atmospheric correction is performed with other tools than i.atcorr)

  *   Band statistics: It seems you are computing “zonal statistics” with just 
one zone which in practice will be a sort of global maximum per band. In that 
case you do not need a map and can use a constant in r.mapcalc.
If you need to use global maximum reflectance per band, you could use:
gscript.parse_command(‘r.info’, flags=’g’, …) if the maximum for the entire map 
is needed. This would be the fastest option.
If you need to use maximum within current computational region (or e.g. with a 
different mask applied) you could use:
gscript.parse_command(‘r.univar’, flags=’g’, …); then statistics are computed
From that you get “max” as a variable.

  *   Also having an eye on coding style (pep8 in this case) from the 
beginning, can be very helpful, especially in the beginning (at least that is 
my experience). To start with you could check your code as described here:
https://trac.osgeo.org/grass/wiki/Submitting/Python#Style A more comprehensive 
tutorial can be found e.g. here: 
https://www.datacamp.com/community/tutorials/pep8-tutorial-python-code

Just for inspiration…

Kind regards,
Stefan


From: Roberta Fagandini <[email protected]>
Sent: onsdag 23. mai 2018 17.07
To: GRASS developers list <[email protected]>
Cc: Stefan Blumentrath <[email protected]>; Roberto Marzocchi 
<[email protected]>; Moritz Lennert <[email protected]>; 
[email protected]
Subject: Re: [GRASS-dev] ​GSoC 2018 report week 01 - GRASS GIS module for 
Sentinel-2 cloud and shadow detection

Hi all!
I have just added a new version of the grass python script to my GitHub 
repository [0].
I tried to clean up the code.
As always, any feedback is welcome!

Thanks in advance!

Roberta

[0] https://github.com/RobiFag/GRASS_clouds_and_shadows

2018-05-21 15:19 GMT+02:00 Roberta Fagandini 
<[email protected]<mailto:[email protected]>>:
Ciao Stefan!

2018-05-20 21:44 GMT+02:00 Stefan Blumentrath 
<[email protected]<mailto:[email protected]>>:
Ciao Roberta,
Thanks for the comprehensive report!
One general hint: Even if the drawback is complex expression(s) I would suggest 
merging r.mapcalc calls. That can improve performance quite a bit (less data 
read and written) and reduces the need to manage temporary data.
See also: 
https://grass.osgeo.org/<https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#multiple-computations>grass74<https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#multiple-computations>/manuals/r.mapcalc.html#multiple-computations<https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#multiple-computations>
If you don't need the first_... To fifth_... files later, I would even say 
everything in 3rd_procedure.py until r.to.vect could be solved in a single 
mapcalc operation...

Thank you so much for your hints! I'm trying to clean up the code without 
creating a too complex expression..I hope to share the new version by this 
evening or tomorrow at the latest.


Kind regards and again thank for your GSoC work,
Stefan


Thanks again!!
Roberta


________________________________
From: grass-dev 
<[email protected]<mailto:[email protected]>> 
on behalf of Roberta Fagandini 
<[email protected]<mailto:[email protected]>>
Sent: Sunday, May 20, 2018 4:33:57 PM
To: [email protected]<mailto:[email protected]>; GRASS developers list
Subject: [GRASS-dev] ​GSoC 2018 report week 01 - GRASS GIS module for 
Sentinel-2 cloud and shadow detection

Hi all!
I'm Roberta Fagandini and I'm working on my GSoC project, a GRASS GIS module 
for Sentinel-2 cloud and shadow detection.
This is my report for the first week of coding.
Since my progress has been a bit faster than expected I have already discussed 
with my mentors about further additions to the project. Therefore I have 
already updated my wiki page [0] changing the timeline. In this way, I will be 
able to release a more complete module.

1) What did I complete this week?

  *   Checked the prototype version of the algorithm for cloud and shadow 
detection
  *   Tested it
  *   I better studied the documentation of the GRASS Python Scripting Library 
and started coding the GRASS python script following the workflow schema 
prepared during the bonding period [1]
  *   Coded the 'data preparation' phase
  *   Coded the clouds detection procedure
  *   Added this first part of python script to my GitHub repository [2]
  *   Discussed with my mentors about further additions
  *   Discussed with the community about testing phase. I received some 
feedback and some developers stepped forward to help me in testing the algorithm
  *   Shared progress with the community
Unfortunately, I wasn't able to code on Thursday because of a PhD meeting with 
my supervisor.

2) What am I going to achieve for next week?

  *   Finish the translation of the algorithm in a basic python script adding 
the shadows detection procedure and the steps for checking and cleaning the 
final outputs (see [1] for details)
  *   Improve the python script so as to have a "light" working python script 
(manage temporary file, clean up the code, etc.)
  *   Test it and fix bugs
  *   Start implementing the GUI
3) Is there any blocking issue?
No at the moment.

Best wishes,
Roberta

[0] https://trac.osgeo.org/grass/wiki/GSoC/2018/CloudsAndShadowsDetection
[1] 
https://drive.google.com/file/d/1KYEKvNBurBFHw1xUTLjM0PW80Z-7br81/view?usp=sharing
[2] https://github.com/RobiFag/GRASS_clouds_and_shadows


_______________________________________________
grass-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to