Skip to content

Add random seeds to examples for reproducible results#5312

Merged
tomchor merged 11 commits intomainfrom
tc/random-seeds
Mar 1, 2026
Merged

Add random seeds to examples for reproducible results#5312
tomchor merged 11 commits intomainfrom
tc/random-seeds

Conversation

@tomchor
Copy link
Copy Markdown
Member

@tomchor tomchor commented Feb 19, 2026

Closes #5299

  • Add Random.seed!(1234) to all examples that use random functions
  • Include explanatory comments for consistency

Files modified:

  • examples/baroclinic_adjustment.jl
  • examples/convecting_plankton.jl
  • examples/kelvin_helmholtz_instability.jl
  • examples/langmuir_turbulence.jl
  • examples/ocean_wind_mixing_and_convection.jl
  • examples/shallow_water_Bickley_jet.jl
  • examples/spherical_baroclinic_instability.jl
  • examples/tilted_bottom_boundary_layer.jl
  • examples/two_dimensional_turbulence.jl

- Add Random.seed!(1234) to all examples that use random functions
- Include explanatory comments for consistency
- Ensures reproducible results across runs for testing and educational purposes

Files modified:
- examples/baroclinic_adjustment.jl
- examples/convecting_plankton.jl
- examples/kelvin_helmholtz_instability.jl
- examples/langmuir_turbulence.jl
- examples/ocean_wind_mixing_and_convection.jl
- examples/shallow_water_Bickley_jet.jl
- examples/spherical_baroclinic_instability.jl
- examples/tilted_bottom_boundary_layer.jl
- examples/two_dimensional_turbulence.jl

Co-authored-by: Cursor <[email protected]>
@glwagner
Copy link
Copy Markdown
Member

can we use more fun numbers than 1234

@tomchor
Copy link
Copy Markdown
Member Author

tomchor commented Feb 19, 2026

can we use more fun numbers than 1234

Not sure what you mean by fun, but feel free to change the numbers!

@tomchor
Copy link
Copy Markdown
Member Author

tomchor commented Feb 19, 2026

Also, should we try to find a way to have docs fail if one of the examples blows up? At the moment this is a silent failure and we only find out when someone notices it on the docs (like I did for the tilted BBL).

@glwagner
Copy link
Copy Markdown
Member

fun numbers: 42, 314, Oceananigans birthday, your birthday, other cool numbers, years, dates, things that have meaning (1234 does not)

using CUDA
using Random

Random.seed!(1337) # for reproducible results
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Random.seed!(1337) # for reproducible results
Random.seed!(2021) # for reproducible results

the year wagner et al was published!

@tomchor
Copy link
Copy Markdown
Member Author

tomchor commented Mar 1, 2026

It seems CI is failing because something is going on with distributed tests. Since it seems to be unrelated to this PR, I'm merging.

@tomchor tomchor merged commit 1d96495 into main Mar 1, 2026
66 of 70 checks passed
@tomchor tomchor deleted the tc/random-seeds branch March 1, 2026 09:14
@navidcy navidcy added the documentation 📜 The sacred scrolls label Mar 1, 2026
briochemc added a commit to briochemc/Oceananigans.jl that referenced this pull request Mar 1, 2026
* glw/prescribed-free-surface:
  Fix reduced FieldTimeSeries indexing to collapse reduced dimensions
  Add random seeds to examples for reproducible results (CliMA#5312)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation 📜 The sacred scrolls

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tilted boundary layer example failing on docs

4 participants