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

Feature/traitlets refactor #55

Merged
merged 12 commits into from
Jun 13, 2018
Merged

Feature/traitlets refactor #55

merged 12 commits into from
Jun 13, 2018

Conversation

mpu-creare
Copy link
Contributor

This modifies the way we use Traitlets. It inegrates more tightly with traitlets, requiring traits to be tagged. This tagging can the be used to more accurately and robustly create pipelines.

Also adding a large amount of documentation in the PR.

@mpu-creare mpu-creare requested a review from jmilloy June 8, 2018 19:08
@mpu-creare
Copy link
Contributor Author

I'd like this one merged in sooner than later so we can start working using the same methodology.

@coveralls
Copy link

coveralls commented Jun 8, 2018

Pull Request Test Coverage Report for Build 133

  • 280 of 354 (79.1%) changed or added relevant lines in 13 files are covered.
  • 15 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+4.5%) to 64.65%

Changes Missing Coverage Covered Lines Changed/Added Lines %
podpac/datalib/smap.py 0 1 0.0%
podpac/core/algorithm/coord_select.py 28 29 96.55%
podpac/core/algorithm/signal.py 20 21 95.24%
podpac/core/pipeline.py 0 1 0.0%
podpac/core/data/data.py 15 17 88.24%
podpac/core/algorithm/test/test_algorithm.py 1 5 20.0%
podpac/core/compositor.py 12 16 75.0%
podpac/core/algorithm/algorithm.py 9 14 64.29%
podpac/core/data/type.py 29 35 82.86%
podpac/core/algorithm/test/test_signal.py 57 64 89.06%
Files with Coverage Reduction New Missed Lines %
podpac/core/authentication.py 1 36.36%
podpac/core/test/test_node.py 1 97.14%
podpac/core/coordinate/coordinate.py 1 53.02%
podpac/core/compositor.py 3 31.13%
podpac/core/node.py 3 51.88%
podpac/core/coordinate/test/test_coordinate.py 6 76.01%
Totals Coverage Status
Change from base Build 114: 4.5%
Covered Lines: 3890
Relevant Lines: 6017

💛 - Coveralls

@jmilloy
Copy link
Collaborator

jmilloy commented Jun 11, 2018

@mpu-creare This was the first thing I tried to do.

from podpac import Coordinate
from podpac.core.algorithm.algorithm import CoordData 
n = CoordData(coord_name='lat')
c = Coordinate(lat=[1, 2, 3, 4])
n.execute(c)

Here's the result:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "podpac/core/algorithm/algorithm.py", line 70, in execute
    result = self.algorithm()
  File "podpac/core/algorithm/algorithm.py", line 162, in algorithm
    coord_name = self._params['coord_name']
KeyError: u'coord_name'

Are the tagged attrs supposed to be loaded in the the _params, too? Does get_params need to be if value.metadata.get('param', False) or value.metadata.get('attr', False)? Or is it something else?

@jmilloy
Copy link
Collaborator

jmilloy commented Jun 11, 2018

@mpu Well, no, actually I'm guessing that either

  • coord_name should be tagged as a param, or
  • it should be coord_name = self.coord_name (instead of coord_name = self._params['coord_name'])

@mpu-creare
Copy link
Contributor Author

Yep, that was another mistake on my part. attrs are NOT supposed to be loaded into the params dictionary. It should have be self.coord_name. I'll fix that and the ReprojectedCoords one.

* CoordData should have used coord_name as an attr, not a parameter
* CoordData should raise exception if coord_name not in evaluated_coordinates
* ReprojectedSource should still inherit from Algorithm to allow coordinates_source to be specified as an input
Copy link
Collaborator

@jmilloy jmilloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, seems pretty clear. I guess we need these two tags to be documented somewhere, probably we need a "Writing Custom Nodes" user guide and we would describe these there.

@mpu-creare
Copy link
Contributor Author

Agreed. Feel free to start a doc stub, or assign that task to me.

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

Successfully merging this pull request may close these issues.

3 participants