Skip to content

Commit

Permalink
MAINT: updated pandas frequency
Browse files Browse the repository at this point in the history
Update the format of the pandas frequency to address FutureWarnings.
  • Loading branch information
aburrell committed Aug 13, 2024
1 parent 1bf5775 commit c13247c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pysatSpaceWeather/instruments/methods/f107.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ def calc_f107a(f107_inst, f107_name='f107', f107a_name='f107a', min_pnts=41):

# Resample to the original frequency, if it is not equal to 1 day
freq = pysat.utils.time.calc_freq(f107_inst.index)
if freq != "86400S":
if freq != "86400s":
# Resample to the desired frequency
if pds.to_timedelta(freq) < pds.to_timedelta("86400S"):
if pds.to_timedelta(freq) < pds.to_timedelta("86400s"):
f107_fill = f107_fill.resample(freq).ffill()
else:
f107_fill = f107_fill.resample(freq).asfreq()
Expand Down
2 changes: 1 addition & 1 deletion pysatSpaceWeather/instruments/methods/kp_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def calc_daily_Ap(ap_inst, ap_name='3hr_ap', daily_name='Ap',
if tt.hour == 21]])

# Backfill this data
ap_data = ap_sel.resample('3H').bfill()
ap_data = ap_sel.resample('3h').bfill()

# Save the output for the original time range
ap_inst[daily_name] = pds.Series(ap_data[1:], index=ap_data.index[1:])
Expand Down
6 changes: 3 additions & 3 deletions pysatSpaceWeather/instruments/methods/swpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def solar_geomag_predictions_download(name, date_array, data_path,
# Process the Kp data
hr_strs = ['00-03UT', '03-06UT', '06-09UT', '09-12UT', '12-15UT',
'15-18UT', '18-21UT', '21-00UT']
data_times['kp'] = pds.date_range(pred_times[0], periods=24, freq='3H')
data_times['kp'] = pds.date_range(pred_times[0], periods=24, freq='3h')

for line in kp_raw.split('\n'):
if line.find("Prob_Mid") >= 0:
Expand Down Expand Up @@ -644,7 +644,7 @@ def geomag_forecast_download(name, date_array, data_path,
kp_day2.append(float(cols[-2]))
kp_day3.append(float(cols[-1]))

kp_times = pds.date_range(forecast_date, periods=24, freq='3H')
kp_times = pds.date_range(forecast_date, periods=24, freq='3h')
kp_day = []
for dd in [kp_day1, kp_day2, kp_day3]:
kp_day.extend(dd)
Expand Down Expand Up @@ -785,7 +785,7 @@ def kp_ap_recent_download(name, date_array, data_path, mock_download_dir=None):
sub_aps[i].append(np.int64(ap_sub_lines[i]))

# Create times on 3 hour cadence
kp_times = pds.date_range(times[0], periods=(8 * 30), freq='3H')
kp_times = pds.date_range(times[0], periods=(8 * 30), freq='3h')

# Put both data sets into DataFrames
data = {'kp': pds.DataFrame({'mid_lat_Kp': sub_kps[0],
Expand Down

0 comments on commit c13247c

Please sign in to comment.