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

Plotting Issue - "TypeError: ufunc 'isfinite' not supported for the input types" #14

Open
nyambol opened this issue Nov 1, 2021 · 3 comments

Comments

@nyambol
Copy link

nyambol commented Nov 1, 2021

This seems to be related to the other plot issues (#10) but I can't fix.

Attached screenshot shows the error.

Also, I inserted the print of the data[] array to help me resolve another issue. It seems that a redirect of the output in PowerShell borks the formatting. I think there's a way in PS to fix it, but I just switched to cmd instead. In PS, the output is formatted into lines, and that formatting is carried into the file, making the resulting data[] a list of lists, one list for each line.

  • Python 3.10.0
  • numpy 1.21.3
  • matplotlib 3.4.3

fortran-py-script-error

@milancurcic
Copy link
Member

Thank you, @nyambol! Can you please attach output_dos.txt here? I'll take a look and see how we can fix the code to make it portable.

@nyambol
Copy link
Author

nyambol commented Nov 2, 2021

Well, I seemed to have borked things myself. I re-ran the PS capture of output & it came out the way it should. But, this time I get a different error from the one above. And it's the same error for both exports. A real WTF moment. Sorry.

Now, I did have to change the Unicode setting from UTF-16 to UTF-8, which is my Windows 10 Pro system. I know I've seen commentary around about Win 10 being the former, but mine was CP1252 until I enabled the beta option to switch to `UTF-8'. This is

Edition	Windows 10 Pro
Version	21H1
Installed on	‎9/‎4/‎2021
OS build	19043.1288

The "latest and greatest" according to MS. :-\
I wonder if you can just use sys.stdin.encoding to get the necessary value.

C:\Users\micha\Dropbox\src\fortran\fortran-basics
{micha} [8] --> .\plot_water_height_multipanel.py .\output-ps.txt
Traceback (most recent call last):
  File "C:\Users\micha\Dropbox\src\fortran\fortran-basics\plot_water_height_multipanel.py", line 44, in <module>
    ax.plot(x, h[time_steps[n], :], "b-")
IndexError: index 25 is out of bounds for axis 0 with size 1

output-ps.txt
output-dos.txt

@milancurcic
Copy link
Member

Hi @nyambol, sorry for the delay. I just looked at the files and they seem fine (they're exactly the same on my end). I was also able to plot them with the Python script. Unfortunately I don't have a Windows computer. Are you still having issues with this?

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

2 participants