Skip to content

Commit

Permalink
Merge branch 'rc_0_0_6' into no_remote_files
Browse files Browse the repository at this point in the history
  • Loading branch information
aburrell authored Aug 5, 2024
2 parents 4d627af + 93924dd commit e866196
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:

name: Documentation tests
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pip_rc_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pysat_rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [0.0.6] - 2024-XX-XX
## [0.0.6] - 2024-07-31
* New Instruments
* DE2 VEFIMAGB - electric and magnetic field on the same cadence
* MAVEN mag
* MAVEN MAG
* MAVEN SEP
* MAVEN in situ key parameters
* REACH Dosimeter
Expand Down Expand Up @@ -40,6 +40,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
* Added version cap for sphinx_rtd_theme
* Include standard tests for ICON IVM-B
* Update NEP29 standards for Jun 2024
* Updated standards for pandas, numpy, and pysat
* Updated versions in GitHub Actions

## [0.0.5] - 2023-06-27
* New Instruments
Expand Down
4 changes: 2 additions & 2 deletions docs/supported_instruments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ JPL GPS

.. _maven_insitu_kp:

MAVEN INSITU KP
---------------
MAVEN IN SITU KP
----------------

.. automodule:: pysatNASA.instruments.maven_insitu_kp
:members:
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pysatNASA"
version = "0.0.5"
version = "0.0.6"
description = "pysat support for NASA Instruments"
readme = "README.md"
requires-python = ">=3.6"
Expand Down Expand Up @@ -44,7 +44,7 @@ dependencies = [
"netCDF4",
"numpy",
"pandas",
"pysat >= 3.1",
"pysat >= 3.2",
"requests",
"scipy >= 1.4",
"xarray"
Expand Down Expand Up @@ -84,6 +84,7 @@ markers = [
"download",
"no_download",
"load_options",
"new_tests",
"first",
"second"
]
12 changes: 9 additions & 3 deletions pysatNASA/instruments/de2_vefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
tag
'', 'dca', 'ac'
inst_id
none supported
None supported
Warnings
Expand Down Expand Up @@ -133,7 +133,9 @@ def load(fnames, tag='', inst_id='', **kwargs):
inst_id : str
Instrument ID used to identify particular data set to be loaded.
This input is nominally provided by pysat itself. (default='')
**kwargs : unpacked dict
Optional kwargs that will be passed to the
`pysatNASA.instruments.methods.cdaweb.load_xarray` function
Returns
-------
data : pds.DataFrame
Expand All @@ -146,12 +148,16 @@ def load(fnames, tag='', inst_id='', **kwargs):
Several variables relating to time stored in different formats are dropped.
These are redundant and complicate the load procedure.
See Also
--------
pysatNASA.instruments.methods.cdaweb.load_xarray
"""

if tag == '':
# Warn user that e-field data is dropped.
estr = 'E-field data dropped'
pysat.logger.warn(estr)
pysat.logger.warning(estr)

# Drop E-field data
if 'use_cdflib' in kwargs.keys():
Expand Down
2 changes: 1 addition & 1 deletion pysatNASA/instruments/de2_vefimagb.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

# Set the load routine
def load(fnames, tag='', inst_id='', **kwargs):
"""Load DE2 VEFI data.
"""Load DE2 VEFI MAG B-field data.
This routine is called as needed by pysat. It is not intended
for direct user interaction.
Expand Down
6 changes: 3 additions & 3 deletions pysatNASA/instruments/dmsp_ssusi.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ def clean(self):


def concat_data(self, new_data, combine_times=False, **kwargs):
"""Concatonate data to self.data for DMSP SSUSI data.
"""Concatenate data to self.data for DMSP SSUSI data.
Parameters
----------
new_data : xarray.Dataset or list of such objects
New data objects to be concatonated
New data objects to be concatenated
combine_times : bool
For SDR data, optionally combine the different datetime coordinates
into a single time coordinate (default=False)
Expand All @@ -155,7 +155,7 @@ def concat_data(self, new_data, combine_times=False, **kwargs):
if self.tag in ['sdr-disk', 'sdr2-dist']:
time_dims.append('time_auroral')

# Concatonate using the appropriate method for the number of time
# Concatenate using the appropriate method for the number of time
# dimensions
jhuapl.concat_data(self, time_dims, new_data, combine_times=combine_times,
**kwargs)
Expand Down
10 changes: 5 additions & 5 deletions pysatNASA/instruments/maven_insitu_kp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is
# unlimited.
# ----------------------------------------------------------------------------
"""Module for the MAVEN insitu instruments.
"""Module for the MAVEN in situ instruments.
Supports the in situ Key Parameter (kp) data from multiple 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.
Expand All @@ -32,9 +32,9 @@
::
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)
insitukp = pysat.Instrument(platform='maven', name='insitu_kp')
insitukp.download(dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 31))
insitukp.load(2020, 1, use_header=True)
"""

Expand Down
2 changes: 1 addition & 1 deletion pysatNASA/instruments/maven_mag.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is
# unlimited.
# ----------------------------------------------------------------------------
"""Module for the MAVEN mag instrument.
"""Module for the MAVEN magnetometer.
Supports the Magnetometer (MAG) onboard the Mars Atmosphere
and Volatile Evolution (MAVEN) satellite.
Expand Down
8 changes: 4 additions & 4 deletions pysatNASA/instruments/maven_sep.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is
# unlimited.
# ----------------------------------------------------------------------------
"""Module for the MAVEN sep instrument.
"""Module for the MAVEN Solar Energetic Particle instrument.
Supports the Solar Energetic Particle (SEP) data from
onboard the Mars Atmosphere and Volatile Evolution (MAVEN) satellite.
Expand All @@ -31,9 +31,9 @@
::
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)
sep = pysat.Instrument(platform='maven', name='sep', inst_id='s1')
sep.download(dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 31))
sep.load(2020, 1, use_header=True)
"""

Expand Down
14 changes: 7 additions & 7 deletions pysatNASA/instruments/methods/cdaweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def load(fnames, tag='', inst_id='', file_cadence=dt.timedelta(days=1),
else:
if not use_cdflib:
estr = 'The `use_cdflib` option is not currently enabled for xarray'
pysat.logger.warn(estr)
pysat.logger.warning(estr)

data, meta = load_xarray(fnames, tag=tag, inst_id=inst_id,
epoch_name=epoch_name,
Expand Down Expand Up @@ -264,8 +264,8 @@ def load_pandas(fnames, tag='', inst_id='', file_cadence=dt.timedelta(days=1),
tdata = tdata.loc[date:date2, :]
ldata.append(tdata)
except ValueError as verr:
logger.warn("unable to load {:}: {:}".format(fname,
str(verr)))
logger.warning(
"unable to load {:}: {:}".format(fname, str(verr)))
else:
# Basic data return
with CDF(lfname) as cdf:
Expand All @@ -274,8 +274,8 @@ def load_pandas(fnames, tag='', inst_id='', file_cadence=dt.timedelta(days=1),
flatten_twod=flatten_twod)
ldata.append(temp_data)
except ValueError as verr:
logger.warn("unable to load {:}: {:}".format(lfname,
str(verr)))
logger.warning(
"unable to load {:}: {:}".format(lfname, str(verr)))

# Combine individual files together
if len(ldata) > 0:
Expand Down Expand Up @@ -847,7 +847,7 @@ def list_remote_files(tag='', inst_id='', start=None, stop=None,
if 'month' in search_dir['keys']:
search_times = pds.date_range(start,
stop + pds.DateOffset(months=1),
freq='M')
freq='ME')
for time in search_times:
subdir = format_dir.format(year=time.year, month=time.month)
url_list.append('/'.join((remote_url, subdir)))
Expand All @@ -859,7 +859,7 @@ def list_remote_files(tag='', inst_id='', start=None, stop=None,
else:
search_times = pds.date_range(start, stop
+ pds.DateOffset(years=1),
freq='Y')
freq='YE')
for time in search_times:
doy = int(time.strftime('%j'))
subdir = format_dir.format(year=time.year, day=doy)
Expand Down
8 changes: 4 additions & 4 deletions pysatNASA/instruments/methods/jhuapl.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ def load_sdr_aurora(fnames, name='', tag='', inst_id='', pandas_format=False,

# Ensure identical day and night dimensions for GUVI
if name == 'guvi':
if sdata.dims['nAlongDay'] != sdata.dims['nAlongNight']:
if sdata.sizes['nAlongDay'] != sdata.sizes['nAlongNight']:
raise ValueError('Along-track day and night dimensions differ')

if 'nCrossDay' in rename_dims.keys():
if sdata.dims['nCrossDay'] != sdata.dims['nCrossNight']:
if sdata.sizes['nCrossDay'] != sdata.sizes['nCrossNight']:
raise ValueError(''.join([
'Cross-track day and night dimensions differ ',
'{:} != {:}'.format(sdata.dims['nCrossDay'],
sdata.dims['nCrossNight'])]))
'{:} != {:}'.format(sdata.sizes['nCrossDay'],
sdata.sizes['nCrossNight'])]))

# Combine identical dimensions and rename some time dimensions
sdata = sdata.rename_dims(rename_dims)
Expand Down
7 changes: 1 addition & 6 deletions pysatNASA/instruments/methods/maven.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is
# unlimited.
# ----------------------------------------------------------------------------
"""Provides non-instrument specific routines for MAVEN data.
Created on Thu Jul 13 11:21:01 2023
@author: tesman
"""
"""Provides non-instrument specific routines for MAVEN data."""

ackn_str = ''.join(('Jakosky, B.M., Lin, R.P., Grebowsky, J.M. et al.',
' The Mars Atmosphere and Volatile Evolution',
Expand Down
16 changes: 9 additions & 7 deletions pysatNASA/instruments/methods/omni.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ def time_shift_to_magnetic_poles(inst):

# Need to fill in Vx to get an estimate of what is going on.
inst['Vx'] = inst['Vx'].interpolate('nearest')
inst['Vx'] = inst['Vx'].fillna(method='backfill')
inst['Vx'] = inst['Vx'].fillna(method='pad')
inst['Vx'] = inst['Vx'].bfill()
inst['Vx'] = inst['Vx'].ffill()

inst['BSN_x'] = inst['BSN_x'].interpolate('nearest')
inst['BSN_x'] = inst['BSN_x'].fillna(method='backfill')
inst['BSN_x'] = inst['BSN_x'].fillna(method='pad')
inst['BSN_x'] = inst['BSN_x'].bfill()
inst['BSN_x'] = inst['BSN_x'].ffill()

# Make sure there are no gaps larger than a minute.
inst.data = inst.data.resample('1T').interpolate('time')
inst.data = inst.data.resample('1min').interpolate('time')

time_x = inst['BSN_x'] * 6371.2 / -inst['Vx']
idx, = np.where(np.isnan(time_x))
Expand Down Expand Up @@ -164,12 +164,14 @@ def calculate_imf_steadiness(inst, steady_window=15, min_window_frac=0.75,
if steady:
del_min = int((inst.data.index[i]
- inst.data.index[i - 1]).total_seconds() / 60.0)
if np.isnan(cv) or np.isnan(ca_std[i]) or del_min > sample_rate:
if np.any([np.isnan(cv),
np.isnan(ca_std.iloc[i]),
del_min > sample_rate]):
# Reset the steadiness flag if fill values are encountered, or
# if an entry is missing
steady = False

if cv <= max_bmag_cv and ca_std[i] <= max_clock_angle_std:
if cv <= max_bmag_cv and ca_std.iloc[i] <= max_clock_angle_std:
# Steadiness conditions have been met
if steady:
imf_steady[i] = imf_steady[i - 1]
Expand Down
8 changes: 1 addition & 7 deletions pysatNASA/instruments/reach_dosimeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
The Responsive Environmental Assessment Commercially Hosted (REACH)
constellation is collection of 32 small sensors hosted on six orbital planes of
the Iridium-Next space vehicles in low earth orbit. Each sensor contains two
the Iridium-Next space vehicles in Low Earth Orbit. Each sensor contains two
micro-dosimeters sensitive to the passage of charged particles from the Earth's
radiation belts. There are six distinct dosimeter types spread among the 64
individual sensors, which are unique in shielding and electronic threshold.
Expand All @@ -33,8 +33,6 @@
'101', '102', '105', '108', '113', '114', '115', '116', '133', '134', '135',
'136', '137', '138', '139', '140', '148', '149', '162', '163', '164', '165',
'166', '169', '170', '171', '172', '173', '175', '176', '180', '181'
"""

import datetime as dt
Expand Down Expand Up @@ -69,8 +67,6 @@

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


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

Expand All @@ -84,8 +80,6 @@ def preprocess(self):
self.acknowledgements = self.meta.header.Acknowledgement

return


# ----------------------------------------------------------------------------
# Instrument functions
#
Expand Down
Loading

0 comments on commit e866196

Please sign in to comment.