insarlab / PySolid

A Python wrapper for solid Earth tides
GNU General Public License v3.0
63 stars 9 forks source link

grid: empty values in solid.txt file on Windows OS #15

Closed pbrotoisworo closed 2 years ago

pbrotoisworo commented 3 years ago

When running test_SET_grid.py the test fails after running the solid_grid function because the output solid.txt file contains empty values (https://github.com/insarlab/PySolid/issues/12).

Sample of file with empty values:

# program solid -- UTC version -- 2018jun01
# year, month, day = 2020 12 25
# hour, minute, second = 14  7 44
# S, N, W, E =   33.479166795   33.800000000 -118.200000000 -117.796666828
# step_lat, num_lat =   -0.009166663    35
# step_lon, num_lon =    0.009166663    44
,  ,  ,  ,  
,  ,  ,  ,  
,  ,  ,  ,  
,  ,  ,  , 
etc...
jhkennedy commented 2 years ago

@pbrotoisworo I just merged conda-forge/pysolid-feedstock#3 which will provide Windows builds of PySolid (should be able to install it in ~2 hours once their cloudfront cached updates) -- I suspect this issue has not been resolved (focused more on getting the build pipeline working). I'll check later (next week at the earliest), but if you want to test as well, that'd be great.

Likely the best solution for this would be to do #2 so I might poke at it at some point.

pbrotoisworo commented 2 years ago

Sure. I can try running the tests this weekend and I'll share the results here.

pbrotoisworo commented 2 years ago

Hello @jhkennedy and @yunjunz . The new update does not raise the error anymore due to empty solid.txt file.

I was able to try it on my personal device which is running Windows 10. I created a Python 3.8 environment and installed PySolid using conda install -c conda-forge pysolid.

However I do get 'PySolid' is not recognized as an internal or external command, operable program or batch file. after running the script. After poking around, I realized that Windows needs the absolute path of the image to open the file. I think relative paths don't work. So my suggestion is to also revise the code in both tests where it will open the figure. The revised code worked on my Windows machine and was able to open the figure automatically after the test: https://github.com/insarlab/PySolid/blob/e9bad8ebdf63407c6722092c3dfaab766c784660/tests/test_SET_point.py#L42

To this:

os.system(os.path.abspath(out_fig))

Output:

image

image

yunjunz commented 2 years ago

This's great news. It confirms #19 from @jhkennedy does work on Windows, as noted in the conda-forge testing!

For the test script, I would suggest using the absolute path while defining out_fig. @pbrotoisworo could you issue an PR for the two scripts? https://github.com/insarlab/PySolid/blob/e9bad8ebdf63407c6722092c3dfaab766c784660/tests/test_SET_grid.py#L37

yunjunz commented 2 years ago

Close the issue as it's resolved.

Thank you @jhkennedy and @pbrotoisworo for the fixing and testing!