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

Picciotto et al. 1960 isotopic temperature inference formula (journal club paper) #1498

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

slayoo
Copy link
Member

@slayoo slayoo commented Jan 9, 2025

No description provided.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.23%. Comparing base (824a94d) to head (364b053).

Files with missing lines Patch % Lines
...tope_temperature_inference/picciotto_et_al_1960.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1498   +/-   ##
=======================================
  Coverage   85.22%   85.23%           
=======================================
  Files         376      378    +2     
  Lines        9266     9277   +11     
=======================================
+ Hits         7897     7907   +10     
- Misses       1369     1370    +1     

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

Copy link
Collaborator

@AgnieszkaZaba AgnieszkaZaba left a comment

Choose a reason for hiding this comment

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

@slayoo
I tested fig_2 with changing delta_180 with delta_deuterium. For me it looks similar but need to add actual tests.
I can easily add it as a new commit if you want.

Copy link
Collaborator

Choose a reason for hiding this comment

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

New test for fig_2 that is just for plotting and need some assert.

def test_fig_2(plot=True):
    # arrange
    formulae = Formulae(isotope_temperature_inference="PicciottoEtAl1960")
    delta_18O = np.linspace(-35, -13) * PER_MILLE
    # act
    delta_deuterium = formulae.isotope_temperature_inference.temperature_from_delta_deuterium(
        in_unit(delta_18O, PER_MILLE)
    )
    
    # plot
    pyplot.figure(figsize=(5, 6))
    for side in ("top", "right"):
        pyplot.gca().spines[side].set_visible(False)
    pyplot.plot(in_unit(delta_deuterium, PER_CENT), in_unit(delta_18O, PER_MILLE), color="k")

    pyplot.xlabel("$\Delta$ D [%]")
    pyplot.xlim(-35, -10)
    pyplot.xticks(range(-35, -10, 5))

    pyplot.ylabel("δ$^{18}$O [‰]")
    pyplot.ylim(in_unit(delta_18O[0], PER_MILLE), in_unit(delta_18O[-1], PER_MILLE))
    pyplot.yticks(range(-35, -10, 5))

    pyplot.grid(color="k")
    pyplot.savefig("pysdm_fig2.pdf")
    if plot:
        pyplot.show()
    else:
        pyplot.clf()

Copy link
Collaborator

Choose a reason for hiding this comment

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

@staticmethod
    def temperature_from_delta_deuterium(const, delta_180):
        return const.PICCIOTTO_180_TO_DEUTERIUM_A * delta_180 - const.PICCIOTTO_180_TO_DEUTERIUM_B

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that I change it to minus B. Hmmm I need to add tests to properly check it

Copy link
Collaborator

Choose a reason for hiding this comment

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

PICCIOTTO_180_TO_DEUTERIUM_A = 0.8 * PER_CENT
PICCIOTTO_180_TO_DEUTERIUM_B = 1.8 * PER_CENT

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