mcuttler / coastsat.islands Goto Github PK
View Code? Open in Web Editor NEWSatellite-derived shorelines and 2D planform measurements for islands, extension of the CoastSat toolbox.
License: GNU General Public License v3.0
Satellite-derived shorelines and 2D planform measurements for islands, extension of the CoastSat toolbox.
License: GNU General Public License v3.0
Hi,
I have an issues running the example notebook I have not been able to resolve: coastsat runs fine, but the example .ipynb in coastsat.islands gives an error when running SDS_islands.extract_sand_poly (batch contour detection)
For the coastsat.islands setup I have copied the classification folder from coastsat-master into coastsat.islands and updated the joblib import in the shoreline.py and islands.py script.
I can't figure out if it's not creating the contours correct or If I am missing something else.
Thank you so much, and thanks for this cool work.
Batch contour detection
CELL
%matplotlib qt
output = SDS_islands.extract_sand_poly(metadata, settings)
Exception Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_18888\1560753613.py in
2 get_ipython().run_line_magic('matplotlib', 'qt')
3 #output = SDS_shoreline.extract_shorelines(metadata, settings)
----> 4 output = SDS_islands.extract_sand_poly(metadata, settings)
D:\CRI\coastsat\CoastSat.islands-master\coastsat\SDS_islands.py in extract_sand_poly(metadata, settings)
297
298 # process water contours into shorelines
--> 299 shoreline = SDS_shoreline.process_shoreline(contours_mwi, cloud_mask, georef, image_epsg, settings)
300
301 if settings['check_detection_sand_poly']:
D:\CRI\coastsat\CoastSat.islands-master\coastsat\SDS_shoreline.py in process_shoreline(contours, cloud_mask, georef, image_epsg, settings)
640
641 # convert pixel coordinates to world coordinates
--> 642 contours_world = SDS_tools.convert_pix2world(contours, georef)
643 # convert world coordinates to desired spatial reference system
644 contours_epsg = SDS_tools.convert_epsg(contours_world, image_epsg, settings['output_epsg'])
D:\CRI\coastsat\CoastSat.islands-master\coastsat\SDS_tools.py in convert_pix2world(points, georef)
66
67 else:
---> 68 raise Exception('invalid input type')
69
70 return points_converted
Exception: invalid input type
Hi have error issue in the sklearn module, I also already check in my coastat environment this module has installed but it is still strange keep saying that there are No module named 'sklearn.neural_network.multilayer_perceptron'
System:
python: 3.8.16 (default, Jun 12 2023, 12:55:15) [Clang 14.0.6 ]
executable: /Users/yochi/opt/anaconda3/envs/coastsat/bin/python
machine: macOS-10.16-x86_64-i386-64bit
Python dependencies:
sklearn: 1.2.2
pip: 23.1.2
setuptools: 67.8.0
numpy: 1.24.3
scipy: 1.9.1
Cython: None
pandas: 2.0.2
matplotlib: 3.7.1
joblib: 1.2.0
threadpoolctl: 3.1.0
Built with OpenMP: True
ModuleNotFoundError Traceback (most recent call last)
Cell In[26], line 2
1 get_ipython().run_line_magic('matplotlib', 'qt')
----> 2 output = SDS_islands.extract_sand_poly(metadata, settings)
File ~/Documents/CoastSat-master/coastsat/SDS_islands.py:129, in extract_sand_poly(metadata, settings)
127 elif satname == 'S2':
128 pixel_size = 10
--> 129 clf = joblib.load(os.path.join(filepath_models, 'NN_4classes_S2.pkl'))
131 # convert settings['min_beach_area'] and settings['buffer_size'] from metres to pixels
132 buffer_size_pixels = np.ceil(settings['buffer_size']/pixel_size)
File ~/opt/anaconda3/envs/coastsat/lib/python3.8/site-packages/joblib/numpy_pickle.py:658, in load(filename, mmap_mode)
652 if isinstance(fobj, str):
653 # if the returned file object is a string, this means we
654 # try to load a pickle file generated with an version of
655 # Joblib so we load it with joblib compatibility function.
656 return load_compatibility(fobj)
--> 658 obj = _unpickle(fobj, filename, mmap_mode)
659 return obj
File ~/opt/anaconda3/envs/coastsat/lib/python3.8/site-packages/joblib/numpy_pickle.py:577, in _unpickle(fobj, filename, mmap_mode)
575 obj = None
576 try:
--> 577 obj = unpickler.load()
578 if unpickler.compat_mode:
579 warnings.warn("The file '%s' has been generated with a "
580 "joblib version less than 0.10. "
581 "Please regenerate this pickle file."
582 % filename,
583 DeprecationWarning, stacklevel=3)
File ~/opt/anaconda3/envs/coastsat/lib/python3.8/pickle.py:1212, in _Unpickler.load(self)
1210 raise EOFError
1211 assert isinstance(key, bytes_types)
-> 1212 dispatchkey[0]
1213 except _Stop as stopinst:
1214 return stopinst.value
File ~/opt/anaconda3/envs/coastsat/lib/python3.8/pickle.py:1528, in _Unpickler.load_global(self)
1526 module = self.readline()[:-1].decode("utf-8")
1527 name = self.readline()[:-1].decode("utf-8")
-> 1528 klass = self.find_class(module, name)
1529 self.append(klass)
File ~/opt/anaconda3/envs/coastsat/lib/python3.8/pickle.py:1579, in _Unpickler.find_class(self, module, name)
1577 elif module in _compat_pickle.IMPORT_MAPPING:
1578 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1579 import(module, level=0)
1580 if self.proto >= 4:
1581 return _getattribute(sys.modules[module], name)[0]
ModuleNotFoundError: No module named 'sklearn.neural_network.multilayer_perceptron'
While running settings['reference_shoreline'] = SDS_preprocess.get_reference_sl(metadata, settings) from the coastsat.islands code, it throws the below attribute error.
AttributeError : 'FigureManagerBase' object has no attribut 'window'
I was able to fix the issue by adding matplotlib.use("Qt5Agg") under the function just before plotting the figure.
How can I run coassat library in Rstudio?
I am using Spyder to run the example_islands.py and whenever I try to reference_shorline (line 84 -settings['reference_shoreline'] = SDS_preprocess.get_reference_sl(metadata, settings)) an error shows as soon I select a clear image to digitize the shoreline:
OverflowError: argument 1 overflowed: value must be in the range -2147483648 to 2147483647
I ran the case program in the cosatsat environment that I installed together. But it reports an error that there is no gradual.Is this normal? Is the environment updated?Very much your work for this period!
Hi, I can run coastsat with no problems, but once I try to run the default example (jupyter notebook) on coastsat.islands, I run into the following error at the step "Batch contour detection".
Some details on my config:
-I updated to Matplotlib 3.3.1, but the error persists.
-I copied the coastsat.islands in my coastsat folder, and copied the "classification" folder into the coastsat.islands folder.
Maybe there is another way to "install" the island toolbox.
BTW, this is exceptional work, keep it up!
Error:
ValueError Traceback (most recent call last)
in
1 get_ipython().run_line_magic('matplotlib', 'qt')
----> 2 output = SDS_islands.extract_sand_poly(metadata, settings)
~\Documents\coastsat\CoastSat\CoastSat.islands\coastsat\SDS_islands.py in extract_sand_poly(metadata, settings)
297 if settings['check_detection_sand_poly']:
298 date = filenames[i][:18]
--> 299 skip_image = show_detection_sand_poly(im_ms, cloud_mask, im_labels, im_binary_sand, im_binary_sand_closed,sand_contours, settings, date, satname, regions)
300 # if user decides to skip the image
301 if skip_image:
~\Documents\coastsat\CoastSat\CoastSat.islands\coastsat\SDS_islands.py in show_detection_sand_poly(im_ms, cloud_mask, im_labels, im_binary_sand, im_binary_sand_closed, sand_contours, settings, date, satname, regions)
458 black_line = mlines.Line2D([],[],color='k',linestyle='-', label='shoreline')
459 ax2.legend(handles=[orange_patch,white_patch,blue_patch, black_line],
--> 460 loc='bottom right', fontsize=10)
461 ax2.set_title(date, fontweight='bold', fontsize=16)
462
~\AppData\Local\Continuum\anaconda3\envs\coastsat\lib\site-packages\matplotlib\axes_axes.py in legend(self, *args, **kwargs)
415 if len(extra_args):
416 raise TypeError('legend only accepts two non-keyword arguments')
--> 417 self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
418 self.legend_._remove_method = self.remove_legend
419 return self.legend
~\AppData\Local\Continuum\anaconda3\envs\coastsat\lib\site-packages\matplotlib\legend.py in init(self, parent, handles, labels, loc, numpoints, markerscale, markerfirst, scatterpoints, scatteryoffsets, prop, fontsize, labelcolor, borderpad, labelspacing, handlelength, handleheight, handletextpad, borderaxespad, columnspacing, ncol, mode, fancybox, shadow, title, title_fontsize, framealpha, edgecolor, facecolor, bbox_to_anchor, bbox_transform, frameon, handler_map)
455 raise ValueError(
456 "Unrecognized location {!r}. Valid locations are\n\t{}\n"
--> 457 .format(loc, '\n\t'.join(self.codes)))
458 else:
459 loc = self.codes[loc]
ValueError: Unrecognized location 'bottom right'. Valid locations are
best
upper right
upper left
lower left
lower right
right
center left
center right
lower center
upper center
center
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.