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

Feat/set profile in imagedata #688

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

Conversation

iferencik
Copy link

@iferencik iferencik commented Mar 22, 2024

@vincentsarago

This PR adds an optional profile attribute to ImageData in case the reader that created it was requested to unscale the data.

as per developmentseed/titiler#803

The profile attr will contain the scales and offsets, which at this point are not part of the profile attribute of the rio DatasetReader

This is to accomodate a specific use case when the reader is not STAC or Mosaic.

if not 'scales' in dataset_profile:
dataset_profile['scales'] = dataset.scales
if not 'offsets' in dataset_profile:
dataset_profile['offsets'] = dataset.offsets
Copy link
Member

Choose a reason for hiding this comment

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

what if we want the scales and offsets info even if we don't apply them?

Copy link
Member

Choose a reason for hiding this comment

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

alos I think if we add profile we should always populate the field, not just when we unscale=True

Copy link
Author

Choose a reason for hiding this comment

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

well, i made it conditional on unscale request as to avoid issues with STAC and Mosaic readers.
I believe the profile probably is always available but i did this per your suggestion.

It would be easy to remove the condition and update the profile with "scales" and "offsets"

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.

2 participants