ESMCI / cime

Common Infrastructure for Modeling the Earth
http://esmci.github.io/cime
Other
161 stars 206 forks source link

Disallow a year zero for start and reference year #3580

Open ekluzek opened 4 years ago

ekluzek commented 4 years ago

Some NetCDF processing tools have trouble with having a year zero. This is because in the BCE, AD calendar there is NOT a year zero. So we should change both the defaults to not have a year zero as well as prevent it being set to zero.

ekluzek commented 4 years ago

@mnlevy1981 and Gary Strand feel this is important. We are pretty sure WACCM already disallows this as well.

mnlevy1981 commented 4 years ago

The issue I see is in the units attribute of the time variable written to netcdf by POP:

$ ncdump -h b.e22b05.B1850.f09_g17.timeseries_output_for_intake.pop.h.0001-01.nc | grep time:[a-z]
        time:long_name = "time" ;
        time:units = "days since 0000-01-01 00:00:00" ;
        time:bounds = "time_bound" ;
        time:calendar = "noleap" ;

I'm unclear on who sets this metadata -- CIME? PIO? The components themselves? Because it looks like CICE output from the same run has different units...

$ ncdump -h b.e22b05.B1850.f09_g17.timeseries_output_for_intake.cice.h.0001-01.nc | grep time:[a-z]
        time:long_name = "model time" ;
        time:units = "days since 0001-01-01 00:00:00" ;
        time:calendar = "noleap" ;
        time:bounds = "time_bounds" ;
ekluzek commented 4 years ago

The behavior I see in cime right now (for branch_tags/cime5.8.24_a01) is that negative start years are get converted to positive numbers, and the reference date is always the start year. This is because it just simply removes the "-" in the strings (so the leading dash gets removed as well). This is done in the scripting level, so any checks on this would need to be done there.

It looks like CAM has some tests that set the start year to 0000 as well (silhs). POP might have this hardcoded in, tavg.F90

mnlevy1981 commented 4 years ago

Although it looks like maybe this is not a big deal as of cf_units 2.0.1 and xarray 0.15.0, as I can now open POP history files without the decode_times=False option.

ekluzek commented 4 years ago

Note, also that for Paleo-work allowing negative years would be something useful to represent BCE periods. But, that's a somewhat different issue than this is.

klindsay28 commented 4 years ago

@mnlevy1981, time:units in POP output is set by POP here. The reference date is hard-coded to be 0000-01-01. time_bound has the same hard-coded units, set here.

billsacks commented 2 years ago

@mnlevy1981 @ekluzek @klindsay28 is this still an issue or should it be closed?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

ekluzek commented 1 year ago

This still should be done. Year zero really shouldn't be allowed.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

klindsay28 commented 1 year ago

Some rationales for not fixing this in POP are

  1. It is highly likely that output generated post-fix would break user's analysis scripts,
  2. We've largely stopped development on POP and SE resources to implement and test this are very thin.

Are there components besides POP that have zero for start and reference year?