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

Fixed some show methods #156

Merged
merged 9 commits into from
Nov 8, 2023
Merged

Fixed some show methods #156

merged 9 commits into from
Nov 8, 2023

Conversation

jagoosw
Copy link
Collaborator

@jagoosw jagoosw commented Nov 7, 2023

When I went to update Oceananigans I found these changes I made so thought we might as well merge them first too.

@jagoosw jagoosw requested a review from navidcy November 7, 2023 14:31
Copy link
Collaborator

@navidcy navidcy left a comment

Choose a reason for hiding this comment

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

Some doctests are failing.

Copy link
Collaborator

@navidcy navidcy left a comment

Choose a reason for hiding this comment

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

lgtm

@navidcy
Copy link
Collaborator

navidcy commented Nov 7, 2023

We dropped showing "Optional components" and "Sinking velocities" from model's show methods?

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (37530fc) 65.84% compared to head (1658ddf) 64.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #156      +/-   ##
==========================================
- Coverage   65.84%   64.18%   -1.66%     
==========================================
  Files          27       27              
  Lines        1054     1061       +7     
==========================================
- Hits          694      681      -13     
- Misses        360      380      +20     
Files Coverage Δ
src/Light/2band.jl 88.57% <ø> (ø)
src/Models/AdvectedPopulations/NPZD.jl 87.65% <50.00%> (-1.24%) ⬇️
src/OceanBioME.jl 68.75% <0.00%> (-2.22%) ⬇️
src/Utils/negative_tracers.jl 70.96% <0.00%> (-4.90%) ⬇️
src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl 70.49% <14.28%> (-6.71%) ⬇️

... and 1 file with indirect coverage changes

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

@jagoosw
Copy link
Collaborator Author

jagoosw commented Nov 7, 2023

We dropped showing "Optional components" and "Sinking velocities" from model's show methods?

Where is this? It still shows them here:

show(io::IO, model::LOBSTER{FT, Val{B}, W}) where {FT, B, W} = print(io, string(summary(model), " \n",
" Optional components:", "\n",
" ├── Carbonates $(B[1] ? :✅ : :❌) \n",
" ├── Oxygen $(B[2] ? :✅ : :❌) \n",
" └── Variable Redfield Ratio $(B[3] ? :✅ : :❌)", "\n",
" Sinking Velocities:", "\n", show_sinking_velocities(model.sinking_velocities)))

@navidcy
Copy link
Collaborator

navidcy commented Nov 7, 2023

E.g., look at the changes in docs/src/model_components/biogeochemical/LOBSTER.md I had to do so that the doctests pass. That's what I meant.

@jagoosw
Copy link
Collaborator Author

jagoosw commented Nov 8, 2023

Ah I see, that's because there LOBSTER is wrapped in Biogeochemistry so its only showing the summary of the underlying model:

julia> bgc_model
Lodyc-DAMTP Ocean Biogeochemical Simulation Tools for Ecosystem and Resources (LOBSTER) model (Float64) 
 Light attenuation: Two-band light attenuation model (Float64)
 Sediment: Nothing
 Particles: Nothing

julia> bgc_model.underlying_biogeochemistry
Lodyc-DAMTP Ocean Biogeochemical Simulation Tools for Ecosystem and Resources (LOBSTER) model (Float64) 
 Optional components:
    ├── Carbonates ✅ 
    ├── Oxygen ❌ 
    └── Variable Redfield Ratio ❌
 Sinking Velocities:
    ├── sPOM: 0.0 to -3.47e-5 m/s 
    └── bPOM: 0.0 to -0.0023148148148148147 m/s

Perhaps the summary should include slightly more information? I could change it so the summary includes:

summary(::LOBSTER{FT, Val{B}, W}) where {FT, B, W} = string("Lodyc-DAMTP Ocean Biogeochemical Simulation Tools for Ecosystem and Resources (LOBSTER) model ($FT)\n Optional components: carbonates $(B[1] ? :✅ : :❌), oxygen $(B[2] ? :✅ : :❌), variable Redfield ratio $(B[3] ? :✅ : :❌)")

But then it is quite long. I don't think we really need the sinking velocities in the summary since the details are a lot less important.

@navidcy
Copy link
Collaborator

navidcy commented Nov 8, 2023

I think it’s fine. Just wanted to ensure it wasn’t by accident.

Merge at your convenience.

@jagoosw
Copy link
Collaborator Author

jagoosw commented Nov 8, 2023

I think it’s fine. Just wanted to ensure it wasn’t by accident.

Merge at your convenience.

Ah thank you, just saw this and have changed them a bit so will need to update docstrings

@jagoosw jagoosw mentioned this pull request Nov 8, 2023
@jagoosw jagoosw added enhancement New feature or request package labels Nov 8, 2023
@jagoosw jagoosw merged commit f677df5 into main Nov 8, 2023
2 of 4 checks passed
@jagoosw jagoosw deleted the jsw/fix-shows branch November 8, 2023 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants