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

ENH: General Madrigal instrument #67

Merged
merged 34 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2a88e05
DOC: improved jro docstring
aburrell Jan 6, 2022
3326d33
DEL: removed old template
aburrell Jan 6, 2022
60197dd
DOC: updated download docstring
aburrell Jan 6, 2022
e4961fc
ENH: added Madrigal inst_code function
aburrell Jan 6, 2022
e30d0e0
TST: updated general tests
aburrell Jan 6, 2022
717713b
ENH: added a general madrigal inst
aburrell Jan 6, 2022
ae8f0b2
ENH: updated instrument init
aburrell Jan 6, 2022
7c0e163
DOC: updated changelog
aburrell Jan 6, 2022
975c2e1
ENH: added madrigal file format function
aburrell Feb 28, 2022
cc4d08e
ENH: updated instruments
aburrell Feb 28, 2022
0566cba
TST: added `known_madrigal_inst_codes` tests
aburrell Feb 28, 2022
c47d9d9
MAINT: added packaging
aburrell Feb 28, 2022
2d1bbc4
DOC: updated supported instruments
aburrell Feb 28, 2022
601ab15
DOC: updated changelog
aburrell Feb 28, 2022
51986d7
BUG: fixed test method names
aburrell Feb 28, 2022
7985813
Merge branch 'develop' into general_madrigal_inst
aburrell Feb 28, 2022
c780112
STY: Updated feedback.
rstoneback Mar 1, 2022
d87d035
DOC: updated example
aburrell Mar 1, 2022
4e892af
BUG: update test day
aburrell Mar 2, 2022
820a8a0
ENH: added verbose flag
aburrell Apr 4, 2022
fed0c70
Merge branch 'develop' into general_madrigal_inst
aburrell Apr 4, 2022
d77ec0c
TST: set general download True
aburrell Apr 6, 2022
3af6f71
BUG: fixed kindat handling
aburrell Apr 11, 2022
4336552
BUG: added handling for 'h5' extension
aburrell Apr 11, 2022
757c7cc
BUG: fixed file parsing
aburrell Apr 12, 2022
7e5746d
BUG: updated test dates
aburrell Apr 12, 2022
8db4725
BUG: fixed logic
aburrell Apr 13, 2022
9fc9e09
BUG: fixed delimiter bug in `list_files`
aburrell Apr 14, 2022
2d25046
MAINT: add pysat version cap
aburrell Apr 14, 2022
6ce1e74
Merge branch 'develop' into general_madrigal_inst
aburrell Apr 26, 2022
9e87e8a
STY: removed try/except statement
aburrell Apr 26, 2022
f412a3b
Merge branch 'develop' into general_madrigal_inst
aburrell Jul 22, 2022
e7f5272
MAINT: bumped pysat version
aburrell Jul 28, 2022
9ce2721
BUG: removed '8105' tag
aburrell Aug 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [0.1.0] - 2021-XX-XX
## [0.1.0] - 2022-XX-XX
- Enhancements
- Improved definitions of general and GNSS meta data
- Removed unused logic in cleaning routines
- Moved warning for no cleaning of JRO ISR data to preprocess
- Added a general Madrigal instrument for time-series data
- Added functions to specify all known Madrigal instrument codes and
file formats
- Documentation
- Added examples for JRO and GNSS data
- Testing
- Added unit tests for general, JRO, and GNSS methods
- Added the packaging module to handle version logic
- Bug
- Fixed bugs in the coordinate conversion functions

Expand Down
21 changes: 20 additions & 1 deletion docs/supported_instruments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TEC is provided by MIT Haystack.
:members:

JRO_ISR
----------------
-------

The incoherent scatter radar (ISR) at the
`Jicamarca Radio Observatory <http://jro.igp.gob.pe/english/>`_ regularly
Expand All @@ -31,3 +31,22 @@ magnetic equator over Peru.

.. automodule:: pysatMadrigal.instruments.jro_isr
:members:


Madrigal_Pandas
---------------

A general instrument for Madrigal time-series data. This
:py:class:`pysat.Instrument` uses Madrigal instrument codes and kindats to
support the use of any of the Madrigal time-series data sets. There are some
further constraints in that the data set's Madrigal naming convention must be
parsable by pysat. Currently nine Madrigal instrument codes are supported by
this :py:class:`pysat.Instrument`. When possible, using a specific instrument
module is recommended, since that instrument module will have additional
support (e.g., cleaning methods, experiment acknowledgements, and references).

.. automodule:: pysatMadrigal.instruments.madrigal_pandas
:members:



7 changes: 5 additions & 2 deletions pysatMadrigal/instruments/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Import Madrigal instruments
from pysatMadrigal.instruments import dmsp_ivm, gnss_tec, jro_isr
from pysatMadrigal.instruments import dmsp_ivm
from pysatMadrigal.instruments import gnss_tec
from pysatMadrigal.instruments import jro_isr
from pysatMadrigal.instruments import madrigal_pandas

# Import Madrigal methods
from pysatMadrigal.instruments import methods # noqa F401

# Define variable name with all available instruments
__all__ = ['dmsp_ivm', 'gnss_tec', 'jro_isr']
__all__ = ['dmsp_ivm', 'gnss_tec', 'jro_isr', 'madrigal_pandas']
14 changes: 6 additions & 8 deletions pysatMadrigal/instruments/gnss_tec.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,17 @@

pandas_format = False

# Madrigal tags
madrigal_inst_code = 8000
madrigal_tag = {'': {'vtec': '3500'}} # TODO(#12): `, 'los': '3505'}}`

# Local attributes
dname = '{{year:02d}}{{month:02d}}{{day:02d}}'
vname = '.{{version:03d}}'
supported_tags = {ss: {'vtec': ''.join(['gps', dname, 'g', vname,
".{file_type}"])}
fname = general.madrigal_file_format_str(madrigal_inst_code).split("*")
supported_tags = {ss: {'vtec': ''.join(['gps', fname[1], 'g', fname[2]])}
for ss in inst_ids.keys()}
remote_tags = {ss: {kk: supported_tags[ss][kk].format(file_type='hdf5')
for kk in inst_ids[ss]} for ss in inst_ids.keys()}

# Madrigal tags
madrigal_inst_code = 8000
madrigal_tag = {'': {'vtec': '3500'}} # , 'los': '3505'}} <- Issue #12

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

Expand Down
50 changes: 28 additions & 22 deletions pysatMadrigal/instruments/jro_isr.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env python
# Full license can be found in License.md
# Full author list can be found in .zenodo.json file
# DOI:10.5281/zenodo.3824979
# ----------------------------------------------------------------------------
# -*- coding: utf-8 -*-.
"""Supports the Incoherent Scatter Radar at the Jicamarca Radio Observatory

The Incoherent Scatter Radar (ISR) at the Jicamarca Radio Observatory (JRO)
observes ion drifts, line-of-sight neutral winds, electron density and
temperature, ion temperature, and ion composition through three overarching
experiments.

Downloads data from the JRO Madrigal Database.
"""Supports the Incoherent Scatter Radar at the Jicamarca Radio Observatory.

Properties
----------
Expand All @@ -30,7 +28,15 @@

Note
----
Please provide name and email when downloading data with this routine.
The Incoherent Scatter Radar (ISR) at the Jicamarca Radio Observatory (JRO)
observes ion drifts, line-of-sight neutral winds, electron density and
temperature, ion temperature, and ion composition through three overarching
experiments.

Downloads data from the JRO Madrigal Database.

Please provide name (user) and email (password) when downloading data with this
routine.

"""

Expand All @@ -55,24 +61,23 @@

pandas_format = False

# Local attributes
jro_fname1 = 'jro{{year:4d}}{{month:02d}}{{day:02d}}'
jro_fname2 = '.{{version:03d}}.{file_type}'
supported_tags = {ss: {'drifts': jro_fname1 + "drifts" + jro_fname2,
'drifts_ave': jro_fname1 + "drifts_avg" + jro_fname2,
'oblique_stan': jro_fname1 + jro_fname2,
'oblique_rand': jro_fname1 + "?" + jro_fname2,
'oblique_long': jro_fname1 + "?" + jro_fname2}
for ss in inst_ids.keys()}
remote_tags = {ss: {kk: supported_tags[ss][kk].format(file_type='hdf5')
for kk in inst_ids[ss]} for ss in inst_ids.keys()}

# Madrigal tags
madrigal_inst_code = 10
madrigal_tag = {'': {'drifts': "1910", 'drifts_ave': "1911",
'oblique_stan': "1800", 'oblique_rand': "1801",
'oblique_long': "1802"}, }

# Local attributes
jro_fname = general.madrigal_file_format_str(madrigal_inst_code)
supported_tags = {ss: {'drifts': jro_fname.replace("*", "drifts"),
'drifts_ave': jro_fname.replace("*", "drifts_avg"),
'oblique_stan': jro_fname.replace("*", ""),
'oblique_rand': jro_fname.replace("*", "?"),
'oblique_long': jro_fname.replace("*", "?")}
for ss in inst_ids.keys()}
remote_tags = {ss: {kk: supported_tags[ss][kk].format(file_type='hdf5')
for kk in inst_ids[ss]} for ss in inst_ids.keys()}

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

Expand Down Expand Up @@ -203,7 +208,7 @@ def download(date_array, tag='', inst_id='', data_path=None, user=None,
Notes
-----
The user's names should be provided in field user. Ruby Payne-Scott should
be entered as Ruby+Payne-Scott
be entered as "Ruby Payne-Scott"

The password field should be the user's email address. These parameters
are passed to Madrigal when downloading.
Expand All @@ -215,6 +220,7 @@ def download(date_array, tag='', inst_id='', data_path=None, user=None,
general.download(date_array, inst_code=str(madrigal_inst_code),
kindat=madrigal_tag[inst_id][tag], data_path=data_path,
user=user, password=password, file_type=file_type)
return


def load(fnames, tag=None, inst_id=None):
Expand Down