PmagPy / PmagPy/PmagPy

pmag.sundec function gives incorrect results

Open
#695 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
81
Forks
45
Avg merge
1d 14h
Merged PRs (30d)
8

Description

What command was run:
pmag.dosundec()

What happened:
The calculated core strike values from shadow angles are incorrect. They are consistently off from the magnetic strike values which are already corrected. Checking with the super-IAPD program confirms the magnetic core strike values and the calculated core strikes using sun compass values should agree.

I find that the issue with the dosundec function happens when the delta parameter from the Greenwich hour angle calculation function pmag.gha() is really close to the latitude of the paleomagnetic site. Rounding issues or integer casting of the latitude from user inputs will cause the conditional argument if delta < lat in pmag.dosundec() to jump between True and False values, causing the resultant sunaz parameter to have wrong values.

What I expected to happen:
@ltauxe Lisa, I am not very familiar with this function, and I am confused about why there is this line that compares the greenwich hour angle with the site latitude. It seems to me that line 4360 and 4361 are not necessary and are causing the issues. My light testing with some example data are shown below in the screenshot and in the example notebook in the zip file. It seems to me that removing those lines fixes the issue. Could you help explain what those lines do? Thanks!

Screenshot 2023-06-21 at 14 31 26

Data file(s):

sun_correction.zip

Screenshot(s):
Screenshot 2023-06-21 at 14 37 02

This screenshot shows the true magnetic core strike in the first column, the calculated core strike from sun angle using my modified dosundec() function that removed line 4360 and 4361 in pmag.py in the second column, and the calculated core strike from sun angle using the pmag.dosundec() without modifications in the third column. You can see that the values in the third column are all off by ~15 degrees from the true values.

PmagPy version:
Developer version, main branch, synced to the latest commits.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pmag.py around lines 4360-4361 and trace how pmag.dosundec() uses pmag.gha()'s delta and the site's latitude to calculate sunaz. Reproduce the discrepancy with the supplied sun_correction.zip example notebook, then verify the calculated core strikes against the magnetic values and the super-IAPD results.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.