<jupyter_start><jupyter_text>Measuring Waterbody Surace Area* **Products used:**[ga_ls8c_wofs_2](https://explorer.digitalearth.africa/ga_ls8c_wofs_2)  DescriptionIn this example, data from Water Observations from Space (WOfS) is used to identify waterbody area change over time. This example guides the user through the code to achieve: 1. Create a time series data cube over a waterbody2. Identify the wet and dry surface change over time3. Interpret the results  Load packages and apps This notebook works using two functions, referred to as apps:` load_waterbody_data` and `run_waterbody_app`. These functions allow the analysis code to be stored in another file, which enables the notebook to run with ease. To view the code directly, open the .[Water_Surface_Area.py](../Development/Water_Surface_Area.py) file.<jupyter_code>%matplotlib inline

import sys
import datacube

sys.path.append('../Scripts')
from Water_Surface_Area import load_waterbody_data 
from Water_Surface_Area import run_waterbody_app<jupyter_output>/env/lib/python3.8/site-packages/geopandas/_compat.py:106: UserWarning: The Shapely GEOS version (3.8.0-CAPI-1.13.1 ) is incompatible with the GEOS version PyGEOS was compiled with (3.9.1-CAPI-1.14.2). Conversions between both will be slow.
  warnings.warn(
/env/lib/python3.8/site-packages/datacube/storage/masking.py:7: DeprecationWarning: datacube.storage.masking has moved to datacube.utils.masking
  warnings.warn("datacube.storage.masking has moved to datacube.utils.masking",<jupyter_text>Analysis ParametersThe following cell imports parameters required for the analysis. Including four parameters that control where the data will be loaded:* `lat`: The central latitude to analyse (e.g. `11.6791`).* `lon`: The central longitude to analyse (e.g. `8.0063`).* `buffer`: The number of square degrees to load around the central latitude and longitude (e.g. `0.1`).* `start`: The start date of for the observation period (e.g. `2019-01-01`).* `end`: The ebd date of for the observation period (e.g. `2020-01-01`). Suggested areaHere is a suggested area to look at. To view this area, simply copy and paste into the cell below, then run the notebook. **Lake**```lat = 11.6791lon = 8.0063buffer = 0.1start = 2019-01-01end = 2020-01-01```<jupyter_code># Define the area of interest and the time period for analysis
lat = 11.6791
lon = 8.0063
buffer = 0.1
start = '2019-01-01'
end = '2020-01-01'<jupyter_output><empty_output><jupyter_text>Load the dataThe `(load_waterbody_data)` command performs several steps including:* identifies all available WOfS data in the study area within the set time period* identifies pixels with water prestent* identifies pixels without water present* returns the data for analysis The function takes five arguements: `lat`, `lon`, `buffer`, `start`, and `end`. These arguements determine the area which the function loads, and can be altered in the previous cell.<jupyter_code>data = load_waterbody_data(lat, lon, buffer, start, end)<jupyter_output><empty_output><jupyter_text>Run the waterbody appThe `run_waterbody_app()` function launches an interactive map. Drawing a polygon within the red boundary box (which illustrates the bounds of the area loaded) will result in the plots of both wet and dry change over time. Draw polygons by clicking the &11039; symbol in the app.This function works by taking the loaded data `data` as an arguement, as well as `lat`, `lon`, and `buffer`parameters used to define the spatial extent.<jupyter_code>run_waterbody_app(data, lat, lon, buffer)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08821058527023243, 'fraction_numerical': 0.03388406608793055, 'mean_word_length': 5.412926391382406, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '657497', 'license': 'Apache-2.0', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1041, 'n_words': 424, 'path': 'Real_world_examples/Waterbody_area.ipynb', 'repo_name': 'mseehaber/deafrica-sandbox-notebooks', 'size': '3571'}