Closed dvalters closed 5 years ago
This is partly due to the way it calculates the header information. If there are no time_bounds
defined in the netcdf file, it defaults to 1850. For example:
y0 = None; yf = None
with Dataset(self.source) as dataset:
if dataset.dimensions.has_key("data"):
#self.hasSites = True
if "site_name" in dataset.ncattrs():
self.lbls = dataset.site_name.split(",")
else:
self.lbls = ["site%d" % s for s in range(len(dataset.dimensions["data"]))]
if dataset.dimensions.has_key("time"):
t = dataset.variables["time"]
if "bounds" in t.ncattrs():
t = dataset.variables[t.bounds][...]
y0 = int(t[ 0,0]/365.+1850.)
yf = int(t[-1,1]/365.+1850.)-1
else:
y0 = int(round(t[ 0]/365.)+1850.)
yf = int(round(t[-1]/365.)+1850.)-1
The HTML is rendered in:
class HtmlLayout():
def __init__(self,pages,cname,years=None):
self.pages = pages
self.cname = cname.replace("/"," / ")
if years is not None:
try:
self.cname += " / %d-%d" % (years)
So you must have a bounds
attribute to your time
variable for this to work.
At the very top of the model output page, the date range is wrong.
Date is presumably(?) calculated from the netCDF variable attributes, but this doesn't seem to work. I.e. if the date is 2001-01-01 it still calculates from 1850.
But other instances of dates are correctly calculated - e.g. from the timeseries output. So it is only the HTML headers that are affected: