Comments (14)
@huyquangt
I don't know what is causing that error, I was not able to reproduce it and line 207 of SDS_download.py doesn't seem to have an invalid syntax. I suggest you go into the /coastsat subfolder and delete the pycache folder. Then open spyder (within the coastsat env) and try to run example.py again.
Let me know how it goes,
from coastsat.
Hi @kvos,
Sorry for a late reply & I have not sorted this out..
The error message only happens with Spyder on Windows (Spyder on Linux works fine). However, on windows, I can run this script using Command Prompt (e.g. python example.py). Therefore, I guess Spyder requires additional packages.
Any more suggestions?
from coastsat.
@huyquangt, my guess would be that Spyder is using python2 instead of python3. Can you run the following commands in Spyder and let us know what you get?
>>> import sys
>>> print(sys.version)
3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
It should be showing python version 3.x, rather than 2.x.
from coastsat.
Hi @chrisleaman ,
my spyder is 3.7.3 actually.
I have reinstalled anaconda, then now example.py can run a halft way ( all files were succesfully downloaded and saved in 'reprocessed' folder), then another error message appears:
Reloaded modules: coastsat, coastsat.SDS_download, coastsat.gdal_merge, coastsat.SDS_preprocess, coastsat.SDS_tools, coastsat.SDS_shoreline, coastsat.SDS_transects
Downloading images:
S2: 7 images
100%
0 pairs of overlapping Sentinel-2 images were merged
Satellite images saved as .jpg in C:\CoastSat-master\data\NARRA\jpg_files\preprocessed
Traceback (most recent call last):
File "", line 1, in
runfile('C:/CoastSat-master/example.py', wdir='C:/CoastSat-master')
File "C:\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
execfile(filename, namespace)
File "C:\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/CoastSat-master/example.py", line 81, in
settings['reference_shoreline'] = SDS_preprocess.get_reference_sl(metadata, settings)
File "C:\CoastSat-master\coastsat\SDS_preprocess.py", line 793, in get_reference_sl
pts_coords = SDS_tools.convert_epsg(pts_sl, image_epsg, settings['output_epsg'])
File "C:\CoastSat-master\coastsat\SDS_tools.py", line 144, in convert_epsg
points_converted = np.array(coordTransform.TransformPoints(points))
File "C:\Anaconda3\lib\site-packages\osgeo\osr.py", line 1288, in TransformPoints
return _osr.CoordinateTransformation_TransformPoints(self, *args)
TypeError: in method 'CoordinateTransformation_TransformPoints', argument 1 of type 'OSRCoordinateTransformationShadow *'
from coastsat.
Can we check which versions of the packages you have installed? Make sure you have the coastsat environment activated (conda activate coastsat
), then can you provide the output of conda list
?
from coastsat.
Yes.. I did run conda activate coastsat and the conda list is attached.
conda_list.txt
from coastsat.
hi @huyquangt , is this error still happening or you found a way around it?
I looked at your conda_list.txt file and you have a lot of packages in there that are not required for CoastSat, some of these may be conflicting with GDAL. I suggest you create a new environment with only the packages listed in environment.yml and try again. Let me know how it goes
from coastsat.
Hi @kvos,
sorry for a late reply as I was working on another task..
I have not solved this problem yet. Attached is the list of packages I am currently having after activating coastsat program.
Another error message comes out when I specify several satellite at the same time below is also attached.
Traceback (most recent call last):
File "", line 1, in
runfile('C:/CoastSat-master/example.py', wdir='C:/CoastSat-master')
File "C:\Anaconda3\envs\coastsat\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Anaconda3\envs\coastsat\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/CoastSat-master/example.py", line 53, in
metadata = SDS_download.retrieve_images(inputs)
File "C:\CoastSat-master\coastsat\SDS_download.py", line 207, in retrieve_images
print('\r%d%%' % (int(((i+1)/n_img)*100)), end='')
UnboundLocalError: local variable 'i' referenced before assignment
from coastsat.
For example,
For a test, I specify:
#date range
dates = ['2012-04-01', '2012-05-01']
# Sat missions
sat_list = ['L5', 'L7', 'L8', 'S2']
The error message is:
File "C:\CoastSat-master\coastsat\SDS_download.py", line 207, in retrieve_images
print('\r%d%%' % (int(((i+1)/n_img)*100)), end='')
UnboundLocalError: local variable 'i' referenced before assignment
from coastsat.
I don't really know what may be going wrong here as the line that you mention is correct and is sitting inside a loop for i in range(n_img) so i is always defined. I saw that your coastsat environment still has additional packages that are not needed, since those may be causing conflicts you could run conda clean -all
and then re-install the CoastSat environment.
from coastsat.
Ok... it is solved....thanks kvos..
from coastsat.
ok, just out of curiosity, what solved the problem? re-installing the environment?
from coastsat.
Yes @kvos I deleted everything and downloaded the current codes in GitHub and run new environment.
from coastsat.
perfect, I will close the issue then.
cheers,
Kilian
from coastsat.
Related Issues (20)
- IndexError: list index out of range - when plotting seasonal averages and long term trends HOT 2
- Doesn't plot final seasonal and monthly trend figures HOT 1
- After opening the clash proxy software, some errors message appears HOT 1
- Tidal Correction data error:''value' must be an instance of str or bytes, not a float' HOT 7
- Quick question about water level correction HOT 1
- Problem with GEE HOT 2
- white water border in pixel classification HOT 11
- Axis limits cannot be NaN or Inf HOT 1
- CoastSAT seasonal and monthly average graphs HOT 8
- tidal correction plus setup and runup correction! HOT 2
- fail to digitize a reference shoreline HOT 2
- KeyError: 'dimensions' when retrieving S2 imagery HOT 12
- Spyder: QWidget: Must construct a Qapplication before a Qwidget. HOT 4
- Downloading question and reference shoreline question HOT 3
- Sentinel-2 images failed to download HOT 3
- CoastSat running on Colab: error with the pyfes package HOT 1
- L7 scanline error HOT 6
- Error about SDS_download.retrieve_images(inputs) HOT 1
- Coastsat to work for small atoll island of Tuvalu HOT 1
- Images not downloading HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coastsat.