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

Combine data bugfix #146

Merged
merged 5 commits into from
Aug 14, 2024
Merged

Combine data bugfix #146

merged 5 commits into from
Aug 14, 2024

Conversation

aburrell
Copy link
Member

@aburrell aburrell commented Aug 14, 2024

Description

Addresses #142 by removing the assumption that all instruments will have downloaded files that can be queried.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

First, go and delete any data present in these instrument directories.

import datetime as dt
import pysat
import pysatSpaceWeather as pysw

pred = pysat.Instrument(inst_module=pysw.instruments.sw_kp, tag='prediction')
rec = pysat.Instrument(inst_module=pysw.instruments.sw_kp, tag='recent')
start = dt.datetime(2023, 12, 1)
stop = dt.datetime(2024, 2, 1)

kp = pysw.instruments.methods.kp_ap.combine_kp(now, pred, start=start, stop=stop)

forecast = pysat.Instrument(inst_module=pysw.instruments.sw_f107, tag='forecast')
daily = pysat.Instrument(inst_module=pysw.instruments.sw_f107, tag='daily')

f107 = pysw.instruments.methods.f107.combine_f107(daily, forecast, start=start, stop=stop)

With these changes, you will have instruments that have an index and only fill values. Without these changes, you'll get some sort of Exception.

Test Configuration

  • Operating system: OS X Big Sur
  • Version number: Python 3.10
  • Any details about your local setup that are relevant: develop branch of pysat

Checklist:

  • Make sure you are merging into the develop (not main) branch
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Add a note to CHANGELOG.md, summarizing the changes

If this is a release PR, replace the first item of the above checklist with the
release checklist on the pysat wiki:
https://github.com/pysat/pysat/wiki/Checklist-for-Release

Fixed a bug in `combine_kp` that assumed Instruments would always have downloaded files.
Fixed a bug in `combine_f107` that assumed Instruments would always have downloaded files.
Added unit tests for the `combine_kp` and `combine_f107` methods that ensure they work for instruments without downloaded files.
Added a summary of this bugfix to the changelog.
@aburrell aburrell added this to the 0.2.0 milestone Aug 14, 2024
@aburrell aburrell linked an issue Aug 14, 2024 that may be closed by this pull request
@aburrell aburrell requested a review from jklenzing August 14, 2024 16:59
@aburrell aburrell added the bug Something isn't working label Aug 14, 2024
@aburrell aburrell merged commit 98b971f into develop Aug 14, 2024
28 of 30 checks passed
@aburrell aburrell deleted the combine_data_bugfix branch August 14, 2024 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: improve no data in combine_f107 and combine_kp
2 participants