[GRASS-dev] ​GSoC 2018 report week 01 - GRASS GIS module for Sentinel-2 cloud and shadow detection

Roberta Fagandini robifagandini at gmail.com
Fri May 25 04:27:19 PDT 2018


Ciao Stefan!

2018-05-25 11:19 GMT+02:00 Stefan Blumentrath <Stefan.Blumentrath at nina.no>:

> Ciao Roberta,
>
>
>
> Thanks, that was exactly what I had in mind!
>

I'm still cleaning the code managing temporary file and arranging it in
order to add the GUI next week! I hope the next version will be even better
(I'm going to upload it later in the afternoon).

Thank you for your suggestions, they are so useful for me!


>
>
> 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)
>
> I agree with you! The next month aim is to implement an automatic
procedure to run i.atcorr within mine, retrieving automatically all
necessary parameters for the control file. Therefore, I think making the
scaling factor an user-defined parameter can be the best choice, in this
way users can choose their own factor or to not use it in case the
atmospheric correction is performed with i.atcorr or within the cloud and
shadow detection procedure. At the moment I have changed the code defining
the scaling factor as a variable, this should help in managing the GUI for
this step.


>
>    - 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.
>

You're right! At the moment I manage the stats maps as temporary files but
actually, it is not necessary to create them..I have already change the
code.


>
>    - 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
>    <https://www.datacamp.com/community/tutorials/pep8-tutorial-python-code>
>
> Thank you for the hint! these will certainly help me..I'm a bit messy!


> Just for inspiration…
>
>
>
> Kind regards,
>
> Stefan
>

Kind regards,
Roberta


>
>
>
>
> *From:* Roberta Fagandini <robifagandini at gmail.com>
> *Sent:* onsdag 23. mai 2018 17.07
> *To:* GRASS developers list <grass-dev at lists.osgeo.org>
> *Cc:* Stefan Blumentrath <Stefan.Blumentrath at nina.no>; Roberto Marzocchi <
> roberto.marzocchi at gmail.com>; Moritz Lennert <mlennert at club.worldonline.be
> >; soc at lists.osgeo.org
> *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 <robifagandini at gmail.com>:
>
> Ciao Stefan!
>
>
>
> 2018-05-20 21:44 GMT+02:00 Stefan Blumentrath <Stefan.Blumentrath at nina.no
> >:
>
> 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 <grass-dev-bounces at lists.osgeo.org> on behalf of
> Roberta Fagandini <robifagandini at gmail.com>
> *Sent:* Sunday, May 20, 2018 4:33:57 PM
> *To:* soc at lists.osgeo.org; 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
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180525/211d0e97/attachment-0001.html>


More information about the grass-dev mailing list