Skip to content

Modern diag manager does not save time bounds in legacy average_(DT|T1|T2) variables #36

@ceblanton

Description

@ceblanton

Calculating time averages requires the time bounds. Traditionally, FMS history files contained the time bounds information in 3 variables: average_T1, average_T2, and average_DT

average_T1 is the start time for the averaging period (in the same time units as time)
average_T2 is the end time for the averaging period
average_DT is the length of the averaging period, in days

These 3 variables are referenced as a variable attribute in each diagnostic. e.g.

	dis_liq:time_avg_info = "average_T1,average_T2,average_DT" ;

The modern diag manager does not save the time bounds in that non-standard format. It uses the CF convention, which is to point to the time bounds in the "bounds" attribute to time. e.g.

	time:bounds = "time_bnds" ;

The time bounds variable contains the start/end period for each time. https://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#cell-boundaries

double nv(nv) ;
	nv:long_name = "vertex number" ;
double time_bnds(time, nv) ;
	time_bnds:units = "days since 1979-01-01 00:00:00" ;
	time_bnds:long_name = "time axis boundaries" ;

The old diag manager saved both sets of time bounds and the new/modern diag manager saves only the CF standard time bounds.

In some places, the code is looking for average_DT which will need to be updated to be compatible with output from the new/modern diag manager.

grep -RPin average_DT 

gfdlvitals/averagers/cubesphere.py:65:            weights = dset.average_DT.astype("float") * _masked_area
gfdlvitals/averagers/ice.py:139:            weights = dset.average_DT.astype("float")
gfdlvitals/averagers/land_lm4.py:114:                weights = dset.average_DT.astype("float") * _masked_area
gfdlvitals/averagers/latlon.py:60:            weights = dset.average_DT.astype("float") * _masked_area
gfdlvitals/averagers/tripolar.py:65:            weights = dset.average_DT.astype("float") * _masked_area
gfdlvitals/util/average.py:47:    average_dt : np.ma.masked_array
gfdlvitals/util/average.py:67:        average_dt=None,
gfdlvitals/util/average.py:83:        self.average_dt = average_dt
gfdlvitals/util/average.py:122:                    var, axis=0, weights=data_file[0].variables["average_DT"][:]
gfdlvitals/util/average.py:130:                var, axis=0, weights=data_file[0].variables["average_DT"][:]
gfdlvitals/util/average.py:149:                    var, axis=0, weights=fdata.variables["average_DT"][:]
gfdlvitals/util/average.py:159:            var = np.ma.average(var, axis=0, weights=fdata.variables["average_DT"][:])
gfdlvitals/util/average.py:164:            var = np.ma.average(var, axis=0, weights=fdata["average_DT"][:])
gfdlvitals/util/average.py:204:                np.ma.average(_v, axis=0, weights=variable.average_dt),
gfdlvitals/util/extract_ocean_scalar.py:22:    ignore_list = ["time_bounds", "time_bnds", "average_T2", "average_T1", "average_DT"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions