spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
149 stars 58 forks source link

Loading MAVEN data by orbit number doesn't work #894

Closed jameswilburlewis closed 3 months ago

jameswilburlewis commented 3 months ago

The MAVEN load routines assume that if the start/end times are integers, they should be interpreted as orbit numbers. But it doesn't seem to be working.

>>> data = pyspedas.maven.mag(trange=[500,501], datatype="ss1s")
23-Jun-24 13:22:29: Orbit numbers specified, checking for updated orbit # file from naif.jpl.nasa.gov

Traceback (most recent call last):
  File "/Users/jwl/PycharmProjects/pyspedas_examples/venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3526, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-9-263127da7aa6>", line 1, in <module>
    data = pyspedas.maven.mag(trange=[500,501], datatype="ss1s")
  File "/Users/jwl/PycharmProjects/pyspedas_examples/venv/lib/python3.9/site-packages/pyspedas/maven/__init__.py", line 134, in mag
    return maven_load(
  File "/Users/jwl/PycharmProjects/pyspedas_examples/venv/lib/python3.9/site-packages/pyspedas/maven/maven_load.py", line 283, in load_data
    maven_files = maven_filenames(
  File "/Users/jwl/PycharmProjects/pyspedas_examples/venv/lib/python3.9/site-packages/pyspedas/maven/maven_load.py", line 72, in maven_filenames
    start_date, end_date = orbit_time(start_date, end_date)
  File "/Users/jwl/PycharmProjects/pyspedas_examples/venv/lib/python3.9/site-packages/pyspedas/maven/orbit_time.py", line 72, in orbit_time
    with open(orb_file, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jwl/PycharmProjects/pyspedas_examples/venv/lib/python3.9/site-packages/pyspedas/maven/maven_orb_rec.orb'

To convert orbit numbers to times, there are routines that download and merge orbit files from http://naif.jpl.nasa.gov/pub/naif/MAVEN/kernels/spk/

Orbit files are being downloaded, but the code seems to be looking in the wrong directory when it tries to read them.