iris-edu / EMC-ParaView

A set of Python programmable filters/sources to allow ParaView open-source, multi-platform data analysis and visualization application to display EMC netCDF/GeoCSV models along with other auxiliary Earth data.
GNU Affero General Public License v3.0
19 stars 4 forks source link

python2.7 is dead and this plugin no longer works #1

Open pavlis opened 3 years ago

pavlis commented 3 years ago

I ran across a reference to this software the EMC site at IRIS DMC. I tried to install it using direction in this repository. Got the plugins installed in paraview 5.9.1 on a macos machine. That was straightforward. Any time I try to use any of the plugins, however, I get messages infamous python2.7 syntax errors throw. They are typically Missing parantheses in call to 'print' did you mean print(" .... I look in the python code and there are indeed tons of python2 print statements that will create that problem.

It seems paraview like everyone else depricated python2.7 a year ago or more and this plugin in is no longer functional. Are there plans to fix this? Alternatively, do you have a workaround? Is anyone maintaining this code? I see no changes since 2018. Gary Pavlis, Indiana University

manoch-iris commented 3 years ago

Hi Gary,

Yes, we are also moving to Python 3. We are currently trying to upgrade our other automated products. This is on the list to do next. I cannot give you an exact time but will be the next one we will work on. We do not have a workaround other than installing Python 2.7 and running an older ParaView (It is working for me).

Thanks, --manoch

pavlis commented 3 years ago

Happy to see you respond to this. I cloned this repository and will see if I can convert the code to python3. Not usually that hard from my experience. If I manage to get it working I can submit a pull request. Can I seek your help if I run into unexpected problems?

pavlis commented 3 years ago

Manoch, Hey the conversion was pretty trivial, although I confess the testing is not yet complete. You may or may not know of the now standard python command line tool "2to3" that seemed to fix all the problems from python 2.7. I doubt I can just push to this repository without a permission change. On the other hand, you could probably do this in a few minutes if you just run 2to3 on every python file in this repository. Let me know how you want to proceed.

If this works as I it seems to may I ask for some help via email? I'm working with a group on a synthesis paper of imaging results from USArray Alaska and I'm trying to use paraview, and now your variant, for the paper. What I'm going to need help with is converting some older stuff I did that didn't have this georeferencing capability to use your plugins. An alternative to email if you want to preserve the dialogue for others is to add a discussion tab to this github repository. Preserving our dialogue might help others down the road.

manoch-iris commented 3 years ago

Gary,

This is great and I am glad you got it working. Your experience with the conversion will be very helpful.

The issue that we want to address when we move to Python 3 goes beyond the syntax change. Under Python 2.7, ParaView under Windows did not support netCDF4 library and because of that we had to switch to CSV model files when OS was Windows. I think this may not be an issue under Python 3 and ParaView has addressed this problem. I will keep this discussion open until we have done conversion to Python 3.

As you suggested, let us move to regular email for other discussions. Looking forward to hear from you.

pavlis commented 3 years ago

Not so sure you want to remove the geoCSV model option. I alway viewed netcdf as one of those examples of a generic format that got so complex it became a monster - a bit too much like SEED. I just checked and the C manual, for example, is 127 pages. geoCSV appear a lot simpler although obviously takes a lot more bytes to store the same data.

That aside, you might still consider:

  1. Freezing the current version as a formal release in github and call it something like 1.0 with a notice it is only usable on old versions of paraview that used python 2.
  2. Doing what I did and run 2to3 on all the python files, check those in, and change the README appropriately.

I've now run the basics on every one of the modules in this plugin and they all work on the latest paraview. Well, caveat is I only tested in on ubuntu.

Your call if you want to close this issue or keep it open until this is fully resolved.

manoch-iris commented 3 years ago

I am not planning to remove GeoCSV support but will open up Windows to netCDF. Then it will be up to user, regardless of OS, to use either netCDF or GeoCSV. Thanks for your suggestions and we do plan to preserve older versions. Glad to hear that all modules are working for you.

martinvandriel commented 2 years ago

Any update here? Maybe you can put a big warning on the main page in the meantime, so people don't waste their time trying to get this to work (like I just did).

@pavlis Maybe you can create a merge request so that it is easy for others to use your version for now?

Thanks!

manoch-iris commented 2 years ago

My apologies for the delay. The Python 3 update is ready, but I need to run a few more tests. I will upload the update at the beginning of the next week.

pavlis commented 2 years ago

Not sure I can actually even find the original I got from you. I went way beyond that conversion from python2 to python3 for this paper we have been working on. @martinvandriel , if you want to get this to run for the time being just run 2to3 on all the .py files and the plugin works.

You may be interested in the child of this library I wrote based on the @manoch-iris code. The module I have will just return he netcdf data as a set of python arrays. I wrote the converter for a project related to MsPASS with this home page. In particular, I'm adapting a rather complicated set of programs I've been developing for about 20 years for what we called plane wave migration for teleseismic body waves. The current code is in a github site but that site is curently not public because it is still totally in flux. I could either give you permission to pull that current version of that or email you the module. Depends upon what you want to do. If you only want the paraview plugin to work with the newer paraview just run 2to3 as I suggested earlier.

Us old professors often don't know when to shut up

pavlis commented 2 years ago

@manoch-iris if you are revising that plugin you might consider using pandas. The algorithm used in this code is a bit slow on large grids because it does a lot of array indexing in python. Here is a tutorial I found on a quick google search that might be helpful.

Related is something you should verify. My experience working with models for Alaska was that all the files I read were sampled on a regular grid in latitude and longitude. I don't really think that is a netcdf limitation, but it was true of all examples in the EMC I read. I think your algorithm actually depends on that anyway because of how you get coordinate arrays. In any case, I think if you are revising this anyway you might rethink some details of the algorithm.

martinvandriel commented 2 years ago

@pavlis I got it to work now, importantly the plugin xml files need to be regenerated after running 2to3, because they also contain generated python code. I'll take a look at your website, for the time being I just needed coastlines in paraview :)