pyrolite icon indicating copy to clipboard operation
pyrolite copied to clipboard

[FEATURE] close and normalise functions in pyrolite.comp.codata

Open sarahshi opened this issue 1 year ago • 2 comments

Hi Morgan! I am working on some codata functions and thought I'd provide a very small patch for a note in the close function. I added a UserWarning for when negative values are in either the array for close or in the dataframe for normalise.

Is your feature request related to a problem? Please describe. This feature request addresses a comment in the documentation for pyrolite.comp.codata

Describe the solution you'd like Provide warnings when negative values are found in the close and normalise functions, explicitly replace zeros in division with NaN

Describe alternatives you've considered Solution provided in commit 267de50

sarahshi avatar Apr 27 '24 04:04 sarahshi

Hey @sarahshi! Apologies, I've been on a long block of leave. Thanks for adding an issue, this will be a nice little quality of life addition. Happy for you to open a PR onto to develop, otherwise I can just replicate the commit. l take a look now, and send through any comments.

morganjwilliams avatar May 14 '24 00:05 morganjwilliams

Hi @morganjwilliams. No worries at all! I incorporated your suggested logic, made small modifications to codata.py to have the renormalise function replace negative values with np.nan, and altered the UserWarning accordingly. See commit 58329ee for the new updates. I will open a pull request onto the develop branch now. Please let me know if you have any further suggested modifications to the code.

sarahshi avatar May 15 '24 18:05 sarahshi