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

Using multiple custom nansat_mappers from different projects does not work #474

Open
korvinos opened this issue Jul 2, 2020 · 2 comments

Comments

@korvinos
Copy link
Member

korvinos commented Jul 2, 2020

@akorosov I have an issue regarding using custom nansat_mappers created outside the Nansat.
I have several project repositories. Each project is mounted to the /path/to/python3.7/site-packages/ so I can access it in python. Within each mounted repository in turn I have a nansat_mappers directory. The __init__.py file for all available nansat_mappers was modified according to the nansat documentation. However, the Nasnat still does not see these custom mappers. I checked the source code for the nansat and found that import of the custom mappers is implemented as follows:

import nansat_mappers as nansat_mappers_pkg

As far as I understand it requires that nansat_mappers directory is mounted directly to the /path/to/python3.7/site-packages/ instead of /path/to/python3.7/site-packages/package/.

However the documentation says (https://nansat.readthedocs.io/en/latest/source/about_mappers.html):

Create a directory called nansat_mappers within a directory on your $PYTHONPATH

If I mount on of the nansat_mappers directly to the site-packages it works just fine. However, it creates an issue with mounting multiple different nansat_mappers from different packages in the same environment.

@akorosov
Copy link
Member

akorosov commented Jul 7, 2020

Maybe to extend Nansat.init with use_mapper parameter and call like that:

from some_package.some_mappers import SomeMapper

n = Nansat(filename, use_mapper=SomeMapper)

@akorosov
Copy link
Member

akorosov commented Jul 7, 2020

Maybe to extend Nansat.init with add_mappers:

from some_package1 import some_mappers1
from some_package2 import some_mappers2

n = Nansat(filename, add_mappers=[some_mappers1, some_mappers2])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants