Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug-fix: Mom6 time #514

Merged
merged 7 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion models/MOM6/model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -945,14 +945,21 @@ function read_model_time(filename)
integer :: ncid
character(len=*), parameter :: routine = 'read_model_time'
real(r8) :: days
type(time_type) :: mom6_time
integer :: dart_base_date_in_days, dart_days

dart_base_date_in_days = 584388 ! 1601 1 1 0 0
ncid = nc_open_file_readonly(filename, routine)

call nc_get_variable(ncid, 'Time', days, routine)

call nc_close_file(ncid, routine)

read_model_time = set_time(0,int(days))
! MOM6 counts days from year 1
! DART counts days from 1601
dart_days = int(days) - dart_base_date_in_days

read_model_time = set_time(0,dart_days)

end function read_model_time

Expand Down
42 changes: 42 additions & 0 deletions models/MOM6/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,48 @@ Instructions for using MOM6 in CESM are available on the `MOM_interface GitHub W

This DART-MOM6 interface was developed for `MOM6 <https://github.com/NCAR/MOM6>`_ within the CESM framework.

MOM6 time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation is good! Are there other models in CESM that need this info added to their documentation pages? For example, I looked through the CLM documentation, and it doesn't talk about the calendar.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dart shell scripts for CLM, POP, CAM set the CALENDAR.

./xmlchange CALENDAR=GREGORIAN

MOM6 with dart is fairly new (e.g. Robin developing the MOM6-Marble, Alper adding MOM6 multi-instance capability) so I figured it is worth noting in the docs about the calendar.

Maybe it is worth noting about the calendar in the CESM page? @kdraeder what do you think? https://docs.dart.ucar.edu/en/latest/models/CESM/readme.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hkershaw-brown we could move this discussion to email so that we can get this PR approved and released. Especially since the doc changes proposed above could be done in a separate PR. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjs2369 sounds like a plan, lets get this one out.

---------

The default in CESM is to run with no leap years.
To assimilate real observations, we need to switch to the Gregorian
calendar to account for leap years.

.. code-block:: text

./xmlchange CALENDAR=GREGORIAN

To illustrate what happens if you do not set CALENDAR=GREGORIAN, here is
an example where the RUN_STARTDATE is set to 2015-02-01 and MOM6 is run for 10 days.

.. code-block:: text

./xmlchange RUN_STARTDATE=2015-02-01

The MOM6 restart file has the following meta data, where Time is days from year 1.

.. code-block:: text

double Time(Time) ;
Time:long_name = "Time" ;
Time:units = "days" ;
Time:axis = "T" ;
...
// global attributes:
:filename = "./c.T62_g16.ens3.mom6.r.2015-02-11-00000._0001.nc" ;
data:

Time = 735151 ;
}


The absence of leap years gives you inconsistent time information when comparing
to observation times in YYYY-MM-DD:

- Restart filename has the time 2015-02-11-00000.
- The Time variable is Time = 735151 days, which is 2013/10/11


MOM6 checksum of restart files
------------------------------

Expand Down