Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Example input file #68

Closed
csboucher opened this issue Aug 19, 2021 · 16 comments
Closed

No Example input file #68

csboucher opened this issue Aug 19, 2021 · 16 comments

Comments

@csboucher
Copy link

csboucher commented Aug 19, 2021

I am getting a divide by zero error when using negative latitude.

./StrainTensor.py -i ../data/Nubia_velzone36S.txt -r 30.0/36.0/-0.1/-30.0 --x-grid-step=0.5 --y-grid-step=0.5 -m='veis' -c
[DEBUG] Reading station coordinates and velocities from ../data/Nubia_velzone36S.txt
[DEBUG] Number of stations parsed: 57
[DEBUG] Left with only 0 stations! Cannot do anything
[ERROR] Failed to parse region argument "30.0/36.0/-0.1/-30.0"
Traceback (most recent call last):
File "./StrainTensor.py", line 407, in
mean_lon = degrees(sum([ x.lon for x in sta_list_ell ]) / len(sta_list_ell))
ZeroDivisionError: integer division or modulo by zero

@xanthospap
Copy link
Contributor

Hi, thanks for your question,

it seems that after parsing the input file (where 57 station records have been parsed), the software tries to find any stations falling within the rectangle defined by the coordinates 30.0/36.0/-0.1/-30.0 (in longitude and latitude). The software fails to actually find any station which falls within this region. Is that incorrect? Do you actually have stations within this region in the input file? If so, could you please provide us with the input file so that we can further investigate what is going on?

Xanthos

@csboucher
Copy link
Author

Nubia_velzone36S.txt

I had to separate my data to be calculated for each UMT zone, this will effect the strain rate solution but I couldn't find a way to do calculations in different zones. I also can't get -m='shen' to work only the 'veis.'

@xanthospap
Copy link
Contributor

thanks for the file,

you are correct, computations between zones are still to be addressed. We will look into it and come up with a solution; what is the actual regions limits you are interested in (30.0/36.0/-0.1/-30.0 is only a portion i suppose)?

@csboucher
Copy link
Author

csboucher commented Aug 21, 2021

I am looking at the East African Rift System so mainly zones 35-38 north and south. There are a few stations in zone 34 but those are less important. There are about 200 stations in total.

@xanthospap
Copy link
Contributor

xanthospap commented Aug 22, 2021

Hi there,

here is a quick fix for the problem discussed:
go to the file pystrain/pystrain/geodesy/utm.py and comment out the line nr 137 (aka the line Zone *= -1e0).
Re-install the pystrain package (aka go to the folder StrainTool/pystrain and execute the command sudo python setup.py install).

Now you should be able to estimate the strain tensors for the whole region (also using the 'shen' method). E.g., with the changes mentioned, i can successfully run: ./StrainTensor.py -i ../data/Nubia_velzone36S.txt --x-grid-step=0.5 --y-grid-step=0.5 -c --multicore

The software now 'forces' all stations to be translated to UTM coordinates relative to a single UTM zone. That could introduce small distortions in case the stations are too far away (but that does not seem to be the case). Please let me know if that looks ok.

Xanthos

@xanthospap
Copy link
Contributor

@csboucher

please pull the branch origin/bug68, re-install the pystrain package and let me know if this bugfix fixes the problem. The issue is discussed #69 , where a little more detailed is provided regarding the pull/install.

let me know if that fixes the problem.

Xanthos

@csboucher
Copy link
Author

Sorry for the delay in response.

I have pulled/installed the new files and am still getting an issue, after I run the StrainTensor.py the strain_info.dat file is empty. I am trying to run my entire area (UMT zone 35-38). I may have misunderstood and the script may still only work for singular UMT zones and not across 4. I am attaching my input file, the output files and the error I am receiving. I am going to try and run these for a smaller area and see if there is still an issue.

Error:[DEBUG] Using multithreaded version; available CPU's: 12
[DEBUG] Reading station coordinates and velocities from ../data/Nubia_vel.txt
[DEBUG] Number of stations parsed: 193
[DEBUG] Grid Information:
[DEBUG] Longtitude : from 25.53924 to 49.03924 with step 0.5 (deg)
[DEBUG] Latitude : from -28.83769 to 21.66231 with step 0.5 (deg)
[DEBUG] Number of Strain Tensors to be estimated: 4747
[DEBUG] Estimating strain tensors in multi-threading mode
Process Process-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
Process Process-2:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
Process Process-3:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 114, in run
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self.args, **self.kwargs)
File "./StrainTensor.py", line 127, in compute

self._target(*self.args, **self.kwargs)
File "./StrainTensor.py", line 127, in compute

self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 114, in run
Process Process-4:
self._target(*self.args, **self.kwargs)
File "./StrainTensor.py", line 127, in compute

Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
sstr = ShenStrain(E, N, clat<0e0, sta_list_utm, **dargs)
sstr = ShenStrain(E, N, clat<0e0, sta_list_utm, **dargs)
TypeError: init() takes at most 4 arguments (22 given)
TypeError: init() takes at most 4 arguments (22 given)
sstr = ShenStrain(E, N, clat<0e0, sta_list_utm, **dargs)
TypeError: init() takes at most 4 arguments (22 given)
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self.args, **self.kwargs)
File "./StrainTensor.py", line 127, in compute

sstr = ShenStrain(E, N, clat<0e0, sta_list_utm, **dargs)
TypeError: init() takes at most 4 arguments (22 given)
[DEBUG] Total running time: 0.05 sec.
Nubia_vel.txt

@csboucher csboucher reopened this Aug 23, 2021
@xanthospap
Copy link
Contributor

@csboucher ,

i made a few changes at the source code and hopefully it should be ok. I was able to run the example dataset you attached, using the command ./StrainTensor.py -i ../data/Nubia_vel.txt --x-grid-step=0.5 --y-grid-step=0.5 -c and produce parameters for 1552 strain tensors. Please pull the changes, re-install the pystrain package and give it a try.

I am not sure it will work though; i can see from the error messages you attach, that you use python2.x. I am currently out of office and i can only try the program in my own personal pc where i only have python 3.x available. I will have access to a 2.x version the following week.

Give it a try and let me know how it goes. I attach the resulting strain_info.dat file; i can see that various tensors have been estimated but unfortunately i cannot tell if they make any sense.

Xanthos

strain_info.nubia.txt

@csboucher
Copy link
Author

I pulled the new code from the bug68, switched which python to 3.7, installed and am still getting the same error with both -m='shen' and -m='veis'

File "./StrainTensor.py", line 128, in compute__
sstr = ShenStrain(E, N, clat<0e0, sta_list_utm, **dargs)
TypeError: init() takes at most 4 arguments (22 given)

@xanthospap
Copy link
Contributor

@csboucher ,

that is kind of weird .... i tried cloning the repository and installing bug68 and everything seems to work. What is the version of python you use (aka the result from the command python --version)? Did you re-install the pystrain package with the correct python version (aka something like sudo python 3.x setup.py install)? Could you maybe clone the repository from the start using the latest python version you have available (you can leave this one as is, and clone the repository in a different folder, install pystrain and try running). Sorry for this, but i cannot understand what else is causing the problem. Just make sure that sudo python 3.x setup.py install is executed without errors.

I can only imagine that the error is caused by some kind of mismatch between python versions/installed packages. Unfortunately, i cannot try the changes out, in a different python version, until Monday.

Xanthos

@csboucher
Copy link
Author

I am now using python 3.9.1 but everything is screwy now with my python paths and the script wont even output the stations.dat file.

I am going to hopefully get my paths, packages and modules solved in the next day or so. I will let you know if the code indeed runs after that.

@csboucher
Copy link
Author

Would you be able to give me the station_info.Nubia.txt and the station_stats.Nubia.txt so that I can plot up the maps to see the output? I am getting no return files and the same error running python in a new environment.

This is what I get when I run python setup.py install
/usr/local/lib/python3.9/site-packages/setuptools/dist.py:461: UserWarning: Normalizing '1.0-r1' to '1.0.post1'
warnings.warn(tmpl.format(**locals()))
running install
running bdist_egg
running egg_info
error: [Errno 13] Permission denied
(base) clapp-210-188:pystrain chloe$ sudo python setup.py install
Password:
Sorry, try again.
Password:
/Users/chloe/opt/anaconda3/lib/python3.8/site-packages/setuptools/dist.py:461: UserWarning: Normalizing '1.0-r1' to '1.0.post1'
warnings.warn(tmpl.format(**locals()))
running install
running bdist_egg
running egg_info
writing pystrain.egg-info/PKG-INFO
writing dependency_links to pystrain.egg-info/dependency_links.txt
writing requirements to pystrain.egg-info/requires.txt
writing top-level names to pystrain.egg-info/top_level.txt
reading manifest file 'pystrain.egg-info/SOURCES.txt'
writing manifest file 'pystrain.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.9-x86_64/egg
running install_lib
running build_py
creating build/bdist.macosx-10.9-x86_64
creating build/bdist.macosx-10.9-x86_64/egg
creating build/bdist.macosx-10.9-x86_64/egg/pystrain
copying build/lib/pystrain/grid.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain
creating build/bdist.macosx-10.9-x86_64/egg/pystrain/iotools
copying build/lib/pystrain/iotools/init.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain/iotools
copying build/lib/pystrain/iotools/iparser.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain/iotools
copying build/lib/pystrain/init.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain
copying build/lib/pystrain/station.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain
creating build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy
copying build/lib/pystrain/geodesy/crdtrans.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy
copying build/lib/pystrain/geodesy/ellipsoid.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy
copying build/lib/pystrain/geodesy/init.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy
copying build/lib/pystrain/geodesy/utm.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy
copying build/lib/pystrain/strain.py -> build/bdist.macosx-10.9-x86_64/egg/pystrain
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/grid.py to grid.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/iotools/init.py to init.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/iotools/iparser.py to iparser.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/init.py to init.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/station.py to station.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy/crdtrans.py to crdtrans.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy/ellipsoid.py to ellipsoid.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy/init.py to init.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/geodesy/utm.py to utm.cpython-38.pyc
byte-compiling build/bdist.macosx-10.9-x86_64/egg/pystrain/strain.py to strain.cpython-38.pyc
creating build/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying pystrain.egg-info/PKG-INFO -> build/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying pystrain.egg-info/SOURCES.txt -> build/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying pystrain.egg-info/dependency_links.txt -> build/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying pystrain.egg-info/requires.txt -> build/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying pystrain.egg-info/top_level.txt -> build/bdist.macosx-10.9-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/pystrain-1.0.post1-py3.8.egg' and adding 'build/bdist.macosx-10.9-x86_64/egg' to it
removing 'build/bdist.macosx-10.9-x86_64/egg' (and everything under it)
Processing pystrain-1.0.post1-py3.8.egg
Copying pystrain-1.0.post1-py3.8.egg to /Users/chloe/opt/anaconda3/lib/python3.8/site-packages
Adding pystrain 1.0.post1 to easy-install.pth file

Installed /Users/chloe/opt/anaconda3/lib/python3.8/site-packages/pystrain-1.0.post1-py3.8.egg
Processing dependencies for pystrain==1.0.post1
Searching for scipy==1.6.2
Best match: scipy 1.6.2
Adding scipy 1.6.2 to easy-install.pth file

Using /Users/chloe/opt/anaconda3/lib/python3.8/site-packages

This all looks good to me, but I am still getting this error in the output

Using /Users/chloe/opt/anaconda3/lib/python3.8/site-packages
Finished processing dependencies for pystrain==1.0.post1
(base) clapp-210-188:pystrain chloe$ cd ..
(base) clapp-210-188:StrainTool-bug68 chloe$ cd bin
(base) clapp-210-188:bin chloe$ ./StrainTensor.py -i ../data/Nubia_vel.txt --x-grid-step=0.5 --y-grid-step=0.5 -c
[DEBUG] Reading station coordinates and velocities from ../data/Nubia_vel.txt
[DEBUG] Number of stations parsed: 193
[DEBUG] Grid Information:
[DEBUG] Longtitude : from 25.53924 to 49.03924 with step 0.5 (deg)
[DEBUG] Latitude : from -28.83769 to 21.66231 with step 0.5 (deg)
[DEBUG] Number of Strain Tensors to be estimated: 4747
Traceback (most recent call last):
File "./StrainTensor.py", line 511, in
compute__(grd, sta_list_utm, lcm, fout, fstats, vprint, **dargs)
File "./StrainTensor.py", line 128, in compute__
sstr = ShenStrain(E, N, clat<0e0, sta_list_utm, **dargs)
TypeError: init() takes at most 4 arguments (22 given)

@xanthospap
Copy link
Contributor

hi @csboucher ,
strain_stats.txt
strain_info.txt
station_info.txt

sorry for my late reply; i just got back to office and can now test various things on the software. I attach the output files from running the command ./StrainTensor.py -i ../data/Nubia_vel.txt --x-grid-step=0.5 --y-grid-step=0.5 -c -g. Let me know it the results seems ok.

I will also try to figure out what is going on with the python versioning and get back to you as soon as possible.

Xanthos

@csboucher
Copy link
Author

I am running python 3.9.1 and fixed my pyqt on python 2.7 but I am getting the same error where it says:

init() takes at most 4 arguments (22 given)

demanasta added a commit that referenced this issue Sep 8, 2021
@demanasta
Copy link
Contributor

hi @csboucher

We checked the operation of the software in python2.7, 3.8 and 3.9 but we were not able to recreate the error presented to you. Check if there is any conflict with the different versions you have installed. The pystrain setup should be installed with the version that the system uses as default. Maybe you have installed python 3.9.1 but the system default version is python 2.7.

Dimitris
ps. I attach our last results produced with your data
nubia-station_info.dat.txt
nubia-strain_stats.dat.txt
nubia-strain_info.dat.txt
nubia-output_str

@demanasta demanasta mentioned this issue Sep 11, 2021
4 tasks
demanasta added a commit that referenced this issue Sep 11, 2021
@csboucher
Copy link
Author

This must be user error on my part if it is working for all of you professional coders as DOS.

Thank you so much for your quick responses and altering the code to accommodate multiple UMT zones. I have closed this ticket and will continue to work on my python versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants