[Thread Prev][Thread Next][Index]

Re: [ferret_users]: time interpolation from files with different time axes fails



Hi all,
Fabian and Jaison, thanks for your help.

First: my output quantity has a correct time axis.

But let me try to simplify the problem.

Generate a testfile:

use coads_climatology
set region/x=-20:20/y=-30:10
define axis/t=1-dec-1999:31-jan-2000:6/unit=hours/t0=1-jan-1955/cal=julian time_6
define grid/x=sst/y=sst/t=time_6 xytgrid

let ta=t[gt=xytgrid]+0*(x[gx=xytgrid]+y[gy=xytgrid])
save/clobber/file=ta.nc ta
quit

Start ferret again
use ta.nc
let tair_hour = ta[gt=tdummy@lin]-273.15
define axis/t=1-dec-1999:31-jan-2000:1/unit=hours/t0=1-jan-1955/cal=julian time_hourly
define grid/t=time_hourly tgrid
let tdummy=0*t[gt=tgrid]

Now I can display or save tair_hour (all time steps together) and everything looks fine.

But I wanted to have a gregorian calendar and change the calendar attribute.
DEFINE ATTRIBUTE (`tair_hour[l=1],return=TAXIS`).calendar = "GREGORIAN"

Displaying i.e. shade/i=10 tair_hour looks still fine.

let lmax=500
sp rm tair_h_by_step_greg.nc
DEFINE ATTRIBUTE (`tair_hour[l=1],return=TAXIS`).calendar = "GREGORIAN"
repeat/l=1:`lmax` save/append/file=tair_h_by_step_greg.nc tair_hour
quit

Now one may load tair_h_by_step_greg.nc and finds (time) gaps in the output data. Please note, the gaps appear only if no output operation of tair_hour is done before the data are saved to file.
Otherwise correct data are in the memory cache.

To summarise and to resolve the confusion:
- the error persists, if the calendar is set to gregorian in the time axis definition:
use ta.nc
let tair_hour = ta[gt=tdummy@lin]-273.15
define axis/t=1-dec-1999:31-jan-2000:1/unit=hours/t0=1-jan-1955/cal=gregorian time_hourly
define grid/t=time_hourly tgrid
let tdummy=0*t[gt=tgrid]
let lmax=500
sp rm tair_h_by_step_greg.nc
repeat/l=1:`lmax` save/append/file=tair_h_by_step_greg.nc tair_hour

generates a wrong data set.

Using a julian calendar or saving all time steps together gives a correct data set.
use ta.nc
let tair_hour = ta[gt=tdummy@lin]-273.15
define axis/t=1-dec-1999:31-jan-2000:1/unit=hours/t0=1-jan-1955/cal=julian time_hourly
define grid/t=time_hourly tgrid
let tdummy=0*t[gt=tgrid]
let lmax=500
sp rm tair_h_by_step_greg.nc
repeat/l=1:`lmax` save/append/file=tair_h_by_step_julian.nc tair_hour

Another error is, that for the gregorian case the calendar attribute is missing in the time axis definition. This is required for example by mom4 and additional file
processing is needed.

Hence, the switch between calendar types during interpolation on different time axes is not recommended.
I my happen that errors are introduced.

Best,
Martin






[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement