Skip to content

Commit

Permalink
Merge branch 'maven_mgs' into inst/maven_ngims
Browse files Browse the repository at this point in the history
  • Loading branch information
jklenzing committed Oct 2, 2023
2 parents 2671b48 + 106aeb4 commit 8c63359
Show file tree
Hide file tree
Showing 12 changed files with 385 additions and 8 deletions.
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"
}
]
}
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [0.X.X] - 2023-XX-XX
* Bug Fix
* New window needs to be integer for calculate_imf_steadiness
* New Instruments
* MAVEN mag
* MAVEN SEP
* MAVEN in situ
* Documentation
* Added example of how to export data for archival
* Bug Fixes
* New window needs to be integer for calculate_imf_steadiness
* Fix general clean routine to skip transformation matrices
* Maintenance
* Implemented unit tests for cleaning warnings
* Use pip install for readthedocs
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:

MAVEN INSITU
------------

.. automodule:: pysatNASA.instruments.maven_insitu
: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', 'maven_ngims', 'omni_hro',
'igs_gps', 'iss_fpmu', 'jpl_gps', 'maven_insitu_kp',
'maven_mag', 'maven_ngims', 'maven_sep', 'omni_hro',
'ses14_gold', 'timed_guvi', 'timed_saber', 'timed_see']

for inst in __all__:
Expand Down
92 changes: 92 additions & 0 deletions pysatNASA/instruments/maven_insitu_kp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# -*- 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 = {'': ''}
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 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
inst_id
None supported
Warnings
--------
- Only supports level-2 sunstate 1 second data.
Examples
--------
::
import pysat
mag = pysat.Instrument(platform='maven', name='mag')
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 = {'': 'l2'}
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)

# 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)
104 changes: 104 additions & 0 deletions pysatNASA/instruments/maven_sep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# -*- 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
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 = {'': ''}
inst_ids = {'s1': [''], 's2': ['']}

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 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

0 comments on commit 8c63359

Please sign in to comment.