-
Notifications
You must be signed in to change notification settings - Fork 16
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
Packaging #3
Packaging #3
Conversation
James: @ocefpaf (Filipe) and I are restarting the effort to improve the packaging of mocsy in Python, after a few months. I'll be at the GOA-ON Science workshop at Hobart in two weeks. I saw that in the draft agenda you're scheduled to give a presentation on carbonate system calculations, just before my presentation on the GOA-ON data portal we're developing. It'll be great to have some time to talk then. And hopefully we'll have made more progress by then with @ocefpaf's new pull request! (Thanks, Filipe!) For reference, see our previous discussions from last November at #2 and issues linked there. |
Emilio, It would be great to discuss the changes that Felipe and you are proposing in this pull request at the GOA-ON meeting in Hobart. I like most of them. For others, we need to talk. For instance, I would prefer to make all the routines in the gasx module compliant with f2py rather than commenting them out. There are also new features (e.g., error propagation, derivatives, and new routines for model comparison) that have yet to be added to the main branch. They should be included though in May. Unfortunately, I won't be able to do anything about this pull request until mid-May, when I return to Paris. I leave for Hobart in 2 days to attend the preceding meeting (4th symposium on the Ocean in a High-CO2 World), See you in Tasmania! Jim |
@jamesorr By no means I want those workarounds to be merged! I just added them to "make things work." My knowledge of Fortran is limited, but I am trying to fix it. BTW I already got |
No worries about the Fortran. I can make the necessary changes as long as it is very clear to me what you are after. |
I want to leave the Fortran code as pristine as possible. I even thought about creating another project for the python wrapper that would use this repository as a submodule to avoid making changes here. However, I gave up that idea because I thought that you might want to keep the python wrapper and the Fortran code in the same place. I believe that the problem we are facing is this one. That is an old limitation in |
@ocefpaf: It's a good idea to keep things in one place. I will check into the Fortran issues as soon as I have a chance but that may have to wait for 2 weeks because I'll be away from the lab at 3 big meetings. Thanks for your efforts on this. |
No worries.
Thanks @emiliom for pushing this. |
Thanks, James. Let's talk at Hobart. I arrive at noon on the 6th and leave very early on the 11th. I completely agree that the goal is to keep everything in one place, in the mocsy source repository (James'). @ocefpaf: in the meantime, is it possible to create a conda package in a "test channel" off of your mocsy fork's "packaging" branch? If that's doable (I have no idea if you have some kind of test anaconda channel available), that would let me start easily testing general features of what you've done, without impacting anything else. It would also allow me to show that conda package and your wrapping "in action" when I meet with @jamesorr in two weeks. So: no rush, but if it's something you can do w/o too much effort by mid-late next week, that'd be great. If you don't have a such test environment, no worries. |
Cool. We are all in the same page here.
We already have a version in the IOOS channel based on #1. I will update that to this PR early tomorrow. |
That sounds good. Thanks. |
@emiliom the binaries for this PR are available at: http://anaconda.org/IOOS/mocsy/files PS: Let me know the results if you test them. |
Thanks, @ocefpaf! I'll examine it on friday or the following couple of days. |
I can report back that Filipe's new approach works, and it accomplishes one of the main goals I had: to bring the FORTRAN subroutine documentation strings into Python function docstrings! This is fantastic, as it makes the Python package a lot easier to use by removes the need to be consulting the doc strings on the FORTRAN code. Of course, another major goal of Filipe's approach was to leave the fortran files as-is (previously he was combining them). That's taken care of. I re-ran the Jupyter notebook I wrote last November using the new mocsy package. I checked results only quickly and visually, but everything ran, and there didn't seem to be any changes. So, this is very promising, and a great starting point for James and I when we meet in a week and discuss remaining problems (eg, gasx) and future directions. Thanks @ocefpaf! |
3fe6b9f
to
0281c5f
Compare
@jamesorr indeed the failures here were not related to numpy/numpy#4645, it seems that just a few adjusts to the Fortran code did the trick. However, I do not trust my fixes here! My Fortran is ~20 years old and I never really used it. I will make a few comments on the code to make it easier to follow. |
@@ -364,14 +364,14 @@ SUBROUTINE pistonvel(windspeed, Fice, N, kw660) | |||
|
|||
! INPUT variables | |||
!> wind speed at 10-m height | |||
REAL(kind=r8), INTENT(out), DIMENSION(N) :: windspeed | |||
REAL(kind=r8), INTENT(out) :: Fice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the comment below I figure this should be Fice
and not windspeed
. I also guess that Fice
is not dimension of N
.
!> surface salinity [psu] | ||
REAL(kind=r4), INTENT(in), DIMENSION(N) :: S | ||
REAL(kind=r8), INTENT(in), DIMENSION(N) :: S |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the one above are the same as https://github.com/jamesorr/mocsy/pull/3/files#r61793559
Most of the fixes to the code have been implemented in the new intermediate version of mocsy on github (v2.2). A mocsy branch on error propagation and buffer factors has been developed and will be put up on github next week. Because that branch has many changes, I am closing this PR for now. But I hope we can get back to discussing better packaging for mocsy and to optimizing its use in python. |
The boilerplate to package was sent to |
@ocefpaf Thanks so much for all your efforts to advance this issue. Unfortunately, I had to close this PR because my local code has evolved much since the PR was first submitted. It was just much easier for me to do so. I don't know how to selectively merge (not keep all changes). Anyway, just after closing the PR, I reorganized the package structure exactly along the lines you were requesting. All your same boilerplate additions are now included and are identical to what you provided. Please take a look! Over the newt few days, I'll be making other additions to the code to do error propagation, but it will then reach a stable state. I really hope we can continue pursue this effort together to make it a conda package on the IOOS channel! |
No problem. I understand that. However, I recommend you to commit more often to keep the local dev version in sync with the remote dev version to improve collaborations.
I split all the commits to try to make it easy for an eventual
Will do soon.
Sure. But note that the |
@ocefpaf That's excellent advice. The remote dev now includes all recent local developments, namely error propagation and partial derivative calculations (buffer factors). Sorry it took so long to bring this up from the local dev, but it represents months of collaborative development. From now on, I'll do better job at keeping the remote current. Another thing the remote dev now includes are all the boilerplate files that you provided. And the overall structure is exactly what you recommended. I'd be been keen on moving forward to make mocsy installable via conda-forge as soon as possible. It seems all is now in place but I've never done this before and your help would be critical. One kludge that I had to do to be able to do a 'import mocsy' was to move the mocsy/init.py file to a 'mocsy/tmp' directory. Otherwise it was trying to read that file and it didn't seem to like line 3: from ._mocsy import ( Do you know why this might be? |
As soon as we get a successful build we can do that. The packaging in
Not sure what is going on but if I had to guess you are testing the python setup.py sdist # Creates a source distribution.
cd dist && pip install mocsy-2.0.1.tar.gz and everything worked. Tests, example, and the notebook. However, the build is failing b/c of the changes. There are new Fortran sources that must be added here in the proper build order. In addition to that some of the new (and old) Fortran source is hitting numpy/numpy#4645 again. Because the error mensagem is not informative debugging that is quite painful and time consuming: (1) commenting the source to figure out which one is breaking, (2) edit the source to fix it for f2py, repeat (1) and (2) until all are found. Someone with more Fortran knowledge than me can probably do this quicker. Another alternative is to no use PS: You need to renamed the file |
I've produced a new version v2.3.2, now also on github. As suggested by @ocefpaf, the travis.yml has been renamed to .travis.yml and expanded to include the 5 missing source modules. I also expanded setup.py in the same way. After moving './mocsy/init.py' to '.', I was indeed able to run python and then do an 'import mocsy' without any problem. But the same file needs to be put back into the ./mocsy subdirectory for
to start up correctly. But even with that, the build fails as you mentioned previously. When I have a little more time I will see if I can get that build to work without the gasx module, and if so gradually bring in the routines in that module to see where the problems lie. It seems strange to me to think that the fortran code is the problem because the mocsy.so package does build with my Makefile (which invokes f2py), and the routines work after importing that into python. |
Even after removing gasx.f90 from setup.py and
the build fails. The final output from that command says:
I had the same result when I tried to greatly simplify the gasx module to include only 1 routine (SUBROUTINE pCO2atm2xCO2) while keeping gasx.f90 in the 2 routines mentioned above. This seems to suggest there is another problem elsewhere. Any ideas? |
The problem is how
When I tried with the new code the code choke on BTW, for a conda package, we can try to use the makefile b/c conda allows us some breathing room for hacking the creation of the package. But that won't be |
This PR supersedes #1
@jamesorr This PR does not merge all the Fortran sources into one file. It does treat them separately to build the extension. However, I had to use an older and modified version of
gasx.f90
because of somef2py
does not support some features used. (See numpy/numpy#4645)I don't recommend merging with this workaround, but my Fortran is rusty to fix this properly.
Ping @emiliom.
PS0: I separated the commits to make it easy to review, but I can squash it before merging.
PS1: Can you enable Travis-CI for this repository?