Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven mgs #200

Merged
merged 39 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6fb63b8
Addition of MAVEN module
t-esman Jul 13, 2023
7e19413
Merge branch 'develop' into maven_mgs_jk
jklenzing Jul 13, 2023
9678664
Merge pull request #196 from pysat/maven_mgs_jk
t-esman Jul 13, 2023
2c1e6aa
BUG: combine single value list
jklenzing Aug 3, 2023
ffc4242
ENH: use standard load
jklenzing Aug 3, 2023
0ef71dc
Update mvn_kp.py
t-esman Aug 4, 2023
df71e67
TME: Formatting, file rename
t-esman Aug 4, 2023
cbf0479
TME: Additional formatting
t-esman Aug 4, 2023
5ced356
STY: edit init
t-esman Aug 4, 2023
638c7d6
ENH: add sep instrument
t-esman Aug 10, 2023
35b2edf
Merge branch 'develop' into maven_mgs
jklenzing Sep 5, 2023
587c023
Apply suggestions from code review
jklenzing Sep 5, 2023
37716df
Update pysatNASA/instruments/__init__.py
jklenzing Sep 5, 2023
d6ce40d
Fixing merge issues
jklenzing Sep 6, 2023
30f375e
Update supported_instruments.rst
t-esman Sep 6, 2023
ed505df
Update .zenodo.json
t-esman Sep 6, 2023
fb5c4f9
Update maven_mag.py
t-esman Sep 6, 2023
af0c6e8
Apply suggestions from code review
t-esman Sep 6, 2023
31399d7
Apply suggestions from code review
t-esman Sep 6, 2023
3fed9d4
Apply suggestions from code review
t-esman Sep 6, 2023
86e2fd8
STY: reference indents fixed
t-esman Sep 6, 2023
c09bca9
BUG: don't clean symmetric matrices
jklenzing Sep 7, 2023
c1e0f88
DOC: add rationale
jklenzing Sep 7, 2023
f463041
DOC: update changelog
jklenzing Sep 7, 2023
2f3d9b1
BUG: skip check for pandas
jklenzing Sep 7, 2023
0d0b60f
Update pysatNASA/instruments/methods/general.py
jklenzing Sep 7, 2023
6f44f57
Merge pull request #203 from pysat/maven_mgs_jk
jklenzing Sep 7, 2023
f61b74c
Apply suggestions from code review
t-esman Sep 13, 2023
8474d74
Apply suggestions from code review
t-esman Sep 25, 2023
106aeb4
Apply suggestions from code review
t-esman Sep 28, 2023
a5a4672
STY: update clean routine
jklenzing Oct 2, 2023
c8a27a6
STY: apply to insitu kp
jklenzing Oct 2, 2023
2ea0dac
Merge branch 'maven_mgs' into maven_mgs_2
jklenzing Oct 2, 2023
857d848
DOC: update comments
jklenzing Oct 2, 2023
7ba9ffb
BUG: fix test dates
jklenzing Oct 2, 2023
d65734b
Apply suggestions from code review
t-esman Oct 3, 2023
e4a7880
Merge pull request #208 from pysat/maven_mgs_2
jklenzing Oct 3, 2023
bf3e276
Apply suggestions from code review
t-esman Oct 5, 2023
2b03daa
Merge branch 'develop' into maven_mgs
jklenzing Oct 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"orcid": "0000-0002-8191-4765"
},
{
"affilitation":"University of Colorado at Boulder",
"affiliation":"University of Colorado at Boulder",
"name": "Navarro, Luis",
"orcid": "0000-0002-6362-6575"
},
Expand All @@ -32,6 +32,11 @@
{
"name": "Spence, Carey",
"orcid": "0000-0001-8340-5625"
},
{
"affiliation": "NASA Postdoctoral Program, Goddard Space Flight Center",
"name": "Esman, Teresa",
"orcid": "0000-0003-0382-6281"
}
t-esman marked this conversation as resolved.
Show resolved Hide resolved
]
}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ This project adheres to [Semantic Versioning](https://semver.org/).

## [0.X.X] - 2023-XX-XX
* New Instruments
* MAVEN mag
* MAVEN SEP
* MAVEN in situ key parameters
* REACH Dosimeter
* Bug Fix
* Bug Fixes
* Fix general clean routine to skip transformation matrices
* New window needs to be integer for calculate_imf_steadiness
* Documentation
* Added example of how to export data for archival
Expand Down
24 changes: 24 additions & 0 deletions docs/supported_instruments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,30 @@ JPL GPS
.. automodule:: pysatNASA.instruments.jpl_gps
:members:

.. _maven_insitu_kp:

MAVEN INSITU KP
---------------

.. automodule:: pysatNASA.instruments.maven_insitu_kp
:members:

.. _maven_mag:

MAVEN MAG
---------

.. automodule:: pysatNASA.instruments.maven_mag
:members:

.. _maven_sep:

MAVEN SEP
---------

.. automodules:: pysatNASA.instruments.maven_sep
:members:

.. _omni_hro:

OMNI HRO
Expand Down
3 changes: 2 additions & 1 deletion pysatNASA/instruments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
'de2_lang', 'de2_nacs', 'de2_rpa', 'de2_vefi', 'de2_wats',
'dmsp_ssusi', 'formosat1_ivm',
'icon_euv', 'icon_fuv', 'icon_ivm', 'icon_mighti',
'igs_gps', 'iss_fpmu', 'jpl_gps', 'omni_hro', 'reach_dosimeter',
'igs_gps', 'iss_fpmu', 'jpl_gps', 'maven_insitu_kp',
'maven_mag', 'maven_sep', 'omni_hro', 'reach_dosimeter',
'ses14_gold', 'timed_guvi', 'timed_saber', 'timed_see']

for inst in __all__:
Expand Down
94 changes: 94 additions & 0 deletions pysatNASA/instruments/maven_insitu_kp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-
"""Module for the MAVEN insitu instruments.

Supports the in situ Key Parameter (kp) data from multiple instruments
onboard the Mars Atmosphere and Volatile Evolution (MAVEN) satellite.

Accesses local data in CDF format.
Downloads from CDAWeb.

Properties
----------
platform
'maven'
name
'insitu_kp'
tag
None supported
inst_id
None supported


Examples
--------
::
import pysat

insitu = pysat.Instrument(platform='maven', name='insitu_kp')
insitu.download(dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 31))
insitu.load(2020, 1, use_header=True)

"""

import datetime as dt
import functools

from pysat.instruments.methods import general as mm_gen
from pysatNASA.instruments.methods import cdaweb as cdw
from pysatNASA.instruments.methods import general as mm_nasa
from pysatNASA.instruments.methods import maven as mm_mvn

# ----------------------------------------------------------------------------
# Instrument attributes

platform = 'maven'
name = 'insitu_kp'
tags = {'': 'in situ Key Parameter data'}
inst_ids = {'': ['']}

pandas_format = False

# ----------------------------------------------------------------------------
# Instrument test attributes

_test_dates = {'': {'': dt.datetime(2020, 1, 1)}}

# ----------------------------------------------------------------------------
# Instrument methods

# Use standard init routine
init = functools.partial(mm_nasa.init, module=mm_mvn, name=name)


# Use default clean
clean = functools.partial(mm_nasa.clean,
skip_names=['Rotation_matrix_IAU_MARS_MAVEN_MSO',
'Rotation_matrix_SPACECRAFT_MAVEN_MSO'])


# ----------------------------------------------------------------------------
# Instrument functions
#
# Use the MAVEN and pysat methods

# Set the list_files routine
fname = ''.join(('mvn_insitu_kp-4sec_{year:04d}{month:02d}{day:02d}_',
'v{version:02d}_r{revision:02d}.cdf'))
supported_tags = {'': {'': fname}}
list_files = functools.partial(mm_gen.list_files,
supported_tags=supported_tags)
# Set the download routine
basic_tag = {'remote_dir': ''.join(('/pub/data/maven/insitu/kp-4sec/',
'cdfs/{year:04d}/{month:02d}')),
'fname': fname}
download_tags = {'': {'': basic_tag}}
download = functools.partial(cdw.download, supported_tags=download_tags)

# Set the list_remote_files routine
list_remote_files = functools.partial(cdw.list_remote_files,
supported_tags=download_tags)


# Set the load routine
load = functools.partial(cdw.load, epoch_name='epoch',
pandas_format=pandas_format, use_cdflib=True)
93 changes: 93 additions & 0 deletions pysatNASA/instruments/maven_mag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
"""Module for the MAVEN mag instrument.

Supports the Magnetometer (MAG) onboard the Mars Atmosphere
and Volatile Evolution (MAVEN) satellite.
Accesses local data in CDF format.
Downloads from CDAWeb.

Properties
----------
platform
'maven'
name
'mag'
tag
None supported
t-esman marked this conversation as resolved.
Show resolved Hide resolved
inst_id
None supported

Warnings
--------

- Only supports level-2 sunstate 1 second data.

Examples
--------
::
import pysat

t-esman marked this conversation as resolved.
Show resolved Hide resolved
mag = pysat.Instrument(platform='maven', name='mag')
t-esman marked this conversation as resolved.
Show resolved Hide resolved
mag.download(dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 31))
mag.load(2020, 1, use_header = True)

"""

import datetime as dt
import functools

from pysat.instruments.methods import general as mm_gen
from pysatNASA.instruments.methods import cdaweb as cdw
from pysatNASA.instruments.methods import general as mm_nasa
from pysatNASA.instruments.methods import maven as mm_mvn

# ----------------------------------------------------------------------------
# Instrument attributes

platform = 'maven'
name = 'mag'
tags = {'': 'Level 2 magnetometer data'}
inst_ids = {'': ['']}

pandas_format = False
# ----------------------------------------------------------------------------
# Instrument test attributes

_test_dates = {'': {'': dt.datetime(2020, 1, 1)}}

# ----------------------------------------------------------------------------
# Instrument methods

# Use standard init routine
init = functools.partial(mm_nasa.init, module=mm_mvn, name=name)


# Use default clean
clean = mm_nasa.clean


# ----------------------------------------------------------------------------
# Instrument functions
#
# Use the CDAWeb and pysat methods

# Set the list_files routine
fname = ''.join(('mvn_mag_l2-sunstate-1sec_{year:04d}{month:02d}{day:02d}_',
'v{version:02d}_r{revision:02d}.cdf'))
supported_tags = {'': {'': fname}}
list_files = functools.partial(mm_gen.list_files,
supported_tags=supported_tags)
# Set the download routine
basic_tag = {'remote_dir': ''.join(('/pub/data/maven/mag/l2/sunstate-1sec',
'/cdfs/{year:04d}/{month:02d}')),
'fname': fname}
download_tags = {'': {'': basic_tag}}
download = functools.partial(cdw.download, supported_tags=download_tags)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since none of these datasets have monthly files this is good, but should we use the cdasws interface for MAVEN.
I'm still not sure that the cdasws interface is ideal for all of our NASA instruments but I can put together some suggestions if we want to use it here.


# Set the list_remote_files routine
list_remote_files = functools.partial(cdw.list_remote_files,
supported_tags=download_tags)

# Set the load routine
load = functools.partial(cdw.load, epoch_name='epoch',
pandas_format=pandas_format, use_cdflib=True)
105 changes: 105 additions & 0 deletions pysatNASA/instruments/maven_sep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
"""Module for the MAVEN sep instrument.

Supports the Solar Energetic Particle (SEP) data from
onboard the Mars Atmosphere and Volatile Evolution (MAVEN) satellite.

Accesses local data in CDF format.
Downloads from CDAWeb.

Properties
----------
platform
'maven'
name
'sep'
tag
None supported
inst_id
['s1', 's2']

Examples
--------
::
import pysat

t-esman marked this conversation as resolved.
Show resolved Hide resolved
insitu = pysat.Instrument(platform='maven', name='sep', inst_id='s1')
insitu.download(dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 31))
insitu.load(2020, 1, use_header=True)

"""

import datetime as dt
import functools

from pysat.instruments.methods import general as mm_gen
from pysatNASA.instruments.methods import cdaweb as cdw
from pysatNASA.instruments.methods import general as mm_nasa
from pysatNASA.instruments.methods import maven as mm_mvn

# ----------------------------------------------------------------------------
# Instrument attributes

platform = 'maven'
name = 'sep'
tags = {'': 'Level 2 Solar Energetic Particle data'}
inst_ids = {'s1': [''], 's2': ['']}

pandas_format = False

# ----------------------------------------------------------------------------
# Instrument test attributes

_test_dates = {id: {'': dt.datetime(2020, 1, 1)} for id in inst_ids.keys()}

# ----------------------------------------------------------------------------
# Instrument methods

# Use standard init routine
init = functools.partial(mm_nasa.init, module=mm_mvn, name=name)


# Use default clean
clean = mm_nasa.clean


# ----------------------------------------------------------------------------
# Instrument functions
#
# Use the MAVEN and pysat methods

# Set the list_files routine
fname = ''.join(('mvn_sep_l2_s1-cal-svy-full_{year:04d}{month:02d}{day:02d}_',
'v{version:02d}_r{revision:02d}.cdf'))

fname2 = ''.join(('mvn_sep_l2_s2-cal-svy-full_{year:04d}{month:02d}{day:02d}_',
'v{version:02d}_r{revision:02d}.cdf'))

supported_tags = {'s1': {'': fname},
's2': {'': fname2}}

list_files = functools.partial(mm_gen.list_files,
supported_tags=supported_tags)

# Set the download routine
basic_tag = {'remote_dir': ''.join(('/pub/data/maven/sep/l2/s1-cal-svy-full',
'/{year:04d}/{month:02d}')),
'fname': fname}

basic_tag2 = {'remote_dir': ''.join(('/pub/data/maven/sep/l2/s2-cal-svy-full',
'/{year:04d}/{month:02d}')),
'fname': fname2}

download_tags = {'s1': {'': basic_tag},
's2': {'': basic_tag2}}

# Set the download routine
download = functools.partial(cdw.download, supported_tags=download_tags)

# Set the list_remote_files routine
list_remote_files = functools.partial(cdw.list_remote_files,
supported_tags=download_tags)

# Set the load routine
load = functools.partial(cdw.load, epoch_name='epoch',
pandas_format=pandas_format, use_cdflib=True)
4 changes: 3 additions & 1 deletion pysatNASA/instruments/methods/cdaweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,11 @@ def load_xarray(fnames, tag='', inst_id='',
ldata.append(temp_data)

# Combine individual files together, concat along epoch
if len(ldata) > 0:
if len(ldata) > 1:
data = xr.combine_nested(ldata, epoch_name,
combine_attrs='override')
else:
data = ldata[0]

all_vars = io.xarray_all_vars(data)

Expand Down
Loading
Loading