kvos / CoastSat

Global shoreline mapping tool from satellite imagery
http://coastsat.wrl.unsw.edu.au/
GNU General Public License v3.0
667 stars 245 forks source link

Multiple date range #83

Closed sac3g15 closed 3 years ago

sac3g15 commented 4 years ago

Is your feature request related to a problem? Please describe. Are you able to input more than one date range in the image download section. In [2]. E.g. dates = (['1983-12-01', '1990-04-01'] , ['2008-12-01', '2012-04-01']

kvos commented 4 years ago

this would be a cool enhancement and shouldn't be too hard, only needs to modify one function SDS_download.retrieve_images(). I would add to this an option to check which images have already been downloaded in the /data folder so that it is not repeating some downloads. If you want to have a go and submit a pull request that would be much appreciated!

sac3g15 commented 4 years ago

Unfortunately my coding skills are very basic at the moment to I was unable to change code within the SDS_download.retrieve_images(). Instead, I have created a list of dates, then looped through them during the download section of the code.

sac3g15 commented 4 years ago

On a separate note, I would like to thank you for producing such a easy-to-use and freely available code to digitise coastlines. It is a fantastic tool! I notice there is a field in the final .geojson file 'geoaccuracy'. After looking through the documents I have been unable to find out how this derived, do you have this information? Many thanks

firmanhadi commented 4 years ago

Thank you for providing us with a tool that makes our job easier. I am also waiting for this enhancement. We are doing research on this topic, but we use a conservative method. We use GEE to select and download images every 5 years since 1980 to 2020. So, if we can use CoastSat with multiple date range, it will be awesome.

Arnaud121187 commented 4 years ago

hi everyone i have been working on coastsat for a while without success. in fact I work on a project whose the main objective is to forecast the evolution of the Cameroonian shoreline which will allow us to anticipate on a possible risk of coastal erosion in the future on the Cameroonian coastline for better coastal management . It is a very important subject because the Cameroonian coast has a very important part in the contribution of the economy of the country and the coastal erosion through the evolution of the shorline constitutes a brake for the development of the economic activities of this part of the country. it is therefore important that I make my contribution on the forecasting of the Cameroonian shoreline.

therefore to achieve my goal it was question that I test the shorefor model with video camera data already existing on the Cameroonian coast more particularly on the coast of Kribi. But unfortunately the available camera data is insufficient to run the model and have satisfactory results and moreover there was a lot of missing value on the camera data.

in my research I read a lot of article where you are author and co-author and I found that I had first a problem that of the insufficient data of wave climate and shoreline or I needed data of at least 5 years in inputs or I only had one year camera data with a lot of missing value.

in my research always I therefore download the erainterim wave data (Hs, Tp) from 2015 to 2019 and currently I am looking to download the shoreline data at the same date.

in my research on how to have shoreline data, I found the existence of google earth engine which is brand new for months but I made a lot of research effort and I knew the existence of coastsat.

this is the beginning of my problems.😀 My concern is to obtain a time series of variations from shore to shore. I pushed my research a bit and I came across Coastsat which is a toolbox on Anaconda which outputs the time series of the coastline through a well defined code on jupyter. So I installed and activated coastsat on anaconda. I used the code on jupyter contained in the coastsat folder to try to execute the kribi zone delimited on Google earth engine ... Since then I have no solution because just after I execute the code which downloads the images I only have the memory errors that appear when I execute the next code after downloading the satellite images. I think that is because my computer has low performances (I have 4 GB of RAM).

I really need help through your powerful computers in your laboratory I do not know if it was possible to solve this problem remotely so that I can test the shorefor model with data from erainterim and Google earth engine and have satisfactory results when I run the model.

that is really my concern.

here I show you my code I am blocked I can no longer advance

import os import numpy as np import pickle import warnings warnings.filterwarnings("ignore") import matplotlib.pyplot as plt from coastsat import SDS_download, SDS_preprocess, SDS_shoreline, SDS_tools, SDS_transects

region of interest (longitude, latitude in WGS84)

polygon = [[[9.90220072636717,2.935583493654297], [9.90494730839842,2.9362692378968904], [9.903574017382795,2.9386693394301435], [9.90117075810545,2.9386693394301435], [9.90220072636717,2.935583493654297]]]

date range

dates = ['2015-10-01', '2019-12-31']

satellite missions

sat_list = ['S2']

name of the site

sitename = 'KRIBI'

filepath where data will be stored

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

put all the inputs into a dictionnary

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

before downloading the images, check how many images are available for your inputs

SDS_download.check_images_available(inputs);

inputs['include_T2'] = True

metadata = SDS_download.retrieve_images(inputs)

settings = {

general parameters:

'cloud_thresh': 0.5,        # threshold on maximum cloud cover
'output_epsg': 32632,       # epsg code of spatial reference system desired for the output   
# quality control:
'check_detection': True,    # if True, shows each shoreline detection to the user for validation
'save_figure': True,        # if True, saves a figure showing the mapped shoreline for each image
# add the inputs defined previously
'inputs': inputs,
# [ONLY FOR ADVANCED USERS] shoreline detection parameters:
'min_beach_area':4500,     # minimum area (in metres^2) for an object to be labelled as a beach
'buffer_size': 150,         # radius (in metres) of the buffer around sandy pixels considered in the shoreline detection
'min_length_sl': 200,       # minimum length (in metres) of shoreline perimeter to be valid
'cloud_mask_issue': False ,  # switch this parameter to True if sand pixels are masked (in black) on many images  
'sand_color': 'default',    # 'default', 'dark' (for grey/black sand beaches) or 'bright' (for white sand beaches)

}

metadata = SDS_download.get_metadata(inputs)

SDS_preprocess.save_jpg(metadata, settings)

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

output = SDS_shoreline.extract_shorelines(metadata, settings)

at this step (output = SDS_shoreline.extract_shorelines(metadata, settings) here is the message that appears:

Mapping shorelines: S2: 0%

MemoryError Traceback (most recent call last)

in ----> 1 output = SDS_shoreline.extract_shorelines(metadata, settings) ~\anaconda\CoastSat-master\coastsat\SDS_shoreline.py in extract_shorelines(metadata, settings) 777 # classify image in 4 classes (sand, whitewater, water, other) with NN classifier 778 im_classif, im_labels = classify_image_NN(im_ms, im_extra, cloud_mask, --> 779 min_beach_area_pixels, clf) 780 781 # there are two options to map the contours: ~\anaconda\CoastSat-master\coastsat\SDS_shoreline.py in classify_image_NN(im_ms, im_extra, cloud_mask, min_beach_area, clf) 146 147 # classify pixels --> 148 labels = clf.predict(vec_features) 149 150 # recompose image ~\anaconda\envs\coastsat\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in predict(self, X) 951 """ 952 check_is_fitted(self, "coefs_") --> 953 y_pred = self._predict(X) 954 955 if self.n_outputs_ == 1: ~\anaconda\envs\coastsat\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in _predict(self, X) 672 for i in range(self.n_layers_ - 1): 673 activations.append(np.empty((X.shape[0], --> 674 layer_units[i + 1]))) 675 # forward propagate 676 self._forward_pass(activations) MemoryError: i really need help. thank you all for your understanding