kmaterna / Strain_2D

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

An error for strain_compare_config.txt #38

Open odito2 opened 3 months ago

odito2 commented 3 months ago

Hi, Thank you again for the software! I tried to compare 3 methods as you can see (on Windows) but received an error. All three were successfully calculated alone. (The txt file name was updated with these 3 methods, therefore received th "Isr" extension.) I'll be happy if you could see why the comparrison didnt workout.

D:\Ariel\Phd\Strain_software\Strain_2D\example>python ..\Strain_Tools\bin\strain_rate_comparison.py strain_compare_config_Isr.txt


Hello! We are comparing strain calculations... Comparing strain from calculations : dict_values(['Output/delaunay', 'Output/loc_avg_grad', 'Output/geostats']) Putting the outputs : Output/_strain_comparison

Traceback (most recent call last): File "D:\Ariel\Phd\Strain_software\Strain_2D\Strain_Tools\bin\strain_rate_comparison.py", line 11, in compare_strain_grids.drive(MyParams); File "C:\Users\Odelya\AppData\Local\Programs\Python\Python310\lib\site-packages\strain_2d-1.1.1-py3.10.egg\strain\compare_strain_grids.py", line 14, in drive mean_dss['max_shear'] = compare_grid_means(MyParams, "max_shear", simple_means_statistics) File "C:\Users\Odelya\AppData\Local\Programs\Python\Python310\lib\site-packages\strain_2d-1.1.1-py3.10.egg\strain\compare_strain_grids.py", line 43, in compare_grid_means strain_values_ds = velocity_io.read_multiple_strain_netcdfs(MyParams, plot_type); File "C:\Users\Odelya\AppData\Local\Programs\Python\Python310\lib\site-packages\strain_2d-1.1.1-py3.10.egg\strain\velocity_io.py", line 144, in read_multiple_strain_netcdfs specific_filename = glob.glob(value + os.sep + '*' + "_strain.nc")[0] IndexError: list index out of range

kmaterna commented 2 months ago

@odito2 hello, sorry for the delay in getting back to you. My guess is that something with os.sep didn't happen correctly... the glob is returning zero files matching the pattern provided, even though you probably have Output/delanauy/delaunay_strain.nc and similar files.

I changed os.sep, and also added more print statements so we might be able to figure out why the glob is returning nothing. Would you be able to pull, install, and run it again?

Commit is here: https://github.com/kmaterna/Strain_2D/commit/ec7b8400df6a09f02fa85fcfaa3ccd67e4e42d92