namespace mom_diag_remap

Overview

provides runtime remapping of diagnostics to z star, sigma and rho vertical coordinates. More…

namespace mom_diag_remap {

// global functions

subroutine, public diag_remap_init(remap_cs remap_cs, coord_tuple coord_tuple);
subroutine, public diag_remap_end(remap_cs remap_cs);
subroutine, public diag_remap_diag_registration_closed(remap_cs remap_cs);
subroutine, public diag_remap_set_active(remap_cs remap_cs);
subroutine, public diag_remap_configure_axes(remap_cs remap_cs, GV GV, US US, param_file param_file);

subroutine, public diag_remap_get_axes_info(
    remap_cs remap_cs,
    nz nz,
    id_layer id_layer,
    id_interface id_interface
    );

logical function, public diag_remap_axes_configured(remap_cs remap_cs);

subroutine, public diag_remap_update(
    remap_cs remap_cs,
    G G,
    GV GV,
    US US,
    h h,
    T T,
    S S,
    eqn_of_state eqn_of_state
    );

subroutine, public diag_remap_do_remap(
    remap_cs remap_cs,
    G G,
    GV GV,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    mask mask,
    missing_value missing_value,
    field field,
    remapped_field remapped_field
    );

subroutine, public diag_remap_calc_hmask(remap_cs remap_cs, G G, mask mask);

subroutine, public vertically_reintegrate_diag_field(
    remap_cs remap_cs,
    G G,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    mask mask,
    missing_value missing_value,
    field field,
    reintegrated_field reintegrated_field
    );

subroutine, public vertically_interpolate_diag_field(
    remap_cs remap_cs,
    G G,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    mask mask,
    missing_value missing_value,
    field field,
    interpolated_field interpolated_field
    );

subroutine, public horizontally_average_diag_field(
    G G,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    is_layer is_layer,
    is_extensive is_extensive,
    missing_value missing_value,
    field field,
    averaged_field averaged_field,
    averaged_mask averaged_mask
    );

} // namespace mom_diag_remap

Detailed Documentation

provides runtime remapping of diagnostics to z star, sigma and rho vertical coordinates.

The diag_remap_ctrl type represents a remapping of diagnostics to a particular vertical coordinate. The module is used by the diag mediator module in the following way:

  1. diag_remap_init() is called to initialize a diag_remap_ctrl instance.

  2. diag_remap_configure_axes() is called to read the configuration file and set up the vertical coordinate / axes definitions.

  3. diag_remap_get_axes_info() returns information needed for the diag mediator to define new axes for the remapped diagnostics.

  4. diag_remap_update() is called periodically (whenever h, T or S change) to either create or update the target remapping grids.

  5. diag_remap_do_remap() is called from within a diag post() to do the remapping before the diagnostic is written out.

Global Functions

subroutine, public diag_remap_init(remap_cs remap_cs, coord_tuple coord_tuple)

Initialize a diagnostic remapping type with the given vertical coordinate.

Parameters:

remap_cs

Diag remapping control structure

coord_tuple

A string in form of MODULE_SUFFIX PARAMETER_SUFFIX COORDINATE_NAME

subroutine, public diag_remap_end(remap_cs remap_cs)

De-init a diagnostic remapping type. Free allocated memory.

Parameters:

remap_cs

Diag remapping control structure

subroutine, public diag_remap_diag_registration_closed(remap_cs remap_cs)

Inform that all diagnostics have been registered. If _set_active() has not been called on the remapping control structure will be disabled. This saves time in the case that a vertical coordinate was configured but no diagnostics which use the coordinate appeared in the diag_table.

Parameters:

remap_cs

Diag remapping control structure

subroutine, public diag_remap_set_active(remap_cs remap_cs)

Indicate that this remapping type is actually used by the diag manager. If this is never called then the type will be disabled to save time. See further explanation with diag_remap_registration_closed.

Parameters:

remap_cs

Diag remapping control structure

subroutine, public diag_remap_configure_axes(
    remap_cs remap_cs,
    GV GV,
    US US,
    param_file param_file
    )

Configure the vertical axes for a diagnostic remapping control structure. Reads a configuration parameters to determine coordinate generation.

Parameters:

remap_cs

Diag remap control structure

gv

ocean vertical grid structure

us

A dimensional unit scaling type

param_file

Parameter file structure

subroutine, public diag_remap_get_axes_info(
    remap_cs remap_cs,
    nz nz,
    id_layer id_layer,
    id_interface id_interface
    )

Get layer and interface axes ids for this coordinate Needed when defining axes groups.

Parameters:

remap_cs

Diagnostic coordinate control structure

nz

Number of vertical levels for the coordinate

id_layer

1D-axes id for layer points

id_interface

1D-axes id for interface points

logical function, public diag_remap_axes_configured(remap_cs remap_cs)

Whether or not the axes for this vertical coordinated has been configured. Configuration is complete when diag_remap_configure_axes() has been successfully called.

Parameters:

remap_cs

Diagnostic coordinate control structure

subroutine, public diag_remap_update(
    remap_cs remap_cs,
    G G,
    GV GV,
    US US,
    h h,
    T T,
    S S,
    eqn_of_state eqn_of_state
    )

Build/update target vertical grids for diagnostic remapping.

The target grids need to be updated whenever sea surface height or layer thicknesses changes. In the case of density-based coordinates then technically we should also regenerate the target grid whenever T/S change.

Parameters:

remap_cs

Diagnostic coordinate control structure

g

The ocean’s grid type

gv

ocean vertical grid structure

us

A dimensional unit scaling type

h

New thickness

t

New T

s

New S

eqn_of_state

A pointer to the equation of state

subroutine, public diag_remap_do_remap(
    remap_cs remap_cs,
    G G,
    GV GV,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    mask mask,
    missing_value missing_value,
    field field,
    remapped_field remapped_field
    )

Remap diagnostic field to alternative vertical grid.

Parameters:

remap_cs

Diagnostic coodinate control structure

g

Ocean grid structure

gv

ocean vertical grid structure

h

The current thicknesses

staggered_in_x

True is the x-axis location is at u or q points

staggered_in_y

True is the y-axis location is at v or q points

mask

A mask for the field

missing_value

A missing_value to assign land/vanished points

field

The diagnostic field to be remapped

remapped_field

Field remapped to new coordinate

subroutine, public diag_remap_calc_hmask(remap_cs remap_cs, G G, mask mask)

Calculate masks for target grid.

Parameters:

remap_cs

Diagnostic coodinate control structure

g

Ocean grid structure

mask

h-point mask for target grid

subroutine, public vertically_reintegrate_diag_field(
    remap_cs remap_cs,
    G G,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    mask mask,
    missing_value missing_value,
    field field,
    reintegrated_field reintegrated_field
    )

Vertically re-grid an already vertically-integrated diagnostic field to alternative vertical grid.

Parameters:

remap_cs

Diagnostic coodinate control structure

g

Ocean grid structure

h

The current thicknesses

staggered_in_x

True is the x-axis location is at u or q points

staggered_in_y

True is the y-axis location is at v or q points

mask

A mask for the field

missing_value

A missing_value to assign land/vanished points

field

The diagnostic field to be remapped

reintegrated_field

Field argument remapped to alternative coordinate

subroutine, public vertically_interpolate_diag_field(
    remap_cs remap_cs,
    G G,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    mask mask,
    missing_value missing_value,
    field field,
    interpolated_field interpolated_field
    )

Vertically interpolate diagnostic field to alternative vertical grid.

Parameters:

remap_cs

Diagnostic coodinate control structure

g

Ocean grid structure

h

The current thicknesses

staggered_in_x

True is the x-axis location is at u or q points

staggered_in_y

True is the y-axis location is at v or q points

mask

A mask for the field

missing_value

A missing_value to assign land/vanished points

field

The diagnostic field to be remapped

interpolated_field

Field argument remapped to alternative coordinate

subroutine, public horizontally_average_diag_field(
    G G,
    h h,
    staggered_in_x staggered_in_x,
    staggered_in_y staggered_in_y,
    is_layer is_layer,
    is_extensive is_extensive,
    missing_value missing_value,
    field field,
    averaged_field averaged_field,
    averaged_mask averaged_mask
    )

Horizontally average field.

Parameters:

g

Ocean grid structure

h

The current thicknesses

staggered_in_x

True if the x-axis location is at u or q points

staggered_in_y

True if the y-axis location is at v or q points

is_layer

True if the z-axis location is at h points

is_extensive

True if the z-direction is spatially integrated (over layers)

missing_value

A missing_value to assign land/vanished points

field

The diagnostic field to be remapped

averaged_field

Field argument horizontally averaged

averaged_mask

Mask for horizontally averaged field