ondrolexa/apsg

Errors "object has no attribute 'dd'" occur when trying to tabulate data from an rs3 file that omits 'BDec' and 'BInc' values

macrobenthos opened this issue · 2 comments

Hi!
I sought to pull data from an rs3 file to perform further computations by using the from_rs3 class method. In this rs3 file, values for 'BDec' and 'BInc' are not specified.
Here's the code I used:

from apsg.feature import Core
rs3path = '/content/drive/MyDrive/paleomagnetism/2-1.rs3'
rs3core = Core.from_rs3(rs3path)
rs3core.datatable()

Upon running my code, an AttributeError pops up, stating that "AttributeError: 'NoneType' object has no attribute 'dd' ".
And the full error message can be seen below:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-53bbc95bbeba> in <cell line: 4>()
      2 rs3path = '/content/drive/MyDrive/paleomagnetism/2-1.rs3'
      3 rs3core = Core.from_rs3(rs3path)
----> 4 rs3core.datatable()

1 frames
/usr/local/lib/python3.10/dist-packages/apsg/feature/_paleomag.py in tilt(self)
    400         """Returns ``Vector3Set`` of vectors in tilt‐corrected coordinates system"""
    401         return self.geo.rotate(
--> 402             Lineation(self.bedding.dd[0] - 90, 0), -self.bedding.dd[1]
    403         )
    404 

AttributeError: 'NoneType' object has no attribute 'dd'

Hence, I modified the code as follows:

from apsg import fol
from apsg.feature import Core
rs3path = '/content/drive/MyDrive/paleomagnetism/2-1.rs3'
rs3core = Core.from_rs3(rs3path)
rs3core.bedding = fol(0,0)
rs3core.datatable()

However, this time, an AttributeError arises again, stating that "AttributeError: 'Foliation' object has no attribute 'dd' ".
And here is the full error message produced by running the modified code as follows:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-2849371bd677> in <cell line: 6>()
      4 rs3core = Core.from_rs3(rs3path)
      5 rs3core.bedding = fol(0,0)
----> 6 rs3core.datatable()

1 frames
/usr/local/lib/python3.10/dist-packages/apsg/feature/_paleomag.py in tilt(self)
    400         """Returns ``Vector3Set`` of vectors in tilt‐corrected coordinates system"""
    401         return self.geo.rotate(
--> 402             Lineation(self.bedding.dd[0] - 90, 0), -self.bedding.dd[1]
    403         )
    404 

AttributeError: 'Foliation' object has no attribute 'dd'

Could you provide some advice on how to solve this? Your assistance would be greatly appreciated.

It is fixed now in the master version and will later be released in version 1.1.5 Let me know.

p.s. to show core data use

rs3core.show()

The datatable is a property to a method of the Core instance.

I want to thank you for your assistance with my posted issue. Your resolution was instrumental for the progress of my pressing assignment, particularly given the scarcity of resources capable of handling paleomagnetic data in RS3 format. I apologize for my delayed response, and extend my gratitude once more.