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

Add builtin 'config' object and 'features.future_geometry' toggle #519

Merged
merged 16 commits into from
Jun 27, 2023

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented May 31, 2023

This is the first step of many to allow users a way of transitioning easily between pyresample 1.x and pyresample 2.x interfaces and objects. As a first step this PR adds a new pyresample.config object using donfig and includes a features.future_geometries boolean flag. This flag modifies utility functions like create_area_def to return a future AreaDefinition instead of the old/existing AreaDefinition. Along with some changes to imports users should be able to easily switch usage to the new geometry objects semi-easily (I think).

This also adds a to_legacy() method to the future area so it is easier to create the future area but return the legacy version.

As part of these changes I originally added an import in pyresample/__init__.py so that importing AreaDefinition and SwathDefinition from pyresample would get you the new versions of the classes if this toggle config flag was set. This seemed near impossible to test so I ended up removing it.

TODO:

  • Add documentation on configuration

  • Modify other utility methods that create AreaDefinitions to use the toggle

  • Closes #xxxx

  • Tests added

  • Tests passed

  • Passes git diff origin/main **/*py | flake8 --diff

  • Fully documented

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Merging #519 (30305c2) into main (327cec1) will increase coverage by 0.02%.
The diff coverage is 95.69%.

@@            Coverage Diff             @@
##             main     #519      +/-   ##
==========================================
+ Coverage   94.31%   94.33%   +0.02%     
==========================================
  Files          79       82       +3     
  Lines       12936    13001      +65     
==========================================
+ Hits        12201    12265      +64     
- Misses        735      736       +1     
Flag Coverage Δ
unittests 94.33% <95.69%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyresample/test/test_gradient.py 99.00% <ø> (+0.01%) ⬆️
pyresample/utils/rasterio.py 62.50% <83.33%> (+8.92%) ⬆️
pyresample/test/test_utils.py 99.37% <97.05%> (-0.63%) ⬇️
pyresample/_config.py 100.00% <100.00%> (ø)
pyresample/area_config.py 90.58% <100.00%> (+0.13%) ⬆️
pyresample/future/geometry/area.py 100.00% <100.00%> (ø)
pyresample/geometry.py 87.50% <100.00%> (+<0.01%) ⬆️
pyresample/test/conftest.py 98.46% <100.00%> (+0.06%) ⬆️
pyresample/test/test_config/__init__.py 100.00% <100.00%> (ø)
pyresample/test/test_config/test_feature_flags.py 100.00% <100.00%> (ø)
... and 3 more

... and 2 files with indirect coverage changes

@djhoese djhoese closed this Jun 7, 2023
@djhoese djhoese reopened this Jun 7, 2023
@coveralls
Copy link

coveralls commented Jun 7, 2023

Coverage Status

coverage: 93.941% (+0.1%) from 93.846% when pulling 30305c2 on djhoese:feature-config-feat-flags into 2b94b70 on pytroll:main.

@djhoese djhoese marked this pull request as ready for review June 8, 2023 13:26
Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

A couple of typos I think, but otherwise LGTM! Thanks for taking the time to cleanup on the way

docs/source/howtos/configuration.rst Outdated Show resolved Hide resolved
pyresample/test/conftest.py Outdated Show resolved Hide resolved
@djhoese
Copy link
Member Author

djhoese commented Jun 8, 2023

Everything should be fixed here, but I'll wait to merge until the various bug fix PRs are merged and released.

@djhoese djhoese added this to the v1.28.0 milestone Jun 19, 2023
@djhoese djhoese merged commit faf3d96 into pytroll:main Jun 27, 2023
@djhoese djhoese deleted the feature-config-feat-flags branch June 27, 2023 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants