Pyroms update

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Pyroms update

#1 Unread post by kate »

I have created a python3 branch of the pyroms repository on github. This is much like the previous PyCNAL repository, but the guys want to start fresh with all new PyCNAL code.

Anyway, let us know of any problems. I've got it working under Linux, but I have some wacky problems on the Mac.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Pyroms update

#2 Unread post by m.hadfield »

kate wrote:I have created a python3 branch of the pyroms repository on github. This is much like the previous PyCNAL repository, but the guys want to start fresh with all new PyCNAL code.
So, if I want to develop my own ROMS Python 3 code (using existing packages like xarray) but also want to build on (and sometimes contribute to) the best existing Python code, should I use your pyroms/python3 or should I use PyCNAL?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Pyroms update

#3 Unread post by kate »

m.hadfield wrote:So, if I want to develop my own ROMS Python 3 code (using existing packages like xarray) but also want to build on (and sometimes contribute to) the best existing Python code, should I use your pyroms/python3 or should I use PyCNAL?
What are you planning to do exactly? If you want feedback from the guys, they're more likely to see it if you create a PyCNAL issue on github.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Pyroms update

#4 Unread post by m.hadfield »

kate wrote:What are you planning to do exactly?
General stuff: analysis of model output; generating input files. With an emphasis on nested grids.

Does PyCNAL have a Python 3 version?

andres
Posts: 54
Joined: Tue May 06, 2003 4:35 pm
Location: University of Concepcion
Contact:

Re: Pyroms update

#5 Unread post by andres »

What is the advantage on moving the code from python2.7 to python 3?
Andres Sepulveda

------------------------------
Geophysics Department
University of Concepcion

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Pyroms update

#6 Unread post by kate »

I believe code that runs on version 3 should also run on version 2.7, so there should be no downside. One colleague of mine is running python in a gui that's only version 3 and I've switched to version 3 when we switched supercomputers. It was time.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Pyroms update

#7 Unread post by m.hadfield »

andres wrote:What is the advantage on moving the code from python 2.7 to python 3?
I'm approaching this as someone who has used Python (version 2) for many years as a scripting language but is looking to adopt it as my main language for data analysis. I have looked at various discussions like this...

https://learntocodewith.me/programming/ ... -python-3/

...and decided provisionally to adopt Python 3, because it's cleaner in various ways and (I think) more future-proof. And now, 3.5 years after the above discussion was written, most libraries are available in Python 3 versions.

So I guess my, selfish answer to your question is, "To make it easier for me to use it."

Kate can advise about what's involved in rewriting the code, but I don't think it's too difficult. The main tasks seem to be rewriting the string formatting to the new style (which also works in 2.7, I believe) and the exception handling.

Most libraries are available in both flavours of Python. I haven't yet looked at how they achieve that.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Pyroms update

#8 Unread post by kate »

Most of the code conversion can be accomplished with the "2to3 -w" command. For pyroms, what's left over is mostly converting tabs to spaces - python 3 is pickier about that.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Pyroms update

#9 Unread post by kate »

I downloaded the latest PyCNAL. It's pretty bare bones at this point, but you can follow it on github to find out about updates. What's there now is a remapping tool for generating MOM6 boundary files using ESMPy. If you're sticking with ROMS, stick with pyroms. For now...

Post Reply