Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Estimation of river turbidity using sentinel-2 satellite data #742

Merged
merged 9 commits into from Dec 8, 2020

Conversation

shivanip32
Copy link
Contributor

@shivanip32 shivanip32 commented Jul 20, 2020

This notebook shows how river turbidity can be estimated using satellite data without any field measurement.


Checklist

Please go through each entry in the below checklist and mark an 'X' if that condition has been met. Every entry should be marked with an 'X' to be get the Pull Request approved.

  • All imports are in the first cell? First block of imports are standard libraries, second block are 3rd party libraries, third block are all arcgis imports? Note that in some cases, for samples, it is a good idea to keep the imports next to where they are used, particularly for uncommonly used features that we want to highlight.
  • All GIS object instantiations are one of the following?
    • gis = GIS()
    • gis = GIS('https://www.arcgis.com', 'arcgis_python', 'P@ssword123')
    • gis = GIS(profile="your_online_profile")
    • gis = GIS('https://pythonapi.playground.esri.com/portal', 'arcgis_python', 'amazing_arcgis_123')
    • gis = GIS(profile="your_enterprise_portal")
  • If this notebook requires setup or teardown, did you add the appropriate code to ./misc/setup.py and/or ./misc/teardown.py?
  • If this notebook references any portal items that need to be staged on AGOL/Python API playground, did you coordinate with a Python API team member to stage the item the correct way with the api_data_owner user?
  • Code refactored & split out across multiple cells, useful comments?
  • Consistent voice/tense/narrative style? Thoroughly checked for typos?
  • All images used like <img src="base64str_here"> instead of <img src="https://some.url">? All map widgets contain a static image preview? (Call mapview_inst.take_screenshot() to do so)
  • All file paths are constructed in an OS-agnostic fashion with os.path.join()? (Instead of r"\foo\bar", os.path.join(os.path.sep, "foo", "bar"), etc.)
  • IF YOU WANT THIS SAMPLE TO BE DISPLAYED ON THE DEVELOPERS.ARCGIS.COM WEBSITE, ping @ DavidJVitale so he can add it to the list for the next deploy

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

Review Jupyter notebook visual diffs & provide feedback on notebooks.


Powered by ReviewNB

@shivanip32 shivanip32 self-assigned this Jul 20, 2020
@shivanip32
Copy link
Contributor Author

ArcGIS/geosaurus/issues/4245

@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:32Z
----------------------------------------------------------------

Create geometry of AOI
Generate water body mask
Create water body mask

@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:33Z
----------------------------------------------------------------

Turbidity represents the level of suspended sediments in water also indicating water clarity or how clear is the water. It is mainly caused by the presence of silt, algae in a water body, or industrial waste disposed in the rivers by mining activity, factory operation, logging, etc.

Traditionally, turbidity is analyzed by evaluating water samples taken during field measurements. However, field studies are expensive, time and labor intensive, besides, during lockdown field surveys cannot be undertaken. Thus, a good alternative to field survey measurements is satellite remote sensing data, which can as well capture both spatial and temporal variations in river turbidity levels. Accordingly, Sentinel-2 multispectral data is used in the current study to evaluate the changes in river turbidity during COVID-19 lockdown, near the holy city of Allahabad, India.

The case study area of Allahabad is in the northern part of India, at the confluence of Ganga and Yamuna river, which is considered as one of the important cities in Hindu religion. Everyday thousands of Hindu devotees visit the city and disposes waste directly in the rivers. The small-scale factories situated in the city also disposes its waste into the rivers adding to the water pollution. On 25th March 2020, lockdown was announced in India for controlling the COVID-19 spread which meant total shutdown of industries and restricted human movement. The lockdown resulted in reduction of turbidity hence improved water quality in rivers throughout the country. This notebook will elaborate the steps to measure this change in turbidity using arcgis api for python tools.


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:34Z
----------------------------------------------------------------

Necessary


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:34Z
----------------------------------------------------------------

1. check if this line is needed

from arcgis import *

2. the arcgis imports can be grouped together like this,

import pandas as pd
from datetime import datetime
from ipywidgets import HBox, VBox, Label, Layout

import arcgis
from arcgis import *
from arcgis.features import GeoAccessor, GeoSeriesAccessor
from arcgis.raster.analytics import convert_feature_to_raster, convert_raster_to_feature
from arcgis.raster.functions import extract_band, greater_than, clip, remap, colormap, stretch
from arcgis.features.analysis import dissolve_boundaries



@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:35Z
----------------------------------------------------------------

Sentinel-2 Views was used in the analysis: - this multispectral and multitemporal imagery consists of 13 bands with 10, 20, and 60m spatial resolution, which is rendered on-the-fly and available for visualization and analytics. This imagery layer pulls directly from the Sentinel-2 on AWS collection and is updated daily with new imagery. 


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:36Z
----------------------------------------------------------------

add some description what is being done in this step of searching allahabad aoi, also why it is needed

@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:37Z
----------------------------------------------------------------

describe the methodology briefly in words as elaborated in the graphics

shivanip32 commented on 2020-11-19T03:35:27Z
----------------------------------------------------------------

Section below this diagram is explaining the whole workflow

shivanip32 commented on 2020-11-19T03:36:28Z
----------------------------------------------------------------

Section below this diagram is explaining the whole workflow

@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:38Z
----------------------------------------------------------------

Sentinel-2 Views imagery layers consists data for the whole world and span different time periods. Thus the first step is to filter out the data of the river in the Allahabad region prior to lockdwon and during the period of lockdown.


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:39Z
----------------------------------------------------------------

Create geometry of area of interest (AOI)


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:40Z
----------------------------------------------------------------

The geometry of AOI was created for filtering out the Sentinel-2 tiles for the study area.


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:41Z
----------------------------------------------------------------

briefly refer where are you getting the fid=1


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:42Z
----------------------------------------------------------------

describe briefly what is being done here


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:43Z
----------------------------------------------------------------

briefly refer how you are getting category=1


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:43Z
----------------------------------------------------------------

briefly refer where you are getting the object id for filtering


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:45Z
----------------------------------------------------------------

provide a brief what will be done here along with the filter_by parameters source reference


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:45Z
----------------------------------------------------------------

Generate water body mask


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:46Z
----------------------------------------------------------------

Create normalized difference water index (NDWI) raster



@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:47Z
----------------------------------------------------------------

Normalized difference water index (NDWI) is a satellite based index used for mapping and detecting the surface water bodies. Water absorbs electromagnetic radiation in visible to infrared spectrum, that is why Green and Near Infrared bands are used to detect the water bodies. In the current study, band 3 (green) and band 8 (NIR) of Sentinel-2 is used for generating NDWI raster. Accordingly the bands are first extracted followed by creation of the NDWI raster as follows:

move the Extract bands section within this section of -Generate water bodies mask- after this paragraph so that it becomes clear why these particular bands are extracted, and change the content accordingly

shivanip32 commented on 2020-10-15T11:18:15Z
----------------------------------------------------------------

These band will also be used for NDTI calculation.

@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:48Z
----------------------------------------------------------------

Binary raster is created from NDWI raster using a threshold value. The binary raster consists of two classes of water and non-water pixels where pixels with value greater than 0.03 are considered as water. Accordingly this threshold value of 0.03 is used for creating the binary raster using the greater_than function.


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:49Z
----------------------------------------------------------------

Create water body mask

add text explaining this step

@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:50Z
----------------------------------------------------------------

The binary rasters are converted to feature layer for extracting the boundaries of the water bodies.


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:50Z
----------------------------------------------------------------

In the feature layer returned above, 'gridcode=0' represents non water class and 'gridcode=1' represents water class. Thus the water polygons with 'gridcode=1 are selected using the query function from the dataframe of the feature layer and saved into a new feature layer created using gis.content.import function consisting of these water polygons.


@review-notebook-app
Copy link

review-notebook-app bot commented Sep 3, 2020

View / edit / reply to this conversation on ReviewNB

moonlanderr commented on 2020-09-03T07:04:51Z
----------------------------------------------------------------

explain the parameter t


Copy link
Contributor Author

Section below this diagram is explaining the whole workflow


View entire conversation on ReviewNB

1 similar comment
Copy link
Contributor Author

Section below this diagram is explaining the whole workflow


View entire conversation on ReviewNB

@shivanip32
Copy link
Contributor Author

@mohi9282 & @moonlanderr thank you for reviewing the sample. I have updated the notebook with suggested changes.

cc. @AtmaMani & @priyankatuteja

@AtmaMani
Copy link
Contributor

@mohi9282 could you verify the revision and approve the PR?

Copy link
Contributor

Date formats: March 9th, 2020 and April 13th, 2020


View entire conversation on ReviewNB

@review-notebook-app
Copy link

review-notebook-app bot commented Nov 20, 2020

View / edit / reply to this conversation on ReviewNB

mohi9282 commented on 2020-11-20T19:47:15Z
----------------------------------------------------------------

"Ganga and Yamuna river falls under the world's most polluted river due to dumping of waste from industrial and religious activities indicated by its highly turbid water. " can be reworded to:

Ganga and Yamuna rivers are among the world's most polluted due to dumping of waste from industrial and religious activities as indicated by their highly turbid water.

"During the period of lock down there was a significant improvement in the pollution level of both the rivers due to complete shutdown of the above-mentioned functions." can be reworded to:

During the lockdown period, pollution levels fell dramatically in both rivers due to complete shutdown of the above-mentioned functions.


@mohi9282
Copy link
Contributor

@shivanip32 - thanks for the updates. Requesting minor changes to date format at 1 place and some conclusion verbiage.

@AtmaMani AtmaMani added this to the 1.8.3 release milestone Nov 25, 2020
@shivanip32
Copy link
Contributor Author

@mohi9282, thank you for reviewing my notebook, I have updated the changes.

cc. @AtmaMani & @priyankatuteja

Copy link
Contributor

@mohi9282 mohi9282 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:13Z
----------------------------------------------------------------

River Turbidity Estimation using Sentinel-2

Can we keep the sample title generalized?


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:14Z
----------------------------------------------------------------

gis3 = GIS("your_enterprise_portal")

I suggest naming gis2 and gis3 as agol_gis, ent_gis or gis. Also replace "your_online_profile" with "home" and pas credentials for enterprise portal explicitly.


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:14Z
----------------------------------------------------------------

Sentinel-2 Views was is used in the analysis,


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:15Z
----------------------------------------------------------------

The item id is specific to demos deldev portal. We need to provide a public item.


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:16Z
----------------------------------------------------------------

This item needs to be published using api_data_owner account.


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:16Z
----------------------------------------------------------------

the estimation of the river turbidity.

remove extra space


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:17Z
----------------------------------------------------------------

was --> is


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 1, 2020

View / edit / reply to this conversation on ReviewNB

priyankatuteja commented on 2020-12-01T10:24:18Z
----------------------------------------------------------------

this output item has also been saved to a private portal. Can we run it against public portal.


Copy link
Collaborator

@priyankatuteja priyankatuteja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivanip32 I have suggested minor changes, in addition to those if you can rename file from river_turbidity_estimation_using_sentinel2_data_for_allahabad to river_turbidity_estimation_using_sentinel2. Thanks!

@priyankatuteja
Copy link
Collaborator

@shivanip32
As discussed, the image needs to be replaced too.

@shivanip32
Copy link
Contributor Author

@priyankatuteja, I have updated the image in sample.

@AtmaMani
Copy link
Contributor

AtmaMani commented Dec 8, 2020

@shivanip32 thanks for the sample. @moonlanderr @mohi9282 @priyankatuteja thank you for the detailed reviews

@AtmaMani AtmaMani merged commit 31212f3 into Esri:master Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants