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

Implement the AIASynopticClient #7842

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

GillySpace27
Copy link
Contributor

PR Description

This PR addresses issue #7828 , implementing the new Client as requested. In its current state the client returns found files, but it does not handle a.Wavelenth or a.Sample yet, which I'd like to ask for assistance in implementing.

@GillySpace27
Copy link
Contributor Author

I need help troubleshooting Wavelength and Sample attrs which aren't doing anything right now.

Example usage

time_range = a.Time("2023-10-11 00:00:00", "2023-10-11 01:00:00")
instrument = a.Instrument("AIASynoptic")
wavelength = a.Wavelength(193 * u.angstrom)
results = Fido.search(time_range, instrument, wavelength)
print(results)

Matchdict

The content of the matchdict from the pre_search_hook has this:
"""

special variables
function variables
'Instrument' =['aiasynoptic']
'Physobs' =['intensity']
'Source' =['SDO']
'Provider' =['JSOC']
'Level' =['1.5']
'Resolution' =['Synoptic']
'Start Time'=Time object: scale='utc' format='isot' value=2023-10-11T00:00:00.000
'End Time'=Time object: scale='utc' format='isot' value=2023-10-11T01:00:00.000
'Wavelength' =<sunpy.net.attrs.Wavelength(193.0, 193.0, 'Angstrom')>
"""

Console Printout:

Results from 1 Provider:

279 Results from the AIASynopticClient:
Source: https://jsoc1.stanford.edu/data/aia/synoptic/

   Start Time               End Time         Instrument  Physobs  Source Provider Level Resolution Wavelength

2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 94
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 131
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 171
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 193
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 211
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 304
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 335
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 1600
2023-10-11 00:00:00.000 2023-10-11 00:00:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 4500
2023-10-11 00:02:00.000 2023-10-11 00:02:59.999 AIASYNOPTIC intensity SDO JSOC 1.5 SYNOPTIC 94

@@ -448,7 448,8 @@ def __contains__(self, other):
if isinstance(other, Range):
return self.min <= other.min and self.max >= other.max
else:
return self.min <= other <= self.max
# return self.min <= other <= self.max
return self.min.value <= int(other) <= self.max.value
Copy link
Contributor

Choose a reason for hiding this comment

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

What query should I run to trigger the bug here?

Comment on lines 25 to 26
required = {a.Time, a.Instrument}
optional = {a.Sample, a.Level, a.Wavelength, a.ExtentType}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
required = {a.Time, a.Instrument}
optional = {a.Sample, a.Level, a.Wavelength, a.ExtentType}
required = {a.Time, a.Instrument, a.ExtentType, a.Provider}
optional = {a.Sample, a.Wavelength}

Maybe this would work, it's a lot to add for a query but it should make sure we only get the results from this client.

a.Source: [("SDO", "The Solar Dynamics Observatory.")],
a.Wavelength: [(f"{wv:04d}", f"{wv} Å") for wv in cls.known_wavelengths],
a.Provider: [("JSOC", "Joint Science Operations Center at Stanford.")],
a.Level: [("synoptic", "Level 1.5 data processed for quicker analysis.")],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
a.Level: [("synoptic", "Level 1.5 data processed for quicker analysis.")],
a.Level: [("1.5", "Level 1.5 data processed for quicker analysis.")],

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I was hoping to maybe just use the Level attribute. It seems appropriate: it labels a homogenious data set from JSOC with standardized processing steps and observational parameters. By referencing the synoptic level of AIA data you are specifying this in a way users probably already know to do. But this is just my preferred implementation and if you'd like it more standardized I understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, fair. I will have to let the others chime in on this matter before we make a change here.

@ayshih ayshih changed the title Implement the AIASynoptiClient, second try due to autoformatter Implement the AIASynopticClient, second try due to autoformatter Oct 23, 2024
Comment on lines 49 to 50
required_attrs = {a.Instrument, a.Level}
supported_attrs = {a.Time, a.Instrument, a.Sample, a.Level, a.Wavelength, a.ExtentType}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be able to be this from the client itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually does the main class's version of this not handle this already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I love the idea that only those two could be required but all the others are accepted too

I'm not sure what you mean about the main class, are you just saying that these values match the defaults?

Copy link
Contributor

@nabobalis nabobalis Oct 23, 2024

Choose a reason for hiding this comment

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

Sorry I wasn't clear.

This client inherits from a base class which should have a def _can_handle_query(self, *query): already which means that I think this isn't needed for this client. But it would need to be checked out to confirm or deny it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just went through and tried troubleshooting the inherited method and I'm missing something because the only way the client returns results is if I use my class' version of the function. It's probably just a syntax misunderstanding since the two versions are very similar.

Copy link
Contributor

Choose a reason for hiding this comment

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

INteresting, I have suspected that there is a bug somewhere in that function for a while now. I think this confirms it. For now, we can leave this here and worry about that in the future.

@nabobalis nabobalis changed the title Implement the AIASynopticClient, second try due to autoformatter Implement the AIASynopticClient Oct 23, 2024
@GillySpace27
Copy link
Contributor Author

I'm sorry I haven't tied this up yet, though it turns out that major flooding at the JSOC datacenter makes this less important for the time being. That said, what are the steps I need to take to keep/get the ball rolling on this PR?

Thanks again for your unending patience!

@nabobalis
Copy link
Contributor

I'm sorry I haven't tied this up yet, though it turns out that major flooding at the JSOC datacenter makes this less important for the time being. That said, what are the steps I need to take to keep/get the ball rolling on this PR?

Thanks again for your unending patience!

Sorry I somehow missed this message.

Unfortunately I think until the JSOC server is back, there isn't much we can do directly.
Having a quick glance over the PR, I see no outstanding issues, so hopefully when the server is back, we can handle the last remaining bits.

@nabobalis nabobalis added net Affects the net submodule Whats New? Needs a section added to the current Whats New? page. labels Jan 2, 2025
@nabobalis
Copy link
Contributor

Seems like the server is back with some data. So we can go back to finishing this PR up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Affects the net submodule Whats New? Needs a section added to the current Whats New? page.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants