Private types and functions

Documentation for ClimaOcean.jl's internal interface.

ClimaOcean

Diagnostics

InitialConditions

DataWrangling

ClimaOcean.DataWrangling.DatasetBackendMethod
DatasetBackend(length, metadata;
               on_native_grid = false,
               cache_inpainted_data = false,
               inpainting = NearestNeighborInpainting(Inf))

Represent a FieldTimeSeries backed by the backend that corresponds to the dataset with metadata (e.g., netCDF). Each time instance is stored in an individual file.

source
ClimaOcean.DataWrangling.NearestNeighborInpaintingType
NearestNeighborInpainting{M}

A structure representing the nearest neighbor inpainting algorithm, where a missing value is substituted with the average of the surrounding valid values. This process is repeated a maximum of maxiter times or until the field is completely inpainted.

source
Oceananigans.Fields.FieldType
Field(metadata::Metadatum;
      architecture = CPU(),
      inpainting = default_inpainting(metadata),
      mask = nothing,
      halo = (7, 7, 7),
      cache_inpainted_data = true)

Return a Field on architecture described by metadata with halo size. If not nothing, the inpainting method is used to fill the cells within the specified mask. mask is set to compute_mask for non-nothing inpainting. Keyword argument cache_inpainted_data dictates whether the inpainted data is cached to avoid recomputing it; default: true.

source
Oceananigans.OutputReaders.FieldTimeSeriesType
FieldTimeSeries(metadata::Metadata [, arch_or_grid=CPU() ];
                time_indices_in_memory = 2,
                time_indexing = Cyclical(),
                inpainting = nothing,
                cache_inpainted_data = true)

Create a FieldTimeSeries from a dataset that corresponds to metadata.

Arguments

  • metadata: Metadata containing information about the dataset.

  • arch_or_grid: Either a grid to interpolate the data to, or an architecture to use for the native grid. Default: CPU().

Keyword Arguments

  • time_indices_in_memory: The number of time indices to keep in memory. Default: 2.

  • time_indexing: The time indexing scheme to use. Default: Cyclical().

  • inpainting: The inpainting algorithm to use for the interpolation. The only option is NearestNeighborInpainting(maxiter), where an average of the valid surrounding values is used maxiter times.

  • cache_inpainted_data: If true, the data is cached to disk after inpainting for later retrieving. Default: true.

source
ClimaOcean.DataWrangling.compute_maskFunction
compute_mask(metadata::Metadatum, dataset_field,
             mask_value = default_mask_value(metadata),
             minimum_value = -1f5,
             maximum_value = 1f5)

A boolean field where true represents a missing value in the dataset_field.

source
ClimaOcean.DataWrangling.download_datasetFunction
download_dataset(metadata; url = urls(metadata))

Download the dataset specified by the metadata::ECCOMetadata. If metadata.dates is a single date, the dataset is downloaded directly. If metadata.dates is a vector of dates, each date is downloaded individually.

Arguments

  • metadata: The metadata specifying the dataset to be downloaded. Available options are metadata for ECCO4, ECCO2, EN4, and JRA55 datasets.
Credential setup requirements for ECCO datasets

For ECCO datasets, the data download requires a username and password to be provided in the ECCO_USERNAME and ECCO_PASSWORD environment variables respectively. This can be done by exporting the environment variables in the shell before running the script, or by launching julia with

ECCO_USERNAME=myusername ECCO_PASSWORD=mypassword julia

or by invoking

julia> ENV["ECCO_USERNAME"] = "myusername"

julia> ENV["ECCO_PASSWORD"] = "mypassword"

within julia.

source
ClimaOcean.DataWrangling.inpaint_mask!Method
inpaint_mask!(field, mask; inpainting=NearestNeighborInpainting(Inf))

Inpaint field within mask, using values outside mask. In other words, regions where mask[i, j, k] == 1 is inpainted and regions where mask[i, j, k] == 0 are preserved.

Arguments

  • field: Field to be inpainted.

  • mask: Boolean-valued Field, values where mask[i, j, k] == true are inpainted.

  • inpainting: The inpainting algorithm to use. The only option is NearestNeighborInpainting(maxiter), where an average of the valid surrounding values is used maxiter times. Default: NearestNeighborInpainting(Inf).

source
ClimaOcean.DataWrangling.native_timesMethod
native_times(metadata; start_time=first(metadata).dates)

Extract the time values from the given metadata, calculate the time difference from the start_time, and return an array of time differences in seconds.

Argument

  • metadata: The metadata containing the date information.

Keyword Argument

  • start_time: The start time for calculating the time difference. Defaults to the first date in the metadata.
source
ClimaOcean.DataWrangling.netrc_downloaderMethod
netrc_downloader(username, password, machine, dir)

Create a downloader that uses a netrc file to authenticate with the given machine. This downloader writes the username and password in a file named auth.netrc (for Unix) and auth_netrc (for Windows), located in the directory dir. To avoid leaving the password on disk after the downloader has been used, it is recommended to initialize the downloader in a temporary directory, which will be removed after the download is complete.

For example:

mktempdir(dir) do tmp
    dowloader = netrc_downloader(username, password, machine, tmp)
    Downloads.download(fileurl, filepath; downloader)
end
source
ClimaOcean.DataWrangling.propagate_horizontally!Function
propagate_horizontally!(inpainting, field, mask [, substituting_field=deepcopy(field)])

Horizontally propagate the values of field into the mask. In other words, cells where mask[i, j, k] == false are preserved, and cells where mask[i, j, k] == true are painted over.

The first argument inpainting is the inpainting algorithm to use in the _propagate_field! step.

source

ECCO

EN4

JRA55

Bathymetry

ClimaOcean.Bathymetry.remove_minor_basins!Method
remove_minor_basins!(z_data, keep_major_basins)

Remove independent basins from the bathymetry data stored in z_data by identifying connected regions below sea level. Basins are removed from smallest to largest until only keep_major_basins remain.

Arguments

  • z_data: A 2D array representing the bathymetry data.
  • keep_major_basins: The maximum number of connected regions to keep. If Inf is provided then all connected regions are kept.
source

VerticalGrids

OceanSeaIceModels

InterfaceComputations

ClimaOcean.OceanSeaIceModels.InterfaceComputations.EdsonMomentumStabilityFunctionType
EdsonMomentumStabilityFunction{FT}

A struct representing the momentum stability function detailed in Edson et al (2013). The formulation hinges on the definition of three different functions: one for stable atmospheric conditions $(ζ > 0)$, named $ψₛ$ and two for unstable conditions, named $ψᵤ₁$ and $ψᵤ₂$. These stability functions are obtained by regression to experimental data.

The stability parameter for stable atmospheric conditions is defined as

\[dζ = min(ζmax, Aˢζ) ψₛ = - Bˢ * ζ⁺ - Cˢ * (ζ⁺ - Dˢ) * exp(- dζ) - Cˢ * Dˢ\]

While the stability parameter for unstable atmospheric conditions is calculated as a function of the two individual stability functions as follows

\[fᵤ₁ = √√(1 - Aᵘζ) ψᵤ₁ = Bᵘ / 2 ⋅ log((1 + fᵤ₁ + fᵤ₁² + fᵤ₁³) / Bᵘ) - √Bᵘ atan(fᵤ₁) - Cᵘ fᵤ₂ = ∛(1 - Dᵘζ) ψᵤ₂ = Eᵘ / 2 ⋅ log((1 + fᵤ₂ + fᵤ₂²) / Eᵘ) - √Eᵘ atan( (1 + 2fᵤ₂) / √Eᵘ) + Fᵘ f = ζ² / (1 + ζ²) ψᵤ = (1 - f) ψᵤ₁ + f ψᵤ₂\]

The superscripts $ˢ$ and $ᵘ$ indicate if the parameter applies to the stability function for stable or unstable atmospheric conditions, respectively.

source
ClimaOcean.OceanSeaIceModels.InterfaceComputations.EdsonScalarStabilityFunctionType
EdsonScalarStabilityFunction{FT}

A struct representing the scalar stability function detailed in Edson et al (2013). The formulation hinges on the definition of three different functions: one for stable atmospheric conditions $(ζ > 0)$, named $ψₛ$ and two for unstable conditions, named $ψᵤ₁$ and $ψᵤ₂$. These stability functions are obtained by regression to experimental data.

The stability parameter for stable atmospheric conditions is defined as

\[dζ = min(ζmax, Aˢζ) ψₛ = - (1 + Bˢ ζ) ^ Cₛ - Bˢ ( ζ - Dˢ ) * exp( - dζ) - Eˢ\]

While the stability parameter for unstable atmospheric conditions is calculated as a function of the two individual stability functions as follows

\[fᵤ₁ = √(1 - Aᵘζ) ψᵤ₁ = Bᵘ ⋅ log((1 + fᵤ₁) / Bᵘ) + Cᵤ fᵤ₂ = ∛(1 - Dᵘζ) ψᵤ₂ = Eᵘ / 2 ⋅ log((1 + fᵤ₂ + fᵤ₂²) / Eᵘ) - √Eᵘ atan( (1 + 2fᵤ₂) / √Eᵘ) + Fᵘ f = ζ² / (1 + ζ²) ψᵤ = (1 - f) ψᵤ₁ + f ψᵤ₂\]

The superscripts $ˢ$ and $ᵘ$ indicate if the parameter applies to the stability function for stable or unstable atmospheric conditions, respectively.

source
ClimaOcean.OceanSeaIceModels.InterfaceComputations.LogarithmicSimilarityProfileType
LogarithmicSimilarityProfile()

Represent the classic Monin-Obukhov similarity profile, which finds that

\[ϕ(z) = Π(z) ϕ★ / ϰ\]

where $ϰ$ is the Von Karman constant, $ϕ★$ is the characteristic scale for $ϕ$, and $Π$ is the "similarity profile",

\[Π(h) = log(h / ℓ) - ψ(h / L) + ψ(ℓ / L)\]

which is a logarithmic profile adjusted by the stability function $ψ$ and dependent on the Monin-Obukhov length $L$ and the roughness length $ℓ$.

source
ClimaOcean.OceanSeaIceModels.InterfaceComputations.MomentumRoughnessLengthType
MomentumRoughnessLength(FT = Float64;
                        gravitational_acceleration = default_gravitational_acceleration,
                        maximum_roughness_length = 1.0,
                        air_kinematic_viscosity = TemperatureDependentAirViscosity(FT),
                        gravity_wave_parameter = 0.011,
                        laminar_parameter = 0.11)

Construct a MomentumRoughnessLength object that represents the momentum roughness length that regulates the exchange of momentum, heat, and water vapor between the ocean and the atmosphere.

Keyword Arguments

  • gravitational_acceleration: The gravitational acceleration. Default: default_gravitational_acceleration.
  • maximum_roughness_length: The maximum roughness length. Default: 1.0.
  • air_kinematic_viscosity: The air kinematic viscosity. Default: TemperatureDependentAirViscosity(FT).
  • gravity_wave_parameter: The wave parameter. Default: 0.011.
  • laminar_parameter: The laminar parameter. Default: 0.11.
source
ClimaOcean.OceanSeaIceModels.InterfaceComputations.ScalarRoughnessLengthType
ScalarRoughnessLength(FT = Float64;
                      air_kinematic_viscosity = temperature_dependent_viscosity,
                      reynolds_number_scaling_function = empirical_scaling_function,
                      maximum_roughness_length = 1.6e-4)

Constructs a ScalarRoughnessLength object that represents the scalar roughness length that regulates the exchange of heat and water vapor between the ocean and the atmosphere.

Keyword Arguments

  • air_kinematic_viscosity::Function: The function to compute the air kinematic viscosity.
  • reynolds_number_scaling_function::Function: The function to compute the Reynolds number scaling factor.
  • maximum_roughness_length::Float: The maximum roughness length value. Defaults to 1.6e-4.
source
ClimaOcean.OceanSeaIceModels.InterfaceComputations.TabulatedAlbedoType
TabulatedAlbedo(arch = CPU(), FT = Float64;
                S₀ = convert(FT, 1365),
                α_table  = α_payne,
                φ_values = (0:2:90) ./ 180 * π,
                𝓉_values = 0:0.05:1)

Constructs a TabulatedAlbedo object that interpolated the albedo from a value table α_table that is function of latitude φ and atmospheric transimissivity 𝓉.

Note: TabulatedAlbedo assumes that the latitude and the transissivity in the table are uniformly spaced.

The transmissivity of the atmosphere is calculated as the ratio of the downwelling solar radiation to the maximum possible downwelling solar radiation for a transparent atmosphere, function of hour of the day, latitude, and day in the year.

Arguments

  • arch: The architecture to use. Default: CPU().
  • FT: The floating-point type to use. Default: Float64.

Keyword Arguments

  • S₀: The solar constant. Default: convert(FT, 1365).
  • α_table: The table of albedo values. Default: α_payne.
  • φ_values: The latitude values for the table. Default: (0:2:90) ./ 180 * π.
  • 𝓉_values: The transmissivity values for the table. Default: 0:0.05:1.
source
ClimaOcean.OceanSeaIceModels.InterfaceComputations.buoyancy_scaleMethod
buoyancy_scale(θ★, q★, 𝒬, ℂ, g)

Return the characteristic buoyancy scale b★ associated with the characteristic temperature θ★, specific humidity scale q★, surface thermodynamic state 𝒬, thermodynamic parameters , and gravitational acceleration g.

The buoyancy scale is defined in terms of the interface buoyancy flux,

\[u★ b★ ≡ w′b′,\]

where u★ is the friction velocity. Using the definition of buoyancy for non-condensing air, we find that

\[b★ = g / 𝒯ₛ * (θ★ * (1 + δ * qₐ) + δ * 𝒯ₛ * q★),\]

where $𝒯ₐ$ is the virtual temperature at the surface, and $δ = Rᵥ / R_d - 1$, where $Rᵥ$ is the molar mass of water vapor and $R_d$ is the molar mass of dry air.

Note that the Monin-Obukhov characteristic length scale is defined in terms of b★ and additionally the Von Karman constant ϰ,

\[L★ = - u★² / ϰ b★ .\]

source
ClimaOcean.OceanSeaIceModels.InterfaceComputations.iterate_interface_stateMethod
iterate_interface_state(flux_formulation, Ψₛⁿ⁻¹, Ψₐ, Ψᵢ, Qᵣ, ℙₛ, ℙₐ, ℙᵢ)

Return the nth iterate of the interface state Ψₛⁿ computed according to the flux_formulation, given the interface state at the previous iterate Ψₛⁿ⁻¹, as well as the atmosphere state Ψₐ, the interior state Ψᵢ, downwelling radiation Qᵣ, and the interface, atmosphere, and interior properties ℙₛ, ℙₐ, and ℙᵢ.

source