Closed isLiYang closed 3 years ago
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
Hi @isLiYang, thanks for filing this bug report! I can reproduce your error, and have tracked down the problem to this section of the code:
The problem is that PyGMT was not handling the NaN values in your dataframe properly. By default, pandas.to_csv
writes out blank '' NaN values, instead of the word NaN to file, but GMT requires an explicit NaN value in the file in order to understand it. The solution is relatively simple, just add na_rep="NaN"
to the track.to_csv` call so that NaN values are printed. I will submit a fix for this bug shortly (edit: done at #1369).
In the meantime, I would suggest using ssh.txt
as input to x2sys_cross for PyGMT v0.4.0. Alternatively, you may also consider doing df = df.dropna()
to remove the NaN values in your lon/lat/ssh dataset, but that would not give you the crossover locations of points with missing values (which may be ok or not ok, depending on what you want to do with your dataset).
Thank you for your reply. I will try to remove NaN values in pandas.Dataframe When using x2sys module, deleting NaN values doesn't affect my calculations. Thank you for your contributions to open source software. @weiji14
Cool, and let us know if you need any other help, or if there's another x2sys
module at https://docs.generic-mapping-tools.org/6.2/modules.html#x2sys you need and we'll put in a feature request :smile:
P.S. I'll reopen this issue until the bugfix at #1369 is incorporated to PyGMT's main branch.
@weiji14 😁 Haha. That sounds great, but I don't need any of the other functions of x2sys module right now. It is better to develop some commonly used functions first.
Description of the problem When I using the x2sys_cross function, passing a pandas.DataFrame I got no result return. However, passing an ASCII file the the program works fine. I don't know what went wrong, and I tested the code of pull request#591 it worked. I upload the ssh.txt for running the above code. See my testdata repertory. https://github.com/isLiYang/testdata
I hope someone can solve my question.
Thank You.
Full code that generated the error
Full error message pyxovers2.dat will be created, but no data in there. below are message of
and
System information