xCDAT / xcdat

An extension of xarray for climate data analysis on structured grids.
https://xcdat.readthedocs.io/en/latest/
Apache License 2.0
119 stars 12 forks source link

[Feature]: Support Climatology bounds #85

Open chengzhuzhang opened 3 years ago

chengzhuzhang commented 3 years ago

Feature request copied from @golaz:

Is your feature request related to a problem? If yes, Please describe

Climatology files have a special type of time bounds:

    double climatology_bounds(time, nbnd) ;
            climatology_bounds:long_name = "time interval endpoints" ;
            climatology_bounds:units = "days since 0001-01-01 00:00:00" ;
            climatology_bounds:calendar = "noleap" ;

While they look like regular bounds, they are more subtle. For more details, see :http://cfconventions.org/cf-conventions/cf-conventions.html

dimensions:
  time=4;
  nv=2;
variables:
  float temperature(time,lat,lon);
    temperature:long_name="surface air temperature";
    temperature:cell_methods="time: minimum within years time: mean over years";
    temperature:units="K";
  double time(time);
    time:climatology="climatology_bounds";
    time:units="days since 1960-1-1";
  double climatology_bounds(time,nv);
data:  // time coordinates translated to date/time format
  time="1960-4-16", "1960-7-16", "1960-10-16", "1961-1-16" ;
  climatology_bounds="1960-3-1",  "1990-6-1",
                     "1960-6-1",  "1990-9-1",
                     "1960-9-1",  "1990-12-1",
                     "1960-12-1", "1991-3-1" ;

Focusing on the first set of bounds: "1960-3-1", "1990-6-1"

The climatology spans the years 1960 to 1990 (inclusive), and the months of March, April, May.

It would be best if xCDAT could handle regular time series bounds, as well as climatology bounds transparently. There will be a need for an auxiliary function that computes the time span between the bounds (to use as weights for time averaging). It’s doable, but a little trickier for climatology bounds.

One additional complexity is that climatology bounds can also apply to diurnal averages.

We want to be able to perform time averaging operations on climatology data just like regular time series data. For example:

If xCDAT is designed in a flexible manner from the on-set, all of that becomes possible without any special treatment. If not, it will be a pain to add later (and lead to a more convoluted and harder to maintain code.

gleckler1 commented 2 years ago

@chengzhuzhang @tomvothecoder I see this is still a low priority. Can we briefly discuss this at the next meeting?

tomvothecoder commented 2 years ago

Sure @gleckler1, I added this item to the agenda

tomvothecoder commented 2 years ago

Notes from meeting (6/22):

tomvothecoder commented 9 months ago

http://cfconventions.org/cf-conventions/cf-conventions.html#cell-boundaries