Giter VIP home page Giter VIP logo

foss4g2022_grass4rs's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ I work as a researcher and lecturer at Gulich Institute - Argentinian Space Agency (CONAE) in Cรณrdoba, Argentina
  • ๐ŸŽ“ I am a biologist and I hold a PhD in Biological Sciences and an MSc in Remote Sensing and GIS applications
  • ๐Ÿ”ฌ My research is focused on uncovering environmental drivers of zoonotic and vector-borne disease outbreaks ๐ŸฆŸ ๐Ÿ“ก ๐ŸŒŽ
  • ๐Ÿ“Œ I'm interested in remote sensing time series, image analysis, GIS, machine learning, SDM, disease ecology, Free and Open Source Software
  • ๐Ÿค“ I am part of the GRASS GIS Development team, currently serving as PSC chair
  • ๐Ÿง‘โ€๐Ÿ’ป I was also the Program Committee chair for FOSS4G 2021, the OSGeo international conference
  • ๐Ÿง‘โ€๐Ÿซ I teach workshops and courses on remote sensing and GIS using GRASS GIS

foss4g2022_grass4rs's People

Contributors

marisn avatar neteler avatar veroandreo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

foss4g2022_grass4rs's Issues

General task list

  • Prepare S2 data for NC location, proposed computational region: same as landsat scenes
  • Decide on exercises/steps to show
  • Obtain new land use land cover data for NC (osm?)
  • Create a merge between neteler's and vero's notebooks

Remaining tasks

  • edit/adapt the maxlik classifcation section of diff scenes using signatures + band ref
  • check section naming and numbering
  • add section titles to README.md for a quick overview
  • upload (reduced) Sentinel-2 data somewhere
  • add section for importing the landuse map
  • run everything from scratch
  • complete instructions in the README file and send to workshop participants
    • software download
    • data download
    • Registration at Copernicus Open Access Hub, store username and password in two lines in a text file called esa_credentials.txt

Small improvements

Here is a list of things I suggest:

Section 4

For printing GRASS version I suggest:

import subprocess
print(subprocess.check_output([grassbin, "--config", "version"], text=True))

Section 5

For gisenv use:

gs.gisenv()

For g.list use:

gs.list_grouped(type="vector")

Creating new mapset - this is not completely solved API. Note that grass.grassdb package was developed for internal use only, it's not linked in the Python documentation, although it is there when you search for it. So it will likely change. You can create mapset and switch with (NOT recommended, unstable API and when you rerun the cell it will fail):

import grass.grassdb.create as gdb
gdb.create_mapset(grassdata, location, "sentinel2")
session.switch_mapset("sentinel2")

Alternatives: Call grass with bash

!grassbin -c -e ....
session.switch_mapset(...)

Or use an existing mapset user1:

session.switch_mapset("user1")

This is something we should address better for the next version.

Section 7

Avoid manual parsing:

import pandas as pd
from io import StringIO

pd.read_csv(StringIO(list_prod), delimiter=" ", usecols=[0, 1, 2, 4, 5, 6, 7],
            names=['uuid', 'scene', 'date', 'cloud', 'product', 'size', 'unit'])

Printing file content - use context manager (with open("") as f:) or just use !cat ...

Section 10

For getting center of region use:

gs.region(complete=True)

Section 13

Instead of:

# Set color table
colours = ["11 195:20:0", "13 255,255,168", "14 100:240:100", "31 77:105:0", "51 0:204:242"]
colourise = gs.feed_command("r.colors", map="sentinel_rf", rules="-", quiet=True)
colourise.stdin.write("\n".join(colours).encode())
colourise.stdin.close()

Use:

gs.write_command("r.colors", map=..., rules="-", stdin="\n".join(colours))

Instead of parse_command with r.report, use print(read_command(...)), there may be more places like that.

Proposed list of exercises

  1. GRASS GIS basics (database, region, modules, show the GUI a bit)
  2. GRASS GIS & Python
  3. Why Jupyter Notebooks and how to use them?
  4. Paths and variables
  5. Download NC location and other data
  6. Initialization of GRASS GIS in the Jupyter notebook session
  7. Create a new mapset within NC
  8. Setting the computational region
  9. Importing geodata into GRASS GIS
  10. Sentinel-2 processing overview
  11. Search and download S2
  12. Import S2 data and show different visualizations
  13. Cloud masking - Skipped for now, no time
  14. Computing NDVI and NDWI for one scene only
  15. Create a time series of NDVI using semantic label syntax and show some other python utilities like plots
  16. Creating an image stack (imagery group)
  17. Image segmentation
  18. Supervised Classification: RandomForest
  19. Supervised Classification: Maximum Likelihood (show classification of different scenes based on signatures with semantic labels)

Remove explicit session.finish call

The explicit call of session.finish is not needed, remove it. Leaving it there means that after executing that cell, you can't get back to any other cell. Generally, you may want that behavior or you may want to align that with the standard non-Jupyter init use (grass.script[.setup].init), but for workshop focused on remote sensing, I recommend greater flexibility.

grass.jupyter.setup.init doc says:

The session is ended when session.finish is called or when the object is destroyed when kernel ends or restarts. This function returns a copy of an internally kept reference, so the return value can be safely ignored when not needed.

The jupyter_tutorial.ipynb notebook says:

When the kernel for the notebooks shuts down or is restarted, the session ends automatically. The session can be explicitly ended using session.finish(), but that's usually not needed in notebooks.

In other words, explicit use of session.finish() is neither required nor considered a best practice according to the documentation. Feel free to extend it as needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.