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

Style unit suffix validation #706

Merged
merged 19 commits into from
Aug 10, 2023
Merged

Style unit suffix validation #706

merged 19 commits into from
Aug 10, 2023

Conversation

MattF-NSIDC
Copy link

@MattF-NSIDC MattF-NSIDC commented Aug 2, 2023

Description

Resolves #685

TODO:

  • Add instructions to documentation on continuous legends

Checklist

If an item on this list is done or not needed, simply check it with [x].

  • Config lockfile updated (inv config.export > qgreenland/config/cfg-lock.json)
  • Version bumped if needed (bumpversion (major|minor|patch|prerelease|build)
  • CHANGELOG.md updated
  • Documentation updated if needed
  • New unit tests if needed

@MattF-NSIDC
Copy link
Author

@trey-stafford re-writing these styles is a bit of tedium. May request to parallelize on this tomorrow :)


def get_style_filepath(style_name: str) -> Path:
"""Generate a Path object for style file represented by `style_name`."""
return ANCILLARY_DIR / "styles" / (style_name + ".qml")
Copy link
Author

Choose a reason for hiding this comment

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

Migrated from _style_filepath in config/layer.py

TODO: Does not support large numbers well, adds commas where the QGIS symbology menu
does not.
formatter.formatNumber(float(-9902))
>>> '-9,902'
Copy link
Author

Choose a reason for hiding this comment

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

I'm a bit frustrated running in to this after I thought I had things figured out. Is there any way to re-use QGIS' behavior for calculating these labels? What am I doing wrong?

Copy link
Author

Choose a reason for hiding this comment

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

We decided to just check that a suffix was populated for linearly-interpolated colorramps, not actually check for consistency with item labels.

Calculating the suffix from QGIS' QML file is difficult. Let's just give
up on that and do this the easier way.
Classification "mode" is how the values are classified: continuous,
equal interval, and quantile. It doesn't matter which of these is
chosen. What matters is the "Interpolation" setting. "Linear" is the
only one that will display a continuous legend.
@MattF-NSIDC MattF-NSIDC changed the title Style unit suffix validator Style unit suffix validation Aug 7, 2023
@MattF-NSIDC MattF-NSIDC marked this pull request as ready for review August 8, 2023 18:45
@MattF-NSIDC
Copy link
Author

@trey-stafford got the docs updated now too

Co-authored-by: Trey Stafford <trey.stafford@colorado.edu>
Copy link
Contributor

@trey-stafford trey-stafford left a comment

Choose a reason for hiding this comment

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

One final suggestion to update the error message w/ a link to RTD. Looks good!

@MattF-NSIDC MattF-NSIDC merged commit 4309130 into main Aug 10, 2023
1 check passed
@MattF-NSIDC MattF-NSIDC deleted the style-unit-suffix-validator branch August 10, 2023 21:43
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.

Raster colormap labels not showing units
3 participants