@@ -14,7 +14,7 @@ import Base: eltype
1414"""
1515 install_veros()
1616
17- Install the Copernicus Marine CLI using CondaPkg.
17+ Install the Veros ocean model Marine CLI using CondaPkg.
1818Returns a NamedTuple containing package information if successful.
1919"""
2020function install_veros ()
@@ -70,7 +70,18 @@ function set!(field::CFField2D, pyarray::Py, k=pyconvert(Int, pyarray.shape[2]))
7070 return field
7171end
7272
73- function veros_ocean_simulation (setup, setup_name)
73+ """
74+ VerosOceanSimulation(setup, setup_name::Symbol)
75+
76+ Creates and initializes a preconfigured Veros ocean simulation using the
77+ specified setup module and setup name.
78+
79+ Arguments
80+ ==========
81+ - `setup::AbstractString`: The name of the Veros setup module to import (e.g., `"global_4deg"`).
82+ - `setup_name::Symbol`: The name of the setup class or function within the module to instantiate (e.g., `:GlobalFourDegreeSetup`).
83+ """
84+ function VerosOceanSimulation (setup, setup_name:: Symbol )
7485 setups = pyimport (" veros.setups." * setup)
7586 setup = @eval $ setups.$ setup_name ()
7687
@@ -80,6 +91,18 @@ function veros_ocean_simulation(setup, setup_name)
8091 return VerosOceanSimulation (setup)
8192end
8293
94+ """
95+ surface_grid(ocean::VerosOceanSimulation)
96+
97+ Constructs a `LatitudeLongitudeGrid` representing the surface grid of the given `VerosOceanSimulation` object.
98+ Notes: Veros always uses a LatitudeLongitudeGrid with 2 halos in both the latitude and longitude directions.
99+ Both latitude and longitude can be either stretched or uniform, depending on the setup, and while the meridional
100+ direction (latitude) is always Bounded, the zonal direction (longitude) can be either Periodic or Bounded.
101+
102+ Arguments
103+ ==========
104+ - `ocean::VerosOceanSimulation`: The ocean simulation object containing the grid state variables.
105+ """
83106function surface_grid (ocean:: VerosOceanSimulation )
84107
85108 xf = Array (PyArray (ocean. setup. state. variables. xu))
@@ -109,20 +132,31 @@ function surface_grid(ocean::VerosOceanSimulation)
109132 return LatitudeLongitudeGrid (size= (Nx, Ny), longitude= xf, latitude= yf, topology= (TX, Bounded, Flat), halo= (2 , 2 ))
110133end
111134
135+ """
136+ veros_set!(ocean, v, x)
137+
138+ Set the `v` variable in the `ocean` model to the value of `x`.
139+ """
112140function veros_set! (ocean:: VerosOceanSimulation , v, x)
113- s = ocean. setup
141+ setup = ocean. setup
114142 pyexec ("""
115143 with setup.state.variables.unlock():
116144 setup.state.variables.__setattr__(y, t)
117- """ , Main, (y= v, t= x, setup= s ))
145+ """ , Main, (y= v, t= x, setup= setup ))
118146end
119147
120- function veros_settings_set! (ocean:: VerosOceanSimulation , v, x)
121- s = ocean. setup
148+
149+ """
150+ veros_settings_set!(ocean, v, x)
151+
152+ Set the `s` setting in the `ocean` model to the value of `x`.
153+ """
154+ function veros_settings_set! (ocean:: VerosOceanSimulation , s, x)
155+ setup = ocean. setup
122156 pyexec ("""
123157 with setup.state.settings.unlock():
124158 setup.state.settings.__setattr__(y, t)
125- """ , Main, (y= v , t= x, setup= s ))
159+ """ , Main, (y= s , t= x, setup= setup ))
126160end
127161
128162function OceanSeaIceModel (ocean:: VerosOceanSimulation , sea_ice= nothing ;
0 commit comments