NCAR / DART

Data Assimilation Research Testbed
https://dart.ucar.edu/
Apache License 2.0
196 stars 145 forks source link

MOM6 time #494

Closed hkershaw-brown closed 1 year ago

hkershaw-brown commented 1 year ago

The default in CESM is to run with no leap year. For assimilating with real obs, we need to use the actual time.

Todos:

Note on what happens if you don't set CALENDAR=GREGORIAN mom6 restart file has time in days from year 1. Starting the run at 2015-02-01:

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

 Time = 735151 ;
}

If you don't have leap years switched on you end up with inconstant time information like this: Restart filename has the time 2015-02-11-00000. The Time variable is Time = 735151, which is 2013/10/11

hkershaw@cisl-fisher utilities (main) $ git diff gregorian_time.c 
diff --git a/assimilation_code/modules/utilities/gregorian_time.c b/assimilation_code/modules/utilities/gregorian_time.c
index ee6a72f03..e8fccb87d 100644
--- a/assimilation_code/modules/utilities/gregorian_time.c
+++ b/assimilation_code/modules/utilities/gregorian_time.c
@@ -20,7 +20,7 @@
 #include <stdlib.h>

 /* the start of gregorian numbered days */
-#define BASE_YEAR 1601
+#define BASE_YEAR 1

 enum todo { TO_YMD, TO_DS };
 enum err  { ERROR, OK };
hkershaw@cisl-fisher utilities (main) $ icc gregorian_time.c ; ./a.out  735151 0
735151     0 == 2013/10/11 00:00:00

https://github.com/NCAR/DART/blob/502af7865e258530cba7c7daff6aed4390cbb649/assimilation_code/modules/assimilation/obs_model_mod.f90#L57-L65

Note the model_time for the whole ensemble is from the first ensemble member only: https://github.com/NCAR/DART/blob/502af7865e258530cba7c7daff6aed4390cbb649/assimilation_code/modules/io/state_vector_io_mod.f90#L288-L292

hkershaw-brown commented 1 year ago

Conclusion from standup July 13th 2023: write_model_time should be dart time for files created by dart.

Existing model netcdf files do not have their time overwritten by dart.

Note there is a overwrite_time_in_output_file = .false. in direct_netcdf_mod.f90 but it is hardcoded to false with this comment:

https://github.com/NCAR/DART/blob/1b76f3afa5978469d6a119710bb638c1c077ae20/assimilation_code/modules/io/direct_netcdf_mod.f90#L137-L151