Skip to content

Commit

Permalink
Added usage examples and valid coordinates to mms_qcotrans docstrings…
Browse files Browse the repository at this point in the history
…; added tests for mms_qcotrans return values
  • Loading branch information
jameswilburlewis committed Dec 19, 2023
1 parent 6b6703b commit 0a6dbed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 11 additions & 2 deletions pyspedas/mms/cotrans/mms_qcotrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ def mms_qcotrans(in_name=None, out_name=None, in_coord=None, out_coord=None, pro
Names of output variables
in_coord: str
Input coordinate system (e.g. 'bcs','gse','gse2000','gsm','sm','geo','eci')
Input coordinate system, valid options:
'bcs', 'dbcs', 'dmpa', 'smpa', 'dsl', 'ssl', 'gse', 'gse2000', 'gsm', 'sm', 'geo', 'eci', 'j2000'
out_coord: str
Output coordinate system (e.g. 'bcs','gse','gse2000','gsm','sm','geo','eci')
Output coordinate system valid options:
'bcs', 'dbcs', 'dmpa', 'smpa', 'dsl', 'ssl', 'gse', 'gse2000', 'gsm', 'sm', 'geo', 'eci', 'j2000'
probe: str
MMS spacecraft # (must be 1, 2, 3, or 4)
Expand All @@ -51,6 +53,13 @@ def mms_qcotrans(in_name=None, out_name=None, in_coord=None, out_coord=None, pro
--------
List of variables created
Examples
--------
>>> from pyspedas import mms # Import MMS namespace
>>> mms.mec() # Load quaternions, positions, and velocity variables from MEC data, using default parameters
>>> mms_qcotrans('mms1_mec_v_sm', 'mms1_mec_v_sm_2gse', out_coord='gse') # Transform SM velocity to GSE
>>> mms_qcotrans('mms1_mec_r_sm', 'mms1_mec_r_sm_2gse', out_coord='gse') # Transform SM position to GSE
')
"""
valid_probes = ['1', '2', '3', '4']
valid_coords = ['bcs', 'dbcs', 'dmpa', 'smpa', 'dsl', 'ssl', 'gse', 'gse2000', 'gsm', 'sm', 'geo', 'eci', 'j2000']
Expand Down
6 changes: 4 additions & 2 deletions pyspedas/mms/tests/cotrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
class CotransTestCases(unittest.TestCase):
def test_qcotrans_sm_to_gse(self):
pyspedas.mms.mec()
mms_qcotrans('mms1_mec_v_sm', 'mms1_mec_v_sm_2gse', out_coord='gse')
mms_qcotrans('mms1_mec_r_sm', 'mms1_mec_r_sm_2gse', out_coord='gse')
ret1 = mms_qcotrans('mms1_mec_v_sm', 'mms1_mec_v_sm_2gse', out_coord='gse')
ret2 = mms_qcotrans('mms1_mec_r_sm', 'mms1_mec_r_sm_2gse', out_coord='gse')
self.assertTrue(data_exists('mms1_mec_v_sm_2gse'))
self.assertTrue('mms1_mec_v_sm_2gse' in ret1)
self.assertTrue('mms1_mec_r_sm_2gse' in ret2)
self.assertTrue(data_exists('mms1_mec_r_sm_2gse'))
mms_qcotrans(['mms1_mec_r_sm', 'mms1_mec_v_sm'], ['mms1_mec_r_sm_2gse', 'mms1_mec_v_sm_2gse'], out_coord=['gse', 'gse'])

Expand Down

0 comments on commit 0a6dbed

Please sign in to comment.