kmaterna / Strain_2D

Strain rate modeling from GNSS velocity fields
MIT License
43 stars 17 forks source link

error when using visr method #32

Closed fengnian-chang closed 9 months ago

fengnian-chang commented 9 months ago

Hi, Great work! But I encountered an error when applying the vsir method to the test dataset, it says:

/home/gmtsar-user/anaconda3/envs/Strain_2D/bin/strain_rate_compute.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import('pkg_resources').run_script('Strain-2D==1.1.1', 'strain_rate_compute.py')


Hello! We are... Computing strain using : visr Input data from : ../test/testing_data/NorCal_stationvels.txt Calculation range : [-125.0, -120.0, 38.0, 42.0] Putting the outputs : Output/visr/


Reading file ../test/testing_data/NorCal_stationvels.txt 284 stations before applying cleaning. 233 stations after imposing bounding box.


Computing strain via Visr method. VISR executable found at ../contrib/visr/visr.exe Calling visr.exe fortran code to compute strain: ../contrib/visr/visr.exe < visr_strain.drv Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO IEEE_UNDERFLOW_FLAG IEEE_DENORMAL Traceback (most recent call last): File "/home/gmtsar-user/anaconda3/envs/Strain_2D/bin/strain_rate_compute.py", line 4, in import('pkg_resources').run_script('Strain-2D==1.1.1', 'strain_rate_compute.py') File "/home/gmtsar-user/anaconda3/envs/Strain_2D/lib/python3.11/site-packages/pkg_resources/init.py", line 722, in run_script self.require(requires)[0].run_script(script_name, ns) File "/home/gmtsar-user/anaconda3/envs/Strain_2D/lib/python3.11/site-packages/pkg_resources/init.py", line 1561, in run_script exec(code, namespace, namespace) File "/home/gmtsar-user/anaconda3/envs/Strain_2D/lib/python3.11/site-packages/Strain_2D-1.1.1-py3.11.egg/EGG-INFO/scripts/strain_rate_compute.py", line 11, in internal_coordinator.strain_coordinator(MyParams); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gmtsar-user/anaconda3/envs/Strain_2D/lib/python3.11/site-packages/Strain_2D-1.1.1-py3.11.egg/strain/internal_coordinator.py", line 26, in strain_coordinator [Ve, Vn, rot, exx, exy, eyy, vels, resids] = constructed_object.compute(velField); # computing strain ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gmtsar-user/anaconda3/envs/Strain_2D/lib/python3.11/site-packages/Strain_2D-1.1.1-py3.11.egg/strain/models/strain_visr.py", line 27, in compute [Ve, Vn, rot_grd, exx_grd, exy_grd, eyy_grd] = compute_visr(myVelfield, self._strain_range, self._grid_inc, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gmtsar-user/anaconda3/envs/Strain_2D/lib/python3.11/site-packages/Strain_2D-1.1.1-py3.11.egg/strain/models/strain_visr.py", line 80, in compute_visr [Ve, Vn, rot, exx, exy, eyy] = make_output_grids_from_strain_out(strain_output_file, xdata, ydata); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gmtsar-user/anaconda3/envs/Strain_2D/lib/python3.11/site-packages/Strain_2D-1.1.1-py3.11.egg/strain/models/strain_visr.py", line 178, in make_output_grids_from_strain_out rotation.append(float(line[53:60])); ^^^^^^^^^^^^^^^^^^ ValueError: could not convert string to float: '** '

The config file was attached. 05_strain_config_visr.txt

BTW, the DeprecationWarning error was reported when I ran 'python setup.py install'.

kmaterna commented 9 months ago

Hi, thanks for reporting this! I just tested it in a newly-created environment using your config file, and surprisingly I didn't reproduce the bug. Mine worked all the way through outputs. I did reproduce the pgk_resources DeprecationWarning, so I'll work on that in a bit. But I think the IEEE-float/string-to-float error and the DeprecationWarning are separate issues.

The main issue could be deeper. What operating system are you working on, and what did you use to compile visr.f? We might even have different versions of visr.exe or visr.f -- do you think that source code changed recently? If it's an issue with visr fortran code, I don't know how useful I'll be at debugging....

One way to debug: based on the screen output, it looks like you have the main visr output file, Output/visr/strain_output.txt. The rest of my code is just reading/re-packaging the contents of this file. On my system, this file has a ton of strain values, and doesn't have any occurrences of the string '** ' which your system is reading. This suggests to me that visr didn't finish properly on your system, and produced broken output. Could you also upload that output file here?

I wonder also if it might work on a different dataset, just breaking here due to a floating point issue on one specific computer architecture...? I hope that's not the answer.

fengnian-chang commented 9 months ago

@kmaterna Thank you for your prompt response! Some lines in the ./strain_output.txt file have errors, including some string '** ' that shouldn't be there. I've had this problem with other datasets as well. So I think it would be wise for you to let me check the vsir compilation process.

I've worked on the Ubuntu20.0 system and compiled the visr using "gfortran -c voronoi_area_version.f90/gfortran visr.f voronoi_area_version.o -o visr.exe'. The problem is most likely with the vsir version or the compilation, cause I found that the URL provided by visr is now inaccessible (http://scec.ess.ucla.edu/~zshen/visr/visr.html). I could not download the native documentation and program, but instead copied a version from someone else. So could you please provide the visr package and documentation? Thanks in advance.

The visr package I used and strain_intput.txt and strain_output.txt were attached for your reference. strain_input.txt strain_output.txt visr.zip

BTW, pgk_resources DeprecationWarning doesn't seem to affect the strain calculations, as I can still get the results using other methods.

kmaterna commented 9 months ago

Hmm, I also found the visr website to be down. Bummer; Visr is a really great method and I hope you get it working. I'm attaching the source that I downloaded from that website in 2018. It would be fascinating to see a diff of yours vs mine (hopefully nonzero, to have an explanation of this bug)

visr_sending.zip

fengnian-chang commented 9 months ago

Thank you for sharing and helping! It's working now.