Skip to content

Use double precision for time bounds#101

Open
blimlim wants to merge 3 commits into
masterfrom
96-time_bounds
Open

Use double precision for time bounds#101
blimlim wants to merge 3 commits into
masterfrom
96-time_bounds

Conversation

@blimlim

@blimlim blimlim commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Closes #96.

Time bounds precision:

The time variable uses double precision while its bounds use single precision. When the time is large relative to the origin, inaccurate bounds can be written to the output files for hourly data. E.g. for ESM1.6:

$ ncdump -h iceh-1hourly-mean_0272-01.nc 
...
 time = "1850-01-01 02", "1850-01-01 03", "1850-01-01 04", "1850-01-01 05", 


$  ncdump -t -v time_bounds iceh-1hourly-mean_1850-01.nc 
 time_bounds =
  "1850-01-01", "1850-01-01 01:30",
  "1850-01-01 01:30", "1850-01-01 03",
  "1850-01-01 03", "1850-01-01 04:30",
  "1850-01-01 04:30", "1850-01-01 04:30",

This PR swaps the time bounds variables to use double precision. With the changes, we get:

 time_bounds =
  "1850-01-01", "1850-01-01 02",
  "1850-01-01 02", "1850-01-01 03",
  "1850-01-01 03", "1850-01-01 04",

Using the release-1deg_jra55_iaf branch for OM2 there aren't any immediate differences in the bounds, as the time origin is much closer to the data:

Without changes

time_bounds =
  "1958-01-01", "1958-01-01 03",
  "1958-01-01 03", "1958-01-01 04:30",
  "1958-01-01 04:30", "1958-01-01 06",

With changes

 time_bounds =
  "1958-01-01", "1958-01-01 03",
  "1958-01-01 03", "1958-01-01 04:30",
  "1958-01-01 04:30", "1958-01-01 06",

Bounds on instantaneous data

For the netCDF io, the lower time bound for single timestep data is also off:

$ ncdump -t -v time_bounds iceh-1-mean_1850-01.nc 
time_bounds =
  "0001-01-01", "1850-01-01 01:30",
  "0001-01-01", "1850-01-01 01:30",
  "0001-01-01", "1850-01-01 03",
  "0001-01-01", "1850-01-01 04:30",
  "0001-01-01", "1850-01-01 04:30",

The io_pio/ice_history_write.F90 code already omits time bounds for histfreq(ns) == 1. This PR copies this change over to io_netcdf/ice_history_write.F90.

Unaddressed issues

There are still a couple of odd things with the hourly data:

  • It seems to skip the first hour:
     ncdump -h iceh-1hourly-mean_1850-01.nc
     time = "1850-01-01 02", "1850-01-01 03", "1850-01-01 04", "1850-01-01 05", 
    
    which might be related to this line. I'm not sure whether we'd like to address this here.
  • Each run produces two output files for hourly output. The second only contains the single timestep at the boundary of the month/year:
    $ ls archive/output000/ice
    i eh-1hourly-mean_1850-01.nc  iceh-1hourly-mean_1850-02.nc  iceh-1monthly-mean_1850-01.nc iceh-1daily-mean_1850-01.nc  iceh-1-mean_1850-01.nc 
    
    Though I'm not sure how much we can do about this.

@blimlim blimlim requested a review from anton-seaice July 1, 2026 01:20
@blimlim blimlim self-assigned this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Time bounds for hourly and snapshot data

1 participant