-
-
Notifications
You must be signed in to change notification settings - Fork 2k
EarthLocation class for Time #1928
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
Conversation
|
@mhvk - I would be inclined to drop I would say that |
|
@mvhk: yes, I think that this makes sense. And I'm also fine with having it accept a Location object rather than lat/lon/hgt. This seems like it would be useful beyond internally, though, so maybe it should be available outside of the Time routines? I would use it for the observatory positions in PINT if that were the case. |
|
I agree that |
astropy/time/core.py
Outdated
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.
This code looks a lot nicer now!
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.
Note that for that calculation, hypot would probably be even better (because of numerical precision issues if nothing else):
u = np.hypot(location.x, location.y).to('m').value
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.
OK, np.hypot is indeed better; using that now.
|
@taldcroft - I agree that it may be best to just move away from It also makes most sense to make the |
|
@eteq - no worries; is good to get this at least in the right direction. |
|
As the new location class is based in |
|
@demorest - on the e-mail you sent separately:
I think this would indeed be great to add, though it sounds like this is more properly done as part of coordinates (where the cc @eteq: this is about which erfa routines are needed for pulsar timing besides those in |
|
@mhvk - look at this pint source file: http://github.com/demorest/PINT/blob/master/pint/erfautils.py It's not too complicated, and I think it very closely follows another one of the SOFA usage examples (maybe @scottransom remembers where to find that in the SOFA docs). |
|
@taldcroft - regarding your comment about this needing to live in |
|
@astrofrog - am not sure |
|
@astrofrog @mhvk - I do not think As for where |
|
👎 on Time in coordinates for the reasons @eteq mentioned. The fact that there is a certain cross-coupling in terms of usage doesn't mean they have to be in the same top level package. I also (still) agree that I don't see a big benefit to splitting out mathematical coordinates like @mhvk suggested, that would just add confusion in terms of where to import relevant classes etc., not to mention a huge API change when we've been promising that coordinates will settle down. |
|
@eteq - I moved Note that I kept the |
|
I was looking through some of the backlog and realized this is still hanging. @mhvk, do you think we should hold off on this until we get through APE5 implementation? It may be that we'll need to move the ERFA stuff as part of that, in which case it might be awkward to merge this in beforehand... But it might also just be a matter of rebasing before merging APE5. (although this also needs a rebase now.) |
|
@eteq - I'd be in favour of putting it in, as long as everybody is happy with the overall API (and it would be hard to think how else one would initialize it that from |
Includes erfa gc2gd so that one can transform XYZ to geodetic
|
OK, I had assumed you wrote a wrapper around CartesianPoints to mimic the CartesianRepresentation API. Should've looked at the code. |
astropy/time/core.py
Outdated
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.
Perhaps this should just say "use an EarthLocation object"? That at least should point the user to relevant documentation. (Not a big deal either way, though)
|
Aside from that one minor bit it seems fine to me. @taldcroft, did you want to actually look more, or is this good to go now as far as you're concerned? |
|
Just to check, currently what is passed to |
|
I was just scanning the tests and noticed there doesn't seem to be any explicit use of |
docs/time/index.rst
Outdated
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.
This doesn't explicitly say you can provide an EarthLocation object, through of course that does qualify as being able to initialize an EarthLocation. Maybe ..., using an |EarthLocation| object or any form that can initialize an |EarthLocation|, i.e. ..
|
OK, I'm done with my review! |
|
@astrofrog - Not sure about non-Earth based locations, since many timescales do not make sense off the Earth, but I certainly hope that we can pass, e.g., observatory names (or classes, which might be subclassed from @taldcroft, @eteq - Good suggestions. All implemented. |
|
This is good from my perspective. |
|
@astrofrog @mhvk - I think it definitely will make sense in the future to allow something more than just EarthLocation... And once we have the IAU2000 stack in, that will be a lot easier because we can use those transforms. But the question, now that @astrofrog brought it up, is this: should we drop the tuple form entirely, and only allow |
|
I do think that it is probably good that at least some non-earth-based locations are handled. I'm thinking specifically of satellite observatories, which often use UTC-based timescales and then do conversions to TDB etc as appropriate.... |
|
@scottransom - I think there is nothing here that would stop us from expanding to satellite locations, especially if one has their geocentric coordinates. @eteq - I can see the point of requiring an |
|
I think I'm ok with strings and tuples being a convenience for earth locations, but I guess I just meant that I wanted to make sure that we make it clear tuples get passed to that class and are just a convenience. |
|
@astrofrog - OK, that makes sense. I looked at the PR again and think over the various iterations all documentation has become fairly clear that it is an |
astropy/time/core.py
Outdated
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.
Typo: lon -> lat
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 perils of cut&paste yet again exposed... Now fixed.
|
@mhvk - sounds good! Once the above typo is fixed we can merge this! |
|
To add one item for the future, @scottransom : I think this will be pretty straightforward once we've got the full IAU2000 stack working, which is the next step after APE5 is done (and shouldn't be too onerous once we figure out the easiest way of getting all the ERFA parts to talk easily with astropy). |
|
And nice work on this, @mhvk : took a while, but I like how it turned out! |
|
Looking at EarthLocation in the API docs, there's a few minor things in the docstrings that should be cleaned up:
|
|
@cdeil - OK, will issue a new PR for those. One item that requires a bit of thought (put here, so people can comment), is whether it makes sense to initialize longitude, latitude, and height with the short forms in |
Triggered by #1924 and its follow-up, I decided to make
Timetake heights or a simpleEarthLocationclass. I realise that this may well need to be a bit more complicated, but the pulsar timing work provides a case where it is good to have something that works now. As written, theEarthLocationclass is a subclass fromCartesianPoints, with the only addition that it can convert from and to geodetic coordinates using theerfaroutinesgd2gcandgc2gd(the former was already there; the latter is now included inerfa_time). Example:@eteq: as you started with a
Locationclass as well, could you check whether you think my approach makes sense? I think for now, since the locations are only used internally, a simple approach should be fine, but we should ensure that it doesn't preclude a more complete implementation later on. Also, do you have a suggestion for where this should live?@taldcroft: do you think the suggested changes to
Timeare OK?@scottransom: would this fulfill the requirements for PINT?
p.s. This supercedes #1927, but is complementary to #1925
p̶.̶s̶.̶2̶ ̶T̶h̶i̶s̶ ̶s̶t̶i̶l̶l̶ ̶n̶e̶e̶d̶s̶ ̶d̶o̶c̶s̶t̶r̶i̶n̶g̶s̶ ̶f̶o̶r̶ ̶t̶h̶e̶ ̶E̶a̶r̶t̶h̶L̶o̶c̶a̶t̶i̶o̶n̶ ̶c̶l̶a̶s̶s̶,̶ ̶a̶s̶ ̶w̶e̶l̶l̶ ̶a̶s̶ ̶t̶e̶s̶t̶ ̶c̶a̶s̶e̶s̶ ̶a̶n̶d̶ ̶a̶n̶ ̶u̶p̶d̶a̶t̶e̶ ̶t̶o̶ ̶t̶h̶e̶ ̶T̶i̶m̶e̶ ̶d̶o̶c̶u̶m̶e̶n̶t̶a̶t̶i̶o̶n̶.̶ ̶W̶i̶l̶l̶ ̶d̶o̶ ̶i̶f̶ ̶i̶t̶ ̶i̶s̶ ̶a̶g̶r̶e̶e̶d̶ ̶t̶h̶a̶t̶ ̶t̶h̶i̶s̶ ̶i̶s̶ ̶t̶h̶e̶ ̶r̶i̶g̶h̶t̶ ̶a̶p̶p̶r̶o̶a̶c̶h̶.̶