should earthaccess provide a way to keep track of input query parameters? #847
Replies: 4 comments 12 replies
-
@JessicaS11 I think keeping track of the search parameters that got you to a search result is a good idea. As you note, we return a vanilla list, so there's nowhere to store that kind of information in the results object. For this, and the reasons discussed here, I think we should pivot to returning a results object so we can provide richer methods/metadata about results. Looking at >>> results = earthacces.search_data(...)
>>> type(results)
Earthaccess.Results
>>> search_args = results.search_args() # some dict, or a dict-like object that allows you to do:
>>> results_again = earthaccess.search_data(**search_args)
>>> results == results_again
True Which I think would get you most, if not all, of the functionality you want.
Can you expand on both of these? I am not sure I quite follow ^ There's a good argument to pull the search stuff into a class as well so that you could search multiple maturities or different catalogs at the same time. Technically, earthaccess already has this as packages are just singleton class objects, but allowing multiple instances could be helpful (e.g., you wouldn't have to pass an I do, however, prefer keeping the search classes and the results classes separate instead of combined like in |
Beta Was this translation helpful? Give feedback.
-
I'm a bit confused. Don't |
Beta Was this translation helpful? Give feedback.
-
Notes from today's hack session: For further discussion: separate the query and results objects entirely. This would be a breaking change but also help users when they need to be authenticated with multiple providers (since the auth wouldn't be attached to a package level earthaccess object). Another question is whether or not users directly call |
Beta Was this translation helpful? Give feedback.
-
I will continue to raise this in our various discussions related to CMR queries: we keep ignoring Perhaps as part of this discussion we should reconsider the relationship between If we want One way or the other (leveraging or abandoning Currently, we're sitting in a sort of "limbo," and I'd like to suggest we make a decision one way or the other and make progress towards getting out of "limbo," which continues to add to our technical debt, IMO. |
Beta Was this translation helpful? Give feedback.
-
In exploring replacing the icepyx.Query module with direct usage of earthaccess, a few fundamental questions are surfacing that I think are also relevant topics to explore in earthaccess. This one concerns a basic difference in an
ipx.Query
object andearthaccess.search
(which returns a list). Specifically, earthaccess does not in any way "store" the user's search criteria. It passes them through and returns a list of results. Both approaches (storing an object with the search criteria and results vs not) have their advantages and disadvantages.I'm curious to hear from others if the benefit of having some of this information stored in an object is worth the cost of having the object (and having the user interact with it rather than, e.g., the functions surfaced directly through
earthaccess.api
). My personal bias (surprise!) is that the object is nice to have: I can see exactly what search parameters I used (temporal, spatial, cloud-or-not, collection, etc.) for the set of results attached to it. I can use that information to feed into another API or tool, and if I change my code without updating my object I'm not confused by the results I have (plus, I don't have to scroll to the top of my notebook if I want any of that info). And I can have multiple objects with different search parameters and results attached (that I'm thus less likely to muck up, and also that I can do per-dataset operations on).I think this is an important conversation for moving forward with how earthaccess and icepyx will interface (and other plugins too). How will the plugins need to check if the earthaccess results they've been passed are valid for working with their tool? How would icepyx "get" and "use" earthaccess search results for its other capabilities (submitting a subset request; reading in data), given users can change filenames and not all datasets have the same metadata (so there'd be a lot of try/if statements to guess at what the user has passed in)?
Beta Was this translation helpful? Give feedback.
All reactions