kvos / CoastSat

Global shoreline mapping tool from satellite imagery
http://coastsat.space
GNU General Public License v3.0
696 stars 252 forks source link

error in Shoreline extraction #421

Closed ignasi13 closed 1 year ago

ignasi13 commented 1 year ago

Hi, I'm Ignasi Turne im trying to use coastsat to extract shoreline of my zone of study for my final degree project and I have some error in this part of code, I don't know how solution them, I would greatly appreciate any assistance or information you can provide. Your support will be invaluable to the success of my project! Thanks.

Error in code for Shoreline detection

TypeError Traceback (most recent call last) Input In [12], in <cell line: 1>() ----> 1 SDS_preprocess.save_jpg(metadata, settings)

File ~\Desktop\CiTM_2022_23\TFG\CoastSat-2.2\coastsat\SDS_preprocess.py:589, in save_jpg(metadata, settings, *kwargs) 587 fn = SDS_tools.get_filenames(filenames[i],filepath, satname) 588 # read and preprocess image --> 589 im_ms, georef, cloud_mask, im_extra, im_QA, im_nodata = preprocess_single(fn, satname, settings['cloud_mask_issue'], 590 settings['pan_off'], collection) 592 # compute cloud_cover percentage (with no data pixels) 593 cloud_cover_combined = np.divide(sum(sum(cloud_mask.astype(int))), 594 (cloud_mask.shape[0]cloud_mask.shape[1]))

File ~\Desktop\CiTM_2022_23\TFG\CoastSat-2.2\coastsat\SDS_preprocess.py:244, in preprocess_single(fn, satname, cloud_mask_issue, pan_off, collection) 242 bands = [data.GetRasterBand(k + 1).ReadAsArray() for k in range(data.RasterCount)] 243 im_QA = bands[0] --> 244 cloud_mask = create_cloud_mask(im_QA, satname, cloud_mask_issue, collection) 245 # check if -inf or nan values on any band and create nodata image 246 im_nodata = np.zeros(cloud_mask.shape).astype(bool)

File ~\Desktop\CiTM_2022_23\TFG\CoastSat-2.2\coastsat\SDS_preprocess.py:331, in create_cloud_mask(im_QA, satname, cloud_mask_issue, collection) 328 # remove cloud pixels that form very thin features. These are beach or swash pixels that are 329 # erroneously identified as clouds by the CFMASK algorithm applied to the images by the USGS. 330 if sum(sum(cloud_mask)) > 0 and sum(sum(~cloud_mask)) > 0: --> 331 morphology.remove_small_objects(cloud_mask, min_size=40, connectivity=1, in_place=True) 333 if cloud_mask_issue: 334 elem = morphology.square(6) # use a square of width 6 pixels

TypeError: remove_small_objects() got an unexpected keyword argument 'in_place'

kvos commented 1 year ago

this has been fixed in the latest version, update your code and it should work

ignasi13 commented 1 year ago

Thanks!

El dl, 19 juny 2023 a les 3:59 Kilian Vos @.***> va escriure:

Closed #421 https://github.com/kvos/CoastSat/issues/421 as completed.

— Reply to this email directly, view it on GitHub https://github.com/kvos/CoastSat/issues/421#event-9562719486, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAT7P32JXUGTTBC26JW5FSTXL6XBHANCNFSM6AAAAAAZJPNJVM . You are receiving this because you authored the thread.Message ID: @.***>