diag_xtype_from_name Function

public function diag_xtype_from_name(name) result(xtype)

Map the &ocean_diag_nml output_precision string onto a NetCDF element type for the diagnostic DATA variables.

  • "double" (default, or anything empty) => NC_WP — the working-precision type, i.e. byte-identical to the writer before this knob existed.
  • "single" => NC_R4 — halves the bytes written per frame.

The value is validated by the namelist schema, so an unknown string should never reach here; it is warned about and falls back to NC_WP (never silently downgrades precision).

This governs the diagnostic stream ONLY. Restart files, gauges, coastal output and the console conservation totals do not consult it and cannot be made single precision.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Return Value integer


Calls

proc~~diag_xtype_from_name~~CallsGraph proc~diag_xtype_from_name diag_xtype_from_name warning warning proc~diag_xtype_from_name->warning

Called by

proc~~diag_xtype_from_name~~CalledByGraph proc~diag_xtype_from_name diag_xtype_from_name proc~open_stream open_stream proc~open_stream->proc~diag_xtype_from_name proc~engine_configure_diag engine_configure_diag proc~engine_configure_diag->proc~open_stream proc~engine_setup engine_setup proc~engine_setup->proc~engine_configure_diag proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Source Code

   function diag_xtype_from_name(name) result(xtype)
      !! Map the `&ocean_diag_nml output_precision` string onto a NetCDF
      !! element type for the diagnostic DATA variables.
      !!
      !!   * `"double"` (default, or anything empty) => `NC_WP` — the
      !!     working-precision type, i.e. byte-identical to the writer
      !!     before this knob existed.
      !!   * `"single"` => `NC_R4` — halves the bytes written per frame.
      !!
      !! The value is validated by the namelist schema, so an unknown
      !! string should never reach here; it is warned about and falls back
      !! to `NC_WP` (never silently downgrades precision).
      !!
      !! This governs the diagnostic stream ONLY.  Restart files, gauges,
      !! coastal output and the console conservation totals do not consult
      !! it and cannot be made single precision.
      character(len=*), intent(in) :: name
      integer :: xtype

      select case (trim(name))
      case ("", "double")
         xtype = NC_WP
      case ("single")
         xtype = NC_R4
      case default
         call logger%warning("&ocean_diag_nml output_precision = '"//trim(name)// &
                             "' not recognised; writing double precision")
         xtype = NC_WP
      end select
   end function diag_xtype_from_name