Skip to content

increase min sunpy #63

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

Merged
merged 11 commits into from
Apr 9, 2025
Merged

increase min sunpy #63

merged 11 commits into from
Apr 9, 2025

Conversation

nabobalis
Copy link
Member

@nabobalis nabobalis commented Jul 23, 2024

This supersedes #48

  • Fixes Add towncrier #49
  • Renamed FortranTracer to PerformanceTracer
  • Deprecated FortranTracer
  • streamtracer is now a hard dep
  • Deprecated bunch of utils I think we don't need anymore.
  • Bunch of package updates
  • Trying to tidy up the example gallery
  • Adaptmap removed due to upstream support in sunpy

This turned into a large PR. I could split it out but i'm lazy.

@nabobalis nabobalis force-pushed the sunpy_version branch 3 times, most recently from 3b12579 to d4d8d35 Compare July 24, 2024 00:09
@nabobalis nabobalis marked this pull request as draft July 24, 2024 00:09
@nabobalis nabobalis marked this pull request as ready for review July 24, 2024 00:10
@nabobalis nabobalis marked this pull request as draft July 24, 2024 00:10
@nabobalis nabobalis force-pushed the sunpy_version branch 4 times, most recently from 1ba30c9 to d28706f Compare July 24, 2024 01:17
hmi_map.meta.update(_earth_obs_coord_meta(hmi_map.meta['date-obs']))


def load_adapt(adapt_path):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont have the same loader in sunpy but we can now load them directly. But only the first one.

This comment was marked as outdated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally use load_adapt almost every day i do research with sunkit-magex and send people examples which use it. It's very useful to be able to in one line get all the realizations loaded into a Map and then decide what to do next (choose one, average them all etc.), so i'd advocate that this function would be useful to have somewhere. I get that handling specific magnetograms doesn't make sense to be the job of sunkit-magex - could it be possible to house it in sunpy.map ? Is the direct use of astropy.io.fits problematic?

In any case, I'm good with this being deprecated for now and having this discussion elsewhere. Is it bad practise to have a long message here. if not, I suggest :

message = "Use sunpy.map.Map to load the first realization (see <link to examples/utils/reproject_car_to_cea.py>) or see https://docs.sunpy.org/en/latest/generated/gallery/saving_and_loading_data/load_adapt_fits_into_map.html on how to load all realizations"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the example can be updated to have the load_funciton or maybe it could be in sunpy but for me it does not belong in magex.

Cadair

This comment was marked as outdated.

@nabobalis nabobalis force-pushed the sunpy_version branch 5 times, most recently from 6af00f1 to bfacbe8 Compare July 24, 2024 22:44
@nabobalis nabobalis force-pushed the sunpy_version branch 5 times, most recently from 2d7c5db to 1f03469 Compare July 25, 2024 19:51
@nabobalis nabobalis marked this pull request as ready for review July 25, 2024 19:52
@nabobalis

This comment was marked as outdated.

@nabobalis nabobalis requested a review from Cadair August 22, 2024 19:54
"scipy>=1.10.1",
"streamtracer>=2.2.0",
"sunpy[map]>=6.0.1,!=6.0.0",
"matplotlib>=3.5.0", # Needed to solve the correct env for oldestdeps
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know how else to handle it

Copy link
Contributor

@STBadman STBadman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost everything looks good except the deprecation of FortranTracer looks to be broken - it's inheriting a child Class and as I understand it, this needs to be passed to .super()

Otherwise, I'm ok with load_adapt and fix_hmi_meta being deprecated and discussion of any gaps in capability moving to sunpy.

Thanks for all this work!

@@ -11,9 +11,8 @@ To enable this simply `install numba`_ and use `sunkit_magex.pfss` as normal.
Streamline tracing
==================

`sunkit_magex.pfss` has two streamline tracers: a pure python `sunkit_magex.pfss.tracing.PythonTracer` and a complied tracer `sunkit_magex.pfss.tracing.FortranTracer`.
The compiled version is significantly faster, using the `streamtracer`_ package.
`sunkit_magex.pfss` uses a complied tracer `sunkit_magex.pfss.tracing.PerformanceTracer` using the `streamtracer`_ package.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since we're not removing the pythontracer and there isn't a default behavior implemented anywhere yet we should still mention it here, like it was originally but just change FortranTracer to PerformanceTracer in the old line 14,

hmi_map.meta.update(_earth_obs_coord_meta(hmi_map.meta['date-obs']))


def load_adapt(adapt_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally use load_adapt almost every day i do research with sunkit-magex and send people examples which use it. It's very useful to be able to in one line get all the realizations loaded into a Map and then decide what to do next (choose one, average them all etc.), so i'd advocate that this function would be useful to have somewhere. I get that handling specific magnetograms doesn't make sense to be the job of sunkit-magex - could it be possible to house it in sunpy.map ? Is the direct use of astropy.io.fits problematic?

In any case, I'm good with this being deprecated for now and having this discussion elsewhere. Is it bad practise to have a long message here. if not, I suggest :

message = "Use sunpy.map.Map to load the first realization (see <link to examples/utils/reproject_car_to_cea.py>) or see https://docs.sunpy.org/en/latest/generated/gallery/saving_and_loading_data/load_adapt_fits_into_map.html on how to load all realizations"

@nabobalis
Copy link
Member Author

I think have addressed all of your points/questions @STBadman.

pyproject.toml Outdated
"sunpy[map]>=5.1",
"scipy>=1.10.1",
"streamtracer>=2.2.0",
"git+https://github.com/nabobalis/sunpy.git@database",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is me testing a commit to see if I can fix the database.

@nabobalis
Copy link
Member Author

Oh I am confused, sunpy doesn't change the meta anymore. If you access the attributes of the map, those should be correct now. I think .units?

Hm, I don't know. But I just checked and run some old code that uses fix_hmi_meta. I run it with applying fix_hmi_meta and also without (i.e., just loading the HMI file with sunpy). The resulting figures look the same, only in the latter case, some SunpyMetadataWarning are printed:

Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase]
2024-09-17 18:19:50 - sunpy - INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere.
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hgln_obs,hglt_obs,dsun_obs
For frame 'heliographic_carrington' the following metadata is missing: crlt_obs,dsun_obs,crln_obs
 [sunpy.map.mapbase]
2024-09-17 18:19:50 - sunpy - WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hgln_obs,hglt_obs,dsun_obs
For frame 'heliographic_carrington' the following metadata is missing: crlt_obs,dsun_obs,crln_obs

Which HMI files were causing these warnings?

@jgieseler
Copy link
Member

jgieseler commented Mar 14, 2025

Which HMI files were causing these warnings?

It might be 2021-04-17 13:04 (mrzqs210417t1304c2243_256.fits). At least I modified that file close to when writing my message here (and the April 17 event is quite often my default setting).

Copy link
Contributor

@STBadman STBadman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @nabobalis - I think it's in good shape!

@nabobalis nabobalis merged commit 5bf2a62 into main Apr 9, 2025
11 of 13 checks passed
@nabobalis nabobalis deleted the sunpy_version branch April 9, 2025 16:27
@nabobalis
Copy link
Member Author

Thanks everyone

@nabobalis nabobalis removed the request for review from jgieseler April 9, 2025 16:27
@STBadman
Copy link
Contributor

STBadman commented Apr 9, 2025

Thank you @nabobalis !

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

Successfully merging this pull request may close these issues.

Add towncrier
4 participants