Skip to content

[Python] Wrong key name for magnetic field at mirror point in find_mirror_point #54

@lkncl

Description

@lkncl

Hi, I just want to report a small error in the python wrapper for IRBEM (in IRBEM/python/IRBEM/IRBEM.py)
In the find_mirror_point python function, the magnetic field at mirror point is stored with the wrong key in the returned result.
The key bmin should be bmirr as it is decribed in the documentation (https://prbem.github.io/IRBEM/api/magnetic_coordinates.html#routine-FIND_MIRROR_POINT).

def find_mirror_point(self, X, maginput, alpha):
        """
        Find the magnitude and location of the mirror point along a field 
        line traced from any given location and local pitch-angle.

        Parameters
        ----------
        X: dict
            A dictionary that specifies the input time and location. The `time` key can be a
            ISO-formatted time string, or a `datetime.datetime` or `pd.TimeStamp` objects. 
            The three location keys: `x1`, `x2`, and `x3` specify the location in the `sysaxes`.
        maginput: dict
            The magnetic field input dictionary. See the online documentation for the valid
            keys and the corresponding models.
        alpha: float
            The local pitch angle in degrees.

        Returns
        -------
        dict
-          A dictionary with "blocal" and "bmin" scalars, and "POSIT" that contains the
+         A dictionary with "blocal" and "bmirr" scalars, and "POSIT" that contains the
            GEO coordinates of the mirror point.
        """
        a = ctypes.c_double(alpha)
        
        # Prep the magnetic field model inputs and samping spacetime location.
        self._prepMagInput(maginput)
        iyear, idoy, ut, x1, x2, x3 = self._prepTimeLoc(X)
        
-       blocal, bmin = [ctypes.c_double(-9999) for i in range(2)]
+      blocal, bmirr = [ctypes.c_double(-9999) for i in range(2)]
        positType = (3 * ctypes.c_double)
        posit = positType()

        if self.TMI: print("Running IRBEM-LIB mirror_point")
            
        self._irbem_obj.find_mirror_point1_(ctypes.byref(self.kext), \
                ctypes.byref(self.options), ctypes.byref(self.sysaxes), \
                ctypes.byref(iyear), ctypes.byref(idoy), ctypes.byref(ut), \
                ctypes.byref(x1), ctypes.byref(x2), ctypes.byref(x3), \
                ctypes.byref(a), ctypes.byref(self.maginput), \
-               ctypes.byref(blocal), ctypes.byref(bmin), ctypes.byref(posit))
+              ctypes.byref(blocal), ctypes.byref(bmirr), ctypes.byref(posit))
                
-       self.find_mirror_point_output = {'blocal':blocal.value, 'bmin':bmin.value, \
+      self.find_mirror_point_output = {'blocal':blocal.value, 'bmirr':bmirr.value, \
                'POSIT':posit[:]}
        return self.find_mirror_point_output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions