-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
library: Add imagery Python library module to grass.script #3756
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
One last question about this one: does it wire up everything in order for the sphinx docs to be generated correctly for it? For the makefiles it is probably enough, I didn't search more. |
import grass.script as gs | ||
|
||
gs.imagery.group_to_dict(imagery_group) |
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.
If you mean for it to be used this way, then don't add that to the __init__.py
or leave .imagery
here out. (I don't know if it would even not work the way it is written now.) It is basically a decision between the imagery being part of the internal structure versus part of the API. Simpler imports versus more freedom in naming (no danger of collisions).
I added from . import setup
there so that there is no need for extra import, but that the namespace stays separate. However setup
is a special case.
For consistency with raster and others, having from .imagery import *
seems appropriate.
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.
We should tend to avoid adding new star imports
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.
We should tend to avoid adding new star imports
In general, of course, but here in __init__.py
and next to from .raster import *
?
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.
The reason I included the star import is do have it consistent with the other modules...
And with that: gs.imagery.group_to_dict(imagery_group)
does work.
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.
That said, gs.group_to_dict(imagery_group)
works too. I do what you prefer regarding the star-import. Not being able to do gs.group_to_dict(imagery_group)
without the star-import would be fine with me...
Let me know what to do to merge it...
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.
Hm... tests fail without the import of imagery
in __init__.py
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.
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.
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.
Of course the long way, import grass.script.imagery will work.
if you add it, then gs.imagery should work too
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.
I'm confused. Why it works right now? I thought from . import imagery
is needed for gs.imagery.group_to_dict
to work. I think I had to do it that way for from . import setup
and gs.setup.init
.
Co-authored-by: Vaclav Petras <[email protected]>
This reverts commit 3635ea8.
This PR adds a new imagery module to grass.script. For the time being it has just one function, that returns a dictionary for an imagery group with the contained maps and metadata.
It addresses #3750