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

pre-validate band math tool entries #893

Open
jreiberkyle opened this issue Mar 22, 2023 · 3 comments
Open

pre-validate band math tool entries #893

jreiberkyle opened this issue Mar 22, 2023 · 3 comments

Comments

@jreiberkyle
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Creating an order with invalid band math entries results in the order being run for several minutes before the order finally fails. There is no pre-validation.

Describe the solution you'd like

Pre-validate band math entries before an order is run. This would likely happen in the band_math tool itself.

Describe alternatives you've considered

Additional context
Here's an order request with an invalid band math entry for b2.

{
  "name": "name",
  "products": [
    {
      "item_ids": [
        "20230322_161237_04_24ca"
      ],
      "item_type": "PSScene",
      "product_bundle": "analytic_udm2"
    }
  ],
  "tools": [
    {
      "bandmath": {
        "b1": "2*b1",
        "b2": "3*before",
        "pixel_type": "Auto"
      }
    }
  ]
}
@jreiberkyle jreiberkyle added this to the V2 Post-Release milestone Mar 22, 2023
@jreiberkyle
Copy link
Contributor Author

pre-validation could occur on a test 1x1xnum_bands numpy array, using regex to replace e.g. b1 with test_array[:,:,0] then run the expression and look for errors. note: requires numpy, which is currently not a dependency

@jreiberkyle
Copy link
Contributor Author

for now, hold off on this to discuss a broader strategy for pre-validation of various tools although this is probably the tool that would benefit from pre-validation the most

@tbarsballe
Copy link
Contributor

This still seems reasonable enough to do using AST parsing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants