Coder Social home page Coder Social logo

kvos / coastsat Goto Github PK

View Code? Open in Web Editor NEW
633.0 27.0 236.0 114.26 MB

Global shoreline mapping tool from satellite imagery

Home Page: http://coastsat.wrl.unsw.edu.au/

License: GNU General Public License v3.0

Jupyter Notebook 94.24% Python 5.76%
google-earth-engine earth-engine remote-sensing satellite-images coastal-engineering shoreline-detection landsat-5 landsat-7 landsat-8 landsat-9

coastsat's Introduction

CoastSat

Last Commit GitHub release DOI License: GPL v3 Join the chat at https://gitter.im/CoastSat/community GitHub issues GitHub commit activity

CoastSat is an open-source software toolkit written in Python that enables users to obtain time-series of shoreline position at any coastline worldwide from 39 years (and growing) of publicly available satellite imagery.

Alt text

Finding CoastSat useful? Show your support with a Github star — it’s a simple click that helps others discover it ⭐️

Latest toolbox updates

▶️ (2024/04/26) CoastSat v2.5: contributions from @2320sharon and @DanieTheron to improve the download updates and cloud masking for Landsat.

▶️ (2023/11/09) CoastSat v2.4: bug & fixes, function to create animations, S2_HARMONIZED collection, better instructions on gcloud installations

▶️ (2023/07/07) CoastSat v2.3: addition of a better cloud mask for Sentinel-2 imagery using the s2cloudless collection on GEE

Additional resources

👉 Visit the CoastSat website to explore and download existing datasets of satellite-derived shorelines and beach slopes generated with CoastSat in the Pacific and Atlantic basins.

👉 Useful publications describing the toolbox:

👉 Other repositories and extensions related to the toolbox:

  • CoastSeg: an interactive toolbox for downloading satellite imagery, applying image segmentation models, mapping shoreline positions and more.
  • SDS_Benchmark: testbed for satellite-derived shorelines mapping algorithms and validation against benchmark datasets.
  • CoastSat.slope: estimates the beach-face slope from the satellite-derived shorelines obtained with CoastSat.
  • CoastSat.PlanetScope: shoreline extraction for PlanetScope Dove imagery (near-daily since 2017 at 3m resolution).
  • CoastSat.islands: 2D planform measurements for small reef islands.
  • CoastSat.Maxar: shoreline extraction on Maxar World-View images (in progress)
  • InletTracker: monitoring of intermittent open/close estuary entrances.

Project description

Satellite remote sensing can provide low-cost long-term shoreline data capable of resolving the temporal scales of interest to coastal scientists and engineers at sites where no in-situ field measurements are available. CoastSat enables the non-expert user to extract shorelines from Landsat 5, Landsat 7, Landsat 8, Landsat 9 and Sentinel-2 images. The shoreline detection algorithm implemented in CoastSat is optimised for sandy beach coastlines. It combines a sub-pixel border segmentation and an image classification component, which refines the segmentation into four distinct categories such that the shoreline detection is specific to the sand/water interface.

The toolbox has the following functionalities:

  1. easy retrieval of satellite imagery spanning the user-defined region of interest and time period from Google Earth Engine, including state-of-the-art pre-processing steps (re-projecting the different bands, pansharpening, advanced cloud masking).
  2. automated extraction of shorelines from all the selected images using a sub-pixel resolution technique and options for quality-control.
  3. intersection of the 2D shorelines with user-defined shore-normal transects.
  4. tidal correction using tide/water levels and an estimate of the beach slope.
  5. post-processing of the shoreline time-series, despiking and seasonal averaging.

Table of Contents

1. Installation

1.1 Create an environment with Anaconda

To run the toolbox you first need to install the required Python packages in an environment. To do this we will use Anaconda, which can be downloaded freely here. If you are a more advanced user and have Mamba installed, use Mamba as it will install everything faster and without problems (highly recommended if you know about python environments).

Once you have it installed on your PC, open the Anaconda prompt (in Mac and Linux, open a terminal window) and use the cd command (change directory) to go the folder where you have downloaded this repository (e.g., cd C:\Users\kilian\Documents\Github\CoastSat).

Create a new environment named coastsat with all the required packages by entering these commands in succession:

conda create -n coastsat
conda activate coastsat
conda install -c conda-forge geopandas -y
conda install -c conda-forge earthengine-api scikit-image matplotlib astropy notebook -y
pip install pyqt5 imageio-ffmpeg

All the required packages have now been installed and are self-contained in an environment called coastsat. Always make sure that the environment is activated with:

conda activate coastsat

To confirm that you have successfully activated CoastSat, your terminal command line prompt should now start with (coastsat).

⚠️ In case errors are raised ⚠️: clean things up with the following command (better to have the Anaconda Prompt open as administrator) before attempting to install coastsat again:

conda clean --all

You can also install the packages with the Anaconda Navigator, in the Environments tab. For more details, the following link shows how to create and manage an environment with Anaconda.

1.2 Activate Google Earth Engine Python API

First, you need to request access to Google Earth Engine at https://signup.earthengine.google.com/. Then install gcloud, go to https://cloud.google.com/sdk/docs/install and install gcloud CLI. After you have installed gcloud CLI it will automatically launch and let you authenticate with your GEE account (or gmail). Then close the Anaconda Prompt and restart it.

Now you are ready to start using the CoastSat toolbox!

⚠️ remember to always activate the environment with conda activate coastsat each time you are preparing to use the toolbox.

2. Usage

An example of how to run the software in a Jupyter Notebook is provided in the repository (example_jupyter.ipynb). To run this, first activate your coastsat environment with conda activate coastsat (if not already active), and then type:

jupyter notebook

A web browser window will open. Point to the directory where you downloaded this repository and click on example_jupyter.ipynb. A Jupyter Notebook combines formatted text and code. To run the code, place your cursor inside one of the code sections and click on the run cell button (or press Shift + Enter) and progress forward.

image

If you prefer to use Spyder or other integrated development environments (IDEs), a Python script named example.py is also included in the repository. If using Spyder, make sure that the Graphics Backend is set to Automatic and not Inline (as this mode doesn't allow to interact with the figures). To change this setting go under Preferences>IPython console>Graphics.

The following sections show an example of how to run the full CoastSat workflow at Narrabeen-Collaroy beach (Australia).

2.1 Retrieval of the satellite images

To retrieve from the GEE server the available satellite images cropped around the user-defined region of coastline for the particular time period of interest, the following variables are required:

  • polygon: the coordinates of the region of interest (longitude/latitude pairs in WGS84), do not exceed 100 sqkm.
  • dates: dates over which the images will be retrieved (e.g., dates = ['2017-12-01', '2018-01-01'])
  • sat_list: satellite missions to consider (e.g., sat_list = ['L5', 'L7', 'L8', 'L9', 'S2'] for Landsat 5, 7, 8, 9 and Sentinel-2 collections)
  • sitename: name of the site (this is the name of the subfolder where the images and other accompanying files will be stored)
  • filepath: filepath to the directory where the data will be stored
  • landsat_collection: whether to use Collection 1 (C01) or Collection 2 (C02). Note that after 2022/01/01, Landsat images are only available in Collection 2. Landsat 9 is therefore only available as Collection 2. So if the user has selected C01, images prior to 2022/01/01 will be downloaded from Collection 1, while images captured after that date will be automatically taken from C02.
  • (optional) S2tile: for Sentinel-2 only, this parameter let's you specify the tile from which you'd like to crop your ROI, this avoids having many duplicates in the Sentinel-2 collection. For example inputs['S2tile'] = '56HLH' is the S2 tile for Sydney, check this website to view all tiles and find the one covering your ROI.

The call metadata = SDS_download.retrieve_images(inputs) will launch the retrieval of the images and store them as .TIF files (under /filepath/sitename). The metadata contains the exact time of acquisition (in UTC time) of each image, its projection and its geometric accuracy. If the images have already been downloaded previously and the user only wants to run the shoreline detection, the metadata can be loaded directly by running metadata = SDS_download.get_metadata(inputs).

The screenshot below shows an example of inputs that will retrieve all the images of Collaroy-Narrabeen (Australia) acquired by Sentinel-2 in December 2017.

doc1

⚠️ The area of the polygon should not exceed 100 km2, so for very long beaches split it into multiple smaller polygons.

2.2 Shoreline detection

To map the shorelines, the following user-defined settings are needed:

  • cloud_thresh: threshold on maximum cloud cover that is acceptable on the images (value between 0 and 1 - this may require some initial experimentation).
  • dist_clouds: buffer around cloud pixels where shoreline is not mapped (in metres)
  • output_epsg: epsg code defining the spatial reference system of the shoreline coordinates. It has to be a cartesian coordinate system (i.e. projected) and not a geographical coordinate system (in latitude and longitude angles). See http://spatialreference.org/ to find the EPSG number corresponding to your local coordinate system. If you do not use a local projection your results may not be accurate.
  • check_detection: if set to True the user can quality control each shoreline detection interactively (recommended when mapping shorelines for the first time) and accept/reject each shoreline.
  • adjust_detection: in case users wants more control over the detected shorelines, they can set this parameter to True, then they will be able to manually adjust the threshold used to map the shoreline on each image.
  • save_figure: if set to True a figure of each mapped shoreline is saved under /filepath/sitename/jpg_files/detection, even if the two previous parameters are set to False. Note that this may slow down the process.

There are additional parameters (min_beach_size, min_length_sl, cloud_mask_issue, sand_color and pan_off) that can be tuned to optimise the shoreline detection (for Advanced users only). For the moment leave these parameters set to their default values, we will see later how they can be modified.

An example of settings is provided here:

image

Timelapse animation in MP4

Once the images have been downloaded you can visualise them and create an MP4 animation using SDS_preprocess.save_jpg(metadata, settings) and SDS_tools.make_animation_mp4(fp_images, fps, fn_animation) as shown in the Jupyter Notebook.

image

Reference shoreline [HIGHLY RECOMMENDED]

Before running the batch shoreline detection, there is the option to manually digitize a reference shoreline on one cloud-free image. This reference shoreline helps to reject outliers and false detections when mapping shorelines as it only considers as valid shorelines the points that are within a defined distance from this reference shoreline (defined by settings['max_dist_ref']).

The user can manually digitize one or several reference shorelines on one of the images by calling:

settings['reference_shoreline'] = SDS_preprocess.get_reference_sl_manual(metadata, settings)
settings['max_dist_ref'] = 100 # max distance (in meters) allowed from the reference shoreline

This function allows the user to click points along the shoreline on cloud-free satellite images, as shown in the animation below.

ref_shoreline

The maximum distance (in metres) allowed from the reference shoreline is defined by the parameter max_dist_ref. This parameter is set to a default value of 100 m. If you think that 100 m buffer from the reference shoreline will not capture the shoreline variability at your site, increase the value of this parameter. This may be the case for large nourishments or eroding/accreting coastlines.

Batch shoreline detection

Once all the settings have been defined, the batch shoreline detection can be launched by calling:

output = SDS_shoreline.extract_shorelines(metadata, settings)

When check_detection is set to True, a figure like the one below appears and asks the user to manually accept/reject each detection by pressing on the keyboard the right arrow (⇨) to keep the shoreline or left arrow (⇦) to skip the mapped shoreline. The user can break the loop at any time by pressing escape (nothing will be saved though).

map_shorelines

When adjust_detection is set to True, a figure like the one below appears and the user can adjust the position of the shoreline by clicking on the histogram of MNDWI pixel intensities. Once the threshold has been adjusted, press Enter and then accept/reject the image with the keyboard arrows.

Alt text

Once all the shorelines have been mapped, the output is available in two different formats (saved under /filepath/data/SITENAME):

  • SITENAME_output.pkl: contains a list with the shoreline coordinates, the exact timestamp at which the image was captured (UTC time), the geometric accuracy and the cloud cover of each individual image. This list can be manipulated with Python, a snippet of code to plot the results is provided in the example script.
  • SITENAME_output.geojson: this output can be visualised in a GIS software (e.g., QGIS, ArcGIS).

The figure below shows how the satellite-derived shorelines can be opened in a GIS software (QGIS) using the .geojson output. Note that the coordinates in the .geojson file are in the spatial reference system defined by the output_epsg.

Advanced shoreline detection parameters

As mentioned above, there are some additional parameters that can be modified to optimise the shoreline detection:

  • min_beach_area: minimum allowable object area (in metres^2) for the class 'sand'. During the image classification, some features (for example, building roofs) may be incorrectly labelled as sand. To correct this, all the objects classified as sand containing less than a certain number of connected pixels are removed from the sand class. The default value is 4500 m^2, which corresponds to 20 connected pixels of 15 m^2. If you are looking at a very small beach (<20 connected pixels on the images), try decreasing the value of this parameter.
  • min_length_sl: minimum length (in metres) of shoreline perimeter to be valid. This can be used to discard small features that are detected but do not correspond to the actual shoreline. The default value is 500 m. If the shoreline that you are trying to map is shorter than 500 m, decrease the value of this parameter.
  • cloud_mask_issue: the cloud mask algorithm applied to Landsat images by USGS, namely CFMASK, does have difficulties sometimes with very bright features such as beaches or white-water in the ocean. This may result in pixels corresponding to a beach being identified as clouds and appear as masked pixels on your images. If this issue seems to be present in a large proportion of images from your local beach, you can switch this parameter to True and CoastSat will remove from the cloud mask the pixels that form very thin linear features, as often these are beaches and not clouds. Only activate this parameter if you observe this very specific cloud mask issue, otherwise leave to the default value of False.
  • sand_color: this parameter can take 3 values: default, latest, dark or bright. Only change this parameter if you are seing that with the default the sand pixels are not being classified as sand (in orange). If your beach has dark sand (grey/black sand beaches), you can set this parameter to dark and the classifier will be able to pick up the dark sand. On the other hand, if your beach has white sand and the default classifier is not picking it up, switch this parameter to bright. The latest classifier contains all the training data and can pick up sand in most environments (but not as accurately). At this stage the different classifiers are only available for Landsat images (soon for Sentinel-2 as well).
  • pan_off: by default Landsat 7, 8 and 9 images are pan-sharpened using the panchromatic band and a PCA algorithm. If for any reason you prefer not to pan-sharpen the Landsat images, switch it off by setting pan_off to True.
  • s2cloudless_prob: by default set to 60, this is the threshold to identify cloudy pixels in the s2cloudless probability mask. If you see that too many cloudy pixels appear on the image increase the threshold, if too many cloudy pixels are missed lower the threshold (reasonable range between 20 and 80).

Re-training the classifier

CoastSat's shoreline mapping alogorithm uses an image classification scheme to label each pixel into 4 classes: sand, water, white-water and other land features. While this classifier has been trained using a wide range of different beaches, it may be that it does not perform very well at specific sites that it has never seen before. You can try the different classifiers already available in the /classification folder by changing the settings['sand_color'] parameter to dark or bright, but if none of those fit your data you can train a new classifier for your site. This process is described in another Jupyter notebook called re-train CoastSat classifier and located in the /classification folder.

2.3 Shoreline change time-series along cross-shore transects

This section shows how to obtain time-series of shoreline change along shore-normal transects. Each transect is defined by two points, its origin and a second point that defines its length and orientation. The origin is always defined first and located landwards, the second point is located seawards. There are 3 options to define the coordinates of the transects:

  1. Interactively draw shore-normal transects along the mapped shorelines:
transects = SDS_transects.draw_transects(output, settings)
  1. Load the transect coordinates from a .geojson file:
transects = SDS_tools.transects_from_geojson(path_to_geojson_file)
  1. Create the transects by manually providing the coordinates of two points:
transects = dict([])
transects['Transect 1'] = np.array([[342836, ,6269215], [343315, 6269071]])
transects['Transect 2'] = np.array([[342482, 6268466], [342958, 6268310]])
transects['Transect 3'] = np.array([[342185, 6267650], [342685, 6267641]])

⚠️ if you choose option 2 or 3, make sure that the points that you are providing are in the spatial reference system defined by settings['output_epsg'], otherwise they won't match the shorelines.

Computing the intersections (normal mode)

Once the shore-normal transects have been defined, the intersection between the 2D shorelines and the transects is computed with the following function:

settings['along_dist'] = 25
cross_distance = SDS_transects.compute_intersection(output, transects, settings)

The parameter along_dist defines the along-shore distance around the transect over which shoreline points are selected to compute the intersection. The default value is 25 m, which means that the intersection is computed as the median of the points located within 25 m of the transect (50 m alongshore-median). This helps to smooth out localised water levels in the swash zone.

An example is shown in the animation below:

transects

Computing the intersections (quality-controlled mode)

There is also a more advanced function to compute the intersections SDS_transects.compute_intersection_QA(), which provides more quality-control and can deal with small loops, multiple intersections, false detections etc. It is recommended to use this function as it can provide cleaner shoreline time-series. An example of parameter values is provided below, the default parameters should work in most cases (leave as it is if unsure).

Capture
  • along_dist: (in metres), alongshore distance to caluclate the intersection (median of points within this distance).
  • min_points: minimum number of shoreline points to calculate an intersection.
  • max_std: (in metres) maximum STD for the shoreline points within the alongshore range, if STD is above this value a NaN is returned for this intersection.
  • max_range: (in metres) maximum RANGE for the shoreline points within the alongshore range, if RANGE is above this value a NaN is returned for this intersection.
  • min_chainage: (in metres) furthest distance landward of the transect origin that an intersection is accepted, beyond this point a NaN is returned.
  • multiple_inter: ('auto','nan','max') defines how to deal with multiple shoreline intersections
  • auto_prc: (value between 0 and 1) by default 0.1, percentage of the time that a multiple intersection needs to be present to use the max in auto mode

The multiple_inter setting helps to deal with multiple shoreline intersections along the same transect. This is quite common, for example when there is a lagoon behind the beach and the transect crosses two water bodies. The function will try to identify this cases and the user can choose whether to:

  • 'nan': always assign a NaN when there are multile intersections.
  • 'max': always take the max (intersection the furtherst seaward).
  • 'auto': let the function decide transect by transect, and if it thinks there are two water bodies, take the max. If 'auto' is chosen, the auto_prc parameter will define when to use the max, by default it is set to 0.1, which means that the function thinks there are two water bodies if 10% of the time-series show multiple intersections.

2.4 Tidal Correction

Each satellite image is captured at a different stage of the tide, therefore a tidal correction is necessary to remove the apparent shoreline changes cause by tidal fluctuations.

In order to tidally-correct the time-series of shoreline change you will need the following data:

  • Time-series of water/tide level: this can be formatted as a .csv file, an example is provided here. Make sure that the dates are in UTC time as the CoastSat shorelines are always in UTC time. Also the vertical datum needs to be approx. Mean Sea Level.

  • An estimate of the beach-face slope along each transect. If you don't have this data you can obtain it using CoastSat.slope, see Vos et al. 2020 for more details (preprint available here).

Wave setup and runup corrections are not included in the toolbox, but for more information on these additional corrections see Castelle et al. 2021.

2.5 Post-processing (seasonal averages and linear trends)

The tidally-corrected time-series can be post-processed to remove outliers with a despiking algorithm SDS_transects.reject_outliers(). This function was developed to remove obvious outliers in the time-series by removing the points that do not make physical sense in a shoreline change setting. For example, the shoreline can experience rapid erosion after a large storm, but it will then take time to recover and return to its previous state. Therefore, if the shoreline erodes/accretes suddenly of a significant amount (max_cross_change) and then immediately returns to its previous state, this spike does not make any physical sense and can be considered an outlier.

image

Additionally, this function also checks that the Otsu thresholds used to map the shoreline are within the typical range defined by otsu_threshold, with values outside this range (typically -0.5 to 0) identified as outliers.

otsu_threhsolds

Additionally, a set of functions to compute seasonal averages, monthly averages and linear trends on the shoreline time-series are provided.

SDS_transects.seasonal_averages()

NA1_seasonally

SDS_transects.monthly_averages()

NA1_monthly

⚠️ given that the shoreline time-series are not uniformly sampled and there is more density of datapoints towards the end of the record (more satellite in orbit), it is best to estimate the long-term trends on the seasonally-averaged shoreline time-series as the trend estimated on the raw time-series may be biased towards the end of the record.

2.6 Validation against survey data

This section provides code to compare the satellite-derived shorelines against the survey data for Narrabeen, available at http://narrabeen.wrl.unsw.edu.au/.

comparison_transect_PF1

Contributing and Issues

Having a problem? Post an issue in the Issues page (please do not email).

If you are willing to contribute, check out our todo list in the Projects page.

  1. Fork the repository (https://github.com/kvos/coastsat/fork). A fork is a copy on which you can make your changes.
  2. Create a new branch on your fork
  3. Commit your changes and push them to your branch
  4. When the branch is ready to be merged, create a Pull Request (how to make a clean pull request explained here)

References and Datasets

This section provides a list of references that use the CoastSat toolbox as well as existing shoreline datasets extracted with CoastSat.

Publications

  • Vos K., Splinter K.D., Harley M.D., Simmons J.A., Turner I.L. (2019). CoastSat: a Google Earth Engine-enabled Python toolkit to extract shorelines from publicly available satellite imagery. Environmental Modelling and Software. 122, 104528. https://doi.org/10.1016/j.envsoft.2019.104528 (Open Access)

  • Vos K., Harley M.D., Splinter K.D., Simmons J.A., Turner I.L. (2019). Sub-annual to multi-decadal shoreline variability from publicly available satellite imagery. Coastal Engineering. 150, 160–174. https://doi.org/10.1016/j.coastaleng.2019.04.004

  • Vos K., Harley M.D., Splinter K.D., Walker A., Turner I.L. (2020). Beach slopes from satellite-derived shorelines. Geophysical Research Letters. 47(14). https://doi.org/10.1029/2020GL088365 (Open Access preprint here)

  • Vos, K. and Deng, W. and Harley, M. D. and Turner, I. L. and Splinter, K. D. M. (2022). Beach-face slope dataset for Australia. Earth System Science Data. volume 14, 3, p. 1345--1357. https://doi.org/10.5194/essd-14-1345-2022

  • Vos, K., Harley, M.D., Turner, I.L. et al. Pacific shoreline erosion and accretion patterns controlled by El Niño/Southern Oscillation. Nature Geosciences. 16, 140–146 (2023). https://doi.org/10.1038/s41561-022-01117-8

  • Castelle B., Masselink G., Scott T., Stokes C., Konstantinou A., Marieu V., Bujan S. (2021). Satellite-derived shoreline detection at a high-energy meso-macrotidal beach. Geomorphology. volume 383, 107707. https://doi.org/10.1016/j.geomorph.2021.107707

  • Castelle, B., Ritz, A., Marieu, V., Lerma, A. N., & Vandenhove, M. (2022). Primary drivers of multidecadal spatial and temporal patterns of shoreline change derived from optical satellite imagery. Geomorphology, 413, 108360. https://doi.org/10.1016/j.geomorph.2022.10836

  • Konstantinou, A., Scott, T., Masselink, G., Stokes, K., Conley, D., & Castelle, B. (2023). Satellite-based shoreline detection along high-energy macrotidal coasts and influence of beach state. Marine Geology, 107082. https://doi.org/10.1016/j.margeo.2023.107082

Datasets

coastsat's People

Contributors

2320sharon avatar borgstad avatar chrisleaman avatar danietheron avatar hcastrol avatar ianlturner avatar jimpaulobautista avatar kant avatar kristensplinter avatar kvos avatar sbfrf 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coastsat's Issues

Duplicate of #18

The following is the error message:

(base) PS C:\Users\TANIN\Anaconda3> conda activate coastsat

>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

An unexpected error has occurred. Conda has prepared the above report.

Offshore bias in shoreline detection

Hi kvos, Antonio from Italy here.
On the same stretch of beach I used all the available satellite images (L5, L7, L8, S2) in the same periods (15/07/2018-15/08/2018). The results are very different and none is optimal. What parameters should I work on?
Kind Regards
problemi

Images not downloading and tidal correction

Hello Killan,
I started using coastsat as a part of my dissertation. I have successfully completed the example on Narra beach. After changing the coordinates and site name of the example, the code was executed, but no images were downloaded. I'm preparing script in spyder and running the same in anaconda prompt.Here I'm attaching the screen shots please check the same and give a suitable reply.
anaconda prompt
cap1
2

Using non-satellite imagery

Hi Kvos,

We regularly receive high resolution geo-referenced aerial survey information and overtime we have built up quite a database of information.

Is it possible to include non-satellite project specific imagery in the shoreline analysis process?

Kudos on such a great project. Digitising shorelines and accessing decent satellite imagery use to take up quite a bit of my time so its exciting to see such great developments being made.

Shoreline detection of Marawila beach

Dear all,

I started using CoastSat recently and found it to be a very useful tool. I recommended the software to one undergraduate project where the student will be using the tool
2017-12-22-05-07-59_S2
to assess the long-term (20+ years) shoreline change at a beach in Sri Lanka- Marawila beach (https://www.google.com/maps/search/marawila+beach/@7.4124624,79.8009101,14z/data=!3m1!4b1).

The student has successfully completed the example on Narra Beach given in GitHub. After changing only the co-ordinates of the example (so that it would match Marawila beach), the code was executed. However, we see that the quality of the images obtained is not clear - they appear pixelated (see attached image) which would clearly affect the shoreline detection stage as well. Clearly, there needs to be some adjustment to shoreline detection parameters in the code, but we are not sure how to fine-tune these parameters to get a reasonably accurate detection of the shoreline for Marawila. Could anybody give some suggestions, based on your experience, to improve this?

Any help is highly appreciated.

Kind regards

Time-series of shoreline change in .csv file

Hello again,

so far the software works very well and I am glad with the results it provides! However, the very last step when you plot the time series of shoreline change could be improved I believe.

The resulting time series are confusing and there is nothing much you can do. With the provided figure it is only possible to alter the very first transect shoreline time-series visualization. No matter if I choose a second transect, the changes only apply to the first one... for example if I want to adjust the bottom and top boundaries (yes, I can do that before I run the command, however shoreline position on a first transect and the last one, e.g. 200 meters away, is different).

It would be great if the time series data could be extracted to an excel compatible file for example, where you could fit a trend, better compare with in-situ measurements, etc.
Even a .txt file would do good with information on the date and shoreline position in each of the transects.

Let me know if that would be possible or perhaps there are alternative solutions? Everything else is fine!:)

All the best,
Lukas

CoastSat not working due to Pillow 7.0

image

Hi,

I have encountered the following issues as in the picture. It seems that new version of CoastSat is not compatibile with Pillow environment, so there a need for going back to lower version which is 6.2.
With this change the CoastSat is working as before.

Hope it is helpful,

Marcin

Error when runnning batch shoreline detection

Hi,
This has been a frequent problem of mine. Whenever i press the right arrow which says keep
wrong narra i get this error
coastsat problem. The mapping is stuck at 14%

I run everything normally except i skip the optional code where it asks me to save it as a jpg because it errors.

I expected it to make a graph after i press keep.

Im running windows 10 pro, and using miniconda3.

Improving resolution of satellite images

Dear Kilian:

We are trying to improve the resolution of the satellite images obtained for Marawila region. However, it seems we are doing something wrong as the images obtained are rather blurred.

The input parameter values we used are:

cloud_thresh = 0.5
min_beach_area'= 1000
buffer_size= 100
min_length_sl=200
sand_color=dark

The KML file used is here:
https://drive.google.com/file/d/1CW65qN-BbG-iapZgQrFFTpj4zFTCh30H/view?usp=sharing](url)

I am sharing herewith the images we obtained

d
e

We are certainly doing something wrong as our resolution is significantly less than the resolution that you reproduced the same region with. Please could you let us know the parameters you would change to improve this quality?
Thank you very much.

Duplicate of #18

After typing "conda env create -f environment.yml -n coastsat" in the folder same as CoastSat-master the following ERROR appears:
CondaValueError: prefix already exists: C:\Users........\Anaconda3\envs\coastsat

The purpose of this post was to figure out "why" such issues might happen in the first place so to avoid repeat of such issues in the future for better workflow.

No images are downloaded

I'm trying to use my study site in the GEE and I'm using this code

polygon = [[[29.242207, -83.090314],
[29.229097, -83.092357],
[29.229088, -83.068519],
[29.245553, -83.068872]]]

dates = ['2015-01-01', '2017-012-01']

sat_list = ['L5']

sitename = 'LCR'

filepath = os.path.join(os.getcwd(), 'data')

inputs = {'polygon': polygon, 'dates': dates, 'sat_list': sat_list, 'sitename': sitename, 'filepath':filepath}

I was getting an error 404, but I enabled the widgets and that went away. It just keeps loading without downloading any images. I can send a screenshot too if that helps. Can you check if that range works for you?

Make coastsat into a package

In order to use coastsat, you have to set your pythonpath/start your environment with coastsat as root dir.

It would be really nice if CoastSat existed as an installable package.

If you are interested, I could create a PR

Not able to install coastsat

when i tried to create environment, it shows the following error
SpecNotFound: Invalid name, try the format: user/package

Shoreline extraction issues

@kvos,

I am (sometimes) getting a strange error message when I call "SDS_shoreline.extract_shorelines(metadata,settings)", where the error message is "ValueError: LineStrings must have at least 2 coordinate tuples" (screenshot attached). Sometimes the function works without error, and sometimes I get this message. I cannot seem to detect a pattern of when it errors (i.e. only for certain satellites or dates, etc.), other than that it only seems to happen when I apply the function to a relatively long interval (e.g. 15 yr). For example, I can call the function, for the same satellites and end date as established in "metadata", for 3 months and it will work fine, but will error if I try it for 10 yr. As the screenshot shows, the function gets all the way to 100% for each satellite before it errors out. For reference, I'm running MacOS 10.14 with Python 3.7. Any ideas?
Screen Shot 2019-06-17 at 10 20 13 AM

Batch shoreline detection error

Hi kvos,

When I finished "Batch shoreline detection" this step, it shows something wrong and reminded me" linestrings must have at least 2 coordinate tuples"

and when i run " plot the time-series of shoreline change along each transect" this stage, there should be a line chart representing the trend, but it can't display, only a blank is displayed.

i m very grateful if you can point out my problem.

Thank you very much

best,

yuan
图片 1

Duplicate of #18

After that I tried to follow the following 3 steps:

conda create --name coastsat
conda activate coastsat
conda install <name_of_the_package>

BUT in step 3 while dealing with """earthengine-api""", I get an ERROR message.
please see below:

(coastsat) C:\Users.........>conda install earthengine-api
Collecting package metadata: done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

earthengine-api
Current channels:

https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to

https://anaconda.org
and use the search bar at the top of the page.

Any ideas? inputs?

Calculation of features not robust towards nan values

In calculate_feature a feature vector is generated for each pixel not obscured by clouds. The feature vector consists of five bands and a corresponding normalized difference index. This yields in total ten bands. For each of these bands, the standard deviation is calculated, and this is where things go wrong. The function image_std, used to calculated the standard deviation, uses uniform_filter from Scipy to do so. I have expierenced problems in accordance with this issue: scipy/scipy#7818. I.e., whenever a pixel is assigned nan, all values proceding this pixel values in the convolution will have value nan.

The issue can be very easily replicated:

im_ms, georef, cloud_mask, im_extra, im_QA, im_nodata = SDS_preprocess.preprocess_single(fn,
                                                                                             satname,
                                                                                             cloud_mask_problem)

# will results in channel 9- 19 of im_features equal nan
im_ms[0,0,:] = np.nan
im_features = SDS_shoreline.calculate_features(im_ms, cloud_mask, ~im_nodata)

# check if all elements are nan
im_features[:,:,10:].flatten().all() == True

The problem can be mitigated easily by using a convolution library that handles nan values. Astropy (https://docs.astropy.org/en/stable/convolution/) is one such library

Choosing only one date of each year

Sir,
I need to analyse the shoreline change of a particular season and want to take one data in every one/ five yera. Can you please tell, how to define ?

regards,
Subhasis

Linking to GEE server [HTTP error 403]

Hi Kilian,

I have set up this CoastSAT after our previous discussions. I have been trying to use Jupitor and look at the example to be able to fully capture what is going on. I received the following messages. part a and part b. I was wondering if somebody can advise what is going on?
Is this on the right track or?

part a

part b

Thanks for your cooperation and interaction in advance.
Best wishes

Error in retrieving satellite images

Dear all,

I am using CoastSat to obtain shoreline images of Marawila beach (Sri Lanka) before the year 2016. I used a .KML file generated from My Maps, using this, I input the coordinates of the coastal region to CoastSat. The time period was also selected as 2015/02/01 to 2015/12/01.

At this point, there was an error called "Unbound Local Error" - please see the screenshot below:

img3

Please note that this error did not occur for shoreline images obtained after the year 2016. So this seemed to be quite strange. I would highly appreciate it if you could provide a suggestion to help to resolve this problem.

Thanks a lot.

Kind regards
Eranda

Black sand beaches

Hi Kilian, Francisco from Chile here.

first to all, thank you very much for the tool that you and your teammates developed.

I have a problem with the use of the tool... In Pichilemu we have black sand, I saw in the when you analyzed the Pichilemu beach that the model can recognize the black sand, but when I did the same the model couldn't recognize it. Do I need to edit some parameters?

Kind Regards !!

2019-03-10-14-52-32_S2

2019-03-20-14-52-34_S2

Error while setting up in windows system

Hi everybody,

I am using a windows system, I spent a couple of hours to set up the system on the computer but in the step 1.1 I come across some Error Messages. I installed Anaconda on my PC. Then I created a new environment named coastsat with all the required packages:
conda env create -f environment.yml -n coastsat
Then I wanted to activate the new environment as below according to the website

conda activate coastsat
At this stage the following message has appeared.

Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.

At C:\Users\TANIN\Anaconda3\shell\condabin\Conda.psm1:70 char:36

  •     Invoke-Expression -Command $activateCommand;
    
  •                                ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Invoke-Expression], ParameterBindingValidationException

    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Invo

    keExpressionCommand


I would highly appreciate if you can kindly advise how I can fix this issue.

Some of the conda-forge files not found.

Hello,
I am trying to install the CoastSat package on a Macbook Pro Retina with OSX 10.13.6 following the description but it fails while running the command:
conda install --name coastsat --file requirements_osx64.txt

some of the file listed in the requirement file seems to be missing.
any hint?
thanks
Marco Olivieri

CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/osx-64/proj4-5.2.0-h470a237_1.tar.bz2
Elapsed: 00:00.222118
CF-RAY: 4d7370aaea7ccd2e-FCO

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/osx-64/hdf5-1.10.4-nompi_h5598ddc_1003.tar.bz2
Elapsed: 00:00.267745
CF-RAY: 4d73714a19cbcd26-FCO

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/osx-64/postgresql-10.5-ha408888_1.tar.bz2
Elapsed: 00:00.436672
CF-RAY: 4d73729d1c01cd36-FCO

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/osx-64/libgdal-2.3.2-h42efa9e_1.tar.bz2
Elapsed: 00:00.428753
CF-RAY: 4d737429eca7cd0a-FCO

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/osx-64/gdal-2.3.2-py36hfc77a4a_1.tar.bz2
Elapsed: 00:00.217833
CF-RAY: 4d73748ecf86cd1e-FCO

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

Possible to expand on bands extraction?

Is your feature request related to a problem? Please describe.
No, not related to a problem! Just would like to learn more about the background processes :)

Describe the solution you'd like
Hi @kvos , by now (and my emails) you are well aware that I am a big fan of your academic pubs on the subject-content (methodology) for your coastsat module. I was wondering, when reading both the larger pub (methodology deep) and shorter pub (explaining coastsat high-level process) if you would be able to append the processing of the imagery between the 'download' and before 'shoreline extraction'.

For example, during image processing, are the images downloaded inidividual bands, or, are those extracted separately during the image?

I will try to use this example 👍 :

From SDS_preprocess.preprocess_single_image(), there is the following line:

# read all bands
        data = gdal.Open(fn, gdal.GA_ReadOnly)
        georef = np.array(data.GetGeoTransform())
        bands = [data.GetRasterBand(k + 1).ReadAsArray() for k in range(data.RasterCount)]
        im_ms = np.stack(bands, 2)

However, in the source docs for arguments, SDS_classify.label_images(), you mention that fn = ( a list of filenames, one filename for each band"

# get individual RGB image
            im_RGB = SDS_preprocess.rescale_image_intensity(im_ms[:,:,[2,1,0]], cloud_mask, 99.9)
            im_NDVI = SDS_tools.nd_index(im_ms[:,:,3], im_ms[:,:,2], cloud_mask)
            im_NDWI = SDS_tools.nd_index(im_ms[:,:,3], im_ms[:,:,1], cloud_mask)

Additional context
Given the data above, I am wondering how the processing is actually carried out. For example, I have the following understanding (in my small head):

Download Images (inputs, etc) [Let's pretend there is only one capture for the inputs, a L7 (B,G,R,NIR,SWIR1)] ---> Image Stored in (./data) ===skip ahead in process=== ---> Use pre-processing, gather the bands and stack RGB together, also extract im_NDVI & im_NDWI.

Obviously, from here - it differs based on creating new location (classifier training) or simply receiving the input. However, I would love to understand if we are pulling in a single image or if that image is being downloaded by band (i.e. are we getting ~7 copies of the image at different bands or a single raster)?

Thanks @kvos , stay awesome

Issue setting up environment

Hi Kvos,
I've just installed the code, and was able to run example_jupyter.ipynb. However, I am getting an error message below while running example.py. Do you know why?

I am using Python 3.7 Windows... thank you

runfile('C:/CoastSat-master/example.py', wdir='C:/CoastSat-master')
Reloaded modules: coastsat
File "coastsat\SDS_download.py", line 207
print('\r%d%%' % (int(((i+1)/n_img)*100)), end='')
^
SyntaxError: invalid syntax

Duplicate of #28

Hello Hi Kilian,,
Does anybody know why the following error message might appear
when running "metadata = SDS_download.retrieve_images(inputs)"

ValueError: zero-size array to reduction operation maximum which has no identity

Classifier issues

I have ran into problems of accurate shoreline detection and I thought I will try to retrain the classifier. I did (to my knowledge) everything according to the guidelines...I have added the SDS_classify.py file, installed the astropy, etc.

After completing all of the prior steps (initial settings, download, etc. (from the example)) I have tried to run the command: SDS_classify.label_images(metadata,settings), however I run into an error:

KeyError Traceback (most recent call last)
in
----> 1 metadata = SDS_classify.label_images(metadata,settings)

~/CoastSat-master/coastsat/SDS_classify.py in label_images(metadata, settings)
93
94 """
---> 95 filepath_train = settings['filepath_train']
96 # initialize figure
97 fig,ax = plt.subplots(1,1,figsize=[17,10], tight_layout=True,sharex=True,

KeyError: 'filepath_train'

Currently working on Linux Mint OS. I am a complete beginner, so any help would be marvelous.

Thanks and have a great day!

cannot calculate cross distance

When running the code everything works except for the shoreline change analysis. I can select shorelines, view all of the created shorelines, and draw transects for them, but the cross distance is given as nan and no shoreline change graph is created.

Annotation 2020-03-02 115744

My points are:
[-75.537, 35.776], [-75.52, 35.78], [-75.439, 35.591],[-75.508, 35.588],[-75.537, 35.776]

output epsg: 3358

Any ideas?

Offshore bias in S2 images

Hi Kilian, as mentioned above (# 50) I have a problem with S2 images, the shoreline are overly offshore.
Whith the same S2 images in QGIS I calculated NDWI ((B3-B8)/(B3+B8)), whith the threshold equal to 0, and I got better results. In this way I can use two images with the same spatial resolution, rather than proceeding with interpolations (as in the MNDWI calculation).
The difference between the two shorelines is 17-22 meters.
Below you can see two examples
What do you think about it?
Greetings from Italy

10 aprile
19_luglio

Use keyboard to keep/skip images

Hi,

After downloading the master version for Coastsat on my Mac, I appear to be having issues with running the SDS_shoreline.extract_shorelines routine in example workbook.

When I run the routine a new window with three figures opens up. But nothing happens when I click on either keep or skip. In the jupiter notebook it says the shoreline analysis has reached 14%. Im also prompted with the following message any time I try to click the skip or keep buttons in the picture: QTimer::singleShot: Timers cannot have negative timeouts. The window will close if I press escape though.

See screenshots below.

I have also tried this on my Windows computer and get stuck on the same bit which makes me think that there might be an issue with the SDS_shoreline.extract_shorelines routine.

Would be grateful for any ideas.

Screenshot 2019-10-06 at 22 34 07
Screenshot 2019-10-06 at 22 34 17
Screenshot 2019-10-06 at 22 34 35

Offline-use after download

Hi Kilian,

Awesome tool! It worked in a jiffy and tried it on my holiday-beach: smooth and easy.
Now. I wanted to work off-line after I download the data but I see you initialise the Google Earth Engine toolbox also if you just want to load the metadata. I think this is not necessary. There is just a tiny change needed for this and I don't think it is worth to make a pull-request etc.

Can you move;
ee.Initialize()

within
def retrieve_images(inputs):

Then you only initialise the server when it is really needed. For the users, it then becomes
from coastsat.SDS_download import get_metadata to work offline... (small detail)

Cheers,

Erwin

Broken GDAL package

Hi Kilian,

Im so sorry, i know that Issue #15 is closed but im facing the same problem with *TypeError: in method 'CoordinateTransformation_TransformPoints', argument 1 of type 'OSRCoordinateTransformationShadow '
I runned the example.py before and it was all good. But now t doesnt work i dont know why. I cleaned it all and re-installed the CoastSat environment several times, and still not working. :(

Any clues?
TypeError Traceback (most recent call last)
in
1 get_ipython().run_line_magic('matplotlib', 'qt')
----> 2 output = SDS_shoreline.extract_shorelines(metadata, settings)

~\Anaconda3\Scripts\Coast\coastsat\SDS_shoreline.py in extract_shorelines(metadata, settings)
773
774 # process the water contours into a shoreline
--> 775 shoreline = process_shoreline(contours_mwi, cloud_mask, georef, image_epsg, settings)
776
777 # visualise the mapped shorelines, there are two options:

~\Anaconda3\Scripts\Coast\coastsat\SDS_shoreline.py in process_shoreline(contours, cloud_mask, georef, image_epsg, settings)
413 contours_world = SDS_tools.convert_pix2world(contours, georef)
414 # convert world coordinates to desired spatial reference system
--> 415 contours_epsg = SDS_tools.convert_epsg(contours_world, image_epsg, settings['output_epsg'])
416 # remove contours that have a perimeter < min_length_sl (provided in settings dict)
417 # this enables to remove the very small contours that do not correspond to the shoreline

~\Anaconda3\Scripts\Coast\coastsat\SDS_tools.py in convert_epsg(points, epsg_in, epsg_out)
140 # iterate over the list
141 for i, arr in enumerate(points):
--> 142 points_converted.append(np.array(coordTransform.TransformPoints(arr)))
143 elif type(points) is np.ndarray:
144 points_converted = np.array(coordTransform.TransformPoints(points))

~\Anaconda3\lib\site-packages\osgeo\osr.py in TransformPoints(self, *args)
1286 def TransformPoints(self, *args):
1287 """TransformPoints(CoordinateTransformation self, int nCount)"""
-> 1288 return _osr.CoordinateTransformation_TransformPoints(self, *args)
1289
1290 CoordinateTransformation_swigregister = _osr.CoordinateTransformation_swigregister

TypeError: in method 'CoordinateTransformation_TransformPoints', argument 1 of type 'OSRCoordinateTransformationShadow *'

Thank you

Juliana

metadata = SDS_download.retrieve_images(inputs)

TimeoutError Traceback (most recent call last)
in
----> 1 metadata = SDS_download.retrieve_images(inputs)

~\Desktop\P work\CoastSat-master\coastsat\SDS_download.py in retrieve_images(inputs)
76
77 # initialise connection with GEE server
---> 78 ee.Initialize()
79
80 # check image availability

~\Anaconda3\envs\coastsat\lib\site-packages\ee_init_.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key)
103 cloud_api_key=cloud_api_key)
104 # Initialize the dynamically loaded functions on the objects that want them.
--> 105 ApiFunction.initialize()
106 Element.initialize()
107 Image.initialize()

~\Anaconda3\envs\coastsat\lib\site-packages\ee\apifunction.py in initialize(cls)
150 """Initializes the list of signatures from the Earth Engine front-end."""
151 if not cls._api:
--> 152 signatures = data.getAlgorithms()
153 api = {}
154 for name, sig in signatures.items():

~\Anaconda3\envs\coastsat\lib\site-packages\ee\data.py in getAlgorithms()
648 is not specified.
649 """
--> 650 return send_('/algorithms', {}, 'GET')
651
652

~\Anaconda3\envs\coastsat\lib\site-packages\ee\data.py in send_(path, params, opt_method, opt_raw)
1159 return response, content
1160
-> 1161 response, content = send_with_backoff()
1162
1163 # Call the profile hook if present. Note that this is done before we handle

~\Anaconda3\envs\coastsat\lib\site-packages\ee\data.py in send_with_backoff(retries)
1150 try:
1151 response, content = http.request(
-> 1152 url, method=opt_method, body=payload, headers=headers)
1153 if response.status == 429:
1154 if retries < MAX_RETRIES:

~\Anaconda3\envs\coastsat\lib\site-packages\oauth2client\transport.py in new_request(uri, method, body, headers, redirections, connection_type)
157 _LOGGER.info('Attempting refresh to obtain '
158 'initial access_token')
--> 159 credentials._refresh(orig_request_method)
160
161 # Clone and modify the request headers to add the appropriate

~\Anaconda3\envs\coastsat\lib\site-packages\oauth2client\client.py in _refresh(self, http)
747 """
748 if not self.store:
--> 749 self._do_refresh_request(http)
750 else:
751 self.store.acquire_lock()

~\Anaconda3\envs\coastsat\lib\site-packages\oauth2client\client.py in _do_refresh_request(self, http)
778 resp, content = transport.request(
779 http, self.token_uri, method='POST',
--> 780 body=body, headers=headers)
781 content = _helpers._from_bytes(content)
782 if resp.status == http_client.OK:

~\Anaconda3\envs\coastsat\lib\site-packages\oauth2client\transport.py in request(http, uri, method, body, headers, redirections, connection_type)
280 return http_callable(uri, method=method, body=body, headers=headers,
281 redirections=redirections,
--> 282 connection_type=connection_type)
283
284

~\Anaconda3\envs\coastsat\lib\site-packages\httplib2_init_.py in request(self, uri, method, body, headers, redirections, connection_type)
1989 headers,
1990 redirections,
-> 1991 cachekey,
1992 )
1993 except Exception as e:

~\Anaconda3\envs\coastsat\lib\site-packages\httplib2_init_.py in _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey)
1649
1650 (response, content) = self._conn_request(
-> 1651 conn, request_uri, method, body, headers
1652 )
1653

~\Anaconda3\envs\coastsat\lib\site-packages\httplib2_init_.py in _conn_request(self, conn, request_uri, method, body, headers)
1555 try:
1556 if conn.sock is None:
-> 1557 conn.connect()
1558 conn.request(method, request_uri, body, headers)
1559 except socket.timeout:

~\Anaconda3\envs\coastsat\lib\site-packages\httplib2_init_.py in connect(self)
1389 break
1390 if not self.sock:
-> 1391 raise socket_err
1392
1393

~\Anaconda3\envs\coastsat\lib\site-packages\httplib2_init_.py in connect(self)
1322 if has_timeout(self.timeout):
1323 sock.settimeout(self.timeout)
-> 1324 sock.connect((self.host, self.port))
1325
1326 self.sock = self._context.wrap_socket(sock, server_hostname=self.host)

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

potential cloud mask issue?

@kvos -

See attached for quick test case from south coast of WA (Parry's Beach, near Denmark). Seems like the beach pixels in the majority of the images are being masked out (e.g., 2015-02-23_L8 and 2015-10-21_L8), however, some images are still processed normally (e.g. 2016-06-01_L8).

I have tried this for a few other locations along the SW coast and seem to get the same issue, but have yet to see this for other test locations (i.e. Mandurah). Maybe an issue with how the cloud mask is applied or calculated ?

SouthCoast_WA_examples.zip

Linking CoastSat to GEE server

Hi,
I am trying to run your script but I seem to be stuck on earthengine authenticate , it says it is not recognised as an internal or external command. I m not an experienced programmer I am just ok at following instructions when they are very detailled. Any idea why I cannot link ee to anaconda please?
Thank you
Jerome

Question regarding georeferencing

Hi all, I got a question regarding georeferencing in CoastSat.
in Vos et al (2019) it says the following:

"It should be noted that the images are orthorectified by the data
provider and no further geometric correction (i.e. co-registration) is
applied in CoastSat. The georeferencing accuracy of each image is stored
in the output file containing the mapped shorelines
. "

Now, when I download some L5 images I can see the following in the .txt file, for example:
filename 2003-09-25-14-48-35_L5_Location1.tif
acc_georef 4.633
epsg 32618

Now the question:
Does this mean that the georeferencing accuracy is 4.63 meters in this image? or is this 4.63 some factor?
I saw in some part of the code, file SDS_download.py, the following
"acc_georef.append(12) # default value of accuracy (RMSE = 12m)", so I'm guessing that the 4.63 is also in meters.

Thanks in advance for the help.

Daniel

How to pull the latest updates

Hi,
I was double checking things and have been also looking into some updates here.
I have seen the following update about 20 days ago:
update SDS_prepocess.py

Could you please advise if I need to update something in the master folder because of this?

Best regards

earth engine not registered/initializing

Hey Killian (or other moderators).
stoked on the tool, but having trouble running the example.py and I think it's related to the google earth engine initialization. Following Issue #28 i ran from the command line and re-activated the google earth-engine, and still ended up with an initialization error.

I think it's primarily a earth engine trouble, so i posted on stack overflow. Maybe you have some insight, or it might be helpful for others to see

Stack question here:
https://stackoverflow.com/questions/58053386/trouble-initalizing-google-earth-engine

Issue linking to GEE server

Hi!

When running the example at the third part or the code to retrieve satellite images from GEE. "metadata = SDS_download.retrieve_images(inputs)" it return an error.

The error returned is:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

I have already followed the steps suggested in erros #39, #41 and #40. And still I'm not correctly linked to the GEE server.

I requested access directly to Earth Engine yesterday and promptly received an email conceding access to the following products:

  • Earth Engine Code Editor - the primary Earth Engine development environment.
  • Earth Engine API - including our Python library.
  • Earth Engine Explorer - a graphical user interface.
    (I can already open the API and all, so I presume that this is fine)

I'm using Windows.

Thanks!

Coastline extraction from Planet Images

Hello! Congratulations for Coast Sat, I really like it. I have a question for you. Is it possible somehow to extract coastlines from Planet Imagery? I already have some images saved in my laptop. What changes should I try in the code? I tried to run it as it is and I have an error message 'no L7 images'.

Thank you

Installation/Initialization errors on MacOS

Hey Killian,

I've just begun the process of using CoastSat for my local east coast Florida site. For reference, I'm doing this on MacOS 10.14. In following your nicely laid out installation/initialization steps in the readme, I ran into trouble when your line to create a new environment (i.e. "conda env create -f environment.yml -n coastsat") threw me an error. To fix this, and to make it through the step of linking my GEE credentials to the Python API, I had to do the following:

  1. Create the new environment within the folder containing CoastSat using conda create --name coastsat
  2. Install python and pip within the new environment using conda install pip
  3. Install the GEE python library using pip install earthengine-api
  4. Do earthengine-authenticate and follow the steps in the readme to authenticate

I'm not sure if this is a general MacOS issue, or one specific to my system, but I figured I post in case anyone else runs into the same issue.

-Matt Conlin

Duplicate of #18

Hi,
When trying to type the following "conda env create -f environment.yml -n coastsat" in the same folder as "environment.yml" exists which is in master folder
.........CoastSat-master>conda env create -f environment.yml -n coastsat
a message appears as
CondaValueError: prefix already exists: C:\Users........\Anaconda3\envs\coastsat

Any idea why this happens?

Linking CoastSat to GEE server

Hi Kilian, Shanghai from China here.

Thank you very much and the free tools provided by your team.

I am trying to run your script but after I copy the authorization code into the Anaconda terminal , it says "NameError:name "urllib2"is not defined"and"TimeoutError:[WinError 10060] The connection attempt failed because the connected party did not respond correctly after a certain period of time or the connected host did not respond.".

For programming, I am just a rookie just getting started.I don't know if the reason is because I am online in China...Can you help me ?

Sincere regards!!

Cannot locate module 'coastsat'

Followed the README:
created new env and activated 'coastsat' via .yml
tried in both Jupyter and Spyder, continue to get error when attempting to import the required scripts from 'coastsat'

from coastsat import SDS_download, SDS_preprocess, SDS_shoreline, SDS_tools, SDS_transects

"No module named coastsat"

When running via jupyter:

EEException                               Traceback (most recent call last)
<ipython-input-3-81739100d1f3> in <module>
----> 1 metadata = SDS_download.retrieve_images(inputs)

~/Downloads/CoastSat-master/coastsat/SDS_download.py in retrieve_images(inputs)
     98 
     99     # initialise connection with GEE server
--> 100     ee.Initialize()
    101 
    102     # read inputs dictionnary

~/anaconda3/envs/coastsat/lib/python3.7/site-packages/ee/__init__.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key)
    103       cloud_api_key=cloud_api_key)
    104   # Initialize the dynamically loaded functions on the objects that want them.
--> 105   ApiFunction.initialize()
    106   Element.initialize()
    107   Image.initialize()

~/anaconda3/envs/coastsat/lib/python3.7/site-packages/ee/apifunction.py in initialize(cls)
    150     """Initializes the list of signatures from the Earth Engine front-end."""
    151     if not cls._api:
--> 152       signatures = data.getAlgorithms()
    153       api = {}
    154       for name, sig in signatures.items():

~/anaconda3/envs/coastsat/lib/python3.7/site-packages/ee/data.py in getAlgorithms()
    648                 is not specified.
    649   """
--> 650   return send_('/algorithms', {}, 'GET')
    651 
    652 

~/anaconda3/envs/coastsat/lib/python3.7/site-packages/ee/data.py in send_(path, params, opt_method, opt_raw)
   1194     # error above rather than this generic one.
   1195     raise ee_exception.EEException(
-> 1196         'Server returned HTTP code: %d' % response.status)
   1197 
   1198   # Now known not to be an error response...

EEException: Server returned HTTP code: 404

Linking CoastSat to GEE server [HTTP error 404]

When running the example at the third part or the code to retrieve satellite images from GEE. "metadata = SDS_download.retrieve_images(inputs)" it return an error.

The error code returned is:

~\AppData\Local\Continuum\anaconda3\envs\coastsat\lib\site-packages\ee\data.py in send_(path, params, opt_method, opt_raw)
1194 # error above rather than this generic one.
1195 raise ee_exception.EEException(
-> 1196 'Server returned HTTP code: %d' % response.status)
1197
1198 # Now known not to be an error response...

EEException: Server returned HTTP code: 404

Any help will be greatly appreciated.
Thank you

Download Tier 2 images for remote locations

Hi Kilian,

I'm trying to apply the CoastSat for my study area (Fernando de Noronha Archipelago, PE, Brazil), but no image was found/downloaded. I've already tested some different periods, satellites and polygons, but without results.

However, I found many Landsat images for this area available by the USGS. On the Earth Explorer page, I did the search using the same time period and only looking for Landsat Collection 1 Level-1 (data sets). It found many images with their names end in T2. Then, I don't know if they are Tier 1 or Tier 2 images. And I don't know why they aren't find by the CoastSat (from the GEE). Do you know what could be happening or how can I solve this problem?

I'm running the script in jupyter notebook (Windows system). My polygon is located on 25S UTM zone and it's around 5 km2. I'm attaching the screen shots that show the settings and the error message.

Thank you.

settings

error

conda activate versus source activate

In my machine one has to use source activate, not conda activate

mosa@parti-mosa:~/CoastSat$ conda activate coastsat

CommandNotFoundError: 'activate is not a conda command.
Did you mean 'source activate'?

mosa@parti-mosa:~/CoastSat$ source activate coastsat

(coastsat) mosa@parti-mosa:~/CoastSat$

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.