<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kilian Vos on Medium]]></title>
        <description><![CDATA[Stories by Kilian Vos on Medium]]></description>
        <link>https://medium.com/@voskilian?source=rss-70aaf6d57b92------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yqlkzr3t9bjjqOKr8A1qCg.jpeg</url>
            <title>Stories by Kilian Vos on Medium</title>
            <link>https://medium.com/@voskilian?source=rss-70aaf6d57b92------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 19:53:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@voskilian/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mapping coastal change from space (Part 3): open data in a webGIS portal]]></title>
            <link>https://medium.com/@voskilian/mapping-coastal-change-from-space-part-3-open-data-in-a-webgis-portal-88596b1846db?source=rss-70aaf6d57b92------2</link>
            <guid isPermaLink="false">https://medium.com/p/88596b1846db</guid>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[coastal]]></category>
            <category><![CDATA[landsat]]></category>
            <category><![CDATA[earth-observation]]></category>
            <dc:creator><![CDATA[Kilian Vos]]></dc:creator>
            <pubDate>Wed, 18 Dec 2024 22:12:19 GMT</pubDate>
            <atom:updated>2024-12-21T11:30:36.215Z</atom:updated>
            <content:encoded><![CDATA[<p>As <a href="https://github.com/kvos/CoastSat">CoastSat</a> has been used over a few years to map shoreline changes along the world’s coastlines, I have put together a database with all these shoreline-change time-series. This dataset is now available in an interactive webGIS portal at <a href="http://coastsat.space/">coastsat.space</a> for the following regions: Australia, Japan, Hawai’i, California, Mexico, Peru, Chile, New Zealand, US East coast.</p><p>The time-series have been processed using Landsat missions from 1984–2024 (Landsat 5, 7, 8 and 9) and the <a href="https://www.aviso.altimetry.fr/en/data/products/auxiliary-products/global-tide-fes/release-fes22.html">FES2022 </a>model for tidal correction and beach slope estimation along each transect (as shown in the previous tutorials <a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-1-53a7de363cd9">Part 1</a> and <a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-2-tidal-correction-02978dda4189">Part 2</a>). You can use the portal to browse the dataset, display time-series at specific locations and download CSV files for further analysis (also programmatically, see Downloads tab).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zbAwchudirjzQeJt0cOIw.png" /><figcaption><a href="http://coastsat.space/">http://coastsat.space</a> data portal with shoreline change time-series.</figcaption></figure><p>A few examples of interesting sites in the portal.</p><h3>Gold Coast, Australia</h3><p>This beach is home to the world’s largest <a href="https://gcwa.qld.gov.au/portfolio-item/sand-bypass-system/">sand bypassing system</a> which continuously pumps sand from the southern beaches to the northern side of the river entrance. The impact of the bypassing system on the sandy beaches is clearly seen in the shoreline time-series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wfW3zSyeM77XbVmSMfj0w.png" /><figcaption>Gold Coast, Australia</figcaption></figure><h3>Rodanthe Island, North Carolina (USA)</h3><p>Here the coast has been retreating steadily over the last 40 years and <a href="https://www.washingtonpost.com/climate-environment/interactive/2023/obx-rodanthe-erosion-rising-sea-levels/">houses are falling into the sea one after the other</a>. This chronic erosion is evident in the shoreline time-series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0aqK9WP83QHKjHvk1W7C4Q.png" /><figcaption>Rodanthe Island, North Carolina, USA</figcaption></figure><h3>2010 Earthquake in Central Chile</h3><p>As a result of the earthquake, the coast south of Conception experienced a substantial uplift which subsequently caused the beach to widen of more than 100 m.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DKix7VLvllHBnJpdvoxDlw.png" /><figcaption>Ranquil Bajo, south of Conception, Central Chile</figcaption></figure><h3>Summary</h3><p>This web portal can be used to explore coastal changes around the Pacific Basin and US East coast. Portions of the data shown here was funded by the <a href="https://www.unsw.edu.au/research/wrl">Water Research Laboratory</a> and the <a href="https://www.usgs.gov/programs/cmhrp">United States Geological Survey</a> and used in a number of studies looking at <a href="https://www.nature.com/articles/s41561-022-01117-8">climate variability</a>, <a href="https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2022JF006936">coastal hazard assessments</a> and <a href="https://www.nature.com/articles/s41558-024-02180-2">future coastal adaptation</a>.</p><p>The accuracy of the shoreline time-series is ~10 m in microtidal environments and increases to 15–20 m in mesodital environments (<a href="http://python manage.py runscript fill_db.py -v2">see validation study</a>).</p><h3>Relevant links:</h3><p><a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-1-53a7de363cd9">Mapping coastal change from space (Part 1)</a><br><a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-2-tidal-correction-02978dda4189">Mapping coastal change from space (Part 2): Tidal Correction</a></p><h3>Important links:</h3><p>Data portal: <a href="http://coastsat.space/">coastsat.space</a><br><a href="https://github.com/kvos/CoastSat">CoastSat Github Repository</a><br><a href="https://doi.org/10.1016/j.envsoft.2019.104528">CoastSat paper</a><br><a href="https://www.nature.com/articles/s43247-023-01001-2">Validation of the methodology</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88596b1846db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mapping coastal change from space (Part 2): Tidal correction]]></title>
            <link>https://medium.com/@voskilian/mapping-coastal-change-from-space-part-2-tidal-correction-02978dda4189?source=rss-70aaf6d57b92------2</link>
            <guid isPermaLink="false">https://medium.com/p/02978dda4189</guid>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[google-earth-engine]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[earth-observation]]></category>
            <category><![CDATA[tides]]></category>
            <dc:creator><![CDATA[Kilian Vos]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 21:50:29 GMT</pubDate>
            <atom:updated>2024-11-12T21:58:36.432Z</atom:updated>
            <content:encoded><![CDATA[<p>While <a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-1-53a7de363cd9">Part 1</a> of this tutorial demonstrated how to map shorelines from publicly available satellite imagery, this part will show how to apply a tidal correction to the satellite-derived shorelines.</p><blockquote>As each satellite image is captured at a different stage of the tide, it is crucial to account for those changes in the tides to enable inter-comparison between dates in coastal environments.</blockquote><p>This is illustrated in the timelapse below, which shows shorelines mapped in Cable Beach, Western Australia, where the tidal range is ~8 m. Although the waterline is seen to oscilalte by hundreds of metres, this is not real erosion or accretion, but it is only due to the fluctuations in the tide levels between the images acquired at low tide and at high tide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*8uYQe7MnmSP4XY70bybIpQ.gif" /><figcaption>Timelapse of satellite-derived shorelines at Cable Beach, Wester Australia (tide range of 8 m).</figcaption></figure><p>We will now see how we can use a global tide model to apply a tidal correction to the satellite-derived shorelines that we derived in <a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-1-53a7de363cd9">Part 1</a>.</p><h3>Global tide model</h3><p>A global tide model is a piece of software that enables you to predict tide levels for any location in the world at any given instant. According to a recent assessment of global tide models (in this <a href="https://doi.org/10.1002/2014RG000450">paper</a>), the FES2014 model was found to be one of the most accurate along coastal regions. Here we will use <a href="https://www.aviso.altimetry.fr/en/data/products/auxiliary-products/global-tide-fes/release-fes22.html">FES2022</a>, which is an enhancement of FES2014 and the latest version developed by CNES. This model comes with a nice prediction library available on Github at <a href="https://github.com/CNES/aviso-fes/">https://github.com/CNES/aviso-fes/</a>. To install and run the tidal model on your machine, I have written a separate <a href="https://github.com/kvos/CoastSat/blob/master/doc/FES2022_setup.md">step-by-step instructions document</a> that you can follow.</p><p>As we can see from the plot below, the tidal range varies along the world’s coastlines, from close to 0 in some areas (Mediterranean sea) to almost 15 m in places like Western Australia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uzUac0p1yqISVhXBoFJ0Hg.jpeg" /><figcaption>Tidal range across the globe from FES2022.</figcaption></figure><h3>Tidal prediction</h3><p>Now we can take the time-series of shoreline change that we generated in <a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-1-53a7de363cd9">Part 1</a> for Narrabeen beach (Sydney, Australia) and use FES2022 to extract the tide levels at the times of image acquisition.</p><p>First, we import the tidal model using the pyfes library (can take a couple minutes).</p><pre># load pyfes and the global tide model (may take one minute)<br>import pyfes<br>filepath_FES = os.path.join(os.pardir,&#39;CoastSat.webgis&#39;,&#39;aviso-fes-main&#39;,&#39;data&#39;,&#39;fes2022b&#39;)<br>config =  os.path.join(filepath_FES, &#39;fes2022.yaml&#39;)<br>handlers = pyfes.load_config(config)<br>ocean_tide = handlers[&#39;tide&#39;]<br>load_tide = handlers[&#39;radial&#39;] <br># import coastsat.slope module<br>from coastsat import SDS_slope</pre><p>We can now predict tide levels for any given location and date. Below we compute the tides at Narrabeen at the time of acquisition of each image.</p><pre># coordinates in lat and lon (longitude has to be between 0 and 360)<br>centroid = [151.3023, -33.7239]<br># if longitude is negative add 180 (longitudes are from 0 to 360 in fes)<br>if centroid[0] &lt; 0: centroid[0] += 180<br><br># the dates we take from our output dictionary<br>dates_sat = output[&#39;dates&#39;]<br><br># predict the tide levels at time of image acquisition<br>tides_sat = SDS_slope.compute_tide_dates(centroid, dates_sat, ocean_tide, load_tide)</pre><p>Finally, we can plot the tide levels at the time of image acquisition and compare it with full tide time-series at that location.</p><pre># define date range based on inputs<br>date_range = [pytz.utc.localize(datetime.strptime(inputs[&#39;dates&#39;][0],&#39;%Y-%m-%d&#39;)),<br>              pytz.utc.localize(datetime.strptime(inputs[&#39;dates&#39;][1],&#39;%Y-%m-%d&#39;))]<br># get tide time-series every 15 minutes at the same location<br>timestep = 900 # seconds<br>dates_ts, tides_ts = SDS_slope.compute_tide(centroid, date_range, timestep, ocean_tide, load_tide)<br><br># plot tide time-series<br>fig, ax = plt.subplots(1,1,figsize=(15,4), tight_layout=True)<br>ax.grid(which=&#39;major&#39;, linestyle=&#39;:&#39;, color=&#39;0.5&#39;)<br>ax.plot(dates_ts, tides_ts, &#39;-&#39;, color=&#39;0.6&#39;, label=&#39;all time-series&#39;)<br>ax.plot(dates_sat, tides_sat, &#39;-o&#39;, color=&#39;k&#39;, ms=6, mfc=&#39;w&#39;,lw=1, label=&#39;image acquisition&#39;)<br>ax.set(ylabel=&#39;tide level [m]&#39;,xlim=[dates_sat[0],dates_sat[-1]], title=&#39;Tide levels at the time of image acquisition&#39;);<br>ax.legend()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aOXqhrD0GzZMQ-SZqOfvNg.jpeg" /><figcaption>Tide levels at the time of image acquisition.</figcaption></figure><p>We can clearly see that how the images are captured over different stages of the tidal cycle.</p><h3>Tidal Correction</h3><p>Now that we have the tide levels at the time of image acquisition, we can apply a tidal correction along each transect. To convert the vertical change in water level into a horizontal shift of the shoreline position, we need an estimate of the beach slope (slope along which the tide moves). In this case for Narrabeen beach we use a slope of 0.1 (1 m vertical for 100 m horizontal).</p><pre># apply tidal correction along each transect<br>beach_slope = 0.1<br>cross_distance_tidally_corrected = {}<br>for key in cross_distance.keys():<br>    correction = tides_sat/beach_slope<br>    cross_distance_tidally_corrected[key] = cross_distance[key] + correction<br><br># plot the time-series of shoreline change (both raw and tidally-corrected)<br>fig = plt.figure(figsize=[15,8], tight_layout=True)<br>gs = gridspec.GridSpec(len(cross_distance),1)<br>gs.update(left=0.05, right=0.95, bottom=0.05, top=0.95, hspace=0.05)<br>for i,key in enumerate(cross_distance.keys()):<br>    idx_nan = np.isnan(cross_distance[key])<br>    dates = [output[&#39;dates&#39;][_] for _ in np.where(~idx_nan)[0]]<br>    chainage = cross_distance[key][~idx_nan]<br>    chainage_corrected = cross_distance_tidally_corrected[key][~idx_nan]<br>    ax = fig.add_subplot(gs[i,0])<br>    ax.grid(linestyle=&#39;:&#39;, color=&#39;0.5&#39;)<br>    ax.plot(dates, chainage, &#39;-o&#39;, ms=6, mfc=&#39;w&#39;, label=&#39;raw&#39;)<br>    ax.plot(dates, chainage_corrected, &#39;-o&#39;, ms=6, mfc=&#39;w&#39;, label=&#39;tidally-corrected&#39;)<br>    ax.set_ylabel(&#39;distance [m]&#39;, fontsize=12)<br>    ax.text(0.5,0.95, key, bbox=dict(boxstyle=&quot;square&quot;, ec=&#39;k&#39;,fc=&#39;w&#39;), ha=&#39;center&#39;,<br>            va=&#39;top&#39;, transform=ax.transAxes, fontsize=14)<br>    if i == 0:<br>        ax.legend()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZMJblAlnHVnvesp8ftALMQ.jpeg" /><figcaption>Tidally-corrected time-series of shoreline change along the transects.</figcaption></figure><p>That’s it we have tidally-corrected our shoreline change time-series!</p><p>But what if I don’t know the slope for my beach? <br>We will see in the next part how we can estimate this slope from long-term shoreline time-series.</p><p>🌎 To explore tidally-corrected time-series of shoreline change along many of the world’s coastlines visit the <a href="http://coastsat.space/">coastsat.space</a> website.</p><h4>Relevant links:</h4><p><a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-1-53a7de363cd9">Mapping coastal change from space (Part 1)</a></p><h4>Important links:</h4><p><a href="https://github.com/kvos/CoastSat">Github Repository<br></a><a href="https://github.com/kvos/CoastSat/blob/master/example_jupyter.ipynb">Jupyter Notebook tutorial</a><br>Data portal: <a href="http://coastsat.space/">coastsat.space</a><br>Journal publication: <a href="https://doi.org/10.1016/j.envsoft.2019.104528">CoastSat toolbox</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02978dda4189" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mapping coastal change from space (Part 1)]]></title>
            <link>https://medium.com/@voskilian/mapping-coastal-change-from-space-part-1-53a7de363cd9?source=rss-70aaf6d57b92------2</link>
            <guid isPermaLink="false">https://medium.com/p/53a7de363cd9</guid>
            <category><![CDATA[coastal]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[google-earth-engine]]></category>
            <category><![CDATA[image-processing]]></category>
            <dc:creator><![CDATA[Kilian Vos]]></dc:creator>
            <pubDate>Wed, 06 Nov 2024 15:46:21 GMT</pubDate>
            <atom:updated>2024-11-12T21:57:22.612Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>While beaches may seem static to the holidaymaker, they are one of the most dynamic regions on Earth. Sand is transported by winds, waves and tides, constantly reshaping the beach.</blockquote><p>In this tutorial, we will cover how to use publicly available satellite imagery to monitor changes in beach width along the world’s coastlines using the <a href="https://github.com/kvos/CoastSat">CoastSat</a> Python toolbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*84mVRMGcVU3-whHLEnPRSw.gif" /><figcaption>Monitoring coastal change from publicly available imagery with CoastSat.</figcaption></figure><p>Where no field measurements are available, satellite remote sensing can provide low-cost long-term shoreline data capable of detecting beach changes and often resolving the temporal scales of interest to coastal scientists and engineers. In this context, <a href="https://github.com/kvos/CoastSat">CoastSat </a>enables the non-expert user to extract shorelines from Landsat 5, Landsat 7, Landsat 8, Landsat 9 and Sentinel-2 images. In this tutorial we will cover the following functionalities:</p><ol><li>retrieval of satellite imagery spanning the user-defined region of interest and time period from <a href="https://earthengine.google.com/">Google Earth Engine</a>, including state-of-the-art pre-processing steps (re-projecting the different bands, pansharpening, advanced cloud masking, s2cloudless).</li><li>automated extraction of shorelines from all the images using machine learning classication and a sub-pixel resolution technique.</li></ol><h3>Installing CoastSat</h3><p>The CoastSat toolkit is available on Github at <a href="https://github.com/kvos/CoastSat">https://github.com/kvos/CoastSat</a>. Clone/download the repository. To install the dependencies in a virtual environment, you can use either Anaconda or <a href="https://github.com/conda-forge/miniforge">Mamba</a> (Mamba is much faster). Run the following commands to create the coastsat environment:</p><pre>mamba create -n coastsat<br>mamba activate coastsat<br>mamba install geopandas -y<br>mamba install earthengine-api scikit-image matplotlib astropy notebook -y<br>pip install pyqt5 imageio-ffmpeg</pre><p>For activating the Google Earth Engine API, download thegcloud command line interface from <a href="https://cloud.google.com/sdk/docs/install">https://cloud.google.com/sdk/docs/install</a> and run this command: gcloud auth application-default login . This creates a default application credentials on your machine.</p><h3>Satellite image retrieval</h3><p>CoastSat provides easy retrieval of satellite imagery spanning the user-defined region of interest and time period, including state-of-the-art pre-processing steps like advanced s2cloudless cloud masking, re-projecting the bands that come at different resolution, pansharpening etc.</p><p>To define the region of interest, go to <a href="https://geojson.io/">geojson.io</a> and draw a polyon around your beach and download as GeoJSON. Here we will use Narrabeen-Collaroy (Sydney), Australia, as an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F3U7p7Sk5M3p71YUgu7Pgg.png" /><figcaption>Region of interest polygon can be defined at geojson.io.</figcaption></figure><p>We can start by loading the python libraries and definining the region and time of interest as well as the satellite missions that we want to leverage (Landsat satellites and/or Sentinel-2).</p><pre>import os<br>import numpy as np<br>import pickle<br>import matplotlib<br>import matplotlib.pyplot as plt<br>from datetime import datetime<br>import pytz<br>from coastsat import SDS_download, SDS_preprocess, SDS_shoreline, SDS_tools<br>matplotlib.use(&#39;Qt5Agg&#39;)<br>plt.ion()</pre><pre># load ROI<br>geojson_polygon = os.path.join(os.getcwd(), &#39;examples&#39;, &#39;NARRA_polygon.geojson&#39;)<br>polygon = SDS_tools.polygon_from_geojson(geojson_polygon)<br># date range<br>dates = [&#39;2024-01-01&#39;, &#39;2024-12-01&#39;]<br># satellite missions [&#39;L5&#39;,&#39;L7&#39;,&#39;L8&#39;,&#39;L9&#39;,&#39;S2&#39;]<br>sat_list = [&#39;L8&#39;,&#39;L9&#39;,&#39;S2&#39;]<br># name of the site<br>sitename = &#39;NARRA&#39;<br># directory where the data will be stored<br>filepath = os.path.join(os.getcwd(), &#39;data&#39;)<br># put all the inputs into a dictionnary<br>inputs = {&#39;polygon&#39;: polygon, &#39;dates&#39;: dates, &#39;sat_list&#39;: sat_list,<br>          &#39;sitename&#39;: sitename, &#39;filepath&#39;:filepath}</pre><p>The inputs above will retrieve all the images from 2024 taken by Landsat 8, Landsat 9 and Sentinel-2. The .tif files will be saved locally. This download process should take a few minutes for a 100 images if the polygon is not too large (&lt;25 sqkm).</p><pre>metadata = SDS_download.retrieve_images(inputs)</pre><p>To pre-process the images that were downloaded and create a timelapse we can run the following code with a set of parameters that control cloud masking and pansharpening:</p><pre># settings for cloud threshold, s2cloudless probability and pansharpening<br>settings = {<br>    &#39;cloud_thresh&#39;: 0.1,        # threshold on maximum cloud cover<br>    &#39;s2cloudless_prob&#39;: 60,     # probability threshold to identify cloudy pixels in the s2cloudless mask<br>    &#39;cloud_mask_issue&#39;: False,  # switch this parameter to True if sand pixels are masked (in black) on many images  <br>    &#39;pan_off&#39;: False,           # True to switch pansharpening off for Landsat 7/8/9 imagery<br>    # add the inputs defined previously<br>    &#39;inputs&#39;: inputs,<br>}<br><br># preprocess images and save as jpg<br>SDS_preprocess.save_jpg(metadata, settings, use_matplotlib=True)<br><br># create timelapse animation<br>fn_animation = os.path.join(inputs[&#39;filepath&#39;],inputs[&#39;sitename&#39;], &#39;%s_animation_RGB.gif&#39;%inputs[&#39;sitename&#39;])<br>fp_images = os.path.join(inputs[&#39;filepath&#39;], inputs[&#39;sitename&#39;], &#39;jpg_files&#39;, &#39;preprocessed&#39;)<br>fps = 4 # frames per second in animation<br>SDS_tools.make_animation_mp4(fp_images, fps, fn_animation)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C-pvGHHu5Pj8oVv72bgmpw.gif" /><figcaption>Sentinel-2 imagery downloaded from Google Earth Engine and preprocessed to mask clouds.</figcaption></figure><h3>Mapping the shoreline position</h3><p>To run the shoreline detection, we add a fewsettings controlling the image processing algorithm and run the extract_shorelines() function:</p><pre># magic command to allow interactive plotting in a Jupyter Notebook<br>%matplotlib qt<br># settings for shoreline mapping<br>settings.update({<br>    &#39;dist_clouds&#39;: 300,         # ditance around clouds where shoreline can&#39;t be mapped<br>    &#39;output_epsg&#39;: 28356,       # epsg code of spatial reference system desired for the output<br>    # quality control:<br>    &#39;check_detection&#39;: True,    # if True, shows each shoreline detection to the user for validation<br>    &#39;save_figure&#39;: True,        # if True, saves a figure showing the mapped shoreline for each image    <br>    &#39;adjust_detection&#39;: False,  # if True, allows user to adjust the postion of each shoreline by changing the threhold<br>    # [ONLY FOR ADVANCED USERS] shoreline detection parameters:<br>    &#39;min_beach_area&#39;: 1000,     # minimum area (in metres^2) for an object to be labelled as a beach<br>    &#39;min_length_sl&#39;: 500,       # minimum length (in metres) of shoreline perimeter to be valid<br>    &#39;sand_color&#39;: &#39;default&#39;,    # &#39;default&#39;, &#39;latest&#39;, &#39;dark&#39; (for grey/black sand beaches) or &#39;bright&#39; (for white sand beaches)<br>})<br><br># run shoreline detection<br>output = SDS_shoreline.extract_shorelines(metadata, settings)<br><br># create timelapse animation<br>fn_animation = os.path.join(inputs[&#39;filepath&#39;],inputs[&#39;sitename&#39;], &#39;%s_animation_shorelines.gif&#39;%inputs[&#39;sitename&#39;])<br>fp_images = os.path.join(inputs[&#39;filepath&#39;], inputs[&#39;sitename&#39;], &#39;jpg_files&#39;, &#39;detection&#39;)<br>fps = 4 # frames per second in animation<br>SDS_tools.make_animation_mp4(fp_images, fps, fn_animation)</pre><p>The function will allow you to quality-control the outputs and generate the timelapse below, where you can see the beach widening and retreating as it responds to different wave events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b8PDKvCxeQc4Jb3YUPSKKg.gif" /><figcaption>Shoreline detection from Sentinel-2 imagery with CoastSat.</figcaption></figure><p>That’s it! You have mapped shoreline positions at your local beach using CoastSat with only a few lines of code!</p><h3>Shoreline change time-series along transects</h3><p>You have generated a set of shoreline positions, time-tagged based on image acquisition, that you can plot in 2D:</p><pre># plot shorelines<br>fig = plt.figure(figsize=[10,8])<br>plt.axis(&#39;equal&#39;)<br>plt.xlabel(&#39;Eastings&#39;)<br>plt.ylabel(&#39;Northings&#39;)<br>plt.grid(linestyle=&#39;:&#39;, color=&#39;0.5&#39;)<br>cmap = plt.get_cmap(&#39;RdYlGn&#39;)<br>for i in range(len(output[&#39;shorelines&#39;])):<br>    sl = output[&#39;shorelines&#39;][i]<br>    date = output[&#39;dates&#39;][i]<br>    plt.plot(sl[:,0], sl[:,1], &#39;-&#39;, c=cmap(i/len(output[&#39;shorelines&#39;])), label=date.strftime(&#39;%d-%m-%Y&#39;))<br>plt.legend(loc=&#39;upper left&#39;,ncols=2);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ivl3Y01NSkSCuIp1kI8wkg.jpeg" /><figcaption>Mapped shoreline positions during 2024 at Narrabeen beach, Sydney, Australia.</figcaption></figure><p>You can see in the plot above how the southern part of the beach has eroded since the begining of the year (red to green). To quantify those changes we can set shore-normal transects and create time-series of shoreline change.</p><p>To define the transects, you can either draw them interactively, load them from a GeoJSON file or enter the coordinates manually. For simplicity, here I will provide the coordinates of 5 transects along the beach:</p><pre># define transect coordinates (in EPSG:28356, as shorelines)<br>transects = {<br>    &#39;NA1&#39;: np.array([[ 342880, 6269180 ], [ 343144, 6269037 ]]),<br>    &#39;NA2&#39;:np.array([[ 342733, 6268783 ], [ 343008, 6268664 ]]),<br>    &#39;NA3&#39;: np.array([[ 342451, 6267913 ], [ 342746, 6267859 ]]),<br>    &#39;NA4&#39;: np.array([[ 342460, 6267042 ], [ 342759, 6267075 ]]),<br>    &#39;NA5&#39;: np.array([[ 342675, 6266241 ], [ 342936, 6266388 ]])<br>}<br># plot shorelines and transects<br>fig = plt.figure(figsize=[10,8], tight_layout=True)<br>plt.axis(&#39;equal&#39;)<br>plt.xlabel(&#39;Eastings&#39;)<br>plt.ylabel(&#39;Northings&#39;)<br>plt.grid(linestyle=&#39;:&#39;, color=&#39;0.5&#39;)<br>cmap = plt.get_cmap(&#39;RdYlGn&#39;)<br>for i in range(len(output[&#39;shorelines&#39;])):<br>    sl = output[&#39;shorelines&#39;][i]<br>    date = output[&#39;dates&#39;][i]<br>    plt.plot(sl[:,0], sl[:,1], &#39;-&#39;, c=cmap(i/len(output[&#39;shorelines&#39;])), label=date.strftime(&#39;%d-%m-%Y&#39;))<br>for i,key in enumerate(list(transects.keys())):<br>    plt.plot(transects[key][0,0],transects[key][0,1], &#39;bo&#39;, ms=5)<br>    plt.plot(transects[key][:,0],transects[key][:,1],&#39;k-&#39;,lw=1)<br>    plt.text(transects[key][0,0]-100, transects[key][0,1]+100, key,<br>                va=&#39;center&#39;, ha=&#39;right&#39;, bbox=dict(boxstyle=&quot;square&quot;, ec=&#39;k&#39;,fc=&#39;w&#39;))<br>plt.legend(loc=&#39;upper left&#39;,ncols=2);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxp5sDD71KAuZdoIyJ-ItA.jpeg" /><figcaption>Shoreline positions and shore-normal transects.</figcaption></figure><p>Now we can compute the intersections between the shorelines and the transects and plot the time-series of shoreline change along each transect:</p><pre># define along-shore distance over which to consider shoreline points to compute the median intersection<br>settings_transects = {&#39;along_dist&#39;:25}<br># compute intersections<br>cross_distance = SDS_transects.compute_intersection(output, transects, settings_transects)<br><br># plot shoreline change time-series<br>fig = plt.figure(figsize=[15,10], tight_layout=True)<br>gs = gridspec.GridSpec(len(cross_distance),1)<br>gs.update(left=0.05, right=0.95, bottom=0.05, top=0.95, hspace=0.05)<br>for i,key in enumerate(cross_distance.keys()):<br>    idx_nan = np.isnan(cross_distance[key])<br>    dates = [output[&#39;dates&#39;][_] for _ in np.where(~idx_nan)[0]]<br>    chainage = cross_distance[key][~idx_nan]<br>    ax = fig.add_subplot(gs[i,0])<br>    ax.grid(linestyle=&#39;:&#39;, color=&#39;0.5&#39;)<br>    ax.plot(dates, chainage, &#39;-o&#39;, ms=6, mfc=&#39;w&#39;)<br>    ax.set_ylabel(&#39;distance [m]&#39;, fontsize=12)<br>    ax.text(0.5,0.95, key, bbox=dict(boxstyle=&quot;square&quot;, ec=&#39;k&#39;,fc=&#39;w&#39;), ha=&#39;center&#39;,<br>            va=&#39;top&#39;, transform=ax.transAxes, fontsize=14)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8k4IvOmOWKtJAtMUqOFQLw.jpeg" /><figcaption>Time-series of shoreline change along the transects.</figcaption></figure><p>We can now quantify by how much the shoreline changed along each transect. For example at the southern end of the beach, along transects NA4 and NA5, it looks like it retreated about of about 30 m during the year.</p><h3>Conclusion</h3><p>This short tutorial has demonstrated how you can map coastal changes using publicly available satellite imagery with CoastSat in just a few lines of code. You can now change the region of interest and run this at your favourite beach to see how it has changed over time.</p><p>🌎 To explore time-series of shoreline change along many of the world’s coastlines visit the <a href="http://coastsat.space/">coastsat.space</a> website.</p><p>If you find this useful, please do not forget to give CoastSat a⭐️ on <a href="https://github.com/kvos/CoastSat">GitHub</a>.</p><p>Next, we will see in <a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-2-tidal-correction-02978dda4189">Part 2</a> how ocean tides influence shoreline positions and how we can apply a tidal correction to the time-series, stay tuned!</p><h4>Relevant links:</h4><p><a href="https://medium.com/@voskilian/mapping-coastal-change-from-space-part-2-tidal-correction-02978dda4189">Mapping coastal change from space (Part 2): Tidal Correction</a></p><h4>Important links:</h4><p><a href="https://github.com/kvos/CoastSat">Github Repository<br></a><a href="https://github.com/kvos/CoastSat/blob/master/example_jupyter.ipynb">Jupyter Notebook tutorial</a><br>Data portal: <a href="http://coastsat.space/">coastsat.space</a><br>Journal publication: <a href="https://doi.org/10.1016/j.envsoft.2019.104528">CoastSat toolbox</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53a7de363cd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>