ESMG / pyroms

Python tools for the Regional Ocean Modeling System (ROMS)
Other
141 stars 88 forks source link

Importing modules like _interp #33

Closed hadfieldnz closed 3 years ago

hadfieldnz commented 3 years ago

In pyroms/pyroms/src there are several .f files (interp.f, iso.f, ..., remapping_fast_weighted.f) and at the beginning of pyroms/setup.py there is code to build the corresponding extension using numpy.distutils.

In a lot of the example files there is a call to "import _remapping". For example, examples/Arctic2/remap.py has the following lines:

import pyroms
import pyroms_toolbox
import _remapping

When I try these commands at the Python prompt, the final one doesn't work, eg.

>>> import pyroms
>>> import pyroms_toolbox
>>> import _remapping
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named '_remapping'

However this form does work: >>> from pyroms import _remapping Is this a mistake in the example file, or is there something I'm failing to understand about Python imports in this context?

kshedstrom commented 3 years ago

It's a feature change in going from Python 2 to Python 3. I guess the 2to3 script missed them all - I change them as I find them.

hadfieldnz commented 3 years ago

Thanks!