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

CRS Refactor (Add Datum, CoordinateOperation, CoordinateSystem classes; update CRS repr) #263

Merged
merged 22 commits into from
Apr 23, 2019

Conversation

snowman2
Copy link
Member

@snowman2 snowman2 commented Apr 11, 2019

Copy link
Contributor

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Cool! Added some comments

And additionally:

  • I think we now create the Ellipsoid and PrimeMeridian objects twice? Once through the CRS and once through the Datum. Maybe the properties on CRS can point to the one on the Datum to avoid creating them twice?

pyproj/_crs.pyx Outdated Show resolved Hide resolved
pyproj/_crs.pyx Outdated Show resolved Hide resolved
@snowman2
Copy link
Member Author

snowman2 commented Apr 11, 2019

Maybe the properties on CRS can point to the one on the Datum to avoid creating them twice?

If you are talking about inheritance, I had the same thought about maybe doing a mixin base class for both CRS and Datum. I hesitated because it might be complicated with cython, but probably a worthwhile venture to attempt to reduce some duplication.

@snowman2
Copy link
Member Author

If you weren't referring to inheritance, there are cases where the datum is None (see the tests).

@jorisvandenbossche
Copy link
Contributor

Yes, I wasn't really referring to inheritance (although that would be a good idea for some common functionality), but to the actual properties.

If you weren't referring to inheritance, there are cases where the datum is None (see the tests).

That's indeed a problem for my suggestion. So I think this is the case for BoundCRS or CompoundCRS. The general question here is also to what extent we want to give access to specific properties of those (like getting access to the underlying CRSs)

@snowman2 snowman2 changed the title added Datum class for CRS refactor CRS class repr & add BaseCRS Apr 12, 2019
@snowman2 snowman2 changed the title refactor CRS class repr & add BaseCRS refactor CRS class repr; add BaseCRS; add Datum class Apr 12, 2019
@snowman2
Copy link
Member Author

I updated it again for your review - will probably add more later to address other issues.

@snowman2 snowman2 force-pushed the datum_class branch 3 times, most recently from 4801852 to 7f9800c Compare April 12, 2019 03:07
pyproj/_crs.pxd Outdated Show resolved Hide resolved
pyproj/_crs.pyx Outdated Show resolved Hide resolved
pyproj/_crs.pyx Show resolved Hide resolved
pyproj/_crs.pyx Show resolved Hide resolved
pyproj/_crs.pyx Show resolved Hide resolved
@snowman2
Copy link
Member Author

Another thing to note is that I use horizontal_datum as backup for datum which is useful for the compound CRS.

@snowman2
Copy link
Member Author

@jorisvandenbossche, after going through all of this, I am so glad you brought this up. This is much better than it used to be and has a much better design.

@snowman2 snowman2 changed the title refactor CRS class repr; add BaseCRS; add Datum class CRS Refactor (Add Datum, CoordinateOperation, CoordinateSystem classes; update CRS repr) Apr 14, 2019
@snowman2 snowman2 force-pushed the datum_class branch 3 times, most recently from 4ff0fc5 to 0fb4cff Compare April 15, 2019 01:12
Copy link
Contributor

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Small comment (didn't yet go through again in more detail)

For me, the main API question that I am wondering is the CRS class. Is a single class enough, or do we want more classes? I think at least customizing the repr depending on which CRS type it is, would be useful (will comment about that in the repr issue). But of course, that can also be done without having CRS subclasses.

But, regarding getting this merged: how do we go about that? Because it is getting a big PR, making it difficult to do other PRs touching the CRS at the moment.
So it might be good to merge this relatively fast (after proper review of course). But meaning that not all details need to be perfect. Eg we can further tweak the repr in a separate PR afterwards, ..

"CoordinateOperation",
"Datum",
"Ellipsoid",
"PrimeMeridian",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason that CoordinateSystem is not in this list?
(because there is no way to create it from the class itself?)

Copy link
Contributor

Choose a reason for hiding this comment

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

But I see below that you are including them in the sphinx docs (in the _crs namespace), so maybe we could add it to this namespace nevertheless? (so the namespace in sphinx is the same as for the other objects)

Copy link
Member Author

Choose a reason for hiding this comment

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

because there is no way to create it from the class itself?

Yes, that is correct. No user facing way to create it. So, only access is through the CRS class. I prefer not to include it for clarity of usage.

I see below that you are including them in the sphinx docs

I am including it so the user knows what they are getting from the CRS class. Just a reference for them when looking at the return types from the CRS class.

@snowman2
Copy link
Member Author

For me, the main API question that I am wondering is the CRS class. Is a single class enough, or do we want more classes?

Great idea for another issue.

But, regarding getting this merged: how do we go about that?

Currently just waiting on @jswhit for approval. Once he approves, it should be good to go.

@snowman2
Copy link
Member Author

But, regarding getting this merged: how do we go about that?

Also, want to decide on what to do with the towgs84. I am leaning towards removing it.

@jorisvandenbossche
Copy link
Contributor

Also, want to decide on what to do with the towgs84. I am leaning towards removing it.

It can also certainly be add later, so I would also remove it for now.

@snowman2 snowman2 requested a review from jswhit April 18, 2019 21:04
@snowman2
Copy link
Member Author

Set towgs84 from params instead of the PROJ method.

Copy link
Collaborator

@jswhit jswhit left a comment

Choose a reason for hiding this comment

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

I haven't had time to look at this in detail, but it looks like @jorisvandenbossche has done a thorough review. @snowman2, if you're happy with this now please go ahead and merge.

@snowman2
Copy link
Member Author

Sounds good. Thanks for the review @jswhit!

@snowman2 snowman2 merged commit 88955aa into pyproj4:master Apr 23, 2019
@snowman2
Copy link
Member Author

Sounds good, thanks @jswhit!

@jorisvandenbossche
Copy link
Contributor

Great, thanks a lot for this work, @snowman2 !

(side remark: given that this are quite some changes, and also additions to the API, should the next version rather be 2.2.0 instead of 2.1.4 ?)

@snowman2
Copy link
Member Author

(side remark: given that this are quite some changes, and also additions to the API, should the next version rather be 2.2.0 instead of 2.1.4 ?)

If we wait to release until after PROJ 6.1.0 (May 1st) and add the option to keep the axis ordering, then bumping to 2.2.0 makes sense to me.

@snowman2 snowman2 deleted the datum_class branch September 2, 2019 14:45
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