dstansby / pfsspy

Potential Field Source Surface model package for Python
https://pfsspy.readthedocs.io/
Other
41 stars 17 forks source link

Roll function #296

Closed STBadman closed 3 years ago

STBadman commented 3 years ago

Added function pfsspy.utils.roll_map to perform roll of an input sunpy.map.Map which satisfies pfsspy.utils.is_full_synoptic_map using reporject, following closely the CEA reprojection example.

Function takes (in addition to reproject method) the argument lh_edge_lon which is the desired Carrington longitude for the left hand edge of the map after the roll. This input is used along with the input header reference pixel and pixel spacing to create a new header with the reference pixel value changed in such a way to align the left hand edge of the map as required. The input must be type float or int and must be in the range [0,360]. The new value of the reference pixel is also ensured to be within [0,360]

The default value for lh_edge_lon is 0.0 which corresponds to the default roll of ADAPT maps. GONG mrzqs maps are typically offset from this value by a timedependent roll and so the default action of this function on a GONG mrzqs map would bring it into alignment with an ADAPT map for the same day.

Tests in pfsspy/tests/test_utils.py check the output map is finite, is a synoptic map, the new longitude of the reference pixel is as expected, and that the validation of input types of lh_edge_lon and method are done correctly.

STBadman commented 3 years ago

Ok updated with commits that implement ;

dstansby commented 3 years ago

Ok updated with commits that implement ;

* Checking the roll is performed with `pixel_to_world` Doing this also identified the roll itself was slightly incorrect and had been aligned the left most pixel center with the LH edge rather than the LH edge of the LH most pixel

I suspected this might be the case, I've spent a lot of time tracking down 0.5 pixels in sunpy recently 😆

* Manual validation of the range being within 0-360 deg is still done - question: is it preferable to put an even stronger constraint on lh_edge_lon as `astropy.coordinates.Angle` to implicitly capture this range requirement?

I think manual validation is fine.