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

Converting Stonyhurst coordinates to pixel values. #4

Open
JulioHC00 opened this issue May 8, 2023 · 5 comments
Open

Converting Stonyhurst coordinates to pixel values. #4

JulioHC00 opened this issue May 8, 2023 · 5 comments

Comments

@JulioHC00
Copy link

I'm trying to convert Stonyhurst coordinates into pixel values by using Sunpy. A simple example, assuming root is the SDOML s3://gov-nasa-hdrl-data1/contrib/fdl-sdoml/fdl-sdoml-v2/sdomlv2_hmi.zarr/ folder, is as follows (this is just plotting the stonyhurst coordinates which can later on be converted to pixel values with world_to_pixel)

import sunpy.map as smap
import matplotlib.pyplot as plt
from astropy.coordinates import SkyCoord
import astropy.units as u

data_x = root["2010"]["Bx"]
arr_x = da.from_zarr(data_x)

def get_header(data, index):
    headr = {keys: values[index] for keys, values in data.attrs.items()}
    return headr

example_img = arr_x[0]
example_header = get_header(data_x, 0)

fig = plt.figure()
ax = plt.subplot(projection=hmimap)

hmimap.plot(axes=ax)

stonyhurst_centre = SkyCoord(0 * u.deg, 0 * u.deg, frame="heliographic_stonyhurst")

ax.plot_coord(stonyhurst_centre, "x", color="white")

However, the centre in stonyhurst coordinates is not at the centre of the image. Is this expected? As I understand it, SDO images should have the stonyhurst centre in the centre of the image. Could this be a problem when reading the header information? Or is it a result of the processing that is applied to SDOML data.

@PaulJWright
Copy link
Member

@kingbob8, maybe you're able to help here?

@PaulJWright
Copy link
Member

If you're able to directly obtain a HMI image from JSOC, do you see the same thing for the same image?

@JulioHC00
Copy link
Author

JulioHC00 commented May 8, 2023

This top one is from SDOML, the white cross is the (0,0) point in Stonyhurst coordinates

image

And this one I've obtained directly from JSOC using the hmi.B_720s series and the field segment, which I think is what is used for SDOML. It seems like the (0,0) point is in the same position so it's probably not something to do with SDOML but if anyone knows why the point shouldn't be at the centre I'd really appreciate some insights!

image

For completeness, this is what the hmi.M_720s magnetogram looks like. Same thin

image

@PaulJWright
Copy link
Member

PaulJWright commented May 8, 2023

I believe it's most likely due to inclination that hasn't been corrected for. It should perhaps line up twice a year at (0,0)? I would suggest plotting the position as a function of time, and it should be ~ sinusoidal

@JulioHC00
Copy link
Author

JulioHC00 commented May 8, 2023

I'll try to do that. Seems likely to be what happens, but I've never heard of such a thing with SDO and images in JHelioviewer seem to be centred, which leads me to believe it may be something to do with SunPy. I'll try to open an issue in their project because their chat isn't working and I'll comment back in case this is useful for people in the future.

Indeed, it does have a sinusoidal pattern over time in the y-direction

image

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

No branches or pull requests

2 participants