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

calc_geodist_exact: allow passing DataArray #299

Merged
merged 5 commits into from Sep 21, 2023

Conversation

mathause
Copy link
Member

  • Closes #xxx
  • Tests added
  • Passes isort . && black . && flake8
  • Fully documented, including CHANGELOG.rst

Similar to #296: allow passing DataArray to calc_geodist_exact. Again I am keeping this in computation for the moment. Should probably go to mesmer.geospatial.

Again, inspired by #109. Thanks @znicholls

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.10% 🎉

Comparison is base (5a03e98) 86.79% compared to head (0591b3e) 86.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #299      +/-   ##
==========================================
+ Coverage   86.79%   86.89%   +0.10%     
==========================================
  Files          38       38              
  Lines        1568     1580      +12     
==========================================
+ Hits         1361     1373      +12     
  Misses        207      207              
Flag Coverage Δ
unittests 86.89% <100.00%> (+0.10%) ⬆️

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

Files Changed Coverage Δ
mesmer/stats/localized_covariance.py 96.42% <ø> (ø)
mesmer/core/computation.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mesmer/core/computation.py Show resolved Hide resolved
mesmer/core/computation.py Outdated Show resolved Hide resolved
mesmer/core/computation.py Outdated Show resolved Hide resolved
Comment on lines +154 to +155
lt = np.repeat(lat[i : i + 1], n_points - (i + 1))
ln = np.repeat(lon[i : i + 1], n_points - (i + 1))
Copy link
Member Author

@mathause mathause Sep 21, 2023

Choose a reason for hiding this comment

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

repeat is faster than tile. Also using an array (lat[i : i + 1]) is faster than a scalar (lat[i]).

@mathause mathause merged commit 1358e63 into MESMER-group:main Sep 21, 2023
7 checks passed
@mathause mathause deleted the calc_geodist_exact_dataarray branch September 21, 2023 20:17
mathause added a commit that referenced this pull request Sep 21, 2023
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.

None yet

1 participant