Skip to content

Commit

Permalink
Merge branch 'main' into ana
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Jun 10, 2024
2 parents b2128d3 + 09319a1 commit 2a5a61d
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "1eff2ed0ff32c123e64b5faacf7c505362cfbb92",
"commit": "00b247401fc4660d63583bb44117a84ecd36ae01",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/sub_package_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ jobs:
branch: cruft/update
commit-message: "Automatic package template update"
title: Updates from the package template
- add-paths: .cruft.json
body: reject these changes for this repo.
branch: cruft/reject
commit-message: "Reject this package template update"
title: Reject new updates from package template

steps:
- uses: actions/checkout@v4
Expand All @@ -42,7 +37,7 @@ jobs:
python-version: "3.11"

- name: Install Cruft
run: python -m pip install cruft
run: python -m pip install git+https://github.com/Cadair/cruft@patch-p1

- name: Check if update is available
continue-on-error: false
Expand Down
1 change: 1 addition & 0 deletions changelog/7652.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the `~sunpy.map.sources.gong.GONGHalphaMap.rsun_obs` to use correct header information ``solar-r`` keyword.
2 changes: 2 additions & 0 deletions changelog/7656.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added support for JSOC's HMI millisecond TAI time format.
Previously, it would only work with seconds.
1 change: 1 addition & 0 deletions changelog/7662.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix compilation with gcc 14, avoid implicit pointer conversions.
Binary file not shown.
7 changes: 2 additions & 5 deletions sunpy/io/src/ana/_pyana.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static PyObject * pyana_fzwrite(PyObject *self, PyObject *args) {
int compress = 1, debug=0;
char *header = NULL;
// Processed data goes here
PyObject *anadata_align;
PyArrayObject *anadata_align;
uint8_t *anadata_bytes;
// ANA file writing
int type, d;
Expand Down Expand Up @@ -334,7 +334,7 @@ static PyObject * pyana_fzwrite(PyObject *self, PyObject *args) {
// Sanitize data, make a new array from the old array and force the
// NPY_ARRAY_CARRAY_RO requirement which ensures a C-contiguous and aligned
// array will be made
anadata_align = PyArray_FromArray(anadata, PyArray_DESCR(anadata),NPY_ARRAY_CARRAY_RO);
anadata_align = (PyArrayObject*) PyArray_FromArray(anadata, PyArray_DESCR(anadata),NPY_ARRAY_CARRAY_RO);

// Get a pointer to the aligned data
anadata_bytes = (uint8_t*) PyArray_DATA(anadata_align);
Expand All @@ -344,12 +344,10 @@ static PyObject * pyana_fzwrite(PyObject *self, PyObject *args) {
int *dims = malloc(nd*sizeof(int));
// Get the dimensions and number of elements
npy_intp *npy_dims = PyArray_DIMS(anadata_align);
//npy_intp npy_nelem = PyArray_SIZE(anadata_align);

if (debug == 1) printf("pyana_fzwrite(): Dimensions: ");
for (d=0; d<nd; d++) {
// ANA stores dimensions the other way around?
//dims[d] = npy_dims[d];
dims[d] = npy_dims[nd-1-d];
if (debug == 1) printf(" %d", dims[d]);
}
Expand All @@ -363,6 +361,5 @@ static PyObject * pyana_fzwrite(PyObject *self, PyObject *args) {
ana_fzwrite(anadata_bytes, filename, dims, nd, header, type);

free(dims);
// If we didn't crash up to here, we're probably ok :P
return Py_BuildValue("i", 1);
}
6 changes: 5 additions & 1 deletion sunpy/map/sources/gong.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ def is_datasource_for(cls, data, header, **kwargs):
return (str(header.get('TELESCOP', '')).endswith('GONG') and
str(header.get('IMTYPE', '')).startswith('H-ALPHA'))


@property
def scale(self):
solar_r = self.meta['SOLAR-R'] * u.arcsec
return SpatialPair(solar_r / (self.meta['FNDLMBMI'] * u.pixel),
solar_r/ (self.meta['FNDLMBMA'] * u.pixel))

@property
def rsun_obs(self):
# Header contains a radius keyword which seems to have a higher priority but for GONG Ha is in pixels
return self.meta['SOLAR-R'] * u.arcsec

@property
def coordinate_system(self):
"""
Expand Down
4 changes: 4 additions & 0 deletions sunpy/map/sources/tests/test_gong_halpha_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def test_scale(gong_halpha):
assert_equal(gong_halpha.scale.axis2, 1.0794939681708389 * (u.arcsec / u.pix))


def test_rsun_obs(gong_halpha):
assert gong_halpha.rsun_obs == 971.544571353755 * u.arcsec


def test_nickname(gong_halpha):
"""Tests the nickname property of the GONGHalphaMap map."""
assert gong_halpha.nickname == "NSO-GONG, Big Bear"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"sunpy.map.tests.test_compositemap.test_plot_composite_map_colors": "4e6310746beab7a9d866aab10d86878aa5797b2f20ae933f8cfdcdf1ce9d461e",
"sunpy.map.tests.test_compositemap.test_set_alpha_composite_map": "2b2a157405dc296d5c06c74f7d8bc6e03b3cff4512cf9b0e66a773827497f37a",
"sunpy.map.tests.test_compositemap.test_peek_composite_map": "a21143a11c499d95b3618d2f82a6d6e8a3cbad6291ab52b20b218b3f4a03c45b",
"sunpy.map.tests.test_map_factory.test_map_jp2_HMI": "3b731f25ab5777f187def8296fbed88d27809867405e0e97d5e808ca1bb4b42c",
"sunpy.map.tests.test_map_factory.test_map_jp2_HMI": "0b92d617cae5712f3c9a131f2712e74e38cacddb16902a19ea26db424e40d1d2",
"sunpy.map.tests.test_mapbase.test_rotation_rect_pixelated_data": "5b37819c36a50a2a7a26944a2f1481027dd17390e73158f6b5510034102d35bb",
"sunpy.map.tests.test_mapbase.test_draw_contours_with_transform": "c0c7a13980dd5302e6a365080a9933caa70fab9e313d166c53384490218a2eea",
"sunpy.map.tests.test_mapbase.test_derotating_nonpurerotation_pcij[scipy]": "9168fca9a4e04def3da12624196b29ebe954004ad269faa4bab11276a85366af",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"sunpy.map.tests.test_compositemap.test_plot_composite_map_colors": "7c18ed0720d8b670fe903e2a493f4892466c97c23a22bf2ac815a596022ed275",
"sunpy.map.tests.test_compositemap.test_set_alpha_composite_map": "a0f312dfa68645b446a3a03a4adc2ce2e4452c30aae90348c6de0bf97b519a39",
"sunpy.map.tests.test_compositemap.test_peek_composite_map": "601847a982ee4a372def1eede3a992921a33986735e6ec5b7ca1a92a7a056846",
"sunpy.map.tests.test_map_factory.test_map_jp2_HMI": "d54c99b975dc2e5805bfd39e00627ad92fba9fe2d38e510fc72b143cfbc28e4c",
"sunpy.map.tests.test_map_factory.test_map_jp2_HMI": "a7098f65fd06e81723ab8310f8873d69bcc220100ceafa8edc24dfb07caa937c",
"sunpy.map.tests.test_mapbase.test_rotation_rect_pixelated_data": "356822787795278a4dab61bb8bbf5d62cc29d979ec1280653286a85b6188e944",
"sunpy.map.tests.test_mapbase.test_draw_contours_with_transform": "cb1bfc0b30651b48df1430782ec43ebde5f2a785b892f99e4b9763abb4758221",
"sunpy.map.tests.test_mapbase.test_derotating_nonpurerotation_pcij[scipy]": "c15c6c707b3b0e707936988054aeb818eee7b39e2249db5309ca43585d325a51",
Expand Down
13 changes: 8 additions & 5 deletions sunpy/time/tests/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,14 @@ def test_parse_time_ISO():


def test_parse_time_tai():
dt = Time('2007-05-04T21:08:12', scale='tai')
dt2 = parse_time('2007.05.04_21:08:12_TAI')

assert dt == dt2
assert dt.scale == dt2.scale
tai_format = Time('2007-05-04T21:08:12', scale='tai')
tai_format_micro = Time('2007-05-04T21:08:12.999999', scale='tai')
parsed_tai = parse_time('2007.05.04_21:08:12_TAI')
parsed_tai_micro = parse_time('2007.05.04_21:08:12.999999_TAI')
assert tai_format == parsed_tai
assert tai_format.scale == parsed_tai.scale
assert tai_format_micro == parsed_tai_micro
assert tai_format_micro.scale == parsed_tai_micro.scale


def test_parse_time_leap_second():
Expand Down
1 change: 1 addition & 0 deletions sunpy/time/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"%Y:%j:%H:%M:%S.%f", # Example 2012:124:21:08:12.999999
"%Y%m%d%H%M%S", # Example 20140101000001 (JSOC/VSO Export/Downloads)
"%Y.%m.%d_%H:%M:%S_TAI", # Example 2016.05.04_21:08:12_TAI - JSOC
"%Y.%m.%d_%H:%M:%S.%f_TAI", # Example 2019.09.15_00:00:02.898_TAI - JSOC
"%Y.%m.%d_%H:%M:%S_UTC", # Example 2016.05.04_21:08:12_UTC - JSOC
"%Y.%m.%d_%H:%M:%S", # Example 2016.05.04_21:08:12 - JSOC
"%Y/%m/%dT%H:%M", # Example 2007/05/04T21:08
Expand Down

0 comments on commit 2a5a61d

Please sign in to comment.