-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
Add function and map method for drawing extent of another wcs #7851
base: main
Are you sure you want to change the base?
Conversation
Docs build and figure test devdeps fails are unrelated. |
@pytest.fixture | ||
def cropped_aia193_sample_map(): | ||
import sunpy.data.sample | ||
m = sunpy.map.Map(sunpy.data.sample.AIA_193_JUN2012) |
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.
What is this sample data file?!
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.
- I think the map method should be locked to plotting that map's own extent on the specified axes. I would not accept a potentially unrelated WCS as an argument.
- Instead of using the
resolution
approach, I think it would be better to literally use the pixel corners. That way, the segmentation of the extent box will not be mismatched from pixelization. (There can be a different parameter for adding sampling points along a pixel edge, but the default would be just the corners.)
Agreed. This is also more consistent with the way the other draw methods work, i.e. they "draw themselves". I don't know why I did it backwards. Are you opposed to keeping the function in
I see what you mean re: pixelization. However, aren't the four corners alone insufficient to adequately define the map extent? For example, in your original issue, the red and green boxes you show have the same corner coordinates even though the FOVs are different. Am I missing something? |
Nope, not opposed as it is consistent with the limb stuff.
To clarify, I meant the outer corners of every edge pixel, so 2N+2M(+1) points for an NxM array. For that example image, I think I may have called |
I've removed the resolution argument and constructed the edges such that the spacing along any given edge has a resolution of 1 pixel, with the left endpoint included and the right endpoint excluded as the latter is the starting point of the subsequent edge. The reason I didn't use |
@@ -194,6 +194,54 @@ def prime_meridian(axes, *, rsun: u.m = R_sun, resolution=500, **kwargs): | |||
return visible, hidden | |||
|
|||
|
|||
@u.quantity_input | |||
def extent(axes, wcs, *, rsun: u.m = R_sun, **kwargs): |
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.
Without having looked at this in detail, this feels like something which could be useful to upstream to astropy?
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.
Probably. I'm kind of surprised this doesn't already exist actually. Hopefully I'm not duplicating functionality here.
Fixes #7615
TODOs: