Skip to content

info routine to display info about the ObsSequence#133

Merged
hkershaw-brown merged 1 commit into
mainfrom
info
Jun 10, 2026
Merged

info routine to display info about the ObsSequence#133
hkershaw-brown merged 1 commit into
mainfrom
info

Conversation

@hkershaw-brown

Copy link
Copy Markdown
Member

repl and str also

fixes #92

Example:

>>> import pydartdiags.obs_sequence.obs_sequence as obsq
>>> obs_seq = obsq.ObsSequence(file=None)
>>> obs_seq
ObsSequence(file=None)
>>> print(obs_seq)
ObsSequence: None
  obs types : []
  copies    : []
  n_obs     : 0
>>> obs_seq.info()
Non-routines (data attributes):
  - all_obs: []
  - copie_names: []
  - default_composite_types: /Users/hkershaw/DART/siparcs/2026/pyDARTdiags/src/pydartdiags/obs_sequence/composite_types.yaml
  - df: DataFrame(0, 0)
  - file: None
  - loc_mod: None
  - n_copies: 0
  - n_non_qc: 0
  - n_qc: 0
  - non_qc_copie_names: []
  - qc_copie_names: []
  - reverse_types: {}
  - reversed_vert: {'undefined': -2, 'surface (m)': -1, 'model level': 1, 'pressure (Pa)': 2, 'height (m)': 3, 'scale height': 4}
  - seq: []
  - synonyms_for_obs: ['NCEP BUFR observation', 'AIRS observation', 'GTSPP observation', 'SST observation', 'observations', 'WOD observation']
  - types: {}
  - vert: {-2: 'undefined', -1: 'surface (m)', 1: 'model level', 2: 'pressure (Pa)', 3: 'height (m)', 4: 'scale height'}

Routines (methods/functions):
  - composite_types
  - create_header
  - create_header_from_dataframe
  - has_assimilation_info
  - has_posterior
  - info
  - join
  - possible_vs_used
  - select_by_dart_qc
  - select_used_qcs
  - update_attributes_from_df
  - write_obs_seq

This example is a black obs seq so boring.

@hkershaw-brown

hkershaw-brown commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

in print(obs_seq) also want loc_mod?

edit added loc mod

@codecov-commenter

codecov-commenter commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.94%. Comparing base (4cea059) to head (46463cc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
+ Coverage   64.13%   64.94%   +0.81%     
==========================================
  Files           5        5              
  Lines        1118     1141      +23     
==========================================
+ Hits          717      741      +24     
+ Misses        401      400       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/pydartdiags/obs_sequence/obs_sequence.py
assert "2" in result # n_obs
assert "loc3d" in result # loc_mod

def test_info(self, obs_seq, capsys):

@mjs2369 mjs2369 Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be worth it to test if more stuff than this is in the return from info()? Even in an empty obs_seq, as shown in the body text of this PR, there should be the full set of data attributes and routines

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes this is exactly what our intern Ira is hitting.
Right now, totally blank.
Should be the required columns. I was thinking it would be good to have Ira do the fix and pull request for a "from scratch" obs seq.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hang on I am mixing up two issues

The test is using
obj = obsq.ObsSequence(file=None)
which is really minimal (i.e. no info). When really it should be the minimum columns (which is what it would be cool to have Ira add).

@mjs2369 mjs2369 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR is good to go; Ira expected to expand on this by testing for the minimum columns returned by info

@hkershaw-brown hkershaw-brown merged commit 482f55d into main Jun 10, 2026
2 checks passed
@hkershaw-brown hkershaw-brown deleted the info branch June 10, 2026 20:17
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.

inspect routine for ObsSequence object?

3 participants