Skip to content

Added Space Weather Data loader module#1306

Open
carlo98 wants to merge 1 commit intoAVSLab:developfrom
carlo98:feature/space_weather_data_loader
Open

Added Space Weather Data loader module#1306
carlo98 wants to merge 1 commit intoAVSLab:developfrom
carlo98:feature/space_weather_data_loader

Conversation

@carlo98
Copy link
Contributor

@carlo98 carlo98 commented Mar 5, 2026

  • Tickets addressed: nd
  • Review: By file
  • Merge strategy: Merge (no squash)

Description

Implements the spaceWeatherData Basilisk simulation module, which reads a CelesTrak-style space-weather CSV file and publishes the 23 SwDataMsgPayload output messages required by the msisAtmosphere module.

Key implementation details reviewers should be aware of:

  • Date arithmetic: The module converts a Gregorian calendar date from the linked EpochMsgPayload to a signed Unix day number, which serves as the unique lookup key into the weather table. On each UpdateState call, the BSK simulation time is added to the epoch to derive the current UTC instant, whole-day offset, and the current 3-hour Ap bin index.

  • 23-channel output mapping: Channel 0 maps AP_AVG for the current day; channels 1-20 map 20 consecutive 3-hour Ap values stepping back one bin at a time (wrapping across day boundaries up to D-3); channel 21 maps F10.7_OBS_CENTER81; channel 22 maps F10.7_OBS from the previous day.

  • loadSpaceWeatherFile validation pipeline: Opens the file, checks all required columns (DATE, AP1-AP8, AP_AVG, F10.7_OBS, F10.7_OBS_CENTER81), parses rows until the first unparseable line (intentionally stops before the predicted section that omits AP values), and enforces strictly ascending, duplicate-free DATE values. Any failure throws an error.

  • Reset guard: At Reset, the module verifies that the simulation start date and its three preceding days are all present in the loaded table. A BSK_ERROR is emitted immediately rather than failing silently at runtime. A zero-state message is always published at Reset.

  • Task ordering requirement: swModule must be added to the task before atmoModule (or given higher priority) so output messages are written before the atmosphere module reads them within the same step.

  • No interpolation: All indices are taken directly from the nearest table row; no temporal interpolation is performed.

Verification

  • Unit tests cover the full date-arithmetic pipeline against known reference dates.
  • Integration tests load a trimmed CelesTrak CSV fixture and verify all 23 output message values against hand-computed expected indices for a fixed simulation epoch.
  • Tests confirm that missing columns, duplicate dates, unsorted dates, and an unlinked epochInMsg each produce the correct BSK_ERROR log.
  • A run-time warning test verifies that a missing day in the look-up window causes the module to publish the last available state. BSK_WARNING is not checked as it is not thrown.

Documentation

  • New: spaceWeatherData.rst.
  • Reviewers should verify the symbol table, the 23-channel mapping table, and all code snippets in the User Guide section for accuracy against the implementation.

Future work

  • Expose a setFallbackApValue Python setter so users can override the zero-state fallback with a mission-specific quiet-time Ap.
  • Update documentation and examples for all modules that may be consumers of this module. Starting from msisAtmosphere.

@carlo98 carlo98 requested a review from a team as a code owner March 5, 2026 21:39
@carlo98 carlo98 force-pushed the feature/space_weather_data_loader branch 2 times, most recently from 658fb7a to 3797009 Compare March 10, 2026 16:53
@carlo98
Copy link
Contributor Author

carlo98 commented Mar 18, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fdc62418e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

carlo98 added a commit to carlo98/basilisk that referenced this pull request Mar 18, 2026
@carlo98 carlo98 force-pushed the feature/space_weather_data_loader branch from 6fdc624 to 2d31f29 Compare March 18, 2026 20:15
carlo98 added a commit to carlo98/basilisk that referenced this pull request Mar 18, 2026
@carlo98 carlo98 force-pushed the feature/space_weather_data_loader branch from 2d31f29 to f31dbda Compare March 18, 2026 21:08
carlo98 added a commit to carlo98/basilisk that referenced this pull request Mar 18, 2026
@carlo98 carlo98 force-pushed the feature/space_weather_data_loader branch from f31dbda to bec3a73 Compare March 18, 2026 21:21
@carlo98
Copy link
Contributor Author

carlo98 commented Mar 18, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bec3a7372c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@carlo98 carlo98 force-pushed the feature/space_weather_data_loader branch from bec3a73 to d1d7885 Compare March 18, 2026 21:32
@carlo98
Copy link
Contributor Author

carlo98 commented Mar 18, 2026

@codex review

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant