-
Notifications
You must be signed in to change notification settings - Fork 42
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
calculate indices in client using one-liner #255
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first round of review notes 😅
I found this via #246 as I'm interested in how this aligns with OGC CQL and JS, but I can't understand what it's about. Could you translate it, please? ;-) |
The original post is not really explaining the PR, it's mainly wondering about how to write the unit tests. But in a nutshell, this PR adds a helper module to easily calculate the spectral indices defined in https://github.com/davemlz/eemont/blob/master/eemont/data/spectral-indices-dict.json:
and translates that into a process graph (based on band name mapping) |
maybe this is a better reference to this spectral indices repo: https://github.com/davemlz/awesome-spectral-indices |
Thanks, this is interesting. It seems that this is not a general "band math parser", right? Or I have missed the parsing in the code... |
current implementation does not really define a parser, but uses an |
"reference": "", | ||
"short_name": "ANIR", | ||
"type": "vegetation", | ||
"range": "(0,1)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not a direct copy from upstream, we should document (e.g. in a README) how this file was generated/edited, so that we can properly adapt it when there are "upstream" updates.
Even better would be a script that automatically generates an adapted file from the upstream source.
return array_modify(data=x_res, values=index_values, index=len(datacube.metadata.band_names)) | ||
|
||
|
||
def compute_indices(datacube: DataCube, index_list: list, uplim_rescale: int = None) -> DataCube: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this compute_indices
works with apply_dimension
where multiple indices are appended to the cube
I think user would also expect other approaches:
- compute multiple indices but disregard all original bands
- compute single index with
reduce_dimension
(e.g. how all the original NDVI examples are done)
no need to throw exception when collection band is "unknown" (it's not going to be used anyway)
no need to throw exception when collection band is "unknown" (it's not going to be used anyway)
31b9c92
to
9bb461d
Compare
Die testen moet ik echt nog aanpassen, maar ik weet niet zo goed hoe.
Ik heb gemerkt dat met die equals in de test_get_expression_map ik eender welke waarde in kan geven voor array_create en in alle gevallen gaat de test groen markeren, wat te maken zou moeten hebben met de implementatie van de eq (die eq aanroept, die er in de client ok uitziet).
Heb jij nog ideeën hoe ik die testen zou kunnen verbeteren?