Skip to content

Commit fad20da

Browse files
authored
Merge pull request #159 from pysat/text_file_bug
Bugfixes: file reading and downloads. Merging without review, since no other developers are actively working.
2 parents 1d994dd + 4c62b9e commit fad20da

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
19-
python-version: ["3.11", "3.12"]
19+
python-version: ["3.10", "3.13"]
2020
numpy_ver: ["latest"]
2121
test_config: ["latest"]
2222
include:
2323
# NEP29 compliance settings
24-
- python-version: "3.10"
25-
numpy_ver: "1.24"
24+
- python-version: "3.11"
25+
numpy_ver: "2.0"
2626
os: ubuntu-latest
2727
test_config: "NEP29"
2828
# Operational compliance settings
29-
- python-version: "3.9"
30-
numpy_ver: "1.23.5"
31-
os: "ubuntu-20.04"
29+
- python-version: "3.12"
30+
numpy_ver: "2.0"
31+
os: "ubuntu-latest"
3232
test_config: "Ops"
3333

3434
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Change Log
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](https://semver.org/).
55

6+
[0.2.2] - 2025-10-XX
7+
--------------------
8+
* Bugs
9+
* Fixed the remote location where NOAA Dst files are located
10+
* Fixed error in loading the 45-day F10.7 forecasts
11+
612
[0.2.1] - 2024-11-18
713
--------------------
814
* Enhancements

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ classifiers = [
2121
"License :: OSI Approved :: BSD License",
2222
"Natural Language :: English",
2323
"Programming Language :: Python :: 3",
24-
"Programming Language :: Python :: 3.9",
2524
"Programming Language :: Python :: 3.10",
2625
"Programming Language :: Python :: 3.11",
2726
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2828
"Operating System :: POSIX :: Linux",
2929
"Operating System :: MacOS :: MacOS X",
3030
"Operating System :: Microsoft :: Windows"

pysatSpaceWeather/instruments/methods/swpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ def recent_ap_f107_download(name, date_array, data_path,
875875

876876
# Get the F107
877877
raw_f107 = raw_data.split('45-DAY F10.7 CM FLUX FORECAST')[-1]
878-
raw_f107 = raw_f107.split('\n')[1:-4]
878+
raw_f107 = raw_f107.split('\n')[1:10]
879879

880880
# Parse the data
881881
ap_times, ap = parse_45day_block(raw_ap)

pysatSpaceWeather/instruments/sw_dst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def download(date_array, tag, inst_id, data_path, mock_download_dir=None):
286286

287287
# User anonymous, passwd anonymous@
288288
ftp.login()
289-
ftp.cwd('/STP/GEOMAGNETIC_DATA/INDICES/DST')
289+
ftp.cwd('/STP/space-weather/geomagnetic-data/INDICES/DST')
290290

291291
# Data stored by year. Only download for unique set of input years.
292292
years = np.array([date.year for date in date_array])

pysatSpaceWeather/tests/test_instruments.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ class TestInstruments(clslib.InstLibTests):
4949
5050
"""
5151

52+
def test_45day_forecast_data_length(self):
53+
"""Test that the downloaded 45-day forecasts load 45 days of data."""
54+
# Initalize the desired instrument parameters
55+
inst_dict = {'inst_module': pysatSpaceWeather.instruments.sw_f107,
56+
'tag': '45day', 'inst_id': ''}
57+
_, date = clslib.initialize_test_inst_and_date(inst_dict)
58+
59+
# Load the downloaded data
60+
self.test_inst = pysat.Instrument(**inst_dict)
61+
self.test_inst.load(date=date)
62+
63+
# Test that 45 days of F10.7 data are available
64+
assert len(self.test_inst['f107']) == 45
65+
return
66+
5267

5368
class TestSWInstrumentLogging(object):
5469
"""Test logging messages raised under instrument-specific conditions."""

0 commit comments

Comments
 (0)