diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2b6d7e88..9e9736bf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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 }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 45e17fae..d6ab5ffa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml index cc60a7dc..e0502661 100644 --- a/.github/workflows/pip_rc_install.yml +++ b/.github/workflows/pip_rc_install.yml @@ -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 }} diff --git a/.github/workflows/pysat_rc.yml b/.github/workflows/pysat_rc.yml index 85afb492..84bf06b4 100644 --- a/.github/workflows/pysat_rc.yml +++ b/.github/workflows/pysat_rc.yml @@ -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 }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 372e9427..06613778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,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 diff --git a/pyproject.toml b/pyproject.toml index 63b726aa..8213f9ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,6 +84,7 @@ markers = [ "download", "no_download", "load_options", + "new_tests", "first", "second" ] diff --git a/pysatNASA/instruments/de2_vefi.py b/pysatNASA/instruments/de2_vefi.py index 28f13a15..516e39cb 100644 --- a/pysatNASA/instruments/de2_vefi.py +++ b/pysatNASA/instruments/de2_vefi.py @@ -151,7 +151,7 @@ def load(fnames, tag='', inst_id='', **kwargs): 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(): diff --git a/pysatNASA/instruments/methods/cdaweb.py b/pysatNASA/instruments/methods/cdaweb.py index 1a3b1382..5bd2261f 100644 --- a/pysatNASA/instruments/methods/cdaweb.py +++ b/pysatNASA/instruments/methods/cdaweb.py @@ -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, @@ -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: @@ -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: @@ -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))) @@ -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) diff --git a/pysatNASA/instruments/methods/jhuapl.py b/pysatNASA/instruments/methods/jhuapl.py index 4a3e3bb0..a855c1e2 100644 --- a/pysatNASA/instruments/methods/jhuapl.py +++ b/pysatNASA/instruments/methods/jhuapl.py @@ -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) diff --git a/pysatNASA/instruments/methods/omni.py b/pysatNASA/instruments/methods/omni.py index a6c3df46..b456044d 100644 --- a/pysatNASA/instruments/methods/omni.py +++ b/pysatNASA/instruments/methods/omni.py @@ -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)) @@ -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] diff --git a/pysatNASA/tests/test_instruments.py b/pysatNASA/tests/test_instruments.py index 821dfe58..7a9eb1b9 100644 --- a/pysatNASA/tests/test_instruments.py +++ b/pysatNASA/tests/test_instruments.py @@ -89,13 +89,13 @@ def test_load_cdflib(self, inst_dict): target = 'Fake Data to be cleared' test_inst.data = [target] try: - test_inst.load(date=date, use_header=True, use_cdflib=True) + test_inst.load(date=date, use_cdflib=True) except ValueError as verr: # Check if instrument is failing due to strict time flag if str(verr).find('Loaded data') > 0: test_inst.strict_time_flag = False with warnings.catch_warnings(record=True) as war: - test_inst.load(date=date, use_header=True) + test_inst.load(date=date) assert len(war) >= 1 categories = [war[j].category for j in range(0, len(war))] assert UserWarning in categories