Private types and functions

Documentation for ClimaOcean.jl's internal interface.

ClimaOcean

Diagnostics

InitialConditions

DataWrangling

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
ClimaOcean.DataWrangling.inpaint_mask!Method
inpaint_mask!(field, mask; max_iter = 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. For the moment, the only option is NearestNeighborInpainting(maxiter), where an average of the valid surrounding values is used maxiter times.
source
ClimaOcean.DataWrangling.propagate_horizontally!Function
propagate_horizontally!(inpainting, field, mask [, tmp_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

ClimaOcean.DataWrangling.ECCO.ECCONetCDFBackendMethod
ECCONetCDFBackend(length; on_native_grid = false, inpainting = NearestNeighborInpainting(Inf))

Represent an ECCO FieldTimeSeries backed by ECCO native netCDF files. Each time instance is stored in an individual file.

source
ClimaOcean.DataWrangling.ECCO.ECCO_field_time_seriesMethod
ECCO_field_time_series(metadata::ECCOMetadata;
                       grid = nothing,
                       architecture = isnothing(grid) ? CPU() : architecture(grid),
                       time_indices_in_memory = 2,
                       time_indexing = Cyclical(),
                       inpainting_iterations = prod(size(metadata)),

Create a field time series object for ECCO data.

Arguments

  • metadata: ECCOMetadata containing information about the ECCO dataset.

Keyword Arguments

  • grid: where ECCO data is interpolated. If nothing, the native ECCO grid is used.

  • architecture: where data is stored. Should only be set if isnothing(grid).

  • 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 ECCO interpolation. The only option is NearestNeighborInpainting(maxiter), where an average of the valid surrounding values is used maxiter times.

source
ClimaOcean.DataWrangling.ECCO.ECCO_timesMethod
ECCO_times(metadata; start_time = metadata.dates[1])

Extract the time values from the given metadata and calculates the time difference from the start time.

Arguments

  • metadata: The metadata containing the date information.
  • start_time: The start time for calculating the time difference. Defaults to the first date in the metadata.

Returns

An array of time differences in seconds.

source
ClimaOcean.DataWrangling.ECCO.download_datasetMethod
download_dataset(metadata::ECCOMetadata; url = urls(metadata))

Download the dataset specified by ECCOMetadata. If ECCOMetadata.dates is a single date, the dataset is downloaded directly. If ECCOMetadata.dates is a vector of dates, each date is downloaded individually. The data download requires a username and password to be provided in the ECCO_USERNAME and ECCO_PASSWORD environment variables. 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 

Arguments

  • metadata::ECCOMetadata: The metadata specifying the dataset to be downloaded.
source
ClimaOcean.DataWrangling.ECCO.inpainted_ECCO_fieldMethod
inpainted_ECCO_field(metadata::ECCOMetadata;
                     architecture = CPU(),
                     mask = ECCO_mask(metadata, architecture),
                     inpainting = NearestNeighborInpainting(Inf),
                     kw...)

Retrieve the ECCO field corresponding to metadata inpainted to fill all the missing values in the original dataset.

Arguments

  • metadata: the metadata corresponding to the dataset.

Keyword Arguments

  • architecture: either CPU() or GPU().
  • mask: the mask used to inpaint the field, see inpaint_mask!.
  • inpainting: the inpainting algorithm, see inpaint_mask!. Default: NearestNeighborInpainting(Inf).
source

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. Default is Inf, which means all connected regions are kept.
source

VerticalGrids

ClimaOcean.VerticalGrids.stretched_vertical_facesMethod
stretched_vertical_faces(; surface_layer_Δz = 5.0,
                           surface_layer_height = 100.0,
                           constant_bottom_spacing_depth = Inf,
                           maximum_Δz = Inf,
                           stretching = PowerLawStretching(1.02),
                           rounding_digits = 1,
                           depth = 5000)

Return an array of cell interfaces with surface_layer_Δz spacing in a surface layer of height surface_layer_height, and stretched according to the function stretching(Δz_above, z_above) down to depth. The interfaces extends from Lz = -z[1] to 0 = z[end], where Lz ≥ depth.

The grid spacing Δz is limited to be less than maximum_Δz. The grid is also uniformly-spaced below constant_bottom_spacing_depth.

rounding_digits controls the accuracy with which the grid face positions are saved.

source

OceanSeaIceModels

CrossRealFluxes

ClimaOcean.OceanSeaIceModels.CrossRealmFluxes.LatitudeDependentAlbedoType
LatitudeDependentAlbedo([FT::DataType=Float64]; diffuse = 0.069, direct = 0.011)

Constructs a LatitudeDependentAlbedo object. The albedo of the ocean surface is assumed to be a function of the latitude, obeying the following formula (Large and Yeager, 2009):

α(φ) = α.diffuse - α.direct * cos(2φ)

where φ is the latitude, α.diffuse is the diffuse albedo, and α.direct is the direct albedo.

Arguments

  • FT::DataType: The data type of the albedo values. Default is Float64.

Keyword Arguments

  • diffuse: The diffuse albedo value. Default is 0.069.
  • direct: The direct albedo value. Default is 0.011.
source
ClimaOcean.OceanSeaIceModels.CrossRealmFluxes.RadiationType
Radiation([arch = CPU(), FT=Float64];
          ocean_emissivity = 0.97,
          sea_ice_emissivity = 1.0,
          ocean_albedo = LatitudeDependentAlbedo(FT),
          sea_ice_albedo = 0.7,
          stefan_boltzmann_constant = 5.67e-8)

Constructs a Radiation object that represents the radiation properties of the ocean and sea ice.

Arguments

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

Keyword Arguments

  • ocean_emissivity: The emissivity of the ocean surface. Default: 0.97.
  • sea_ice_emissivity: The emissivity of the sea ice surface. Default: 1.0.
  • ocean_albedo: The albedo of the ocean surface. Default: LatitudeDependentAlbedo(FT).
  • sea_ice_albedo: The albedo of the sea ice surface. Default: 0.7.
  • stefan_boltzmann_constant: The Stefan-Boltzmann constant. Default: 5.67e-8.
source
ClimaOcean.OceanSeaIceModels.CrossRealmFluxes.SimilarityTheoryTurbulentFluxesType
SimilarityTheoryTurbulentFluxes(FT::DataType = Float64;
                                gravitational_acceleration = default_gravitational_acceleration,
                                von_karman_constant = convert(FT, 0.4),
                                turbulent_prandtl_number = convert(FT, 1),
                                gustiness_parameter = convert(FT, 6.5),
                                stability_functions = default_stability_functions(FT),
                                thermodynamics_parameters = PATP(FT),
                                water_vapor_saturation = ClasiusClapyeronSaturation(),
                                water_mole_fraction = convert(FT, 0.98),
                                roughness_lengths = default_roughness_lengths(FT),
                                similarity_profile_type = LogarithmicSimilarityProfile(),
                                bulk_velocity = RelativeVelocity(),
                                tolerance = 1e-8,
                                maxiter = 100,
                                fields = nothing)

SimilarityTheoryTurbulentFluxes contains parameters and settings to calculate sea-air turbulent fluxes using Monin-Obukhov similarity theory.

Keyword Arguments

  • gravitational_acceleration: The gravitational acceleration. Default: default_gravitational_acceleration.
  • von_karman_constant: The von Karman constant. Default: 0.4.
  • turbulent_prandtl_number: The turbulent Prandtl number. Default: 1.
  • gustiness_parameter: The gustiness parameter that accounts for low wind speed areas. Default: 6.5.
  • stability_functions: The stability functions. Default: default_stability_functions(FT) that follow the formulation of Edson et al. (2013).
  • thermodynamics_parameters: The thermodynamics parameters used to calculate atmospheric stability and saturation pressure. Default: PATP(FT), alias for PrescribedAtmosphereThermodynamicsParameters.
  • water_vapor_saturation: The water vapor saturation law. Default: ClasiusClapyeronSaturation() that follows the Clasius-Clapyeron pressure formulation.
  • water_mole_fraction: The water mole fraction used to calculate the seawater_saturation_specific_humidity. Default: 0.98, the rest is assumed to be other substances such as chlorine, sodium sulfide, and magnesium.
  • roughness_lengths: The roughness lengths used to calculate the characteristic scales for momentum, temperature and water vapor. Default: default_roughness_lengths(FT), formulation taken from Edson et al (2013).
  • similarity_profile_type: The type of similarity profile used to relate the atmospheric state to the surface fluxes / characteristic scales.
  • bulk_velocity: The velocity used to calculate the characteristic scales. Default: RelativeVelocity() (difference between atmospheric and oceanic speed).
  • tolerance: The tolerance for convergence. Default: 1e-8.
  • maxiter: The maximum number of iterations. Default: 100.
  • fields: The fields to calculate. Default: nothing.
source