Skip to content

move planet data stats interval and filter args to required options #894

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 1 commit into from
Mar 24, 2023

Conversation

jreiberkyle
Copy link
Contributor

Related Issue(s):

Closes #887

Proposed Changes:

For inclusion in changelog (if applicable):

  1. move planet data stats interval and filter args to required options

Not intended for changelog:

Diff of User Interface

Old behavior:

planet data stats PSScene hour filter.json

New behavior:

planet data stats PSScene --interval hour --filter filter.json

PR Checklist:

  • This PR is as small and focused as possible
  • If this PR includes proposed changes for inclusion in the changelog, the title of this PR summarizes those changes and is ready for inclusion in the Changelog.
  • [] I have updated docstrings for function changes and docs in the 'docs' folder for user interface / behavior changes
  • This PR does not break any examples or I have updated them

(Optional) @mentions for Notifications:
@cholmes I don't see anywhere where the docs reference planet data stats so I didn't update nor add any.

Sorry, something went wrong.

@jreiberkyle jreiberkyle self-assigned this Mar 23, 2023
@cholmes
Copy link
Member

cholmes commented Mar 23, 2023

@cholmes I don't see anywhere where the docs reference planet data stats so I didn't update nor add any.

It's in #891, so in progress. I can update that one after this merges (or vice versa - happy to do the doc updates here if that merges first).

Copy link
Member

@cholmes cholmes left a comment

Choose a reason for hiding this comment

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

Tried it out - looks great!

Copy link
Contributor

@kevinlacaille kevinlacaille left a comment

Choose a reason for hiding this comment

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

When I run the interval for an hour I get a server error, which makes me a little curious as to what's going on. I should note that this filter, {"type": "AndFilter", "config": []}, provides results for any other interval.

> planet data stats PSScene --interval hour --filter filter.json                             

Error: {"general": [{"message": "Item search failed"}], "field": {}}

It seems to be unable to provide the stats for the past hour. Should we raise a ClientError for this? Also, should we be testing for this?

Comment on lines +802 to +804
args = ["stats", item_types, f'--filter={json.dumps(filter)}']
if interval:
args.append(f'--interval={interval}')
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for adding the keywords 👍

Base automatically changed from rc3dev-fixes to main March 24, 2023 17:04
@jreiberkyle
Copy link
Contributor Author

The failure is on the server side, due to the filter being too broad, this works for me:

 planet data filter --date-range acquired gt 2023-01-01 | planet data stats PSScene --interval hour --filter -

@jreiberkyle
Copy link
Contributor Author

since it's a server-side error we won't throw a ClientError. The SDK code seems to work as expected so I'll close but happy to reopen if there are concerns.

@jreiberkyle jreiberkyle merged commit 7aa43b6 into main Mar 24, 2023
@jreiberkyle jreiberkyle deleted the data-stats-887 branch March 29, 2023 23:06
@jreiberkyle jreiberkyle mentioned this pull request Apr 14, 2023
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.

Update planet data stats CLI and python API commands to match search
3 participants