NCAR / kcor-pipeline

Pipeline code for KCor
Other
3 stars 2 forks source link

Update K-Cor header coordinate system to work with SunPy #360

Closed jburkepile closed 9 months ago

jburkepile commented 11 months ago

Add the following keywords to comply with SunPy and AstroPy:

Questions

mgalloy commented 10 months ago

Here are the KCor and the AIA 193 images for 2022-10-02T20:27:32 displayed together:

KCor and AIA 193 at 2022-10-02T20:27:32

jburkepile commented 10 months ago

This looks fantastic Mike!

I need to find out how to apply the 'nrgf' filter to the AIA images to view them off the limb. I will check with Sarah or Giuliana; I think they both know how to do that. That will fill in the narrow black ring between AIA and K-Cor that looks like a data gap. I would also like to have the AIA and K-Cor image times embedded in the upper left corner of the composite. You don't need to do these things. This is something Ben can do and show the observers how to make changes, as part of the tasks the observers will work on while MLSO is closed.

mgalloy commented 10 months ago

The Jupyter notebook with the code to do this is in tutorials/kcor-wcs.ipynb.

jburkepile commented 10 months ago

Thanks! That is great to know.

mgalloy commented 10 months ago

By the way, there is still this warning:

INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase]
INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase]

I am not sure what is missing we have DSUN_OBS, RSUN_OBS, R_SUN, and RSUN FITS keywords. What is it looking for?

mgalloy commented 10 months ago

Looking at the SunPy code, it looks like it wants RSUN_REF, which is:

RSUN_REF = radius of Sun in m, agreed upon standard, c. 6.96E8 but must be consistent with WAVELNTH keyword.

mgalloy commented 10 months ago

Still need correct value for RSUN_REF, but it seems to fix the SunPy Map warning.

mgalloy commented 10 months ago

UCoMP does not get this warning because we set WAVELNG instead of WAVELNTH.

mgalloy commented 10 months ago

A fuller quote from the SDO keyword documentation:

From SDO attitude and orbit information:
   ...
   DSUN_OBS distance to Sun center from spacecraft in m, c. 1.5E11.
   RSUN_REF = radius of Sun in m, agreed upon standard, c. 6.96E8 but must be consistent with WAVELNTH keyword.

For AIA:
   ...
   IM_SCALE is the predefined AIA plate scale in arc-seconds per pixel.
   R_SUN is computed from DSUN_OBS, RSUN_REF, and IM_SCALE.

For HMI:
   R_SUN is computed from the same fit to each image.
   IM_SCALE is computed from R_SUN and DSUN_OBS and RSUN_REF.
mgalloy commented 10 months ago

RSUN_REF could be computed with:

radius = (radius_0 + radius_1) / 2.0
dsun_obs = dist_au * au_to_meters
rsun_ref = dsun_obs * tan(run->epoch('plate_scale') * radius / 60.0 / 60.0 * !dtor)

The values I get from the files on 20221002 are about 7.35E8 (I am using 6.96E8 now). This is consistent since the occulter is larger than the sun.

mgalloy commented 10 months ago

RSUN_REF can be calculated with the arcsec/mm value found using the size of the occulter (in mm) and the focal length of the instrument using optical formulas similar to UCoMP's calculation.

jburkepile commented 9 months ago

Value of RSUN_REF at KCor center wavelength 735 nm = 696182 km. Reference used: 'Solar radius determined from PICARD/SODISM observations and extremely weak wavelength dependence in the visible and the near-infrared' by Meftah et al. 2018; https://doi.org/10.1051/0004-6361/201732159 We should include that reference in a comment that has the DOI.

The solar diameter varies from 696179 to 696185 km over the K-Cor wavelength range of 720 to 750 nm. The uncertainty in the RSUN_REF cited above is likely larger than +/- 3 km since the PICARD measurements were not made exactly at the K-Cor wavelengths. I interpolated the PICARD data to extract the value of the solar diameter over the K-Cor wavelengths.

NOTE: The RSUN_REF value is important for solar datasets that view the Sun's disk, such as AIA and ChroMag. The platescale of these datasets can be checked using RSUN_REF. That doesn't hold for coronagraphs that block the disk with an occulter. The physical size of the occulter needs to be used. Our occulter names in the 'OCCLTRID' keyword contain the size of the occulter in arcseconds and should be used to check platescale. Do you think it is worth putting a comment in the header about this for our users?

mgalloy commented 9 months ago

There are new files in raw.latest/20221007:

level2$ fitscat -r 20221007_173900_kcor_l2.fts | grep RSUN_REF
RSUN_REF=          6.96182E+08 / [m] solar rad. doi:10.1051/0004-6361/201732159

There is one extra character left in the comment.