Skip to content

diag_data::diag_write_time check for uppercase 'Time' field #2

Description

@wrongkindofdoctor

@thomas-robinson MOM outputs their diagnostic time variable as "Time", rather than "time", leading to a 'variable does not exist' error in diag_write_time after the axis is registered to the file.

The following solution checks the file for the variable called "Time" with the new fms variable_exists function, and sets name_time accordingly if the result is true. This permits the simple ocean-only test case to run to completion:

!> Get the name of the time variable
     if (present(time_name)) then
          allocate(character(len=len(time_name)) :: name_time)
          name_time = time_name
     elseif (variable_exists(fileob,"Time")) then
          allocate(character(len=4) :: name_time)
          name_time = "Time"
     else
          allocate(character(len=4) :: name_time)
          name_time = "time"
     endif

Unless CF guidelines specify string case for axis names, the next iteration of diag_manager should use fms utilities to check for variables and attributes registered to file if necessary before writing data rather than assuming a default name.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions