<jupyter_start><jupyter_text>[![colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/davemlz/eemont/blob/master/docs/tutorials/018-Complete-Preprocessing-One-Method.ipynb)  Complete Preprocessing (Clouds Masking, Shadows Masking, Scaling and Offsetting) With Just One Method _Tutorial created by **<NAME>**_: [GitHub](https://github.com/davemlz) | [Twitter](https://twitter.com/dmlmont)- GitHub Repo: [https://github.com/davemlz/eemont](https://github.com/davemlz/eemont)- PyPI link: [https://pypi.org/project/eemont/](https://pypi.org/project/eemont/)- Conda-forge: [https://anaconda.org/conda-forge/eemont](https://anaconda.org/conda-forge/eemont)- Documentation: [https://eemont.readthedocs.io/](https://eemont.readthedocs.io/)- More tutorials: [https://github.com/davemlz/eemont/tree/master/docs/tutorials](https://github.com/davemlz/eemont/tree/master/docs/tutorials)  Let's start! If required, please uncomment:<jupyter_code>#!pip install eemont
#!pip install geemap<jupyter_output><empty_output><jupyter_text>Import the required packges.<jupyter_code>import ee, eemont, geemap
import geemap.colormaps as cm<jupyter_output><empty_output><jupyter_text>Authenticate and Initialize Earth Engine and geemap.<jupyter_code>Map = geemap.Map()<jupyter_output><empty_output><jupyter_text>Let's define a point of interest:<jupyter_code>poi = ee.Geometry.BBoxFromQuery("Puerto Rico",user_agent = "eemont-tutorial-017")<jupyter_output><empty_output><jupyter_text>Let's take the L8 product as example:<jupyter_code>L8 = (ee.ImageCollection("LANDSAT/LC08/C01/T1_SR")
      .filterBounds(poi)          
      .filterDate("2020-01-01","2021-01-01"))<jupyter_output><empty_output><jupyter_text>Complete Preprocessing Do you want to do almost everything with just one method? Here is it: `preprocess`.<jupyter_code>L8pre = L8.preprocess()<jupyter_output><empty_output><jupyter_text>The `preprocess` method automatically masks clouds and shadows and scales and offsets the image or image collection.NOTE: You can apply the `preprocess` method to any ee.Image or ee.ImageCollection from the GEE STAC. If you want to change some argument for cloud masking, just use the same aguments that are used for the `maskClouds` method. If not, the default parameters of `maskClouds` are used in `preprocess`:<jupyter_code>L8pre = L8.preprocess(maskShadows = False)<jupyter_output><empty_output><jupyter_text>After preprocessing, you can process your ee.Image or ee.ImageCollection as you want!<jupyter_code>L8full = L8pre.spectralIndices(["SAVI","GNDVI"],L = 0.5).median()<jupyter_output><empty_output><jupyter_text>Visualization parameters:<jupyter_code>vis = {
    "min": 0,
    "max": 1,
    "palette": cm.palettes.ndvi
}<jupyter_output><empty_output><jupyter_text>Visualize everything with `geemap`:<jupyter_code>Map.addLayer(L8full.select("SAVI"),vis,"SAVI")
Map.addLayer(L8full.select("GNDVI"),vis,"GNDVI")
Map.centerObject(poi.centroid(1),8)
Map<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1387782204515272, 'fraction_numerical': 0.014276228419654714, 'mean_word_length': 6.970899470899471, 'pattern_counts': {'":': 3, '<': 42, '<?xml version=': 0, '>': 42, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '28965', 'license': 'MIT', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1083, 'n_words': 188, 'path': 'docs/tutorials/018-Complete-Preprocessing-One-Method.ipynb', 'repo_name': 'davemlz/eemont', 'size': '3026'}