This script was used to normalize time variables in netCDF files for the PDP.
Specifically, the PDP assumes that the reference time stamp given in the units attribute of the time variable is the same as the first timestamp in the data.
It will show up on the portal date selection widget as spanning 1850-2000, not 1950-2100. The right number of days, but the wrong start date.
This is probably because the calendar is generated from a DAS call, which includes only metadata, not the actual timestamps. So the front end has easy access to the time:units attribute, but no access to the actual timestamps.
This script subtracts 100 years (or whatever the offset is) from each timestamp and adds a hundred years to the reference date in the units attribute, so that the reference date is the same as the first timestamp.
After running the script, the above time variable would look like this:
This script was used to normalize time variables in netCDF files for the PDP.
Specifically, the PDP assumes that the reference time stamp given in the units attribute of the time variable is the same as the first timestamp in the data.
So if you load a dataset with this time variable:
It will show up on the portal date selection widget as spanning 1850-2000, not 1950-2100. The right number of days, but the wrong start date.
This is probably because the calendar is generated from a DAS call, which includes only metadata, not the actual timestamps. So the front end has easy access to the time:units attribute, but no access to the actual timestamps.
This script subtracts 100 years (or whatever the offset is) from each timestamp and adds a hundred years to the reference date in the units attribute, so that the reference date is the same as the first timestamp.
After running the script, the above time variable would look like this: